[libvirt] PATCH: Relabel disk images *before* hotplugging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For some bizarre reason the original code we added for sVirt disk labelling
with hotplug did not relabel the disks until after telling QEMU to hotplug.
Clearly this is going to fail 99% of the time. It also forgot todo labelling
when invoking a CDROM media change

 src/qemu_driver.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Daniel

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 25d446d..59c163c 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -4136,10 +4136,14 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
         switch (dev->data.disk->device) {
         case VIR_DOMAIN_DISK_DEVICE_CDROM:
         case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
+            if (driver->securityDriver)
+                driver->securityDriver->domainSetSecurityImageLabel(dom->conn, vm, dev->data.disk);
             ret = qemudDomainChangeEjectableMedia(dom->conn, vm, dev);
             break;
 
         case VIR_DOMAIN_DISK_DEVICE_DISK:
+            if (driver->securityDriver)
+                driver->securityDriver->domainSetSecurityImageLabel(dom->conn, vm, dev->data.disk);
             if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_USB) {
                 ret = qemudDomainAttachUsbMassstorageDevice(dom->conn, vm, dev);
             } else if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_SCSI ||
@@ -4151,8 +4155,6 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
                                  virDomainDiskBusTypeToString(dev->data.disk->bus));
                 goto cleanup;
             }
-            if (driver->securityDriver)
-                driver->securityDriver->domainSetSecurityImageLabel(dom->conn, vm, dev->data.disk);
             break;
 
         default:
-- 
1.6.2.5



-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]