]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
domain_conf: Add disk bus=sd, wire it up for qemu
authorCole Robinson <crobinso@redhat.com>
Wed, 31 Jul 2013 13:00:26 +0000 (09:00 -0400)
committerCole Robinson <crobinso@redhat.com>
Mon, 2 Sep 2013 20:53:40 +0000 (16:53 -0400)
This corresponds to '-sd' and '-drive if=sd' on the qemu command line.
Needed for many ARM boards which don't provide any other way to
pass in storage.

docs/formatdomain.html.in
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
src/conf/domain_conf.h
src/qemu/qemu_command.c

index 6773b62677f1590ab7115a8a5b879ebbab710f36..e7fbe5f051d131911be7d0b194e1e1818d141bb9 100644 (file)
         as a device ordering hint.  The optional <code>bus</code>
         attribute specifies the type of disk device to emulate;
         possible values are driver specific, with typical values being
-        "ide", "scsi", "virtio", "xen", "usb" or "sata". If omitted, the bus
+        "ide", "scsi", "virtio", "xen", "usb", "sata", or
+        "sd" <span class="since">"sd" since 1.1.2</span>. If omitted, the bus
         type is inferred from the style of the device name (e.g. a device named
         'sda' will typically be exported using a SCSI bus). The optional
         attribute <code>tray</code> indicates the tray status of the
index d17177a8fb57fe94c9b5d8c1a61d87b690df2fd6..ecd3a42544f7c4ca40016d954268bfae4d47113e 100644 (file)
             <value>usb</value>
             <value>uml</value>
             <value>sata</value>
+            <value>sd</value>
           </choice>
         </attribute>
       </optional>
index 355821cfb44c5cca6329242871327e3e369b6e87..a13b42c21525854d2ed5df71bde8cebe4f4d0590 100644 (file)
@@ -239,7 +239,8 @@ VIR_ENUM_IMPL(virDomainDiskBus, VIR_DOMAIN_DISK_BUS_LAST,
               "xen",
               "usb",
               "uml",
-              "sata")
+              "sata",
+              "sd")
 
 VIR_ENUM_IMPL(virDomainDiskCache, VIR_DOMAIN_DISK_CACHE_LAST,
               "default",
@@ -17333,6 +17334,7 @@ virDiskNameToBusDeviceIndex(const virDomainDiskDefPtr disk,
         case VIR_DOMAIN_DISK_BUS_USB:
         case VIR_DOMAIN_DISK_BUS_VIRTIO:
         case VIR_DOMAIN_DISK_BUS_XEN:
+        case VIR_DOMAIN_DISK_BUS_SD:
         default:
             *busIdx = 0;
             *devIdx = idx;
index 83fd4f324de50bafb0c9a7230224b194e5aebb1d..048b3a883b4027739a675ba0326cbaf6030033d4 100644 (file)
@@ -509,6 +509,7 @@ enum virDomainDiskBus {
     VIR_DOMAIN_DISK_BUS_USB,
     VIR_DOMAIN_DISK_BUS_UML,
     VIR_DOMAIN_DISK_BUS_SATA,
+    VIR_DOMAIN_DISK_BUS_SD,
 
     VIR_DOMAIN_DISK_BUS_LAST
 };
index e62d43aac5aed5f8093ed85674a81569db49af6f..24996eea06acc0458e2fd65643c90597d3ac6151 100644 (file)
@@ -73,7 +73,8 @@ VIR_ENUM_IMPL(virDomainDiskQEMUBus, VIR_DOMAIN_DISK_BUS_LAST,
               "xen",
               "usb",
               "uml",
-              "sata")
+              "sata",
+              "sd")
 
 
 VIR_ENUM_DECL(qemuDiskCacheV1)
@@ -646,6 +647,9 @@ static int qemuAssignDeviceDiskAliasFixed(virDomainDiskDefPtr disk)
     case VIR_DOMAIN_DISK_BUS_XEN:
         ret = virAsprintf(&dev_name, "xenblk%d", devid);
         break;
+    case VIR_DOMAIN_DISK_BUS_SD:
+        ret = virAsprintf(&dev_name, "sd%d", devid);
+        break;
     default:
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Unsupported disk name mapping for bus '%s'"),
@@ -3786,7 +3790,9 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
         break;
 
     case VIR_DOMAIN_DISK_BUS_XEN:
-        /* Xen has no address type currently, so assign based on index */
+    case VIR_DOMAIN_DISK_BUS_SD:
+        /* Xen and SD have no address type currently, so assign
+         * based on index */
         break;
     }
 
@@ -8213,12 +8219,13 @@ qemuBuildCommandLine(virConnectPtr conn,
             virCommandAddArg(cmd, "-drive");
 
             /* Unfortunately it is not possible to use
-               -device for floppies, or Xen paravirt
+               -device for floppies, xen PV, or SD
                devices. Fortunately, those don't need
                static PCI addresses, so we don't really
                care that we can't use -device */
             if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
-                if (disk->bus != VIR_DOMAIN_DISK_BUS_XEN) {
+                if (disk->bus != VIR_DOMAIN_DISK_BUS_XEN &&
+                    disk->bus != VIR_DOMAIN_DISK_BUS_SD) {
                     withDeviceArg = true;
                 } else {
                     virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE);
@@ -9915,6 +9922,8 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
                 def->bus = VIR_DOMAIN_DISK_BUS_VIRTIO;
             else if (STREQ(values[i], "xen"))
                 def->bus = VIR_DOMAIN_DISK_BUS_XEN;
+            else if (STREQ(values[i], "sd"))
+                def->bus = VIR_DOMAIN_DISK_BUS_SD;
         } else if (STREQ(keywords[i], "media")) {
             if (STREQ(values[i], "cdrom")) {
                 def->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
@@ -10064,7 +10073,8 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
 
     if (def->bus == VIR_DOMAIN_DISK_BUS_IDE) {
         ignore_value(VIR_STRDUP(def->dst, "hda"));
-    } else if (def->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
+    } else if (def->bus == VIR_DOMAIN_DISK_BUS_SCSI ||
+               def->bus == VIR_DOMAIN_DISK_BUS_SD) {
         ignore_value(VIR_STRDUP(def->dst, "sda"));
     } else if (def->bus == VIR_DOMAIN_DISK_BUS_VIRTIO) {
         ignore_value(VIR_STRDUP(def->dst, "vda"));