LXC messages cleanup and fix lxcError

* src/lxc/lxc_container.c src/lxc/lxc_controller.c src/lxc/lxc_driver.c
  src/lxc/veth.c: most of cleanups are just capitalizing their messages
  though, some fixes wrong error messages and awkward indentations, and
  improves error messages.
This commit is contained in:
Ryota Ozaki 2009-11-05 13:39:09 +01:00 committed by Daniel Veillard
parent 15941b2bc7
commit 24e3b35c6c
4 changed files with 97 additions and 97 deletions

View File

@ -184,7 +184,7 @@ int lxcContainerSendContinue(int control)
writeCount = safewrite(control, &msg, sizeof(msg)); writeCount = safewrite(control, &msg, sizeof(msg));
if (writeCount != sizeof(msg)) { if (writeCount != sizeof(msg)) {
virReportSystemError(NULL, errno, "%s", virReportSystemError(NULL, errno, "%s",
_("unable to send container continue message")); _("Unable to send container continue message"));
goto error_out; goto error_out;
} }
@ -295,7 +295,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root)
/* root->parent must be private, so make / private. */ /* root->parent must be private, so make / private. */
if (mount("", "/", NULL, MS_PRIVATE|MS_REC, NULL) < 0) { if (mount("", "/", NULL, MS_PRIVATE|MS_REC, NULL) < 0) {
virReportSystemError(NULL, errno, "%s", virReportSystemError(NULL, errno, "%s",
_("failed to make root private")); _("Failed to make root private"));
goto err; goto err;
} }
@ -306,7 +306,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root)
if ((rc = virFileMakePath(oldroot)) < 0) { if ((rc = virFileMakePath(oldroot)) < 0) {
virReportSystemError(NULL, rc, virReportSystemError(NULL, rc,
_("failed to create %s"), _("Failed to create %s"),
oldroot); oldroot);
goto err; goto err;
} }
@ -315,7 +315,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root)
* on separate filesystems */ * on separate filesystems */
if (mount("tmprootfs", oldroot, "tmpfs", 0, NULL) < 0) { if (mount("tmprootfs", oldroot, "tmpfs", 0, NULL) < 0) {
virReportSystemError(NULL, errno, virReportSystemError(NULL, errno,
_("failed to mount empty tmpfs at %s"), _("Failed to mount empty tmpfs at %s"),
oldroot); oldroot);
goto err; goto err;
} }
@ -328,7 +328,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root)
if ((rc = virFileMakePath(newroot)) < 0) { if ((rc = virFileMakePath(newroot)) < 0) {
virReportSystemError(NULL, rc, virReportSystemError(NULL, rc,
_("failed to create %s"), _("Failed to create %s"),
newroot); newroot);
goto err; goto err;
} }
@ -336,7 +336,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root)
/* ... and mount our root onto it */ /* ... and mount our root onto it */
if (mount(root->src, newroot, NULL, MS_BIND|MS_REC, NULL) < 0) { if (mount(root->src, newroot, NULL, MS_BIND|MS_REC, NULL) < 0) {
virReportSystemError(NULL, errno, virReportSystemError(NULL, errno,
_("failed to bind new root %s into tmpfs"), _("Failed to bind new root %s into tmpfs"),
root->src); root->src);
goto err; goto err;
} }
@ -345,7 +345,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root)
* root->src bind-mounted onto '/new' */ * root->src bind-mounted onto '/new' */
if (chdir(newroot) < 0) { if (chdir(newroot) < 0) {
virReportSystemError(NULL, errno, virReportSystemError(NULL, errno,
_("failed to chroot into %s"), newroot); _("Failed to chroot into %s"), newroot);
goto err; goto err;
} }
@ -353,7 +353,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root)
* this and will soon be unmounted completely */ * this and will soon be unmounted completely */
if (pivot_root(".", ".oldroot") < 0) { if (pivot_root(".", ".oldroot") < 0) {
virReportSystemError(NULL, errno, "%s", virReportSystemError(NULL, errno, "%s",
_("failed to pivot root")); _("Failed to pivot root"));
goto err; goto err;
} }
@ -396,13 +396,13 @@ static int lxcContainerMountBasicFS(virDomainFSDefPtr root)
for (i = 0 ; i < ARRAY_CARDINALITY(mnts) ; i++) { for (i = 0 ; i < ARRAY_CARDINALITY(mnts) ; i++) {
if (virFileMakePath(mnts[i].dst) < 0) { if (virFileMakePath(mnts[i].dst) < 0) {
virReportSystemError(NULL, errno, virReportSystemError(NULL, errno,
_("failed to mkdir %s"), _("Failed to mkdir %s"),
mnts[i].src); mnts[i].src);
goto cleanup; goto cleanup;
} }
if (mount(mnts[i].src, mnts[i].dst, mnts[i].type, 0, NULL) < 0) { if (mount(mnts[i].src, mnts[i].dst, mnts[i].type, 0, NULL) < 0) {
virReportSystemError(NULL, errno, virReportSystemError(NULL, errno,
_("failed to mount %s on %s"), _("Failed to mount %s on %s"),
mnts[i].type, mnts[i].type); mnts[i].type, mnts[i].type);
goto cleanup; goto cleanup;
} }
@ -410,14 +410,14 @@ static int lxcContainerMountBasicFS(virDomainFSDefPtr root)
if ((rc = virFileMakePath("/dev/pts") < 0)) { if ((rc = virFileMakePath("/dev/pts") < 0)) {
virReportSystemError(NULL, rc, "%s", virReportSystemError(NULL, rc, "%s",
_("cannot create /dev/pts")); _("Cannot create /dev/pts"));
goto cleanup; goto cleanup;
} }
VIR_DEBUG("Trying to move %s to %s", devpts, "/dev/pts"); VIR_DEBUG("Trying to move %s to %s", devpts, "/dev/pts");
if ((rc = mount(devpts, "/dev/pts", NULL, MS_MOVE, NULL)) < 0) { if ((rc = mount(devpts, "/dev/pts", NULL, MS_MOVE, NULL)) < 0) {
virReportSystemError(NULL, errno, "%s", virReportSystemError(NULL, errno, "%s",
_("failed to mount /dev/pts in container")); _("Failed to mount /dev/pts in container"));
goto cleanup; goto cleanup;
} }
@ -452,7 +452,7 @@ static int lxcContainerPopulateDevices(void)
if (mknod(devs[i].path, S_IFCHR, dev) < 0 || if (mknod(devs[i].path, S_IFCHR, dev) < 0 ||
chmod(devs[i].path, devs[i].mode)) { chmod(devs[i].path, devs[i].mode)) {
virReportSystemError(NULL, errno, virReportSystemError(NULL, errno,
_("failed to make device %s"), _("Failed to make device %s"),
devs[i].path); devs[i].path);
return -1; return -1;
} }
@ -461,7 +461,7 @@ static int lxcContainerPopulateDevices(void)
if (access("/dev/pts/ptmx", W_OK) == 0) { if (access("/dev/pts/ptmx", W_OK) == 0) {
if (symlink("/dev/pts/ptmx", "/dev/ptmx") < 0) { if (symlink("/dev/pts/ptmx", "/dev/ptmx") < 0) {
virReportSystemError(NULL, errno, "%s", virReportSystemError(NULL, errno, "%s",
_("failed to create symlink /dev/ptmx to /dev/pts/ptmx")); _("Failed to create symlink /dev/ptmx to /dev/pts/ptmx"));
return -1; return -1;
} }
} else { } else {
@ -469,7 +469,7 @@ static int lxcContainerPopulateDevices(void)
if (mknod("/dev/ptmx", S_IFCHR, dev) < 0 || if (mknod("/dev/ptmx", S_IFCHR, dev) < 0 ||
chmod("/dev/ptmx", 0666)) { chmod("/dev/ptmx", 0666)) {
virReportSystemError(NULL, errno, "%s", virReportSystemError(NULL, errno, "%s",
_("failed to make device /dev/ptmx")); _("Failed to make device /dev/ptmx"));
return -1; return -1;
} }
} }
@ -499,17 +499,16 @@ static int lxcContainerMountNewFS(virDomainDefPtr vmDef)
if (virFileMakePath(vmDef->fss[i]->dst) < 0) { if (virFileMakePath(vmDef->fss[i]->dst) < 0) {
virReportSystemError(NULL, errno, virReportSystemError(NULL, errno,
_("failed to create %s"), _("Failed to create %s"),
vmDef->fss[i]->dst); vmDef->fss[i]->dst);
VIR_FREE(src); VIR_FREE(src);
return -1; return -1;
} }
if (mount(src, vmDef->fss[i]->dst, NULL, MS_BIND, NULL) < 0) { if (mount(src, vmDef->fss[i]->dst, NULL, MS_BIND, NULL) < 0) {
VIR_FREE(src);
virReportSystemError(NULL, errno, virReportSystemError(NULL, errno,
_("failed to mount %s at %s"), _("Failed to mount %s at %s"),
vmDef->fss[i]->src, src, vmDef->fss[i]->dst);
vmDef->fss[i]->dst); VIR_FREE(src);
return -1; return -1;
} }
VIR_FREE(src); VIR_FREE(src);
@ -530,7 +529,7 @@ static int lxcContainerUnmountOldFS(void)
if (!(procmnt = setmntent("/proc/mounts", "r"))) { if (!(procmnt = setmntent("/proc/mounts", "r"))) {
virReportSystemError(NULL, errno, "%s", virReportSystemError(NULL, errno, "%s",
_("failed to read /proc/mounts")); _("Failed to read /proc/mounts"));
return -1; return -1;
} }
while (getmntent_r(procmnt, &mntent, mntbuf, sizeof(mntbuf)) != NULL) { while (getmntent_r(procmnt, &mntent, mntbuf, sizeof(mntbuf)) != NULL) {
@ -559,7 +558,7 @@ static int lxcContainerUnmountOldFS(void)
VIR_DEBUG("Umount %s", mounts[i]); VIR_DEBUG("Umount %s", mounts[i]);
if (umount(mounts[i]) < 0) { if (umount(mounts[i]) < 0) {
virReportSystemError(NULL, errno, virReportSystemError(NULL, errno,
_("failed to unmount '%s'"), _("Failed to unmount '%s'"),
mounts[i]); mounts[i]);
return -1; return -1;
} }
@ -609,7 +608,7 @@ static int lxcContainerSetupExtraMounts(virDomainDefPtr vmDef)
if (mount("", "/", NULL, MS_SLAVE|MS_REC, NULL) < 0) { if (mount("", "/", NULL, MS_SLAVE|MS_REC, NULL) < 0) {
virReportSystemError(NULL, errno, "%s", virReportSystemError(NULL, errno, "%s",
_("failed to make / slave")); _("Failed to make / slave"));
return -1; return -1;
} }
for (i = 0 ; i < vmDef->nfss ; i++) { for (i = 0 ; i < vmDef->nfss ; i++) {
@ -623,7 +622,7 @@ static int lxcContainerSetupExtraMounts(virDomainDefPtr vmDef)
MS_BIND, MS_BIND,
NULL) < 0) { NULL) < 0) {
virReportSystemError(NULL, errno, virReportSystemError(NULL, errno,
_("failed to mount %s at %s"), _("Failed to mount %s at %s"),
vmDef->fss[i]->src, vmDef->fss[i]->src,
vmDef->fss[i]->dst); vmDef->fss[i]->dst);
return -1; return -1;
@ -633,7 +632,7 @@ static int lxcContainerSetupExtraMounts(virDomainDefPtr vmDef)
/* mount /proc */ /* mount /proc */
if (mount("lxcproc", "/proc", "proc", 0, NULL) < 0) { if (mount("lxcproc", "/proc", "proc", 0, NULL) < 0) {
virReportSystemError(NULL, errno, "%s", virReportSystemError(NULL, errno, "%s",
_("failed to mount /proc")); _("Failed to mount /proc"));
return -1; return -1;
} }
@ -672,20 +671,20 @@ static int lxcContainerDropCapabilities(void)
CAP_MAC_ADMIN, /* No messing with LSM config */ CAP_MAC_ADMIN, /* No messing with LSM config */
-1 /* sentinal */)) < 0) { -1 /* sentinal */)) < 0) {
lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR, lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR,
_("failed to remove capabilities %d"), ret); _("Failed to remove capabilities: %d"), ret);
return -1; return -1;
} }
if ((ret = capng_apply(CAPNG_SELECT_BOTH)) < 0) { if ((ret = capng_apply(CAPNG_SELECT_BOTH)) < 0) {
lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR, lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR,
_("failed to apply capabilities: %d"), ret); _("Failed to apply capabilities: %d"), ret);
return -1; return -1;
} }
/* Need to prevent them regaining any caps on exec */ /* Need to prevent them regaining any caps on exec */
if ((ret = capng_lock()) < 0) { if ((ret = capng_lock()) < 0) {
lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR, lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR,
_("failed to lock capabilities: %d"), ret); _("Failed to lock capabilities: %d"), ret);
return -1; return -1;
} }
@ -739,7 +738,7 @@ static int lxcContainerChild( void *data )
ttyfd = open(ttyPath, O_RDWR|O_NOCTTY); ttyfd = open(ttyPath, O_RDWR|O_NOCTTY);
if (ttyfd < 0) { if (ttyfd < 0) {
virReportSystemError(NULL, errno, virReportSystemError(NULL, errno,
_("failed to open tty %s"), _("Failed to open tty %s"),
ttyPath); ttyPath);
return -1; return -1;
} }
@ -820,7 +819,7 @@ int lxcContainerStart(virDomainDefPtr def,
if (pid < 0) { if (pid < 0) {
virReportSystemError(NULL, errno, "%s", virReportSystemError(NULL, errno, "%s",
_("failed to run clone container")); _("Failed to run clone container"));
return -1; return -1;
} }

View File

@ -330,7 +330,7 @@ static int lxcControllerMain(int monitor,
epollEvent.data.fd = monitor; epollEvent.data.fd = monitor;
if (0 > epoll_ctl(epollFd, EPOLL_CTL_ADD, monitor, &epollEvent)) { if (0 > epoll_ctl(epollFd, EPOLL_CTL_ADD, monitor, &epollEvent)) {
virReportSystemError(NULL, errno, "%s", virReportSystemError(NULL, errno, "%s",
_("epoll_ctl(contPty) failed")); _("epoll_ctl(monitor) failed"));
goto cleanup; goto cleanup;
} }
@ -338,7 +338,7 @@ static int lxcControllerMain(int monitor,
epollEvent.data.fd = client; epollEvent.data.fd = client;
if (0 > epoll_ctl(epollFd, EPOLL_CTL_ADD, client, &epollEvent)) { if (0 > epoll_ctl(epollFd, EPOLL_CTL_ADD, client, &epollEvent)) {
virReportSystemError(NULL, errno, "%s", virReportSystemError(NULL, errno, "%s",
_("epoll_ctl(contPty) failed")); _("epoll_ctl(client) failed"));
goto cleanup; goto cleanup;
} }
@ -358,13 +358,13 @@ static int lxcControllerMain(int monitor,
epollEvent.data.fd = client; epollEvent.data.fd = client;
if (0 > epoll_ctl(epollFd, EPOLL_CTL_ADD, client, &epollEvent)) { if (0 > epoll_ctl(epollFd, EPOLL_CTL_ADD, client, &epollEvent)) {
virReportSystemError(NULL, errno, "%s", virReportSystemError(NULL, errno, "%s",
_("epoll_ctl(contPty) failed")); _("epoll_ctl(client) failed"));
goto cleanup; goto cleanup;
} }
} else if (client != -1 && epollEvent.data.fd == client) { } else if (client != -1 && epollEvent.data.fd == client) {
if (0 > epoll_ctl(epollFd, EPOLL_CTL_DEL, client, &epollEvent)) { if (0 > epoll_ctl(epollFd, EPOLL_CTL_DEL, client, &epollEvent)) {
virReportSystemError(NULL, errno, "%s", virReportSystemError(NULL, errno, "%s",
_("epoll_ctl(contPty) failed")); _("epoll_ctl(client) failed"));
goto cleanup; goto cleanup;
} }
close(client); close(client);
@ -452,7 +452,7 @@ static int lxcControllerMoveInterfaces(unsigned int nveths,
for (i = 0 ; i < nveths ; i++) for (i = 0 ; i < nveths ; i++)
if (moveInterfaceToNetNs(veths[i], container) < 0) { if (moveInterfaceToNetNs(veths[i], container) < 0) {
lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR, lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR,
_("failed to move interface %s to ns %d"), _("Failed to move interface %s to ns %d"),
veths[i], container); veths[i], container);
return -1; return -1;
} }
@ -477,7 +477,7 @@ static int lxcControllerCleanupInterfaces(unsigned int nveths,
for (i = 0 ; i < nveths ; i++) for (i = 0 ; i < nveths ; i++)
if (vethDelete(veths[i]) < 0) if (vethDelete(veths[i]) < 0)
lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR, lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR,
_("failed to delete veth: %s"), veths[i]); _("Failed to delete veth: %s"), veths[i]);
/* will continue to try to cleanup any other interfaces */ /* will continue to try to cleanup any other interfaces */
return 0; return 0;
@ -540,13 +540,13 @@ lxcControllerRun(virDomainDefPtr def,
VIR_DEBUG0("Setting up private /dev/pts"); VIR_DEBUG0("Setting up private /dev/pts");
if (unshare(CLONE_NEWNS) < 0) { if (unshare(CLONE_NEWNS) < 0) {
virReportSystemError(NULL, errno, "%s", virReportSystemError(NULL, errno, "%s",
_("cannot unshare mount namespace")); _("Cannot unshare mount namespace"));
goto cleanup; goto cleanup;
} }
if (mount("", "/", NULL, MS_SLAVE|MS_REC, NULL) < 0) { if (mount("", "/", NULL, MS_SLAVE|MS_REC, NULL) < 0) {
virReportSystemError(NULL, errno, "%s", virReportSystemError(NULL, errno, "%s",
_("failed to switch root mount into slave mode")); _("Failed to switch root mount into slave mode"));
goto cleanup; goto cleanup;
} }
@ -558,7 +558,7 @@ lxcControllerRun(virDomainDefPtr def,
if (virFileMakePath(devpts) < 0) { if (virFileMakePath(devpts) < 0) {
virReportSystemError(NULL, errno, virReportSystemError(NULL, errno,
_("failed to make path %s"), _("Failed to make path %s"),
devpts); devpts);
goto cleanup; goto cleanup;
} }
@ -566,13 +566,13 @@ lxcControllerRun(virDomainDefPtr def,
VIR_DEBUG("Mouting 'devpts' on %s", devpts); VIR_DEBUG("Mouting 'devpts' on %s", devpts);
if (mount("devpts", devpts, "devpts", 0, "newinstance,ptmxmode=0666") < 0) { if (mount("devpts", devpts, "devpts", 0, "newinstance,ptmxmode=0666") < 0) {
virReportSystemError(NULL, errno, virReportSystemError(NULL, errno,
_("failed to mount devpts on %s"), _("Failed to mount devpts on %s"),
devpts); devpts);
goto cleanup; goto cleanup;
} }
if (access(devptmx, R_OK) < 0) { if (access(devptmx, R_OK) < 0) {
VIR_WARN0("kernel does not support private devpts, using shared devpts"); VIR_WARN0("Kernel does not support private devpts, using shared devpts");
VIR_FREE(devptmx); VIR_FREE(devptmx);
} }
} }
@ -584,7 +584,7 @@ lxcControllerRun(virDomainDefPtr def,
&containerPtyPath, &containerPtyPath,
0) < 0) { 0) < 0) {
virReportSystemError(NULL, errno, "%s", virReportSystemError(NULL, errno, "%s",
_("failed to allocate tty")); _("Failed to allocate tty"));
goto cleanup; goto cleanup;
} }
} else { } else {
@ -593,7 +593,7 @@ lxcControllerRun(virDomainDefPtr def,
&containerPtyPath, &containerPtyPath,
0) < 0) { 0) < 0) {
virReportSystemError(NULL, errno, "%s", virReportSystemError(NULL, errno, "%s",
_("failed to allocate tty")); _("Failed to allocate tty"));
goto cleanup; goto cleanup;
} }
} }
@ -801,7 +801,7 @@ int main(int argc, char *argv[])
/* Accept initial client which is the libvirtd daemon */ /* Accept initial client which is the libvirtd daemon */
if ((client = accept(monitor, NULL, 0)) < 0) { if ((client = accept(monitor, NULL, 0)) < 0) {
virReportSystemError(NULL, errno, "%s", virReportSystemError(NULL, errno, "%s",
_("Failed connection from LXC driver")); _("Failed to accept a connection from driver"));
goto cleanup; goto cleanup;
} }

