diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index cd8a0da353..7eb387d17e 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -292,10 +292,7 @@ static const vshCmdOptDef opts_dommemstat[] = { }, VIRSH_COMMON_OPT_CONFIG(N_("affect next boot")), VIRSH_COMMON_OPT_LIVE(N_("affect running domain")), - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_CURRENT(N_("affect current domain")), {.name = NULL} }; diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 8076475037..456e5969bc 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -78,6 +78,9 @@ #define VIRSH_COMMON_OPT_DOMAIN_LIVE \ VIRSH_COMMON_OPT_LIVE(N_("affect running domain")) \ +#define VIRSH_COMMON_OPT_DOMAIN_CURRENT \ + VIRSH_COMMON_OPT_CURRENT(N_("affect current domain")) \ + static virDomainPtr virshLookupDomainInternal(vshControl *ctl, const char *cmdname, @@ -229,10 +232,7 @@ static const vshCmdOptDef opts_attach_device[] = { VIRSH_COMMON_OPT_DOMAIN_PERSISTENT, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = NULL} }; @@ -383,10 +383,7 @@ static const vshCmdOptDef opts_attach_disk[] = { VIRSH_COMMON_OPT_DOMAIN_PERSISTENT, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = NULL} }; @@ -834,10 +831,7 @@ static const vshCmdOptDef opts_attach_interface[] = { VIRSH_COMMON_OPT_DOMAIN_PERSISTENT, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = "print-xml", .type = VSH_OT_BOOL, .help = N_("print XML document rather than attach the interface") @@ -1274,10 +1268,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = { }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = NULL} }; @@ -1522,10 +1513,7 @@ static const vshCmdOptDef opts_blkiotune[] = { }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = NULL} }; @@ -3205,10 +3193,7 @@ static const vshCmdOptDef opts_domiftune[] = { }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = NULL} }; @@ -4799,10 +4784,7 @@ static const vshCmdOptDef opts_schedinfo[] = { .flags = VSH_OFLAG_REQ_OPT, .help = N_("cap for XEN_CREDIT") }, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("get/set current scheduler info") - }, + VIRSH_COMMON_OPT_CURRENT(N_("get/set current scheduler info")), VIRSH_COMMON_OPT_CONFIG(N_("get/set value to be used on next boot")), VIRSH_COMMON_OPT_LIVE(N_("get/set value from running domain")), {.name = "set", @@ -6075,10 +6057,7 @@ static const vshCmdOptDef opts_vcpucount[] = { }, VIRSH_COMMON_OPT_LIVE(N_("get value from running domain")), VIRSH_COMMON_OPT_CONFIG(N_("get value to be used on next boot")), - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("get value according to current domain state") - }, + VIRSH_COMMON_OPT_CURRENT(N_("get value according to current domain state")), {.name = "guest", .type = VSH_OT_BOOL, .help = N_("retrieve vcpu count from the guest instead of the hypervisor") @@ -6392,10 +6371,7 @@ static const vshCmdOptDef opts_vcpupin[] = { }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = NULL} }; @@ -6590,10 +6566,7 @@ static const vshCmdOptDef opts_emulatorpin[] = { }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = NULL} }; @@ -6701,10 +6674,7 @@ static const vshCmdOptDef opts_setvcpus[] = { }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = "guest", .type = VSH_OT_BOOL, .help = N_("modify cpu state in the guest") @@ -6783,10 +6753,7 @@ static const vshCmdOptDef opts_iothreadinfo[] = { VIRSH_COMMON_OPT_DOMAIN_FULL, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = NULL} }; @@ -6872,10 +6839,7 @@ static const vshCmdOptDef opts_iothreadpin[] = { }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = NULL} }; @@ -6952,10 +6916,7 @@ static const vshCmdOptDef opts_iothreadadd[] = { }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = NULL} }; @@ -7020,10 +6981,7 @@ static const vshCmdOptDef opts_iothreaddel[] = { }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = NULL} }; @@ -7702,10 +7660,7 @@ static const vshCmdOptDef opts_desc[] = { VIRSH_COMMON_OPT_DOMAIN_FULL, VIRSH_COMMON_OPT_LIVE(N_("modify/get running state")), VIRSH_COMMON_OPT_CONFIG(N_("modify/get persistent configuration")), - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("modify/get current state configuration") - }, + VIRSH_COMMON_OPT_CURRENT(N_("modify/get current state configuration")), {.name = "title", .type = VSH_OT_BOOL, .help = N_("modify/get the title instead of description") @@ -7876,10 +7831,7 @@ static const vshCmdOptDef opts_metadata[] = { }, VIRSH_COMMON_OPT_LIVE(N_("modify/get running state")), VIRSH_COMMON_OPT_CONFIG(N_("modify/get persistent configuration")), - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("modify/get current state configuration") - }, + VIRSH_COMMON_OPT_CURRENT(N_("modify/get current state configuration")), {.name = "edit", .type = VSH_OT_BOOL, .help = N_("use an editor to change the metadata") @@ -8264,10 +8216,7 @@ static const vshCmdOptDef opts_setmem[] = { }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = NULL} }; @@ -8348,10 +8297,7 @@ static const vshCmdOptDef opts_setmaxmem[] = { }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = NULL} }; @@ -8446,10 +8392,7 @@ static const vshCmdOptDef opts_memtune[] = { }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = NULL} }; @@ -8619,10 +8562,7 @@ static const vshCmdOptDef opts_numatune[] = { }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = NULL} }; @@ -10734,10 +10674,7 @@ static const vshCmdOptDef opts_detach_device[] = { VIRSH_COMMON_OPT_DOMAIN_PERSISTENT, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = NULL} }; @@ -10822,10 +10759,7 @@ static const vshCmdOptDef opts_update_device[] = { VIRSH_COMMON_OPT_DOMAIN_PERSISTENT, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = "force", .type = VSH_OT_BOOL, .help = N_("force device update") @@ -10915,10 +10849,7 @@ static const vshCmdOptDef opts_detach_interface[] = { VIRSH_COMMON_OPT_DOMAIN_PERSISTENT, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = NULL} }; @@ -11318,10 +11249,7 @@ static const vshCmdOptDef opts_detach_disk[] = { VIRSH_COMMON_OPT_DOMAIN_PERSISTENT, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current domain") - }, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name = NULL} }; @@ -12283,11 +12211,9 @@ static const vshCmdOptDef opts_change_media[] = { .type = VSH_OT_BOOL, .help = N_("Update the media") }, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("can be either or both of --live and --config, " - "depends on implementation of hypervisor driver") - }, + VIRSH_COMMON_OPT_CURRENT(N_("can be either or both of --live and " + "--config, depends on implementation " + "hypervisor driver")), VIRSH_COMMON_OPT_LIVE(N_("alter live configuration of running domain")), VIRSH_COMMON_OPT_CONFIG(N_("alter persistent configuration, effect " "observed on next boot")), diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 90d4c8b589..24e80490c6 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -908,10 +908,7 @@ static const vshCmdOptDef opts_network_update[] = { }, VIRSH_COMMON_OPT_CONFIG(N_("affect next network startup")), VIRSH_COMMON_OPT_LIVE(N_("affect running network")), - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("affect current state of network") - }, + VIRSH_COMMON_OPT_CURRENT(N_("affect current state of network")), {.name = NULL} }; diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index f4b2350b84..f879e7aec4 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -135,10 +135,7 @@ static const vshCmdOptDef opts_snapshot_create[] = { .type = VSH_OT_BOOL, .help = N_("redefine metadata for existing snapshot") }, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("with redefine, set current snapshot") - }, + VIRSH_COMMON_OPT_CURRENT(N_("with redefine, set current snapshot")), {.name = "no-metadata", .type = VSH_OT_BOOL, .help = N_("take snapshot but create no metadata") @@ -518,10 +515,7 @@ static const vshCmdOptDef opts_snapshot_edit[] = { .type = VSH_OT_STRING, .help = N_("snapshot name") }, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("also set edited snapshot as current") - }, + VIRSH_COMMON_OPT_CURRENT(N_("also set edited snapshot as current")), {.name = "rename", .type = VSH_OT_BOOL, .help = N_("allow renaming an existing snapshot") @@ -868,10 +862,7 @@ static const vshCmdOptDef opts_snapshot_info[] = { .type = VSH_OT_STRING, .help = N_("snapshot name") }, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("info on current snapshot") - }, + VIRSH_COMMON_OPT_CURRENT(N_("info on current snapshot")), {.name = NULL} }; @@ -1471,10 +1462,7 @@ static const vshCmdOptDef opts_snapshot_list[] = { .type = VSH_OT_STRING, .help = N_("limit list to children of given snapshot") }, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("limit list to children of current snapshot") - }, + VIRSH_COMMON_OPT_CURRENT(N_("limit list to children of current snapshot")), {.name = "descendants", .type = VSH_OT_BOOL, .help = N_("with --from, list all descendants") @@ -1747,10 +1735,7 @@ static const vshCmdOptDef opts_snapshot_parent[] = { .type = VSH_OT_STRING, .help = N_("find parent of snapshot name") }, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("find parent of current snapshot") - }, + VIRSH_COMMON_OPT_CURRENT(N_("find parent of current snapshot")), {.name = NULL} }; @@ -1811,10 +1796,7 @@ static const vshCmdOptDef opts_snapshot_revert[] = { .type = VSH_OT_STRING, .help = N_("snapshot name") }, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("revert to current snapshot") - }, + VIRSH_COMMON_OPT_CURRENT(N_("revert to current snapshot")), {.name = "running", .type = VSH_OT_BOOL, .help = N_("after reverting, change state to running") @@ -1900,10 +1882,7 @@ static const vshCmdOptDef opts_snapshot_delete[] = { .type = VSH_OT_STRING, .help = N_("snapshot name") }, - {.name = "current", - .type = VSH_OT_BOOL, - .help = N_("delete current snapshot") - }, + VIRSH_COMMON_OPT_CURRENT(N_("delete current snapshot")), {.name = "children", .type = VSH_OT_BOOL, .help = N_("delete snapshot and all children") diff --git a/tools/virsh.h b/tools/virsh.h index e731964634..ba7e31457c 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -88,6 +88,12 @@ .help = _helpstr \ } \ +# define VIRSH_COMMON_OPT_CURRENT(_helpstr) \ + {.name = "current", \ + .type = VSH_OT_BOOL, \ + .help = _helpstr \ + } \ + typedef struct _virshControl virshControl; typedef virshControl *virshControlPtr;