con->terminalToStream.offset,
avail);
if (got < 0) {
- if (errno != EAGAIN) {
+ if (errno != EAGAIN)
virConsoleShutdown(con);
- }
return;
}
if (got == 0) {
con->streamToTerminal.data,
con->streamToTerminal.offset);
if (done < 0) {
- if (errno != EAGAIN) {
+ if (errno != EAGAIN)
virConsoleShutdown(con);
- }
return;
}
memmove(con->streamToTerminal.data,
if ((ret = virNodeGetCPUMap(conn, NULL, NULL, 0)) < 0) {
/* fall back to nodeinfo */
vshResetLibvirtError();
- if (virNodeGetInfo(conn, &nodeinfo) == 0) {
+ if (virNodeGetInfo(conn, &nodeinfo) == 0)
ret = VIR_NODEINFO_MAXCPUS(nodeinfo);
- }
}
return ret;
}
flags |= VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA;
snapshots_safe = true;
}
- if (nvram) {
+ if (nvram)
flags |= VIR_DOMAIN_UNDEFINE_NVRAM;
- }
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
flags &= ~VIR_DOMAIN_UNDEFINE_MANAGED_SAVE;
managed_save_safe = true;
}
- if (has_snapshots == 0) {
+ if (has_snapshots == 0)
snapshots_safe = true;
- }
if (has_snapshots_metadata == 0) {
flags &= ~VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA;
snapshots_safe = true;
int cpu, lastcpu;
bool bit, lastbit, isInvert;
- if (!cpumaps || cpumaplen <= 0 || maxcpu <= 0 || vcpuindex < 0) {
+ if (!cpumaps || cpumaplen <= 0 || maxcpu <= 0 || vcpuindex < 0)
return false;
- }
bit = lastbit = isInvert = false;
lastcpu = -1;
vshPrint(ctl, "-%d", cpu - 1);
lastbit = bit;
}
- if (bit && !isInvert) {
+ if (bit && !isInvert)
vshPrint(ctl, "-%d", maxcpu - 1);
- }
return true;
}
goto cleanup;
}
- if ((maxcpu = vshNodeGetCPUCount(ctl->conn)) < 0) {
+ if ((maxcpu = vshNodeGetCPUCount(ctl->conn)) < 0)
goto cleanup;
- }
cpumaplen = VIR_CPU_MAPLEN(maxcpu);
kibibytes = VIR_DIV_UP(bytes, 1024);
if (flags == -1) {
- if (virDomainSetMemory(dom, kibibytes) != 0) {
+ if (virDomainSetMemory(dom, kibibytes) != 0)
ret = false;
- }
} else {
- if (virDomainSetMemoryFlags(dom, kibibytes, flags) < 0) {
+ if (virDomainSetMemoryFlags(dom, kibibytes, flags) < 0)
ret = false;
- }
}
virDomainFree(dom);
if (vshCommandOptBool(cmd, "rdma-pin-all"))
flags |= VIR_MIGRATE_RDMA_PIN_ALL;
- if (vshCommandOptBool(cmd, "offline")) {
+ if (vshCommandOptBool(cmd, "offline"))
flags |= VIR_MIGRATE_OFFLINE;
- }
if (vshCommandOptBool(cmd, "abort-on-error"))
flags |= VIR_MIGRATE_ABORT_ON_ERROR;
goto edit_cleanup;
/* Compare original XML with edited. Has it changed at all? */
- if (STREQ(doc, doc_edited)) {
+ if (STREQ(doc, doc_edited))
EDIT_NOT_CHANGED;
- }
redefine:
msg = NULL;
}
/* Everything checks out, so redefine the object. */
- if (!msg && !(EDIT_DEFINE)) {
+ if (!msg && !(EDIT_DEFINE))
msg = _("Failed.");
- }
if (msg) {
int c = vshAskReedit(ctl, msg);
goto cleanup;
vshPrint(ctl, _("Node %d:\n"), cell);
- for (j = 0; j < npages; j++) {
+ for (j = 0; j < npages; j++)
vshPrint(ctl, "%uKiB: %lld\n", pagesize[j], counts[j]);
- }
vshPrint(ctl, "%c", '\n');
}
if (!(pool = vshCommandOptPool(ctl, cmd, "pool", &name)))
return false;
- if (vshCommandOptBool(cmd, "no-overwrite")) {
+ if (vshCommandOptBool(cmd, "no-overwrite"))
flags |= VIR_STORAGE_POOL_BUILD_NO_OVERWRITE;
- }
- if (vshCommandOptBool(cmd, "overwrite")) {
+ if (vshCommandOptBool(cmd, "overwrite"))
flags |= VIR_STORAGE_POOL_BUILD_OVERWRITE;
- }
if (virStoragePoolBuild(pool, flags) == 0) {
vshPrint(ctl, _("Pool %s built\n"), name);
return false;
}
- if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", &name))) {
+ if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", &name)))
return false;
- }
if (vshCommandOptStringReq(ctl, cmd, "file", &file) < 0)
goto cleanup;
bool ret = true;
const char *name;
- if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", &name))) {
+ if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", &name)))
return false;
- }
if (virStorageVolDelete(vol, 0) == 0) {
vshPrint(ctl, _("Vol %s deleted\n"), name);
int algorithm = VIR_STORAGE_VOL_WIPE_ALG_ZERO;
int funcRet;
- if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", &name))) {
+ if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", &name)))
return false;
- }
if (vshCommandOptStringReq(ctl, cmd, "algorithm", &algorithm_str) < 0)
goto out;
virStorageVolPtr vol;
char * StorageVolPath;
- if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", NULL))) {
+ if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", NULL)))
return false;
- }
if ((StorageVolPath = virStorageVolGetPath(vol)) == NULL) {
virStorageVolFree(vol);
char *key;
va_start(ap, ctl);
- while ((key = va_arg(ap, char *)) != NULL) {
+ while ((key = va_arg(ap, char *)) != NULL)
vshPrint(ctl, "%s\r\n", key);
- }
va_end(ap);
}
return false;
}
- if (vshCommandOptString(cmd, "dir", &dir) <= 0) {
+ if (vshCommandOptString(cmd, "dir", &dir) <= 0)
dir = dir_malloced = virGetUserDirectory();
- }
if (!dir)
dir = "/";
const vshCmdOptDef *ret = NULL;
char *alias = NULL;
- if (STREQ(name, helpopt.name)) {
+ if (STREQ(name, helpopt.name))
return &helpopt;
- }
for (i = 0; cmd->opts && cmd->opts[i].name; i++) {
const vshCmdOptDef *opt = &cmd->opts[i];
if (ret <= 0)
return ret;
- if (!*arg->data && !(arg->def->flags & VSH_OFLAG_EMPTY_OK)) {
+ if (!*arg->data && !(arg->def->flags & VSH_OFLAG_EMPTY_OK))
return -1;
- }
*value = arg->data;
return 1;
}
opt = opt ? opt->next : cmd->opts;
while (opt) {
- if (opt->def->type == VSH_OT_ARGV) {
+ if (opt->def->type == VSH_OT_ARGV)
return opt;
- }
opt = opt->next;
}
return NULL;
else
progname++;
- if ((defaultConn = virGetEnvBlockSUID("VIRSH_DEFAULT_CONNECT_URI"))) {
+ if ((defaultConn = virGetEnvBlockSUID("VIRSH_DEFAULT_CONNECT_URI")))
ctl->name = vshStrdup(ctl, defaultConn);
- }
vshInitDebug(ctl);
first = pds[0].proc;
last = pds[length-1].proc;
- if (proc < first || proc > last) {
+ if (proc < first || proc > last)
return NULL;
- }
pd = &pds[proc-first];
/* There is no guarantee to proc numbers has no gap */
xdr_destroy(&xdrs);
g_free(payload_data);
- if (nfds != 0) {
+ if (nfds != 0)
dissect_libvirt_fds(tvb, start + payload_length, nfds);
- }
}
static void