Francesco Romani has uploaded a new change for review.
Change subject: virt: reverse default for the serial-console
......................................................................
virt: reverse default for the serial-console
In commit 22b98ce056 we added support for the new
virtio serial console feature. The feature, in VDSM,
is controlled by a new boolean specParam, defaulting
to 'disabled' (preserve old behaviour).
However, everywhere else we defaulted to enable new
behaviour, allowing users to opt-out.
This patch reverses the default and makes VDSM
consistent with the behaviours of the other
components, most notably Engine.
Feature Page:
http://www.ovirt.org/Features/Serial_Console
Related-To: https://bugzilla.redhat.com/1223671
Change-Id: I0a74aed67b073e28819f2695be707ecfe4bdeb8b
Signed-off-by: Francesco Romani <[email protected]>
---
M tests/deviceTests.py
M tests/vmTests.py
M vdsm/rpc/vdsmapi-schema.json
M vdsm/virt/vmdevices/core.py
4 files changed, 31 insertions(+), 22 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/94/42094/1
diff --git a/tests/deviceTests.py b/tests/deviceTests.py
index acaf897..7a3182b 100644
--- a/tests/deviceTests.py
+++ b/tests/deviceTests.py
@@ -220,26 +220,26 @@
tpm = vmdevices.core.Tpm(self.conf, self.log, **dev)
self.assertXMLEqual(tpm.getXML().toxml(), tpmXML)
- @permutations([[None], [{}], [{'enableSocket': False}]])
- def testConsolePtyXML(self, specParams):
+ def testConsolePtyXML(self):
consoleXML = """
<console type="pty">
<target port="0" type="virtio"/>
</console>"""
- dev = {'device': 'console'}
- if specParams is not None:
- dev['specParams'] = specParams
+ dev = {'device': 'console', 'specParams': {'disableSocket': True}}
console = vmdevices.core.Console(self.conf, self.log, **dev)
self.assertXMLEqual(console.getXML().toxml(), consoleXML)
- def testConsoleSocketXML(self):
+ @permutations([[None], [{}], [{'disableSocket': False}]])
+ def testConsoleSocketXML(self, specParams):
consoleXML = """
<console type="unix">
<source mode="bind" path="%s%s.sock" />
<target port="0" type="virtio"/>
</console>""" % (constants.P_OVIRT_VMCONSOLES,
self.conf['vmId'])
- dev = {'device': 'console', 'specParams': {'enableSocket': True}}
+ dev = {'device': 'console'}
+ if specParams is not None:
+ dev['specParams'] = specParams
console = vmdevices.core.Console(self.conf, self.log, **dev)
self.assertXMLEqual(console.getXML().toxml(), consoleXML)
@@ -511,7 +511,7 @@
def test_console_pty_not_prepare_path(self):
supervdsm = fake.SuperVdsm()
with MonkeyPatchScope([(vmdevices.core, 'supervdsm', supervdsm)]):
- dev = {'device': 'console'}
+ dev = {'device': 'console', 'specParams': {'disableSocket': True}}
con = vmdevices.core.Console(self.cfg, self.log, **dev)
con.prepare()
@@ -520,7 +520,7 @@
def test_console_usock_prepare_path(self):
supervdsm = fake.SuperVdsm()
with MonkeyPatchScope([(vmdevices.core, 'supervdsm', supervdsm)]):
- dev = {'device': 'console', 'specParams': {'enableSocket': True}}
+ dev = {'device': 'console'}
con = vmdevices.core.Console(self.cfg, self.log, **dev)
con.prepare()
@@ -535,7 +535,7 @@
with MonkeyPatchScope([(vmdevices.core,
'cleanup_guest_socket', _fake_cleanup)]):
- dev = {'device': 'console'}
+ dev = {'device': 'console', 'specParams': {'disableSocket': True}}
con = vmdevices.core.Console(self.cfg, self.log, **dev)
con.cleanup()
@@ -548,7 +548,7 @@
with MonkeyPatchScope([(vmdevices.core,
'cleanup_guest_socket', _fake_cleanup)]):
- dev = {'device': 'console', 'specParams': {'enableSocket': True}}
+ dev = {'device': 'console'}
con = vmdevices.core.Console(self.cfg, self.log, **dev)
con.cleanup()
diff --git a/tests/vmTests.py b/tests/vmTests.py
index 36522a0..27deb8e 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -290,7 +290,10 @@
<console type="pty">
<target port="0" type="virtio"/>
</console>"""
- dev = {'device': 'console', 'specParams': {'consoleType': 'virtio'}}
+ dev = {
+ 'device': 'console',
+ 'specParams': {'consoleType': 'virtio', 'disableSocket': True}
+ }
console = vmdevices.core.Console(self.conf, self.log, **dev)
self.assertXMLEqual(console.getXML().toxml(), consoleXML)
@@ -299,15 +302,20 @@
<console type="pty">
<target port="0" type="serial"/>
</console>"""
- dev = {'device': 'console', 'specParams': {'consoleType': 'serial'}}
+ dev = {
+ 'device': 'console',
+ 'specParams': {'consoleType': 'serial', 'disableSocket': True}
+ }
console = vmdevices.core.Console(self.conf, self.log, **dev)
self.assertXMLEqual(console.getXML().toxml(), consoleXML)
def testConsoleXMLDefault(self):
+ path = "/var/run/ovirt-vmconsole-console/%s.sock" % self.conf['vmId']
consoleXML = """
- <console type="pty">
- <target port="0" type="virtio"/>
- </console>"""
+ <console type="unix">
+ <source mode="bind" path="%s" />
+ <target port="0" type="virtio" />
+ </console>""" % path
dev = {'device': 'console'}
console = vmdevices.core.Console(self.conf, self.log, **dev)
self.assertXMLEqual(console.getXML().toxml(), consoleXML)
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index 53d3b1b..b9b1a8e 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -3403,14 +3403,15 @@
#
# @consoleType: Type of console to be configured for the VM
#
-# @enableSocket: #optional if enabled, export console endpoint
-# as UNIX domain socket instead of pty.
+# @disableSocket: #optional if equals True, do not export console
+# endpoint as UNIX domain socket, use pty-s instead,
+# as VDSM < 4.17.0 did.
#
# Since: 4.17.0
##
{'type': 'VmConsoleDeviceSpecParams',
'data': {'consoleType': 'VmConsoleDeviceType',
- '*enableSocket': 'bool'}}
+ '*disableSocket': 'bool'}}
##
# @VmConsoleDevice:
diff --git a/vdsm/virt/vmdevices/core.py b/vdsm/virt/vmdevices/core.py
index ff049c0..113e823 100644
--- a/vdsm/virt/vmdevices/core.py
+++ b/vdsm/virt/vmdevices/core.py
@@ -89,13 +89,13 @@
if not hasattr(self, 'specParams'):
self.specParams = {}
- if utils.tobool(self.specParams.get('enableSocket', False)):
+ if utils.tobool(self.specParams.get('disableSocket', False)):
+ self._path = None
+ else:
self._path = os.path.join(
constants.P_OVIRT_VMCONSOLES,
self.conf['vmId'] + self.CONSOLE_EXTENSION
)
- else:
- self._path = None
def prepare(self):
if self._path:
--
To view, visit https://gerrit.ovirt.org/42094
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0a74aed67b073e28819f2695be707ecfe4bdeb8b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches