Commit Graph

110 Commits

Author SHA1 Message Date
Cole Robinson
8bfa04c230 storage: Split apart build_default_pool, and document it 2019-06-11 17:54:45 -04:00
Cole Robinson
6677f677da util: move generate_name to generatename.py 2019-06-07 18:16:53 -04:00
Cole Robinson
5ed8f2aa5f util: move validate_name to XMLBuilder.validate_generic_name 2019-06-07 18:04:12 -04:00
Cole Robinson
c603ea4084 util: Move *_meter to progress.py 2019-06-07 17:32:51 -04:00
Cole Robinson
ca10e4094b util: move is_error_nosupport to SupportCache 2019-06-07 16:49:19 -04:00
Cole Robinson
f85e6def55 support: Convert callers to the new format 2019-06-07 16:26:03 -04:00
Cole Robinson
f47f6f3c7c util: Replace xml_indent with textwrap.indent 2019-06-06 18:11:01 -04:00
Cole Robinson
1cc2a0ae8b storage: Add ensure_pool_is_running
We pretty much require a referenced storage pool to be running if
it's intended to be used as a virt-install or virt-manager requested
disk. So add a helper to start a pool if needed and optionally refresh
it
2019-04-14 20:22:02 -04:00
Cole Robinson
cfd543adb9 storage: more logging when we look up default pool 2019-03-26 11:16:14 -04:00
Cole Robinson
4f66c423f7 cloner: Handle --nonsparse for qcow2 images (bz 1675743)
https://bugzilla.redhat.com/show_bug.cgi?id=1675743
2019-03-04 14:04:34 -05:00
Pavel Hrdina
26a433fc42 virtManager: clone: check which storage pools supports volume cloning
When cloning a guest in virt-manager the GUI shows a list of disks and
select default cloning policy for every disk.  For storage pools where
we know that cloning is not possible we should not select that option
as default one.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1463066

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-03-04 13:23:45 +01:00
Cole Robinson
2f89ecf4a9 Remove Author lines from file headers
Similar to what was done in libvirt. See these commits:

600462834f
c99e954973
2019-01-08 11:45:35 -05:00
Cole Robinson
c0314cad2e storage: Remove needless manage_path wrapper 2018-10-11 19:23:18 -04:00
Cole Robinson
2b7043cd85 createpool: Fix showing formats
But shrink the format list to 'auto' only, but also add a text entry
so users can type their own
2018-09-06 13:28:21 -04:00
Cole Robinson
c5033c02d5 fsdetails: Use combo entry for format list
And stop listing all the crazy qemu formats
2018-09-06 13:28:21 -04:00
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
Cole Robinson
1e76496fa8 storage: remove default_cb usage 2018-09-04 14:55:04 -04:00
Cole Robinson
fb1bb26373 support: Drop lots more checks
- Remove anything for less than qemu 0.12 or libvirt 0.10, basically
  rhel6 vintage stuff
