Commit graph

107928 commits

Author SHA1 Message Date
Cédric Bosdonnat
62527d052e Add volume disks support to virt.purge()
virt.purge will now remove not only the file disks, but also the disk volumes.
2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
f7e88a79af Add volume support to virt._get_disks
If a virtual machine has disks of volume types, they will now be
reported by the virt._get_disk() function and all the user-exposed
functions using it like virt.get_disks(), virt.vm_info() and
virt.full_info().
2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
a7218588ae Add virt.volume_defined state
In order to help creating storage volumes in virtual storage pools from
states, add a virt.volume_defined state.
2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
1a45660920 virt.volume_infos: output disk format
Since the format of a volume may be of interest and could help to tell
if two volumes are similar, output this information in the
virt.volume_infos function.
2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
9b2d180e46 virt.volume_infos: output backing store as well
Since it could be useful to know whether a volume has a backing store,
output the path and format of the backing store if any is defined.
2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
142ca61644 virt.update handle disk volumes 2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
04965675a8 virt: let libvirt generate MAC addresses
There is no need to generate MAC addresses in the virt module if the
user hasn't provided any. This only makes it harder to make the
difference between a real mac address change from the user and a new
generated one.

Now the mac address is not written in the domain XML definition if not
provided by the user. This avoids unnecessary changes when applying
virt.running.
2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
87c85cc820 fix libvirtError use
libvirtError is not defined, libvirt.libvirtError should be used
instead.
2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
faf46571c0 Add disk volumes support in virt.init
In order to support creating VMs with disk on more storage pools like
iSCSI, disks, LVM, RBD, etc, virt.init needs to handle disks not only as
files, but also as libvirt volumes.
2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
7bb3572390 Share libvirt connection in virt.init
Since the next commits will introduce more uses of the libvirt
connection in virt.init(), start sharing it now.
2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
d6d5b51dde Extract virt.pool_capabilities logic for use with a libvirt connection
Te virt.pool_capabilities function computes a lot of interesting values
on the virtual storage pool types. Extract the logic of it into
virt._pool_capabilities for reuse.
2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
261d2ef7bf virt.capabilities refactoring
Extract the libvirt-handling code from virt.capabilities into a
virt._capabilities function accepting an opened libvirt connection.
This allows reusing the code in other functions with easy connection
handling.
2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
5ec45b7771 Add virt.volume_upload function
When using volumes the user can just copy the template disk image into
the target path. In such a case, the image needs to be uploaded into the
volume.
2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
c5b4737b69 Add virt.volume_define function
In the same vein than pool_define and network_define, expose a
volume_define function to let users create a volume without needing to
know all of libvirt's XML details.
2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
a038269738 virt.define_vol_xml_str variant using an existing libvirt connection
In order to avoid connection multiple times when reusing this function
in the virt module, create _define_vol_xml_str not caring about the
connection opening and closing.
2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
2fd1556819 virt: add more properties to generate volume XML
In order to generate almost all the volumes that libvirt can handle, add
the type, backingStore, permissions and allocation parameters to the
virt._gen_vol_xml() function.

Also make the format parameter optional since libvirt has default values
depending on the storage backend.
2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
720673dcc0 virt._gen_vol_xml: move all esx-specifics outside
In the near future gen_vol_xml will be able to handle many volume types,
not only for ESX volumes. For this, clean up the function from all the
ESX-specifics code and move them to the caller code.

The volume key and target path values have also been removed since those
are read-only elements that should not be provided for volume creation
as per https://libvirt.org/formatstorage.html#StorageVol
2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
8ed54cd923 Remove useless default values for disks and vm_name in _disk_profile 2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
95458aef46 Add pool parameter to virt.define_vol_xml_str 2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
2492714da1 Fix pylint warning in test_virt.py after blackening 2020-05-07 16:15:03 -07:00
Joe Eacott
8c6eaea3c9 Add back removed pylint 2020-05-07 16:14:27 -07:00
Joe Eacott
7e51746d2d add back removed pylint 2020-05-07 16:14:27 -07:00
Joe Eacott
7d6e441ca9 Add removed code 2020-05-07 16:14:27 -07:00
Joe Eacott
a7b40e5947 Add code that was removed on accident 2020-05-07 16:14:27 -07:00
Joe Eacott
d34ce4610b Revert import changes 2020-05-07 16:14:27 -07:00
Erik Johnson
b4d9b845c9 Fix tests again 2020-05-07 16:14:27 -07:00
Erik Johnson
d321e1ce99 Fix tests 2020-05-07 16:14:27 -07:00
Daniel Wozniak
273fc9e65c Port #52305 to master 2020-05-07 16:14:27 -07:00
Pedro Algarvio
81f43fb67f Get some insight on failing tests 2020-05-07 16:00:11 -07:00
Pedro Algarvio
bf6b61a0e5 Fix integration.reactor.test_reactor under PyTest 2020-05-07 16:00:11 -07:00
Pedro Algarvio
d14889eb1d Tweak pytest settings to speed up test collection 2020-05-07 16:00:11 -07:00
Pedro Algarvio
a0e96810fd Show test execution order in CI runs to help debug test suite hangs 2020-05-07 16:00:11 -07:00
Pedro Algarvio
ef9237e056 Upgrade to pytest-salt-factories 0.10.x 2020-05-07 16:00:11 -07:00
Pedro Algarvio
433e75fea7 Fix multimaster tests, again. 2020-05-07 16:00:11 -07:00
Pedro Algarvio
578df98e4a Fix conditions to properly run saltutil related wheel tests
Whell functions, on a minion, must run with the master running along side the minion.
We now copy the master config to the minion's configuration directory just the wheel tests since the test suite master and minion(s) do not share the same configuration directory
2020-05-07 16:00:11 -07:00
Pedro Algarvio
743b47de51 Add helper code to run CLI commands 2020-05-07 16:00:11 -07:00
Pedro Algarvio
65c22bf488 Add salt related CLI scripts fixtures 2020-05-07 16:00:11 -07:00
Pedro Algarvio
3f77f6eb28 Add pytest helper to create temporary pillar files 2020-05-07 16:00:11 -07:00
Pedro Algarvio
14e606b39c Completely remove reactors from the configuration 2020-05-07 16:00:11 -07:00
Pedro Algarvio
5e5414e9dc Remove no longer used reactor entry 2020-05-07 16:00:11 -07:00
Pedro Algarvio
6405948882 Upgrade to pytest-salt-factories 0.9.x 2020-05-07 16:00:11 -07:00
Pedro Algarvio
d30e09f297 Upgrade to pytest-salt-factories 0.8.x 2020-05-07 16:00:11 -07:00
Pedro Algarvio
c5feb6859a Create the temp directory if it doesn't exist 2020-05-07 16:00:11 -07:00
Pedro Algarvio
27a5e95541 pytest-saltfactories added support for system information reporting 2020-05-07 16:00:11 -07:00
Pedro Algarvio
ad95cd4c47 Update to saltfactories v0.7.14 2020-05-07 16:00:11 -07:00
Pedro Algarvio
982c506cc0 Fix tests/unit/test_config.py tests 2020-05-07 16:00:11 -07:00
Pedro Algarvio
eea435b91e Fix the hosts tests 2020-05-07 16:00:11 -07:00
Pedro Algarvio
d742aafd5a Fix the proxy minion tests 2020-05-07 16:00:11 -07:00
Pedro Algarvio
113effec7b Fix non salt daemons support 2020-05-07 16:00:11 -07:00
Pedro Algarvio
e157459016 Switch to pytest-salt-factories 2020-05-07 16:00:11 -07:00