virt-manager/virtman-device-flags.diff
Charles Arnold 39bfc34504 - Update to virt-manager 0.8.5
* Improved save/restore support
  * Option to view and change disk cache mode
  * Configurable VNC keygrab sequence (Michal Novotny)
- Update to virtinst 0.500.4
  * New virt-install --console option for specifying virtio console 
    device
  * New virt-install --channel option for specifying guest 
    communication channel
  * New virt-install --boot option. Allows setting post-install boot
    order, direct kernel/initrd boot, and enabling boot device menu.
  * New virt-install --initrd-inject option, which enables 
    installation using a _local_ kickstart file (Colin Walters)

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=37
2010-09-27 20:47:12 +00:00

72 lines
3.0 KiB
Diff

Index: virt-manager-0.8.5/src/virtManager/addhardware.py
===================================================================
--- virt-manager-0.8.5.orig/src/virtManager/addhardware.py
+++ virt-manager-0.8.5/src/virtManager/addhardware.py
@@ -1022,6 +1022,18 @@ class vmmAddHardware(gobject.GObject):
self._dev.get_xml_config()
logging.debug("Adding device:\n" + self._dev.get_xml_config())
+ # If vm is active, Try to hotplug the device and modify persistent
+ # config in one go
+ if self.vm.is_active():
+ try:
+ self.vm.attach_device_flags(self._dev, 3)
+ return (False, None)
+ except Exception, e:
+ logging.debug("Could not hotplug device and modify persistent "
+ "config at the same time: %s" % str(e))
+ logging.debug("Trying the operations seperately ...")
+
+ # Try hotplug then modify persistent config
# Hotplug device
attach_err = False
try:
Index: virt-manager-0.8.5/src/virtManager/details.py
===================================================================
--- virt-manager-0.8.5.orig/src/virtManager/details.py
+++ virt-manager-0.8.5/src/virtManager/details.py
@@ -1479,6 +1479,17 @@ class vmmDetails(gobject.GObject):
return
self.config.set_confirm_removedev(not skip_prompt)
+ # If vm is running, try to hot remove the device and modify
+ # persistent config in one go
+ if self.vm.is_active():
+ try:
+ self.vm.detach_device_flags(dev_type, dev_id_info, 3)
+ return
+ except Exception, e:
+ logging.debug("Could not hot remove device and modify "
+ "persistent config at the same time: %s" % str(e))
+ logging.debug("Trying the operations seperately ...")
+
# Define the change
try:
self.vm.remove_device(dev_type, dev_id_info)
Index: virt-manager-0.8.5/src/virtManager/domain.py
===================================================================
--- virt-manager-0.8.5.orig/src/virtManager/domain.py
+++ virt-manager-0.8.5/src/virtManager/domain.py
@@ -1413,6 +1413,10 @@ class vmmDomain(vmmDomainBase):
self._backend.attachDevice(devxml)
+ def attach_device_flags(self, devobj, flags):
+ xml = devobj.get_xml_config()
+ self._backend.attachDeviceFlags(xml, flags)
+
def detach_device(self, devtype, dev_id_info):
"""
Hotunplug device from running guest
@@ -1421,6 +1425,10 @@ class vmmDomain(vmmDomainBase):
if self.is_active():
self._backend.detachDevice(xml)
+ def detach_device_flags(self, devtype, dev_id_info, flags):
+ xml = self._get_device_xml(devtype, dev_id_info)
+ self._backend.detachDeviceFlags(xml, flags)
+
def hotplug_vcpus(self, vcpus):
vcpus = int(vcpus)
if vcpus != self.vcpu_count():