CLOUDSTACK-2303: upgrade failed from 2.2.14 to 4.1.0 - part2

Signed-off-by: Chip Childers <chip.childers@gmail.com>
This commit is contained in:
Wei Zhou 2013-05-03 16:01:44 +01:00 committed by Chip Childers
parent c8e3fff6e4
commit a3a5c13427

View File

@ -630,7 +630,7 @@ public class Upgrade2214to30 extends Upgrade30xBase implements DbUpgrade {
//XenServer
try {
//Get 3.0.0 or later xenserer system Vm template Id
pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name like 'systemvm-xenserver-%' and removed is null");
pstmt = conn.prepareStatement("select max(id) from `cloud`.`vm_template` where name like 'systemvm-xenserver-%' and removed is null");
rs = pstmt.executeQuery();
if(rs.next()){
long templateId = rs.getLong(1);
@ -661,7 +661,7 @@ public class Upgrade2214to30 extends Upgrade30xBase implements DbUpgrade {
s_logger.debug("Updating KVM System Vms");
try {
//Get 3.0.0 or later KVM system Vm template Id
pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name like 'systemvm-kvm-%' and removed is null");
pstmt = conn.prepareStatement("select max(id) from `cloud`.`vm_template` where name like 'systemvm-kvm-%' and removed is null");
rs = pstmt.executeQuery();
if(rs.next()){
long templateId = rs.getLong(1);
@ -692,7 +692,7 @@ public class Upgrade2214to30 extends Upgrade30xBase implements DbUpgrade {
s_logger.debug("Updating VMware System Vms");
try {
//Get 3.0.0 or later VMware system Vm template Id
pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name like 'systemvm-vmware-%' and removed is null");
pstmt = conn.prepareStatement("select max(id) from `cloud`.`vm_template` where name like 'systemvm-vmware-%' and removed is null");
rs = pstmt.executeQuery();
if(rs.next()){
long templateId = rs.getLong(1);