Rather than continually cut-n-paste the strings into each command,
create a common macro to be used generically. Note that not all
'{.name = "domain",' entries are replaced, just those that have the
common .help string of "domain name, id or uuid" and those that are
required.
Other instances won't take all 3 options, but some subset of those
options as directed by the virshCommandOptDomainBy flags argument or
in some instances where the domain is not a required option.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
tools/virsh-domain.c | 445 +++++++++------------------------------------------
tools/virsh.h | 7 +
2 files changed, 81 insertions(+), 371 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 7650535..916c754 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -63,7 +63,6 @@
# define SA_SIGINFO 0
#endif
-
static virDomainPtr
virshLookupDomainInternal(vshControl *ctl,
const char *cmdname,
@@ -206,11 +205,7 @@ static const vshCmdInfo info_attach_device[] = {
};
static const vshCmdOptDef opts_attach_device[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "file",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -308,11 +303,7 @@ static const vshCmdInfo info_attach_disk[] = {
};
static const vshCmdOptDef opts_attach_disk[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "source",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ | VSH_OFLAG_EMPTY_OK,
@@ -808,11 +799,7 @@ static const vshCmdInfo info_attach_interface[] = {
};
static const vshCmdOptDef opts_attach_interface[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "type",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -1135,11 +1122,7 @@ static const vshCmdInfo info_autostart[] = {
};
static const vshCmdOptDef opts_autostart[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "disable",
.type = VSH_OT_BOOL,
.help = N_("disable autostarting")
@@ -1191,11 +1174,7 @@ static const vshCmdInfo info_blkdeviotune[] = {
};
static const vshCmdOptDef opts_blkdeviotune[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "device",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -1534,11 +1513,7 @@ static const vshCmdInfo info_blkiotune[] = {
};
static const vshCmdOptDef opts_blkiotune[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "weight",
.type = VSH_OT_INT,
.help = N_("IO Weight")
@@ -2007,11 +1982,7 @@ static const vshCmdInfo info_block_commit[] = {
};
static const vshCmdOptDef opts_block_commit[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "path",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -2227,11 +2198,7 @@ static const vshCmdInfo info_block_copy[] = {
};
static const vshCmdOptDef opts_block_copy[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "path",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -2532,11 +2499,7 @@ static const vshCmdInfo info_block_job[] = {
};
static const vshCmdOptDef opts_block_job[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "path",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -2777,11 +2740,7 @@ static const vshCmdInfo info_block_pull[] = {
};
static const vshCmdOptDef opts_block_pull[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "path",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -2916,11 +2875,7 @@ static const vshCmdInfo info_block_resize[] = {
};
static const vshCmdOptDef opts_block_resize[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "path",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -2984,11 +2939,7 @@ static const vshCmdInfo info_console[] = {
};
static const vshCmdOptDef opts_console[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "devname", /* sc_prohibit_devname */
.type = VSH_OT_STRING,
.help = N_("character device name")
@@ -3082,11 +3033,7 @@ static const vshCmdInfo info_domif_setlink[] = {
};
static const vshCmdOptDef opts_domif_setlink[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "interface",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -3269,11 +3216,7 @@ static const vshCmdInfo info_domiftune[] = {
};
static const vshCmdOptDef opts_domiftune[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "interface",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -3479,11 +3422,7 @@ static const vshCmdInfo info_suspend[] = {
};
static const vshCmdOptDef opts_suspend[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = NULL}
};
@@ -3525,11 +3464,7 @@ static const vshCmdInfo info_dom_pm_suspend[] = {
};
static const vshCmdOptDef opts_dom_pm_suspend[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "target",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -3607,11 +3542,7 @@ static const vshCmdInfo info_dom_pm_wakeup[] = {
};
static const vshCmdOptDef opts_dom_pm_wakeup[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = NULL}
};
@@ -4245,11 +4176,7 @@ static const vshCmdInfo info_save[] = {
};
static const vshCmdOptDef opts_save[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "file",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -4715,11 +4642,7 @@ static const vshCmdInfo info_managedsave[] = {
};
static const vshCmdOptDef opts_managedsave[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "bypass-cache",
.type = VSH_OT_BOOL,
.help = N_("avoid file system cache when saving")
@@ -4839,11 +4762,7 @@ static const vshCmdInfo info_managedsaveremove[] = {
};
static const vshCmdOptDef opts_managedsaveremove[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = NULL}
};
@@ -4898,11 +4817,7 @@ static const vshCmdInfo info_schedinfo[] = {
};
static const vshCmdOptDef opts_schedinfo[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "weight",
.type = VSH_OT_INT,
.flags = VSH_OFLAG_REQ_OPT,
@@ -5226,11 +5141,7 @@ static const vshCmdInfo info_dump[] = {
};
static const vshCmdOptDef opts_dump[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "file",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -5409,11 +5320,7 @@ static const vshCmdInfo info_screenshot[] = {
};
static const vshCmdOptDef opts_screenshot[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "file",
.type = VSH_OT_STRING,
.help = N_("where to store the screenshot")
@@ -5556,11 +5463,7 @@ static const vshCmdInfo info_set_user_password[] = {
};
static const vshCmdOptDef opts_set_user_password[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "user",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -5624,11 +5527,7 @@ static const vshCmdInfo info_resume[] = {
};
static const vshCmdOptDef opts_resume[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = NULL}
};
@@ -5667,11 +5566,7 @@ static const vshCmdInfo info_shutdown[] = {
};
static const vshCmdOptDef opts_shutdown[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "mode",
.type = VSH_OT_STRING,
.help = N_("shutdown mode: acpi|agent|initctl|signal|paravirt")
@@ -5756,11 +5651,7 @@ static const vshCmdInfo info_reboot[] = {
};
static const vshCmdOptDef opts_reboot[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "mode",
.type = VSH_OT_STRING,
.help = N_("shutdown mode: acpi|agent|initctl|signal|paravirt")
@@ -5840,11 +5731,7 @@ static const vshCmdInfo info_reset[] = {
};
static const vshCmdOptDef opts_reset[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = NULL}
};
@@ -5883,11 +5770,7 @@ static const vshCmdInfo info_domjobinfo[] = {
};
static const vshCmdOptDef opts_domjobinfo[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "completed",
.type = VSH_OT_BOOL,
.help = N_("return statistics of a recently completed job")
@@ -6169,11 +6052,7 @@ static const vshCmdInfo info_domjobabort[] = {
};
static const vshCmdOptDef opts_domjobabort[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = NULL}
};
@@ -6207,11 +6086,7 @@ static const vshCmdInfo info_vcpucount[] = {
};
static const vshCmdOptDef opts_vcpucount[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "maximum",
.type = VSH_OT_BOOL,
.help = N_("get maximum count of vcpus")
@@ -6422,11 +6297,7 @@ static const vshCmdInfo info_vcpuinfo[] = {
};
static const vshCmdOptDef opts_vcpuinfo[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "pretty",
.type = VSH_OT_BOOL,
.help = N_("return human readable output")
@@ -6537,11 +6408,7 @@ static const vshCmdInfo info_vcpupin[] = {
};
static const vshCmdOptDef opts_vcpupin[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "vcpu",
.type = VSH_OT_INT,
.help = N_("vcpu number")
@@ -6749,11 +6616,7 @@ static const vshCmdInfo info_emulatorpin[] = {
};
static const vshCmdOptDef opts_emulatorpin[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "cpulist",
.type = VSH_OT_STRING,
.flags = VSH_OFLAG_EMPTY_OK,
@@ -6866,11 +6729,7 @@ static const vshCmdInfo info_setvcpus[] = {
};
static const vshCmdOptDef opts_setvcpus[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "count",
.type = VSH_OT_INT,
.flags = VSH_OFLAG_REQ,
@@ -6967,11 +6826,7 @@ static const vshCmdInfo info_iothreadinfo[] = {
{.name = NULL}
};
static const vshCmdOptDef opts_iothreadinfo[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "config",
.type = VSH_OT_BOOL,
.help = N_("affect next boot")
@@ -7056,11 +6911,7 @@ static const vshCmdInfo info_iothreadpin[] = {
};
static const vshCmdOptDef opts_iothreadpin[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "iothread",
.type = VSH_OT_INT,
.flags = VSH_OFLAG_REQ,
@@ -7151,11 +7002,7 @@ static const vshCmdInfo info_iothreadadd[] = {
};
static const vshCmdOptDef opts_iothreadadd[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "id",
.type = VSH_OT_INT,
.flags = VSH_OFLAG_REQ,
@@ -7229,11 +7076,7 @@ static const vshCmdInfo info_iothreaddel[] = {
};
static const vshCmdOptDef opts_iothreaddel[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "id",
.type = VSH_OT_INT,
.flags = VSH_OFLAG_REQ,
@@ -7526,11 +7369,7 @@ static const vshCmdInfo info_cpu_stats[] = {
};
static const vshCmdOptDef opts_cpu_stats[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "total",
.type = VSH_OT_BOOL,
.help = N_("Show total statistics only")
@@ -7877,11 +7716,7 @@ static const vshCmdInfo info_destroy[] = {
};
static const vshCmdOptDef opts_destroy[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "graceful",
.type = VSH_OT_BOOL,
.help = N_("terminate gracefully")
@@ -7934,11 +7769,7 @@ static const vshCmdInfo info_desc[] = {
};
static const vshCmdOptDef opts_desc[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("modify/get running state")
@@ -8113,11 +7944,7 @@ static const vshCmdInfo info_metadata[] = {
};
static const vshCmdOptDef opts_metadata[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "uri",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -8272,11 +8099,7 @@ static const vshCmdInfo info_inject_nmi[] = {
};
static const vshCmdOptDef opts_inject_nmi[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = NULL}
};
@@ -8310,11 +8133,7 @@ static const vshCmdInfo info_send_key[] = {
};
static const vshCmdOptDef opts_send_key[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "codeset",
.type = VSH_OT_STRING,
.flags = VSH_OFLAG_REQ_OPT,
@@ -8410,11 +8229,7 @@ static const vshCmdInfo info_send_process_signal[] = {
};
static const vshCmdOptDef opts_send_process_signal[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "pid",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -8519,11 +8334,7 @@ static const vshCmdInfo info_setmem[] = {
};
static const vshCmdOptDef opts_setmem[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "kilobytes",
.type = VSH_OT_ALIAS,
.help = "size"
@@ -8613,11 +8424,7 @@ static const vshCmdInfo info_setmaxmem[] = {
};
static const vshCmdOptDef opts_setmaxmem[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "kilobytes",
.type = VSH_OT_ALIAS,
.help = "size"
@@ -8714,11 +8521,7 @@ static const vshCmdInfo info_memtune[] = {
};
static const vshCmdOptDef opts_memtune[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "hard-limit",
.type = VSH_OT_INT,
.help = N_("Max memory, as scaled integer (default KiB)")
@@ -8904,11 +8707,7 @@ static const vshCmdInfo info_numatune[] = {
};
static const vshCmdOptDef opts_numatune[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "mode",
.type = VSH_OT_STRING,
.help = N_("NUMA mode, one of strict, preferred and interleave \n"
@@ -9052,11 +8851,7 @@ static const vshCmdInfo info_qemu_monitor_command[] = {
};
static const vshCmdOptDef opts_qemu_monitor_command[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "hmp",
.type = VSH_OT_BOOL,
.help = N_("command is in human monitor protocol")
@@ -9342,11 +9137,7 @@ static const vshCmdInfo info_qemu_agent_command[] = {
};
static const vshCmdOptDef opts_qemu_agent_command[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "timeout",
.type = VSH_OT_INT,
.flags = VSH_OFLAG_REQ_OPT,
@@ -9469,11 +9260,7 @@ static const vshCmdInfo info_lxc_enter_namespace[] = {
};
static const vshCmdOptDef opts_lxc_enter_namespace[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "noseclabel",
.type = VSH_OT_BOOL,
.help = N_("Do not change process security label")
@@ -9612,11 +9399,7 @@ static const vshCmdInfo info_dumpxml[] = {
};
static const vshCmdOptDef opts_dumpxml[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "inactive",
.type = VSH_OT_BOOL,
.help = N_("show inactive defined XML")
@@ -9836,11 +9619,7 @@ static const vshCmdInfo info_domrename[] = {
};
static const vshCmdOptDef opts_domrename[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "new-name",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -9969,11 +9748,7 @@ static const vshCmdInfo info_migrate[] = {
};
static const vshCmdOptDef opts_migrate[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "desturi",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -10339,11 +10114,7 @@ static const vshCmdInfo info_migrate_setmaxdowntime[] = {
};
static const vshCmdOptDef opts_migrate_setmaxdowntime[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "downtime",
.type = VSH_OT_INT,
.flags = VSH_OFLAG_REQ,
@@ -10394,11 +10165,7 @@ static const vshCmdInfo info_migrate_compcache[] = {
};
static const vshCmdOptDef opts_migrate_compcache[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "size",
.type = VSH_OT_INT,
.flags = VSH_OFLAG_REQ_OPT,
@@ -10455,11 +10222,7 @@ static const vshCmdInfo info_migrate_setspeed[] = {
};
static const vshCmdOptDef opts_migrate_setspeed[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "bandwidth",
.type = VSH_OT_INT,
.flags = VSH_OFLAG_REQ,
@@ -10505,11 +10268,7 @@ static const vshCmdInfo info_migrate_getspeed[] = {
};
static const vshCmdOptDef opts_migrate_getspeed[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = NULL}
};
@@ -10550,11 +10309,7 @@ static const vshCmdInfo info_domdisplay[] = {
};
static const vshCmdOptDef opts_domdisplay[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "include-password",
.type = VSH_OT_BOOL,
.help = N_("includes the password into the connection URI if available")
@@ -10773,11 +10528,7 @@ static const vshCmdInfo info_vncdisplay[] = {
};
static const vshCmdOptDef opts_vncdisplay[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = NULL}
};
@@ -10858,11 +10609,7 @@ static const vshCmdInfo info_ttyconsole[] = {
};
static const vshCmdOptDef opts_ttyconsole[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = NULL}
};
@@ -10918,11 +10665,7 @@ static const vshCmdInfo info_domhostname[] = {
};
static const vshCmdOptDef opts_domhostname[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = NULL}
};
@@ -11081,11 +10824,7 @@ static const vshCmdInfo info_detach_device[] = {
};
static const vshCmdOptDef opts_detach_device[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "file",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -11182,11 +10921,7 @@ static const vshCmdInfo info_update_device[] = {
};
static const vshCmdOptDef opts_update_device[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "file",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -11284,11 +11019,7 @@ static const vshCmdInfo info_detach_interface[] = {
};
static const vshCmdOptDef opts_detach_interface[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "type",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -11704,11 +11435,7 @@ static const vshCmdInfo info_detach_disk[] = {
};
static const vshCmdOptDef opts_detach_disk[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "target",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -11820,11 +11547,7 @@ static const vshCmdInfo info_edit[] = {
};
static const vshCmdOptDef opts_edit[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "skip-validate",
.type = VSH_OT_BOOL,
.help = N_("skip validation of the XML against the schema")
@@ -12671,11 +12394,7 @@ static const vshCmdInfo info_change_media[] = {
};
static const vshCmdOptDef opts_change_media[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "path",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
@@ -12843,11 +12562,7 @@ static const vshCmdInfo info_domfstrim[] = {
};
static const vshCmdOptDef opts_domfstrim[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "minimum",
.type = VSH_OT_INT,
.help = N_("Just a hint to ignore contiguous "
@@ -12900,11 +12615,7 @@ static const vshCmdInfo info_domfsfreeze[] = {
};
static const vshCmdOptDef opts_domfsfreeze[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "mountpoint",
.type = VSH_OT_ARGV,
.help = N_("mountpoint path to be frozen")
@@ -12957,11 +12668,7 @@ static const vshCmdInfo info_domfsthaw[] = {
};
static const vshCmdOptDef opts_domfsthaw[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = "mountpoint",
.type = VSH_OT_ARGV,
.help = N_("mountpoint path to be thawed")
@@ -13014,11 +12721,7 @@ static const vshCmdInfo info_domfsinfo[] = {
};
static const vshCmdOptDef opts_domfsinfo[] = {
- {.name = "domain",
- .type = VSH_OT_DATA,
- .flags = VSH_OFLAG_REQ,
- .help = N_("domain name, id or uuid")
- },
+ VIRSH_DOMAIN_OPT_COMMON,
{.name = NULL}
};
diff --git a/tools/virsh.h b/tools/virsh.h
index c1a1866..a77a2d6 100644
--- a/tools/virsh.h
+++ b/tools/virsh.h
@@ -69,6 +69,13 @@
.help = N_("pool name or uuid") \
} \
+# define VIRSH_DOMAIN_OPT_COMMON \
+ {.name = "domain", \
+ .type = VSH_OT_DATA, \
+ .flags = VSH_OFLAG_REQ, \
+ .help = N_("domain name, id or uuid") \
+ } \
+
typedef struct _virshControl virshControl;
typedef virshControl *virshControlPtr;
--
2.5.0