Skip to content

Commit a3a5c13

Browse files
ustcweizhouchipchilders
authored andcommitted
CLOUDSTACK-2303: upgrade failed from 2.2.14 to 4.1.0 - part2
Signed-off-by: Chip Childers <chip.childers@gmail.com>
1 parent c8e3fff commit a3a5c13

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

server/src/com/cloud/upgrade/dao/Upgrade2214to30.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ private void updateSystemVms(Connection conn){
630630
//XenServer
631631
try {
632632
//Get 3.0.0 or later xenserer system Vm template Id
633-
pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name like 'systemvm-xenserver-%' and removed is null");
633+
pstmt = conn.prepareStatement("select max(id) from `cloud`.`vm_template` where name like 'systemvm-xenserver-%' and removed is null");
634634
rs = pstmt.executeQuery();
635635
if(rs.next()){
636636
long templateId = rs.getLong(1);
@@ -661,7 +661,7 @@ private void updateSystemVms(Connection conn){
661661
s_logger.debug("Updating KVM System Vms");
662662
try {
663663
//Get 3.0.0 or later KVM system Vm template Id
664-
pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name like 'systemvm-kvm-%' and removed is null");
664+
pstmt = conn.prepareStatement("select max(id) from `cloud`.`vm_template` where name like 'systemvm-kvm-%' and removed is null");
665665
rs = pstmt.executeQuery();
666666
if(rs.next()){
667667
long templateId = rs.getLong(1);
@@ -692,7 +692,7 @@ private void updateSystemVms(Connection conn){
692692
s_logger.debug("Updating VMware System Vms");
693693
try {
694694
//Get 3.0.0 or later VMware system Vm template Id
695-
pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name like 'systemvm-vmware-%' and removed is null");
695+
pstmt = conn.prepareStatement("select max(id) from `cloud`.`vm_template` where name like 'systemvm-vmware-%' and removed is null");
696696
rs = pstmt.executeQuery();
697697
if(rs.next()){
698698
long templateId = rs.getLong(1);

0 commit comments

Comments
 (0)