Commit graph

11578 commits

Author SHA1 Message Date
Jorge Schrauwen
2065fa15f0 Update pdbedit tests to handle debian versions
Debian seems to prepend `-Debian` behind the version, we should test those too.
Also lower the requirement to 4.5.0 as apparently that version is new enough according to
https://github.com/saltstack/salt/issues/55185#issuecomment-625285808
2020-05-08 09:39:58 -07:00
Christian McHugh
d4bb81df2e tighten up test validation 2020-05-08 00:45:00 -07:00
Christian McHugh
e5b7f76b66 tighten up test object copies 2020-05-08 00:45:00 -07:00
Christian McHugh
9b5562c7a2 correct list comparision test for some python vers 2020-05-08 00:45:00 -07:00
Christian McHugh
ac239f50a9 attempt to support windows paths 2020-05-08 00:45:00 -07:00
Christian McHugh
075fef3b3d Add unit tests for vault util 2020-05-08 00:45:00 -07:00
Christian McHugh
ca7cbd1aa5 passing runner test 2020-05-08 00:45:00 -07:00
Christian McHugh
acf41dfe2c remove print 2020-05-08 00:45:00 -07:00
Christian McHugh
06b51f9d4e Initial port of 54094 2020-05-08 00:45:00 -07:00
Joe Eacott
d2688ae80e add tests 2020-05-07 16:21:43 -07:00
Joe Eacott
6b9c3faf11 add simple test to checking sys var 2020-05-07 16:21:43 -07:00
ch3ll
5d280eee1e Update test paths to include windows 2020-05-07 16:16:31 -07:00
ch3ll
cdd470c76e Add auto_detect feature to ssh_ext_alternatives 2020-05-07 16:16:31 -07:00
Cédric Bosdonnat
7d18001dba virt.update properly handle removable devices
Live attaching / detaching removable devices results in failures.
To change the source of those, we need to call updateDeviceFlags instead.
2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
73438d43d8 virt: handle cdrom remote images
Libvirt allows to use network images for cdroms. Use them if the image
is a remote URL for a cdrom device.
2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
734ae1a3a4 virt: fix VM creating with disk volume
Since volumes in a virtual storage pool of type 'disk' are partitions,
then need to be named after the disk name with sequential numbers rather
than using the VM and disk names.

Also, the format passed by the user is the one used when creating the volume.
However in the VM definition for logical and disk volumes, the format should
be set to raw.
2020-05-07 16:15:03 -07:00
Cédric Bosdonnat
5ecea2bac1 Handle RBD volumes as network disks in VM definition
libvirt doesn't support attaching RBD storage pool volumes to a VM.
For instance, a disk with such a source is invalid:

    <source pool='rbd-pool' volume='rbd-volume'/>

And needs to be replaced with:

    <source protocol="rbd" name="rbd-pool-name/rbd-volume">
      <host name="hostname" port="7000"/>
      <auth username='myuser'>
        <secret type='ceph' usage='mypassid'/>
      </auth>
    </source>

This means that we need to fetch the connection data from the pool
definition and convert the volume disk definition into a network one
when creating the VM.

This also means that when purging the VM we need to search for the
pool by looking in every pool's XML to delete the volume.
2020-05-07 16:15:03 -07:00
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
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
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
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
2492714da1 Fix pylint warning in test_virt.py after blackening 2020-05-07 16:15:03 -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
ef9237e056 Upgrade to pytest-salt-factories 0.10.x 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
Christian McHugh
d6aa368b0d Update baredoc to dump docstrings like sys.doc 2020-05-07 13:58:34 -07:00
twangboy
9ccb7edbc9 Add ability to add hwaddr and macaddr
Adds the ability to add `hwaddr` and `macaddr` to the network config for
Redhat based systems. Adds tests.
2020-05-07 13:57:33 -07:00
twangboy
16457386a6 Fix issue when pillars are integers
Fixes an issue where some pillar data may have integer keys. This was
causing the sorted function to fail. See issue #56909
2020-05-07 13:57:07 -07:00
twangboy
4684c9dca1 Add some tests 2020-05-07 13:54:45 -07:00
twangboy
dfdcf95d93 Fix stacktrace in return from win_pkg
Returns a meaningful message without the stacktrace
Adds some tests
2020-05-07 13:50:17 -07:00
Pedro Algarvio
5852d60dbf No global variables, fix tests. 2020-05-07 13:49:10 -07:00
Alexander Werner
3ddd6539c7 saltclass: Reference classes with globs
Allow the list of classes in saltclass external pillar/master_tops
to include shell-style globs.
2020-05-07 13:49:10 -07:00
Joe Eacott
5b708dba40 Forgot to add variable for when import is successful 2020-05-07 13:36:34 -07:00
Joe Eacott
1d08b27817 Add non-windows modules into try except as to not fail 2020-05-07 13:36:34 -07:00
xetix
09c5d8b6c1 Port #53681 to master 2020-05-07 13:36:34 -07:00
twangboy
86e061f91e Add tests 2020-05-07 13:26:41 -07:00
Erik Johnson
eaa96bb59d aptpkg: Fix installing 32-bit packages on 64-bit OS
This was broken because a normalize_name function was added to aptpkg,
which was incorrectly written. The pkg states use this function, if
present, to figure out whether or not the package architecture needs to
be stripped from the package name. However, this recently-added function
was *always* stripping the architecture, causing 32-bit suffixes to be
stripped.

This commit fixes the incorrect implementation of normalize_name and
adds a unit test.
2020-05-07 13:25:34 -07:00
Erik Johnson
1bee7c8a3a Confirm that the correct number of procs is returned 2020-05-07 13:24:33 -07:00