mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
virsh: Create macro for common "network" option
Rather than continually cut-n-paste the strings into each command, create a common macro to be used generically. Note that not all '{.name = "network",' entries are replaced, just those that have the common .help string of "network name or uuid". Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
5b436359a8
commit
2165522819
@ -34,6 +34,13 @@
|
|||||||
#include "virtime.h"
|
#include "virtime.h"
|
||||||
#include "conf/network_conf.h"
|
#include "conf/network_conf.h"
|
||||||
|
|
||||||
|
#define VIRSH_COMMON_OPT_NETWORK \
|
||||||
|
{.name = "network", \
|
||||||
|
.type = VSH_OT_DATA, \
|
||||||
|
.flags = VSH_OFLAG_REQ, \
|
||||||
|
.help = N_("network name or uuid") \
|
||||||
|
} \
|
||||||
|
|
||||||
virNetworkPtr
|
virNetworkPtr
|
||||||
virshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd,
|
virshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd,
|
||||||
const char **name, unsigned int flags)
|
const char **name, unsigned int flags)
|
||||||
@ -86,11 +93,7 @@ static const vshCmdInfo info_network_autostart[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const vshCmdOptDef opts_network_autostart[] = {
|
static const vshCmdOptDef opts_network_autostart[] = {
|
||||||
{.name = "network",
|
VIRSH_COMMON_OPT_NETWORK,
|
||||||
.type = VSH_OT_DATA,
|
|
||||||
.flags = VSH_OFLAG_REQ,
|
|
||||||
.help = N_("network name or uuid")
|
|
||||||
},
|
|
||||||
{.name = "disable",
|
{.name = "disable",
|
||||||
.type = VSH_OT_BOOL,
|
.type = VSH_OT_BOOL,
|
||||||
.help = N_("disable autostarting")
|
.help = N_("disable autostarting")
|
||||||
@ -237,11 +240,7 @@ static const vshCmdInfo info_network_destroy[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const vshCmdOptDef opts_network_destroy[] = {
|
static const vshCmdOptDef opts_network_destroy[] = {
|
||||||
{.name = "network",
|
VIRSH_COMMON_OPT_NETWORK,
|
||||||
.type = VSH_OT_DATA,
|
|
||||||
.flags = VSH_OFLAG_REQ,
|
|
||||||
.help = N_("network name or uuid")
|
|
||||||
},
|
|
||||||
{.name = NULL}
|
{.name = NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -280,11 +279,7 @@ static const vshCmdInfo info_network_dumpxml[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const vshCmdOptDef opts_network_dumpxml[] = {
|
static const vshCmdOptDef opts_network_dumpxml[] = {
|
||||||
{.name = "network",
|
VIRSH_COMMON_OPT_NETWORK,
|
||||||
.type = VSH_OT_DATA,
|
|
||||||
.flags = VSH_OFLAG_REQ,
|
|
||||||
.help = N_("network name or uuid")
|
|
||||||
},
|
|
||||||
{.name = "inactive",
|
{.name = "inactive",
|
||||||
.type = VSH_OT_BOOL,
|
.type = VSH_OT_BOOL,
|
||||||
.help = N_("network information of an inactive domain")
|
.help = N_("network information of an inactive domain")
|
||||||
@ -335,11 +330,7 @@ static const vshCmdInfo info_network_info[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const vshCmdOptDef opts_network_info[] = {
|
static const vshCmdOptDef opts_network_info[] = {
|
||||||
{.name = "network",
|
VIRSH_COMMON_OPT_NETWORK,
|
||||||
.type = VSH_OT_DATA,
|
|
||||||
.flags = VSH_OFLAG_REQ,
|
|
||||||
.help = N_("network name or uuid")
|
|
||||||
},
|
|
||||||
{.name = NULL}
|
{.name = NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -788,11 +779,7 @@ static const vshCmdInfo info_network_start[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const vshCmdOptDef opts_network_start[] = {
|
static const vshCmdOptDef opts_network_start[] = {
|
||||||
{.name = "network",
|
VIRSH_COMMON_OPT_NETWORK,
|
||||||
.type = VSH_OT_DATA,
|
|
||||||
.flags = VSH_OFLAG_REQ,
|
|
||||||
.help = N_("network name or uuid")
|
|
||||||
},
|
|
||||||
{.name = NULL}
|
{.name = NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -830,11 +817,7 @@ static const vshCmdInfo info_network_undefine[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const vshCmdOptDef opts_network_undefine[] = {
|
static const vshCmdOptDef opts_network_undefine[] = {
|
||||||
{.name = "network",
|
VIRSH_COMMON_OPT_NETWORK,
|
||||||
.type = VSH_OT_DATA,
|
|
||||||
.flags = VSH_OFLAG_REQ,
|
|
||||||
.help = N_("network name or uuid")
|
|
||||||
},
|
|
||||||
{.name = NULL}
|
{.name = NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -873,11 +856,7 @@ static const vshCmdInfo info_network_update[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const vshCmdOptDef opts_network_update[] = {
|
static const vshCmdOptDef opts_network_update[] = {
|
||||||
{.name = "network",
|
VIRSH_COMMON_OPT_NETWORK,
|
||||||
.type = VSH_OT_DATA,
|
|
||||||
.flags = VSH_OFLAG_REQ,
|
|
||||||
.help = N_("network name or uuid")
|
|
||||||
},
|
|
||||||
{.name = "command",
|
{.name = "command",
|
||||||
.type = VSH_OT_DATA,
|
.type = VSH_OT_DATA,
|
||||||
.flags = VSH_OFLAG_REQ,
|
.flags = VSH_OFLAG_REQ,
|
||||||
@ -1081,11 +1060,7 @@ static const vshCmdInfo info_network_edit[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const vshCmdOptDef opts_network_edit[] = {
|
static const vshCmdOptDef opts_network_edit[] = {
|
||||||
{.name = "network",
|
VIRSH_COMMON_OPT_NETWORK,
|
||||||
.type = VSH_OT_DATA,
|
|
||||||
.flags = VSH_OFLAG_REQ,
|
|
||||||
.help = N_("network name or uuid")
|
|
||||||
},
|
|
||||||
{.name = NULL}
|
{.name = NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1332,11 +1307,7 @@ static const vshCmdInfo info_network_dhcp_leases[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const vshCmdOptDef opts_network_dhcp_leases[] = {
|
static const vshCmdOptDef opts_network_dhcp_leases[] = {
|
||||||
{.name = "network",
|
VIRSH_COMMON_OPT_NETWORK,
|
||||||
.type = VSH_OT_DATA,
|
|
||||||
.flags = VSH_OFLAG_REQ,
|
|
||||||
.help = N_("network name or uuid")
|
|
||||||
},
|
|
||||||
{.name = "mac",
|
{.name = "mac",
|
||||||
.type = VSH_OT_STRING,
|
.type = VSH_OT_STRING,
|
||||||
.flags = VSH_OFLAG_NONE,
|
.flags = VSH_OFLAG_NONE,
|
||||||
|
Loading…
Reference in New Issue
Block a user