[PATCH v2 4/6] bhyve: automatically add 'isa' controller

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

 



When domain configuration requires the 'isa' controller to be present,
automatically add it on domain post-parse stage.

Now, as this controller is always available when needed, it's not
necessary to implicitly add it to the bhyve command line, so remove
bhyveBuildLPCArgStr().

Also, make bhyveDomainDefNeedsISAController() static as it's no longer
used outside of bhyve_domain.c.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@xxxxxxxxx>
---
 src/bhyve/bhyve_command.c                             | 11 -----------
 src/bhyve/bhyve_domain.c                              |  7 ++++++-
 src/bhyve/bhyve_domain.h                              |  2 --
 tests/bhyvexml2argvdata/bhyvexml2argv-console.args    |  2 +-
 .../bhyvexml2argv-serial-grub-nocons.args             |  2 +-
 .../bhyvexml2argvdata/bhyvexml2argv-serial-grub.args  |  2 +-
 tests/bhyvexml2argvdata/bhyvexml2argv-serial.args     |  2 +-
 tests/bhyvexml2argvdata/bhyvexml2argv-uefi.args       |  4 ++--
 .../bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.args |  4 ++--
 .../bhyvexml2argv-vnc-vgaconf-io.args                 |  4 ++--
 .../bhyvexml2argv-vnc-vgaconf-off.args                |  4 ++--
 .../bhyvexml2argv-vnc-vgaconf-on.args                 |  4 ++--
 tests/bhyvexml2argvdata/bhyvexml2argv-vnc.args        |  4 ++--
 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-console.xml |  3 +++
 .../bhyvexml2xmlout-serial-grub-nocons.xml            |  3 +++
 .../bhyvexml2xmlout-serial-grub.xml                   |  3 +++
 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial.xml  |  3 +++
 .../bhyvexml2xmlout-vnc-autoport.xml                  |  3 +++
 .../bhyvexml2xmlout-vnc-vgaconf-io.xml                |  3 +++
 .../bhyvexml2xmlout-vnc-vgaconf-off.xml               |  3 +++
 .../bhyvexml2xmlout-vnc-vgaconf-on.xml                |  3 +++
 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc.xml     |  3 +++
 22 files changed, 49 insertions(+), 30 deletions(-)

diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index 2c90265a93..6e0af3892e 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -325,14 +325,6 @@ bhyveBuildVirtIODiskArgStr(const virDomainDef *def ATTRIBUTE_UNUSED,
     return 0;
 }
 
-static int
-bhyveBuildLPCArgStr(const virDomainDef *def ATTRIBUTE_UNUSED,
-                    virCommandPtr cmd)
-{
-    virCommandAddArgList(cmd, "-s", "1,lpc", NULL);
-    return 0;
-}
-
 static int
 bhyveBuildGraphicsArgStr(const virDomainDef *def,
                          virDomainGraphicsDefPtr graphics,
@@ -634,9 +626,6 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn,
         }
     }
 
-    if (nisacontrollers == 0 && bhyveDomainDefNeedsISAController(def))
-        bhyveBuildLPCArgStr(def, cmd);
-
     if (bhyveBuildConsoleArgStr(def, cmd) < 0)
         goto error;
 
diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c
index e476ef7e7d..68f66904a3 100644
--- a/src/bhyve/bhyve_domain.c
+++ b/src/bhyve/bhyve_domain.c
@@ -61,7 +61,7 @@ virDomainXMLPrivateDataCallbacks virBhyveDriverPrivateDataCallbacks = {
     .free = bhyveDomainObjPrivateFree,
 };
 
-bool
+static bool
 bhyveDomainDefNeedsISAController(virDomainDefPtr def)
 {
     if ((def->os.bootloader == NULL && def->os.loader) ||
@@ -83,6 +83,11 @@ bhyveDomainDefPostParse(virDomainDefPtr def,
                                        VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) < 0)
         return -1;
 
+    if (bhyveDomainDefNeedsISAController(def))
+        if (virDomainDefMaybeAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_ISA, 1,
+                                           VIR_DOMAIN_CONTROLLER_MODEL_ISA_BRIDGE) < 0)
+            return -1;
+
     return 0;
 }
 
