Skip to content

Commit fcc87d9

Browse files
Merge branch '4.11'
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2 parents 00468cf + 223a373 commit fcc87d9

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

engine/orchestration/src/main/java/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,12 @@ private void processReport(long hostId, Map<Long, VirtualMachine.PowerState> tra
122122

123123
Date vmStateUpdateTime = instance.getPowerStateUpdateTime();
124124
if (vmStateUpdateTime == null) {
125-
s_logger.warn("VM state was updated but update time is null?! vm id: " + instance.getId());
126-
vmStateUpdateTime = currentTime;
125+
s_logger.warn("VM power state update time is null, falling back to update time for vm id: " + instance.getId());
126+
vmStateUpdateTime = instance.getUpdateTime();
127+
if (vmStateUpdateTime == null) {
128+
s_logger.warn("VM update time is null, falling back to creation time for vm id: " + instance.getId());
129+
vmStateUpdateTime = instance.getCreated();
130+
}
127131
}
128132

129133
if (s_logger.isDebugEnabled())

engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,7 @@ public void prepare(VirtualMachineProfile vm, DeployDestination dest) throws Sto
14041404
if (cloneSettingVO != null) {
14051405
if (!cloneSettingVO.getCloneType().equals(cloneType.toString())) {
14061406
cloneSettingVO.setCloneType(cloneType.toString());
1407-
_vmCloneSettingDao.update(cloneSettingVO.getVmId(), cloneSettingVO);
1407+
_vmCloneSettingDao.update(cloneSettingVO.getId(), cloneSettingVO);
14081408
}
14091409
} else {
14101410
UserVmCloneSettingVO vmCloneSettingVO = new UserVmCloneSettingVO(vm.getId(), cloneType.toString());

engine/schema/src/main/java/com/cloud/vm/UserVmCloneSettingVO.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,23 @@
1616
// under the License.
1717
package com.cloud.vm;
1818

19+
import org.apache.cloudstack.api.InternalIdentity;
20+
1921
import javax.persistence.Column;
2022
import javax.persistence.Entity;
23+
import javax.persistence.GeneratedValue;
24+
import javax.persistence.GenerationType;
25+
import javax.persistence.Id;
2126
import javax.persistence.Table;
2227

2328
@Entity
2429
@Table(name = "user_vm_clone_setting")
25-
public class UserVmCloneSettingVO {
30+
public class UserVmCloneSettingVO implements InternalIdentity {
31+
32+
@Id
33+
@GeneratedValue(strategy = GenerationType.IDENTITY)
34+
@Column(name = "id")
35+
private long id;
2636

2737
@Column(name = "vm_id")
2838
private Long vmId;
@@ -50,4 +60,9 @@ public String getCloneType() {
5060
public void setCloneType(String cloneType) {
5161
this.cloneType = cloneType;
5262
}
63+
64+
@Override
65+
public long getId() {
66+
return id;
67+
}
5368
}

engine/schema/src/main/resources/META-INF/db/schema-41110to41120.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,9 @@
2222
-- XenServer 7.5
2323
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);
2424
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';
25+
26+
-- Fix Vmware full clones issue
27+
ALTER TABLE `cloud`.`user_vm_clone_setting`
28+
ADD COLUMN `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
29+
DROP PRIMARY KEY,
30+
ADD PRIMARY KEY (`id`);

0 commit comments

Comments
 (0)