Sandro Bonazzola has uploaded a new change for review.

Change subject: vdsm: add console device to the VM
......................................................................

vdsm: add console device to the VM

Add console device to the Hosted Engine VM definition.
Allows to connect to the VM without X.

Change-Id: Ieabe9538571a6e4e18217a728c71677225b1fddb
Bug-Url: https://bugzilla.redhat.com/1001706
Signed-off-by: Sandro Bonazzola <sbona...@redhat.com>
---
M src/ovirt_hosted_engine_setup/constants.py
M src/plugins/ovirt-hosted-engine-setup/vm/configurevm.py
M src/plugins/ovirt-hosted-engine-setup/vm/runvm.py
M templates/vm.conf.in
4 files changed, 36 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup 
refs/changes/94/19394/1

diff --git a/src/ovirt_hosted_engine_setup/constants.py 
b/src/ovirt_hosted_engine_setup/constants.py
index 4923bdb..694ecde 100644
--- a/src/ovirt_hosted_engine_setup/constants.py
+++ b/src/ovirt_hosted_engine_setup/constants.py
@@ -416,6 +416,12 @@
     @ohostedattrs(
         answerfile=True,
     )
+    def CONSOLE_UUID(self):
+        return 'OVEHOSTED_VM/consoleUUID'
+
+    @ohostedattrs(
+        answerfile=True,
+    )
     def EMULATED_MACHINE(self):
         return 'OVEHOSTED_VM/emulatedMachine'
 
diff --git a/src/plugins/ovirt-hosted-engine-setup/vm/configurevm.py 
b/src/plugins/ovirt-hosted-engine-setup/vm/configurevm.py
index 32d7d22..6f9b174 100644
--- a/src/plugins/ovirt-hosted-engine-setup/vm/configurevm.py
+++ b/src/plugins/ovirt-hosted-engine-setup/vm/configurevm.py
@@ -85,6 +85,10 @@
             ohostedcons.VMEnv.NIC_UUID,
             str(uuid.uuid4())
         )
+        self.environment.setdefault(
+            ohostedcons.VMEnv.CONSOLE_UUID,
+            str(uuid.uuid4())
+        )
 
     @plugin.event(
         stage=plugin.Stages.STAGE_CUSTOMIZATION,
@@ -192,8 +196,10 @@
             '@NIC_UUID@': self.environment[
                 ohostedcons.VMEnv.NIC_UUID
             ],
+            '@CONSOLE_UUID@': self.environment[
+                ohostedcons.VMEnv.CONSOLE_UUID
+            ],
         }
-
         if self.environment[
             ohostedcons.VMEnv.BOOT
         ] in self.BOOT_DEVICE.keys():
diff --git a/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py 
b/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py
index 3f901ae..32d82a1 100644
--- a/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py
+++ b/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py
@@ -67,7 +67,7 @@
             return _(
                 'You can now connect to the VM with the following command:\n'
                 '\t{remote} vnc://localhost:5900\nUse temporary password '
-                '"{password}" to connect to vnc console.'
+                '"{password}" to connect to vnc console.\n'
             ).format(
                 remote=self.command.get('remote-viewer'),
                 password=self.environment[
@@ -145,10 +145,30 @@
                     ]
                 )
             )
+            host = 'localhost'
+            spice_values = [
+                x.strip()
+                for x in self.environment[
+                    ohostedcons.VDSMEnv.SPICE_SUBJECT
+                ].split(',')
+                if x
+            ]
+            for items in spice_values:
+                key, val = items.split('=', 1)
+                if key == 'CN':
+                    host = val
+                    break
+
             self.dialog.note(
                 _(
                     'Please note that in order to use remote-viewer you need '
-                    'to be able to run graphical applications.'
+                    'to be able to run graphical applications.\n'
+                    'If you cannot run graphical applications you can '
+                    'connect to the graphic console from another host or '
+                    'connect to the console using the following command:\n'
+                    'virsh -c qemu+tls://{host}/system console HostedEngine'
+                ).format(
+                    host=host
                 )
             )
             self.dialog.note(
diff --git a/templates/vm.conf.in b/templates/vm.conf.in
index ecb7220..c60f044 100644
--- a/templates/vm.conf.in
+++ b/templates/vm.conf.in
@@ -5,6 +5,7 @@
 
devices={index:0,iface:virtio,format:raw,poolID:@SP_UUID@,volumeID:@VOL_UUID@,imageID:@IMG_UUID@,specParams:{},readonly:false,domainID:@SD_UUID@,optional:false,deviceId:@IMG_UUID@,address:{bus:0x00,
 slot:0x06, domain:0x0000, type:pci, 
function:0x0},device:disk,shared:exclusive,propagateErrors:off,type:disk}
 devices={device:scsi,model:virtio-scsi,type:controller}
 
devices={nicModel:pv,macAddr:@MAC_ADDR@,linkActive:true,network:ovirtmgmt,filter:vdsm-no-mac-spoofing,specParams:{},deviceId:@NIC_UUID@,address:{bus:0x00,
 slot:0x03, domain:0x0000, type:pci, function:0x0},device:bridge,type:interface}
+devices={device:console,specParams:{},type:console,deviceId:@CONSOLE_UUID@,alias:console0}
 boot=@BOOT@
 vmName=@NAME@
 
spiceSecureChannels=smain,sdisplay,sinputs,scursor,splayback,srecord,ssmartcard,susbredir


-- 
To view, visit http://gerrit.ovirt.org/19394
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieabe9538571a6e4e18217a728c71677225b1fddb
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: ovirt-hosted-engine-setup-1.0
Gerrit-Owner: Sandro Bonazzola <sbona...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to