Store virtual media device changes persistently
Prior to this patch, ejecting virtual media was not communicated to libvirt effectively leaving virtual media inserted. Also, changing virtual media properties has not been stored persistently in the emulator. Co-Authored-By: Ilya Etingof <etingof@gmail.com> Change-Id: Ib5505c9a5dbd55bba81bcd6bd5ba315e944e8896
This commit is contained in:
parent
61fbdd3d07
commit
794ca7f3e3
@ -777,8 +777,6 @@ class LibvirtDriver(AbstractSystemsDriver):
|
|||||||
if write_protected:
|
if write_protected:
|
||||||
ET.SubElement(disk_element, 'readonly')
|
ET.SubElement(disk_element, 'readonly')
|
||||||
|
|
||||||
conn.defineXML(ET.tostring(domain_tree).decode('utf-8'))
|
|
||||||
|
|
||||||
def _remove_boot_images(self, domain, domain_tree, device):
|
def _remove_boot_images(self, domain, domain_tree, device):
|
||||||
|
|
||||||
identity = domain.UUIDString()
|
identity = domain.UUIDString()
|
||||||
@ -841,6 +839,9 @@ class LibvirtDriver(AbstractSystemsDriver):
|
|||||||
|
|
||||||
raise error.FishyError(msg)
|
raise error.FishyError(msg)
|
||||||
|
|
||||||
|
with libvirt_open(self._uri) as conn:
|
||||||
|
conn.defineXML(ET.tostring(domain_tree).decode('utf-8'))
|
||||||
|
|
||||||
def _find_device_by_path(self, vol_path):
|
def _find_device_by_path(self, vol_path):
|
||||||
"""Get device attributes using path
|
"""Get device attributes using path
|
||||||
|
|
||||||
|
@ -200,6 +200,8 @@ class StaticDriver(DriverBase):
|
|||||||
device_info['WriteProtected'] = write_protected
|
device_info['WriteProtected'] = write_protected
|
||||||
device_info['_local_file_path'] = local_file_path
|
device_info['_local_file_path'] = local_file_path
|
||||||
|
|
||||||
|
self._devices.update({(identity, device): device_info})
|
||||||
|
|
||||||
return local_file_path
|
return local_file_path
|
||||||
|
|
||||||
def eject_image(self, identity, device):
|
def eject_image(self, identity, device):
|
||||||
@ -216,6 +218,8 @@ class StaticDriver(DriverBase):
|
|||||||
device_info['Inserted'] = False
|
device_info['Inserted'] = False
|
||||||
device_info['WriteProtected'] = False
|
device_info['WriteProtected'] = False
|
||||||
|
|
||||||
|
self._devices.update({(identity, device): device_info})
|
||||||
|
|
||||||
local_file = device_info.pop('_local_file', None)
|
local_file = device_info.pop('_local_file', None)
|
||||||
if local_file:
|
if local_file:
|
||||||
os.unlink(local_file)
|
os.unlink(local_file)
|
||||||
|
Loading…
Reference in New Issue
Block a user