[PATCH 14/25] conf: domain: Introduce VIR_DOMAIN_DISK_BUS_NONE

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

 



Add a disk bus value represending no selected bus. This will help split
up the XML parser.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/conf/domain_conf.c         | 3 ++-
 src/conf/domain_conf.h         | 1 +
 src/conf/domain_validate.c     | 1 +
 src/qemu/qemu_alias.c          | 1 +
 src/qemu/qemu_command.c        | 2 ++
 src/qemu/qemu_domain_address.c | 1 +
 src/qemu/qemu_hotplug.c        | 2 ++
 src/vbox/vbox_common.c         | 1 +
 8 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2803055204..c600c1e6b1 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -340,6 +340,7 @@ VIR_ENUM_IMPL(virDomainDiskGeometryTrans,

 VIR_ENUM_IMPL(virDomainDiskBus,
               VIR_DOMAIN_DISK_BUS_LAST,
+              "none",
               "ide",
               "fdc",
               "scsi",
@@ -9510,7 +9511,7 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt,
     }

     if (bus) {
-        if ((def->bus = virDomainDiskBusTypeFromString(bus)) < 0) {
+        if ((def->bus = virDomainDiskBusTypeFromString(bus)) <= 0) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("unknown disk bus type '%s'"), bus);
             return NULL;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 1a2e0fc872..cb5ce68fdb 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -371,6 +371,7 @@ typedef enum {
 } virDomainDiskDevice;

 typedef enum {
+    VIR_DOMAIN_DISK_BUS_NONE,
     VIR_DOMAIN_DISK_BUS_IDE,
     VIR_DOMAIN_DISK_BUS_FDC,
     VIR_DOMAIN_DISK_BUS_SCSI,
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 5118d6a25e..1073da3bfa 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -227,6 +227,7 @@ virDomainDiskAddressDiskBusCompatibility(virDomainDiskBus bus,
     case VIR_DOMAIN_DISK_BUS_USB:
     case VIR_DOMAIN_DISK_BUS_UML:
     case VIR_DOMAIN_DISK_BUS_SD:
+    case VIR_DOMAIN_DISK_BUS_NONE:
     case VIR_DOMAIN_DISK_BUS_LAST:
         return true;
     }
diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
index 7c86a6eeaa..63638b1402 100644
--- a/src/qemu/qemu_alias.c
+++ b/src/qemu/qemu_alias.c
@@ -255,6 +255,7 @@ qemuAssignDeviceDiskAlias(virDomainDef *def,
         case VIR_DOMAIN_DISK_BUS_XEN:
         case VIR_DOMAIN_DISK_BUS_UML:
         case VIR_DOMAIN_DISK_BUS_SD:
+        case VIR_DOMAIN_DISK_BUS_NONE:
         case VIR_DOMAIN_DISK_BUS_LAST:
             break;
         }
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 77d8e3f38c..6ac36da1bb 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1607,6 +1607,7 @@ qemuCheckIOThreads(const virDomainDef *def,
     case VIR_DOMAIN_DISK_BUS_UML:
     case VIR_DOMAIN_DISK_BUS_SATA:
     case VIR_DOMAIN_DISK_BUS_SD:
+    case VIR_DOMAIN_DISK_BUS_NONE:
     case VIR_DOMAIN_DISK_BUS_LAST:
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("IOThreads not available for bus %s target %s"),
@@ -1849,6 +1850,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
     case VIR_DOMAIN_DISK_BUS_XEN:
     case VIR_DOMAIN_DISK_BUS_UML:
     case VIR_DOMAIN_DISK_BUS_SD:
+    case VIR_DOMAIN_DISK_BUS_NONE:
     case VIR_DOMAIN_DISK_BUS_LAST:
     default:
         virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 8adef60675..1ee75b8f2e 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -800,6 +800,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDef *dev,
         case VIR_DOMAIN_DISK_BUS_UML:
         case VIR_DOMAIN_DISK_BUS_SATA:
         case VIR_DOMAIN_DISK_BUS_SD:
+        case VIR_DOMAIN_DISK_BUS_NONE:
         case VIR_DOMAIN_DISK_BUS_LAST:
             return 0;
         }
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 20c34ef104..4344edc75b 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1092,6 +1092,7 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver *driver,
         /* Note that SD card hotplug support should be added only once
          * they support '-device' (don't require -drive only).
          * See also: qemuDiskBusIsSD */
+    case VIR_DOMAIN_DISK_BUS_NONE:
     case VIR_DOMAIN_DISK_BUS_LAST:
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                        _("disk bus '%s' cannot be hotplugged."),
@@ -5315,6 +5316,7 @@ qemuDomainDetachPrepDisk(virDomainObj *vm,
                            _("This type of disk cannot be hot unplugged"));
             return -1;

+        case VIR_DOMAIN_DISK_BUS_NONE:
         case VIR_DOMAIN_DISK_BUS_LAST:
         default:
             virReportEnumRangeError(virDomainDiskBus, disk->bus);
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 1ea1e4e537..1ca521321c 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -1154,6 +1154,7 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDriver *data, IMachine *machine)
         case VIR_DOMAIN_DISK_BUS_USB:
         case VIR_DOMAIN_DISK_BUS_UML:
         case VIR_DOMAIN_DISK_BUS_SD:
+        case VIR_DOMAIN_DISK_BUS_NONE:
         case VIR_DOMAIN_DISK_BUS_LAST:
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("The vbox driver does not support %s bus type"),
-- 
2.30.2




[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