mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
tools: Rename vshCommandOptStringReq to vshCommandOptString
Shorten the function name as there isn't any vshCommandOptString. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
9a4752ca5b
commit
0d687d13ed
@ -68,7 +68,7 @@ cmdBackupBegin(vshControl *ctl,
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "backupxml", &backup_from) < 0)
|
if (vshCommandOptString(ctl, cmd, "backupxml", &backup_from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!backup_from) {
|
if (!backup_from) {
|
||||||
@ -80,7 +80,7 @@ cmdBackupBegin(vshControl *ctl,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "checkpointxml", &check_from) < 0)
|
if (vshCommandOptString(ctl, cmd, "checkpointxml", &check_from) < 0)
|
||||||
return false;
|
return false;
|
||||||
if (check_from) {
|
if (check_from) {
|
||||||
if (virFileReadAll(check_from, VSH_MAX_XML_FILE, &check_buffer) < 0) {
|
if (virFileReadAll(check_from, VSH_MAX_XML_FILE, &check_buffer) < 0) {
|
||||||
|
@ -121,7 +121,7 @@ cmdCheckpointCreate(vshControl *ctl,
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "xmlfile", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "xmlfile", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
if (!from) {
|
if (!from) {
|
||||||
buffer = g_strdup("<domaincheckpoint/>");
|
buffer = g_strdup("<domaincheckpoint/>");
|
||||||
@ -234,8 +234,8 @@ cmdCheckpointCreateAs(vshControl *ctl,
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "name", &name) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "name", &name) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "description", &desc) < 0)
|
vshCommandOptString(ctl, cmd, "description", &desc) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
virBufferAddLit(&buf, "<domaincheckpoint>\n");
|
virBufferAddLit(&buf, "<domaincheckpoint>\n");
|
||||||
@ -281,7 +281,7 @@ virshLookupCheckpoint(vshControl *ctl,
|
|||||||
{
|
{
|
||||||
const char *chkname = NULL;
|
const char *chkname = NULL;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, arg, &chkname) < 0)
|
if (vshCommandOptString(ctl, cmd, arg, &chkname) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!(*chk = virDomainCheckpointLookupByName(dom, chkname, 0)))
|
if (!(*chk = virDomainCheckpointLookupByName(dom, chkname, 0)))
|
||||||
|
@ -381,7 +381,7 @@ virshDomainInterfaceStateCompleter(vshControl *ctl,
|
|||||||
if (virshDomainGetXML(ctl, cmd, flags, &xml, &ctxt) < 0)
|
if (virshDomainGetXML(ctl, cmd, flags, &xml, &ctxt) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "interface", &iface) < 0)
|
if (vshCommandOptString(ctl, cmd, "interface", &iface) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* normalize the mac addr */
|
/* normalize the mac addr */
|
||||||
|
@ -227,10 +227,10 @@ virshCPUModelCompleter(vshControl *ctl,
|
|||||||
|
|
||||||
virCheckFlags(0, NULL);
|
virCheckFlags(0, NULL);
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "virttype", &virttype) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "virttype", &virttype) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "emulator", &emulator) < 0 ||
|
vshCommandOptString(ctl, cmd, "emulator", &emulator) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "arch", &arch) < 0 ||
|
vshCommandOptString(ctl, cmd, "arch", &arch) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "machine", &machine) < 0)
|
vshCommandOptString(ctl, cmd, "machine", &machine) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!priv->conn || virConnectIsAlive(priv->conn) <= 0)
|
if (!priv->conn || virConnectIsAlive(priv->conn) <= 0)
|
||||||
|
@ -927,7 +927,7 @@ cmdEvent(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "event", &eventName) < 0)
|
if (vshCommandOptString(ctl, cmd, "event", &eventName) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!eventName && !all) {
|
if (!eventName && !all) {
|
||||||
|
@ -765,7 +765,7 @@ cmdDomIfGetLink(vshControl *ctl, const vshCmd *cmd)
|
|||||||
int ninterfaces;
|
int ninterfaces;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "interface", &iface) < 0)
|
if (vshCommandOptString(ctl, cmd, "interface", &iface) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptBool(cmd, "config"))
|
if (vshCommandOptBool(cmd, "config"))
|
||||||
@ -934,7 +934,7 @@ cmdDomblkstat(vshControl *ctl, const vshCmd *cmd)
|
|||||||
string to denote 'all devices'. A NULL device arg would violate
|
string to denote 'all devices'. A NULL device arg would violate
|
||||||
API contract.
|
API contract.
|
||||||
*/
|
*/
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "device", &device) < 0)
|
if (vshCommandOptString(ctl, cmd, "device", &device) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!device)
|
if (!device)
|
||||||
@ -1058,7 +1058,7 @@ cmdDomIfstat(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, &name)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, &name)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "interface", &device) < 0)
|
if (vshCommandOptString(ctl, cmd, "interface", &device) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (virDomainInterfaceStats(dom, device, &stats, sizeof(stats)) == -1) {
|
if (virDomainInterfaceStats(dom, device, &stats, sizeof(stats)) == -1) {
|
||||||
@ -2254,9 +2254,9 @@ cmdDomIfAddr(vshControl *ctl, const vshCmd *cmd)
|
|||||||
const char *sourcestr = NULL;
|
const char *sourcestr = NULL;
|
||||||
int source = VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE;
|
int source = VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "interface", &ifacestr) < 0)
|
if (vshCommandOptString(ctl, cmd, "interface", &ifacestr) < 0)
|
||||||
return false;
|
return false;
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "source", &sourcestr) < 0)
|
if (vshCommandOptString(ctl, cmd, "source", &sourcestr) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (sourcestr &&
|
if (sourcestr &&
|
||||||
|
@ -382,7 +382,7 @@ cmdAttachDevice(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (persistent &&
|
if (persistent &&
|
||||||
@ -647,25 +647,25 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (live)
|
if (live)
|
||||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "source", &source) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "source", &source) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "target", &target) < 0 ||
|
vshCommandOptString(ctl, cmd, "target", &target) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "driver", &driver) < 0 ||
|
vshCommandOptString(ctl, cmd, "driver", &driver) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "subdriver", &subdriver) < 0 ||
|
vshCommandOptString(ctl, cmd, "subdriver", &subdriver) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "type", &device) < 0 ||
|
vshCommandOptString(ctl, cmd, "type", &device) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "mode", &mode) < 0 ||
|
vshCommandOptString(ctl, cmd, "mode", &mode) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "iothread", &iothread) < 0 ||
|
vshCommandOptString(ctl, cmd, "iothread", &iothread) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "cache", &cache) < 0 ||
|
vshCommandOptString(ctl, cmd, "cache", &cache) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "io", &io) < 0 ||
|
vshCommandOptString(ctl, cmd, "io", &io) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "serial", &serial) < 0 ||
|
vshCommandOptString(ctl, cmd, "serial", &serial) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "wwn", &wwn) < 0 ||
|
vshCommandOptString(ctl, cmd, "wwn", &wwn) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "address", &straddr) < 0 ||
|
vshCommandOptString(ctl, cmd, "address", &straddr) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "targetbus", &targetbus) < 0 ||
|
vshCommandOptString(ctl, cmd, "targetbus", &targetbus) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "alias", &alias) < 0 ||
|
vshCommandOptString(ctl, cmd, "alias", &alias) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "sourcetype", &stype) < 0 ||
|
vshCommandOptString(ctl, cmd, "sourcetype", &stype) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "source-protocol", &source_protocol) < 0 ||
|
vshCommandOptString(ctl, cmd, "source-protocol", &source_protocol) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "source-host-name", &host_name) < 0 ||
|
vshCommandOptString(ctl, cmd, "source-host-name", &host_name) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "source-host-transport", &host_transport) < 0 ||
|
vshCommandOptString(ctl, cmd, "source-host-transport", &host_transport) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "source-host-socket", &host_socket) < 0)
|
vshCommandOptString(ctl, cmd, "source-host-socket", &host_socket) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (stype &&
|
if (stype &&
|
||||||
@ -963,16 +963,16 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (live)
|
if (live)
|
||||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "type", &type) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "type", &type) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "source", &source) < 0 ||
|
vshCommandOptString(ctl, cmd, "source", &source) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "target", &target) < 0 ||
|
vshCommandOptString(ctl, cmd, "target", &target) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "mac", &mac) < 0 ||
|
vshCommandOptString(ctl, cmd, "mac", &mac) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "script", &script) < 0 ||
|
vshCommandOptString(ctl, cmd, "script", &script) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "model", &model) < 0 ||
|
vshCommandOptString(ctl, cmd, "model", &model) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "alias", &alias) < 0 ||
|
vshCommandOptString(ctl, cmd, "alias", &alias) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "inbound", &inboundStr) < 0 ||
|
vshCommandOptString(ctl, cmd, "inbound", &inboundStr) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "outbound", &outboundStr) < 0 ||
|
vshCommandOptString(ctl, cmd, "outbound", &outboundStr) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "source-mode", &sourceModeStr) < 0)
|
vshCommandOptString(ctl, cmd, "source-mode", &sourceModeStr) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* check interface type */
|
/* check interface type */
|
||||||
@ -1402,7 +1402,7 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, &name)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, &name)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "device", &disk) < 0)
|
if (vshCommandOptString(ctl, cmd, "device", &disk) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
#define VSH_ADD_IOTUNE_SCALED(PARAM, CONST) \
|
#define VSH_ADD_IOTUNE_SCALED(PARAM, CONST) \
|
||||||
@ -1450,7 +1450,7 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
|
|||||||
VSH_ADD_IOTUNE(write-iops-sec-max-length, WRITE_IOPS_SEC_MAX_LENGTH);
|
VSH_ADD_IOTUNE(write-iops-sec-max-length, WRITE_IOPS_SEC_MAX_LENGTH);
|
||||||
#undef VSH_ADD_IOTUNE
|
#undef VSH_ADD_IOTUNE
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "group-name", &group_name) < 0) {
|
if (vshCommandOptString(ctl, cmd, "group-name", &group_name) < 0) {
|
||||||
vshError(ctl, "%s", _("Unable to parse group-name parameter"));
|
vshError(ctl, "%s", _("Unable to parse group-name parameter"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -2095,13 +2095,13 @@ cmdBlockcommit(vshControl *ctl, const vshCmd *cmd)
|
|||||||
|
|
||||||
VSH_EXCLUSIVE_OPTIONS("pivot", "keep-overlay");
|
VSH_EXCLUSIVE_OPTIONS("pivot", "keep-overlay");
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "path", &path) < 0)
|
if (vshCommandOptString(ctl, cmd, "path", &path) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "base", &base) < 0)
|
if (vshCommandOptString(ctl, cmd, "base", &base) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "top", &top) < 0)
|
if (vshCommandOptString(ctl, cmd, "top", &top) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshBlockJobOptionBandwidth(ctl, cmd, bytes, &bandwidth) < 0)
|
if (vshBlockJobOptionBandwidth(ctl, cmd, bytes, &bandwidth) < 0)
|
||||||
@ -2352,13 +2352,13 @@ cmdBlockcopy(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virshBlockJobWaitData *bjWait = NULL;
|
virshBlockJobWaitData *bjWait = NULL;
|
||||||
int nparams = 0;
|
int nparams = 0;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "path", &path) < 0)
|
if (vshCommandOptString(ctl, cmd, "path", &path) < 0)
|
||||||
return false;
|
return false;
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "dest", &dest) < 0)
|
if (vshCommandOptString(ctl, cmd, "dest", &dest) < 0)
|
||||||
return false;
|
return false;
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "xml", &xml) < 0)
|
if (vshCommandOptString(ctl, cmd, "xml", &xml) < 0)
|
||||||
return false;
|
return false;
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "format", &format) < 0)
|
if (vshCommandOptString(ctl, cmd, "format", &format) < 0)
|
||||||
return false;
|
return false;
|
||||||
if (vshBlockJobOptionBandwidth(ctl, cmd, bytes, &bandwidth) < 0)
|
if (vshBlockJobOptionBandwidth(ctl, cmd, bytes, &bandwidth) < 0)
|
||||||
return false;
|
return false;
|
||||||
@ -2755,7 +2755,7 @@ cmdBlockjob(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* XXX Allow path to be optional to list info on all devices at once */
|
/* XXX Allow path to be optional to list info on all devices at once */
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "path", &path) < 0)
|
if (vshCommandOptString(ctl, cmd, "path", &path) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (bandwidth)
|
if (bandwidth)
|
||||||
@ -2840,10 +2840,10 @@ cmdBlockpull(vshControl *ctl, const vshCmd *cmd)
|
|||||||
VSH_REQUIRE_OPTION("verbose", "wait");
|
VSH_REQUIRE_OPTION("verbose", "wait");
|
||||||
VSH_REQUIRE_OPTION("async", "wait");
|
VSH_REQUIRE_OPTION("async", "wait");
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "path", &path) < 0)
|
if (vshCommandOptString(ctl, cmd, "path", &path) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "base", &base) < 0)
|
if (vshCommandOptString(ctl, cmd, "base", &base) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshBlockJobOptionBandwidth(ctl, cmd, bytes, &bandwidth) < 0)
|
if (vshBlockJobOptionBandwidth(ctl, cmd, bytes, &bandwidth) < 0)
|
||||||
@ -2950,7 +2950,7 @@ cmdBlockresize(vshControl *ctl, const vshCmd *cmd)
|
|||||||
|
|
||||||
VSH_ALTERNATIVE_OPTIONS("size", "capacity");
|
VSH_ALTERNATIVE_OPTIONS("size", "capacity");
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "path", (const char **) &path) < 0)
|
if (vshCommandOptString(ctl, cmd, "path", (const char **) &path) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptScaledInt(ctl, cmd, "size", &size, 1024, ULLONG_MAX) < 0)
|
if (vshCommandOptScaledInt(ctl, cmd, "size", &size, 1024, ULLONG_MAX) < 0)
|
||||||
@ -3052,7 +3052,7 @@ cmdConsole(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "devname", &name) < 0) /* sc_prohibit_devname */
|
if (vshCommandOptString(ctl, cmd, "devname", &name) < 0) /* sc_prohibit_devname */
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (force)
|
if (force)
|
||||||
@ -3121,8 +3121,8 @@ cmdDomIfSetLink(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "interface", &iface) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "interface", &iface) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "state", &state) < 0)
|
vshCommandOptString(ctl, cmd, "state", &state) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (STRNEQ(state, "up") && STRNEQ(state, "down")) {
|
if (STRNEQ(state, "up") && STRNEQ(state, "down")) {
|
||||||
@ -3276,11 +3276,11 @@ cmdDomIftune(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, &name)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, &name)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "interface", &device) < 0)
|
if (vshCommandOptString(ctl, cmd, "interface", &device) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "inbound", &inboundStr) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "inbound", &inboundStr) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "outbound", &outboundStr) < 0)
|
vshCommandOptString(ctl, cmd, "outbound", &outboundStr) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (inboundStr) {
|
if (inboundStr) {
|
||||||
@ -3481,7 +3481,7 @@ cmdDomPMSuspend(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (vshCommandOptULongLong(ctl, cmd, "duration", &duration) < 0)
|
if (vshCommandOptULongLong(ctl, cmd, "duration", &duration) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "target", &target) < 0)
|
if (vshCommandOptString(ctl, cmd, "target", &target) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((suspendTarget = virshNodeSuspendTargetTypeFromString(target)) < 0) {
|
if ((suspendTarget = virshNodeSuspendTargetTypeFromString(target)) < 0) {
|
||||||
@ -4188,7 +4188,7 @@ doSave(void *opaque)
|
|||||||
goto out_sig;
|
goto out_sig;
|
||||||
#endif /* !WIN32 */
|
#endif /* !WIN32 */
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &to) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &to) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (vshCommandOptBool(cmd, "bypass-cache"))
|
if (vshCommandOptBool(cmd, "bypass-cache"))
|
||||||
@ -4198,7 +4198,7 @@ doSave(void *opaque)
|
|||||||
if (vshCommandOptBool(cmd, "paused"))
|
if (vshCommandOptBool(cmd, "paused"))
|
||||||
flags |= VIR_DOMAIN_SAVE_PAUSED;
|
flags |= VIR_DOMAIN_SAVE_PAUSED;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "xml", &xmlfile) < 0)
|
if (vshCommandOptString(ctl, cmd, "xml", &xmlfile) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, &name)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, &name)))
|
||||||
@ -4454,7 +4454,7 @@ cmdSave(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, &name)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, &name)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &to) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &to) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptBool(cmd, "verbose"))
|
if (vshCommandOptBool(cmd, "verbose"))
|
||||||
@ -4521,7 +4521,7 @@ cmdSaveImageDumpxml(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (vshCommandOptBool(cmd, "security-info"))
|
if (vshCommandOptBool(cmd, "security-info"))
|
||||||
flags |= VIR_DOMAIN_XML_SECURE;
|
flags |= VIR_DOMAIN_XML_SECURE;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &file) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &file) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringQuiet(ctl, cmd, "xpath", &xpath) < 0)
|
if (vshCommandOptStringQuiet(ctl, cmd, "xpath", &xpath) < 0)
|
||||||
@ -4581,10 +4581,10 @@ cmdSaveImageDefine(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (vshCommandOptBool(cmd, "paused"))
|
if (vshCommandOptBool(cmd, "paused"))
|
||||||
flags |= VIR_DOMAIN_SAVE_PAUSED;
|
flags |= VIR_DOMAIN_SAVE_PAUSED;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &file) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &file) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "xml", &xmlfile) < 0)
|
if (vshCommandOptString(ctl, cmd, "xml", &xmlfile) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (virFileReadAll(xmlfile, VSH_MAX_XML_FILE, &xml) < 0)
|
if (virFileReadAll(xmlfile, VSH_MAX_XML_FILE, &xml) < 0)
|
||||||
@ -4645,7 +4645,7 @@ cmdSaveImageEdit(vshControl *ctl, const vshCmd *cmd)
|
|||||||
* flags, so we reject it up front to avoid looping. */
|
* flags, so we reject it up front to avoid looping. */
|
||||||
VSH_EXCLUSIVE_OPTIONS("running", "paused");
|
VSH_EXCLUSIVE_OPTIONS("running", "paused");
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &file) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &file) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#define EDIT_GET_XML \
|
#define EDIT_GET_XML \
|
||||||
@ -4980,7 +4980,7 @@ cmdManagedSaveDefine(vshControl *ctl, const vshCmd *cmd)
|
|||||||
|
|
||||||
VSH_EXCLUSIVE_OPTIONS("running", "paused");
|
VSH_EXCLUSIVE_OPTIONS("running", "paused");
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "xml", &xmlfile) < 0)
|
if (vshCommandOptString(ctl, cmd, "xml", &xmlfile) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (virFileReadAll(xmlfile, VSH_MAX_XML_FILE, &xml) < 0)
|
if (virFileReadAll(xmlfile, VSH_MAX_XML_FILE, &xml) < 0)
|
||||||
@ -5089,7 +5089,7 @@ cmdSchedInfoUpdate(vshControl *ctl, const vshCmd *cmd,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = vshCommandOptStringReq(ctl, cmd, "cap", &val);
|
rv = vshCommandOptString(ctl, cmd, "cap", &val);
|
||||||
if (rv < 0 ||
|
if (rv < 0 ||
|
||||||
(val &&
|
(val &&
|
||||||
cmdSchedInfoUpdateOne(ctl, src_params, nsrc_params,
|
cmdSchedInfoUpdateOne(ctl, src_params, nsrc_params,
|
||||||
@ -5097,7 +5097,7 @@ cmdSchedInfoUpdate(vshControl *ctl, const vshCmd *cmd,
|
|||||||
"cap", val) < 0))
|
"cap", val) < 0))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
rv = vshCommandOptStringReq(ctl, cmd, "weight", &val);
|
rv = vshCommandOptString(ctl, cmd, "weight", &val);
|
||||||
if (rv < 0 ||
|
if (rv < 0 ||
|
||||||
(val &&
|
(val &&
|
||||||
cmdSchedInfoUpdateOne(ctl, src_params, nsrc_params,
|
cmdSchedInfoUpdateOne(ctl, src_params, nsrc_params,
|
||||||
@ -5263,7 +5263,7 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptBool(cmd, "bypass-cache"))
|
if (vshCommandOptBool(cmd, "bypass-cache"))
|
||||||
@ -5275,7 +5275,7 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (vshCommandOptBool(cmd, "reset-nvram"))
|
if (vshCommandOptBool(cmd, "reset-nvram"))
|
||||||
flags |= VIR_DOMAIN_SAVE_RESET_NVRAM;
|
flags |= VIR_DOMAIN_SAVE_RESET_NVRAM;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "xml", &xmlfile) < 0)
|
if (vshCommandOptString(ctl, cmd, "xml", &xmlfile) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (xmlfile &&
|
if (xmlfile &&
|
||||||
@ -5372,7 +5372,7 @@ doDump(void *opaque)
|
|||||||
goto out_sig;
|
goto out_sig;
|
||||||
#endif /* !WIN32 */
|
#endif /* !WIN32 */
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &to) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &to) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, &name)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, &name)))
|
||||||
@ -5445,7 +5445,7 @@ cmdDump(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, &name)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, &name)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &to) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &to) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptBool(cmd, "verbose"))
|
if (vshCommandOptBool(cmd, "verbose"))
|
||||||
@ -5536,7 +5536,7 @@ cmdScreenshot(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
virshStreamCallbackData cbdata;
|
virshStreamCallbackData cbdata;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", (const char **) &file) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", (const char **) &file) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptUInt(ctl, cmd, "screen", &screen) < 0)
|
if (vshCommandOptUInt(ctl, cmd, "screen", &screen) < 0)
|
||||||
@ -5666,8 +5666,8 @@ cmdSetLifecycleAction(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (live)
|
if (live)
|
||||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "type", &typeStr) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "type", &typeStr) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "action", &actionStr) < 0) {
|
vshCommandOptString(ctl, cmd, "action", &actionStr) < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5735,10 +5735,10 @@ cmdSetUserPassword(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (vshCommandOptBool(cmd, "encrypted"))
|
if (vshCommandOptBool(cmd, "encrypted"))
|
||||||
flags = VIR_DOMAIN_PASSWORD_ENCRYPTED;
|
flags = VIR_DOMAIN_PASSWORD_ENCRYPTED;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "user", &user) < 0)
|
if (vshCommandOptString(ctl, cmd, "user", &user) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "password", &password) < 0)
|
if (vshCommandOptString(ctl, cmd, "password", &password) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, &name)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, &name)))
|
||||||
@ -5811,7 +5811,7 @@ cmdShutdown(vshControl *ctl, const vshCmd *cmd)
|
|||||||
g_auto(GStrv) modes = NULL;
|
g_auto(GStrv) modes = NULL;
|
||||||
char **tmp;
|
char **tmp;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "mode", &mode) < 0)
|
if (vshCommandOptString(ctl, cmd, "mode", &mode) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (mode && !(modes = g_strsplit(mode, ",", 0))) {
|
if (mode && !(modes = g_strsplit(mode, ",", 0))) {
|
||||||
@ -5886,7 +5886,7 @@ cmdReboot(vshControl *ctl, const vshCmd *cmd)
|
|||||||
g_auto(GStrv) modes = NULL;
|
g_auto(GStrv) modes = NULL;
|
||||||
char **tmp;
|
char **tmp;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "mode", &mode) < 0)
|
if (vshCommandOptString(ctl, cmd, "mode", &mode) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (mode && !(modes = g_strsplit(mode, ",", 0))) {
|
if (mode && !(modes = g_strsplit(mode, ",", 0))) {
|
||||||
@ -6982,7 +6982,7 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (live)
|
if (live)
|
||||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "cpulist", &cpulist) < 0)
|
if (vshCommandOptString(ctl, cmd, "cpulist", &cpulist) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!cpulist)
|
if (!cpulist)
|
||||||
@ -7076,7 +7076,7 @@ cmdEmulatorPin(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "cpulist", &cpulist) < 0) {
|
if (vshCommandOptString(ctl, cmd, "cpulist", &cpulist) < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
query = !cpulist;
|
query = !cpulist;
|
||||||
@ -7253,7 +7253,7 @@ cmdGuestvcpus(vshControl *ctl, const vshCmd *cmd)
|
|||||||
VSH_REQUIRE_OPTION("enable", "cpulist");
|
VSH_REQUIRE_OPTION("enable", "cpulist");
|
||||||
VSH_REQUIRE_OPTION("disable", "cpulist");
|
VSH_REQUIRE_OPTION("disable", "cpulist");
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "cpulist", &cpulist))
|
if (vshCommandOptString(ctl, cmd, "cpulist", &cpulist))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (cpulist && !(enable || disable)) {
|
if (cpulist && !(enable || disable)) {
|
||||||
@ -7346,7 +7346,7 @@ cmdSetvcpu(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "vcpulist", &vcpulist))
|
if (vshCommandOptString(ctl, cmd, "vcpulist", &vcpulist))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
@ -7396,7 +7396,7 @@ cmdDomblkthreshold(vshControl *ctl, const vshCmd *cmd)
|
|||||||
const char *dev = NULL;
|
const char *dev = NULL;
|
||||||
g_autoptr(virshDomain) dom = NULL;
|
g_autoptr(virshDomain) dom = NULL;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "dev", &dev))
|
if (vshCommandOptString(ctl, cmd, "dev", &dev))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptScaledInt(ctl, cmd, "threshold",
|
if (vshCommandOptScaledInt(ctl, cmd, "threshold",
|
||||||
@ -7552,7 +7552,7 @@ cmdIOThreadPin(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (vshCommandOptUInt(ctl, cmd, "iothread", &iothread_id) < 0)
|
if (vshCommandOptUInt(ctl, cmd, "iothread", &iothread_id) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "cpulist", &cpulist) < 0)
|
if (vshCommandOptString(ctl, cmd, "cpulist", &cpulist) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((maxcpu = virshNodeGetCPUCount(priv->conn)) < 0)
|
if ((maxcpu = virshNodeGetCPUCount(priv->conn)) < 0)
|
||||||
@ -8052,7 +8052,7 @@ cmdCreate(vshControl *ctl, const vshCmd *cmd)
|
|||||||
g_autofree int *fds = NULL;
|
g_autofree int *fds = NULL;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0)
|
if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0)
|
||||||
@ -8129,7 +8129,7 @@ cmdDefine(vshControl *ctl, const vshCmd *cmd)
|
|||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptBool(cmd, "validate"))
|
if (vshCommandOptBool(cmd, "validate"))
|
||||||
@ -8432,9 +8432,9 @@ cmdMetadata(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "uri", &uri) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "uri", &uri) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "key", &key) < 0 ||
|
vshCommandOptString(ctl, cmd, "key", &key) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "set", &set) < 0)
|
vshCommandOptString(ctl, cmd, "set", &set) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((set || edit) && !key) {
|
if ((set || edit) && !key) {
|
||||||
@ -8684,7 +8684,7 @@ cmdSendProcessSignal(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (vshCommandOptLongLong(ctl, cmd, "pid", &pid_value) < 0)
|
if (vshCommandOptLongLong(ctl, cmd, "pid", &pid_value) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "signame", &signame) < 0)
|
if (vshCommandOptString(ctl, cmd, "signame", &signame) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((signum = getSignalNumber(signame)) < 0) {
|
if ((signum = getSignalNumber(signame)) < 0) {
|
||||||
@ -8896,7 +8896,7 @@ virshGetUpdatedMemoryXML(char **updatedMemoryXML,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
nodeOpt = vshCommandOptBool(cmd, "node");
|
nodeOpt = vshCommandOptBool(cmd, "node");
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "alias", &alias) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "alias", &alias) < 0 ||
|
||||||
vshCommandOptUInt(ctl, cmd, "node", &node) < 0) {
|
vshCommandOptUInt(ctl, cmd, "node", &node) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -9248,8 +9248,8 @@ cmdPerf(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (live)
|
if (live)
|
||||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "enable", &enable) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "enable", &enable) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "disable", &disable) < 0)
|
vshCommandOptString(ctl, cmd, "disable", &disable) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
@ -9340,7 +9340,7 @@ cmdNumatune(vshControl * ctl, const vshCmd * cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "nodeset", &nodeset) < 0)
|
if (vshCommandOptString(ctl, cmd, "nodeset", &nodeset) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (nodeset &&
|
if (nodeset &&
|
||||||
@ -9348,7 +9348,7 @@ cmdNumatune(vshControl * ctl, const vshCmd * cmd)
|
|||||||
VIR_DOMAIN_NUMA_NODESET, nodeset) < 0)
|
VIR_DOMAIN_NUMA_NODESET, nodeset) < 0)
|
||||||
goto save_error;
|
goto save_error;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "mode", &mode) < 0)
|
if (vshCommandOptString(ctl, cmd, "mode", &mode) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (mode) {
|
if (mode) {
|
||||||
@ -9502,10 +9502,10 @@ cmdDomSetLaunchSecState(vshControl * ctl, const vshCmd * cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "secrethdr", &sechdrfile) < 0)
|
if (vshCommandOptString(ctl, cmd, "secrethdr", &sechdrfile) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "secret", &secfile) < 0)
|
if (vshCommandOptString(ctl, cmd, "secret", &secfile) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (sechdrfile == NULL || secfile == NULL) {
|
if (sechdrfile == NULL || secfile == NULL) {
|
||||||
@ -9609,7 +9609,7 @@ cmdDomFdAssociate(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "name", &name) < 0)
|
if (vshCommandOptString(ctl, cmd, "name", &name) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (virshFetchPassFdsList(ctl, cmd, &nfds, &fds) < 0)
|
if (virshFetchPassFdsList(ctl, cmd, &nfds, &fds) < 0)
|
||||||
@ -9941,7 +9941,7 @@ cmdQemuMonitorEvent(vshControl *ctl, const vshCmd *cmd)
|
|||||||
data.count = 0;
|
data.count = 0;
|
||||||
if (vshCommandOptTimeoutToMs(ctl, cmd, &timeout) < 0)
|
if (vshCommandOptTimeoutToMs(ctl, cmd, &timeout) < 0)
|
||||||
return false;
|
return false;
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "event", &event) < 0)
|
if (vshCommandOptString(ctl, cmd, "event", &event) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptBool(cmd, "domain"))
|
if (vshCommandOptBool(cmd, "domain"))
|
||||||
@ -10350,8 +10350,8 @@ cmdDomXMLFromNative(vshControl *ctl, const vshCmd *cmd)
|
|||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "format", &format) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "format", &format) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "config", &configFile) < 0)
|
vshCommandOptString(ctl, cmd, "config", &configFile) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (virFileReadAll(configFile, VSH_MAX_XML_FILE, &configData) < 0)
|
if (virFileReadAll(configFile, VSH_MAX_XML_FILE, &configData) < 0)
|
||||||
@ -10405,8 +10405,8 @@ cmdDomXMLToNative(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
g_autoptr(virshDomain) dom = NULL;
|
g_autoptr(virshDomain) dom = NULL;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "format", &format) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "format", &format) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "xml", &xmlFile) < 0)
|
vshCommandOptString(ctl, cmd, "xml", &xmlFile) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
VSH_EXCLUSIVE_OPTIONS("domain", "xml");
|
VSH_EXCLUSIVE_OPTIONS("domain", "xml");
|
||||||
@ -10500,7 +10500,7 @@ cmdDomrename(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "new-name", &new_name) < 0)
|
if (vshCommandOptString(ctl, cmd, "new-name", &new_name) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (virDomainRename(dom, new_name, 0) < 0)
|
if (virDomainRename(dom, new_name, 0) < 0)
|
||||||
@ -10881,24 +10881,24 @@ doMigrate(void *opaque)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "desturi", &desturi) < 0)
|
if (vshCommandOptString(ctl, cmd, "desturi", &desturi) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "migrateuri", &opt) < 0)
|
if (vshCommandOptString(ctl, cmd, "migrateuri", &opt) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
if (opt &&
|
if (opt &&
|
||||||
virTypedParamsAddString(¶ms, &nparams, &maxparams,
|
virTypedParamsAddString(¶ms, &nparams, &maxparams,
|
||||||
VIR_MIGRATE_PARAM_URI, opt) < 0)
|
VIR_MIGRATE_PARAM_URI, opt) < 0)
|
||||||
goto save_error;
|
goto save_error;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "graphicsuri", &opt) < 0)
|
if (vshCommandOptString(ctl, cmd, "graphicsuri", &opt) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
if (opt &&
|
if (opt &&
|
||||||
virTypedParamsAddString(¶ms, &nparams, &maxparams,
|
virTypedParamsAddString(¶ms, &nparams, &maxparams,
|
||||||
VIR_MIGRATE_PARAM_GRAPHICS_URI, opt) < 0)
|
VIR_MIGRATE_PARAM_GRAPHICS_URI, opt) < 0)
|
||||||
goto save_error;
|
goto save_error;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "listen-address", &opt) < 0)
|
if (vshCommandOptString(ctl, cmd, "listen-address", &opt) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
if (opt &&
|
if (opt &&
|
||||||
virTypedParamsAddString(¶ms, &nparams, &maxparams,
|
virTypedParamsAddString(¶ms, &nparams, &maxparams,
|
||||||
@ -10912,7 +10912,7 @@ doMigrate(void *opaque)
|
|||||||
VIR_MIGRATE_PARAM_DISKS_PORT, intOpt) < 0)
|
VIR_MIGRATE_PARAM_DISKS_PORT, intOpt) < 0)
|
||||||
goto save_error;
|
goto save_error;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "disks-uri", &opt) < 0)
|
if (vshCommandOptString(ctl, cmd, "disks-uri", &opt) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
if (opt &&
|
if (opt &&
|
||||||
virTypedParamsAddString(¶ms, &nparams, &maxparams,
|
virTypedParamsAddString(¶ms, &nparams, &maxparams,
|
||||||
@ -10920,14 +10920,14 @@ doMigrate(void *opaque)
|
|||||||
opt) < 0)
|
opt) < 0)
|
||||||
goto save_error;
|
goto save_error;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "dname", &opt) < 0)
|
if (vshCommandOptString(ctl, cmd, "dname", &opt) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
if (opt &&
|
if (opt &&
|
||||||
virTypedParamsAddString(¶ms, &nparams, &maxparams,
|
virTypedParamsAddString(¶ms, &nparams, &maxparams,
|
||||||
VIR_MIGRATE_PARAM_DEST_NAME, opt) < 0)
|
VIR_MIGRATE_PARAM_DEST_NAME, opt) < 0)
|
||||||
goto save_error;
|
goto save_error;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "migrate-disks", &opt) < 0)
|
if (vshCommandOptString(ctl, cmd, "migrate-disks", &opt) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
if (opt) {
|
if (opt) {
|
||||||
g_autofree char **val = NULL;
|
g_autofree char **val = NULL;
|
||||||
@ -10948,7 +10948,7 @@ doMigrate(void *opaque)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "comp-methods", &opt) < 0)
|
if (vshCommandOptString(ctl, cmd, "comp-methods", &opt) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
if (opt) {
|
if (opt) {
|
||||||
g_autofree char **val = g_strsplit(opt, ",", 0);
|
g_autofree char **val = g_strsplit(opt, ",", 0);
|
||||||
@ -10998,7 +10998,7 @@ doMigrate(void *opaque)
|
|||||||
goto save_error;
|
goto save_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "xml", &opt) < 0)
|
if (vshCommandOptString(ctl, cmd, "xml", &opt) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
if (opt) {
|
if (opt) {
|
||||||
g_autofree char *xml = NULL;
|
g_autofree char *xml = NULL;
|
||||||
@ -11014,7 +11014,7 @@ doMigrate(void *opaque)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "persistent-xml", &opt) < 0)
|
if (vshCommandOptString(ctl, cmd, "persistent-xml", &opt) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
if (opt) {
|
if (opt) {
|
||||||
g_autofree char *xml = NULL;
|
g_autofree char *xml = NULL;
|
||||||
@ -11093,7 +11093,7 @@ doMigrate(void *opaque)
|
|||||||
goto save_error;
|
goto save_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "tls-destination", &opt) < 0)
|
if (vshCommandOptString(ctl, cmd, "tls-destination", &opt) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
if (opt &&
|
if (opt &&
|
||||||
virTypedParamsAddString(¶ms, &nparams, &maxparams,
|
virTypedParamsAddString(¶ms, &nparams, &maxparams,
|
||||||
@ -11250,7 +11250,7 @@ cmdMigrate(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virConnectPtr dconn = NULL;
|
virConnectPtr dconn = NULL;
|
||||||
const char *desturi = NULL;
|
const char *desturi = NULL;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "desturi", &desturi) < 0)
|
if (vshCommandOptString(ctl, cmd, "desturi", &desturi) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
dconn = virshConnect(ctl, desturi, false);
|
dconn = virshConnect(ctl, desturi, false);
|
||||||
@ -11722,7 +11722,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (vshCommandOptBool(cmd, "include-password"))
|
if (vshCommandOptBool(cmd, "include-password"))
|
||||||
flags |= VIR_DOMAIN_XML_SECURE;
|
flags |= VIR_DOMAIN_XML_SECURE;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "type", &type) < 0)
|
if (vshCommandOptString(ctl, cmd, "type", &type) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (virshDomainGetXMLFromDom(ctl, dom, flags, &xml, &ctxt) < 0)
|
if (virshDomainGetXMLFromDom(ctl, dom, flags, &xml, &ctxt) < 0)
|
||||||
@ -11885,7 +11885,7 @@ cmdDomHostname(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "source", &sourcestr) < 0)
|
if (vshCommandOptString(ctl, cmd, "source", &sourcestr) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (sourcestr) {
|
if (sourcestr) {
|
||||||
@ -11966,7 +11966,7 @@ cmdDetachDevice(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virDomainIsActive(dom) == 1)
|
virDomainIsActive(dom) == 1)
|
||||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0) {
|
if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0) {
|
||||||
@ -12033,7 +12033,7 @@ cmdDetachDeviceAlias(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "alias", &alias) < 0)
|
if (vshCommandOptString(ctl, cmd, "alias", &alias) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (virDomainDetachDeviceAlias(dom, alias, flags) < 0) {
|
if (virDomainDetachDeviceAlias(dom, alias, flags) < 0) {
|
||||||
@ -12093,7 +12093,7 @@ cmdUpdateDevice(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (persistent &&
|
if (persistent &&
|
||||||
@ -12255,10 +12255,10 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "type", &type) < 0)
|
if (vshCommandOptString(ctl, cmd, "type", &type) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "mac", &mac) < 0)
|
if (vshCommandOptString(ctl, cmd, "mac", &mac) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
affect_config = (config || persistent);
|
affect_config = (config || persistent);
|
||||||
@ -12548,7 +12548,7 @@ cmdDetachDisk(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "target", &target) < 0)
|
if (vshCommandOptString(ctl, cmd, "target", &target) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (flags == VIR_DOMAIN_AFFECT_CONFIG)
|
if (flags == VIR_DOMAIN_AFFECT_CONFIG)
|
||||||
@ -12736,7 +12736,7 @@ cmdChangeMedia(vshControl *ctl, const vshCmd *cmd)
|
|||||||
|
|
||||||
VSH_EXCLUSIVE_OPTIONS_VAR(eject, block);
|
VSH_EXCLUSIVE_OPTIONS_VAR(eject, block);
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "source", &source) < 0)
|
if (vshCommandOptString(ctl, cmd, "source", &source) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Docs state that update without source is eject */
|
/* Docs state that update without source is eject */
|
||||||
@ -12776,7 +12776,7 @@ cmdChangeMedia(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "path", &path) < 0)
|
if (vshCommandOptString(ctl, cmd, "path", &path) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG)
|
if (flags & VIR_DOMAIN_AFFECT_CONFIG)
|
||||||
@ -12842,7 +12842,7 @@ cmdDomFSTrim(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (vshCommandOptULongLong(ctl, cmd, "minimum", &minimum) < 0)
|
if (vshCommandOptULongLong(ctl, cmd, "minimum", &minimum) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "mountpoint", &mountPoint) < 0)
|
if (vshCommandOptString(ctl, cmd, "mountpoint", &mountPoint) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (virDomainFSTrim(dom, mountPoint, minimum, flags) < 0) {
|
if (virDomainFSTrim(dom, mountPoint, minimum, flags) < 0) {
|
||||||
@ -13164,7 +13164,7 @@ cmdGetUserSSHKeys(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "user", &user) < 0)
|
if (vshCommandOptString(ctl, cmd, "user", &user) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
nkeys = virDomainAuthorizedSSHKeysGet(dom, user, &keys, flags);
|
nkeys = virDomainAuthorizedSSHKeysGet(dom, user, &keys, flags);
|
||||||
@ -13230,10 +13230,10 @@ cmdSetUserSSHKeys(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "user", &user) < 0)
|
if (vshCommandOptString(ctl, cmd, "user", &user) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptBool(cmd, "remove")) {
|
if (vshCommandOptBool(cmd, "remove")) {
|
||||||
@ -13323,7 +13323,7 @@ cmdDomDirtyRateCalc(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (vshCommandOptInt(ctl, cmd, "seconds", &seconds) < 0)
|
if (vshCommandOptInt(ctl, cmd, "seconds", &seconds) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "mode", &modestr) < 0)
|
if (vshCommandOptString(ctl, cmd, "mode", &modestr) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (modestr) {
|
if (modestr) {
|
||||||
|
@ -130,10 +130,10 @@ cmdDomCapabilities(vshControl *ctl, const vshCmd *cmd)
|
|||||||
bool wrap = vshCommandOptBool(cmd, "wrap");
|
bool wrap = vshCommandOptBool(cmd, "wrap");
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "virttype", &virttype) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "virttype", &virttype) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "emulatorbin", &emulatorbin) < 0 ||
|
vshCommandOptString(ctl, cmd, "emulatorbin", &emulatorbin) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "arch", &arch) < 0 ||
|
vshCommandOptString(ctl, cmd, "arch", &arch) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "machine", &machine) < 0 ||
|
vshCommandOptString(ctl, cmd, "machine", &machine) < 0 ||
|
||||||
vshCommandOptStringQuiet(ctl, cmd, "xpath", &xpath) < 0)
|
vshCommandOptStringQuiet(ctl, cmd, "xpath", &xpath) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -605,7 +605,7 @@ cmdMaxvcpus(vshControl *ctl, const vshCmd *cmd)
|
|||||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
g_autoptr(xmlXPathContext) ctxt = NULL;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "type", &type) < 0)
|
if (vshCommandOptString(ctl, cmd, "type", &type) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((caps = virConnectGetDomainCapabilities(priv->conn, NULL, NULL, NULL,
|
if ((caps = virConnectGetDomainCapabilities(priv->conn, NULL, NULL, NULL,
|
||||||
@ -977,7 +977,7 @@ cmdNodeSuspend(vshControl *ctl, const vshCmd *cmd)
|
|||||||
long long duration;
|
long long duration;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "target", &target) < 0)
|
if (vshCommandOptString(ctl, cmd, "target", &target) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptLongLong(ctl, cmd, "duration", &duration) < 0)
|
if (vshCommandOptLongLong(ctl, cmd, "duration", &duration) < 0)
|
||||||
@ -1189,7 +1189,7 @@ cmdCPUCompare(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (vshCommandOptBool(cmd, "validate"))
|
if (vshCommandOptBool(cmd, "validate"))
|
||||||
flags |= VIR_CONNECT_COMPARE_CPU_VALIDATE_XML;
|
flags |= VIR_CONNECT_COMPARE_CPU_VALIDATE_XML;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(cpus = vshExtractCPUDefXMLs(ctl, from)))
|
if (!(cpus = vshExtractCPUDefXMLs(ctl, from)))
|
||||||
@ -1258,7 +1258,7 @@ cmdCPUBaseline(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (vshCommandOptBool(cmd, "migratable"))
|
if (vshCommandOptBool(cmd, "migratable"))
|
||||||
flags |= VIR_CONNECT_BASELINE_CPU_MIGRATABLE;
|
flags |= VIR_CONNECT_BASELINE_CPU_MIGRATABLE;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(list = vshExtractCPUDefXMLs(ctl, from)))
|
if (!(list = vshExtractCPUDefXMLs(ctl, from)))
|
||||||
@ -1300,7 +1300,7 @@ cmdCPUModelNames(vshControl *ctl, const vshCmd *cmd)
|
|||||||
const char *arch = NULL;
|
const char *arch = NULL;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "arch", &arch) < 0)
|
if (vshCommandOptString(ctl, cmd, "arch", &arch) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
nmodels = virConnectGetCPUModelNames(priv->conn, arch, &models, 0);
|
nmodels = virConnectGetCPUModelNames(priv->conn, arch, &models, 0);
|
||||||
@ -1598,11 +1598,11 @@ cmdHypervisorCPUCompare(vshControl *ctl,
|
|||||||
if (vshCommandOptBool(cmd, "validate"))
|
if (vshCommandOptBool(cmd, "validate"))
|
||||||
flags |= VIR_CONNECT_COMPARE_CPU_VALIDATE_XML;
|
flags |= VIR_CONNECT_COMPARE_CPU_VALIDATE_XML;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "virttype", &virttype) < 0 ||
|
vshCommandOptString(ctl, cmd, "virttype", &virttype) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "emulator", &emulator) < 0 ||
|
vshCommandOptString(ctl, cmd, "emulator", &emulator) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "arch", &arch) < 0 ||
|
vshCommandOptString(ctl, cmd, "arch", &arch) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "machine", &machine) < 0)
|
vshCommandOptString(ctl, cmd, "machine", &machine) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(cpus = vshExtractCPUDefXMLs(ctl, from)))
|
if (!(cpus = vshExtractCPUDefXMLs(ctl, from)))
|
||||||
@ -1718,12 +1718,12 @@ cmdHypervisorCPUBaseline(vshControl *ctl,
|
|||||||
if (vshCommandOptBool(cmd, "migratable"))
|
if (vshCommandOptBool(cmd, "migratable"))
|
||||||
flags |= VIR_CONNECT_BASELINE_CPU_MIGRATABLE;
|
flags |= VIR_CONNECT_BASELINE_CPU_MIGRATABLE;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "virttype", &virttype) < 0 ||
|
vshCommandOptString(ctl, cmd, "virttype", &virttype) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "emulator", &emulator) < 0 ||
|
vshCommandOptString(ctl, cmd, "emulator", &emulator) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "arch", &arch) < 0 ||
|
vshCommandOptString(ctl, cmd, "arch", &arch) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "machine", &machine) < 0 ||
|
vshCommandOptString(ctl, cmd, "machine", &machine) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "model", &model) < 0)
|
vshCommandOptString(ctl, cmd, "model", &model) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
VSH_ALTERNATIVE_OPTIONS_EXPR("file", from, "model", model);
|
VSH_ALTERNATIVE_OPTIONS_EXPR("file", from, "model", model);
|
||||||
|
@ -58,7 +58,7 @@ virshCommandOptInterfaceBy(vshControl *ctl, const vshCmd *cmd,
|
|||||||
if (!optname)
|
if (!optname)
|
||||||
optname = "interface";
|
optname = "interface";
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, optname, &n) < 0)
|
if (vshCommandOptString(ctl, cmd, optname, &n) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n",
|
vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n",
|
||||||
@ -515,7 +515,7 @@ cmdInterfaceDefine(vshControl *ctl, const vshCmd *cmd)
|
|||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptBool(cmd, "validate"))
|
if (vshCommandOptBool(cmd, "validate"))
|
||||||
@ -770,7 +770,7 @@ cmdInterfaceBridge(vshControl *ctl, const vshCmd *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Name for new bridge device */
|
/* Name for new bridge device */
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "bridge", &br_name) < 0)
|
if (vshCommandOptString(ctl, cmd, "bridge", &br_name) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* make sure "new" device doesn't already exist */
|
/* make sure "new" device doesn't already exist */
|
||||||
|
@ -65,7 +65,7 @@ virshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd,
|
|||||||
|
|
||||||
virCheckFlags(VIRSH_BYUUID | VIRSH_BYNAME, NULL);
|
virCheckFlags(VIRSH_BYUUID | VIRSH_BYNAME, NULL);
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, optname, &n) < 0)
|
if (vshCommandOptString(ctl, cmd, optname, &n) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n",
|
vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n",
|
||||||
@ -103,7 +103,7 @@ virshCommandOptNetworkPort(vshControl *ctl, const vshCmd *cmd,
|
|||||||
const char *n = NULL;
|
const char *n = NULL;
|
||||||
const char *optname = "port";
|
const char *optname = "port";
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, optname, &n) < 0)
|
if (vshCommandOptString(ctl, cmd, optname, &n) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n",
|
vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n",
|
||||||
@ -193,7 +193,7 @@ cmdNetworkCreate(vshControl *ctl, const vshCmd *cmd)
|
|||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptBool(cmd, "validate"))
|
if (vshCommandOptBool(cmd, "validate"))
|
||||||
@ -244,7 +244,7 @@ cmdNetworkDefine(vshControl *ctl, const vshCmd *cmd)
|
|||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptBool(cmd, "validate"))
|
if (vshCommandOptBool(cmd, "validate"))
|
||||||
@ -570,9 +570,9 @@ cmdNetworkMetadata(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(net = virshCommandOptNetwork(ctl, cmd, NULL)))
|
if (!(net = virshCommandOptNetwork(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "uri", &uri) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "uri", &uri) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "key", &key) < 0 ||
|
vshCommandOptString(ctl, cmd, "key", &key) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "set", &set) < 0)
|
vshCommandOptString(ctl, cmd, "set", &set) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((set || edit) && !key) {
|
if ((set || edit) && !key) {
|
||||||
@ -1281,7 +1281,7 @@ cmdNetworkUpdate(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(network = virshCommandOptNetwork(ctl, cmd, NULL)))
|
if (!(network = virshCommandOptNetwork(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "command", &commandStr) < 0)
|
if (vshCommandOptString(ctl, cmd, "command", &commandStr) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (STREQ(commandStr, "add")) {
|
if (STREQ(commandStr, "add")) {
|
||||||
@ -1295,7 +1295,7 @@ cmdNetworkUpdate(vshControl *ctl, const vshCmd *cmd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "section", §ionStr) < 0)
|
if (vshCommandOptString(ctl, cmd, "section", §ionStr) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
section = virshNetworkSectionTypeFromString(sectionStr);
|
section = virshNetworkSectionTypeFromString(sectionStr);
|
||||||
@ -1314,7 +1314,7 @@ cmdNetworkUpdate(vshControl *ctl, const vshCmd *cmd)
|
|||||||
* the desired xml.
|
* the desired xml.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "xml", &xml) < 0)
|
if (vshCommandOptString(ctl, cmd, "xml", &xml) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (*xml != '<') {
|
if (*xml != '<') {
|
||||||
@ -1631,7 +1631,7 @@ cmdNetworkEvent(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "event", &eventName) < 0)
|
if (vshCommandOptString(ctl, cmd, "event", &eventName) < 0)
|
||||||
return false;
|
return false;
|
||||||
if (!eventName) {
|
if (!eventName) {
|
||||||
vshError(ctl, "%s", _("either --list or --event <type> is required"));
|
vshError(ctl, "%s", _("either --list or --event <type> is required"));
|
||||||
@ -1736,7 +1736,7 @@ cmdNetworkDHCPLeases(vshControl *ctl, const vshCmd *cmd)
|
|||||||
g_autoptr(virshNetwork) network = NULL;
|
g_autoptr(virshNetwork) network = NULL;
|
||||||
g_autoptr(vshTable) table = NULL;
|
g_autoptr(vshTable) table = NULL;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "mac", &mac) < 0)
|
if (vshCommandOptString(ctl, cmd, "mac", &mac) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(network = virshCommandOptNetwork(ctl, cmd, &name)))
|
if (!(network = virshCommandOptNetwork(ctl, cmd, &name)))
|
||||||
@ -1829,7 +1829,7 @@ cmdNetworkPortCreate(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (network == NULL)
|
if (network == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (vshCommandOptBool(cmd, "validate"))
|
if (vshCommandOptBool(cmd, "validate"))
|
||||||
|
@ -61,7 +61,7 @@ cmdNodeDeviceCreate(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0)
|
if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0)
|
||||||
@ -142,7 +142,7 @@ cmdNodeDeviceDestroy(vshControl *ctl, const vshCmd *cmd)
|
|||||||
g_autoptr(virshNodeDevice) dev = NULL;
|
g_autoptr(virshNodeDevice) dev = NULL;
|
||||||
const char *device_value = NULL;
|
const char *device_value = NULL;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "device", &device_value) < 0)
|
if (vshCommandOptString(ctl, cmd, "device", &device_value) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
dev = vshFindNodeDevice(ctl, device_value);
|
dev = vshFindNodeDevice(ctl, device_value);
|
||||||
@ -604,7 +604,7 @@ cmdNodeDeviceDumpXML(vshControl *ctl, const vshCmd *cmd)
|
|||||||
bool wrap = vshCommandOptBool(cmd, "wrap");
|
bool wrap = vshCommandOptBool(cmd, "wrap");
|
||||||
const char *xpath = NULL;
|
const char *xpath = NULL;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "device", &device_value) < 0)
|
if (vshCommandOptString(ctl, cmd, "device", &device_value) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringQuiet(ctl, cmd, "xpath", &xpath) < 0)
|
if (vshCommandOptStringQuiet(ctl, cmd, "xpath", &xpath) < 0)
|
||||||
@ -659,7 +659,7 @@ cmdNodeDeviceDetach(vshControl *ctl, const vshCmd *cmd)
|
|||||||
bool ret = true;
|
bool ret = true;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "device", &name) < 0)
|
if (vshCommandOptString(ctl, cmd, "device", &name) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ignore_value(vshCommandOptStringQuiet(ctl, cmd, "driver", &driverName));
|
ignore_value(vshCommandOptStringQuiet(ctl, cmd, "driver", &driverName));
|
||||||
@ -716,7 +716,7 @@ cmdNodeDeviceReAttach(vshControl *ctl, const vshCmd *cmd)
|
|||||||
bool ret = true;
|
bool ret = true;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "device", &name) < 0)
|
if (vshCommandOptString(ctl, cmd, "device", &name) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(device = virNodeDeviceLookupByName(priv->conn, name))) {
|
if (!(device = virNodeDeviceLookupByName(priv->conn, name))) {
|
||||||
@ -762,7 +762,7 @@ cmdNodeDeviceReset(vshControl *ctl, const vshCmd *cmd)
|
|||||||
bool ret = true;
|
bool ret = true;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "device", &name) < 0)
|
if (vshCommandOptString(ctl, cmd, "device", &name) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(device = virNodeDeviceLookupByName(priv->conn, name))) {
|
if (!(device = virNodeDeviceLookupByName(priv->conn, name))) {
|
||||||
@ -936,7 +936,7 @@ cmdNodeDeviceEvent(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "event", &eventName) < 0)
|
if (vshCommandOptString(ctl, cmd, "event", &eventName) < 0)
|
||||||
return false;
|
return false;
|
||||||
if (!eventName) {
|
if (!eventName) {
|
||||||
vshError(ctl, "%s", _("either --list or --event <type> is required"));
|
vshError(ctl, "%s", _("either --list or --event <type> is required"));
|
||||||
@ -958,7 +958,7 @@ cmdNodeDeviceEvent(vshControl *ctl, const vshCmd *cmd)
|
|||||||
data.cb = &virshNodeDeviceEventCallbacks[event];
|
data.cb = &virshNodeDeviceEventCallbacks[event];
|
||||||
if (vshCommandOptTimeoutToMs(ctl, cmd, &timeout) < 0)
|
if (vshCommandOptTimeoutToMs(ctl, cmd, &timeout) < 0)
|
||||||
return false;
|
return false;
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "device", &device_value) < 0)
|
if (vshCommandOptString(ctl, cmd, "device", &device_value) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (device_value) {
|
if (device_value) {
|
||||||
@ -1025,7 +1025,7 @@ cmdNodeDeviceUndefine(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
|
|||||||
g_autoptr(virshNodeDevice) dev = NULL;
|
g_autoptr(virshNodeDevice) dev = NULL;
|
||||||
const char *device_value = NULL;
|
const char *device_value = NULL;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "device", &device_value) < 0)
|
if (vshCommandOptString(ctl, cmd, "device", &device_value) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
dev = vshFindNodeDevice(ctl, device_value);
|
dev = vshFindNodeDevice(ctl, device_value);
|
||||||
@ -1072,7 +1072,7 @@ cmdNodeDeviceDefine(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
|
|||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0)
|
if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0)
|
||||||
@ -1119,7 +1119,7 @@ cmdNodeDeviceStart(vshControl *ctl, const vshCmd *cmd)
|
|||||||
bool ret = true;
|
bool ret = true;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "device", &name) < 0)
|
if (vshCommandOptString(ctl, cmd, "device", &name) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(device = virNodeDeviceLookupByName(priv->conn, name))) {
|
if (!(device = virNodeDeviceLookupByName(priv->conn, name))) {
|
||||||
@ -1168,7 +1168,7 @@ cmdNodeDeviceAutostart(vshControl *ctl, const vshCmd *cmd)
|
|||||||
const char *name = NULL;
|
const char *name = NULL;
|
||||||
int autostart;
|
int autostart;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "device", &name) < 0)
|
if (vshCommandOptString(ctl, cmd, "device", &name) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
dev = vshFindNodeDevice(ctl, name);
|
dev = vshFindNodeDevice(ctl, name);
|
||||||
@ -1223,7 +1223,7 @@ cmdNodeDeviceInfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
int autostart;
|
int autostart;
|
||||||
const char *parent = NULL;
|
const char *parent = NULL;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "device", &device_value) < 0)
|
if (vshCommandOptString(ctl, cmd, "device", &device_value) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
device = vshFindNodeDevice(ctl, device_value);
|
device = vshFindNodeDevice(ctl, device_value);
|
||||||
@ -1286,7 +1286,7 @@ cmdNodeDeviceUpdate(vshControl *ctl, const vshCmd *cmd)
|
|||||||
VSH_EXCLUSIVE_OPTIONS("current", "live");
|
VSH_EXCLUSIVE_OPTIONS("current", "live");
|
||||||
VSH_EXCLUSIVE_OPTIONS("current", "config");
|
VSH_EXCLUSIVE_OPTIONS("current", "config");
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "device", &device_value) < 0)
|
if (vshCommandOptString(ctl, cmd, "device", &device_value) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
device = vshFindNodeDevice(ctl, device_value);
|
device = vshFindNodeDevice(ctl, device_value);
|
||||||
@ -1294,7 +1294,7 @@ cmdNodeDeviceUpdate(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!device)
|
if (!device)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virFileReadAll(from, VSH_MAX_XML_FILE, &xml) < 0)
|
if (virFileReadAll(from, VSH_MAX_XML_FILE, &xml) < 0)
|
||||||
|
@ -38,7 +38,7 @@ virshCommandOptNWFilterBy(vshControl *ctl, const vshCmd *cmd,
|
|||||||
|
|
||||||
virCheckFlags(VIRSH_BYUUID | VIRSH_BYNAME, NULL);
|
virCheckFlags(VIRSH_BYUUID | VIRSH_BYNAME, NULL);
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, optname, &n) < 0)
|
if (vshCommandOptString(ctl, cmd, optname, &n) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n",
|
vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n",
|
||||||
@ -94,7 +94,7 @@ cmdNWFilterDefine(vshControl *ctl, const vshCmd *cmd)
|
|||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptBool(cmd, "validate"))
|
if (vshCommandOptBool(cmd, "validate"))
|
||||||
@ -447,7 +447,7 @@ virshCommandOptNWFilterBindingBy(vshControl *ctl,
|
|||||||
|
|
||||||
virCheckFlags(0, NULL);
|
virCheckFlags(0, NULL);
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, optname, &n) < 0)
|
if (vshCommandOptString(ctl, cmd, optname, &n) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n",
|
vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n",
|
||||||
@ -494,7 +494,7 @@ cmdNWFilterBindingCreate(vshControl *ctl, const vshCmd *cmd)
|
|||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptBool(cmd, "validate"))
|
if (vshCommandOptBool(cmd, "validate"))
|
||||||
|
@ -180,7 +180,7 @@ virshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname,
|
|||||||
|
|
||||||
virCheckFlags(VIRSH_BYUUID | VIRSH_BYNAME, NULL);
|
virCheckFlags(VIRSH_BYUUID | VIRSH_BYNAME, NULL);
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, optname, &n) < 0)
|
if (vshCommandOptString(ctl, cmd, optname, &n) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (cmd->skipChecks && !n)
|
if (cmd->skipChecks && !n)
|
||||||
@ -286,7 +286,7 @@ cmdPoolCreate(vshControl *ctl, const vshCmd *cmd)
|
|||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
build = vshCommandOptBool(cmd, "build");
|
build = vshCommandOptBool(cmd, "build");
|
||||||
@ -340,31 +340,31 @@ virshBuildPoolXML(vshControl *ctl,
|
|||||||
|
|
||||||
VSH_EXCLUSIVE_OPTIONS("secret-usage", "secret-uuid");
|
VSH_EXCLUSIVE_OPTIONS("secret-usage", "secret-uuid");
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "name", &name) < 0)
|
if (vshCommandOptString(ctl, cmd, "name", &name) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "type", &type) < 0)
|
if (vshCommandOptString(ctl, cmd, "type", &type) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "source-host", &srcHost) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "source-host", &srcHost) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "source-path", &srcPath) < 0 ||
|
vshCommandOptString(ctl, cmd, "source-path", &srcPath) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "source-dev", &srcDev) < 0 ||
|
vshCommandOptString(ctl, cmd, "source-dev", &srcDev) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "source-name", &srcName) < 0 ||
|
vshCommandOptString(ctl, cmd, "source-name", &srcName) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "source-format", &srcFormat) < 0 ||
|
vshCommandOptString(ctl, cmd, "source-format", &srcFormat) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "target", &target) < 0 ||
|
vshCommandOptString(ctl, cmd, "target", &target) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "auth-type", &authType) < 0 ||
|
vshCommandOptString(ctl, cmd, "auth-type", &authType) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "auth-username", &authUsername) < 0 ||
|
vshCommandOptString(ctl, cmd, "auth-username", &authUsername) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "secret-usage", &secretUsage) < 0 ||
|
vshCommandOptString(ctl, cmd, "secret-usage", &secretUsage) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "secret-uuid", &secretUUID) < 0 ||
|
vshCommandOptString(ctl, cmd, "secret-uuid", &secretUUID) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "adapter-name", &adapterName) < 0 ||
|
vshCommandOptString(ctl, cmd, "adapter-name", &adapterName) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "adapter-wwnn", &adapterWwnn) < 0 ||
|
vshCommandOptString(ctl, cmd, "adapter-wwnn", &adapterWwnn) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "adapter-wwpn", &adapterWwpn) < 0 ||
|
vshCommandOptString(ctl, cmd, "adapter-wwpn", &adapterWwpn) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "adapter-parent", &adapterParent) < 0 ||
|
vshCommandOptString(ctl, cmd, "adapter-parent", &adapterParent) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "adapter-parent-wwnn", &adapterParentWwnn) < 0 ||
|
vshCommandOptString(ctl, cmd, "adapter-parent-wwnn", &adapterParentWwnn) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "adapter-parent-wwpn", &adapterParentWwpn) < 0 ||
|
vshCommandOptString(ctl, cmd, "adapter-parent-wwpn", &adapterParentWwpn) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "adapter-parent-fabric-wwn", &adapterParentFabricWwn) < 0 ||
|
vshCommandOptString(ctl, cmd, "adapter-parent-fabric-wwn", &adapterParentFabricWwn) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "source-protocol-ver", &protoVer) < 0 ||
|
vshCommandOptString(ctl, cmd, "source-protocol-ver", &protoVer) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "source-initiator", &srcInitiator) < 0) {
|
vshCommandOptString(ctl, cmd, "source-initiator", &srcInitiator) < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -530,7 +530,7 @@ cmdPoolDefine(vshControl *ctl, const vshCmd *cmd)
|
|||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptBool(cmd, "validate"))
|
if (vshCommandOptBool(cmd, "validate"))
|
||||||
@ -1124,7 +1124,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
|
|||||||
if (vshCommandOptBool(cmd, "name"))
|
if (vshCommandOptBool(cmd, "name"))
|
||||||
name = true;
|
name = true;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "type", &type) < 0)
|
if (vshCommandOptString(ctl, cmd, "type", &type) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
VSH_EXCLUSIVE_OPTIONS("details", "uuid");
|
VSH_EXCLUSIVE_OPTIONS("details", "uuid");
|
||||||
@ -1407,16 +1407,16 @@ cmdPoolDiscoverSourcesAs(vshControl * ctl, const vshCmd * cmd G_GNUC_UNUSED)
|
|||||||
const char *initiator = NULL;
|
const char *initiator = NULL;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "type", &type) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "type", &type) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "host", &host) < 0 ||
|
vshCommandOptString(ctl, cmd, "host", &host) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "initiator", &initiator) < 0)
|
vshCommandOptString(ctl, cmd, "initiator", &initiator) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (host) {
|
if (host) {
|
||||||
const char *port = NULL;
|
const char *port = NULL;
|
||||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "port", &port) < 0) {
|
if (vshCommandOptString(ctl, cmd, "port", &port) < 0) {
|
||||||
vshError(ctl, "%s", _("missing argument"));
|
vshError(ctl, "%s", _("missing argument"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1480,10 +1480,10 @@ cmdPoolDiscoverSources(vshControl * ctl, const vshCmd * cmd G_GNUC_UNUSED)
|
|||||||
char *srcSpec = NULL, *srcList;
|
char *srcSpec = NULL, *srcList;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "type", &type) < 0)
|
if (vshCommandOptString(ctl, cmd, "type", &type) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "srcSpec", &srcSpecFile) < 0)
|
if (vshCommandOptString(ctl, cmd, "srcSpec", &srcSpecFile) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (srcSpecFile && virFileReadAll(srcSpecFile, VSH_MAX_XML_FILE,
|
if (srcSpecFile && virFileReadAll(srcSpecFile, VSH_MAX_XML_FILE,
|
||||||
@ -1952,7 +1952,7 @@ cmdPoolEvent(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "event", &eventName) < 0)
|
if (vshCommandOptString(ctl, cmd, "event", &eventName) < 0)
|
||||||
return false;
|
return false;
|
||||||
if (!eventName) {
|
if (!eventName) {
|
||||||
vshError(ctl, "%s", _("either --list or --event <type> is required"));
|
vshError(ctl, "%s", _("either --list or --event <type> is required"));
|
||||||
|
@ -41,7 +41,7 @@ virshCommandOptSecret(vshControl *ctl, const vshCmd *cmd, const char **name)
|
|||||||
const char *optname = "secret";
|
const char *optname = "secret";
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, optname, &n) < 0)
|
if (vshCommandOptString(ctl, cmd, optname, &n) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
vshDebug(ctl, VSH_ERR_DEBUG,
|
vshDebug(ctl, VSH_ERR_DEBUG,
|
||||||
@ -86,7 +86,7 @@ cmdSecretDefine(vshControl *ctl, const vshCmd *cmd)
|
|||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
virshControl *priv = ctl->privData;
|
virshControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptBool(cmd, "validate"))
|
if (vshCommandOptBool(cmd, "validate"))
|
||||||
@ -227,10 +227,10 @@ cmdSecretSetValue(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(secret = virshCommandOptSecret(ctl, cmd, NULL)))
|
if (!(secret = virshCommandOptSecret(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "base64", &base64) < 0)
|
if (vshCommandOptString(ctl, cmd, "base64", &base64) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &filename) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &filename) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (base64) {
|
if (base64) {
|
||||||
@ -763,7 +763,7 @@ cmdSecretEvent(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "event", &eventName) < 0)
|
if (vshCommandOptString(ctl, cmd, "event", &eventName) < 0)
|
||||||
return false;
|
return false;
|
||||||
if (!eventName) {
|
if (!eventName) {
|
||||||
vshError(ctl, "%s", _("either --list or --event <type> is required"));
|
vshError(ctl, "%s", _("either --list or --event <type> is required"));
|
||||||
|
@ -182,7 +182,7 @@ cmdSnapshotCreate(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "xmlfile", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "xmlfile", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
if (!from) {
|
if (!from) {
|
||||||
buffer = g_strdup("<domainsnapshot/>");
|
buffer = g_strdup("<domainsnapshot/>");
|
||||||
@ -401,8 +401,8 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "name", &name) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "name", &name) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "description", &desc) < 0)
|
vshCommandOptString(ctl, cmd, "description", &desc) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
virBufferAddLit(&buf, "<domainsnapshot>\n");
|
virBufferAddLit(&buf, "<domainsnapshot>\n");
|
||||||
@ -410,7 +410,7 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virBufferEscapeString(&buf, "<name>%s</name>\n", name);
|
virBufferEscapeString(&buf, "<name>%s</name>\n", name);
|
||||||
virBufferEscapeString(&buf, "<description>%s</description>\n", desc);
|
virBufferEscapeString(&buf, "<description>%s</description>\n", desc);
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "memspec", &memspec) < 0)
|
if (vshCommandOptString(ctl, cmd, "memspec", &memspec) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (memspec && virshParseSnapshotMemspec(ctl, &buf, memspec) < 0)
|
if (memspec && virshParseSnapshotMemspec(ctl, &buf, memspec) < 0)
|
||||||
@ -451,7 +451,7 @@ virshLookupSnapshot(vshControl *ctl, const vshCmd *cmd,
|
|||||||
bool current = vshCommandOptBool(cmd, "current");
|
bool current = vshCommandOptBool(cmd, "current");
|
||||||
const char *snapname = NULL;
|
const char *snapname = NULL;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, arg, &snapname) < 0)
|
if (vshCommandOptString(ctl, cmd, arg, &snapname) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (exclusive && current && snapname) {
|
if (exclusive && current && snapname) {
|
||||||
@ -629,7 +629,7 @@ cmdSnapshotCurrent(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, &domname)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, &domname)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "snapshotname", &snapshotname) < 0)
|
if (vshCommandOptString(ctl, cmd, "snapshotname", &snapshotname) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (snapshotname) {
|
if (snapshotname) {
|
||||||
@ -1616,7 +1616,7 @@ cmdSnapshotDumpXML(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (vshCommandOptBool(cmd, "security-info"))
|
if (vshCommandOptBool(cmd, "security-info"))
|
||||||
flags |= VIR_DOMAIN_XML_SECURE;
|
flags |= VIR_DOMAIN_XML_SECURE;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "snapshotname", &name) < 0)
|
if (vshCommandOptString(ctl, cmd, "snapshotname", &name) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
|
@ -87,7 +87,7 @@ virshCommandOptDomainBy(vshControl *ctl,
|
|||||||
const char *n = NULL;
|
const char *n = NULL;
|
||||||
const char *optname = "domain";
|
const char *optname = "domain";
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, optname, &n) < 0)
|
if (vshCommandOptString(ctl, cmd, optname, &n) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n",
|
vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n",
|
||||||
|
@ -92,11 +92,11 @@ virshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
|
|||||||
|
|
||||||
virCheckFlags(VIRSH_BYUUID | VIRSH_BYNAME, NULL);
|
virCheckFlags(VIRSH_BYUUID | VIRSH_BYNAME, NULL);
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, optname, &n) < 0)
|
if (vshCommandOptString(ctl, cmd, optname, &n) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (pooloptname != NULL &&
|
if (pooloptname != NULL &&
|
||||||
vshCommandOptStringReq(ctl, cmd, pooloptname, &p) < 0)
|
vshCommandOptString(ctl, cmd, pooloptname, &p) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (p) {
|
if (p) {
|
||||||
@ -249,10 +249,10 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(pool = virshCommandOptPool(ctl, cmd, "pool", NULL)))
|
if (!(pool = virshCommandOptPool(ctl, cmd, "pool", NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "name", &name) < 0)
|
if (vshCommandOptString(ctl, cmd, "name", &name) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "capacity", &capacityStr) < 0)
|
if (vshCommandOptString(ctl, cmd, "capacity", &capacityStr) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (virshVolSize(capacityStr, &capacity) < 0) {
|
if (virshVolSize(capacityStr, &capacity) < 0) {
|
||||||
@ -266,10 +266,9 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "format", &format) < 0 ||
|
if (vshCommandOptString(ctl, cmd, "format", &format) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "backing-vol", &snapshotStrVol) < 0 ||
|
vshCommandOptString(ctl, cmd, "backing-vol", &snapshotStrVol) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "backing-vol-format",
|
vshCommandOptString(ctl, cmd, "backing-vol-format", &snapshotStrFormat) < 0)
|
||||||
&snapshotStrFormat) < 0)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
virBufferAddLit(&buf, "<volume>\n");
|
virBufferAddLit(&buf, "<volume>\n");
|
||||||
@ -404,7 +403,7 @@ cmdVolCreate(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(pool = virshCommandOptPool(ctl, cmd, "pool", NULL)))
|
if (!(pool = virshCommandOptPool(ctl, cmd, "pool", NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0) {
|
if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0) {
|
||||||
@ -477,7 +476,7 @@ cmdVolCreateFrom(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (vshCommandOptBool(cmd, "validate"))
|
if (vshCommandOptBool(cmd, "validate"))
|
||||||
flags |= VIR_STORAGE_VOL_CREATE_VALIDATE;
|
flags |= VIR_STORAGE_VOL_CREATE_VALIDATE;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(inputvol = virshCommandOptVol(ctl, cmd, "vol", "inputpool", NULL)))
|
if (!(inputvol = virshCommandOptVol(ctl, cmd, "vol", "inputpool", NULL)))
|
||||||
@ -577,7 +576,7 @@ cmdVolClone(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "newname", &name) < 0)
|
if (vshCommandOptString(ctl, cmd, "newname", &name) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(origxml = virStorageVolGetXMLDesc(origvol, 0)))
|
if (!(origxml = virStorageVolGetXMLDesc(origvol, 0)))
|
||||||
@ -656,7 +655,7 @@ cmdVolUpload(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(vol = virshCommandOptVol(ctl, cmd, "vol", "pool", &name)))
|
if (!(vol = virshCommandOptVol(ctl, cmd, "vol", "pool", &name)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &file) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &file) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((fd = open(file, O_RDONLY)) < 0) {
|
if ((fd = open(file, O_RDONLY)) < 0) {
|
||||||
@ -768,7 +767,7 @@ cmdVolDownload(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(vol = virshCommandOptVol(ctl, cmd, "vol", "pool", &name)))
|
if (!(vol = virshCommandOptVol(ctl, cmd, "vol", "pool", &name)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "file", &file) < 0)
|
if (vshCommandOptString(ctl, cmd, "file", &file) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (vshCommandOptBool(cmd, "sparse"))
|
if (vshCommandOptBool(cmd, "sparse"))
|
||||||
@ -908,7 +907,7 @@ cmdVolWipe(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(vol = virshCommandOptVol(ctl, cmd, "vol", "pool", &name)))
|
if (!(vol = virshCommandOptVol(ctl, cmd, "vol", "pool", &name)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "algorithm", &algorithm_str) < 0)
|
if (vshCommandOptString(ctl, cmd, "algorithm", &algorithm_str) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (algorithm_str &&
|
if (algorithm_str &&
|
||||||
@ -1078,7 +1077,7 @@ cmdVolResize(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(vol = virshCommandOptVol(ctl, cmd, "vol", "pool", NULL)))
|
if (!(vol = virshCommandOptVol(ctl, cmd, "vol", "pool", NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "capacity", &capacityStr) < 0)
|
if (vshCommandOptString(ctl, cmd, "capacity", &capacityStr) < 0)
|
||||||
return false;
|
return false;
|
||||||
virSkipSpaces(&capacityStr);
|
virSkipSpaces(&capacityStr);
|
||||||
if (*capacityStr == '-') {
|
if (*capacityStr == '-') {
|
||||||
|
@ -269,7 +269,7 @@ cmdConnect(vshControl *ctl, const vshCmd *cmd)
|
|||||||
bool ro = vshCommandOptBool(cmd, "readonly");
|
bool ro = vshCommandOptBool(cmd, "readonly");
|
||||||
const char *name = NULL;
|
const char *name = NULL;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "name", &name) < 0)
|
if (vshCommandOptString(ctl, cmd, "name", &name) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (virshReconnect(ctl, name, ro, true) < 0)
|
if (virshReconnect(ctl, name, ro, true) < 0)
|
||||||
|
@ -273,7 +273,7 @@ cmdConnect(vshControl *ctl, const vshCmd *cmd)
|
|||||||
vshAdmControl *priv = ctl->privData;
|
vshAdmControl *priv = ctl->privData;
|
||||||
bool connected = priv->conn;
|
bool connected = priv->conn;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "name", &name) < 0)
|
if (vshCommandOptString(ctl, cmd, "name", &name) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
@ -379,7 +379,7 @@ cmdSrvThreadpoolInfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virAdmServerPtr srv = NULL;
|
virAdmServerPtr srv = NULL;
|
||||||
vshAdmControl *priv = ctl->privData;
|
vshAdmControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "server", &srvname) < 0)
|
if (vshCommandOptString(ctl, cmd, "server", &srvname) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(srv = virAdmConnectLookupServer(priv->conn, srvname, 0)))
|
if (!(srv = virAdmConnectLookupServer(priv->conn, srvname, 0)))
|
||||||
@ -454,7 +454,7 @@ cmdSrvThreadpoolSet(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virAdmServerPtr srv = NULL;
|
virAdmServerPtr srv = NULL;
|
||||||
vshAdmControl *priv = ctl->privData;
|
vshAdmControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "server", &srvname) < 0)
|
if (vshCommandOptString(ctl, cmd, "server", &srvname) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#define PARSE_CMD_TYPED_PARAM(NAME, FIELD) \
|
#define PARSE_CMD_TYPED_PARAM(NAME, FIELD) \
|
||||||
@ -545,7 +545,7 @@ cmdSrvClientsList(vshControl *ctl, const vshCmd *cmd)
|
|||||||
vshAdmControl *priv = ctl->privData;
|
vshAdmControl *priv = ctl->privData;
|
||||||
g_autoptr(vshTable) table = NULL;
|
g_autoptr(vshTable) table = NULL;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "server", &srvname) < 0)
|
if (vshCommandOptString(ctl, cmd, "server", &srvname) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(srv = virAdmConnectLookupServer(priv->conn, srvname, 0)))
|
if (!(srv = virAdmConnectLookupServer(priv->conn, srvname, 0)))
|
||||||
@ -638,7 +638,7 @@ cmdClientInfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (vshCommandOptULongLong(ctl, cmd, "client", &id) < 0)
|
if (vshCommandOptULongLong(ctl, cmd, "client", &id) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "server", &srvname) < 0)
|
if (vshCommandOptString(ctl, cmd, "server", &srvname) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(srv = virAdmConnectLookupServer(priv->conn, srvname, 0)) ||
|
if (!(srv = virAdmConnectLookupServer(priv->conn, srvname, 0)) ||
|
||||||
@ -714,7 +714,7 @@ cmdClientDisconnect(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virAdmClientPtr client = NULL;
|
virAdmClientPtr client = NULL;
|
||||||
vshAdmControl *priv = ctl->privData;
|
vshAdmControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "server", &srvname) < 0)
|
if (vshCommandOptString(ctl, cmd, "server", &srvname) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptULongLongWrap(ctl, cmd, "client", &id) < 0)
|
if (vshCommandOptULongLongWrap(ctl, cmd, "client", &id) < 0)
|
||||||
@ -772,7 +772,7 @@ cmdSrvClientsInfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virAdmServerPtr srv = NULL;
|
virAdmServerPtr srv = NULL;
|
||||||
vshAdmControl *priv = ctl->privData;
|
vshAdmControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "server", &srvname) < 0)
|
if (vshCommandOptString(ctl, cmd, "server", &srvname) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(srv = virAdmConnectLookupServer(priv->conn, srvname, 0)))
|
if (!(srv = virAdmConnectLookupServer(priv->conn, srvname, 0)))
|
||||||
@ -841,7 +841,7 @@ cmdSrvClientsSet(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virTypedParameterPtr params = NULL;
|
virTypedParameterPtr params = NULL;
|
||||||
vshAdmControl *priv = ctl->privData;
|
vshAdmControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "server", &srvname) < 0)
|
if (vshCommandOptString(ctl, cmd, "server", &srvname) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#define PARSE_CMD_TYPED_PARAM(NAME, FIELD) \
|
#define PARSE_CMD_TYPED_PARAM(NAME, FIELD) \
|
||||||
@ -925,7 +925,7 @@ cmdSrvUpdateTlsFiles(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virAdmServerPtr srv = NULL;
|
virAdmServerPtr srv = NULL;
|
||||||
vshAdmControl *priv = ctl->privData;
|
vshAdmControl *priv = ctl->privData;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "server", &srvname) < 0)
|
if (vshCommandOptString(ctl, cmd, "server", &srvname) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(srv = virAdmConnectLookupServer(priv->conn, srvname, 0)))
|
if (!(srv = virAdmConnectLookupServer(priv->conn, srvname, 0)))
|
||||||
@ -973,7 +973,7 @@ cmdDaemonLogFilters(vshControl *ctl, const vshCmd *cmd)
|
|||||||
|
|
||||||
if (vshCommandOptBool(cmd, "filters")) {
|
if (vshCommandOptBool(cmd, "filters")) {
|
||||||
const char *filters = NULL;
|
const char *filters = NULL;
|
||||||
if ((vshCommandOptStringReq(ctl, cmd, "filters", &filters) < 0 ||
|
if ((vshCommandOptString(ctl, cmd, "filters", &filters) < 0 ||
|
||||||
virAdmConnectSetLoggingFilters(priv->conn, filters, 0) < 0)) {
|
virAdmConnectSetLoggingFilters(priv->conn, filters, 0) < 0)) {
|
||||||
vshError(ctl, _("Unable to change daemon logging settings"));
|
vshError(ctl, _("Unable to change daemon logging settings"));
|
||||||
return false;
|
return false;
|
||||||
@ -1056,7 +1056,7 @@ cmdDaemonLogOutputs(vshControl *ctl, const vshCmd *cmd)
|
|||||||
|
|
||||||
if (vshCommandOptBool(cmd, "outputs")) {
|
if (vshCommandOptBool(cmd, "outputs")) {
|
||||||
const char *outputs = NULL;
|
const char *outputs = NULL;
|
||||||
if ((vshCommandOptStringReq(ctl, cmd, "outputs", &outputs) < 0 ||
|
if ((vshCommandOptString(ctl, cmd, "outputs", &outputs) < 0 ||
|
||||||
virAdmConnectSetLoggingOutputs(priv->conn, outputs, 0) < 0)) {
|
virAdmConnectSetLoggingOutputs(priv->conn, outputs, 0) < 0)) {
|
||||||
vshError(ctl, _("Unable to change daemon logging settings"));
|
vshError(ctl, _("Unable to change daemon logging settings"));
|
||||||
return false;
|
return false;
|
||||||
|
@ -1036,7 +1036,7 @@ vshCommandOptStringQuiet(vshControl *ctl G_GNUC_UNUSED, const vshCmd *cmd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* vshCommandOptStringReq:
|
* vshCommandOptString:
|
||||||
* @ctl virtshell control structure
|
* @ctl virtshell control structure
|
||||||
* @cmd command structure
|
* @cmd command structure
|
||||||
* @name option name
|
* @name option name
|
||||||
@ -1049,7 +1049,7 @@ vshCommandOptStringQuiet(vshControl *ctl G_GNUC_UNUSED, const vshCmd *cmd,
|
|||||||
* returned and error message printed.
|
* returned and error message printed.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
vshCommandOptStringReq(vshControl *ctl,
|
vshCommandOptString(vshControl *ctl,
|
||||||
const vshCmd *cmd,
|
const vshCmd *cmd,
|
||||||
const char *name,
|
const char *name,
|
||||||
const char **value)
|
const char **value)
|
||||||
|
@ -265,7 +265,7 @@ int vshCommandOptULWrap(vshControl *ctl, const vshCmd *cmd,
|
|||||||
int vshCommandOptStringQuiet(vshControl *ctl, const vshCmd *cmd,
|
int vshCommandOptStringQuiet(vshControl *ctl, const vshCmd *cmd,
|
||||||
const char *name, const char **value)
|
const char *name, const char **value)
|
||||||
ATTRIBUTE_NONNULL(4) G_GNUC_WARN_UNUSED_RESULT;
|
ATTRIBUTE_NONNULL(4) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
int vshCommandOptStringReq(vshControl *ctl, const vshCmd *cmd,
|
int vshCommandOptString(vshControl *ctl, const vshCmd *cmd,
|
||||||
const char *name, const char **value)
|
const char *name, const char **value)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
|
||||||
ATTRIBUTE_NONNULL(4) G_GNUC_WARN_UNUSED_RESULT;
|
ATTRIBUTE_NONNULL(4) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
Loading…
Reference in New Issue
Block a user