File tree Expand file tree Collapse file tree
server/src/com/cloud/upgrade/dao Expand file tree Collapse file tree Original file line number Diff line number Diff 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 );
You can’t perform that action at this time.
0 commit comments