This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.11
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.11 by this push:
     new 8aff96c  Fixes #2838 exception in Vmware full clones update (#2840)
8aff96c is described below

commit 8aff96cfc505069152943631fcd0446244f77f2c
Author: Nicolas Vazquez <[email protected]>
AuthorDate: Fri Sep 14 05:28:28 2018 -0300

    Fixes #2838 exception in Vmware full clones update (#2840)
    
    Fixes #2838
---
 .../engine/orchestration/VolumeOrchestrator.java        |  2 +-
 .../resources/META-INF/db/schema-41110to41120.sql       |  6 ++++++
 .../schema/src/com/cloud/vm/UserVmCloneSettingVO.java   | 17 ++++++++++++++++-
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git 
a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
 
b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
index e5e0bbf..7435a3e 100644
--- 
a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
+++ 
b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
@@ -1399,7 +1399,7 @@ public class VolumeOrchestrator extends ManagerBase 
implements VolumeOrchestrati
                 if (cloneSettingVO != null) {
                     if 
(!cloneSettingVO.getCloneType().equals(cloneType.toString())) {
                         cloneSettingVO.setCloneType(cloneType.toString());
-                        _vmCloneSettingDao.update(cloneSettingVO.getVmId(), 
cloneSettingVO);
+                        _vmCloneSettingDao.update(cloneSettingVO.getId(), 
cloneSettingVO);
                     }
                 } else {
                     UserVmCloneSettingVO vmCloneSettingVO = new 
UserVmCloneSettingVO(vm.getId(), cloneType.toString());
diff --git a/engine/schema/resources/META-INF/db/schema-41110to41120.sql 
b/engine/schema/resources/META-INF/db/schema-41110to41120.sql
index 4c85bd1..8b1b9d9 100644
--- a/engine/schema/resources/META-INF/db/schema-41110to41120.sql
+++ b/engine/schema/resources/META-INF/db/schema-41110to41120.sql
@@ -22,3 +22,9 @@
 -- XenServer 7.5
 INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, 
hypervisor_version, max_guests_limit, max_data_volumes_limit, 
storage_motion_supported) values (UUID(), 'XenServer', '7.5.0', 500, 13, 1);
 INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
SELECT UUID(),'Xenserver', '7.5.0', guest_os_name, guest_os_id, 
utc_timestamp(), 0  FROM `cloud`.`guest_os_hypervisor` WHERE 
hypervisor_type='Xenserver' AND hypervisor_version='7.4.0';
+
+-- Fix Vmware full clones issue
+ALTER TABLE `cloud`.`user_vm_clone_setting`
+ADD COLUMN `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
+DROP PRIMARY KEY,
+ADD PRIMARY KEY (`id`);
\ No newline at end of file
diff --git a/engine/schema/src/com/cloud/vm/UserVmCloneSettingVO.java 
b/engine/schema/src/com/cloud/vm/UserVmCloneSettingVO.java
index adca686..f50807e 100644
--- a/engine/schema/src/com/cloud/vm/UserVmCloneSettingVO.java
+++ b/engine/schema/src/com/cloud/vm/UserVmCloneSettingVO.java
@@ -16,13 +16,23 @@
 // under the License.
 package com.cloud.vm;
 
+import org.apache.cloudstack.api.InternalIdentity;
+
 import javax.persistence.Column;
 import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
 import javax.persistence.Table;
 
 @Entity
 @Table(name = "user_vm_clone_setting")
-public class UserVmCloneSettingVO {
+public class UserVmCloneSettingVO implements InternalIdentity {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
 
     @Column(name = "vm_id")
     private Long vmId;
@@ -50,4 +60,9 @@ public class UserVmCloneSettingVO {
     public void setCloneType(String cloneType) {
         this.cloneType = cloneType;
     }
+
+    @Override
+    public long getId() {
+        return id;
+    }
 }

Reply via email to