Skip to content

Commit 148b17a

Browse files
AlanJagerliang-hanyu
authored andcommitted
<fix>[vm]: fix disk missing address config
Change-Id: I6b616366716d627463686e776161717a66777265
1 parent 5b1311b commit 148b17a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

kvmagent/kvmagent/plugins/vm_plugin.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,16 +1856,16 @@ def set_device_address(disk_element, vol, vm_to_attach=None):
18561856

18571857
if vol.pciAddress and vol.pciAddress.type == 'pci':
18581858
attributes = {}
1859-
18601859
if vol.pciAddress.domain:
1861-
attributes = {'domain': '0x%s' % vol.pciAddress.domain}
1860+
attributes['domain'] = vol.pciAddress.domain
18621861
if vol.pciAddress.bus:
1863-
attributes = {'bus': '0x%s' % vol.pciAddress.bus}
1862+
attributes['bus'] = vol.pciAddress.bus
18641863
if vol.pciAddress.slot:
1865-
attributes = {'slot': '0x%s' % vol.pciAddress.slot}
1864+
attributes['slot'] = vol.pciAddress.slot
18661865
if vol.pciAddress.function:
1867-
attributes = {'function': '0x%s' % vol.pciAddress.function}
1868-
attributes = {'type': vol.pciAddress.type}
1866+
attributes['function'] = vol.pciAddress.function
1867+
1868+
attributes['type'] = vol.pciAddress.type
18691869
e(disk_element, 'address', None, attributes)
18701870
elif vol.pciAddress and vol.pciAddress.type == 'driver':
18711871
e(disk_element, 'address', None, {'type': 'drive', 'controller': '0', 'unit': str(vol.pciAddress.function)})
@@ -5213,6 +5213,8 @@ def _start_vm(self, cmd):
52135213
else:
52145214
snapshot_path = cmd.memorySnapshotPath
52155215

5216+
logger.debug('restoring vm:\n%s' % self.domain_xml)
5217+
52165218
try:
52175219
vm.restore(snapshot_path)
52185220
finally:

0 commit comments

Comments
 (0)