Omer Frenkel has uploaded a new change for review.

Change subject: core: fix vm devices upgrade in 3.1
......................................................................

core: fix vm devices upgrade in 3.1

when upgrading from 3.0 to 3.1 vm devices are created,
and boot order is set to new devices,
currenly upgrade code doesn't take into consideration the old boot
order, in case there are more than one disks.

this patch use 'boot' column from images table to order the boot disk to
be first device handled, and then it will have the right boot order.

Change-Id: Ic83725ad44363c75cb6b4230c983383dcbd24d0f
Signed-off-by: Omer Frenkel <[email protected]>
---
M backend/manager/dbscripts/upgrade/03_01_0440_vm_device_upgrade_data.sql
M backend/manager/dbscripts/upgrade/03_01_0560_vm_device_upgrade_data.sql
2 files changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/62/15162/1

diff --git 
a/backend/manager/dbscripts/upgrade/03_01_0440_vm_device_upgrade_data.sql 
b/backend/manager/dbscripts/upgrade/03_01_0440_vm_device_upgrade_data.sql
index 34c1dfa..6dccab2 100644
--- a/backend/manager/dbscripts/upgrade/03_01_0440_vm_device_upgrade_data.sql
+++ b/backend/manager/dbscripts/upgrade/03_01_0440_vm_device_upgrade_data.sql
@@ -198,7 +198,7 @@
 END; $function$
 LANGUAGE plpgsql;
 
-SELECT * FROM __temp_vm_device_upgrade_data();
+--SELECT * FROM __temp_vm_device_upgrade_data();
 
 
 DROP FUNCTION __temp_vm_device_upgrade_data();
diff --git 
a/backend/manager/dbscripts/upgrade/03_01_0560_vm_device_upgrade_data.sql 
b/backend/manager/dbscripts/upgrade/03_01_0560_vm_device_upgrade_data.sql
index 46d8408..54aa37c 100644
--- a/backend/manager/dbscripts/upgrade/03_01_0560_vm_device_upgrade_data.sql
+++ b/backend/manager/dbscripts/upgrade/03_01_0560_vm_device_upgrade_data.sql
@@ -46,7 +46,10 @@
 RETURNS void
 AS $function$
 DECLARE
-    v_sql text := 'SELECT device_id FROM vm_device where vm_id=''' || v_vm_id 
|| ''' and type=''' || v_type || ''' and device=''' ||  v_device || '''';
+    v_sql text := 'SELECT device_id FROM vm_device
+    left outer join images on vm_device.device_id = images.image_group_id
+    where is_managed = true and vm_id=''' || v_vm_id || ''' and type=''' || 
v_type || ''' and device=''' ||  v_device || '''
+    order by images.boot desc';
     v_cur refcursor ;
     v_boot_order int;
     v_device_id UUID;


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

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

Reply via email to