]> xenbits.xensource.com Git - libvirt.git/commitdiff
snapshot: reject transient disks where code is not ready
authorEric Blake <eblake@redhat.com>
Sat, 13 Aug 2011 21:42:48 +0000 (15:42 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 5 Sep 2011 13:03:04 +0000 (07:03 -0600)
The previous patch introduced new config, but if a hypervisor does
not support that new config, someone can write XML that does not
behave as documented.  This prevents some of those cases by
explicitly rejecting transient disks for several hypervisors.

Disk snapshots will require a new flag to actually affect a snapshot
creation, so there's not much to reject there.

* src/qemu/qemu_command.c (qemuBuildDriveStr): Reject transient
disks for now.
* src/libxl/libxl_conf.c (libxlMakeDisk): Likewise.
* src/xenxs/xen_sxpr.c (xenFormatSxprDisk): Likewise.
* src/xenxs/xen_xm.c (xenFormatXMDisk): Likewise.

src/libxl/libxl_conf.c
src/qemu/qemu_command.c
src/xenxs/xen_sxpr.c
src/xenxs/xen_xm.c

index 09f3be85b51efb7c1d4d25dbe05e0f0b6770923e..b9bce144c8687c9862f6f1043ab4d55d21bee278 100644 (file)
@@ -537,6 +537,11 @@ libxlMakeDisk(virDomainDefPtr def, virDomainDiskDefPtr l_disk,
     x_disk->unpluggable = 1;
     x_disk->readwrite = !l_disk->readonly;
     x_disk->is_cdrom = l_disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM ? 1 : 0;
+    if (l_disk->transient) {
+        libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
+                   _("libxenlight does not support transient disks"));
+        return -1;
+    }
 
     x_disk->domid = def->id;
 
index c7c183a012a7b2fec79e156e744204b3dbfce32b..153647ab69c84216019ef9327b82555754a06f46 100644 (file)
@@ -1594,6 +1594,11 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
     if (disk->readonly &&
         qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_READONLY))
         virBufferAddLit(&opt, ",readonly=on");
+    if (disk->transient) {
+        qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                        _("transient disks not supported yet"));
+        goto error;
+    }
     if (disk->driverType && *disk->driverType != '\0' &&
         disk->type != VIR_DOMAIN_DISK_TYPE_DIR &&
         qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_FORMAT))
index 086ad8b76b7767a185122917b17510e213f6736e..72322a7bc7d3e51256c8725a06903f5a116b491b 100644 (file)
@@ -1713,6 +1713,11 @@ xenFormatSxprDisk(virDomainDiskDefPtr def,
         virBufferAddLit(buf, "(mode 'w!')");
     else
         virBufferAddLit(buf, "(mode 'w')");
+    if (def->transient) {
+        XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
+                    _("transient disks not supported yet"));
+        return -1;
+    }
 
     if (!isAttach)
         virBufferAddLit(buf, ")");
index cb31226be7cf04b83d2f8af86a2b680086286617..03857c81e953a86582bf6a94e90c3807783606b0 100644 (file)
@@ -1164,6 +1164,11 @@ static int xenFormatXMDisk(virConfValuePtr list,
         virBufferAddLit(&buf, ",!");
     else
         virBufferAddLit(&buf, ",w");
+    if (disk->transient) {
+        XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
+                    _("transient disks not supported yet"));
+        return -1;
+    }
 
     if (virBufferError(&buf)) {
         virReportOOMError();