static bool
cmdBlockjob(vshControl *ctl, const vshCmd *cmd)
{
- bool ret = false;
bool raw = vshCommandOptBool(cmd, "raw");
bool bytes = vshCommandOptBool(cmd, "bytes");
bool abortMode = vshCommandOptBool(cmd, "abort");
return false;
if (bandwidth)
- ret = virshBlockJobSetSpeed(ctl, cmd, dom, path, bytes);
- else if (abortMode || pivot || async)
- ret = virshBlockJobAbort(dom, path, pivot, async);
- else
- ret = virshBlockJobInfo(ctl, dom, path, raw, bytes);
-
- return ret;
+ return virshBlockJobSetSpeed(ctl, cmd, dom, path, bytes);
+ if (abortMode || pivot || async)
+ return virshBlockJobAbort(dom, path, pivot, async);
+ return virshBlockJobInfo(ctl, dom, path, raw, bytes);
}
/*
const char *field, const char *value)
{
virTypedParameterPtr param;
- int ret = -1;
size_t i;
for (i = 0; i < nsrc_params; i++) {
vshSaveLibvirtError();
return -1;
}
- ret = 0;
- break;
+ return 0;
}
- if (ret < 0)
- vshError(ctl, _("invalid scheduler option: %s"), field);
-
- return ret;
+ vshError(ctl, _("invalid scheduler option: %s"), field);
+ return -1;
}
static int
g_autoptr(GDateTime) now = g_date_time_new_now_local();
g_autofree char *nowstr = NULL;
const char *ext = NULL;
- char *ret = NULL;
if (!dom) {
vshError(ctl, "%s", _("Invalid domain supplied"));
nowstr = g_date_time_format(now, "%Y-%m-%d-%H:%M:%S");
- ret = g_strdup_printf("%s-%s%s", virDomainGetName(dom),
- nowstr, NULLSTR_EMPTY(ext));
-
- return ret;
+ return g_strdup_printf("%s-%s%s", virDomainGetName(dom),
+ nowstr, NULLSTR_EMPTY(ext));
}
static bool
cmdSetLifecycleAction(vshControl *ctl, const vshCmd *cmd)
{
g_autoptr(virshDomain) dom = NULL;
- bool ret = true;
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
bool current = vshCommandOptBool(cmd, "current");
if (virDomainSetLifecycleAction(dom, type, action, flags) < 0) {
vshError(ctl, "%s", _("Unable to change lifecycle action."));
- ret = false;
+ return false;
}
-
- return ret;
+ return true;
}
/*
cmdDomjobabort(vshControl *ctl, const vshCmd *cmd)
{
g_autoptr(virshDomain) dom = NULL;
- bool ret = true;
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
return false;
if (virDomainAbortJob(dom) < 0)
- ret = false;
+ return false;
- return ret;
+ return true;
}
/*
xmlNodePtr cur = NULL, matchNode = NULL;
g_autofree char *detach_xml = NULL;
char buf[64];
- int diff_mac, ret = -1;
+ int diff_mac = -1;
size_t i;
if (!(xml = virXMLParseStringCtxt(doc, _("(domain_definition)"), &ctxt))) {
vshError(ctl, "%s", _("Failed to get interface information"));
- goto cleanup;
+ return false;
}
g_snprintf(buf, sizeof(buf), "/domain/devices/interface[@type='%s']", type);
if (obj == NULL || obj->type != XPATH_NODESET ||
obj->nodesetval == NULL || obj->nodesetval->nodeNr == 0) {
vshError(ctl, _("No interface found whose type is %s"), type);
- goto cleanup;
+ return false;
}
if (!mac && obj->nodesetval->nodeNr > 1) {
vshError(ctl, _("Domain has %d interfaces. Please specify which one "
"to detach using --mac"), obj->nodesetval->nodeNr);
- goto cleanup;
+ return false;
}
if (!mac) {
"MAC address %s. You must use detach-device and "
"specify the device pci address to remove it."),
mac);
- goto cleanup;
+ return false;
}
matchNode = obj->nodesetval->nodeTab[i];
}
}
if (!matchNode) {
vshError(ctl, _("No interface with MAC address %s was found"), mac);
- goto cleanup;
+ return false;
}
hit:
if (!(detach_xml = virXMLNodeToString(xml, matchNode))) {
vshSaveLibvirtError();
- goto cleanup;
+ return false;
}
if (flags != 0 || current)
- ret = virDomainDetachDeviceFlags(dom, detach_xml, flags);
- else
- ret = virDomainDetachDevice(dom, detach_xml);
-
- cleanup:
- return ret == 0;
+ return virDomainDetachDeviceFlags(dom, detach_xml, flags) == 0;
+ return virDomainDetachDevice(dom, detach_xml) == 0;
}