Skip to content

Commit 4c31f9d

Browse files
author
Dahn Highland
committed
Merge release branch 4.20 to main
* 4.20: xenserver: do not destroy halted hypervisor vm (#9175) define the limit of projects through the UI (#10652) fix projects metrics on dashboard (#10651) systemvm: Bump systemvm template version to debian 12.10 (#10628) Enhance VPC Network Tier form to auto-populate Gateway, and Netmask (#10617)
2 parents f275c28 + 6850147 commit 4c31f9d

File tree

17 files changed

+398
-391
lines changed

17 files changed

+398
-391
lines changed

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java

Lines changed: 294 additions & 352 deletions
Large diffs are not rendered by default.

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xen56/XenServer56FenceCommandWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public Answer execute(final FenceCommand command, final XenServer56Resource xenS
5454
for (final VM vm : vms) {
5555
logger.info("Fence command for VM " + command.getVmName());
5656
vm.powerStateReset(conn);
57-
vm.destroy(conn);
57+
xenServer56.destroyVm(vm, conn);
5858
}
5959
return new FenceAnswer(command);
6060
} catch (final XmlRpcException e) {

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xen56p1/XenServer56FP1FenceCommandWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public Answer execute(final FenceCommand command, final XenServer56Resource xenS
6666
}
6767
logger.info("Fence command for VM " + command.getVmName());
6868
vm.powerStateReset(conn);
69-
vm.destroy(conn);
69+
xenServer56.destroyVm(vm, conn);
7070
for (final VDI vdi : vdis) {
7171
final Map<String, String> smConfig = vdi.getSmConfig(conn);
7272
for (final String key : smConfig.keySet()) {

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixCreateVMSnapshotCommandWrapper.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public Answer execute(final CreateVMSnapshotCommand command, final CitrixResourc
6969
try {
7070
// check if VM snapshot already exists
7171
final Set<VM> vmSnapshots = VM.getByNameLabel(conn, command.getTarget().getSnapshotName());
72-
if (vmSnapshots == null || vmSnapshots.size() > 0) {
72+
if (vmSnapshots == null || !vmSnapshots.isEmpty()) {
7373
return new CreateVMSnapshotAnswer(command, command.getTarget(), command.getVolumeTOs());
7474
}
7575

@@ -98,6 +98,7 @@ public Answer execute(final CreateVMSnapshotCommand command, final CitrixResourc
9898
vm = citrixResourceBase.getVM(conn, vmName);
9999
vmState = vm.getPowerState(conn);
100100
} catch (final Exception e) {
101+
logger.debug("Failed to find VM with name: {} due to:", vmName, e);
101102
if (!snapshotMemory) {
102103
vm = citrixResourceBase.createWorkingVM(conn, vmName, guestOSType, platformEmulator, listVolumeTo);
103104
}
@@ -107,7 +108,7 @@ public Answer execute(final CreateVMSnapshotCommand command, final CitrixResourc
107108
return new CreateVMSnapshotAnswer(command, false, "Creating VM Snapshot Failed due to can not find vm: " + vmName);
108109
}
109110

110-
// call Xenserver API
111+
// call XenServer API
111112
if (!snapshotMemory) {
112113
task = vm.snapshotAsync(conn, vmSnapshotName);
113114
} else {
@@ -136,15 +137,15 @@ public Answer execute(final CreateVMSnapshotCommand command, final CitrixResourc
136137
vmSnapshot = Types.toVM(ref);
137138
try {
138139
Thread.sleep(5000);
139-
} catch (final InterruptedException ex) {
140+
} catch (final InterruptedException ignored) {
140141

141142
}
142143
// calculate used capacity for this VM snapshot
143144
for (final VolumeObjectTO volumeTo : command.getVolumeTOs()) {
144145
try {
145146
final long size = citrixResourceBase.getVMSnapshotChainSize(conn, volumeTo, command.getVmName(), vmSnapshotName);
146147
volumeTo.setSize(size);
147-
} catch (final CloudRuntimeException cre) {
148+
} catch (final CloudRuntimeException ignored) {
148149
}
149150
}
150151

@@ -161,13 +162,13 @@ public Answer execute(final CreateVMSnapshotCommand command, final CitrixResourc
161162
} else {
162163
msg = e.toString();
163164
}
164-
logger.warn("Creating VM Snapshot " + command.getTarget().getSnapshotName() + " failed due to: " + msg, e);
165+
logger.warn("Creating VM Snapshot {} failed due to: {}", command.getTarget().getSnapshotName(), msg, e);
165166
return new CreateVMSnapshotAnswer(command, false, msg);
166167
} finally {
167168
try {
168169
if (!success) {
169170
if (vmSnapshot != null) {
170-
logger.debug("Delete existing VM Snapshot " + vmSnapshotName + " after making VolumeTO failed");
171+
logger.debug("Delete existing VM Snapshot {} after making VolumeTO failed", vmSnapshotName);
171172
final Set<VBD> vbds = vmSnapshot.getVBDs(conn);
172173
for (final VBD vbd : vbds) {
173174
final VBD.Record vbdr = vbd.getRecord(conn);
@@ -176,16 +177,14 @@ public Answer execute(final CreateVMSnapshotCommand command, final CitrixResourc
176177
vdi.destroy(conn);
177178
}
178179
}
179-
vmSnapshot.destroy(conn);
180+
citrixResourceBase.destroyVm(vmSnapshot, conn, true);
180181
}
181182
}
182-
if (vmState == VmPowerState.HALTED) {
183-
if (vm != null) {
184-
vm.destroy(conn);
185-
}
183+
if (vmState == VmPowerState.HALTED && vm != null) {
184+
citrixResourceBase.destroyVm(vm, conn);
186185
}
187186
} catch (final Exception e2) {
188-
logger.error("delete snapshot error due to " + e2.getMessage());
187+
logger.error("delete snapshot error due to {}", e2.getMessage());
189188
}
190189
}
191190
}

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixDeleteVMSnapshotCommandWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public Answer execute(final DeleteVMSnapshotCommand command, final CitrixResourc
6666
if (command.getTarget().getType() == VMSnapshot.Type.DiskAndMemory) {
6767
vdiList.add(snapshot.getSuspendVDI(conn));
6868
}
69-
snapshot.destroy(conn);
69+
citrixResourceBase.destroyVm(snapshot, conn, true);
7070
for (final VDI vdi : vdiList) {
7171
vdi.destroy(conn);
7272
}

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixRevertToVMSnapshotCommandWrapper.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ public Answer execute(final RevertToVMSnapshotCommand command, final CitrixResou
5151
final VMSnapshot.Type vmSnapshotType = command.getTarget().getType();
5252
final Boolean snapshotMemory = vmSnapshotType == VMSnapshot.Type.DiskAndMemory;
5353
final Connection conn = citrixResourceBase.getConnection();
54-
PowerState vmState = null;
55-
VM vm = null;
54+
PowerState vmState;
55+
VM vm;
5656
try {
5757

5858
final Set<VM> vmSnapshots = VM.getByNameLabel(conn, command.getTarget().getSnapshotName());
59-
if (vmSnapshots == null || vmSnapshots.size() == 0) {
59+
if (vmSnapshots == null || vmSnapshots.isEmpty()) {
6060
return new RevertToVMSnapshotAnswer(command, false, "Cannot find vmSnapshot with name: " + command.getTarget().getSnapshotName());
6161
}
6262

@@ -66,6 +66,7 @@ public Answer execute(final RevertToVMSnapshotCommand command, final CitrixResou
6666
try {
6767
vm = citrixResourceBase.getVM(conn, vmName);
6868
} catch (final Exception e) {
69+
logger.debug("Failed to find VM with name: {} due to:", vmName, e);
6970
vm = citrixResourceBase.createWorkingVM(conn, vmName, command.getGuestOSType(), command.getPlatformEmulator(), listVolumeTo);
7071
}
7172

@@ -77,7 +78,7 @@ public Answer execute(final RevertToVMSnapshotCommand command, final CitrixResou
7778
citrixResourceBase.revertToSnapshot(conn, vmSnapshot, vmName, vm.getUuid(conn), snapshotMemory, citrixResourceBase.getHost().getUuid());
7879
vm = citrixResourceBase.getVM(conn, vmName);
7980
final Set<VBD> vbds = vm.getVBDs(conn);
80-
final Map<String, VDI> vdiMap = new HashMap<String, VDI>();
81+
final Map<String, VDI> vdiMap = new HashMap<>();
8182
// get vdi:vbdr to a map
8283
for (final VBD vbd : vbds) {
8384
final VBD.Record vbdr = vbd.getRecord(conn);
@@ -88,7 +89,7 @@ public Answer execute(final RevertToVMSnapshotCommand command, final CitrixResou
8889
}
8990

9091
if (!snapshotMemory) {
91-
vm.destroy(conn);
92+
citrixResourceBase.destroyVm(vm, conn);
9293
vmState = PowerState.PowerOff;
9394
} else {
9495
vmState = PowerState.PowerOn;
@@ -103,7 +104,7 @@ public Answer execute(final RevertToVMSnapshotCommand command, final CitrixResou
103104

104105
return new RevertToVMSnapshotAnswer(command, listVolumeTo, vmState);
105106
} catch (final Exception e) {
106-
logger.error("revert vm " + vmName + " to snapshot " + command.getTarget().getSnapshotName() + " failed due to " + e.getMessage());
107+
logger.error("revert vm {} to snapshot {} failed due to {}", vmName, command.getTarget().getSnapshotName(), e.getMessage());
107108
return new RevertToVMSnapshotAnswer(command, false, e.getMessage());
108109
}
109110
}

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixStartCommandWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public Answer execute(final StartCommand command, final CitrixResourceBase citri
7373
for (final VM v : vms) {
7474
final VM.Record vRec = v.getRecord(conn);
7575
if (vRec.powerState == VmPowerState.HALTED) {
76-
v.destroy(conn);
76+
citrixResourceBase.destroyVm(v, conn, true);
7777
} else if (vRec.powerState == VmPowerState.RUNNING) {
7878
final String host = vRec.residentOn.getUuid(conn);
7979
final String msg = "VM " + vmName + " is runing on host " + host;

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixStopCommandWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public Answer execute(final StopCommand command, final CitrixResourceBase citrix
141141
for (final VIF vif : vifs) {
142142
networks.add(vif.getNetwork(conn));
143143
}
144-
vm.destroy(conn);
144+
citrixResourceBase.destroyVm(vm, conn);
145145
final SR sr = citrixResourceBase.getISOSRbyVmName(conn, command.getVmName(), false);
146146
citrixResourceBase.removeSR(conn, sr);
147147
final SR configDriveSR = citrixResourceBase.getISOSRbyVmName(conn, command.getVmName(), true);

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5151
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
5252
<project.systemvm.template.location>https://download.cloudstack.org/systemvm</project.systemvm.template.location>
53-
<project.systemvm.template.version>4.20.0.0</project.systemvm.template.version>
53+
<project.systemvm.template.version>4.20.1.0</project.systemvm.template.version>
5454
<sonar.organization>apache</sonar.organization>
5555
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
5656

tools/appliance/systemvmtemplate/template-base_aarch64-target_aarch64.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
"format": "qcow2",
3333
"headless": true,
3434
"http_directory": "http",
35-
"iso_checksum": "sha512:04a2a128852c2dff8bb71779ad325721385051eb1264d897bdb5918ab207a9b1de636ded149c56c61a09eb8c7f428496815e70d3be31b1b1cf4c70bf6427cedd",
36-
"iso_url": "https://cdimage.debian.org/mirror/cdimage/release/12.9.0/arm64/iso-cd/debian-12.9.0-arm64-netinst.iso",
35+
"iso_checksum": "sha512:022895e699231c94abf7012f86cabc587dc576f07f856c87609d5d40c1f921d805a5a862cba94c1a47d09aaa565ec445222e338e73d1fa1affc4fc5908bb50ad",
36+
"iso_url": "https://cdimage.debian.org/mirror/cdimage/release/12.10.0/arm64/iso-cd/debian-12.10.0-arm64-netinst.iso",
3737
"net_device": "virtio-net",
3838
"output_directory": "../dist",
3939
"qemu_binary": "qemu-system-aarch64",

0 commit comments

Comments
 (0)