if (STREQ(src->path, dest->path)) {
found = true;
- if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT))
+ if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT)) {
dest->weight = src->weight;
- else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS))
+ } else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS)) {
dest->riops = src->riops;
- else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS))
+ } else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS)) {
dest->wiops = src->wiops;
- else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_READ_BPS))
+ } else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_READ_BPS)) {
dest->rbps = src->rbps;
- else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS))
+ } else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS)) {
dest->wbps = src->wbps;
- else {
+ } else {
virReportError(VIR_ERR_INVALID_ARG, _("Unknown parameter %s"),
type);
return -1;
return -1;
dest = &(*dest_array)[*dest_size - 1];
- if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT))
+ if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT)) {
dest->weight = src->weight;
- else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS))
+ } else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS)) {
dest->riops = src->riops;
- else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS))
+ } else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS)) {
dest->wiops = src->wiops;
- else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_READ_BPS))
+ } else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_READ_BPS)) {
dest->rbps = src->rbps;
- else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS))
+ } else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS)) {
dest->wbps = src->wbps;
- else {
+ } else {
*dest_size = *dest_size - 1;
return -1;
}
/*
+ * Copyright (C) 2014 Red Hat, Inc.
* Copyright (C) 2012 Fujitsu Limited.
*
* lxc_fuse.c: fuse filesystem support for libvirt lxc
stbuf->st_atime = sb.st_atime;
stbuf->st_ctime = sb.st_ctime;
stbuf->st_mtime = sb.st_mtime;
- } else
+ } else {
res = -ENOENT;
+ }
cleanup:
VIR_FREE(mempath);
*ptr = '\0';
if (STREQ(line, "MemTotal") &&
- (def->mem.hard_limit || def->mem.max_balloon))
+ (def->mem.hard_limit || def->mem.max_balloon)) {
virBufferAsprintf(new_meminfo, "MemTotal: %8llu kB\n",
meminfo.memtotal);
- else if (STREQ(line, "MemFree") &&
- (def->mem.hard_limit || def->mem.max_balloon))
+ } else if (STREQ(line, "MemFree") &&
+ (def->mem.hard_limit || def->mem.max_balloon)) {
virBufferAsprintf(new_meminfo, "MemFree: %8llu kB\n",
(meminfo.memtotal - meminfo.memusage));
- else if (STREQ(line, "Buffers"))
+ } else if (STREQ(line, "Buffers")) {
virBufferAsprintf(new_meminfo, "Buffers: %8d kB\n", 0);
- else if (STREQ(line, "Cached"))
+ } else if (STREQ(line, "Cached")) {
virBufferAsprintf(new_meminfo, "Cached: %8llu kB\n",
meminfo.cached);
- else if (STREQ(line, "Active"))
+ } else if (STREQ(line, "Active")) {
virBufferAsprintf(new_meminfo, "Active: %8llu kB\n",
(meminfo.active_anon + meminfo.active_file));
- else if (STREQ(line, "Inactive"))
+ } else if (STREQ(line, "Inactive")) {
virBufferAsprintf(new_meminfo, "Inactive: %8llu kB\n",
(meminfo.inactive_anon + meminfo.inactive_file));
- else if (STREQ(line, "Active(anon)"))
+ } else if (STREQ(line, "Active(anon)")) {
virBufferAsprintf(new_meminfo, "Active(anon): %8llu kB\n",
meminfo.active_anon);
- else if (STREQ(line, "Inactive(anon)"))
+ } else if (STREQ(line, "Inactive(anon)")) {
virBufferAsprintf(new_meminfo, "Inactive(anon): %8llu kB\n",
meminfo.inactive_anon);
- else if (STREQ(line, "Active(file)"))
+ } else if (STREQ(line, "Active(file)")) {
virBufferAsprintf(new_meminfo, "Active(file): %8llu kB\n",
meminfo.active_file);
- else if (STREQ(line, "Inactive(file)"))
+ } else if (STREQ(line, "Inactive(file)")) {
virBufferAsprintf(new_meminfo, "Inactive(file): %8llu kB\n",
meminfo.inactive_file);
- else if (STREQ(line, "Unevictable"))
+ } else if (STREQ(line, "Unevictable")) {
virBufferAsprintf(new_meminfo, "Unevictable: %8llu kB\n",
meminfo.unevictable);
- else if (STREQ(line, "SwapTotal") && def->mem.swap_hard_limit)
+ } else if (STREQ(line, "SwapTotal") && def->mem.swap_hard_limit) {
virBufferAsprintf(new_meminfo, "SwapTotal: %8llu kB\n",
(meminfo.swaptotal - meminfo.memtotal));
- else if (STREQ(line, "SwapFree") && def->mem.swap_hard_limit)
+ } else if (STREQ(line, "SwapFree") && def->mem.swap_hard_limit) {
virBufferAsprintf(new_meminfo, "SwapFree: %8llu kB\n",
(meminfo.swaptotal - meminfo.memtotal -
meminfo.swapusage + meminfo.memusage));
- else {
+ } else {
*ptr = ':';
virBufferAdd(new_meminfo, line, -1);
}
const char *state;
virBuffer buf = VIR_BUFFER_INITIALIZER;
- if (type == 0)
+ if (type == 0) {
state = "|grep Running";
- else if (type == 1) {
+ } else if (type == 1) {
if (system_type == HMC) {
state = "|grep \"Not Activated\"";
} else {
state = "|grep \"Open Firmware\"";
}
- } else
+ } else {
state = " ";
+ }
virBufferAddLit(&buf, "lssyscfg -r lpar");
if (system_type == HMC)
VIR_WARN("Unable to generate UUID for domain %d",
ids[i]);
}
- } else
+ } else {
goto cleanup;
+ }
if (phypUUIDTable_WriteFile(conn) == -1)
goto cleanup;
virReportError(VIR_ERR_AUTH_FAILED,
"%s", _("Authentication failed"));
goto disconnect;
- } else
+ } else {
goto exit;
+ }
} else if (rc == LIBSSH2_ERROR_NONE) {
goto exit;
goto cleanup;
}
- if (vol->name != NULL)
+ if (vol->name != NULL) {
voldef.name = vol->name;
- else {
+ } else {
VIR_ERROR(_("Unable to determine storage pool's name."));
goto cleanup;
}
ret = phypExecBuffer(session, &buf, &exit_status, conn, false);
/* I need to parse the textual return in order to get the volumes */
- if (exit_status < 0 || ret == NULL)
+ if (exit_status < 0 || ret == NULL) {
goto cleanup;
- else {
+ } else {
volumes_list = ret;
while (got < nvolumes) {
goto cleanup;
char_ptr++;
volumes_list = char_ptr;
- } else
+ } else {
break;
+ }
}
}
ret = phypExecBuffer(session, &buf, &exit_status, conn, false);
/* I need to parse the textual return in order to get the storage pools */
- if (exit_status < 0 || ret == NULL)
+ if (exit_status < 0 || ret == NULL) {
goto cleanup;
- else {
+ } else {
storage_pools = ret;
while (got < npools) {
goto cleanup;
char_ptr++;
storage_pools = char_ptr;
- } else
+ } else {
break;
+ }
}
}
virStoragePoolDef def;
memset(&def, 0, sizeof(virStoragePoolDef));
- if (pool->name != NULL)
+ if (pool->name != NULL) {
def.name = pool->name;
- else {
+ } else {
VIR_ERROR(_("Unable to determine storage pool's name."));
goto err;
}
ret = phypExecBuffer(session, &buf, &exit_status, conn, false);
/* I need to parse the textual return in order to get the domains */
- if (exit_status < 0 || ret == NULL)
+ if (exit_status < 0 || ret == NULL) {
goto cleanup;
- else {
+ } else {
domains = ret;
while (got < nnames) {
goto cleanup;
char_ptr++;
domains = char_ptr;
- } else
+ } else {
break;
+ }
}
}
} else if (ncpus < nvcpus) {
operation = 'a';
amount = nvcpus - ncpus;
- } else
+ } else {
return 0;
+ }
virBufferAddLit(&buf, "chhwres -r proc");
if (system_type == HMC)
if (def->sounds[0]->model == VIR_DOMAIN_SOUND_MODEL_SB16) {
gVBoxAPI.UIAudioAdapter.SetAudioController(audioAdapter,
AudioControllerType_SB16);
- } else
- if (def->sounds[0]->model == VIR_DOMAIN_SOUND_MODEL_AC97) {
+ } else if (def->sounds[0]->model == VIR_DOMAIN_SOUND_MODEL_AC97) {
gVBoxAPI.UIAudioAdapter.SetAudioController(audioAdapter,
AudioControllerType_AC97);
}
}
def->ngraphics++;
- } else
+ } else {
virReportOOMError();
+ }
}
VBOX_RELEASE(VRDxServer);
}
ret = vboxDomainCreate(dom);
if (!ret)
gVBoxAPI.snapshotRestore(dom, machine, prevSnapshot);
- } else
+ } else {
ret = 0;
+ }
cleanup:
VBOX_RELEASE(prevSnapshot);
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot delete metadata of a snapshot with children"));
goto cleanup;
- } else
- if (gVBoxAPI.vboxSnapshotRedefine) {
+ } else if (gVBoxAPI.vboxSnapshotRedefine) {
ret = vboxDomainSnapshotDeleteMetadataOnly(snapshot);
}
goto cleanup;
#else /* VBOX_API_VERSION >= 4000000 */
def.target.capacity = hddLogicalSize;
#endif /* VBOX_API_VERSION >= 4000000 */
- } else
+ } else {
defOk = 0;
+ }
rc = VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetSize, &hddActualSize);
if (NS_SUCCEEDED(rc) && defOk)