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

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 09/10/2014 07:37 AM, Gene Czarcinski wrote:
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(-)
Ping. Sure would be nice if -N dhcp worked for Secure Containers. Gene

On 10/09/2014 04:46 PM, Gene Czarcinski wrote:
On 09/10/2014 07:37 AM, Gene Czarcinski wrote:
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(-)
Ping. Sure would be nice if -N dhcp worked for Secure Containers.
Hmm... To quote something Eric Blake posted in a recent e-mail "Which project is this against? It may help to do 'git config format.subjectprefix "$proj PATCH"' to let reviewers know to look in libvirt-$proj.git instead of libvirt.git for applying this patch, for the appropriate value of $proj." Since I see 'libvirt-sandbox' - I'll assume that's what it is and added that to the reply so that perhaps someone will know to look for this. John
Gene
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 10.09.2014 13:37, Gene Czarcinski wrote:
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(-)
I'm having some difficulties applying these patches. Can you rebase and resend? Michal
participants (3)
-
Gene Czarcinski
-
John Ferlan
-
Michal Privoznik