[PATCH 1/2] bhyve: add support for virtio block devices

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

 



---
 src/bhyve/bhyve_command.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index b9df6d0..2ec97fc 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -216,6 +216,7 @@ static int
 bhyveBuildDiskArgStr(const virDomainDef *def, virCommandPtr cmd)
 {
     virDomainDiskDefPtr disk;
+    const char *bus_type;
 
     if (def->ndisks != 1) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -225,7 +226,14 @@ bhyveBuildDiskArgStr(const virDomainDef *def, virCommandPtr cmd)
 
     disk = def->disks[0];
 
-    if (disk->bus != VIR_DOMAIN_DISK_BUS_SATA) {
+    switch (disk->bus) {
+    case VIR_DOMAIN_DISK_BUS_SATA:
+        bus_type = "ahci-hd";
+        break;
+    case VIR_DOMAIN_DISK_BUS_VIRTIO:
+        bus_type = "virtio-blk";
+        break;
+    default:
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("unsupported disk bus type"));
         return -1;
@@ -244,7 +252,7 @@ bhyveBuildDiskArgStr(const virDomainDef *def, virCommandPtr cmd)
     }
 
     virCommandAddArg(cmd, "-s");
-    virCommandAddArgFormat(cmd, "2:0,ahci-hd,%s", disk->src);
+    virCommandAddArgFormat(cmd, "2:0,%s,%s", bus_type, disk->src);
 
     return 0;
 }
-- 
1.8.4.2

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