[PATCH 1/3] LXC: remove unnecessary check on root filesystem

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

 



After commit c131525bec5af248e3843224bc5ce8d6435760f0
"Auto-add a root <filesystem> element to LXC containers on startup"
for libvirt lxc, root must be existent.

Signed-off-by: Gao feng <gaofeng@xxxxxxxxxxxxxx>
---
 src/lxc/lxc_container.c  | 18 +++++++-----------
 src/lxc/lxc_controller.c | 11 -----------
 2 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index a1b6aff..b4be4cd 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1940,17 +1940,13 @@ static int lxcContainerChild(void *data)
     root = virDomainGetRootFilesystem(vmDef);
 
     if (argv->nttyPaths) {
-        if (root) {
-            const char *tty = argv->ttyPaths[0];
-            if (STRPREFIX(tty, "/dev/pts/"))
-                tty += strlen("/dev/pts/");
-            if (virAsprintf(&ttyPath, "%s/%s.devpts/%s",
-                            LXC_STATE_DIR, vmDef->name, tty) < 0) {
-                virReportOOMError();
-                goto cleanup;
-            }
-        } else if (VIR_STRDUP(ttyPath, argv->ttyPaths[0]) < 0) {
-                goto cleanup;
+        const char *tty = argv->ttyPaths[0];
+        if (STRPREFIX(tty, "/dev/pts/"))
+            tty += strlen("/dev/pts/");
+        if (virAsprintf(&ttyPath, "%s/%s.devpts/%s",
+                        LXC_STATE_DIR, vmDef->name, tty) < 0) {
+            virReportOOMError();
+            goto cleanup;
         }
     } else if (VIR_STRDUP(ttyPath, "/dev/null") < 0) {
             goto cleanup;
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 730236e..2f01958 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -1280,22 +1280,11 @@ cleanup:
 static int
 virLXCControllerSetupDevPTS(virLXCControllerPtr ctrl)
 {
-    virDomainFSDefPtr root = virDomainGetRootFilesystem(ctrl->def);
     char *mount_options = NULL;
     char *opts = NULL;
     char *devpts = NULL;
     int ret = -1;
 
-    if (!root) {
-        if (ctrl->nconsoles != 1) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("Expected exactly one console, but got %zu"),
-                           ctrl->nconsoles);
-            return -1;
-        }
-        return 0;
-    }
-
     VIR_DEBUG("Setting up private /dev/pts");
 
     /*
-- 
1.8.1.4

--
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]