Commit Graph

56 Commits

Author SHA1 Message Date
Cole Robinson 852d7b564d virtinst: Remove name field validate_cb usage
Either openly do this at callers, or wrap it in a validate() call.
Doing this at set time has always had issues, like the self.replace hack
2018-09-04 14:55:04 -04:00
Daniel P. Berrangé 48e32b429d Fix copyright header to specify GPLv2 or later, not GPLv2 only.
The copyright headers in every file were chjanged in this previous commit

  commit b6dcee8eb7
  Author: Cole Robinson <crobinso@redhat.com>
  Date:   Tue Mar 20 15:00:02 2018 -0400

    Use consistent and minimal license header for every file

Where before this they said "

  "either version 2 of the License, or (at your option) any later version."

Now they just say

  "GNU GPLv2"

This fixes it to say "GNU GPLv2 or later" again.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-04 16:51:37 -04:00
Cole Robinson b6dcee8eb7 Use consistent and minimal license header for every file 2018-03-21 07:29:40 -04:00
Cole Robinson dae8642bb1 xmlbuilder: centralize adding child new child prop instances
Currently the domain CPU class has a child property like:

  siblings = XMLChildProperty(_CPUCellSibling)

If a user wants to add a new sibling, we add a convenience function:

    def add_sibling(self):
        obj = _CPUCellSibling(self.conn)
        self.add_child(obj)
        return obj

Rather than require every child property to define a similar matching
helper function, this adds infrastructure in xmlbuilder to do this
generically for every child property. Now callers can do

    obj = guest.cpu.siblings.add_new()
2018-02-08 14:03:47 -05:00
Cole Robinson 3086c7fda9 Drop python3 compat imports
We are going completely python3
2018-02-06 18:56:15 -05:00
Radostin Stoyanov 5553cbeb38 Replace ipaddr module with ipaddress
The `ipaddress` is available in Python 3.3+ [1] and backport for
Python 2 is available on PyPI [2].

The main differences between ipaddr and ipaddress are:

- ipaddress *Network classes are equivalent to the ipaddr *Network
  class counterparts with the strict flag set to True.
- ipaddress *Interface classes are equivalent to the ipaddr *Network
  class counterparts with the strict flag set to False.
- The factory functions in ipaddress were renamed to disambiguate them
  from classes.
- A few attributes were renamed to disambiguate their purpose as well.
  (eg. network -> network_address, numhosts -> num_addresses)
- A number of methods and functions which returned containers in ipaddr
  now return iterators. This includes subnets, address_exclude,
  summarize_address_range and collapse_address_list.

Another major difference is that in Python 2 the `ipaddress` module
must use unicode. [3]

[1] https://www.python.org/dev/peps/pep-3144/
[2] https://pypi.python.org/pypi/ipaddress
[3] https://github.com/phihag/ipaddress
2018-02-06 18:49:17 -05:00
Radostin Stoyanov 6712261510 Python 2/3 division compatability
In Python 2 the classic devision of integers returns an integer
but in Python 3 it might return float.

Example:
- Python 2:          - Python 3:
    >>> 9 / 4            >>> 9 / 4
    2                    2.25
    >>> 9 // 4           >>> 9 // 4
    2                    2
    >>> 9 / 4.0          >>> 9 / 4.0
    2.25                 2.25
    >>> 9 // 4.0         >>> 9 // 4.0
    2.0                  2.0

For more info see: https://www.python.org/dev/peps/pep-0238/
2018-01-27 15:30:17 -05:00
Chen Hanxiao c92aade081 pycodestyle: fix all E203 warnings
Fix all E203 whitespace before ':'
   Also remove E203 ignore option of pycodestyle

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2017-08-11 00:01:38 +08:00
Radostin Stoyanov b93cc3bbc9 pycodestyle: Do not use bare 'except:'
A bare 'except:' catches all exceptions [1], including SystemExit,
KeyboardInterrupt, and GeneratorExit (which is not an error and should
not normally be caught by user code). In situations where you need to
catch all “normal” errors, you can catch the base class for all normal
exceptions, Exception [2].

