Skip to content

Commit 6850147

Browse files
author
Dahn Highland
committed
Merge branch '4.19' into 4.20
2 parents bc5728a + 5d5ac17 commit 6850147

File tree

13 files changed

+391
-384
lines changed

13 files changed

+391
-384
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);

ui/public/locales/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,9 +625,9 @@
625625
"label.create.template": "Create Template",
626626
"label.create.tier.aclid.description": "The ACL associated with the Network Tier.",
627627
"label.create.tier.externalid.description": "ID of the Network in an external system.",
628-
"label.create.tier.gateway.description": "The Network Tier's gateway in the super CIDR range, not overlapping with the CIDR of other Network Tiers in this VPC.",
628+
"label.create.tier.gateway.description": "Gateway IP must be within VPC CIDR ({value})",
629629
"label.create.tier.name.description": "A unique name for the Network Tier.",
630-
"label.create.tier.netmask.description": "The Network Tier's netmask. For example 255.255.255.0",
630+
"label.create.tier.netmask.description": "Network Tier's netmask must be more restrictive than {value}",
631631
"label.create.tier.networkofferingid.description": "The Network offering for the Network Tier.",
632632
"label.create.tungsten.routing.policy": "Create Tungsten-Fabric routing policy",
633633
"label.create.user": "Create User",

ui/src/components/view/ResourceLimitTab.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
>
2828
<div v-for="(item, index) in dataResource" :key="index">
2929
<a-form-item
30-
v-if="item.resourcetypename !== 'project'"
30+
v-if="item.resourcetypename !== 'project' || !$route.path.startsWith('/project')"
3131
:v-bind="item.resourcetypename"
3232
:label="$t('label.max' + (item.resourcetypename ? item.resourcetypename.replace('_', '') : '')) + (item.tag ? ' [' + item.tag + ']': '')"
3333
:name="item.key"

0 commit comments

Comments
 (0)