/* If path isn't '/' then they typoed, tell them correct path */
if (STRNEQ(conn->uri->path, "/")) {
- lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR,
+ lxcError(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(conn, NULL, VIR_ERR_INTERNAL_ERROR,
+ lxcError(VIR_ERR_INTERNAL_ERROR,
"%s", _("lxc state driver is not active"));
return VIR_DRV_OPEN_ERROR;
}
lxcDriverUnlock(driver);
if (!vm) {
- lxcError(conn, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ lxcError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
lxcDriverUnlock(driver);
if (!vm) {
- lxcError(conn, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ lxcError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
vm = virDomainFindByName(&driver->domains, name);
lxcDriverUnlock(driver);
if (!vm) {
- lxcError(conn, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ lxcError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
lxcDriverUnlock(driver);
if (!obj) {
- lxcError(dom->conn, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ lxcError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
ret = virDomainObjIsActive(obj);
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
lxcDriverUnlock(driver);
if (!obj) {
- lxcError(dom->conn, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ lxcError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
ret = obj->persistent;
goto cleanup;
if ((def->nets != NULL) && !(driver->have_netns)) {
- lxcError(conn, NULL, VIR_ERR_NO_SUPPORT,
+ lxcError(VIR_ERR_NO_SUPPORT,
"%s", _("System lacks NETNS support"));
goto cleanup;
}
lxcDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
- lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
+ lxcError(VIR_ERR_INVALID_DOMAIN,
"%s", _("No domain with matching uuid"));
goto cleanup;
}
if (virDomainObjIsActive(vm)) {
- lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
+ lxcError(VIR_ERR_OPERATION_INVALID,
"%s", _("Cannot delete active domain"));
goto cleanup;
}
if (!vm->persistent) {
- lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
+ lxcError(VIR_ERR_OPERATION_INVALID,
"%s", _("Cannot undefine transient domain"));
goto cleanup;
}
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
- lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
+ lxcError(VIR_ERR_INVALID_DOMAIN,
"%s", _("No domain with matching uuid"));
goto cleanup;
}
info->memory = vm->def->memory;
} else {
if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
- lxcError(dom->conn, dom, VIR_ERR_INTERNAL_ERROR,
+ lxcError(VIR_ERR_INTERNAL_ERROR,
_("Unable to get cgroup for %s"), vm->def->name);
goto cleanup;
}
if (virCgroupGetCpuacctUsage(cgroup, &(info->cpuTime)) < 0) {
- lxcError(dom->conn, dom, VIR_ERR_OPERATION_FAILED,
+ lxcError(VIR_ERR_OPERATION_FAILED,
"%s", _("Cannot read cputime for domain"));
goto cleanup;
}
if (virCgroupGetMemoryUsage(cgroup, &(info->memory)) < 0) {
- lxcError(dom->conn, dom, VIR_ERR_OPERATION_FAILED,
+ lxcError(VIR_ERR_OPERATION_FAILED,
"%s", _("Cannot read memory usage for domain"));
goto cleanup;
}
lxcDriverUnlock(driver);
if (!vm) {
- lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
+ lxcError(VIR_ERR_INVALID_DOMAIN,
"%s", _("No domain with matching uuid"));
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN,
+ lxcError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN,
+ lxcError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (newmax < vm->def->memory) {
- lxcError(dom->conn, dom, VIR_ERR_INVALID_ARG,
+ lxcError(VIR_ERR_INVALID_ARG,
"%s", _("Cannot set max memory lower than current memory"));
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN,
+ lxcError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (newmem > vm->def->maxmem) {
- lxcError(dom->conn, dom, VIR_ERR_INVALID_ARG,
+ lxcError(VIR_ERR_INVALID_ARG,
"%s", _("Cannot set memory higher than max memory"));
goto cleanup;
}
if (virDomainObjIsActive(vm)) {
if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
- lxcError(dom->conn, dom, VIR_ERR_INTERNAL_ERROR,
+ lxcError(VIR_ERR_INTERNAL_ERROR,
_("Unable to get cgroup for %s\n"), vm->def->name);
goto cleanup;
}
if (virCgroupSetMemory(cgroup, newmem) < 0) {
- lxcError(dom->conn, dom, VIR_ERR_OPERATION_FAILED,
+ lxcError(VIR_ERR_OPERATION_FAILED,
"%s", _("Failed to set memory for domain"));
goto cleanup;
}
lxcDriverUnlock(driver);
if (!vm) {
- lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
+ lxcError(VIR_ERR_INVALID_DOMAIN,
"%s", _("No domain with matching uuid"));
goto cleanup;
}
*
* Returns 0 on success or -1 in case of error
*/
-static int lxcVmCleanup(virConnectPtr conn,
- lxc_driver_t *driver,
+static int lxcVmCleanup(lxc_driver_t *driver,
virDomainObjPtr vm)
{
int rc = -1;
close(priv->monitor);
virFileDeletePid(driver->stateDir, vm->def->name);
- virDomainDeleteConfig(conn, driver->stateDir, NULL, vm);
+ virDomainDeleteConfig(NULL, driver->stateDir, NULL, vm);
vm->state = VIR_DOMAIN_SHUTOFF;
vm->pid = -1;
DEBUG("bridge: %s", bridge);
if (NULL == bridge) {
- lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR,
+ lxcError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Failed to get bridge for interface"));
goto error_exit;
}
}
DEBUG("parentVeth: %s, containerVeth: %s", parentVeth, containerVeth);
if (0 != (rc = vethCreate(parentVeth, PATH_MAX, containerVeth, PATH_MAX))) {
- lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR,
+ lxcError(VIR_ERR_INTERNAL_ERROR,
_("Failed to create veth device pair: %d"), rc);
goto error_exit;
}
}
-static int lxcMonitorClient(virConnectPtr conn,
- lxc_driver_t * driver,
+static int lxcMonitorClient(lxc_driver_t * driver,
virDomainObjPtr vm)
{
char *sockpath = NULL;
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
if (virStrcpyStatic(addr.sun_path, sockpath) == NULL) {
- lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR,
+ lxcError(VIR_ERR_INTERNAL_ERROR,
_("Socket path %s too big for destination"), sockpath);
goto error;
}
}
-static int lxcVmTerminate(virConnectPtr conn,
- lxc_driver_t *driver,
+static int lxcVmTerminate(lxc_driver_t *driver,
virDomainObjPtr vm,
int signum)
{
signum = SIGINT;
if (vm->pid <= 0) {
- lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR,
+ lxcError(VIR_ERR_INTERNAL_ERROR,
_("Invalid PID %d for container"), vm->pid);
return -1;
}
vm->state = VIR_DOMAIN_SHUTDOWN;
- return lxcVmCleanup(conn, driver, vm);
+ return lxcVmCleanup(driver, vm);
}
static void lxcMonitorEvent(int watch,
goto cleanup;
}
- if (lxcVmTerminate(NULL, driver, vm, SIGINT) < 0) {
+ if (lxcVmTerminate(driver, vm, SIGINT) < 0) {
virEventRemoveHandle(watch);
} else {
event = virDomainEventNewFromObj(vm,
}
-static int lxcControllerStart(virConnectPtr conn,
+static int lxcControllerStart(lxc_driver_t *driver,
virDomainObjPtr vm,
int nveths,
char **veths,
fd_set keepfd;
char appPtyStr[30];
const char *emulator;
- lxc_driver_t *driver = conn->privateData;
FD_ZERO(&keepfd);
}
if (!(WIFEXITED(status) && WEXITSTATUS(status) == 0)) {
- lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR,
+ lxcError(VIR_ERR_INTERNAL_ERROR,
_("Container '%s' unexpectedly shutdown during startup"),
largv[0]);
goto cleanup;
goto cleanup;
}
- if (lxcControllerStart(conn,
+ if (lxcControllerStart(driver,
vm,
nveths, veths,
parentTty, logfd) < 0)
/* Connect to the controller as a client *first* because
* this will block until the child has written their
* pid file out to disk */
- if ((priv->monitor = lxcMonitorClient(conn, driver, vm)) < 0)
+ if ((priv->monitor = lxcMonitorClient(driver, vm)) < 0)
goto cleanup;
/* And get its pid */
VIR_EVENT_HANDLE_ERROR | VIR_EVENT_HANDLE_HANGUP,
lxcMonitorEvent,
vm, NULL)) < 0) {
- lxcVmTerminate(conn, driver, vm, 0);
+ lxcVmTerminate(driver, vm, 0);
goto cleanup;
}
lxcDriverLock(driver);
vm = virDomainFindByName(&driver->domains, dom->name);
if (!vm) {
- lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
+ lxcError(VIR_ERR_INVALID_DOMAIN,
_("No domain named %s"), dom->name);
goto cleanup;
}
if ((vm->def->nets != NULL) && !(driver->have_netns)) {
- lxcError(dom->conn, NULL, VIR_ERR_NO_SUPPORT,
+ lxcError(VIR_ERR_NO_SUPPORT,
"%s", _("System lacks NETNS support"));
goto cleanup;
}
goto cleanup;
if ((def->nets != NULL) && !(driver->have_netns)) {
- lxcError(conn, NULL, VIR_ERR_NO_SUPPORT,
+ lxcError(VIR_ERR_NO_SUPPORT,
"%s", _("System lacks NETNS support"));
goto cleanup;
}
lxcDriverLock(driver);
vm = virDomainFindByID(&driver->domains, dom->id);
if (!vm) {
- lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
+ lxcError(VIR_ERR_INVALID_DOMAIN,
_("No domain with id %d"), dom->id);
goto cleanup;
}
- ret = lxcVmTerminate(dom->conn, driver, vm, 0);
+ ret = lxcVmTerminate(driver, vm, 0);
event = virDomainEventNewFromObj(vm,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
lxcDriverLock(driver);
vm = virDomainFindByID(&driver->domains, dom->id);
if (!vm) {
- lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
+ lxcError(VIR_ERR_INVALID_DOMAIN,
_("No domain with id %d"), dom->id);
goto cleanup;
}
- ret = lxcVmTerminate(dom->conn, driver, vm, SIGKILL);
+ ret = lxcVmTerminate(driver, vm, SIGKILL);
event = virDomainEventNewFromObj(vm,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
virDomainObjLock(vm);
priv = vm->privateData;
- if ((priv->monitor = lxcMonitorClient(NULL, driver, vm)) < 0) {
+ if ((priv->monitor = lxcMonitorClient(driver, vm)) < 0) {
goto cleanup;
}
VIR_EVENT_HANDLE_ERROR | VIR_EVENT_HANDLE_HANGUP,
lxcMonitorEvent,
vm, NULL)) < 0) {
- lxcVmTerminate(NULL, driver, vm, 0);
+ lxcVmTerminate(driver, vm, 0);
goto cleanup;
}
} else {
return active;
}
-static int lxcVersion(virConnectPtr conn, unsigned long *version)
+static int lxcVersion(virConnectPtr conn ATTRIBUTE_UNUSED, unsigned long *version)
{
struct utsname ver;
int maj;
uname(&ver);
if (sscanf(ver.release, "%i.%i.%i", &maj, &min, &rev) != 3) {
- lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR,
+ lxcError(VIR_ERR_INTERNAL_ERROR,
_("Unknown release: %s"), ver.release);
return -1;
}
vm = virDomainFindByUUID(&driver->domains, domain->uuid);
if (vm == NULL) {
- lxcError(NULL, domain, VIR_ERR_INTERNAL_ERROR,
+ lxcError(VIR_ERR_INTERNAL_ERROR,
_("No such domain %s"), domain->uuid);
goto cleanup;
}
for (i = 0; i < nparams; i++) {
virSchedParameterPtr param = ¶ms[i];
if (param->type != VIR_DOMAIN_SCHED_FIELD_ULLONG) {
- lxcError(NULL, domain, VIR_ERR_INVALID_ARG, "%s",
+ lxcError(VIR_ERR_INVALID_ARG, "%s",
_("Invalid type for cpu_shares tunable, expected a 'ullong'"));
goto cleanup;
}
if (virCgroupSetCpuShares(group, params[i].value.ul) != 0)
goto cleanup;
} else {
- lxcError(NULL, domain, VIR_ERR_INVALID_ARG,
+ lxcError(VIR_ERR_INVALID_ARG,
_("Invalid parameter `%s'"), param->field);
goto cleanup;
}
return -1;
if ((*nparams) != 1) {
- lxcError(NULL, domain, VIR_ERR_INVALID_ARG,
+ lxcError(VIR_ERR_INVALID_ARG,
"%s", _("Invalid parameter count"));
return -1;
}
vm = virDomainFindByUUID(&driver->domains, domain->uuid);
if (vm == NULL) {
- lxcError(NULL, domain, VIR_ERR_INTERNAL_ERROR,
+ lxcError(VIR_ERR_INTERNAL_ERROR,
_("No such domain %s"), domain->uuid);
goto cleanup;
}
goto cleanup;
params[0].value.ul = val;
if (virStrcpyStatic(params[0].field, "cpu_shares") == NULL) {
- lxcError(NULL, domain, VIR_ERR_INTERNAL_ERROR,
+ lxcError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Field cpu_shares too big for destination"));
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN,
+ lxcError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
+ lxcError(VIR_ERR_OPERATION_INVALID,
"%s", _("Domain is not running"));
goto cleanup;
}
if (ret == 0)
ret = linuxDomainInterfaceStats(path, stats);
else
- lxcError(dom->conn, dom, VIR_ERR_INVALID_ARG,
+ lxcError(VIR_ERR_INVALID_ARG,
_("Invalid path, '%s' is not a known interface"), path);
cleanup:
lxcDomainInterfaceStats(virDomainPtr dom,
const char *path ATTRIBUTE_UNUSED,
struct _virDomainInterfaceStats *stats ATTRIBUTE_UNUSED)
- lxcError(dom->conn, dom, VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
+ lxcError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
return -1;
}
#endif
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN,
+ lxcError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN,
+ lxcError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!vm->persistent) {
- lxcError(dom->conn, dom, VIR_ERR_INTERNAL_ERROR,
+ lxcError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Cannot set autostart for transient domain"));
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN,
+ lxcError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
+ lxcError(VIR_ERR_OPERATION_INVALID,
"%s", _("Domain is not running"));
goto cleanup;
}
if (vm->state != VIR_DOMAIN_PAUSED) {
if (lxcFreezeContainer(driver, vm) < 0) {
- lxcError(dom->conn, dom, VIR_ERR_OPERATION_FAILED,
+ lxcError(VIR_ERR_OPERATION_FAILED,
"%s", _("Suspend operation failed"));
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN,
+ lxcError(VIR_ERR_NO_DOMAIN,
_("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
+ lxcError(VIR_ERR_OPERATION_INVALID,
"%s", _("Domain is not running"));
goto cleanup;
}
if (vm->state == VIR_DOMAIN_PAUSED) {
if (lxcUnfreezeContainer(driver, vm) < 0) {
- lxcError(dom->conn, dom, VIR_ERR_OPERATION_FAILED,
+ lxcError(VIR_ERR_OPERATION_FAILED,
"%s", _("Resume operation failed"));
goto cleanup;
}