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:
Daniel P. Berrange 2012-07-13 13:59:51 +01:00
parent 1935471542
commit 4343fee0a8
6 changed files with 235 additions and 240 deletions

View File

@ -77,7 +77,7 @@ virCapsPtr lxcCapsInit(virLXCDriverPtr driver)
VIR_WARN("Failed to get host power management capabilities");
if (virGetHostUUID(caps->host.host_uuid)) {
lxcError(VIR_ERR_INTERNAL_ERROR,
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot get the host uuid"));
goto error;
}
@ -187,7 +187,7 @@ int lxcLoadDriverConfig(virLXCDriverPtr driver)
goto done;
#define CHECK_TYPE(name,typ) if (p && p->type != (typ)) { \
lxcError(VIR_ERR_INTERNAL_ERROR, \
virReportError(VIR_ERR_INTERNAL_ERROR, \
"%s: %s: expected type " #typ, \
filename, (name)); \
virConfFree(conf); \

View File

@ -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 */

View File

@ -872,7 +872,7 @@ retry:
* /etc/filesystems is only allowed to contain '*' on the last line
*/
if (gotStar && !tryProc) {
lxcError(VIR_ERR_INTERNAL_ERROR,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("%s has unexpected '*' before last line"),
fslist);
goto cleanup;
@ -1066,12 +1066,12 @@ 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,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unexpected filesystem type %s"),
virDomainFSTypeToString(fs->type));
break;
default:
lxcError(VIR_ERR_CONFIG_UNSUPPORTED,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Cannot mount filesystem type %s"),
virDomainFSTypeToString(fs->type));
break;
@ -1599,13 +1599,13 @@ 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,
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,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to apply capabilities: %d"), ret);
return -1;
}
@ -1646,7 +1646,7 @@ static int lxcContainerChild( void *data )
virCommandPtr cmd = NULL;
if (NULL == vmDef) {
lxcError(VIR_ERR_INTERNAL_ERROR,
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("lxcChild() passed invalid vm definition"));
goto cleanup;
}

View File

@ -291,7 +291,7 @@ static int virLXCControllerDaemonHandshake(virLXCControllerPtr ctrl)
static int virLXCControllerValidateNICs(virLXCControllerPtr ctrl)
{
if (ctrl->def->nnets != ctrl->nveths) {
lxcError(VIR_ERR_INTERNAL_ERROR,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("expecting %d veths, but got %zu"),
ctrl->def->nnets, ctrl->nveths);
return -1;
@ -304,7 +304,7 @@ static int virLXCControllerValidateNICs(virLXCControllerPtr ctrl)
static int virLXCControllerValidateConsoles(virLXCControllerPtr ctrl)
{
if (ctrl->def->nconsoles != ctrl->nconsoles) {
lxcError(VIR_ERR_INTERNAL_ERROR,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("expecting %d consoles, but got %zu tty file handlers"),
ctrl->def->nconsoles, ctrl->nconsoles);
return -1;
@ -383,7 +383,7 @@ static int virLXCControllerSetupNUMAPolicy(virLXCControllerPtr ctrl)
VIR_DEBUG("Setting NUMA memory policy");
if (numa_available() < 0) {
lxcError(VIR_ERR_CONFIG_UNSUPPORTED,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("Host kernel is not aware of NUMA."));
return -1;
}
@ -395,7 +395,7 @@ 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,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Host cannot support NUMA node %d"), i);
return -1;
}
@ -424,7 +424,7 @@ static int virLXCControllerSetupNUMAPolicy(virLXCControllerPtr ctrl)
}
if (nnodes != 1) {
lxcError(VIR_ERR_CONFIG_UNSUPPORTED,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("NUMA memory tuning in 'preferred' mode "
"only supports single node"));
goto cleanup;
@ -435,7 +435,7 @@ static int virLXCControllerSetupNUMAPolicy(virLXCControllerPtr ctrl)
} else if (mode == VIR_DOMAIN_NUMATUNE_MEM_INTERLEAVE) {
numa_set_interleave_mask(&mask);
} else {
lxcError(VIR_ERR_CONFIG_UNSUPPORTED,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Unable to set NUMA policy %s"),
virDomainNumatuneMemModeTypeToString(mode));
goto cleanup;
@ -450,7 +450,7 @@ cleanup:
static int virLXCControllerSetupNUMAPolicy(virLXCControllerPtr ctrl)
{
if (ctrl->def->numatune.memory.nodemask) {
lxcError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("NUMA policy is not available on this platform"));
return -1;
}
@ -602,7 +602,7 @@ static int lxcControllerClearCapabilities(void)
capng_clear(CAPNG_SELECT_BOTH);
if ((ret = capng_apply(CAPNG_SELECT_BOTH)) < 0) {
lxcError(VIR_ERR_INTERNAL_ERROR,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("failed to apply capabilities: %d"), ret);
return -1;
}
@ -913,7 +913,7 @@ static int virLXCControllerMain(virLXCControllerPtr ctrl)
virLXCControllerConsoleEPoll,
&(ctrl->consoles[i]),
NULL)) < 0) {
lxcError(VIR_ERR_INTERNAL_ERROR, "%s",
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unable to watch epoll FD"));
goto cleanup;
}
@ -923,7 +923,7 @@ static int virLXCControllerMain(virLXCControllerPtr ctrl)
virLXCControllerConsoleIO,
&(ctrl->consoles[i]),
NULL)) < 0) {
lxcError(VIR_ERR_INTERNAL_ERROR, "%s",
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unable to watch host console PTY"));
goto cleanup;
}
@ -933,7 +933,7 @@ static int virLXCControllerMain(virLXCControllerPtr ctrl)
virLXCControllerConsoleIO,
&(ctrl->consoles[i]),
NULL)) < 0) {
lxcError(VIR_ERR_INTERNAL_ERROR, "%s",
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unable to watch host console PTY"));
goto cleanup;
}
@ -1092,7 +1092,7 @@ virLXCControllerSetupDevPTS(virLXCControllerPtr ctrl)
if (!root) {
if (ctrl->nconsoles != 1) {
lxcError(VIR_ERR_CONFIG_UNSUPPORTED,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Expected exactly one console, but got %zu"),
ctrl->nconsoles);
return -1;

View File

@ -101,7 +101,7 @@ 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,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unexpected LXC URI path '%s', try lxc:///"),
conn->uri->path);
return VIR_DRV_OPEN_ERROR;
@ -109,7 +109,7 @@ static virDrvOpenStatus lxcOpen(virConnectPtr conn,
/* URI was good, but driver isn't active */
if (lxc_driver == NULL) {
lxcError(VIR_ERR_INTERNAL_ERROR,
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("lxc state driver is not active"));
return VIR_DRV_OPEN_ERROR;
}
@ -178,7 +178,7 @@ static virDomainPtr lxcDomainLookupByID(virConnectPtr conn,
lxcDriverUnlock(driver);
if (!vm) {
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("No domain with matching id %d"), id);
goto cleanup;
}
@ -207,7 +207,7 @@ static virDomainPtr lxcDomainLookupByUUID(virConnectPtr conn,
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(uuid, uuidstr);
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
@ -233,7 +233,7 @@ static virDomainPtr lxcDomainLookupByName(virConnectPtr conn,
vm = virDomainFindByName(&driver->domains, name);
lxcDriverUnlock(driver);
if (!vm) {
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("No domain with matching name '%s'"), name);
goto cleanup;
}
@ -261,7 +261,7 @@ static int lxcDomainIsActive(virDomainPtr dom)
if (!obj) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
@ -286,7 +286,7 @@ static int lxcDomainIsPersistent(virDomainPtr dom)
if (!obj) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
@ -310,7 +310,7 @@ static int lxcDomainIsUpdated(virDomainPtr dom)
if (!obj) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
@ -392,7 +392,7 @@ static virDomainPtr lxcDomainDefine(virConnectPtr conn, const char *xml)
goto cleanup;
if ((def->nets != NULL) && !(driver->have_netns)) {
lxcError(VIR_ERR_OPERATION_INVALID,
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("System lacks NETNS support"));
goto cleanup;
}
@ -445,13 +445,13 @@ static int lxcDomainUndefineFlags(virDomainPtr dom,
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!vm->persistent) {
lxcError(VIR_ERR_OPERATION_INVALID,
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("Cannot undefine transient domain"));
goto cleanup;
}
@ -502,7 +502,7 @@ static int lxcDomainGetInfo(virDomainPtr dom,
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
@ -514,18 +514,18 @@ 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,
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,
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,
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
@ -568,7 +568,7 @@ lxcDomainGetState(virDomainPtr dom,
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
@ -595,7 +595,7 @@ static char *lxcGetOSType(virDomainPtr dom)
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
@ -626,7 +626,7 @@ lxcDomainGetMaxMemory(virDomainPtr dom)
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
@ -651,13 +651,13 @@ 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,
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,
virReportError(VIR_ERR_INVALID_ARG,
"%s", _("Cannot set max memory lower than current memory"));
goto cleanup;
}
@ -683,37 +683,37 @@ 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,
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,
virReportError(VIR_ERR_INVALID_ARG,
"%s", _("Cannot set memory higher than max memory"));
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
lxcError(VIR_ERR_OPERATION_INVALID,
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("Domain is not running"));
goto cleanup;
}
if (driver->cgroup == NULL) {
lxcError(VIR_ERR_OPERATION_INVALID,
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,
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,
virReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("Failed to set memory for domain"));
goto cleanup;
}
@ -758,13 +758,13 @@ lxcDomainSetMemoryParameters(virDomainPtr dom,
if (vm == NULL) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
lxcError(VIR_ERR_NO_DOMAIN,
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,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot find cgroup for domain %s"), vm->def->name);
goto cleanup;
}
@ -828,7 +828,7 @@ lxcDomainGetMemoryParameters(virDomainPtr dom,
if (vm == NULL) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
@ -841,7 +841,7 @@ lxcDomainGetMemoryParameters(virDomainPtr dom,
}
if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
lxcError(VIR_ERR_INTERNAL_ERROR,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unable to get cgroup for %s"), vm->def->name);
goto cleanup;
}
@ -921,7 +921,7 @@ static char *lxcDomainGetXMLDesc(virDomainPtr dom,
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
@ -960,19 +960,19 @@ 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,
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,
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("System lacks NETNS support"));
goto cleanup;
}
if (virDomainObjIsActive(vm)) {
lxcError(VIR_ERR_OPERATION_INVALID,
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("Domain is already running"));
goto cleanup;
}
@ -1047,7 +1047,7 @@ lxcDomainCreateAndStart(virConnectPtr conn,
goto cleanup;
if ((def->nets != NULL) && !(driver->have_netns)) {
lxcError(VIR_ERR_CONFIG_UNSUPPORTED,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("System lacks NETNS support"));
goto cleanup;
}
@ -1101,13 +1101,13 @@ static int lxcDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr secla
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainVirtTypeToString(vm->def->virtType)) {
lxcError(VIR_ERR_INTERNAL_ERROR,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown virt type in domain definition '%d'"),
vm->def->virtType);
goto cleanup;
@ -1130,7 +1130,7 @@ 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,
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Failed to get security label"));
goto cleanup;
}
@ -1161,7 +1161,7 @@ static int lxcNodeGetSecurityModel(virConnectPtr conn,
if (!virStrcpy(secmodel->model, driver->caps->host.secModel.model,
VIR_SECURITY_MODEL_BUFLEN)) {
lxcError(VIR_ERR_INTERNAL_ERROR,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("security model string exceeds max %d bytes"),
VIR_SECURITY_MODEL_BUFLEN - 1);
ret = -1;
@ -1170,7 +1170,7 @@ static int lxcNodeGetSecurityModel(virConnectPtr conn,
if (!virStrcpy(secmodel->doi, driver->caps->host.secModel.doi,
VIR_SECURITY_DOI_BUFLEN)) {
lxcError(VIR_ERR_INTERNAL_ERROR,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("security DOI string exceeds max %d bytes"),
VIR_SECURITY_DOI_BUFLEN-1);
ret = -1;
@ -1284,13 +1284,13 @@ lxcDomainDestroyFlags(virDomainPtr dom,
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
lxcError(VIR_ERR_OPERATION_INVALID,
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,7 +1627,7 @@ static char *lxcGetSchedulerType(virDomainPtr domain,
lxcDriverLock(driver);
if (!lxcCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
lxcError(VIR_ERR_OPERATION_INVALID,
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("cgroup CPU controller is not mounted"));
goto cleanup;
}
@ -1756,7 +1756,7 @@ lxcSetSchedulerParametersFlags(virDomainPtr dom,
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (vm == NULL) {
lxcError(VIR_ERR_INTERNAL_ERROR,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("No such domain %s"), dom->uuid);
goto cleanup;
}
@ -1774,12 +1774,12 @@ lxcSetSchedulerParametersFlags(virDomainPtr dom,
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
if (!lxcCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
lxcError(VIR_ERR_OPERATION_INVALID,
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,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot find cgroup for domain %s"),
vm->def->name);
goto cleanup;
@ -1898,7 +1898,7 @@ lxcGetSchedulerParametersFlags(virDomainPtr dom,
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (vm == NULL) {
lxcError(VIR_ERR_INTERNAL_ERROR,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("No such domain %s"), dom->uuid);
goto cleanup;
}
@ -1917,13 +1917,13 @@ lxcGetSchedulerParametersFlags(virDomainPtr dom,
}
if (!lxcCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
lxcError(VIR_ERR_OPERATION_INVALID,
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,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot find cgroup for domain %s"), vm->def->name);
goto cleanup;
}
@ -2011,7 +2011,7 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (vm == NULL) {
lxcError(VIR_ERR_INTERNAL_ERROR,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("No such domain %s"), dom->uuid);
goto cleanup;
}
@ -2022,13 +2022,13 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
if (!lxcCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) {
lxcError(VIR_ERR_OPERATION_INVALID, "%s",
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,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot find cgroup for domain %s"), vm->def->name);
goto cleanup;
}
@ -2040,7 +2040,7 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
int rc;
if (params[i].value.ui > 1000 || params[i].value.ui < 100) {
lxcError(VIR_ERR_INVALID_ARG, "%s",
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("out of blkio weight range."));
goto cleanup;
}
@ -2063,7 +2063,7 @@ 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",
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("out of blkio weight range."));
goto cleanup;
}
@ -2109,7 +2109,7 @@ lxcDomainGetBlkioParameters(virDomainPtr dom,
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (vm == NULL) {
lxcError(VIR_ERR_INTERNAL_ERROR,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("No such domain %s"), dom->uuid);
goto cleanup;
}
@ -2127,13 +2127,13 @@ lxcDomainGetBlkioParameters(virDomainPtr dom,
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
if (!lxcCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) {
lxcError(VIR_ERR_OPERATION_INVALID, "%s",
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,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot find cgroup for domain %s"), vm->def->name);
goto cleanup;
}
@ -2211,13 +2211,13 @@ lxcDomainInterfaceStats(virDomainPtr dom,
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
lxcError(VIR_ERR_OPERATION_INVALID,
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("Domain is not running"));
goto cleanup;
}
@ -2234,7 +2234,7 @@ lxcDomainInterfaceStats(virDomainPtr dom,
if (ret == 0)
ret = linuxDomainInterfaceStats(path, stats);
else
lxcError(VIR_ERR_INVALID_ARG,
virReportError(VIR_ERR_INVALID_ARG,
_("Invalid path, '%s' is not a known interface"), path);
cleanup:
@ -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,7 +2266,7 @@ static int lxcDomainGetAutostart(virDomainPtr dom,
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
@ -2293,13 +2293,13 @@ static int lxcDomainSetAutostart(virDomainPtr dom,
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!vm->persistent) {
lxcError(VIR_ERR_OPERATION_INVALID,
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("Cannot set autostart for transient domain"));
goto cleanup;
}
@ -2461,20 +2461,20 @@ static int lxcDomainSuspend(virDomainPtr dom)
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
lxcError(VIR_ERR_OPERATION_INVALID,
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,
virReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("Suspend operation failed"));
goto cleanup;
}
@ -2526,20 +2526,20 @@ static int lxcDomainResume(virDomainPtr dom)
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
lxcError(VIR_ERR_OPERATION_INVALID,
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,
virReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("Resume operation failed"));
goto cleanup;
}
@ -2583,13 +2583,13 @@ lxcDomainOpenConsole(virDomainPtr dom,
virUUIDFormat(dom->uuid, uuidstr);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
lxcError(VIR_ERR_NO_DOMAIN,
virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
lxcError(VIR_ERR_OPERATION_INVALID,
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
goto cleanup;
}
@ -2610,14 +2610,14 @@ lxcDomainOpenConsole(virDomainPtr dom,
}
if (!chr) {
lxcError(VIR_ERR_INTERNAL_ERROR,
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,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("character device %s is not using a PTY"), dev_name);
goto cleanup;
}

View File

@ -275,7 +275,7 @@ static int virLXCProcessSetupInterfaceBridged(virConnectPtr conn,
if (virNetDevBandwidthSet(net->ifname,
virDomainNetGetActualBandwidth(net)) < 0) {
lxcError(VIR_ERR_INTERNAL_ERROR,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot set bandwidth limits on %s"),
net->ifname);
goto cleanup;
@ -311,7 +311,7 @@ static int virLXCProcessSetupInterfaceDirect(virConnectPtr conn,
*/
bw = virDomainNetGetActualBandwidth(net);
if (bw) {
lxcError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Unable to set network bandwidth on direct interfaces"));
return -1;
}
@ -325,7 +325,7 @@ static int virLXCProcessSetupInterfaceDirect(virConnectPtr conn,
*/
prof = virDomainNetGetActualVirtPortProfile(net);
if (prof) {
lxcError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Unable to set port profile on direct interfaces"));
return -1;
}
@ -416,7 +416,7 @@ 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",
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("No bridge name specified"));
goto cleanup;
}
@ -445,7 +445,7 @@ 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,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unsupported network type %s"),
virDomainNetTypeToString(
virDomainNetGetActualType(def->nets[i])
@ -508,7 +508,7 @@ 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,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Socket path %s too big for destination"), sockpath);
goto error;
}
@ -537,7 +537,7 @@ int virLXCProcessStop(virLXCDriverPtr driver,
int rc;
if (vm->pid <= 0) {
lxcError(VIR_ERR_INTERNAL_ERROR,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid PID %d for container"), vm->pid);
return -1;
}
@ -561,7 +561,7 @@ int virLXCProcessStop(virLXCDriverPtr driver,
goto cleanup;
}
if (rc == 1) {
lxcError(VIR_ERR_INTERNAL_ERROR, "%s",
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Some container PIDs refused to die"));
rc = -1;
goto cleanup;
@ -811,26 +811,26 @@ int virLXCProcessStart(virConnectPtr conn,
virErrorPtr err = NULL;
if (!lxc_driver->cgroup) {
lxcError(VIR_ERR_INTERNAL_ERROR, "%s",
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",
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",
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",
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unable to find 'memory' cgroups controller mount"));
return -1;
}
@ -906,7 +906,7 @@ 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",
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Only PTY console types are supported"));
goto cleanup;
}
@ -1021,7 +1021,7 @@ int virLXCProcessStart(virConnectPtr conn,
char out[1024];
if (!(virLXCProcessReadLogOutput(vm, logfile, pos, out, 1024) < 0)) {
lxcError(VIR_ERR_INTERNAL_ERROR,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("guest failed to start: %s"), out);
}