serialcon: Don't open a console with name=None

Can crash libvirt on f16, which is what happens when a user tries to open
dom-0 console
This commit is contained in:
Cole Robinson 2012-01-29 13:02:13 -05:00
parent 006ba306f7
commit ce94126b70

View File

@ -183,11 +183,14 @@ class LibvirtConsoleConnection(ConsoleConnection):
if self.stream:
self.close()
self.stream = self.conn.vmm.newStream(libvirt.VIR_STREAM_NONBLOCK)
name = dev and dev.alias.name or None
logging.debug("Opening console stream for dev=%s alias=%s",
dev, name)
if not name:
raise RuntimeError(_("Cannot open a device with no alias name"))
self.stream = self.conn.vmm.newStream(libvirt.VIR_STREAM_NONBLOCK)
self.vm.open_console(name, self.stream)
self.stream.eventAddCallback((libvirt.VIR_STREAM_EVENT_READABLE |