Fixes #2838 exception in Vmware full clones update (#2840)

Fixes #2838
This commit is contained in:
Nicolas Vazquez 2018-09-14 05:28:28 -03:00 committed by Rohit Yadav
parent 5a046e243a
commit 8aff96cfc5
3 changed files with 23 additions and 2 deletions

View File

@ -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());

View File

@ -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`);

View File

@ -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;
}
}