mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
Replace use of openvzError with virReportError
Update the OpenVZ driver to use virReportError instead of the openvzError custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
a8483d425e
commit
29bf82593c
1
cfg.mk
1
cfg.mk
@ -516,7 +516,6 @@ msg_gen_function += XENXS_ERROR
|
||||
msg_gen_function += lxcError
|
||||
msg_gen_function += libxlError
|
||||
msg_gen_function += nodeReportError
|
||||
msg_gen_function += openvzError
|
||||
msg_gen_function += regerror
|
||||
msg_gen_function += remoteError
|
||||
msg_gen_function += statsError
|
||||
|
@ -120,8 +120,8 @@ int openvzExtractVersion(struct openvz_driver *driver)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -234,9 +234,9 @@ openvzReadNetworkConf(virDomainDefPtr def,
|
||||
*/
|
||||
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);
|
||||
@ -266,9 +266,9 @@ openvzReadNetworkConf(virDomainDefPtr def,
|
||||
*/
|
||||
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);
|
||||
@ -292,8 +292,8 @@ openvzReadNetworkConf(virDomainDefPtr def,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -301,16 +301,16 @@ openvzReadNetworkConf(virDomainDefPtr def,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -318,26 +318,26 @@ openvzReadNetworkConf(virDomainDefPtr def,
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -411,9 +411,9 @@ openvzReadFSConf(virDomainDefPtr def,
|
||||
|
||||
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)
|
||||
@ -425,9 +425,9 @@ openvzReadFSConf(virDomainDefPtr def,
|
||||
/* 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;
|
||||
}
|
||||
|
||||
@ -449,9 +449,9 @@ openvzReadFSConf(virDomainDefPtr def,
|
||||
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. */
|
||||
@ -503,16 +503,16 @@ openvzReadMemConf(virDomainDefPtr def, int veid)
|
||||
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)
|
||||
@ -525,16 +525,16 @@ openvzReadMemConf(virDomainDefPtr def, int veid)
|
||||
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)
|
||||
@ -592,8 +592,8 @@ int openvzLoadDomains(struct openvz_driver *driver) {
|
||||
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';
|
||||
@ -602,8 +602,8 @@ int openvzLoadDomains(struct openvz_driver *driver) {
|
||||
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;
|
||||
}
|
||||
@ -639,8 +639,8 @@ int openvzLoadDomains(struct openvz_driver *driver) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -651,9 +651,9 @@ int openvzLoadDomains(struct openvz_driver *driver) {
|
||||
|
||||
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);
|
||||
@ -671,15 +671,15 @@ int openvzLoadDomains(struct openvz_driver *driver) {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1048,8 +1048,8 @@ openvzGetVPSUUID(int vpsid, char *uuidstr, size_t len)
|
||||
|
||||
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;
|
||||
@ -1110,8 +1110,8 @@ openvzSetUUID(int vpsid){
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1155,8 +1155,8 @@ static int openvzAssignUUIDs(void)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1193,7 +1193,7 @@ int openvzGetVEID(const char *name) {
|
||||
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;
|
||||
}
|
||||
|
@ -33,10 +33,6 @@
|
||||
# include "domain_conf.h"
|
||||
# include "threads.h"
|
||||
|
||||
# define openvzError(code, ...) \
|
||||
virReportErrorHelper(VIR_FROM_OPENVZ, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
|
||||
/* OpenVZ commands - Replace with wrapper scripts later? */
|
||||
# define VZLIST "/usr/sbin/vzlist"
|
||||
|
@ -113,8 +113,8 @@ openvzDomainDefineCmd(virDomainDefPtr vmdef)
|
||||
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;
|
||||
}
|
||||
@ -138,8 +138,8 @@ static int openvzSetInitialConfig(virDomainDefPtr vmdef)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -147,8 +147,8 @@ static int openvzSetInitialConfig(virDomainDefPtr vmdef)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -158,20 +158,20 @@ static int openvzSetInitialConfig(virDomainDefPtr vmdef)
|
||||
{
|
||||
|
||||
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 {
|
||||
@ -217,8 +217,8 @@ openvzSetDiskQuota(virDomainDefPtr vmdef,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -245,7 +245,7 @@ static virDomainPtr openvzDomainLookupByID(virConnectPtr conn,
|
||||
openvzDriverUnlock(driver);
|
||||
|
||||
if (!vm) {
|
||||
openvzError(VIR_ERR_NO_DOMAIN, NULL);
|
||||
virReportError(VIR_ERR_NO_DOMAIN, NULL);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -278,7 +278,7 @@ static char *openvzGetOSType(virDomainPtr dom)
|
||||
openvzDriverUnlock(driver);
|
||||
|
||||
if (!vm) {
|
||||
openvzError(VIR_ERR_NO_DOMAIN, NULL);
|
||||
virReportError(VIR_ERR_NO_DOMAIN, NULL);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -303,7 +303,7 @@ static virDomainPtr openvzDomainLookupByUUID(virConnectPtr conn,
|
||||
openvzDriverUnlock(driver);
|
||||
|
||||
if (!vm) {
|
||||
openvzError(VIR_ERR_NO_DOMAIN, NULL);
|
||||
virReportError(VIR_ERR_NO_DOMAIN, NULL);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -328,7 +328,7 @@ static virDomainPtr openvzDomainLookupByName(virConnectPtr conn,
|
||||
openvzDriverUnlock(driver);
|
||||
|
||||
if (!vm) {
|
||||
openvzError(VIR_ERR_NO_DOMAIN, NULL);
|
||||
virReportError(VIR_ERR_NO_DOMAIN, NULL);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -354,8 +354,8 @@ static int openvzDomainGetInfo(virDomainPtr dom,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -367,8 +367,8 @@ static int openvzDomainGetInfo(virDomainPtr dom,
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -402,8 +402,8 @@ openvzDomainGetState(virDomainPtr dom,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -426,7 +426,7 @@ static int openvzDomainIsActive(virDomainPtr dom)
|
||||
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);
|
||||
@ -448,7 +448,7 @@ static int openvzDomainIsPersistent(virDomainPtr dom)
|
||||
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;
|
||||
@ -476,8 +476,8 @@ static char *openvzDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -520,14 +520,14 @@ static int openvzDomainSuspend(virDomainPtr dom) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -558,14 +558,14 @@ static int openvzDomainResume(virDomainPtr dom) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -601,8 +601,8 @@ openvzDomainShutdownFlags(virDomainPtr dom,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -611,8 +611,8 @@ openvzDomainShutdownFlags(virDomainPtr dom,
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -652,8 +652,8 @@ static int openvzDomainReboot(virDomainPtr dom,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -662,8 +662,8 @@ static int openvzDomainReboot(virDomainPtr dom,
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -752,8 +752,8 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -788,8 +788,8 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid,
|
||||
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;
|
||||
}
|
||||
@ -800,8 +800,8 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid,
|
||||
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;
|
||||
}
|
||||
@ -852,8 +852,8 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid,
|
||||
|
||||
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;
|
||||
|
||||
@ -881,8 +881,8 @@ openvzDomainSetNetworkConfig(virConnectPtr conn,
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -892,8 +892,8 @@ openvzDomainSetNetworkConfig(virConnectPtr conn,
|
||||
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);
|
||||
@ -924,9 +924,9 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
|
||||
|
||||
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,
|
||||
@ -942,15 +942,15 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -958,22 +958,22 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -1010,9 +1010,9 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
|
||||
|
||||
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,
|
||||
@ -1030,15 +1030,15 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1057,8 +1057,8 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -1091,8 +1091,8 @@ openvzDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1100,8 +1100,8 @@ openvzDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1143,8 +1143,8 @@ openvzDomainUndefineFlags(virDomainPtr dom,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1192,8 +1192,8 @@ openvzDomainSetAutostart(virDomainPtr dom, int autostart)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1222,14 +1222,14 @@ openvzDomainGetAutostart(virDomainPtr dom, int *autostart)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1252,8 +1252,8 @@ static int openvzGetMaxVCPUs(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1262,7 +1262,8 @@ openvzDomainGetVcpusFlags(virDomainPtr dom ATTRIBUTE_UNUSED,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1306,7 +1307,8 @@ static int openvzDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1315,14 +1317,14 @@ static int openvzDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1371,21 +1373,21 @@ static virDrvOpenStatus openvzOpen(virConnectPtr conn,
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
@ -1479,8 +1481,8 @@ static int openvzListDomains(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
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;
|
||||
@ -1534,8 +1536,8 @@ static int openvzListDefinedDomains(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
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);
|
||||
@ -1666,24 +1668,24 @@ openvzDomainGetBarrierLimit(virDomainPtr domain,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1706,9 +1708,9 @@ openvzDomainSetBarrierLimit(virDomainPtr domain,
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
@ -1717,9 +1719,9 @@ openvzDomainSetBarrierLimit(virDomainPtr domain,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1872,8 +1874,8 @@ openvzGetVEStatus(virDomainObjPtr vm, int *status, int *reason)
|
||||
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';
|
||||
@ -1916,14 +1918,14 @@ openvzDomainInterfaceStats (virDomainPtr dom,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1939,8 +1941,8 @@ openvzDomainInterfaceStats (virDomainPtr dom,
|
||||
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)
|
||||
@ -1962,8 +1964,8 @@ openvzUpdateDevice(virDomainDefPtr vmdef,
|
||||
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];
|
||||
@ -1974,8 +1976,8 @@ openvzUpdateDevice(virDomainDefPtr vmdef,
|
||||
|| 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;
|
||||
}
|
||||
|
||||
@ -1985,9 +1987,9 @@ openvzUpdateDevice(virDomainDefPtr vmdef,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -2015,14 +2017,14 @@ openvzDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "openvz_conf.h"
|
||||
#include "openvz_util.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_OPENVZ
|
||||
|
||||
long
|
||||
openvzKBPerPages(void)
|
||||
@ -41,8 +42,8 @@ openvzKBPerPages(void)
|
||||
if (kb_per_pages > 0) {
|
||||
kb_per_pages /= 1024;
|
||||
} else {
|
||||
openvzError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Can't determine page size"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Can't determine page size"));
|
||||
kb_per_pages = 0;
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user