From bc9d6cf6d532314a2723890df07fa1a917c9a1f5 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sat, 22 Aug 2020 13:22:51 -0400 Subject: [PATCH] Drop some explicit openvz handling I don't think many, if any, people are using virt-manager with openvz. Drop the specific handling the filesystem UI, users can use the raw XML editor if they need special behavior Signed-off-by: Cole Robinson --- tests/test_conn.py | 2 +- virtManager/connection.py | 4 ++-- virtManager/createvm.py | 10 +++++----- virtManager/device/fsdetails.py | 12 +++--------- virtinst/connection.py | 2 +- 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/tests/test_conn.py b/tests/test_conn.py index a8d55f7c..4194e3c3 100644 --- a/tests/test_conn.py +++ b/tests/test_conn.py @@ -21,7 +21,7 @@ class TestConn(unittest.TestCase): conn.invalidate_caps() assert conn.libvirt_new_enough_for_virtmanager(1000) is True assert conn.is_open() is True - assert conn.is_container() is False + assert conn.is_container_only() is False assert conn.is_openvz() is False assert not conn.get_uri_hostname() assert not conn.get_uri_port() diff --git a/virtManager/connection.py b/virtManager/connection.py index 09899bf9..16f4f6e3 100644 --- a/virtManager/connection.py +++ b/virtManager/connection.py @@ -329,9 +329,9 @@ class vmmConnection(vmmGObject): getattr(s, "_backend").get_uri_transport) get_uri_port = property(lambda s: getattr(s, "_backend").get_uri_port) get_driver = property(lambda s: getattr(s, "_backend").get_uri_driver) - is_container = property(lambda s: getattr(s, "_backend").is_container) + is_container_only = property( + lambda s: getattr(s, "_backend").is_container_only) is_lxc = property(lambda s: getattr(s, "_backend").is_lxc) - is_openvz = property(lambda s: getattr(s, "_backend").is_openvz) is_vz = property(lambda s: getattr(s, "_backend").is_vz) is_xen = property(lambda s: getattr(s, "_backend").is_xen) is_remote = property(lambda s: getattr(s, "_backend").is_remote) diff --git a/virtManager/createvm.py b/virtManager/createvm.py index ca9ca97c..40e42db7 100644 --- a/virtManager/createvm.py +++ b/virtManager/createvm.py @@ -471,7 +471,7 @@ class vmmCreateVM(vmmGObjectUI): is_storage_capable = self.conn.support.conn_storage() can_storage = (is_local or is_storage_capable) is_pv = guest.os.is_xenpv() - is_container = self.conn.is_container() + is_container_only = self.conn.is_container_only() is_vz = self.conn.is_vz() is_vz_container = is_vz and guest.os.is_container() can_remote_url = self.conn.get_backend().support_remote_url_install() @@ -505,7 +505,7 @@ class vmmCreateVM(vmmGObjectUI): installable_arch) method_local.set_sensitive(not is_pv and can_storage and installable_arch) - method_manual.set_sensitive(not is_container) + method_manual.set_sensitive(not is_container_only) method_import.set_sensitive(can_storage) virt_methods = [method_local, method_tree, method_manual, method_import] @@ -538,7 +538,7 @@ class vmmCreateVM(vmmGObjectUI): w.set_active(True) break - if not (is_container or + if not (is_container_only or [w for w in virt_methods if w.get_sensitive()]): return self._show_startup_error( _("No install methods available for this connection."), @@ -550,10 +550,10 @@ class vmmCreateVM(vmmGObjectUI): # Container install options method_container_app.set_active(True) - self.widget("container-install-box").set_visible(is_container) + self.widget("container-install-box").set_visible(is_container_only) self.widget("vz-install-box").set_visible(is_vz) self.widget("virt-install-box").set_visible( - not is_container and not is_vz_container) + not is_container_only and not is_vz_container) self.widget("kernel-info-box").set_visible(not installable_arch) diff --git a/virtManager/device/fsdetails.py b/virtManager/device/fsdetails.py index 0e79c0fd..c7c877c7 100644 --- a/virtManager/device/fsdetails.py +++ b/virtManager/device/fsdetails.py @@ -88,11 +88,7 @@ class vmmFSDetails(vmmGObjectUI): model.append([xmlval, label]) # Filesystem widgets - if self.conn.is_openvz(): - simple_store_set("fs-type-combo", - [DeviceFilesystem.TYPE_MOUNT, - DeviceFilesystem.TYPE_TEMPLATE], sort=False) - elif self.conn.is_lxc(): + if self.conn.is_container_only(): simple_store_set("fs-type-combo", [DeviceFilesystem.TYPE_MOUNT, DeviceFilesystem.TYPE_FILE, @@ -116,8 +112,7 @@ class vmmFSDetails(vmmGObjectUI): simple_store_set("fs-format-combo", ["raw", "qcow2"], capitalize=False) simple_store_set("fs-wrpolicy-combo", DeviceFilesystem.WRPOLICIES + [None]) - self.show_pair_combo("fs-type", - self.conn.is_openvz() or self.conn.is_lxc()) + self.show_pair_combo("fs-type", self.conn.is_container_only()) self.show_check_button("fs-readonly", self.conn.is_qemu() or self.conn.is_test() or @@ -178,8 +173,7 @@ class vmmFSDetails(vmmGObjectUI): self.widget("fs-target").set_text(dev.target or "") self.widget("fs-readonly").set_active(dev.readonly) - self.show_pair_combo("fs-type", - self.conn.is_openvz() or self.conn.is_lxc()) + self.show_pair_combo("fs-type", self.conn.is_container_only()) def set_config_value(self, name, value): combo = self.widget("%s-combo" % name) diff --git a/virtinst/connection.py b/virtinst/connection.py index 992e7357..af9d38cc 100644 --- a/virtinst/connection.py +++ b/virtinst/connection.py @@ -385,7 +385,7 @@ class VirtinstConnection(object): return self._uriobj.scheme.startswith("lxc") def is_openvz(self): return self._uriobj.scheme.startswith("openvz") - def is_container(self): + def is_container_only(self): return self.is_lxc() or self.is_openvz() def is_vz(self): return (self._uriobj.scheme.startswith("vz") or