mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
fix(vrtManager): a new VM's disk path, network and filter names are XML text
create_instance put an existing volume's path and the network and filter names into the domain XML unescaped, so a quote or ampersand, which libvirt allows in them, broke the VM's XML. They are escaped as attach_disk does.
This commit is contained in:
parent
021d75102e
commit
8e24e2ad44
2 changed files with 24 additions and 3 deletions
|
|
@ -227,7 +227,7 @@ class wvmCreate(wvmConnect):
|
|||
else:
|
||||
xml += f"""<disk type='file' device='{volume["device"]}'>"""
|
||||
xml += f""" <driver name='qemu' type='{volume["type"]}' {disk_opts}/>"""
|
||||
xml += f""" <source file='{volume["path"]}'/>"""
|
||||
xml += f""" <source file='{util.xml_escape(volume["path"])}'/>"""
|
||||
|
||||
if volume.get("bus") in dom_caps["disk_bus"]:
|
||||
dev_prefix = util.vol_dev_type(volume.get("bus"))
|
||||
|
|
@ -255,9 +255,9 @@ class wvmCreate(wvmConnect):
|
|||
xml += """<interface type='network'>"""
|
||||
if idx < len(macs):
|
||||
xml += f"""<mac address='{macs[idx].strip()}'/>"""
|
||||
xml += f"""<source network='{net}'/>"""
|
||||
xml += f"""<source network='{util.xml_escape(net)}'/>"""
|
||||
if nwfilter:
|
||||
xml += f"""<filterref filter='{nwfilter}'/>"""
|
||||
xml += f"""<filterref filter='{util.xml_escape(nwfilter)}'/>"""
|
||||
if virtio:
|
||||
xml += f"""<model type='{net_model}'/>"""
|
||||
xml += """</interface>"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue