[libvirt] [sandbox PATCH 0/2] v1.1 bugfix: support dhcp network interfaces

Resubmitted to add "sandbox PATCH" to Subject v1.1 adds some documentation changes. Support for a network such as -N dhcp,source=default was not working in that dhclient was not being started. Although I am not sure what the real problem is, the solution is to use g_spawn_sync() instead of g_spawn_async() to start /sbin/dhclient. The second patch addes "-v" to the dhclient arguments to improve debugging info. The dhclient into will be in /var/log/messages the Secure Contrainer host system and not in the container itself. Gene Czarcinski (2): v1.1 for dhclient use g_spawn_sync() v1.1 add -v to dhclient parameter arguments libvirt-sandbox/libvirt-sandbox-init-common.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) -- 1.9.3

This patch addresses problem RHBZ #1133686. For some (unknown to me) reason, g_spawn_async() is not starting dhclient so that a dhcp NIC can be configured. However, simply using g_spawn_sync() works. This was the only use of g_spawn_async(). Note: There is no problem using sync instead of async since dhclient will disconnect and put itself in the background once the network is started. --- libvirt-sandbox/libvirt-sandbox-init-common.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libvirt-sandbox/libvirt-sandbox-init-common.c b/libvirt-sandbox/libvirt-sandbox-init-common.c index e5f8af0..49baa5c 100644 --- a/libvirt-sandbox/libvirt-sandbox-init-common.c +++ b/libvirt-sandbox/libvirt-sandbox-init-common.c @@ -113,10 +113,8 @@ static gboolean start_dhcp(const gchar *devname, GError **error) { const gchar *argv[] = { "/sbin/dhclient", "--no-pid", devname, NULL }; - if (!g_spawn_async(NULL, (gchar**)argv, NULL, - G_SPAWN_STDOUT_TO_DEV_NULL | - G_SPAWN_STDERR_TO_DEV_NULL, - NULL, NULL, NULL, error)) + if (!g_spawn_sync(NULL, (gchar**)argv, NULL, 0, + NULL, NULL, NULL, NULL, NULL, error)) return FALSE; return TRUE; -- 1.9.3

This patch improves the ability to understand what is happening with dchlient and is obviously optional. --- libvirt-sandbox/libvirt-sandbox-init-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libvirt-sandbox/libvirt-sandbox-init-common.c b/libvirt-sandbox/libvirt-sandbox-init-common.c index 49baa5c..056cbc2 100644 --- a/libvirt-sandbox/libvirt-sandbox-init-common.c +++ b/libvirt-sandbox/libvirt-sandbox-init-common.c @@ -111,7 +111,7 @@ start_shell(void) static gboolean start_dhcp(const gchar *devname, GError **error) { - const gchar *argv[] = { "/sbin/dhclient", "--no-pid", devname, NULL }; + const gchar *argv[] = { "/sbin/dhclient", "-v", "--no-pid", devname, NULL }; if (!g_spawn_sync(NULL, (gchar**)argv, NULL, 0, NULL, NULL, NULL, NULL, NULL, error)) -- 1.9.3

On 31.10.2014 19:02, Gene Czarcinski wrote:
Resubmitted to add "sandbox PATCH" to Subject
v1.1 adds some documentation changes.
Support for a network such as -N dhcp,source=default was not working in that dhclient was not being started. Although I am not sure what the real problem is, the solution is to use g_spawn_sync() instead of g_spawn_async() to start /sbin/dhclient.
The second patch addes "-v" to the dhclient arguments to improve debugging info. The dhclient into will be in /var/log/messages the Secure Contrainer host system and not in the container itself.
Gene Czarcinski (2): v1.1 for dhclient use g_spawn_sync() v1.1 add -v to dhclient parameter arguments
libvirt-sandbox/libvirt-sandbox-init-common.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
Even though this is not rebased as I asked (I still get conflicts when trying to apply the patches), I've resolved the conflicts, ACKed and pushed. Michal
participants (2)
-
Gene Czarcinski
-
Michal Privoznik