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 keywords drives, cdrom,
nicModel, bridge and macAddr for configuring the VM
devices.
Such keywords seem to be obsolete and lead to having
the share:exclusive option not working correctly on drives.
Now it uses the keyword devices for configuring all the devices
and drives in order to have share:exclusive support.

Change-Id: Idbe61b2ef899320f304cd30b5b365e2a523acd49
Bug-Url: https://bugzilla.redhat.com/1008391
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 templates/vm.conf.in
3 files changed, 34 insertions(+), 11 deletions(-)


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

diff --git a/src/ovirt_hosted_engine_setup/constants.py 
b/src/ovirt_hosted_engine_setup/constants.py
index 8eee30e..4923bdb 100644
--- a/src/ovirt_hosted_engine_setup/constants.py
+++ b/src/ovirt_hosted_engine_setup/constants.py
@@ -387,6 +387,12 @@
 
     @ohostedattrs(
         answerfile=True,
+    )
+    def NIC_UUID(self):
+        return 'OVEHOSTED_VM/nicUUID'
+
+    @ohostedattrs(
+        answerfile=True,
         summary=True,
         description=_('Boot type'),
     )
@@ -404,6 +410,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..32d7d22 100644
--- a/src/plugins/ovirt-hosted-engine-setup/vm/configurevm.py
+++ b/src/plugins/ovirt-hosted-engine-setup/vm/configurevm.py
@@ -77,6 +77,14 @@
             None,
         )
         self.environment[ohostedcons.VMEnv.SUBST] = {}
+        self.environment.setdefault(
+            ohostedcons.VMEnv.CDROM_UUID,
+            str(uuid.uuid4())
+        )
+        self.environment.setdefault(
+            ohostedcons.VMEnv.NIC_UUID,
+            str(uuid.uuid4())
+        )
 
     @plugin.event(
         stage=plugin.Stages.STAGE_CUSTOMIZATION,
@@ -177,7 +185,13 @@
             ].replace('model_', ''),
             '@EMULATED_MACHINE@': self.environment[
                 ohostedcons.VMEnv.EMULATED_MACHINE
-            ]
+            ],
+            '@CDROM_UUID@': self.environment[
+                ohostedcons.VMEnv.CDROM_UUID
+            ],
+            '@NIC_UUID@': self.environment[
+                ohostedcons.VMEnv.NIC_UUID
+            ],
         }
 
         if self.environment[
@@ -190,11 +204,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..ecb7220 100644
--- a/templates/vm.conf.in
+++ b/templates/vm.conf.in
@@ -1,14 +1,13 @@
 vmId=@VM_UUID@
 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}
+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}
 boot=@BOOT@
 vmName=@NAME@
 
spiceSecureChannels=smain,sdisplay,sinputs,scursor,splayback,srecord,ssmartcard,susbredir
-bridge=ovirtmgmt
-nicModel=virtio
 smp=@VCPUS@
 cpuType=@CPU_TYPE@
 emulatedMachine=@EMULATED_MACHINE@
-@CDROM@


-- 
To view, visit http://gerrit.ovirt.org/19393
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: 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