mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-05 12:35:20 +00:00
virsh: fix change-media bug on disk block type
Resolves:https://bugzilla.redhat.com/show_bug.cgi?id=923053
When cdrom is block type, the virsh change-media failed to insert
source info because virsh uses "<source block='/dev/sdb'/>" while
the correct name of the attribute for block disks is "dev".
(cherry picked from commit 7729a16814
)
This commit is contained in:
parent
648bd03118
commit
7b5ea428c8
@ -7941,8 +7941,10 @@ vshPrepareDiskXML(xmlNodePtr disk_node,
|
||||
|
||||
if (source) {
|
||||
new_node = xmlNewNode(NULL, BAD_CAST "source");
|
||||
xmlNewProp(new_node, (const xmlChar *)disk_type,
|
||||
(const xmlChar *)source);
|
||||
if (STREQ(disk_type, "block"))
|
||||
xmlNewProp(new_node, BAD_CAST "dev", BAD_CAST source);
|
||||
else
|
||||
xmlNewProp(new_node, BAD_CAST disk_type, BAD_CAST source);
|
||||
xmlAddChild(disk_node, new_node);
|
||||
} else if (type == VSH_PREPARE_DISK_XML_INSERT) {
|
||||
vshError(NULL, _("No source is specified for inserting media"));
|
||||
|
Loading…
Reference in New Issue
Block a user