View File

@ -98,7 +98,7 @@ static virDrvOpenStatus lxcOpen(virConnectPtr conn,
/* If path isn't '/' then they typoed, tell them correct path */ /* If path isn't '/' then they typoed, tell them correct path */
if (STRNEQ(conn->uri->path, "/")) { if (STRNEQ(conn->uri->path, "/")) {
lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR, lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR,
_("unexpected LXC URI path '%s', try lxc:///"), _("Unexpected LXC URI path '%s', try lxc:///"),
conn->uri->path); conn->uri->path);
return VIR_DRV_OPEN_ERROR; return VIR_DRV_OPEN_ERROR;
} }
@ -288,7 +288,7 @@ static virDomainPtr lxcDomainDefine(virConnectPtr conn, const char *xml)
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(vm->def->uuid, uuidstr); virUUIDFormat(vm->def->uuid, uuidstr);
lxcError(conn, NULL, VIR_ERR_OPERATION_FAILED, lxcError(conn, NULL, VIR_ERR_OPERATION_FAILED,
_("domain '%s' is already defined with uuid %s"), _("Domain '%s' is already defined with uuid %s"),
vm->def->name, uuidstr); vm->def->name, uuidstr);
goto cleanup; goto cleanup;
} }
@ -303,7 +303,7 @@ static virDomainPtr lxcDomainDefine(virConnectPtr conn, const char *xml)
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(vm->def->uuid, uuidstr); virUUIDFormat(vm->def->uuid, uuidstr);
lxcError(conn, NULL, VIR_ERR_OPERATION_FAILED, lxcError(conn, NULL, VIR_ERR_OPERATION_FAILED,
_("domain '%s' is already defined with uuid %s"), _("Domain '%s' is already defined with uuid %s"),
def->name, uuidstr); def->name, uuidstr);
goto cleanup; goto cleanup;
} }
@ -360,19 +360,19 @@ static int lxcDomainUndefine(virDomainPtr dom)
vm = virDomainFindByUUID(&driver->domains, dom->uuid); vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) { if (!vm) {
lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN, lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
"%s", _("no domain with matching uuid")); "%s", _("No domain with matching uuid"));
goto cleanup; goto cleanup;
} }
if (virDomainObjIsActive(vm)) { if (virDomainObjIsActive(vm)) {
lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID, lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
"%s", _("cannot delete active domain")); "%s", _("Cannot delete active domain"));
goto cleanup; goto cleanup;
} }
if (!vm->persistent) { if (!vm->persistent) {
lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID, lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
"%s", _("cannot undefine transient domain")); "%s", _("Cannot undefine transient domain"));
goto cleanup; goto cleanup;
} }
@ -412,7 +412,7 @@ static int lxcDomainGetInfo(virDomainPtr dom,
if (!vm) { if (!vm) {
lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN, lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
"%s", _("no domain with matching uuid")); "%s", _("No domain with matching uuid"));
goto cleanup; goto cleanup;
} }
@ -424,18 +424,18 @@ static int lxcDomainGetInfo(virDomainPtr dom,
} else { } else {
if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) { if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
lxcError(dom->conn, dom, VIR_ERR_INTERNAL_ERROR, lxcError(dom->conn, dom, VIR_ERR_INTERNAL_ERROR,
_("Unable to get cgroup for %s\n"), vm->def->name); _("Unable to get cgroup for %s"), vm->def->name);
goto cleanup; goto cleanup;
} }
if (virCgroupGetCpuacctUsage(cgroup, &(info->cpuTime)) < 0) { if (virCgroupGetCpuacctUsage(cgroup, &(info->cpuTime)) < 0) {
lxcError(dom->conn, dom, VIR_ERR_OPERATION_FAILED, lxcError(dom->conn, dom, VIR_ERR_OPERATION_FAILED,
"%s", _("cannot read cputime for domain")); "%s", _("Cannot read cputime for domain"));
goto cleanup; goto cleanup;
} }
if (virCgroupGetMemoryUsage(cgroup, &(info->memory)) < 0) { if (virCgroupGetMemoryUsage(cgroup, &(info->memory)) < 0) {
lxcError(dom->conn, dom, VIR_ERR_OPERATION_FAILED, lxcError(dom->conn, dom, VIR_ERR_OPERATION_FAILED,
"%s", _("cannot read memory usage for domain")); "%s", _("Cannot read memory usage for domain"));
goto cleanup; goto cleanup;
} }
} }
@ -465,7 +465,7 @@ static char *lxcGetOSType(virDomainPtr dom)
if (!vm) { if (!vm) {
lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN, lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
"%s", _("no domain with matching uuid")); "%s", _("No domain with matching uuid"));
goto cleanup; goto cleanup;
} }
@ -491,7 +491,7 @@ static unsigned long lxcDomainGetMaxMemory(virDomainPtr dom) {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr); virUUIDFormat(dom->uuid, uuidstr);
lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN, lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr); _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup; goto cleanup;
} }
@ -516,13 +516,13 @@ static int lxcDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr); virUUIDFormat(dom->uuid, uuidstr);
lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN, lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr); _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup; goto cleanup;
} }
if (newmax < vm->def->memory) { if (newmax < vm->def->memory) {
lxcError(dom->conn, dom, VIR_ERR_INVALID_ARG, lxcError(dom->conn, dom, VIR_ERR_INVALID_ARG,
"%s", _("cannot set max memory lower than current memory")); "%s", _("Cannot set max memory lower than current memory"));
goto cleanup; goto cleanup;
} }
@ -548,13 +548,13 @@ static int lxcDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr); virUUIDFormat(dom->uuid, uuidstr);
lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN, lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr); _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup; goto cleanup;
} }
if (newmem > vm->def->maxmem) { if (newmem > vm->def->maxmem) {
lxcError(dom->conn, dom, VIR_ERR_INVALID_ARG, lxcError(dom->conn, dom, VIR_ERR_INVALID_ARG,
"%s", _("cannot set memory higher than max memory")); "%s", _("Cannot set memory higher than max memory"));
goto cleanup; goto cleanup;
} }
@ -567,7 +567,7 @@ static int lxcDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
if (virCgroupSetMemory(cgroup, newmem) < 0) { if (virCgroupSetMemory(cgroup, newmem) < 0) {
lxcError(dom->conn, dom, VIR_ERR_OPERATION_FAILED, lxcError(dom->conn, dom, VIR_ERR_OPERATION_FAILED,
"%s", _("cannot set memory for domain")); "%s", _("Failed to set memory for domain"));
goto cleanup; goto cleanup;
} }
} else { } else {
@ -596,7 +596,7 @@ static char *lxcDomainDumpXML(virDomainPtr dom,
if (!vm) { if (!vm) {
lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN, lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
"%s", _("no domain with matching uuid")); "%s", _("No domain with matching uuid"));
goto cleanup; goto cleanup;
} }
@ -733,7 +733,7 @@ static int lxcSetupInterfaces(virConnectPtr conn,
DEBUG("bridge: %s", bridge); DEBUG("bridge: %s", bridge);
if (NULL == bridge) { if (NULL == bridge) {
lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR, lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to get bridge for interface")); "%s", _("Failed to get bridge for interface"));
goto error_exit; goto error_exit;
} }
@ -744,7 +744,7 @@ static int lxcSetupInterfaces(virConnectPtr conn,
DEBUG("parentVeth: %s, containerVeth: %s", parentVeth, containerVeth); DEBUG("parentVeth: %s, containerVeth: %s", parentVeth, containerVeth);
if (0 != (rc = vethCreate(parentVeth, PATH_MAX, containerVeth, PATH_MAX))) { if (0 != (rc = vethCreate(parentVeth, PATH_MAX, containerVeth, PATH_MAX))) {
lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR, lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR,
_("failed to create veth device pair: %d"), rc); _("Failed to create veth device pair: %d"), rc);
goto error_exit; goto error_exit;
} }
if (NULL == def->nets[i]->ifname) { if (NULL == def->nets[i]->ifname) {
@ -757,7 +757,7 @@ static int lxcSetupInterfaces(virConnectPtr conn,
if (NULL == def->nets[i]->ifname) { if (NULL == def->nets[i]->ifname) {
lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR, lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to allocate veth names")); "%s", _("Failed to allocate veth names"));
goto error_exit; goto error_exit;
} }
@ -766,7 +766,7 @@ static int lxcSetupInterfaces(virConnectPtr conn,
virFormatMacAddr(def->nets[i]->mac, macaddr); virFormatMacAddr(def->nets[i]->mac, macaddr);
if (0 != (rc = setMacAddr(containerVeth, macaddr))) { if (0 != (rc = setMacAddr(containerVeth, macaddr))) {
virReportSystemError(conn, rc, virReportSystemError(conn, rc,
_("failed to set %s to %s"), _("Failed to set %s to %s"),
macaddr, containerVeth); macaddr, containerVeth);
goto error_exit; goto error_exit;
} }
@ -774,14 +774,15 @@ static int lxcSetupInterfaces(virConnectPtr conn,
if (0 != (rc = brAddInterface(brctl, bridge, parentVeth))) { if (0 != (rc = brAddInterface(brctl, bridge, parentVeth))) {
virReportSystemError(conn, rc, virReportSystemError(conn, rc,
_("failed to add %s device to %s"), _("Failed to add %s device to %s"),
parentVeth, bridge); parentVeth, bridge);
goto error_exit; goto error_exit;
} }
if (0 != (rc = vethInterfaceUpOrDown(parentVeth, 1))) { if (0 != (rc = vethInterfaceUpOrDown(parentVeth, 1))) {
virReportSystemError(conn, rc, "%s", virReportSystemError(conn, rc,
_("failed to enable parent ns veth device")); _("Failed to enable %s device"),
parentVeth);
goto error_exit; goto error_exit;
} }
@ -811,7 +812,7 @@ static int lxcMonitorClient(virConnectPtr conn,
if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) { if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
virReportSystemError(conn, errno, "%s", virReportSystemError(conn, errno, "%s",
_("failed to create client socket")); _("Failed to create client socket"));
goto error; goto error;
} }
@ -825,7 +826,7 @@ static int lxcMonitorClient(virConnectPtr conn,
if (connect(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) { if (connect(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
virReportSystemError(conn, errno, "%s", virReportSystemError(conn, errno, "%s",
_("failed to connect to client socket")); _("Failed to connect to client socket"));
goto error; goto error;
} }
@ -850,14 +851,14 @@ static int lxcVmTerminate(virConnectPtr conn,
if (vm->pid <= 0) { if (vm->pid <= 0) {
lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR, lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR,
_("invalid PID %d for container"), vm->pid); _("Invalid PID %d for container"), vm->pid);
return -1; return -1;
} }
if (kill(vm->pid, signum) < 0) { if (kill(vm->pid, signum) < 0) {
if (errno != ESRCH) { if (errno != ESRCH) {
virReportSystemError(conn, errno, virReportSystemError(conn, errno,
_("failed to kill pid %d"), _("Failed to kill pid %d"),
vm->pid); vm->pid);
return -1; return -1;
} }
@ -1054,14 +1055,14 @@ static int lxcControllerStart(virConnectPtr conn,
while ((rc = waitpid(child, &status, 0) == -1) && errno == EINTR); while ((rc = waitpid(child, &status, 0) == -1) && errno == EINTR);
if (rc == -1) { if (rc == -1) {
virReportSystemError(conn, errno, virReportSystemError(conn, errno,
_("cannot wait for '%s'"), _("Cannot wait for '%s'"),
largv[0]); largv[0]);
goto cleanup; goto cleanup;
} }
if (!(WIFEXITED(status) && WEXITSTATUS(status) == 0)) { if (!(WIFEXITED(status) && WEXITSTATUS(status) == 0)) {
lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR, lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR,
_("container '%s' unexpectedly shutdown during startup"), _("Container '%s' unexpectedly shutdown during startup"),
largv[0]); largv[0]);
goto cleanup; goto cleanup;
} }
@ -1116,7 +1117,7 @@ static int lxcVmStart(virConnectPtr conn,
if ((r = virFileMakePath(driver->logDir)) < 0) { if ((r = virFileMakePath(driver->logDir)) < 0) {
virReportSystemError(conn, r, virReportSystemError(conn, r,
_("cannot create log directory '%s'"), _("Cannot create log directory '%s'"),
driver->logDir); driver->logDir);
return -1; return -1;
} }
@ -1130,7 +1131,7 @@ static int lxcVmStart(virConnectPtr conn,
/* open parent tty */ /* open parent tty */
if (virFileOpenTty(&parentTty, &parentTtyPath, 1) < 0) { if (virFileOpenTty(&parentTty, &parentTtyPath, 1) < 0) {
virReportSystemError(conn, errno, "%s", virReportSystemError(conn, errno, "%s",
_("failed to allocate tty")); _("Failed to allocate tty"));
goto cleanup; goto cleanup;
} }
if (vm->def->console && if (vm->def->console &&
@ -1151,7 +1152,7 @@ static int lxcVmStart(virConnectPtr conn,
if ((logfd = open(logfile, O_WRONLY | O_APPEND | O_CREAT, if ((logfd = open(logfile, O_WRONLY | O_APPEND | O_CREAT,
S_IRUSR|S_IWUSR)) < 0) { S_IRUSR|S_IWUSR)) < 0) {
virReportSystemError(conn, errno, virReportSystemError(conn, errno,
_("failed to open '%s'"), _("Failed to open '%s'"),
logfile); logfile);
goto cleanup; goto cleanup;
} }
@ -1227,7 +1228,7 @@ static int lxcDomainStart(virDomainPtr dom)
vm = virDomainFindByName(&driver->domains, dom->name); vm = virDomainFindByName(&driver->domains, dom->name);
if (!vm) { if (!vm) {
lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN, lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
_("no domain named %s"), dom->name); _("No domain named %s"), dom->name);
goto cleanup; goto cleanup;
} }
@ -1286,7 +1287,7 @@ lxcDomainCreateAndStart(virConnectPtr conn,
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(vm->def->uuid, uuidstr); virUUIDFormat(vm->def->uuid, uuidstr);
lxcError(conn, NULL, VIR_ERR_OPERATION_FAILED, lxcError(conn, NULL, VIR_ERR_OPERATION_FAILED,
_("domain '%s' is already defined with uuid %s"), _("Domain '%s' is already defined with uuid %s"),
vm->def->name, uuidstr); vm->def->name, uuidstr);
goto cleanup; goto cleanup;
} }
@ -1294,7 +1295,7 @@ lxcDomainCreateAndStart(virConnectPtr conn,
/* UUID & name match, but if VM is already active, refuse it */ /* UUID & name match, but if VM is already active, refuse it */
if (virDomainObjIsActive(vm)) { if (virDomainObjIsActive(vm)) {
lxcError(conn, NULL, VIR_ERR_OPERATION_FAILED, lxcError(conn, NULL, VIR_ERR_OPERATION_FAILED,
_("domain is already active as '%s'"), vm->def->name); _("Domain is already active as '%s'"), vm->def->name);
goto cleanup; goto cleanup;
} }
virDomainObjUnlock(vm); virDomainObjUnlock(vm);
@ -1305,7 +1306,7 @@ lxcDomainCreateAndStart(virConnectPtr conn,
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(vm->def->uuid, uuidstr); virUUIDFormat(vm->def->uuid, uuidstr);
lxcError(conn, NULL, VIR_ERR_OPERATION_FAILED, lxcError(conn, NULL, VIR_ERR_OPERATION_FAILED,
_("domain '%s' is already defined with uuid %s"), _("Domain '%s' is already defined with uuid %s"),
def->name, uuidstr); def->name, uuidstr);
goto cleanup; goto cleanup;
} }
@ -1366,7 +1367,7 @@ static int lxcDomainShutdown(virDomainPtr dom)
vm = virDomainFindByID(&driver->domains, dom->id); vm = virDomainFindByID(&driver->domains, dom->id);
if (!vm) { if (!vm) {
lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN, lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
_("no domain with id %d"), dom->id); _("No domain with id %d"), dom->id);
goto cleanup; goto cleanup;
} }
@ -1499,7 +1500,7 @@ static int lxcDomainDestroy(virDomainPtr dom)
vm = virDomainFindByID(&driver->domains, dom->id); vm = virDomainFindByID(&driver->domains, dom->id);
if (!vm) { if (!vm) {
lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN, lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
_("no domain with id %d"), dom->id); _("No domain with id %d"), dom->id);
goto cleanup; goto cleanup;
} }
@ -1864,7 +1865,7 @@ static int lxcSetSchedulerParameters(virDomainPtr domain,
virSchedParameterPtr param = &params[i]; virSchedParameterPtr param = &params[i];
if (param->type != VIR_DOMAIN_SCHED_FIELD_ULLONG) { if (param->type != VIR_DOMAIN_SCHED_FIELD_ULLONG) {
lxcError(NULL, domain, VIR_ERR_INVALID_ARG, "%s", lxcError(NULL, domain, VIR_ERR_INVALID_ARG, "%s",
_("invalid type for cpu_shares tunable, expected a 'ullong'")); _("Invalid type for cpu_shares tunable, expected a 'ullong'"));
goto cleanup; goto cleanup;
} }
@ -1952,7 +1953,7 @@ static int lxcDomainGetAutostart(virDomainPtr dom,
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr); virUUIDFormat(dom->uuid, uuidstr);
lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN, lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr); _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup; goto cleanup;
} }
@ -1979,13 +1980,13 @@ static int lxcDomainSetAutostart(virDomainPtr dom,
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr); virUUIDFormat(dom->uuid, uuidstr);
lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN, lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr); _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup; goto cleanup;
} }
if (!vm->persistent) { if (!vm->persistent) {
lxcError(dom->conn, dom, VIR_ERR_INTERNAL_ERROR, lxcError(dom->conn, dom, VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot set autostart for transient domain")); "%s", _("Cannot set autostart for transient domain"));
goto cleanup; goto cleanup;
} }
@ -2002,7 +2003,7 @@ static int lxcDomainSetAutostart(virDomainPtr dom,
if ((err = virFileMakePath(driver->autostartDir))) { if ((err = virFileMakePath(driver->autostartDir))) {
virReportSystemError(dom->conn, err, virReportSystemError(dom->conn, err,
_("cannot create autostart directory %s"), _("Cannot create autostart directory %s"),
driver->autostartDir); driver->autostartDir);
goto cleanup; goto cleanup;
} }
@ -2141,20 +2142,20 @@ static int lxcDomainSuspend(virDomainPtr dom)
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr); virUUIDFormat(dom->uuid, uuidstr);
lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN, lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr); _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup; goto cleanup;
} }
if (!virDomainObjIsActive(vm)) { if (!virDomainObjIsActive(vm)) {
lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID, lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running")); "%s", _("Domain is not running"));
goto cleanup; goto cleanup;
} }
if (vm->state != VIR_DOMAIN_PAUSED) { if (vm->state != VIR_DOMAIN_PAUSED) {
if (lxcFreezeContainer(driver, vm) < 0) { if (lxcFreezeContainer(driver, vm) < 0) {
lxcError(dom->conn, dom, VIR_ERR_OPERATION_FAILED, lxcError(dom->conn, dom, VIR_ERR_OPERATION_FAILED,
"%s", _("suspend operation failed")); "%s", _("Suspend operation failed"));
goto cleanup; goto cleanup;
} }
vm->state = VIR_DOMAIN_PAUSED; vm->state = VIR_DOMAIN_PAUSED;
@ -2206,20 +2207,20 @@ static int lxcDomainResume(virDomainPtr dom)
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr); virUUIDFormat(dom->uuid, uuidstr);
lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN, lxcError(dom->conn, dom, VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr); _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup; goto cleanup;
} }
if (!virDomainObjIsActive(vm)) { if (!virDomainObjIsActive(vm)) {
lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID, lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running")); "%s", _("Domain is not running"));
goto cleanup; goto cleanup;
} }
if (vm->state == VIR_DOMAIN_PAUSED) { if (vm->state == VIR_DOMAIN_PAUSED) {
if (lxcUnfreezeContainer(driver, vm) < 0) { if (lxcUnfreezeContainer(driver, vm) < 0) {
lxcError(dom->conn, dom, VIR_ERR_OPERATION_FAILED, lxcError(dom->conn, dom, VIR_ERR_OPERATION_FAILED,
"%s", _("resume operation failed")); "%s", _("Resume operation failed"));
goto cleanup; goto cleanup;
} }
vm->state = VIR_DOMAIN_RUNNING; vm->state = VIR_DOMAIN_RUNNING;

View File

@ -92,13 +92,13 @@ int vethCreate(char* veth1, int veth1MaxLen,
while ((1 > strlen(veth1)) || STREQ(veth1, veth2)) { while ((1 > strlen(veth1)) || STREQ(veth1, veth2)) {
vethDev = getFreeVethName(veth1, veth1MaxLen, 0); vethDev = getFreeVethName(veth1, veth1MaxLen, 0);
++vethDev; ++vethDev;
DEBUG("assigned veth1: %s", veth1); DEBUG("Assigned veth1: %s", veth1);
} }
while ((1 > strlen(veth2)) || STREQ(veth1, veth2)) { while ((1 > strlen(veth2)) || STREQ(veth1, veth2)) {
vethDev = getFreeVethName(veth2, veth2MaxLen, vethDev); vethDev = getFreeVethName(veth2, veth2MaxLen, vethDev);
++vethDev; ++vethDev;
DEBUG("assigned veth2: %s", veth2); DEBUG("Assigned veth2: %s", veth2);
} }
DEBUG("veth1: %s veth2: %s", veth1, veth2); DEBUG("veth1: %s veth2: %s", veth1, veth2);