}
VIR_FREE(ctl->name);
- if (vshCommandOptString(cmd, "name", &name) <= 0)
+ if (vshCommandOptString(cmd, "name", &name) < 0) {
+ vshError(ctl, "%s", _("Please specify valid connection URI"));
return FALSE;
+ }
ctl->name = vshStrdup(ctl, name);
if (!ro) {
cmdConsole(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
- int ret;
+ int ret = FALSE;
const char *name = NULL;
if (!vshConnectionUsability(ctl, ctl->conn))
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return FALSE;
- if (vshCommandOptString(cmd, "devname", &name) < 0)
- return FALSE;
+ if (vshCommandOptString(cmd, "devname", &name) < 0) {
+ vshError(ctl, "%s", _("Invalid devname"));
+ goto cleanup;
+ }
ret = cmdRunConsole(ctl, dom, name);
+cleanup:
virDomainFree(dom);
return ret;
}
const char *type = NULL;
int vcpus;
- if (vshCommandOptString(cmd, "type", &type) < 0)
+ if (vshCommandOptString(cmd, "type", &type) < 0) {
+ vshError(ctl, "%s", _("Invalid type"));
return FALSE;
+ }
if (!vshConnectionUsability(ctl, ctl->conn))
return FALSE;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return FALSE;
- if (vshCommandOptInt(cmd, "count", &count) < 0)
- return FALSE;
+ if (vshCommandOptInt(cmd, "count", &count) < 0) {
+ vshError(ctl, "%s", _("Invalid number of virtual CPUs"));
+ goto cleanup;
+ }
if (!flags) {
if (virDomainSetVcpus(dom, count) != 0) {
if (vshCommandOptString(cmd, "desturi", &desturi) <= 0 ||
vshCommandOptString(cmd, "migrateuri", &migrateuri) < 0 ||
- vshCommandOptString(cmd, "dname", &dname) < 0)
+ vshCommandOptString(cmd, "dname", &dname) < 0) {
+ vshError(ctl, "%s", _("missing argument"));
goto out;
+ }
if (vshCommandOptBool (cmd, "live"))
flags |= VIR_MIGRATE_LIVE;
vshCommandOptString(cmd, "source-dev", &srcDev) < 0 ||
vshCommandOptString(cmd, "source-name", &srcName) < 0 ||
vshCommandOptString(cmd, "source-format", &srcFormat) < 0 ||
- vshCommandOptString(cmd, "target", &target) < 0)
+ vshCommandOptString(cmd, "target", &target) < 0) {
+ vshError(NULL, "%s", _("missing argument"));
goto cleanup;
+ }
virBufferVSprintf(&buf, "<pool type='%s'>\n", type);
virBufferVSprintf(&buf, " <name>%s</name>\n", name);
if (vshCommandOptString(cmd, "type", &type) <= 0 ||
vshCommandOptString(cmd, "host", &host) < 0 ||
- vshCommandOptString(cmd, "initiator", &initiator) < 0)
+ vshCommandOptString(cmd, "initiator", &initiator) < 0) {
+ vshError(ctl,"%s", _("missing argument"));
return FALSE;
+ }
if (!vshConnectionUsability(ctl, ctl->conn))
return FALSE;
if (vshCommandOptString(cmd, "type", &type) <= 0)
return FALSE;
- if (vshCommandOptString(cmd, "srcSpec", &srcSpecFile) < 0)
+ if (vshCommandOptString(cmd, "srcSpec", &srcSpecFile) < 0) {
+ vshError(ctl, "%s", _("missing option"));
return FALSE;
+ }
if (!vshConnectionUsability(ctl, ctl->conn))
return FALSE;
vshCommandOptString(cmd, "target", &target) < 0 ||
vshCommandOptString(cmd, "mac", &mac) < 0 ||
vshCommandOptString(cmd, "script", &script) < 0 ||
- vshCommandOptString(cmd, "model", &model) < 0)
+ vshCommandOptString(cmd, "model", &model) < 0) {
+ vshError(ctl, "missing argument");
goto cleanup;
+ }
/* check interface type */
if (STREQ(type, "network")) {
if (vshCommandOptString(cmd, "type", &type) <= 0)
goto cleanup;
- if (vshCommandOptString(cmd, "mac", &mac) < 0)
+ if (vshCommandOptString(cmd, "mac", &mac) < 0) {
+ vshError(ctl, "%s", _("missing option"));
goto cleanup;
+ }
doc = virDomainGetXMLDesc(dom, 0);
if (!doc)
vshCommandOptString(cmd, "type", &type) < 0 ||
vshCommandOptString(cmd, "mode", &mode) < 0 ||
vshCommandOptString(cmd, "sourcetype", &stype) < 0) {
+ vshError(ctl, "%s", _("missing option"));
goto cleanup;
}
if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL;
- if (vshCommandOptString(cmd, pooloptname, &p) < 0)
+ if (vshCommandOptString(cmd, pooloptname, &p) < 0) {
+ vshError(ctl, "%s", _("missing option"));
return NULL;
+ }
if (p)
pool = vshCommandOptPoolBy(ctl, cmd, pooloptname, name, flag);