return 0;
if (openvzExtractVersionInfo(VZCTL, &driver->version) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not extract vzctl version"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not extract vzctl version"));
return -1;
}
*/
ret = openvzReadVPSConfigParam(veid, "IP_ADDRESS", &temp);
if (ret < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not read 'IP_ADDRESS' from config for container %d"),
- veid);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not read 'IP_ADDRESS' from config for container %d"),
+ veid);
goto error;
} else if (ret > 0) {
token = strtok_r(temp, " ", &saveptr);
*/
ret = openvzReadVPSConfigParam(veid, "NETIF", &temp);
if (ret < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not read 'NETIF' from config for container %d"),
- veid);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not read 'NETIF' from config for container %d"),
+ veid);
goto error;
} else if (ret > 0) {
token = strtok_r(temp, ";", &saveptr);
p += 12;
len = next - p;
if (len > 16) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Too long network device name"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Too long network device name"));
goto error;
}
goto no_memory;
if (virStrncpy(net->ifname, p, len, len+1) == NULL) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Network ifname %s too long for destination"), p);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Network ifname %s too long for destination"), p);
goto error;
}
} else if (STRPREFIX(p, "bridge=")) {
p += 7;
len = next - p;
if (len > 16) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Too long bridge device name"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Too long bridge device name"));
goto error;
}
goto no_memory;
if (virStrncpy(net->data.bridge.brname, p, len, len+1) == NULL) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Bridge name %s too long for destination"), p);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Bridge name %s too long for destination"), p);
goto error;
}
} else if (STRPREFIX(p, "mac=")) {
p += 4;
len = next - p;
if (len != 17) { /* should be 17 */
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Wrong length MAC address"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Wrong length MAC address"));
goto error;
}
if (virStrncpy(cpy_temp, p, len, sizeof(cpy_temp)) == NULL) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("MAC address %s too long for destination"), p);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("MAC address %s too long for destination"), p);
goto error;
}
if (virMacAddrParse(cpy_temp, &net->mac) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Wrong MAC address"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Wrong MAC address"));
goto error;
}
}
ret = openvzReadVPSConfigParam(veid, "OSTEMPLATE", &temp);
if (ret < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not read 'OSTEMPLATE' from config for container %d"),
- veid);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not read 'OSTEMPLATE' from config for container %d"),
+ veid);
goto error;
} else if (ret > 0) {
if (VIR_ALLOC(fs) < 0)
/* OSTEMPLATE was not found, VE was booted from a private dir directly */
ret = openvzReadVPSConfigParam(veid, "VE_PRIVATE", &temp);
if (ret <= 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not read 'VE_PRIVATE' from config for container %d"),
- veid);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not read 'VE_PRIVATE' from config for container %d"),
+ veid);
goto error;
}
ret = openvzReadVPSConfigParam(veid, param, &temp);
if (ret > 0) {
if (openvzParseBarrierLimit(temp, &barrier, &limit)) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not read '%s' from config for container %d"),
- param, veid);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not read '%s' from config for container %d"),
+ param, veid);
goto error;
} else {
/* Ensure that we can multiply by 1024 without overflowing. */
param = "VMGUARPAGES";
ret = openvzReadVPSConfigParam(veid, param, &temp);
if (ret < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not read '%s' from config for container %d"),
- param, veid);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not read '%s' from config for container %d"),
+ param, veid);
goto error;
} else if (ret > 0) {
ret = openvzParseBarrierLimit(temp, &barrier, NULL);
if (ret < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not parse barrier of '%s' "
- "from config for container %d"), param, veid);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not parse barrier of '%s' "
+ "from config for container %d"), param, veid);
goto error;
}
if (barrier == LONG_MAX)
param = "PRIVVMPAGES";
ret = openvzReadVPSConfigParam(veid, param, &temp);
if (ret < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not read '%s' from config for container %d"),
- param, veid);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not read '%s' from config for container %d"),
+ param, veid);
goto error;
} else if (ret > 0) {
ret = openvzParseBarrierLimit(temp, &barrier, &limit);
if (ret < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not parse barrier and limit of '%s' "
- "from config for container %d"), param, veid);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not parse barrier and limit of '%s' "
+ "from config for container %d"), param, veid);
goto error;
}
if (barrier == LONG_MAX)
if (virStrToLong_i(line, &status, 10, &veid) < 0 ||
*status++ != ' ' ||
(line = strchr(status, '\n')) == NULL) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Failed to parse vzlist output"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Failed to parse vzlist output"));
goto cleanup;
}
*line++ = '\0';
goto no_memory;
if (virMutexInit(&dom->lock) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot initialize mutex"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot initialize mutex"));
VIR_FREE(dom);
goto cleanup;
}
ret = virUUIDParse(uuidstr, dom->def->uuid);
if (ret == -1) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("UUID in config file malformed"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("UUID in config file malformed"));
goto cleanup;
}
ret = openvzReadVPSConfigParam(veid, "CPUS", &temp);
if (ret < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not read config for container %d"),
- veid);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not read config for container %d"),
+ veid);
goto cleanup;
} else if (ret > 0) {
dom->def->maxvcpus = strtoI(temp);
virUUIDFormat(dom->def->uuid, uuidstr);
if (virHashLookup(driver->domains.objs, uuidstr)) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Duplicate container UUID %s detected for %d"),
- uuidstr,
- veid);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Duplicate container UUID %s detected for %d"),
+ uuidstr,
+ veid);
goto cleanup;
}
if (virHashAddEntry(driver->domains.objs, uuidstr, dom) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not add UUID for container %d"), veid);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not add UUID for container %d"), veid);
goto cleanup;
}
if (iden != NULL && uuidbuf != NULL && STREQ(iden, "#UUID:")) {
if (virStrcpy(uuidstr, uuidbuf, len) == NULL) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("invalid uuid %s"), uuidbuf);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("invalid uuid %s"), uuidbuf);
goto cleanup;
}
break;
unsigned char uuid[VIR_UUID_BUFLEN];
if (virUUIDGenerate(uuid)) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Failed to generate UUID"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Failed to generate UUID"));
return -1;
}
errno = 0;
}
if (errno) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Failed to scan configuration directory"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Failed to scan configuration directory"));
ret = -1;
}
if (ok && veid >= 0)
return veid;
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Failed to parse vzlist output"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Failed to parse vzlist output"));
return -1;
}
NULL);
if (vmdef == NULL) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Container is not defined"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Container is not defined"));
virCommandFree(cmd);
return NULL;
}
virCommandPtr cmd = NULL;
if (vmdef->nfss > 1) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("only one filesystem supported"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("only one filesystem supported"));
goto cleanup;
}
vmdef->fss[0]->type != VIR_DOMAIN_FS_TYPE_TEMPLATE &&
vmdef->fss[0]->type != VIR_DOMAIN_FS_TYPE_MOUNT)
{
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("filesystem is not of type 'template' or 'mount'"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("filesystem is not of type 'template' or 'mount'"));
goto cleanup;
}
{
if (virStrToLong_i(vmdef->name, NULL, 10, &vpsid) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not convert domain name to VEID"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not convert domain name to VEID"));
goto cleanup;
}
if (openvzCopyDefaultConfig(vpsid) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not copy default config"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not copy default config"));
goto cleanup;
}
if (openvzWriteVPSConfigParam(vpsid, "VE_PRIVATE", vmdef->fss[0]->src) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not set the source dir for the filesystem"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not set the source dir for the filesystem"));
goto cleanup;
}
} else {
virCommandAddArgFormat(cmd, "%lld", hl);
}
} else if (fss->space_soft_limit) {
- openvzError(VIR_ERR_INVALID_ARG, "%s",
- _("Can't set soft limit without hard limit"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Can't set soft limit without hard limit"));
goto cleanup;
}
openvzDriverUnlock(driver);
if (!vm) {
- openvzError(VIR_ERR_NO_DOMAIN, NULL);
+ virReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
openvzDriverUnlock(driver);
if (!vm) {
- openvzError(VIR_ERR_NO_DOMAIN, NULL);
+ virReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
openvzDriverUnlock(driver);
if (!vm) {
- openvzError(VIR_ERR_NO_DOMAIN, NULL);
+ virReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
openvzDriverUnlock(driver);
if (!vm) {
- openvzError(VIR_ERR_NO_DOMAIN, NULL);
+ virReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
openvzDriverUnlock(driver);
if (!vm) {
- openvzError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
info->cpuTime = 0;
} else {
if (openvzGetProcessInfo(&(info->cpuTime), dom->id) < 0) {
- openvzError(VIR_ERR_OPERATION_FAILED,
- _("cannot read cputime for domain %d"), dom->id);
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("cannot read cputime for domain %d"), dom->id);
goto cleanup;
}
}
openvzDriverUnlock(driver);
if (!vm) {
- openvzError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
openvzDriverUnlock(driver);
if (!obj) {
- openvzError(VIR_ERR_NO_DOMAIN, NULL);
+ virReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
ret = virDomainObjIsActive(obj);
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
openvzDriverUnlock(driver);
if (!obj) {
- openvzError(VIR_ERR_NO_DOMAIN, NULL);
+ virReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
ret = obj->persistent;
openvzDriverUnlock(driver);
if (!vm) {
- openvzError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
openvzDriverUnlock(driver);
if (!vm) {
- openvzError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- openvzError(VIR_ERR_OPERATION_INVALID, "%s",
- _("Domain is not running"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not running"));
goto cleanup;
}
openvzDriverUnlock(driver);
if (!vm) {
- openvzError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- openvzError(VIR_ERR_OPERATION_INVALID, "%s",
- _("Domain is not running"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not running"));
goto cleanup;
}
openvzDriverUnlock(driver);
if (!vm) {
- openvzError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
openvzSetProgramSentinal(prog, vm->def->name);
if (status != VIR_DOMAIN_RUNNING) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("domain is not in running state"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("domain is not in running state"));
goto cleanup;
}
openvzDriverUnlock(driver);
if (!vm) {
- openvzError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
openvzSetProgramSentinal(prog, vm->def->name);
if (status != VIR_DOMAIN_RUNNING) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("domain is not in running state"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("domain is not in running state"));
goto cleanup;
}
if (net == NULL)
return 0;
if (vpsid == NULL) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Container ID is not specified"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Container ID is not specified"));
return -1;
}
if (net->data.ethernet.dev == NULL) {
net->data.ethernet.dev = openvzGenerateContainerVethName(veid);
if (net->data.ethernet.dev == NULL) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not generate eth name for container"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not generate eth name for container"));
rc = -1;
goto exit;
}
if (net->ifname == NULL) {
net->ifname = openvzGenerateVethName(veid, net->data.ethernet.dev);
if (net->ifname == NULL) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not generate veth name"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not generate veth name"));
rc = -1;
goto exit;
}
no_memory:
VIR_FREE(opt);
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not put argument to %s"), VZCTL);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not put argument to %s"), VZCTL);
cmdExecFree(prog);
return -1;
}
if (openvzDomainSetNetwork(conn, def->name, def->nets[i], &buf) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not configure network"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not configure network"));
goto exit;
}
}
if (param) {
if (openvzWriteVPSConfigParam(strtoI(def->name), "NETIF", param) < 0) {
VIR_FREE(param);
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot replace NETIF config"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot replace NETIF config"));
return -1;
}
VIR_FREE(param);
vm = virDomainFindByName(&driver->domains, vmdef->name);
if (vm) {
- openvzError(VIR_ERR_OPERATION_FAILED,
- _("Already an OPENVZ VM active with the id '%s'"),
- vmdef->name);
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("Already an OPENVZ VM active with the id '%s'"),
+ vmdef->name);
goto cleanup;
}
if (!(vm = virDomainAssignDef(driver->caps,
if (vm->def->nfss == 1) {
if (openvzSetDiskQuota(vm->def, vm->def->fss[0], true) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not set disk quota"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not set disk quota"));
goto cleanup;
}
}
if (openvzSetDefinedUUID(strtoI(vm->def->name), vm->def->uuid) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not set UUID"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not set UUID"));
goto cleanup;
}
goto cleanup;
if (vm->def->vcpus != vm->def->maxvcpus) {
- openvzError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("current vcpu count must equal maximum"));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("current vcpu count must equal maximum"));
goto cleanup;
}
if (vm->def->maxvcpus > 0) {
if (openvzDomainSetVcpusInternal(vm, vm->def->maxvcpus) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not set number of virtual cpu"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not set number of virtual cpu"));
goto cleanup;
}
}
if (vm->def->mem.cur_balloon > 0) {
if (openvzDomainSetMemoryInternal(vm, vm->def->mem.cur_balloon) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not set memory size"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not set memory size"));
goto cleanup;
}
}
vm = virDomainFindByName(&driver->domains, vmdef->name);
if (vm) {
- openvzError(VIR_ERR_OPERATION_FAILED,
- _("Already an OPENVZ VM defined with the id '%s'"),
- vmdef->name);
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("Already an OPENVZ VM defined with the id '%s'"),
+ vmdef->name);
goto cleanup;
}
if (!(vm = virDomainAssignDef(driver->caps,
if (vm->def->nfss == 1) {
if (openvzSetDiskQuota(vm->def, vm->def->fss[0], true) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not set disk quota"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not set disk quota"));
goto cleanup;
}
}
if (openvzSetDefinedUUID(strtoI(vm->def->name), vm->def->uuid) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not set UUID"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not set UUID"));
goto cleanup;
}
if (vm->def->maxvcpus > 0) {
if (openvzDomainSetVcpusInternal(vm, vm->def->maxvcpus) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not set number of virtual cpu"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not set number of virtual cpu"));
goto cleanup;
}
}
openvzDriverUnlock(driver);
if (!vm) {
- openvzError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching id"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching id"));
goto cleanup;
}
goto cleanup;
if (status != VIR_DOMAIN_SHUTOFF) {
- openvzError(VIR_ERR_OPERATION_DENIED, "%s",
- _("domain is not in shutoff state"));
+ virReportError(VIR_ERR_OPERATION_DENIED, "%s",
+ _("domain is not in shutoff state"));
goto cleanup;
}
openvzDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
- openvzError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
openvzDriverUnlock(driver);
if (!vm) {
- openvzError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
openvzDriverUnlock(driver);
if (!vm) {
- openvzError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
if (openvzReadVPSConfigParam(strtoI(vm->def->name), "ONBOOT", &value) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not read container config"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not read container config"));
goto cleanup;
}
if (type == NULL || STRCASEEQ(type, "openvz"))
return 1028; /* OpenVZ has no limitation */
- openvzError(VIR_ERR_INVALID_ARG,
- _("unknown type '%s'"), type);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("unknown type '%s'"), type);
return -1;
}
unsigned int flags)
{
if (flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
- openvzError(VIR_ERR_INVALID_ARG, _("unsupported flags (0x%x)"), flags);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("unsupported flags (0x%x)"), flags);
return -1;
}
int ret = -1;
if (flags != VIR_DOMAIN_AFFECT_LIVE) {
- openvzError(VIR_ERR_INVALID_ARG, _("unsupported flags (0x%x)"), flags);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("unsupported flags (0x%x)"), flags);
return -1;
}
openvzDriverUnlock(driver);
if (!vm) {
- openvzError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
if (nvcpus <= 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("VCPUs should be >= 1"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("VCPUs should be >= 1"));
goto cleanup;
}
/* If path isn't /system, then they typoed, so tell them correct path */
if (conn->uri->path == NULL ||
STRNEQ (conn->uri->path, "/system")) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("unexpected OpenVZ URI path '%s', try openvz:///system"),
- conn->uri->path);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected OpenVZ URI path '%s', try openvz:///system"),
+ conn->uri->path);
return VIR_DRV_OPEN_ERROR;
}
if (!virFileExists("/proc/vz")) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("OpenVZ control file /proc/vz does not exist"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("OpenVZ control file /proc/vz does not exist"));
return VIR_DRV_OPEN_ERROR;
}
if (access("/proc/vz", W_OK) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("OpenVZ control file /proc/vz is not accessible"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("OpenVZ control file /proc/vz is not accessible"));
return VIR_DRV_OPEN_ERROR;
}
}
if (!ret)
break;
if (virStrToLong_i(buf, &endptr, 10, &veid) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not parse VPS ID %s"), buf);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not parse VPS ID %s"), buf);
continue;
}
ids[got] = veid;
if (!ret)
break;
if (virStrToLong_i(buf, &endptr, 10, &veid) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not parse VPS ID %s"), buf);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not parse VPS ID %s"), buf);
continue;
}
snprintf(vpsname, sizeof(vpsname), "%d", veid);
virCommandAddArgFormat(cmd, "-o%s.b,%s.l", param, param);
virCommandAddArg(cmd, domain->name);
if (virCommandRun(cmd, &status)) {
- openvzError(VIR_ERR_OPERATION_FAILED,
- _("Failed to get %s for %s: %d"), param, domain->name,
- status);
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("Failed to get %s for %s: %d"), param, domain->name,
+ status);
goto cleanup;
}
tmp = output;
virSkipSpaces(&tmp);
if (virStrToLong_ull(tmp, &endp, 10, barrier) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Can't parse limit from "VZLIST" output '%s'"), output);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Can't parse limit from "VZLIST" output '%s'"), output);
goto cleanup;
}
tmp = endp;
virSkipSpaces(&tmp);
if (virStrToLong_ull(tmp, &endp, 10, limit) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Can't parse barrier from "VZLIST" output '%s'"), output);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Can't parse barrier from "VZLIST" output '%s'"), output);
goto cleanup;
}
/* LONG_MAX indicates unlimited so reject larger values */
if (barrier > LONG_MAX || limit > LONG_MAX) {
- openvzError(VIR_ERR_OPERATION_FAILED,
- _("Failed to set %s for %s: value too large"), param,
- domain->name);
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("Failed to set %s for %s: value too large"), param,
+ domain->name);
goto cleanup;
}
virCommandAddArgFormat(cmd, "%llu:%llu", barrier, limit);
virCommandAddArg(cmd, "--save");
if (virCommandRun(cmd, &status)) {
- openvzError(VIR_ERR_OPERATION_FAILED,
- _("Failed to set %s for %s: %d"), param, domain->name,
- status);
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("Failed to set %s for %s: %d"), param, domain->name,
+ status);
goto cleanup;
}
goto cleanup;
if ((line = strchr(outbuf, '\n')) == NULL) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Failed to parse vzlist output"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Failed to parse vzlist output"));
goto cleanup;
}
*line++ = '\0';
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- openvzError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- openvzError(VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is not running"));
goto cleanup;
}
if (ret == 0)
ret = linuxDomainInterfaceStats(path, stats);
else
- openvzError(VIR_ERR_INVALID_ARG,
- _("invalid path, '%s' is not a known interface"), path);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("invalid path, '%s' is not a known interface"), path);
cleanup:
if (vm)
pos = virDomainFSIndexByName(vmdef, fs->dst);
if (pos < 0) {
- openvzError(VIR_ERR_INVALID_ARG,
- _("target %s doesn't exist."), fs->dst);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("target %s doesn't exist."), fs->dst);
return -1;
}
cur = vmdef->fss[pos];
|| cur->accessmode != fs->accessmode
|| cur->wrpolicy != fs->wrpolicy
|| cur->readonly != fs->readonly) {
- openvzError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Can only modify disk quota"));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Can only modify disk quota"));
return -1;
}
cur->space_hard_limit = fs->space_hard_limit;
cur->space_soft_limit = fs->space_soft_limit;
} else {
- openvzError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Can't modify device type '%s'"),
- virDomainDeviceTypeToString(dev->type));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Can't modify device type '%s'"),
+ virDomainDeviceTypeToString(dev->type));
return -1;
}
vmdef = vm->def;
if (!vm) {
- openvzError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
if (virStrToLong_i(vmdef->name, NULL, 10, &veid) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not convert domain name to VEID"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not convert domain name to VEID"));
goto cleanup;
}