From: Guannan Ren Date: Mon, 22 Jul 2013 07:38:43 +0000 (+0800) Subject: virsh: fix change-media bug on disk block type X-Git-Tag: v1.0.5.6~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff165c6a92881932a6535cdfaf0f51d26059d092;p=thirdparty%2Flibvirt.git 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 "" while the correct name of the attribute for block disks is "dev". (cherry picked from commit 7729a16814d5bf3aebd248c9af00296ae2773818) --- diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index bf25ee8f4c..5d9489ce21 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -9631,8 +9631,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"));