Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xen virtual machine disk fixes #58400

Merged
merged 10 commits into from
Sep 16, 2020
Merged

Xen virtual machine disk fixes #58400

merged 10 commits into from
Sep 16, 2020

Conversation

cbosdo
Copy link
Contributor

@cbosdo cbosdo commented Sep 8, 2020

What does this PR do?

This PR converts the disks of volume type into their equivalent of file or block type for Xen virtual machines since libvirt libxl driver doesn't handle them.

In order to help reversing the magic, this PR also shows the disks as volume type if the source path matches one of a known volume.

The new unit tests have been added as pytests. In order to start migrating the big number of virt modules unit tests, the existing virt tests for the touched code have been converted to pytest too.

What issues does this PR fix or reference?

Fixes: #58333

Previous Behavior

For a Xen VM the following disk was created:

    <disk type='volume' device='disk'>
      <driver name='qemu' type='qcow2' cache='none' io='native'/>
      <source pool='default' volume='vm03_system'/>
      <target dev='xvda' bus='xen'/>
    </disk>

New Behavior

Now it would create something like:

    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none' io='native'/>
      <source file='/var/lib/libvirt/images/vm03_system'/>
      <target dev='xvda' bus='xen'/>
    </disk>

Merge requirements satisfied?

Commits signed with GPG?

Yes

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

The libvirt xen driver does not handle disk of 'volume' type. We thus
need to convert them into their equivalent using the 'file' or 'block'
type (issue saltstack#58333).
In order to avoid code duplication, extend the _get_all_volumes_path()
helper function to also provide the volume and pool names.
In some cases like Xen we have to change the volume disks into file or
block ones. Show pool/volumes informations in the virt.get_disk if
possible.
@cbosdo cbosdo requested a review from a team as a code owner September 8, 2020 14:20
@ghost ghost requested review from Ch3LL and removed request for a team September 8, 2020 14:20
@cbosdo
Copy link
Contributor Author

cbosdo commented Sep 16, 2020

@dwoz would be good to have this PR in for Magnesium since it fixes a regression from Sodium

@dwoz dwoz merged commit f534d4d into saltstack:master Sep 16, 2020
@cbosdo cbosdo deleted the xen-disk branch September 17, 2020 07:02
@sagetherage sagetherage added the Magnesium Mg release after Na prior to Al label Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Magnesium Mg release after Na prior to Al
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Creating a Xen Virtual machine shouldn't produce volume disks
4 participants