提交 cf793b00 编写于 作者: J John Ferlan

virsh: Create macro for "pool" option

Rather than continually cut/paste the "pool" option for pool command
option structures, generate a macro which will commonly define it for
any command.  Then of course use that macro.
上级 aeb1078a
...@@ -33,6 +33,13 @@ ...@@ -33,6 +33,13 @@
#include "conf/storage_conf.h" #include "conf/storage_conf.h"
#include "virstring.h" #include "virstring.h"
#define VSH_POOL_OPT_COMMON \
{.name = "pool", \
.type = VSH_OT_DATA, \
.flags = VSH_OFLAG_REQ, \
.help = N_("pool name or uuid") \
} \
virStoragePoolPtr virStoragePoolPtr
virshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname, virshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname,
const char **name, unsigned int flags) const char **name, unsigned int flags)
...@@ -85,11 +92,8 @@ static const vshCmdInfo info_pool_autostart[] = { ...@@ -85,11 +92,8 @@ static const vshCmdInfo info_pool_autostart[] = {
}; };
static const vshCmdOptDef opts_pool_autostart[] = { static const vshCmdOptDef opts_pool_autostart[] = {
{.name = "pool", VSH_POOL_OPT_COMMON,
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.help = N_("pool name or uuid")
},
{.name = "disable", {.name = "disable",
.type = VSH_OT_BOOL, .type = VSH_OT_BOOL,
.help = N_("disable autostarting") .help = N_("disable autostarting")
...@@ -500,11 +504,8 @@ static const vshCmdInfo info_pool_build[] = { ...@@ -500,11 +504,8 @@ static const vshCmdInfo info_pool_build[] = {
}; };
static const vshCmdOptDef opts_pool_build[] = { static const vshCmdOptDef opts_pool_build[] = {
{.name = "pool", VSH_POOL_OPT_COMMON,
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.help = N_("pool name or uuid")
},
{.name = "no-overwrite", {.name = "no-overwrite",
.type = VSH_OT_BOOL, .type = VSH_OT_BOOL,
.help = N_("do not overwrite an existing pool of this type") .help = N_("do not overwrite an existing pool of this type")
...@@ -559,11 +560,8 @@ static const vshCmdInfo info_pool_destroy[] = { ...@@ -559,11 +560,8 @@ static const vshCmdInfo info_pool_destroy[] = {
}; };
static const vshCmdOptDef opts_pool_destroy[] = { static const vshCmdOptDef opts_pool_destroy[] = {
{.name = "pool", VSH_POOL_OPT_COMMON,
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.help = N_("pool name or uuid")
},
{.name = NULL} {.name = NULL}
}; };
...@@ -602,11 +600,8 @@ static const vshCmdInfo info_pool_delete[] = { ...@@ -602,11 +600,8 @@ static const vshCmdInfo info_pool_delete[] = {
}; };
static const vshCmdOptDef opts_pool_delete[] = { static const vshCmdOptDef opts_pool_delete[] = {
{.name = "pool", VSH_POOL_OPT_COMMON,
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.help = N_("pool name or uuid")
},
{.name = NULL} {.name = NULL}
}; };
...@@ -645,11 +640,8 @@ static const vshCmdInfo info_pool_refresh[] = { ...@@ -645,11 +640,8 @@ static const vshCmdInfo info_pool_refresh[] = {
}; };
static const vshCmdOptDef opts_pool_refresh[] = { static const vshCmdOptDef opts_pool_refresh[] = {
{.name = "pool", VSH_POOL_OPT_COMMON,
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.help = N_("pool name or uuid")
},
{.name = NULL} {.name = NULL}
}; };
...@@ -688,11 +680,8 @@ static const vshCmdInfo info_pool_dumpxml[] = { ...@@ -688,11 +680,8 @@ static const vshCmdInfo info_pool_dumpxml[] = {
}; };
static const vshCmdOptDef opts_pool_dumpxml[] = { static const vshCmdOptDef opts_pool_dumpxml[] = {
{.name = "pool", VSH_POOL_OPT_COMMON,
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.help = N_("pool name or uuid")
},
{.name = "inactive", {.name = "inactive",
.type = VSH_OT_BOOL, .type = VSH_OT_BOOL,
.help = N_("show inactive defined XML") .help = N_("show inactive defined XML")
...@@ -1542,11 +1531,8 @@ static const vshCmdInfo info_pool_info[] = { ...@@ -1542,11 +1531,8 @@ static const vshCmdInfo info_pool_info[] = {
}; };
static const vshCmdOptDef opts_pool_info[] = { static const vshCmdOptDef opts_pool_info[] = {
{.name = "pool", VSH_POOL_OPT_COMMON,
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.help = N_("pool name or uuid")
},
{.name = NULL} {.name = NULL}
}; };
...@@ -1622,11 +1608,8 @@ static const vshCmdInfo info_pool_name[] = { ...@@ -1622,11 +1608,8 @@ static const vshCmdInfo info_pool_name[] = {
}; };
static const vshCmdOptDef opts_pool_name[] = { static const vshCmdOptDef opts_pool_name[] = {
{.name = "pool", VSH_POOL_OPT_COMMON,
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.help = N_("pool uuid")
},
{.name = NULL} {.name = NULL}
}; };
...@@ -1657,11 +1640,8 @@ static const vshCmdInfo info_pool_start[] = { ...@@ -1657,11 +1640,8 @@ static const vshCmdInfo info_pool_start[] = {
}; };
static const vshCmdOptDef opts_pool_start[] = { static const vshCmdOptDef opts_pool_start[] = {
{.name = "pool", VSH_POOL_OPT_COMMON,
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.help = N_("name or uuid of the inactive pool")
},
{.name = NULL} {.name = NULL}
}; };
...@@ -1700,11 +1680,8 @@ static const vshCmdInfo info_pool_undefine[] = { ...@@ -1700,11 +1680,8 @@ static const vshCmdInfo info_pool_undefine[] = {
}; };
static const vshCmdOptDef opts_pool_undefine[] = { static const vshCmdOptDef opts_pool_undefine[] = {
{.name = "pool", VSH_POOL_OPT_COMMON,
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.help = N_("pool name or uuid")
},
{.name = NULL} {.name = NULL}
}; };
...@@ -1743,11 +1720,8 @@ static const vshCmdInfo info_pool_uuid[] = { ...@@ -1743,11 +1720,8 @@ static const vshCmdInfo info_pool_uuid[] = {
}; };
static const vshCmdOptDef opts_pool_uuid[] = { static const vshCmdOptDef opts_pool_uuid[] = {
{.name = "pool", VSH_POOL_OPT_COMMON,
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.help = N_("pool name")
},
{.name = NULL} {.name = NULL}
}; };
...@@ -1783,11 +1757,8 @@ static const vshCmdInfo info_pool_edit[] = { ...@@ -1783,11 +1757,8 @@ static const vshCmdInfo info_pool_edit[] = {
}; };
static const vshCmdOptDef opts_pool_edit[] = { static const vshCmdOptDef opts_pool_edit[] = {
{.name = "pool", VSH_POOL_OPT_COMMON,
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.help = N_("pool name or uuid")
},
{.name = NULL} {.name = NULL}
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册