[libvirt] [PATCH] virsh: fix change-media bug on disk block type
Eric Blake
eblake at redhat.com
Mon Jul 22 16:20:01 UTC 2013
On 07/22/2013 01:40 AM, Guannan Ren wrote:
> 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".
> ---
> tools/virsh-domain.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
ACK.
>
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index 606bcdf..8cafce4 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -9866,8 +9866,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"));
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130722/58c2074e/attachment-0001.sig>
More information about the libvir-list
mailing list