[PATCH 02/16] Current virt-sandbox-service-util only supports service sandbox/containers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We need to add support for interactive sandbox/containers for OpenShift.

This patch will create the correct container type based off the /etc/libvirt-sandbox/service/*

Signed-off-by: Dan Walsh <dwalsh@xxxxxxxxxx>
---
 bin/virt-sandbox-service-util.c | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/bin/virt-sandbox-service-util.c b/bin/virt-sandbox-service-util.c
index 430518f..2630109 100644
--- a/bin/virt-sandbox-service-util.c
+++ b/bin/virt-sandbox-service-util.c
@@ -352,6 +352,7 @@ static gboolean libvirt_lxc_attach(const gchar *option_name,
 
 int main(int argc, char **argv) {
     GMainLoop *loop = NULL;
+    GVirSandboxConfigInteractive *interactive_cfg = NULL;
     GVirSandboxConfigService *cfg = NULL;
     GVirSandboxConfig *config = NULL;
     GVirSandboxContext *ctx = NULL;
@@ -360,7 +361,6 @@ int main(int argc, char **argv) {
     int ret = EXIT_FAILURE;
     pid_t pid = 0;
     gchar *buf=NULL;
-    GVirSandboxContextService *service;
     gchar *uri = NULL;
     gchar *command = NULL;
 
@@ -451,16 +451,28 @@ int main(int argc, char **argv) {
         goto cleanup;
     }
 
-    cfg = GVIR_SANDBOX_CONFIG_SERVICE(config);
+    if (GVIR_SANDBOX_IS_CONFIG_INTERACTIVE(config)) {
+        GVirSandboxContextInteractive *service;
+        interactive_cfg = GVIR_SANDBOX_CONFIG_INTERACTIVE(config);
 
-    if (!(service = gvir_sandbox_context_service_new(hv, cfg))) {
-        g_printerr(_("Unable to create new context service: %s\n"),
-                   err && err->message ? err->message : _("unknown"));
-        goto cleanup;
+        if (!(service = gvir_sandbox_context_interactive_new(hv, interactive_cfg))) {
+                g_printerr(_("Unable to create new context service: %s\n"),
+                           err && err->message ? err->message : _("unknown"));
+                goto cleanup;
+        }
+        ctx = GVIR_SANDBOX_CONTEXT(service);
+    } else {
+        GVirSandboxContextService *service;
+        cfg = GVIR_SANDBOX_CONFIG_SERVICE(config);
+
+        if (!(service = gvir_sandbox_context_service_new(hv, cfg))) {
+                g_printerr(_("Unable to create new context service: %s\n"),
+                           err && err->message ? err->message : _("unknown"));
+                goto cleanup;
+        }
+        ctx = GVIR_SANDBOX_CONTEXT(service);
     }
 
-    ctx = GVIR_SANDBOX_CONTEXT(service);
-
     if (command) {
         container_execute(ctx, command, pid);
     }
@@ -475,6 +487,9 @@ cleanup:
 
     free(buf);
 
+    if (interactive_cfg)
+        g_object_unref(interactive_cfg);
+
     if (cfg)
         g_object_unref(cfg);
 
-- 
1.8.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]