Sandro Bonazzola has uploaded a new change for review.

Change subject: vdsm: use devices instead of drives in vm.conf
......................................................................

vdsm: use devices instead of drives in vm.conf

Previously the setup used the keyword drives and cdrom for
configuring the VM drives. Such keywords seem to be
obsolete and don't support the share:exclusive
option correctly.
Now it uses the keyword devices for configuring both cdrom and
drives in order to have share:exclusive support.

Change-Id: Idbe61b2ef899320f304cd30b5b365e2a523acd49
Bug-Url: https://bugzilla.redhat.com/1008391
Signed-off-by: Sandro Bonazzola <[email protected]>
---
M src/ovirt_hosted_engine_setup/constants.py
M src/plugins/ovirt-hosted-engine-setup/vm/configurevm.py
M templates/vm.conf.in
3 files changed, 20 insertions(+), 8 deletions(-)


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

diff --git a/src/ovirt_hosted_engine_setup/constants.py 
b/src/ovirt_hosted_engine_setup/constants.py
index e909d1f..f31f5e2 100644
--- a/src/ovirt_hosted_engine_setup/constants.py
+++ b/src/ovirt_hosted_engine_setup/constants.py
@@ -402,6 +402,12 @@
     @ohostedattrs(
         answerfile=True,
     )
+    def CDROM_UUID(self):
+        return 'OVEHOSTED_VM/cdromUUID'
+
+    @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 09eefb9..b5543fe 100644
--- a/src/plugins/ovirt-hosted-engine-setup/vm/configurevm.py
+++ b/src/plugins/ovirt-hosted-engine-setup/vm/configurevm.py
@@ -77,6 +77,10 @@
             None,
         )
         self.environment[ohostedcons.VMEnv.SUBST] = {}
+        self.environment.setdefault(
+            ohostedcons.VMEnv.CDROM_UUID,
+            str(uuid.uuid4())
+        )
 
     @plugin.event(
         stage=plugin.Stages.STAGE_CUSTOMIZATION,
@@ -177,7 +181,10 @@
             ].replace('model_', ''),
             '@EMULATED_MACHINE@': self.environment[
                 ohostedcons.VMEnv.EMULATED_MACHINE
-            ]
+            ],
+            '@CDROM_UUID@': self.environment[
+                ohostedcons.VMEnv.CDROM_UUID
+            ],
         }
 
         if self.environment[
@@ -190,11 +197,9 @@
         if self.environment[
             ohostedcons.VMEnv.CDROM
         ] is not None:
-            subst['@CDROM@'] = 'cdrom={cdrom}'.format(
-                cdrom=self.environment[
-                    ohostedcons.VMEnv.CDROM
-                ]
-            )
+            subst['@CDROM@'] = self.environment[
+                ohostedcons.VMEnv.CDROM
+            ]
         else:
             subst['@CDROM@'] = ''
 
diff --git a/templates/vm.conf.in b/templates/vm.conf.in
index 33d70ea..b05050a 100644
--- a/templates/vm.conf.in
+++ b/templates/vm.conf.in
@@ -2,7 +2,9 @@
 memSize=@MEM_SIZE@
 macAddr=@MAC_ADDR@
 display=@CONSOLE_TYPE@
-drive=pool:@SP_UUID@,domain:@SD_UUID@,image:@IMG_UUID@,volume:@VOL_UUID@,shared:exclusive
+devices={index:2,iface:ide,address:{ controller:0, target:0,unit:0, bus:1, 
type:drive},specParams:{},readonly:true,deviceId:@CDROM_UUID@,path:@CDROM@,device:cdrom,shared:false,type:disk}
+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}
 boot=@BOOT@
 vmName=@NAME@
 
spiceSecureChannels=smain,sdisplay,sinputs,scursor,splayback,srecord,ssmartcard,susbredir
@@ -11,4 +13,3 @@
 smp=@VCPUS@
 cpuType=@CPU_TYPE@
 emulatedMachine=@EMULATED_MACHINE@
-@CDROM@


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idbe61b2ef899320f304cd30b5b365e2a523acd49
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: master
Gerrit-Owner: Sandro Bonazzola <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to