Re: [PATCH] Require at least one console for LXC domain

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

 



On Fri, Oct 31, 2014 at 10:22:25AM +0100, Ján Tomko wrote:
A domain without a console quietly dies soon after start,
because we try to set /dev/null as a controlling TTY
2014-10-30 15:10:59.705+0000: 1: error : lxcContainerSetupFDs:283 :
ioctl(TIOCSTTY) failed: Inappropriate ioctl for device


s/TIOCSTTY/TIOCSCTTY/ would make it more greppable (is that even a
word?) and it's now true since you pushed your trivial fix for that ;)

Report an error early instead of trying to start it.

https://bugzilla.redhat.com/show_bug.cgi?id=1155410
---
src/lxc/lxc_container.c | 6 ++++--
src/lxc/lxc_process.c   | 6 ++++++
2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index f02b959..8aba3ba 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -2093,8 +2093,10 @@ static int lxcContainerChild(void *data)
        if (virAsprintf(&ttyPath, "%s/%s.devpts/%s",
                        LXC_STATE_DIR, vmDef->name, tty) < 0)
            goto cleanup;
-    } else if (VIR_STRDUP(ttyPath, "/dev/null") < 0) {
-            goto cleanup;
+    } else {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("At least one tty is required"));
+        goto cleanup;
    }

How about we don't attach any tty and use the ioctl(TIOCSTTY) to steal
controlling terminal (or call open() with O_NOCTTY, or just don't call
ioctl() at all, I don't know what we normally use)?  Then there would
be no controlling terminal, but there would still be a session leader,
wouldn't it?

Anyway, this version looks OK too since it doesn't break any use case
(there is nothing to break now).  ACK after release if you argue why
not to use the idea above.

Martin

Attachment: signature.asc
Description: Digital signature

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