[libvirt] [PATCH] Clarify an error message in setmem.

Signed-off-by: Chris Lalancette <clalance@redhat.com> --- tools/virsh.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index ad64bc0..d241fa0 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -2407,7 +2407,8 @@ cmdSetmem(vshControl *ctl, const vshCmd *cmd) if (kilobytes > info.maxMem) { virDomainFree(dom); - vshError(ctl, _("Invalid value of %d for memory size"), kilobytes); + vshError(ctl, _("Requested memory size %d kb is larger than maximum of %lu kb"), + kilobytes, info.maxMem); return FALSE; } -- 1.6.6.1

On 04/05/2010 11:37 AM, Chris Lalancette wrote:
Signed-off-by: Chris Lalancette <clalance@redhat.com> --- tools/virsh.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c index ad64bc0..d241fa0 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -2407,7 +2407,8 @@ cmdSetmem(vshControl *ctl, const vshCmd *cmd)
if (kilobytes > info.maxMem) { virDomainFree(dom); - vshError(ctl, _("Invalid value of %d for memory size"), kilobytes); + vshError(ctl, _("Requested memory size %d kb is larger than maximum of %lu kb"), + kilobytes, info.maxMem);
ACK to the wording change. But why is kilobytes int, while info.maxMem is unsigned long? Could that ever bite us when converting 32-bit kilobytes to 64-bit unsigned? -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On 04/05/2010 04:58 PM, Eric Blake wrote:
On 04/05/2010 11:37 AM, Chris Lalancette wrote:
Signed-off-by: Chris Lalancette <clalance@redhat.com> --- tools/virsh.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c index ad64bc0..d241fa0 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -2407,7 +2407,8 @@ cmdSetmem(vshControl *ctl, const vshCmd *cmd)
if (kilobytes > info.maxMem) { virDomainFree(dom); - vshError(ctl, _("Invalid value of %d for memory size"), kilobytes); + vshError(ctl, _("Requested memory size %d kb is larger than maximum of %lu kb"), + kilobytes, info.maxMem);
ACK to the wording change.
But why is kilobytes int, while info.maxMem is unsigned long? Could that ever bite us when converting 32-bit kilobytes to 64-bit unsigned?
Yeah, I noticed that as well. I think it's just the fact that we don't have vshCommandOptUnsignedLong helper. We can easily add it; I'll put it on the todo list. I've pushed the wording change. -- Chris Lalancette
participants (2)
-
Chris Lalancette
-
Eric Blake