Remove mem/cpu hotplug checks.

We can't reliably determine whether it's supported or not, so just leave
the error reporting up to libvirt.
This commit is contained in:
Cole Robinson
2009-03-13 13:51:35 -04:00
parent bdf1801123
commit d49d0778c5
2 changed files with 6 additions and 35 deletions

View File

@@ -749,15 +749,9 @@ class vmmDetails(gobject.GObject):
if status in [ libvirt.VIR_DOMAIN_SHUTOFF, libvirt.VIR_DOMAIN_CRASHED ] and not self.vm.is_read_only():
self.window.get_widget("control-run").set_sensitive(True)
self.window.get_widget("details-menu-run").set_sensitive(True)
self.window.get_widget("config-vcpus").set_sensitive(True)
self.window.get_widget("config-memory").set_sensitive(True)
self.window.get_widget("config-maxmem").set_sensitive(True)
else:
self.window.get_widget("control-run").set_sensitive(False)
self.window.get_widget("details-menu-run").set_sensitive(False)
self.window.get_widget("config-vcpus").set_sensitive(self.vm.is_vcpu_hotplug_capable())
self.window.get_widget("config-memory").set_sensitive(self.vm.is_memory_hotplug_capable())
self.window.get_widget("config-maxmem").set_sensitive(True)
if status in [libvirt.VIR_DOMAIN_SHUTDOWN, libvirt.VIR_DOMAIN_SHUTOFF,
libvirt.VIR_DOMAIN_CRASHED ] or vm.is_read_only():
@@ -775,11 +769,12 @@ class vmmDetails(gobject.GObject):
self.window.get_widget("details-menu-shutdown").set_sensitive(True)
self.window.get_widget("details-menu-save").set_sensitive(True)
# Currently, the condition that "Migrate" become insensitive is only "readonly".
if vm.is_read_only():
self.window.get_widget("details-menu-migrate").set_sensitive(False)
else:
self.window.get_widget("details-menu-migrate").set_sensitive(True)
ro = vm.is_read_only()
self.window.get_widget("config-vcpus").set_sensitive(not ro)
self.window.get_widget("config-memory").set_sensitive(not ro)
self.window.get_widget("config-maxmem").set_sensitive(not ro)
self.window.get_widget("details-menu-migrate").set_sensitive(not ro)
if not ro:
self.set_migrate_menu()
if status in [ libvirt.VIR_DOMAIN_SHUTOFF ,libvirt.VIR_DOMAIN_CRASHED ]:

View File

@@ -181,30 +181,6 @@ class vmmDomain(gobject.GObject):
# FIXME: This should be static, not parse xml everytime
return vutil.get_xml_path(self.get_xml(), "/domain/@type")
def is_vcpu_hotplug_capable(self):
# Read only connections aren't allowed to change it
if self.connection.is_read_only():
return False
# Running paravirt guests can change it, or any inactive guest
if self.vm.OSType() == "linux" \
or self.status() not in [libvirt.VIR_DOMAIN_RUNNING,\
libvirt.VIR_DOMAIN_PAUSED]:
return True
# Everyone else is out of luck
return False
def is_memory_hotplug_capable(self):
# Read only connections aren't allowed to change it
if self.connection.is_read_only():
return False
# Running paravirt guests can change it, or any inactive guest
if self.vm.OSType() == "linux" \
or self.status() not in [libvirt.VIR_DOMAIN_RUNNING,\
libvirt.VIR_DOMAIN_PAUSED]:
return True
# Everyone else is out of luck
return False
def _normalize_status(self, status):
if status == libvirt.VIR_DOMAIN_NOSTATE:
return libvirt.VIR_DOMAIN_RUNNING