goto cleanup;
}
- if (vmwareParsePath(src, &directoryName, &fileName) < 0) {
+ if (vmwareParsePath(src, &directoryName, &fileName) < 0)
goto cleanup;
- }
if (!virFileHasSuffix(fileName, ".vmdk")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
vmwareSetSentinal(cmd, vmwareDriverTypeToString(driver->type));
vmwareSetSentinal(cmd, ((vmwareDomainPtr) vm->privateData)->vmxPath);
- if (virRun(cmd, NULL) < 0) {
+ if (virRun(cmd, NULL) < 0)
return -1;
- }
vm->def->id = -1;
virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, reason);
else
vmwareSetSentinal(cmd, NULL);
- if (virRun(cmd, NULL) < 0) {
+ if (virRun(cmd, NULL) < 0)
return -1;
- }
if ((vm->def->id = vmwareExtractPid(vmxPath)) < 0) {
vmwareStopVM(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED);
VIR_FREE(path);
- if (r >= 0) {
+ if (r >= 0)
return r;
- }
}
return -1;
/* Get active domains */
numdomains = xenUnifiedConnectNumOfDomains(conn);
- if (numdomains < 0) {
+ if (numdomains < 0)
return ret;
- }
if (numdomains > 0) {
if (VIR_ALLOC_N(ids, numdomains) < 0)
goto out;
- if ((numdomains = xenUnifiedConnectListDomains(conn, &ids[0], numdomains)) < 0) {
+ if ((numdomains = xenUnifiedConnectListDomains(conn, &ids[0], numdomains)) < 0)
goto out;
- }
}
/* Get pci bdf */
if (STREQLEN((const char *)®s.r_ebx, "AuthcAMDenti", 12)) {
if (pread(fd, ®s, sizeof(regs), 0x80000001) == sizeof(regs)) {
/* Read secure virtual machine bit (bit 2 of ECX feature ID) */
- if ((regs.r_ecx >> 2) & 1) {
+ if ((regs.r_ecx >> 2) & 1)
*hvm = "svm";
- }
if ((regs.r_edx >> 6) & 1)
*pae = 1;
}
else
op_sys.u.availheap.node = cell;
ret = xenHypervisorDoV2Sys(priv->handle, &op_sys);
- if (ret < 0) {
+ if (ret < 0)
return -1;
- }
if (hv_versions.sys_interface >= 5)
freeMems[i] = op_sys.u.availheap5.avail_bytes;
else
}
/* recoverable error, retry */
- if ((len == -1) && ((errno == EAGAIN) || (errno == EINTR))) {
+ if ((len == -1) && ((errno == EAGAIN) || (errno == EINTR)))
continue;
- }
/* eof */
- if (len == 0) {
+ if (len == 0)
break;
- }
/* unrecoverable error */
if (len == -1) {
struct sexpr *root;
root = sexpr_get(conn, "/xend/node/");
- if (root == NULL) {
+ if (root == NULL)
return -1;
- }
ret = sexpr_to_xend_topology(root, caps);
sexpr_free(root);
names = xenDaemonListDomainsOld(conn);
tmp = names;
- if (names == NULL) {
+ if (names == NULL)
return NULL;
- }
while (*tmp != NULL) {
id = xenDaemonDomainLookupByName_ids(conn, *tmp, &ident[0]);
if (id >= 0) {
ret = xenDaemonDomainCreateXML(conn, sexpr);
VIR_FREE(sexpr);
- if (ret != 0) {
+ if (ret != 0)
goto error;
- }
/* This comes before wait_for_devices, to ensure that latter
cleanup will destroy the domain upon failure */
*autostart = 0;
tmp = sexpr_node(root, "domain/on_xend_start");
- if (tmp && STREQ(tmp, "start")) {
+ if (tmp && STREQ(tmp, "start"))
*autostart = 1;
- }
sexpr_free(root);
return 0;
if (entry->refreshedAt != args->now) {
const char *olddomname = entry->def->name;
char *nameowner = (char *)virHashLookup(args->priv->nameConfigMap, olddomname);
- if (nameowner && STREQ(nameowner, key)) {
+ if (nameowner && STREQ(nameowner, key))
virHashRemoveEntry(args->priv->nameConfigMap, olddomname);
- }
return 1;
}
return 0;
/* If we currently own the name, then release it and
re-acquire it later - just in case it was renamed */
nameowner = (char *)virHashLookup(priv->nameConfigMap, entry->def->name);
- if (nameowner && STREQ(nameowner, filename)) {
+ if (nameowner && STREQ(nameowner, filename))
virHashRemoveEntry(priv->nameConfigMap, entry->def->name);
- }
/* Clear existing config entry which needs refresh */
virDomainDefFree(entry->def);
}
defPtr->maxvcpus = defPtr->vcpus = xenapiDomainGetMaxVcpus(dom);
enum xen_on_normal_exit action;
- if (xen_vm_get_actions_after_shutdown(session, &action, vm)) {
+ if (xen_vm_get_actions_after_shutdown(session, &action, vm))
defPtr->onPoweroff = xenapiNormalExitEnum2virDomainLifecycle(action);
- }
- if (xen_vm_get_actions_after_reboot(session, &action, vm)) {
+ if (xen_vm_get_actions_after_reboot(session, &action, vm))
defPtr->onReboot = xenapiNormalExitEnum2virDomainLifecycle(action);
- }
enum xen_on_crash_behaviour crash;
- if (xen_vm_get_actions_after_crash(session, &crash, vm)) {
+ if (xen_vm_get_actions_after_crash(session, &crash, vm))
defPtr->onCrash = xenapiCrashExitEnum2virDomainLifecycle(action);
- }
xen_vm_get_platform(session, &result, vm);
if (result != NULL) {
size_t i;
fflush(stdout);
#endif
CURL *curl = curl_easy_init();
- if (!curl) {
+ if (!curl)
return -1;
- }
xen_comms comms = {
.func = result_func,
.handle = result_handle
cred.result = NULL;
cred.resultlen = 0;
- if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) {
+ if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0)
VIR_FREE(cred.result);
- }
break;
}
for (i = 0; i < uri->paramsCount; i++) {
virURIParamPtr queryParam = &uri->params[i];
if (STRCASEEQ(queryParam->name, "no_verify")) {
- if (noVerify == NULL) {
+ if (noVerify == NULL)
continue;
- }
if (virStrToLong_i(queryParam->value, NULL, 10, noVerify) < 0 ||
(*noVerify != 0 && *noVerify != 1)) {
xenapiSessionErrorHandler(conn, VIR_ERR_INVALID_ARG,
size_t i, j;
for (i = 0; i < maplen; i++) {
for (j = 0; j < 8; j++) {
- if (cpumap[i] & (1 << j)) {
+ if (cpumap[i] & (1 << j))
virBufferAsprintf(&buf, "%zu,", (8*i)+j);
- }
}
}
if (virBufferCheckError(&buf) < 0)
!(chr = xenParseSxprChar(str, NULL)))
goto cleanup;
if (chr) {
- if (VIR_ALLOC_N(def->parallels, 1) < 0) {
+ if (VIR_ALLOC_N(def->parallels, 1) < 0)
goto cleanup;
- }
chr->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL;
chr->target.port = 0;
goto cleanup;
chr->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
chr->target.port = portnum;
- if (VIR_APPEND_ELEMENT(def->serials, def->nserials, chr) < 0) {
+ if (VIR_APPEND_ELEMENT(def->serials, def->nserials, chr) < 0)
goto cleanup;
- }
value = value->next;
}
if (def->model != NULL && STREQ(def->model, "netfront")) {
virBufferAddLit(buf, "(type netfront)");
} else {
- if (def->model != NULL) {
+ if (def->model != NULL)
virBufferEscapeSexpr(buf, "(model '%s')", def->model);
- }
/*
* apparently (type ioemu) breaks paravirt drivers on HVM so skip
* this from XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU
*/
- if (xendConfigVersion <= XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU) {
+ if (xendConfigVersion <= XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU)
virBufferAddLit(buf, "(type ioemu)");
- }
}
}