[1] https://docs.python.org/2/howto/doanddont.html#except
[2] https://docs.python.org/2/library/exceptions.html#Exception
2017-08-02 13:57:43 -04:00
Cole Robinson 62feeb02a8 Switch to python3 style 'except X as Y' notation
Which also works with python2.7
2017-05-05 14:52:11 -04:00
Lin Ma 733d541624 network: add support for network forward mode 'open'
libvirt added network forward mode 'open' by commit 25e8112d, No any
iptables rules are added to this virtual network.

This patch adds support to create such a virtual network.

Signed-off-by: Lin Ma <lma@suse.com>
2017-05-03 14:15:02 -04:00
Cole Robinson c0a3234633 baseclass: share wizard cursor setting code 2017-04-27 15:00:17 -04:00
Cole Robinson 6d1a3db421 createnet: Cleanups around hostdev UI 2017-04-04 15:20:33 -04:00
Lin Ma 97c8412df6 network: add support to create SR-IOV VF pool
Create a network with a device pool containing all the VFs of an SR-IOV device.

Signed-off-by: Lin Ma <lma@suse.com>
2017-04-03 19:15:11 -04:00
Cole Robinson f4dfb6de9d Fix recent pylint/pep8 output 2016-04-18 16:42:12 -04:00
Robb Manes 5a7ffed25e createnet: Updated error message for IPv6 when checking
The message when using a non-private address when using IPv6 addresses
referred to private IPv4; changed it to indicate IPv6.
2015-09-21 17:05:13 -04:00
Pavel Hrdina 0fbe8e7a1f translation: fix wrong usage of _() function
All the strings have to be at first translated and then we can fill the
formated and translated string.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-06-05 16:33:51 -04:00
Cole Robinson fdad3efe24 uiutil: streamline column vs rowidx parameter name 2015-05-19 18:29:45 -04:00
Cole Robinson 6071ab0ea4 uiutil: Clarify a few ambiguous function names 2015-04-10 15:00:34 -04:00
Cole Robinson 2d25c920ea connection: Use consistent nodedev function names 2015-04-10 15:00:34 -04:00
Cole Robinson c66bc2a87f connection: Have get_nodedevs return vmmNodeDevice
To make it consistent with similar vmmConnection functionas
2015-04-07 14:12:00 -04:00
Cole Robinson 6a24eb9d30 createnet: Remove unused module 2015-03-26 18:05:38 -04:00
Cole Robinson af562320a5 createnet: Drop incorrect domain name validation (bz 1195873)
Just let libvirt error if something is wrong
2015-03-26 17:11:23 -04:00
Charles Arnold 65f7017eaf createnet: Fix creating network with forward device 2015-01-16 13:30:36 -05:00
Cole Robinson 226c4562d5 virtManager: Switch to relative imports 2014-09-12 16:28:38 -04:00
Chen Hanxiao 658c9500a9 createnet: fix a small pylint
commit f109b1ed6f
used a undefined variable 'PAGE_MAX'.
It looks like it should be in a developing series,
but should be fixed in upstream.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2014-06-27 09:06:14 +02:00
Giuseppe Scrivano f109b1ed6f createnet: validate last page before creating the network
On the last page in the createnet wizard the Next button is changed to
Finish.  Ensure the user input is validated also on this page.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-06-26 15:26:37 +02:00
Giuseppe Scrivano 81bd6bbffb createnet: fix "show_err" typo
s|show_erro|show_err|

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-06-26 15:26:37 +02:00
Giuseppe Scrivano 48be09a997 createnet: use vmmInterface.get_name() instead of vmmInterface.name
It fixes this exception:

Traceback (most recent call last):
  File "virt-manager/virtManager/host.py", line 467, in add_network
    self.addnet.show(self.topwin)
  File "virt-manager/virtManager/createnet.py", line 102, in show
    self.reset_state()
  File "virt-manager/virtManager/createnet.py", line 180, in reset_state
    devnames.append(iface.name)
AttributeError: 'vmmInterface' object has no attribute 'name'

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-06-24 17:14:19 +02:00
Cole Robinson c78974c0d9 connection: Drop netdev abstraction
Just open code it in the one place it's needed. Try to simplify some of
the netlist logic while we are at it. Should fix:

