[virt-tools-list] [PATCH v2] Add bhyve support

Roman Bogorodskiy bogorodskiy at gmail.com
Thu Apr 10 17:54:37 UTC 2014


Allow connection to bhyve using bhyve:///system URI. That is
disabled by default and could be enabled using the new
configure option 'with-bhyve'.
---
 setup.py               | 5 +++++
 virtManager/config.py  | 1 +
 virtManager/connect.py | 9 +++++++--
 virtcli/cliconfig.py   | 1 +
 4 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/setup.py b/setup.py
index e6c51f7..33d2069 100755
--- a/setup.py
+++ b/setup.py
@@ -324,6 +324,8 @@ class configure(Command):
          "Hide config bits that are not considered stable (default=no)"),
         ("default-graphics=", None,
          "Default graphics type (spice or vnc) (default=spice)"),
+        ("with-bhyve=", None,
+         "whether enable Bhyve connection support (default=no)"),
 
     ]
     description = "Configure the build, similar to ./configure"
@@ -341,6 +343,7 @@ class configure(Command):
         self.preferred_distros = None
         self.stable_defaults = None
         self.default_graphics = None
+        self.with_bhyve = None
 
 
     def run(self):
@@ -364,6 +367,8 @@ class configure(Command):
                          self.stable_defaults)
         if self.default_graphics is not None:
             template += "default_graphics = %s\n" % self.default_graphics
+        if self.with_bhyve is not None:
+            template += "with_bhyve = %s\n" % self.with_bhyve
 
         file(cliconfig.cfgpath, "w").write(template)
         print "Generated %s" % cliconfig.cfgpath
diff --git a/virtManager/config.py b/virtManager/config.py
index b451d0a..b24fee5 100644
--- a/virtManager/config.py
+++ b/virtManager/config.py
@@ -161,6 +161,7 @@ class vmmConfig(object):
         self.libvirt_packages = cliconfig.libvirt_packages
         self.askpass_package = cliconfig.askpass_package
         self.default_graphics_from_config = cliconfig.default_graphics
+        self.with_bhyve = cliconfig.with_bhyve
         self.cli_usbredir = None
 
         self.default_storage_format_from_config = "qcow2"
diff --git a/virtManager/connect.py b/virtManager/connect.py
index b779c75..f7f268e 100644
--- a/virtManager/connect.py
+++ b/virtManager/connect.py
@@ -32,7 +32,8 @@ from virtManager.baseclass import vmmGObjectUI
 (HV_QEMU,
 HV_XEN,
 HV_LXC,
-HV_QEMU_SESSION) = range(4)
+HV_QEMU_SESSION,
+HV_BHYVE) = range(5)
 
 (CONN_SSH,
 CONN_TCP,
@@ -153,6 +154,8 @@ class vmmConnect(vmmGObjectUI):
         model.append(["Xen"])
         model.append(["LXC (Linux Containers)"])
         model.append(["QEMU/KVM user session"])
+        if self.config.with_bhyve:
+            model.append(["Bhyve"])
         combo.set_model(model)
         uiutil.set_combo_text_column(combo, 0)
 
@@ -364,6 +367,8 @@ class vmmConnect(vmmGObjectUI):
             hvstr = "xen"
         elif hv == HV_QEMU or hv == HV_QEMU_SESSION:
             hvstr = "qemu"
+        elif hv == HV_BHYVE:
+            hvstr = "bhyve"
         else:
             hvstr = "lxc"
 
@@ -385,7 +390,7 @@ class vmmConnect(vmmGObjectUI):
             hoststr += addrstr + "/"
 
         uri = hvstr + hoststr
-        if hv == HV_QEMU:
+        if hv in (HV_QEMU, HV_BHYVE):
             uri += "system"
         elif hv == HV_QEMU_SESSION:
             uri += "session"
diff --git a/virtcli/cliconfig.py b/virtcli/cliconfig.py
index a6797cc..8aa24b2 100644
--- a/virtcli/cliconfig.py
+++ b/virtcli/cliconfig.py
@@ -88,3 +88,4 @@ hv_packages = _split_list(_get_param("hv_packages", ""))
 askpass_package = _split_list(_get_param("askpass_packages", ""))
 libvirt_packages = _split_list(_get_param("libvirt_packages", ""))
 default_graphics = _get_param("default_graphics", "spice")
+with_bhyve = bool(int(_get_param("with_bhyve", "0")))
-- 
1.9.0




More information about the virt-tools-list mailing list