[libvirt] [PATCH] virsh: use - not _ in memtune option names

* tools/virsh.c (opts_memtune): All other options in virsh use - for separating words. --- tools/virsh.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index cafd304..b616eef 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -2890,13 +2890,13 @@ static const vshCmdInfo info_memtune[] = { static const vshCmdOptDef opts_memtune[] = { {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")}, - {VIR_DOMAIN_MEMORY_HARD_LIMIT, VSH_OT_INT, VSH_OFLAG_NONE, + {"hard-limit", VSH_OT_INT, VSH_OFLAG_NONE, N_("Max memory in kilobytes")}, - {VIR_DOMAIN_MEMORY_SOFT_LIMIT, VSH_OT_INT, VSH_OFLAG_NONE, + {"soft-limit", VSH_OT_INT, VSH_OFLAG_NONE, N_("Memory during contention in kilobytes")}, - {VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT, VSH_OT_INT, VSH_OFLAG_NONE, + {"swap-hard-limit", VSH_OT_INT, VSH_OFLAG_NONE, N_("Max swap in kilobytes")}, - {VIR_DOMAIN_MEMORY_MIN_GUARANTEE, VSH_OT_INT, VSH_OFLAG_NONE, + {"min-guarantee", VSH_OT_INT, VSH_OFLAG_NONE, N_("Min guaranteed memory in kilobytes")}, {NULL, 0, 0, NULL} }; -- 1.7.2.3

2010/10/26 Eric Blake <eblake@redhat.com>:
* tools/virsh.c (opts_memtune): All other options in virsh use - for separating words. --- tools/virsh.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c index cafd304..b616eef 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -2890,13 +2890,13 @@ static const vshCmdInfo info_memtune[] = {
static const vshCmdOptDef opts_memtune[] = { {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")}, - {VIR_DOMAIN_MEMORY_HARD_LIMIT, VSH_OT_INT, VSH_OFLAG_NONE, + {"hard-limit", VSH_OT_INT, VSH_OFLAG_NONE, N_("Max memory in kilobytes")}, - {VIR_DOMAIN_MEMORY_SOFT_LIMIT, VSH_OT_INT, VSH_OFLAG_NONE, + {"soft-limit", VSH_OT_INT, VSH_OFLAG_NONE, N_("Memory during contention in kilobytes")}, - {VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT, VSH_OT_INT, VSH_OFLAG_NONE, + {"swap-hard-limit", VSH_OT_INT, VSH_OFLAG_NONE, N_("Max swap in kilobytes")}, - {VIR_DOMAIN_MEMORY_MIN_GUARANTEE, VSH_OT_INT, VSH_OFLAG_NONE, + {"min-guarantee", VSH_OT_INT, VSH_OFLAG_NONE, N_("Min guaranteed memory in kilobytes")}, {NULL, 0, 0, NULL} }; -- 1.7.2.3
Doesn't this break calls like this in cmdMemtune: vshCommandOptLongLong(cmd, VIR_DOMAIN_MEMORY_HARD_LIMIT, NULL); and this needs to be replaced by: vshCommandOptLongLong(cmd, "hard-limit", NULL); Matthias

On 10/26/2010 12:05 PM, Matthias Bolte wrote:
2010/10/26 Eric Blake<eblake@redhat.com>:
* tools/virsh.c (opts_memtune): All other options in virsh use - for separating words. --- tools/virsh.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c index cafd304..b616eef 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -2890,13 +2890,13 @@ static const vshCmdInfo info_memtune[] = {
static const vshCmdOptDef opts_memtune[] = { {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")}, - {VIR_DOMAIN_MEMORY_HARD_LIMIT, VSH_OT_INT, VSH_OFLAG_NONE, + {"hard-limit", VSH_OT_INT, VSH_OFLAG_NONE, N_("Max memory in kilobytes")},
Doesn't this break calls like this in cmdMemtune:
vshCommandOptLongLong(cmd, VIR_DOMAIN_MEMORY_HARD_LIMIT, NULL);
and this needs to be replaced by:
vshCommandOptLongLong(cmd, "hard-limit", NULL);
Indeed. Thanks for catching that. The #defines hid from my grep; v2 coming up soon. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

* tools/virsh.c (opts_memtune): All other options in virsh use - for separating words. --- v2: test correct option names in memtune implementation tools/virsh.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index cafd304..a182d4c 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -2890,13 +2890,13 @@ static const vshCmdInfo info_memtune[] = { static const vshCmdOptDef opts_memtune[] = { {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")}, - {VIR_DOMAIN_MEMORY_HARD_LIMIT, VSH_OT_INT, VSH_OFLAG_NONE, + {"hard-limit", VSH_OT_INT, VSH_OFLAG_NONE, N_("Max memory in kilobytes")}, - {VIR_DOMAIN_MEMORY_SOFT_LIMIT, VSH_OT_INT, VSH_OFLAG_NONE, + {"soft-limit", VSH_OT_INT, VSH_OFLAG_NONE, N_("Memory during contention in kilobytes")}, - {VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT, VSH_OT_INT, VSH_OFLAG_NONE, + {"swap-hard-limit", VSH_OT_INT, VSH_OFLAG_NONE, N_("Max swap in kilobytes")}, - {VIR_DOMAIN_MEMORY_MIN_GUARANTEE, VSH_OT_INT, VSH_OFLAG_NONE, + {"min-guarantee", VSH_OT_INT, VSH_OFLAG_NONE, N_("Min guaranteed memory in kilobytes")}, {NULL, 0, 0, NULL} }; @@ -2918,22 +2918,22 @@ cmdMemtune(vshControl * ctl, const vshCmd * cmd) return FALSE; hard_limit = - vshCommandOptLongLong(cmd, VIR_DOMAIN_MEMORY_HARD_LIMIT, NULL); + vshCommandOptLongLong(cmd, "hard-limit", NULL); if (hard_limit) nparams++; soft_limit = - vshCommandOptLongLong(cmd, VIR_DOMAIN_MEMORY_SOFT_LIMIT, NULL); + vshCommandOptLongLong(cmd, "soft-limit", NULL); if (soft_limit) nparams++; swap_hard_limit = - vshCommandOptLongLong(cmd, VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT, NULL); + vshCommandOptLongLong(cmd, "swap-hard-limit", NULL); if (swap_hard_limit) nparams++; min_guarantee = - vshCommandOptLongLong(cmd, VIR_DOMAIN_MEMORY_MIN_GUARANTEE, NULL); + vshCommandOptLongLong(cmd, "min-guarantee", NULL); if (min_guarantee) nparams++; -- 1.7.2.3

2010/10/26 Eric Blake <eblake@redhat.com>:
* tools/virsh.c (opts_memtune): All other options in virsh use - for separating words. ---
v2: test correct option names in memtune implementation
tools/virsh.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c index cafd304..a182d4c 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -2890,13 +2890,13 @@ static const vshCmdInfo info_memtune[] = {
static const vshCmdOptDef opts_memtune[] = { {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")}, - {VIR_DOMAIN_MEMORY_HARD_LIMIT, VSH_OT_INT, VSH_OFLAG_NONE, + {"hard-limit", VSH_OT_INT, VSH_OFLAG_NONE, N_("Max memory in kilobytes")}, - {VIR_DOMAIN_MEMORY_SOFT_LIMIT, VSH_OT_INT, VSH_OFLAG_NONE, + {"soft-limit", VSH_OT_INT, VSH_OFLAG_NONE, N_("Memory during contention in kilobytes")}, - {VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT, VSH_OT_INT, VSH_OFLAG_NONE, + {"swap-hard-limit", VSH_OT_INT, VSH_OFLAG_NONE, N_("Max swap in kilobytes")}, - {VIR_DOMAIN_MEMORY_MIN_GUARANTEE, VSH_OT_INT, VSH_OFLAG_NONE, + {"min-guarantee", VSH_OT_INT, VSH_OFLAG_NONE, N_("Min guaranteed memory in kilobytes")}, {NULL, 0, 0, NULL} }; @@ -2918,22 +2918,22 @@ cmdMemtune(vshControl * ctl, const vshCmd * cmd) return FALSE;
hard_limit = - vshCommandOptLongLong(cmd, VIR_DOMAIN_MEMORY_HARD_LIMIT, NULL); + vshCommandOptLongLong(cmd, "hard-limit", NULL); if (hard_limit) nparams++;
soft_limit = - vshCommandOptLongLong(cmd, VIR_DOMAIN_MEMORY_SOFT_LIMIT, NULL); + vshCommandOptLongLong(cmd, "soft-limit", NULL); if (soft_limit) nparams++;
swap_hard_limit = - vshCommandOptLongLong(cmd, VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT, NULL); + vshCommandOptLongLong(cmd, "swap-hard-limit", NULL); if (swap_hard_limit) nparams++;
min_guarantee = - vshCommandOptLongLong(cmd, VIR_DOMAIN_MEMORY_MIN_GUARANTEE, NULL); + vshCommandOptLongLong(cmd, "min-guarantee", NULL); if (min_guarantee) nparams++;
-- 1.7.2.3
This looks better. ACK. Matthias

On 10/26/2010 03:46 PM, Matthias Bolte wrote:
2010/10/26 Eric Blake<eblake@redhat.com>:
* tools/virsh.c (opts_memtune): All other options in virsh use - for separating words. ---
v2: test correct option names in memtune implementation
min_guarantee = - vshCommandOptLongLong(cmd, VIR_DOMAIN_MEMORY_MIN_GUARANTEE, NULL); + vshCommandOptLongLong(cmd, "min-guarantee", NULL); if (min_guarantee) nparams++;
-- 1.7.2.3
This looks better.
ACK.
Thanks; pushed. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
Matthias Bolte