diff --git a/src/bhyve/bhyve_domain.h b/src/bhyve/bhyve_domain.h
index 03a2b369d9..5f94038e89 100644
--- a/src/bhyve/bhyve_domain.h
+++ b/src/bhyve/bhyve_domain.h
@@ -41,6 +41,4 @@ extern virDomainXMLPrivateDataCallbacks virBhyveDriverPrivateDataCallbacks;
 extern virDomainDefParserConfig virBhyveDriverDomainDefParserConfig;
 extern virDomainXMLNamespace virBhyveDriverDomainXMLNamespace;
 
-bool bhyveDomainDefNeedsISAController(virDomainDefPtr def);
-
 #endif /* LIBVIRT_BHYVE_DOMAIN_H */
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-console.args b/tests/bhyvexml2argvdata/bhyvexml2argv-console.args
index 6ab91ae7e4..25fbd4727e 100644
--- a/tests/bhyvexml2argvdata/bhyvexml2argv-console.args
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-console.args
@@ -5,7 +5,7 @@
 -H \
 -P \
 -s 0:0,hostbridge \
+-s 1:0,lpc \
 -s 2:0,ahci,hd:/tmp/freebsd.img \
 -s 3:0,virtio-net,faketapdev,mac=52:54:00:b1:42:eb \
--s 1,lpc \
 -l com1,/dev/nmdm0A bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub-nocons.args b/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub-nocons.args
index 42a278208d..02846cb893 100644
--- a/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub-nocons.args
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub-nocons.args
@@ -5,7 +5,7 @@
 -H \
 -P \
 -s 0:0,hostbridge \
+-s 1:0,lpc \
 -s 2:0,ahci-hd,/tmp/freebsd.img \
 -s 3:0,virtio-net,faketapdev,mac=52:54:00:a7:cd:5b \
--s 1,lpc \
 -l com1,/dev/nmdm0A bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub.args b/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub.args
index 313724dc90..e4712b448c 100644
--- a/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub.args
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub.args
@@ -5,7 +5,7 @@
 -H \
 -P \
 -s 0:0,hostbridge \
+-s 1:0,lpc \
 -s 2:0,ahci,hd:/tmp/freebsd.img \
 -s 3:0,virtio-net,faketapdev,mac=52:54:00:f0:72:11 \
--s 1,lpc \
 -l com1,/dev/nmdm0A bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-serial.args b/tests/bhyvexml2argvdata/bhyvexml2argv-serial.args
index 059e457072..f45a190137 100644
--- a/tests/bhyvexml2argvdata/bhyvexml2argv-serial.args
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-serial.args
@@ -5,7 +5,7 @@
 -H \
 -P \
 -s 0:0,hostbridge \
+-s 1:0,lpc \
 -s 2:0,ahci,hd:/tmp/freebsd.img \
 -s 3:0,virtio-net,faketapdev,mac=52:54:00:4f:f3:5b \
--s 1,lpc \
 -l com1,/dev/nmdm0A bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-uefi.args b/tests/bhyvexml2argvdata/bhyvexml2argv-uefi.args
index 8ff8673ed4..937b066e8c 100644
--- a/tests/bhyvexml2argvdata/bhyvexml2argv-uefi.args
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-uefi.args
@@ -6,6 +6,6 @@
 -P \
 -s 0:0,hostbridge \
 -l bootrom,/path/to/test.fd \
+-s 1:0,lpc \
 -s 2:0,ahci,hd:/tmp/freebsd.img \
--s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
--s 1,lpc bhyve
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.args b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.args
index 039526ff35..551469dabe 100644
--- a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.args
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.args
@@ -6,7 +6,7 @@
 -P \
 -s 0:0,hostbridge \
 -l bootrom,/path/to/test.fd \
+-s 1:0,lpc \
 -s 2:0,ahci,hd:/tmp/freebsd.img \
 -s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
--s 4:0,fbuf,tcp=127.0.0.1:5900 \
--s 1,lpc bhyve
+-s 4:0,fbuf,tcp=127.0.0.1:5900 bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.args b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.args
index da37971009..47022e84cf 100644
--- a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.args
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.args
@@ -6,7 +6,7 @@
 -P \
 -s 0:0,hostbridge \
 -l bootrom,/path/to/test.fd \
+-s 1:0,lpc \
 -s 2:0,ahci,hd:/tmp/freebsd.img \
 -s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
