yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #20733
[Bug 1340518] Re: can not use virsh console on serial terminal
It is not clear what the use case is here, please explain further if
you'd like to take this forward. Also patches need to be provided via
gerrit not via the tracker.
** Changed in: nova
Status: New => Opinion
** Changed in: nova
Importance: Undecided => Wishlist
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1340518
Title:
can not use virsh console on serial terminal
Status in OpenStack Compute (Nova):
Opinion
Bug description:
In KVM case:
We can not use virsh console on serial terminal.
So, can not login to each vm using 'virsh console' command on terminal.
Because vm's config xml file is not support it now.
This feature is so important for us.
Please apply this patch:
CONF.libvirt.virsh_console_serial=False (default. is same now)
if you using virsh console then set
CONF.libvirt.virsh_console_serial=True
diff --git a/nova/virt/libvirt/config.py b/nova/virt/libvirt/config.py
index 8eaf658..090e17b 100644
--- a/nova/virt/libvirt/config.py
+++ b/nova/virt/libvirt/config.py
@@ -1053,6 +1053,9 @@ class LibvirtConfigGuestCharBase(LibvirtConfigGuestDevice):
dev = super(LibvirtConfigGuestCharBase, self).format_dom()
dev.set("type", self.type)
+ if self.root_name == "console":
+ dev.set("tty", self.source_path)
+
if self.type == "file":
dev.append(etree.Element("source", path=self.source_path))
elif self.type == "unix":
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index 9bd75fa..de2735e 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -213,6 +213,9 @@ libvirt_opts = [
help='A path to a device that will be used as source of '
'entropy on the host. Permitted options are: '
'/dev/random or /dev/hwrng'),
+ cfg.BoolOpt('virsh_console_serial',
+ default=False,
+ help='Use virsh console on serial terminal'),
]
CONF = cfg.CONF
@@ -3278,14 +3281,29 @@ class LibvirtDriver(driver.ComputeDriver):
# client app is connected. Thus we can't get away
# with a single type=pty console. Instead we have
# to configure two separate consoles.
- consolelog = vconfig.LibvirtConfigGuestSerial()
- consolelog.type = "file"
- consolelog.source_path = self._get_console_log_path(instance)
- guest.add_device(consolelog)
- consolepty = vconfig.LibvirtConfigGuestSerial()
- consolepty.type = "pty"
- guest.add_device(consolepty)
+ if CONF.libvirt.virsh_console_serial: # Y.Kawada
+ consolepty = vconfig.LibvirtConfigGuestSerial()
+ consolepty.type = "pty"
+ consolepty.target_port = "0"
+ consolepty.source_path = "/dev/pts/11"
+ consolepty.alias_name = "serial0"
+ guest.add_device(consolepty)
+
+ consolepty = vconfig.LibvirtConfigGuestConsole()
+ consolepty.type = "pty"
+ consolepty.target_port = "0"
+ consolepty.source_path = "/dev/pts/11"
+ consolepty.alias_name = "serial0"
+ else:
+ consolelog = vconfig.LibvirtConfigGuestSerial()
+ consolelog.type = "file"
+ consolelog.source_path = self._get_console_log_path(instance)
+ guest.add_device(consolelog)
+
+ consolepty = vconfig.LibvirtConfigGuestSerial()
+ consolepty.type = "pty"
+ guest.add_device(consolepty)
else:
consolepty = vconfig.LibvirtConfigGuestConsole()
consolepty.type = "pty"
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1340518/+subscriptions
References