mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-31 18:15:25 +00:00
Replace use of lxcError with virReportError
Update all LXC code to use virReportError instead of the custom lxcError macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
1935471542
commit
4343fee0a8
@ -77,8 +77,8 @@ virCapsPtr lxcCapsInit(virLXCDriverPtr driver)
|
||||
VIR_WARN("Failed to get host power management capabilities");
|
||||
|
||||
if (virGetHostUUID(caps->host.host_uuid)) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot get the host uuid"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot get the host uuid"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -187,9 +187,9 @@ int lxcLoadDriverConfig(virLXCDriverPtr driver)
|
||||
goto done;
|
||||
|
||||
#define CHECK_TYPE(name,typ) if (p && p->type != (typ)) { \
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR, \
|
||||
"%s: %s: expected type " #typ, \
|
||||
filename, (name)); \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||
"%s: %s: expected type " #typ, \
|
||||
filename, (name)); \
|
||||
virConfFree(conf); \
|
||||
return -1; \
|
||||
}
|
||||
|
@ -76,10 +76,6 @@ struct _virLXCDriver {
|
||||
int lxcLoadDriverConfig(virLXCDriverPtr driver);
|
||||
virCapsPtr lxcCapsInit(virLXCDriverPtr driver);
|
||||
|
||||
# define lxcError(code, ...) \
|
||||
virReportErrorHelper(VIR_FROM_LXC, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
static inline void lxcDriverLock(virLXCDriverPtr driver)
|
||||
{
|
||||
virMutexLock(&driver->lock);
|
||||
@ -89,5 +85,4 @@ static inline void lxcDriverUnlock(virLXCDriverPtr driver)
|
||||
virMutexUnlock(&driver->lock);
|
||||
}
|
||||
|
||||
|
||||
#endif /* LXC_CONF_H */
|
||||
|
@ -872,9 +872,9 @@ retry:
|
||||
* /etc/filesystems is only allowed to contain '*' on the last line
|
||||
*/
|
||||
if (gotStar && !tryProc) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("%s has unexpected '*' before last line"),
|
||||
fslist);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("%s has unexpected '*' before last line"),
|
||||
fslist);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1066,14 +1066,14 @@ static int lxcContainerMountFS(virDomainFSDefPtr fs,
|
||||
/* We do actually support this, but the lxc controller
|
||||
* should have associated the file with a loopback
|
||||
* device and changed this to TYPE_BLOCK for us */
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unexpected filesystem type %s"),
|
||||
virDomainFSTypeToString(fs->type));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unexpected filesystem type %s"),
|
||||
virDomainFSTypeToString(fs->type));
|
||||
break;
|
||||
default:
|
||||
lxcError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Cannot mount filesystem type %s"),
|
||||
virDomainFSTypeToString(fs->type));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Cannot mount filesystem type %s"),
|
||||
virDomainFSTypeToString(fs->type));
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
@ -1599,14 +1599,14 @@ static int lxcContainerDropCapabilities(void)
|
||||
CAP_AUDIT_CONTROL, /* No messing with auditing status */
|
||||
CAP_MAC_ADMIN, /* No messing with LSM config */
|
||||
-1 /* sentinal */)) < 0) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to remove capabilities: %d"), ret);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to remove capabilities: %d"), ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((ret = capng_apply(CAPNG_SELECT_BOTH)) < 0) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to apply capabilities: %d"), ret);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to apply capabilities: %d"), ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1646,8 +1646,8 @@ static int lxcContainerChild( void *data )
|
||||
virCommandPtr cmd = NULL;
|
||||
|
||||
if (NULL == vmDef) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("lxcChild() passed invalid vm definition"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("lxcChild() passed invalid vm definition"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -291,9 +291,9 @@ static int virLXCControllerDaemonHandshake(virLXCControllerPtr ctrl)
|
||||
static int virLXCControllerValidateNICs(virLXCControllerPtr ctrl)
|
||||
{
|
||||
if (ctrl->def->nnets != ctrl->nveths) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("expecting %d veths, but got %zu"),
|
||||
ctrl->def->nnets, ctrl->nveths);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("expecting %d veths, but got %zu"),
|
||||
ctrl->def->nnets, ctrl->nveths);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -304,9 +304,9 @@ static int virLXCControllerValidateNICs(virLXCControllerPtr ctrl)
|
||||
static int virLXCControllerValidateConsoles(virLXCControllerPtr ctrl)
|
||||
{
|
||||
if (ctrl->def->nconsoles != ctrl->nconsoles) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("expecting %d consoles, but got %zu tty file handlers"),
|
||||
ctrl->def->nconsoles, ctrl->nconsoles);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("expecting %d consoles, but got %zu tty file handlers"),
|
||||
ctrl->def->nconsoles, ctrl->nconsoles);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -383,8 +383,8 @@ static int virLXCControllerSetupNUMAPolicy(virLXCControllerPtr ctrl)
|
||||
VIR_DEBUG("Setting NUMA memory policy");
|
||||
|
||||
if (numa_available() < 0) {
|
||||
lxcError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("Host kernel is not aware of NUMA."));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("Host kernel is not aware of NUMA."));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -395,8 +395,8 @@ static int virLXCControllerSetupNUMAPolicy(virLXCControllerPtr ctrl)
|
||||
for (i = 0; i < VIR_DOMAIN_CPUMASK_LEN; i++) {
|
||||
if (ctrl->def->numatune.memory.nodemask[i]) {
|
||||
if (i > NUMA_NUM_NODES) {
|
||||
lxcError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Host cannot support NUMA node %d"), i);
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Host cannot support NUMA node %d"), i);
|
||||
return -1;
|
||||
}
|
||||
if (i > maxnode && !warned) {
|
||||
@ -424,9 +424,9 @@ static int virLXCControllerSetupNUMAPolicy(virLXCControllerPtr ctrl)
|
||||
}
|
||||
|
||||
if (nnodes != 1) {
|
||||
lxcError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("NUMA memory tuning in 'preferred' mode "
|
||||
"only supports single node"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("NUMA memory tuning in 'preferred' mode "
|
||||
"only supports single node"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -435,9 +435,9 @@ static int virLXCControllerSetupNUMAPolicy(virLXCControllerPtr ctrl)
|
||||
} else if (mode == VIR_DOMAIN_NUMATUNE_MEM_INTERLEAVE) {
|
||||
numa_set_interleave_mask(&mask);
|
||||
} else {
|
||||
lxcError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Unable to set NUMA policy %s"),
|
||||
virDomainNumatuneMemModeTypeToString(mode));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Unable to set NUMA policy %s"),
|
||||
virDomainNumatuneMemModeTypeToString(mode));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -450,8 +450,8 @@ cleanup:
|
||||
static int virLXCControllerSetupNUMAPolicy(virLXCControllerPtr ctrl)
|
||||
{
|
||||
if (ctrl->def->numatune.memory.nodemask) {
|
||||
lxcError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("NUMA policy is not available on this platform"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("NUMA policy is not available on this platform"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -602,8 +602,8 @@ static int lxcControllerClearCapabilities(void)
|
||||
capng_clear(CAPNG_SELECT_BOTH);
|
||||
|
||||
if ((ret = capng_apply(CAPNG_SELECT_BOTH)) < 0) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to apply capabilities: %d"), ret);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to apply capabilities: %d"), ret);
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
@ -913,8 +913,8 @@ static int virLXCControllerMain(virLXCControllerPtr ctrl)
|
||||
virLXCControllerConsoleEPoll,
|
||||
&(ctrl->consoles[i]),
|
||||
NULL)) < 0) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Unable to watch epoll FD"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Unable to watch epoll FD"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -923,8 +923,8 @@ static int virLXCControllerMain(virLXCControllerPtr ctrl)
|
||||
virLXCControllerConsoleIO,
|
||||
&(ctrl->consoles[i]),
|
||||
NULL)) < 0) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Unable to watch host console PTY"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Unable to watch host console PTY"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -933,8 +933,8 @@ static int virLXCControllerMain(virLXCControllerPtr ctrl)
|
||||
virLXCControllerConsoleIO,
|
||||
&(ctrl->consoles[i]),
|
||||
NULL)) < 0) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Unable to watch host console PTY"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Unable to watch host console PTY"));
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
@ -1092,9 +1092,9 @@ virLXCControllerSetupDevPTS(virLXCControllerPtr ctrl)
|
||||
|
||||
if (!root) {
|
||||
if (ctrl->nconsoles != 1) {
|
||||
lxcError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Expected exactly one console, but got %zu"),
|
||||
ctrl->nconsoles);
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Expected exactly one console, but got %zu"),
|
||||
ctrl->nconsoles);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -101,16 +101,16 @@ static virDrvOpenStatus lxcOpen(virConnectPtr conn,
|
||||
/* If path isn't '/' then they typoed, tell them correct path */
|
||||
if (conn->uri->path != NULL &&
|
||||
STRNEQ(conn->uri->path, "/")) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unexpected LXC URI path '%s', try lxc:///"),
|
||||
conn->uri->path);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unexpected LXC URI path '%s', try lxc:///"),
|
||||
conn->uri->path);
|
||||
return VIR_DRV_OPEN_ERROR;
|
||||
}
|
||||
|
||||
/* URI was good, but driver isn't active */
|
||||
if (lxc_driver == NULL) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("lxc state driver is not active"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("lxc state driver is not active"));
|
||||
return VIR_DRV_OPEN_ERROR;
|
||||
}
|
||||
}
|
||||
@ -178,8 +178,8 @@ static virDomainPtr lxcDomainLookupByID(virConnectPtr conn,
|
||||
lxcDriverUnlock(driver);
|
||||
|
||||
if (!vm) {
|
||||
lxcError(VIR_ERR_NO_DOMAIN,
|
||||
_("No domain with matching id %d"), id);
|
||||
virReportError(VIR_ERR_NO_DOMAIN,
|
||||
_("No domain with matching id %d"), id);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -207,8 +207,8 @@ static virDomainPtr lxcDomainLookupByUUID(virConnectPtr conn,
|
||||
if (!vm) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(uuid, uuidstr);
|
||||
lxcError(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;
|
||||
}
|
||||
|
||||
@ -233,8 +233,8 @@ static virDomainPtr lxcDomainLookupByName(virConnectPtr conn,
|
||||
vm = virDomainFindByName(&driver->domains, name);
|
||||
lxcDriverUnlock(driver);
|
||||
if (!vm) {
|
||||
lxcError(VIR_ERR_NO_DOMAIN,
|
||||
_("No domain with matching name '%s'"), name);
|
||||
virReportError(VIR_ERR_NO_DOMAIN,
|
||||
_("No domain with matching name '%s'"), name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -261,8 +261,8 @@ static int lxcDomainIsActive(virDomainPtr dom)
|
||||
if (!obj) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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;
|
||||
}
|
||||
ret = virDomainObjIsActive(obj);
|
||||
@ -286,8 +286,8 @@ static int lxcDomainIsPersistent(virDomainPtr dom)
|
||||
if (!obj) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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;
|
||||
}
|
||||
ret = obj->persistent;
|
||||
@ -310,8 +310,8 @@ static int lxcDomainIsUpdated(virDomainPtr dom)
|
||||
if (!obj) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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;
|
||||
}
|
||||
ret = obj->updated;
|
||||
@ -392,8 +392,8 @@ static virDomainPtr lxcDomainDefine(virConnectPtr conn, const char *xml)
|
||||
goto cleanup;
|
||||
|
||||
if ((def->nets != NULL) && !(driver->have_netns)) {
|
||||
lxcError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("System lacks NETNS support"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("System lacks NETNS support"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -445,14 +445,14 @@ static int lxcDomainUndefineFlags(virDomainPtr dom,
|
||||
if (!vm) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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 (!vm->persistent) {
|
||||
lxcError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("Cannot undefine transient domain"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("Cannot undefine transient domain"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -502,8 +502,8 @@ static int lxcDomainGetInfo(virDomainPtr dom,
|
||||
if (!vm) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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;
|
||||
}
|
||||
|
||||
@ -514,19 +514,19 @@ static int lxcDomainGetInfo(virDomainPtr dom,
|
||||
info->memory = vm->def->mem.cur_balloon;
|
||||
} else {
|
||||
if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unable to get cgroup for %s"), vm->def->name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unable to get cgroup for %s"), vm->def->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virCgroupGetCpuacctUsage(cgroup, &(info->cpuTime)) < 0) {
|
||||
lxcError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("Cannot read cputime for domain"));
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("Cannot read cputime for domain"));
|
||||
goto cleanup;
|
||||
}
|
||||
if ((rc = virCgroupGetMemoryUsage(cgroup, &(info->memory))) < 0) {
|
||||
lxcError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("Cannot read memory usage for domain"));
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("Cannot read memory usage for domain"));
|
||||
if (rc == -ENOENT) {
|
||||
/* Don't fail if we can't read memory usage due to a lack of
|
||||
* kernel support */
|
||||
@ -568,8 +568,8 @@ lxcDomainGetState(virDomainPtr dom,
|
||||
if (!vm) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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;
|
||||
}
|
||||
|
||||
@ -595,8 +595,8 @@ static char *lxcGetOSType(virDomainPtr dom)
|
||||
if (!vm) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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;
|
||||
}
|
||||
|
||||
@ -626,8 +626,8 @@ lxcDomainGetMaxMemory(virDomainPtr dom)
|
||||
if (!vm) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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;
|
||||
}
|
||||
|
||||
@ -651,14 +651,14 @@ static int lxcDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) {
|
||||
if (!vm) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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 (newmax < vm->def->mem.cur_balloon) {
|
||||
lxcError(VIR_ERR_INVALID_ARG,
|
||||
"%s", _("Cannot set max memory lower than current memory"));
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
"%s", _("Cannot set max memory lower than current memory"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -683,38 +683,38 @@ static int lxcDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
|
||||
if (!vm) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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 (newmem > vm->def->mem.max_balloon) {
|
||||
lxcError(VIR_ERR_INVALID_ARG,
|
||||
"%s", _("Cannot set memory higher than max memory"));
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
"%s", _("Cannot set memory higher than max memory"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!virDomainObjIsActive(vm)) {
|
||||
lxcError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("Domain is not running"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("Domain is not running"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (driver->cgroup == NULL) {
|
||||
lxcError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("cgroups must be configured on the host"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("cgroups must be configured on the host"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unable to get cgroup for %s"), vm->def->name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unable to get cgroup for %s"), vm->def->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virCgroupSetMemory(cgroup, newmem) < 0) {
|
||||
lxcError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("Failed to set memory for domain"));
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("Failed to set memory for domain"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -758,14 +758,14 @@ lxcDomainSetMemoryParameters(virDomainPtr dom,
|
||||
if (vm == NULL) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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 (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot find cgroup for domain %s"), vm->def->name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot find cgroup for domain %s"), vm->def->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -828,8 +828,8 @@ lxcDomainGetMemoryParameters(virDomainPtr dom,
|
||||
if (vm == NULL) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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;
|
||||
}
|
||||
|
||||
@ -841,8 +841,8 @@ lxcDomainGetMemoryParameters(virDomainPtr dom,
|
||||
}
|
||||
|
||||
if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unable to get cgroup for %s"), vm->def->name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unable to get cgroup for %s"), vm->def->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -921,8 +921,8 @@ static char *lxcDomainGetXMLDesc(virDomainPtr dom,
|
||||
if (!vm) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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;
|
||||
}
|
||||
|
||||
@ -960,20 +960,20 @@ static int lxcDomainStartWithFlags(virDomainPtr dom, unsigned int flags)
|
||||
if (!vm) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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 ((vm->def->nets != NULL) && !(driver->have_netns)) {
|
||||
lxcError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("System lacks NETNS support"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("System lacks NETNS support"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virDomainObjIsActive(vm)) {
|
||||
lxcError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("Domain is already running"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("Domain is already running"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1047,8 +1047,8 @@ lxcDomainCreateAndStart(virConnectPtr conn,
|
||||
goto cleanup;
|
||||
|
||||
if ((def->nets != NULL) && !(driver->have_netns)) {
|
||||
lxcError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("System lacks NETNS support"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("System lacks NETNS support"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1101,15 +1101,15 @@ static int lxcDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr secla
|
||||
if (!vm) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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 (!virDomainVirtTypeToString(vm->def->virtType)) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unknown virt type in domain definition '%d'"),
|
||||
vm->def->virtType);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unknown virt type in domain definition '%d'"),
|
||||
vm->def->virtType);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1130,8 +1130,8 @@ static int lxcDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr secla
|
||||
if (virDomainObjIsActive(vm)) {
|
||||
if (virSecurityManagerGetProcessLabel(driver->securityManager,
|
||||
vm->def, vm->pid, seclabel) < 0) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("Failed to get security label"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("Failed to get security label"));
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
@ -1161,18 +1161,18 @@ static int lxcNodeGetSecurityModel(virConnectPtr conn,
|
||||
|
||||
if (!virStrcpy(secmodel->model, driver->caps->host.secModel.model,
|
||||
VIR_SECURITY_MODEL_BUFLEN)) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("security model string exceeds max %d bytes"),
|
||||
VIR_SECURITY_MODEL_BUFLEN - 1);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("security model string exceeds max %d bytes"),
|
||||
VIR_SECURITY_MODEL_BUFLEN - 1);
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!virStrcpy(secmodel->doi, driver->caps->host.secModel.doi,
|
||||
VIR_SECURITY_DOI_BUFLEN)) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("security DOI string exceeds max %d bytes"),
|
||||
VIR_SECURITY_DOI_BUFLEN-1);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("security DOI string exceeds max %d bytes"),
|
||||
VIR_SECURITY_DOI_BUFLEN-1);
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
@ -1284,14 +1284,14 @@ lxcDomainDestroyFlags(virDomainPtr dom,
|
||||
if (!vm) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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)) {
|
||||
lxcError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("Domain is not running"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("Domain is not running"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1559,7 +1559,7 @@ static int lxcVersion(virConnectPtr conn ATTRIBUTE_UNUSED, unsigned long *versio
|
||||
uname(&ver);
|
||||
|
||||
if (virParseVersionString(ver.release, version, true) < 0) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR, _("Unknown release: %s"), ver.release);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown release: %s"), ver.release);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1627,8 +1627,8 @@ static char *lxcGetSchedulerType(virDomainPtr domain,
|
||||
|
||||
lxcDriverLock(driver);
|
||||
if (!lxcCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
|
||||
lxcError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("cgroup CPU controller is not mounted"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("cgroup CPU controller is not mounted"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1756,8 +1756,8 @@ lxcSetSchedulerParametersFlags(virDomainPtr dom,
|
||||
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||
|
||||
if (vm == NULL) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("No such domain %s"), dom->uuid);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("No such domain %s"), dom->uuid);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1774,14 +1774,14 @@ lxcSetSchedulerParametersFlags(virDomainPtr dom,
|
||||
|
||||
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
||||
if (!lxcCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
|
||||
lxcError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("cgroup CPU controller is not mounted"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("cgroup CPU controller is not mounted"));
|
||||
goto cleanup;
|
||||
}
|
||||
if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot find cgroup for domain %s"),
|
||||
vm->def->name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot find cgroup for domain %s"),
|
||||
vm->def->name);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
@ -1898,8 +1898,8 @@ lxcGetSchedulerParametersFlags(virDomainPtr dom,
|
||||
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||
|
||||
if (vm == NULL) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("No such domain %s"), dom->uuid);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("No such domain %s"), dom->uuid);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1917,14 +1917,14 @@ lxcGetSchedulerParametersFlags(virDomainPtr dom,
|
||||
}
|
||||
|
||||
if (!lxcCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
|
||||
lxcError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("cgroup CPU controller is not mounted"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("cgroup CPU controller is not mounted"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot find cgroup for domain %s"), vm->def->name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot find cgroup for domain %s"), vm->def->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -2011,8 +2011,8 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
|
||||
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||
|
||||
if (vm == NULL) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("No such domain %s"), dom->uuid);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("No such domain %s"), dom->uuid);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -2022,14 +2022,14 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
|
||||
|
||||
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
||||
if (!lxcCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) {
|
||||
lxcError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("blkio cgroup isn't mounted"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("blkio cgroup isn't mounted"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot find cgroup for domain %s"), vm->def->name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot find cgroup for domain %s"), vm->def->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -2040,8 +2040,8 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
|
||||
int rc;
|
||||
|
||||
if (params[i].value.ui > 1000 || params[i].value.ui < 100) {
|
||||
lxcError(VIR_ERR_INVALID_ARG, "%s",
|
||||
_("out of blkio weight range."));
|
||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||
_("out of blkio weight range."));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -2063,8 +2063,8 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
|
||||
|
||||
if (STREQ(param->field, VIR_DOMAIN_BLKIO_WEIGHT)) {
|
||||
if (params[i].value.ui > 1000 || params[i].value.ui < 100) {
|
||||
lxcError(VIR_ERR_INVALID_ARG, "%s",
|
||||
_("out of blkio weight range."));
|
||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||
_("out of blkio weight range."));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -2109,8 +2109,8 @@ lxcDomainGetBlkioParameters(virDomainPtr dom,
|
||||
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||
|
||||
if (vm == NULL) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("No such domain %s"), dom->uuid);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("No such domain %s"), dom->uuid);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -2127,14 +2127,14 @@ lxcDomainGetBlkioParameters(virDomainPtr dom,
|
||||
|
||||
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
||||
if (!lxcCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) {
|
||||
lxcError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("blkio cgroup isn't mounted"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("blkio cgroup isn't mounted"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot find cgroup for domain %s"), vm->def->name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot find cgroup for domain %s"), vm->def->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -2211,14 +2211,14 @@ lxcDomainInterfaceStats(virDomainPtr dom,
|
||||
if (!vm) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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)) {
|
||||
lxcError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("Domain is not running"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("Domain is not running"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -2234,8 +2234,8 @@ lxcDomainInterfaceStats(virDomainPtr dom,
|
||||
if (ret == 0)
|
||||
ret = linuxDomainInterfaceStats(path, stats);
|
||||
else
|
||||
lxcError(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)
|
||||
@ -2248,7 +2248,7 @@ lxcDomainInterfaceStats(virDomainPtr dom,
|
||||
const char *path ATTRIBUTE_UNUSED,
|
||||
struct _virDomainInterfaceStats *stats ATTRIBUTE_UNUSED)
|
||||
{
|
||||
lxcError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
|
||||
virReportError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
@ -2266,8 +2266,8 @@ static int lxcDomainGetAutostart(virDomainPtr dom,
|
||||
if (!vm) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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;
|
||||
}
|
||||
|
||||
@ -2293,14 +2293,14 @@ static int lxcDomainSetAutostart(virDomainPtr dom,
|
||||
if (!vm) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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 (!vm->persistent) {
|
||||
lxcError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("Cannot set autostart for transient domain"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("Cannot set autostart for transient domain"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -2461,21 +2461,21 @@ static int lxcDomainSuspend(virDomainPtr dom)
|
||||
if (!vm) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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)) {
|
||||
lxcError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("Domain is not running"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("Domain is not running"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PAUSED) {
|
||||
if (lxcFreezeContainer(driver, vm) < 0) {
|
||||
lxcError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("Suspend operation failed"));
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("Suspend operation failed"));
|
||||
goto cleanup;
|
||||
}
|
||||
virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_USER);
|
||||
@ -2526,21 +2526,21 @@ static int lxcDomainResume(virDomainPtr dom)
|
||||
if (!vm) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
lxcError(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)) {
|
||||
lxcError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("Domain is not running"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("Domain is not running"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
|
||||
if (lxcUnfreezeContainer(driver, vm) < 0) {
|
||||
lxcError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("Resume operation failed"));
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("Resume operation failed"));
|
||||
goto cleanup;
|
||||
}
|
||||
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
|
||||
@ -2583,14 +2583,14 @@ lxcDomainOpenConsole(virDomainPtr dom,
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||
if (!vm) {
|
||||
lxcError(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)) {
|
||||
lxcError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("domain is not running"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("domain is not running"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -2610,15 +2610,15 @@ lxcDomainOpenConsole(virDomainPtr dom,
|
||||
}
|
||||
|
||||
if (!chr) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot find console device '%s'"),
|
||||
dev_name ? dev_name : _("default"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot find console device '%s'"),
|
||||
dev_name ? dev_name : _("default"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("character device %s is not using a PTY"), dev_name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("character device %s is not using a PTY"), dev_name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -275,9 +275,9 @@ static int virLXCProcessSetupInterfaceBridged(virConnectPtr conn,
|
||||
|
||||
if (virNetDevBandwidthSet(net->ifname,
|
||||
virDomainNetGetActualBandwidth(net)) < 0) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot set bandwidth limits on %s"),
|
||||
net->ifname);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot set bandwidth limits on %s"),
|
||||
net->ifname);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -311,8 +311,8 @@ static int virLXCProcessSetupInterfaceDirect(virConnectPtr conn,
|
||||
*/
|
||||
bw = virDomainNetGetActualBandwidth(net);
|
||||
if (bw) {
|
||||
lxcError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Unable to set network bandwidth on direct interfaces"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Unable to set network bandwidth on direct interfaces"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -325,8 +325,8 @@ static int virLXCProcessSetupInterfaceDirect(virConnectPtr conn,
|
||||
*/
|
||||
prof = virDomainNetGetActualVirtPortProfile(net);
|
||||
if (prof) {
|
||||
lxcError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Unable to set port profile on direct interfaces"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Unable to set port profile on direct interfaces"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -416,8 +416,8 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn,
|
||||
case VIR_DOMAIN_NET_TYPE_BRIDGE: {
|
||||
const char *brname = virDomainNetGetActualBridgeName(def->nets[i]);
|
||||
if (!brname) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("No bridge name specified"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("No bridge name specified"));
|
||||
goto cleanup;
|
||||
}
|
||||
if (virLXCProcessSetupInterfaceBridged(conn,
|
||||
@ -445,11 +445,11 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn,
|
||||
case VIR_DOMAIN_NET_TYPE_MCAST:
|
||||
case VIR_DOMAIN_NET_TYPE_INTERNAL:
|
||||
case VIR_DOMAIN_NET_TYPE_LAST:
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unsupported network type %s"),
|
||||
virDomainNetTypeToString(
|
||||
virDomainNetGetActualType(def->nets[i])
|
||||
));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unsupported network type %s"),
|
||||
virDomainNetTypeToString(
|
||||
virDomainNetGetActualType(def->nets[i])
|
||||
));
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
@ -508,8 +508,8 @@ static int virLXCProcessMonitorClient(virLXCDriverPtr driver,
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sun_family = AF_UNIX;
|
||||
if (virStrcpyStatic(addr.sun_path, sockpath) == NULL) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Socket path %s too big for destination"), sockpath);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Socket path %s too big for destination"), sockpath);
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -537,8 +537,8 @@ int virLXCProcessStop(virLXCDriverPtr driver,
|
||||
int rc;
|
||||
|
||||
if (vm->pid <= 0) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Invalid PID %d for container"), vm->pid);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Invalid PID %d for container"), vm->pid);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -561,8 +561,8 @@ int virLXCProcessStop(virLXCDriverPtr driver,
|
||||
goto cleanup;
|
||||
}
|
||||
if (rc == 1) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Some container PIDs refused to die"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Some container PIDs refused to die"));
|
||||
rc = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
@ -811,27 +811,27 @@ int virLXCProcessStart(virConnectPtr conn,
|
||||
virErrorPtr err = NULL;
|
||||
|
||||
if (!lxc_driver->cgroup) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("The 'cpuacct', 'devices' & 'memory' cgroups controllers must be mounted"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("The 'cpuacct', 'devices' & 'memory' cgroups controllers must be mounted"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!virCgroupMounted(lxc_driver->cgroup,
|
||||
VIR_CGROUP_CONTROLLER_CPUACCT)) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Unable to find 'cpuacct' cgroups controller mount"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Unable to find 'cpuacct' cgroups controller mount"));
|
||||
return -1;
|
||||
}
|
||||
if (!virCgroupMounted(lxc_driver->cgroup,
|
||||
VIR_CGROUP_CONTROLLER_DEVICES)) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Unable to find 'devices' cgroups controller mount"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Unable to find 'devices' cgroups controller mount"));
|
||||
return -1;
|
||||
}
|
||||
if (!virCgroupMounted(lxc_driver->cgroup,
|
||||
VIR_CGROUP_CONTROLLER_MEMORY)) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Unable to find 'memory' cgroups controller mount"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Unable to find 'memory' cgroups controller mount"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -906,8 +906,8 @@ int virLXCProcessStart(virConnectPtr conn,
|
||||
for (i = 0 ; i < vm->def->nconsoles ; i++) {
|
||||
char *ttyPath;
|
||||
if (vm->def->consoles[i]->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
|
||||
lxcError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Only PTY console types are supported"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Only PTY console types are supported"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1021,8 +1021,8 @@ int virLXCProcessStart(virConnectPtr conn,
|
||||
char out[1024];
|
||||
|
||||
if (!(virLXCProcessReadLogOutput(vm, logfile, pos, out, 1024) < 0)) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("guest failed to start: %s"), out);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("guest failed to start: %s"), out);
|
||||
}
|
||||
|
||||
goto error;
|
||||
|
Loading…
Reference in New Issue
Block a user