https://bugzilla.redhat.com/show_bug.cgi?id=1109574
2014-06-18 12:41:36 -04:00
Chen Hanxiao 17a11672b1 createnet: enable specify /29 subnet
https://bugzilla.redhat.com/show_bug.cgi?id=1106913

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2014-06-11 09:52:07 +08:00
Cole Robinson aefd4c4824 connection: Use name instead of uuid for object keys
And clean up the API mess while we are at it. Treat the key as an opaque
value that users shouldn't depend on.

Besides the improved code clarity and API layout, this will help diagnose
'key error' issues, since we'll see an object name instead of UUID which
is hard to trace back.
2014-06-02 17:48:32 -04:00
Cole Robinson 139392c093 createnet: Catch too small network prefix (bz 1095347) 2014-05-19 19:23:46 -04:00
Cole Robinson a398d245cb Clean up pylint integration
- Drop no longer needed disable= bits
- Use string names for all skipped pylint messages
2014-04-02 19:00:24 -04:00
Cole Robinson 889ec18031 uiutil: Use list selection helpers everywhere 2014-01-27 10:46:14 -05:00
Cole Robinson 2771511946 uiutil: Make more use of set_combo_text_column 2014-01-26 21:35:42 -05:00
Cole Robinson 708a2737cf Split uihelpers into sharedui and uiutil
Reserve uiutil for the little gtk helper functions, rest goes into shared
UI (which all should probably be factored into their own files but thats
a task for another day)
2014-01-26 18:15:50 -05:00
Cole Robinson 958dea6c5f createnet: Use typical name validation pattern 2014-01-17 18:40:30 -05:00
Cole Robinson 98a95b2e2d network: Add install() command, remove function from vmmConnection
This is the pattern used by other virtinst objects
2013-09-30 15:38:34 -04:00
Cole Robinson fa47586b37 createnet: Use blue header like other wizards 2013-09-27 13:36:22 -04:00
Cole Robinson 85813203dc createnet: Use virtinst.Network for XML generation 2013-09-23 13:49:20 -04:00
Cole Robinson 7e42faab0f createnet: Massive code and UI cleanup
Modernize the UI, simplify the code, etc.
2013-09-23 12:28:05 -04:00
Cole Robinson d338bce329 Rename ui files to match source file names 2013-09-22 16:10:16 -04:00
Cole Robinson 1683d56b8d ui: Set non-stock button images in glade, not explicitly in code 2013-09-22 12:33:02 -04:00
Cole Robinson a7834f5d6c Add Network class for parsing <network> XML
Convert virtManager/host.py, do some cleanups and modernization to the
UI there, add tests.

createnet.py hasn't really been touched yet, but still works because
it was building the XML by hand anyways.
2013-09-22 11:16:07 -04:00
Cole Robinson 7664840e68 createnet: Refresh forward device list when wizard is launched 2013-08-05 17:20:05 -04:00
Cole Robinson 5e9e444dec connection: Do non-VM polling on demand
The goal here is to reduce the amount of tick() polling that we do by default.
For things like pools, networks, and interfaces, the constant polling is
not very helpful and causes CPU churn and slowness for remote connections.

Switch to a more on demand style. Pages that want new information for
these objects now request a priority tick that only refreshes the info
we want.

This isn't perfect, but neither was the previous solution in the face of
things like XML updates behind our back. The real solution here is libvirt
event support across the board.
2013-07-07 12:17:54 -04:00
Cole Robinson 76887c9a32 engine: Switch tick threading model to use queues
And allow other parts of the API to request a priority tick that is
dispatched from the main tick thread.
2013-07-06 21:24:38 -04:00
Martin Kletzander e407c2eac9 Make pylint a bit happier
Various fixes for some pylint and pep8 warnings/errors which are
fixable and cleanup few lines with that.
2013-06-05 10:19:54 +02:00
Cole Robinson 7f621db08f Fix a few wordings recommended by a translator 2013-05-27 13:41:45 -04:00