
On 07/05/2011 01:25 AM, Hu Tao wrote:
Add --cache option to allow user to specify cache mode of disk device from virsh command line when attaching a disk device. --- tools/virsh.c | 10 ++++++++-- tools/virsh.pod | 5 +++-- 2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c index 9a189fd..cab5a35 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -10176,6 +10176,7 @@ static const vshCmdOptDef opts_attach_disk[] = { {"target", VSH_OT_DATA, VSH_OFLAG_REQ, N_("target of disk device")}, {"driver", VSH_OT_STRING, 0, N_("driver of disk device")}, {"subdriver", VSH_OT_STRING, 0, N_("subdriver of disk device")}, + {"cache", VSH_OT_STRING, 0, N_("cache mode of disk device")},
Nice.
+ ignore_value(vshCommandOptString(cmd, "cache", &cache));
Not so nice. --cache '' will make vshCommandOptString return -1, because that usage is a virsh usage error and should be diagnosed as such up front, rather than accidentally passing cache='' through the XML to the libvirt API. Patch 2/3 shares the same problem. And since all three patches are touching the same 'virsh attach-disk' command, I'd be fine if you wanted to squash them into a single patch for v2. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org