[PATCH v2 2/2] qemuValidateDomainDeviceDefDiskTransient: Add checking set-action capability

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

 



From: Masayoshi Mizuma <m.mizuma@xxxxxxxxxxxxxx>

<transient shareBacking='yes'/> option requires set-action capability
if destroy action is set to all of the events configuration.

Signed-off-by: Masayoshi Mizuma <m.mizuma@xxxxxxxxxxxxxx>
---
 src/qemu/qemu_validate.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 8906aa52d9..0d49512996 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -24,6 +24,7 @@
 #include "qemu_block.h"
 #include "qemu_command.h"
 #include "qemu_domain.h"
+#include "qemu_process.h"
 #include "domain_conf.h"
 #include "virlog.h"
 #include "virutil.h"
@@ -2991,6 +2992,7 @@ qemuValidateDomainDeviceDefDiskBlkdeviotune(const virDomainDiskDef *disk,
 
 static int
 qemuValidateDomainDeviceDefDiskTransient(const virDomainDiskDef *disk,
+                                         const virDomainDef *def,
                                          virQEMUCaps *qemuCaps)
 
 {
@@ -3033,6 +3035,15 @@ qemuValidateDomainDeviceDefDiskTransient(const virDomainDiskDef *disk,
     }
 
     if (disk->transientShareBacking == VIR_TRISTATE_BOOL_YES) {
+        if (!qemuProcessRebootAllowed(def) &&
+            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_SET_ACTION)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("transient disk backing image sharing with destroy action of lifecycle "
+                             "isn't supported by this QEMU binary (%s)"),
+                             disk->dst);
+            return -1;
+        }
+
         /* sharing the backing file requires hotplug of the disk in the qemu driver */
         switch (disk->bus) {
         case VIR_DOMAIN_DISK_BUS_USB:
@@ -3077,7 +3088,7 @@ qemuValidateDomainDeviceDefDisk(const virDomainDiskDef *disk,
     if (qemuValidateDomainDeviceDefDiskBlkdeviotune(disk, def) < 0)
         return -1;
 
-    if (qemuValidateDomainDeviceDefDiskTransient(disk, qemuCaps) < 0)
+    if (qemuValidateDomainDeviceDefDiskTransient(disk, def, qemuCaps) < 0)
         return -1;
 
     if (disk->src->shared && !disk->src->readonly &&
-- 
2.27.0




[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]

  Powered by Linux