int nparams = 0;
int maxparams = 0;
virTypedParameterPtr params = NULL;
- unsigned int flags = 0, i = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
+ unsigned int i = 0;
int rv = 0;
bool current = vshCommandOptBool(cmd, "current");
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
bool ret = false;
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
goto cleanup;
unsigned int i = 0;
virTypedParameterPtr params = NULL;
bool ret = false;
- unsigned int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
bool current = vshCommandOptBool(cmd, "current");
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
virDomainPtr dom;
const char *name = NULL, *device = NULL,
*inboundStr = NULL, *outboundStr = NULL;
- unsigned int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
int nparams = 0;
int maxparams = 0;
virTypedParameterPtr params = NULL;
virNetDevBandwidthRate inbound, outbound;
int i;
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
int nupdates = 0;
int i, ret;
bool ret_val = false;
- unsigned int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
bool current = vshCommandOptBool(cmd, "current");
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
bool live = vshCommandOptBool(cmd, "live");
bool current = vshCommandOptBool(cmd, "current");
bool query = false; /* Query mode if no cpulist */
- unsigned int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- /* neither option is specified */
- if (!live && !config)
- flags = -1;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
+ /* none of the options were specified */
+ if (!current && !live && !config)
+ flags = -1;
if (vshCommandOptStringReq(ctl, cmd, "cpulist", &cpulist) < 0)
return false;
bool live = vshCommandOptBool(cmd, "live");
bool current = vshCommandOptBool(cmd, "current");
bool query = false; /* Query mode if no cpulist */
- unsigned int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- /* neither option is specified */
- if (!live && !config)
- flags = -1;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
+ /* none of the options were specified */
+ if (!current && !live && !config)
+ flags = -1;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
bool current = vshCommandOptBool(cmd, "current");
- unsigned int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- /* neither option is specified */
- if (!live && !config && !maximum)
- flags = -1;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
+ /* none of the options were specified */
+ if (!current && !live && !config && !maximum)
+ flags = -1;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
bool ret = false;
unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
bool current = vshCommandOptBool(cmd, "current");
- unsigned int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- /* neither option is specified */
- if (!live && !config)
- flags = -1;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
+ /* none of the options were specified */
+ if (!current && !live && !config)
+ flags = -1;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
bool current = vshCommandOptBool(cmd, "current");
- unsigned int flags = VIR_DOMAIN_MEM_MAXIMUM;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT | VIR_DOMAIN_MEM_MAXIMUM;
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- /* neither option is specified */
- if (!live && !config)
- flags = -1;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
+ /* none of the options were specified */
+ if (!current && !live && !config)
+ flags = -1;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
unsigned int i = 0;
virTypedParameterPtr params = NULL;
bool ret = false;
- unsigned int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
bool current = vshCommandOptBool(cmd, "current");
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
virTypedParameterPtr params = NULL;
const char *nodeset = NULL;
bool ret = false;
- unsigned int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
bool current = vshCommandOptBool(cmd, "current");
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
const char *mode = NULL;
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
const char *doc = NULL;
xmlNodePtr disk_node = NULL;
const char *disk_xml = NULL;
- int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
bool config, live, current, force = false;
bool eject, insert, update = false;
bool ret = false;
action = "update";
}
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
if (force)
flags |= VIR_DOMAIN_DEVICE_MODIFY_FORCE;