- Open code some simple checks
- Remove some that are only used for unnecessary error reporting
2018-08-31 22:21:15 -04:00
Cole Robinson
ea413be214 xmlbuilder: Rename get_xml_config -> get_xml
The config part is redundant. Should have done this a long time ago
2018-08-31 16:52:02 -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
4b26348290 xmlbuilder: Separate out the property cache
Add a few more mappings to simplify certain lookups, and add
some more validation to prevent programming errors
2018-03-21 14:32:47 -04:00
Cole Robinson
7fb1ddbc18 virtinst: s/_XML_ROOT_NAME/XML_NAME/g
No reason for it to be privatized, could be useful in some cases
2018-03-21 11:17:36 -04:00
Cole Robinson
b6dcee8eb7 Use consistent and minimal license header for every file 2018-03-21 07:29:40 -04:00
Cole Robinson
93c22eff79 xmlbuilder: Move xml_indent to util 2018-03-20 10:35:22 -04:00
Cole Robinson
3d34f6a231 storage: Fix validating empty hosts value (bz #1557942)
https://bugzilla.redhat.com/show_bug.cgi?id=1557942
2018-03-19 10:29:00 -04:00
Radostin Stoyanov
1ae5c4ff75 pylint: Resolve logging-not-lazy
A new Python checker was added to warn about using a + operator inside
call of logging methods when one of the operands is a literal string.

https://pylint.readthedocs.io/en/latest/whatsnew/1.8.html

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-03-03 16:04:12 -05:00
Cole Robinson
3079426c82 virtinst: Drop doc= for properties
This data never gets to the user and largely is just duplicating
libvirt docs. It's redundant
2018-02-22 20:49:07 -05:00
Cole Robinson
6cad350649 storage: Use a threading event to signal progress thread
Much more reactive and saves us time in the test suite
2018-02-22 19:12:23 -05:00
Cole Robinson
d108bbe143 Convert docstrings to standard reStructuredText param format 2018-02-14 11:08:09 -05: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
Radostin Stoyanov
978fb25ac7 Wrap keys(), values() in a list
In Python 3 dict.values() [1] , dict.keys() [2] and dict.items() [3]
return a view [4] of the dictionary’s values, keys and items.

In Python 2 these functions return a list. [5] [6] [7]

To resolve this we can convert the result of these function to a list.

[1] https://docs.python.org/3/library/stdtypes.html#dict.values
[2] https://docs.python.org/3/library/stdtypes.html#dict.keys
[3] https://docs.python.org/3/library/stdtypes.html#dict.items
[4] https://docs.python.org/3/library/stdtypes.html#dict-views
[5] https://docs.python.org/2/library/stdtypes.html#dict.items
[6] https://docs.python.org/2/library/stdtypes.html#dict.keys
[7] https://docs.python.org/2/library/stdtypes.html#dict.values
2018-02-06 18:49:17 -05:00
Rauno Väli
582c1d3ded devicedisk: copy all rbd pool host and auth for volume
(crobinso: add test suite coverage, fix some pylint)
2018-01-30 11:30:22 -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
Cole Robinson
fe59c33772 virtinst: storage: Don't generate UUID by default
Just let libvirt do it for us, it doesn't really add anything
2017-12-14 12:45:01 -05:00
Cole Robinson
8b4befae60 virtinst: Drop UUID validation
It's redundant as libvirt will give us these checks already, and we
aren't even testing it
2017-12-14 12:45:01 -05:00
Chen Hanxiao
7f1b4cee82 pycodestyle: fix all E125 warnings
Fix all E125:
     Continuation line with same indent as next logical line

   Also remove ignore options of E125

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2017-10-21 23:26:16 +08: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
Cole Robinson
c4826444e9 storage: Fix 'srcname' referenced before assignment (bz #1474766)
https://bugzilla.redhat.com/show_bug.cgi?id=1474766
2017-08-03 12:38:37 -04: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
a9903ae0e0 connection: Remove clear_cache callback
It doesn't actually accomplish what we want for the virt-manager case,
and cache_new_pool should cover our needs now
2017-07-20 17:30:37 -04:00
Cole Robinson
4792c7cb8e connection: Add a default impl of cache_new_pool
Inserts it into the cache, and adds its associated volumes too
2017-07-20 17:30:36 -04:00
Cole Robinson
a9d9c0d035 connection: rename s/add_new_pool/cache_new_pool/g
Better describes exactly what's going on
2017-07-20 17:29:55 -04:00
Cole Robinson
5b51c98ae5 storage: Check for pool name collisions against the pool cache
Rather than using storagePoolLookupByName. This will save some API
calls, but the main benefit is that it can help shake out cache
issues.
2017-07-20 17:28:38 -04:00
Cole Robinson
4e7a6ad728 tests: pylint: Silence/fix a bunch of new warnings 2017-06-16 12:54:56 -04:00
Pavel Hrdina
1686511886 virtManager.connection: introduce cb_add_new_pool
The cb_add_new_pool callback will add a newly created storage pool
into virt-manager's cache so we don't have to wait for the libvirt
event to be handled.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1435064

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-05-22 19:43:49 +02:00
Cole Robinson
a90d675394 Switch deprecating log.warn to log.warning
Same semantics, but the alias is deprecated
2017-05-05 14:53:28 -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
Cole Robinson
9c8ffe51da storage: Move alloc/cap validation to validate()
Doing this at property set time is overly noisy. Follow the same
pattern of VirtualDisk and only do this in the validate() function.

https://bugzilla.redhat.com/show_bug.cgi?id=1433239
2017-03-17 12:14:05 -04:00
Pavel Hrdina
82eaf4742e virtinst.storage: improve detection of disk type
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-03-06 14:31:42 -05:00
Cole Robinson
eb2a56f700 util: Move xml_indent to XMLBuilder 2016-08-24 15:56:13 -04:00