[libvirt] [PATCH] Add some misc debugging to LXC startup

From: "Daniel P. Berrange" <berrange@redhat.com> Add some debug logging of LXC wait/continue messages and uid/gid map update code. --- src/lxc/lxc_container.c | 4 ++++ src/lxc/lxc_controller.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index b37300b..282c726 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -294,6 +294,7 @@ int lxcContainerSendContinue(int control) lxc_message_t msg = LXC_CONTINUE_MSG; int writeCount = 0; + VIR_DEBUG("Send continue on fd %d", control); writeCount = safewrite(control, &msg, sizeof(msg)); if (writeCount != sizeof(msg)) { goto error_out; @@ -319,7 +320,9 @@ int lxcContainerWaitForContinue(int control) lxc_message_t msg; int readLen; + VIR_DEBUG("Wait continue on fd %d", control); readLen = saferead(control, &msg, sizeof(msg)); + VIR_DEBUG("Got continue on fd %d %d", control, readLen); if (readLen != sizeof(msg)) { if (readLen >= 0) errno = EIO; @@ -348,6 +351,7 @@ static int lxcContainerSetID(virDomainDefPtr def) * for this container. And user namespace is only enabled * when nuidmap&ngidmap is not zero */ + VIR_DEBUG("Set UID/GID to 0/0"); if (def->idmap.nuidmap && virSetUIDGID(0, 0) < 0) { virReportSystemError(errno, "%s", _("setuid or setgid failed")); diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 4c825aa..88601f1 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -1158,6 +1158,8 @@ virLXCControllerSetupUsernsMap(virDomainIdMapEntryPtr map, if (virBufferError(&map_value)) goto no_memory; + VIR_DEBUG("Set '%s' to '%s'", path, virBufferCurrentContent(&map_value)); + if (virFileWriteStr(path, virBufferCurrentContent(&map_value), 0) < 0) { virReportSystemError(errno, _("unable write to %s"), path); goto cleanup; -- 1.8.1.4

On Tue, Jul 02, 2013 at 11:22:11 +0100, Daniel Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Add some debug logging of LXC wait/continue messages and uid/gid map update code. --- src/lxc/lxc_container.c | 4 ++++ src/lxc/lxc_controller.c | 2 ++ 2 files changed, 6 insertions(+)
ACK Jirka

On 07/02/2013 06:22 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Add some debug logging of LXC wait/continue messages and uid/gid map update code. ---
ACK, thanks!
src/lxc/lxc_container.c | 4 ++++ src/lxc/lxc_controller.c | 2 ++ 2 files changed, 6 insertions(+)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index b37300b..282c726 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -294,6 +294,7 @@ int lxcContainerSendContinue(int control) lxc_message_t msg = LXC_CONTINUE_MSG; int writeCount = 0;
+ VIR_DEBUG("Send continue on fd %d", control); writeCount = safewrite(control, &msg, sizeof(msg)); if (writeCount != sizeof(msg)) { goto error_out; @@ -319,7 +320,9 @@ int lxcContainerWaitForContinue(int control) lxc_message_t msg; int readLen;
+ VIR_DEBUG("Wait continue on fd %d", control); readLen = saferead(control, &msg, sizeof(msg)); + VIR_DEBUG("Got continue on fd %d %d", control, readLen); if (readLen != sizeof(msg)) { if (readLen >= 0) errno = EIO; @@ -348,6 +351,7 @@ static int lxcContainerSetID(virDomainDefPtr def) * for this container. And user namespace is only enabled * when nuidmap&ngidmap is not zero */
+ VIR_DEBUG("Set UID/GID to 0/0"); if (def->idmap.nuidmap && virSetUIDGID(0, 0) < 0) { virReportSystemError(errno, "%s", _("setuid or setgid failed")); diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 4c825aa..88601f1 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -1158,6 +1158,8 @@ virLXCControllerSetupUsernsMap(virDomainIdMapEntryPtr map, if (virBufferError(&map_value)) goto no_memory;
+ VIR_DEBUG("Set '%s' to '%s'", path, virBufferCurrentContent(&map_value)); + if (virFileWriteStr(path, virBufferCurrentContent(&map_value), 0) < 0) { virReportSystemError(errno, _("unable write to %s"), path); goto cleanup;
participants (3)
-
Daniel P. Berrange
-
Gao feng
-
Jiri Denemark