mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-05 16:33:50 +00:00
virsh: improve usability of '--print-xml' flag for attach-disk command
'--print-xml' option is very useful for doing some test. But we had to specify a real domain for it. This patch could enable us to specify a fake domain when using --print-xml option. Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com> Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
7ab40c5d09
commit
21f2d80b0c
@ -528,13 +528,6 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (live)
|
if (live)
|
||||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||||
|
|
||||||
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (persistent &&
|
|
||||||
virDomainIsActive(dom) == 1)
|
|
||||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "source", &source) < 0 ||
|
if (vshCommandOptStringReq(ctl, cmd, "source", &source) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "target", &target) < 0 ||
|
vshCommandOptStringReq(ctl, cmd, "target", &target) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "driver", &driver) < 0 ||
|
vshCommandOptStringReq(ctl, cmd, "driver", &driver) < 0 ||
|
||||||
@ -672,6 +665,13 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (persistent &&
|
||||||
|
virDomainIsActive(dom) == 1)
|
||||||
|
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||||
|
|
||||||
if (flags)
|
if (flags)
|
||||||
ret = virDomainAttachDeviceFlags(dom, xml, flags);
|
ret = virDomainAttachDeviceFlags(dom, xml, flags);
|
||||||
else
|
else
|
||||||
@ -686,7 +686,8 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(xml);
|
VIR_FREE(xml);
|
||||||
virDomainFree(dom);
|
if (dom)
|
||||||
|
virDomainFree(dom);
|
||||||
virBufferFreeAndReset(&buf);
|
virBufferFreeAndReset(&buf);
|
||||||
return functionReturn;
|
return functionReturn;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user