mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
Handle the case where the source device and source type are null -- for example, if a cdrom device exists in the guest config but is not mapped to a backend device.
This commit is contained in:
parent
c3b4a9da71
commit
aec4d3853b
@ -456,23 +456,28 @@ class vmmDomain(gobject.GObject):
|
|||||||
type = node.prop("type")
|
type = node.prop("type")
|
||||||
srcpath = None
|
srcpath = None
|
||||||
devdst = None
|
devdst = None
|
||||||
|
devtype = node.prop("device")
|
||||||
|
if devtype == None:
|
||||||
|
devtype = "disk"
|
||||||
for child in node.children:
|
for child in node.children:
|
||||||
if child.name == "source":
|
if child.name == "source":
|
||||||
if type == "file":
|
if type == "file":
|
||||||
srcpath = child.prop("file")
|
srcpath = child.prop("file")
|
||||||
elif type == "block":
|
elif type == "block":
|
||||||
srcpath = child.prop("dev")
|
srcpath = child.prop("dev")
|
||||||
|
elif type == None:
|
||||||
|
type = "-"
|
||||||
elif child.name == "target":
|
elif child.name == "target":
|
||||||
devdst = child.prop("dev")
|
devdst = child.prop("dev")
|
||||||
|
|
||||||
if srcpath == None:
|
if srcpath == None:
|
||||||
raise RuntimeError("missing source path")
|
if devtype == "cdrom":
|
||||||
|
srcpath = "-"
|
||||||
|
type = "block"
|
||||||
|
else:
|
||||||
|
raise RuntimeError("missing source path")
|
||||||
if devdst == None:
|
if devdst == None:
|
||||||
raise RuntimeError("missing destination device")
|
raise RuntimeError("missing destination device")
|
||||||
|
|
||||||
devtype = node.prop("device")
|
|
||||||
if devtype == None:
|
|
||||||
devtype = "disk"
|
|
||||||
disks.append([type, srcpath, devtype, devdst])
|
disks.append([type, srcpath, devtype, devdst])
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
Reference in New Issue
Block a user