[virt-manager PATCH v2 4/4] virtinst: bhyve: configure nmdm console

Roman Bogorodskiy bogorodskiy at gmail.com
Thu Feb 11 15:41:13 UTC 2021


Bhyve only supports nmdm console type, so use it instead of TYPE_PTY.

Signed-off-by: Roman Bogorodskiy <bogorodskiy at gmail.com>
---
 .../data/cli/compare/virt-install-bhyve-default-f27.xml  | 4 +++-
 virtinst/guest.py                                        | 9 ++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/tests/data/cli/compare/virt-install-bhyve-default-f27.xml b/tests/data/cli/compare/virt-install-bhyve-default-f27.xml
index 766f5f98..7e5bb481 100644
--- a/tests/data/cli/compare/virt-install-bhyve-default-f27.xml
+++ b/tests/data/cli/compare/virt-install-bhyve-default-f27.xml
@@ -26,7 +26,9 @@
       <mac address="00:11:22:33:44:55"/>
       <model type="e1000"/>
     </interface>
-    <console type="pty"/>
+    <console type="nmdm">
+      <source master="/dev/nmdm00000000-1111-2222-3333-444444444444A" slave="/dev/nmdm00000000-1111-2222-3333-444444444444B"/>
+    </console>
     <input type="tablet" bus="usb"/>
     <graphics type="vnc" port="-1"/>
     <video>
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 5306dfb4..34da3e8c 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -844,7 +844,14 @@ class Guest(XMLBuilder):
             return
 
         dev = DeviceConsole(self.conn)
-        dev.type = dev.TYPE_PTY
+        if self.conn.is_bhyve():
+            nmdm_dev_prefix = '/dev/nmdm{}'.format(self.generate_uuid(self.conn))
+            dev.type = dev.TYPE_NMDM
+            dev.source.master = nmdm_dev_prefix + 'A'
+            dev.source.slave = nmdm_dev_prefix + 'B'
+        else:
+            dev.type = dev.TYPE_PTY
+
         if self.os.is_s390x():
             dev.target_type = "sclp"
         self.add_device(dev)
-- 
2.30.0




More information about the virt-tools-list mailing list