[libvirt] [PATCH] virsh: Fix error message on vol-create-from failure

If vol-create-from is failed due to 'input volume not found', virsh outputs like this: $ sudo virsh vol-create-from testpool test-vol.xml test.img error: failed to get vol 'test.img', specifying --pool might help error: Storage volume not found: no storage vol with matching path However, '--pool' is incorrect because it is already specified as second argument ('testpool' in this case). It should be "--inputpool". The patch fixes this by using pooloptname, which will be "inputpool" in this case and "pool" in other cases, as error message. --- tools/virsh.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 72344f0..5544a41 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -15216,8 +15216,8 @@ vshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd, if (pool) vshError(ctl, _("failed to get vol '%s'"), n); else - vshError(ctl, _("failed to get vol '%s', specifying --pool " - "might help"), n); + vshError(ctl, _("failed to get vol '%s', specifying --%s " + "might help"), n, pooloptname); } if (pool) -- 1.7.4.1

On Mon, 2011-10-24 at 20:44 +0900, Ryota Ozaki wrote:
If vol-create-from is failed due to 'input volume not found', virsh outputs like this: $ sudo virsh vol-create-from testpool test-vol.xml test.img error: failed to get vol 'test.img', specifying --pool might help error: Storage volume not found: no storage vol with matching path However, '--pool' is incorrect because it is already specified as second argument ('testpool' in this case). It should be "--inputpool".
The patch fixes this by using pooloptname, which will be "inputpool" in this case and "pool" in other cases, as error message. --- tools/virsh.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c index 72344f0..5544a41 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -15216,8 +15216,8 @@ vshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd, if (pool) vshError(ctl, _("failed to get vol '%s'"), n); else - vshError(ctl, _("failed to get vol '%s', specifying --pool " - "might help"), n); + vshError(ctl, _("failed to get vol '%s', specifying --%s " + "might help"), n, pooloptname); }
if (pool)
Tested-by Wenyi Gao <wenyi@linux.vnet.ibm.com> Wenyi Gao

On Wed, Oct 26, 2011 at 7:18 PM, Wenyi Gao <wenyi@linux.vnet.ibm.com> wrote:
On Mon, 2011-10-24 at 20:44 +0900, Ryota Ozaki wrote:
If vol-create-from is failed due to 'input volume not found', virsh outputs like this: $ sudo virsh vol-create-from testpool test-vol.xml test.img error: failed to get vol 'test.img', specifying --pool might help error: Storage volume not found: no storage vol with matching path However, '--pool' is incorrect because it is already specified as second argument ('testpool' in this case). It should be "--inputpool".
The patch fixes this by using pooloptname, which will be "inputpool" in this case and "pool" in other cases, as error message. --- tools/virsh.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c index 72344f0..5544a41 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -15216,8 +15216,8 @@ vshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd, if (pool) vshError(ctl, _("failed to get vol '%s'"), n); else - vshError(ctl, _("failed to get vol '%s', specifying --pool " - "might help"), n); + vshError(ctl, _("failed to get vol '%s', specifying --%s " + "might help"), n, pooloptname); }
if (pool)
Tested-by Wenyi Gao <wenyi@linux.vnet.ibm.com>
Wenyi Gao
Thanks! ozaki-r

On 10/26/2011 04:18 AM, Wenyi Gao wrote:
On Mon, 2011-10-24 at 20:44 +0900, Ryota Ozaki wrote:
If vol-create-from is failed due to 'input volume not found', virsh outputs like this: $ sudo virsh vol-create-from testpool test-vol.xml test.img error: failed to get vol 'test.img', specifying --pool might help error: Storage volume not found: no storage vol with matching path However, '--pool' is incorrect because it is already specified as second argument ('testpool' in this case). It should be "--inputpool".
Tested-by Wenyi Gao<wenyi@linux.vnet.ibm.com>
ACK and pushed. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (3)
-
Eric Blake
-
Ryota Ozaki
-
Wenyi Gao