--s 4:0,fbuf,tcp=127.0.0.1:5904,vga=io \
--s 1,lpc bhyve
+-s 4:0,fbuf,tcp=127.0.0.1:5904,vga=io bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.args b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.args
index 70347ee0b6..923098f3db 100644
--- a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.args
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.args
@@ -6,7 +6,7 @@
 -P \
 -s 0:0,hostbridge \
 -l bootrom,/path/to/test.fd \
+-s 1:0,lpc \
 -s 2:0,ahci,hd:/tmp/freebsd.img \
 -s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
--s 4:0,fbuf,tcp=127.0.0.1:5904,vga=off \
--s 1,lpc bhyve
+-s 4:0,fbuf,tcp=127.0.0.1:5904,vga=off bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.args b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.args
index d0e1d81e2a..9225f5d133 100644
--- a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.args
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.args
@@ -6,7 +6,7 @@
 -P \
 -s 0:0,hostbridge \
 -l bootrom,/path/to/test.fd \
+-s 1:0,lpc \
 -s 2:0,ahci,hd:/tmp/freebsd.img \
 -s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
--s 4:0,fbuf,tcp=127.0.0.1:5904,vga=on \
--s 1,lpc bhyve
+-s 4:0,fbuf,tcp=127.0.0.1:5904,vga=on bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc.args b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc.args
index 90889b8f39..cd7a543265 100644
--- a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc.args
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc.args
@@ -6,7 +6,7 @@
 -P \
 -s 0:0,hostbridge \
 -l bootrom,/path/to/test.fd \
+-s 1:0,lpc \
 -s 2:0,ahci,hd:/tmp/freebsd.img \
 -s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
--s 4:0,fbuf,tcp=127.0.0.1:5904 \
--s 1,lpc bhyve
+-s 4:0,fbuf,tcp=127.0.0.1:5904 bhyve
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-console.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-console.xml
index 78d4d30016..2b453ee640 100644
--- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-console.xml
+++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-console.xml
@@ -20,6 +20,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
+    <controller type='isa' index='1' model='isa-bridge'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
     <controller type='sata' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </controller>
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub-nocons.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub-nocons.xml
index 845cb09e9f..e012d586c8 100644
--- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub-nocons.xml
+++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub-nocons.xml
@@ -20,6 +20,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
+    <controller type='isa' index='1' model='isa-bridge'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
     <controller type='sata' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </controller>
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub.xml
index 6c8fda32af..ecb13907df 100644
--- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub.xml
+++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial-grub.xml
@@ -20,6 +20,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
+    <controller type='isa' index='1' model='isa-bridge'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
     <controller type='sata' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </controller>
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial.xml
index eb50cc05ad..6dd2b94be7 100644
--- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial.xml
+++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-serial.xml
@@ -20,6 +20,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
+    <controller type='isa' index='1' model='isa-bridge'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
     <controller type='sata' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </controller>
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-autoport.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-autoport.xml
index d6cfe76b70..2c99dc6233 100644
--- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-autoport.xml
+++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-autoport.xml
@@ -21,6 +21,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
+    <controller type='isa' index='1' model='isa-bridge'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
     <controller type='sata' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </controller>
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-io.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-io.xml
index 9e470e432e..9d152e4079 100644
--- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-io.xml
+++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-io.xml
@@ -21,6 +21,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
+    <controller type='isa' index='1' model='isa-bridge'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
     <controller type='sata' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </controller>
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-off.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-off.xml
index 89c4ceac57..ece20ddbab 100644
--- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-off.xml
+++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-off.xml
@@ -21,6 +21,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
+    <controller type='isa' index='1' model='isa-bridge'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
     <controller type='sata' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </controller>
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-on.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-on.xml
index 86d8939364..f2942c91aa 100644
--- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-on.xml
+++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-on.xml
@@ -21,6 +21,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
+    <controller type='isa' index='1' model='isa-bridge'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
     <controller type='sata' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </controller>
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc.xml
index 9e470e432e..9d152e4079 100644
--- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc.xml
+++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc.xml
@@ -21,6 +21,9 @@
       <address type='drive' controller='0' bus='0' target='2' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pci-root'/>
+    <controller type='isa' index='1' model='isa-bridge'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
     <controller type='sata' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </controller>
-- 
2.20.1


[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