Since the maxvcpus command query the maximum number of virtual CPUs supported for a guest VM on this connection, it should be in virsh-host.c but not virsh-domain.c. Signed-off-by: yangdongsheng <yangds.fnst@xxxxxxxxxxxxxx> --- tools/virsh-domain.c | 44 -------------------------------------------- tools/virsh-host.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 4f85f5f..50a57ee 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -5172,44 +5172,6 @@ cmdDomjobabort(vshControl *ctl, const vshCmd *cmd) } /* - * "maxvcpus" command - */ -static const vshCmdInfo info_maxvcpus[] = { - {.name = "help", - .data = N_("connection vcpu maximum") - }, - {.name = "desc", - .data = N_("Show maximum number of virtual CPUs for guests on this connection.") - }, - {.name = NULL} -}; - -static const vshCmdOptDef opts_maxvcpus[] = { - {.name = "type", - .type = VSH_OT_STRING, - .help = N_("domain type") - }, - {.name = NULL} -}; - -static bool -cmdMaxvcpus(vshControl *ctl, const vshCmd *cmd) -{ - const char *type = NULL; - int vcpus; - - if (vshCommandOptStringReq(ctl, cmd, "type", &type) < 0) - return false; - - if ((vcpus = virConnectGetMaxVcpus(ctl->conn, type)) < 0) - return false; - - vshPrint(ctl, "%d\n", vcpus); - - return true; -} - -/* * "vcpucount" command */ static const vshCmdInfo info_vcpucount[] = { @@ -10637,12 +10599,6 @@ const vshCmdDef domManagementCmds[] = { .info = info_managedsaveremove, .flags = 0 }, - {.name = "maxvcpus", - .handler = cmdMaxvcpus, - .opts = opts_maxvcpus, - .info = info_maxvcpus, - .flags = 0 - }, {.name = "memtune", .handler = cmdMemtune, .opts = opts_memtune, diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 880ae4b..f69ab79 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -193,6 +193,44 @@ cleanup: } /* + * "maxvcpus" command + */ +static const vshCmdInfo info_maxvcpus[] = { + {.name = "help", + .data = N_("connection vcpu maximum") + }, + {.name = "desc", + .data = N_("Show maximum number of virtual CPUs for guests on this connection.") + }, + {.name = NULL} +}; + +static const vshCmdOptDef opts_maxvcpus[] = { + {.name = "type", + .type = VSH_OT_STRING, + .help = N_("domain type") + }, + {.name = NULL} +}; + +static bool +cmdMaxvcpus(vshControl *ctl, const vshCmd *cmd) +{ + const char *type = NULL; + int vcpus; + + if (vshCommandOptStringReq(ctl, cmd, "type", &type) < 0) + return false; + + if ((vcpus = virConnectGetMaxVcpus(ctl->conn, type)) < 0) + return false; + + vshPrint(ctl, "%d\n", vcpus); + + return true; +} + +/* * "nodeinfo" command */ static const vshCmdInfo info_nodeinfo[] = { @@ -863,6 +901,12 @@ const vshCmdDef hostAndHypervisorCmds[] = { .info = info_hostname, .flags = 0 }, + {.name = "maxvcpus", + .handler = cmdMaxvcpus, + .opts = opts_maxvcpus, + .info = info_maxvcpus, + .flags = 0 + }, {.name = "node-memory-tune", .handler = cmdNodeMemoryTune, .opts = opts_node_memory_tune, -- 1.7.10.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list