mirror of https://github.com/apache/cloudstack.git
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)
This commit is contained in:
commit
4c31f9d533
File diff suppressed because it is too large
Load Diff
|
|
@ -54,7 +54,7 @@ public final class XenServer56FenceCommandWrapper extends CommandWrapper<FenceCo
|
||||||
for (final VM vm : vms) {
|
for (final VM vm : vms) {
|
||||||
logger.info("Fence command for VM " + command.getVmName());
|
logger.info("Fence command for VM " + command.getVmName());
|
||||||
vm.powerStateReset(conn);
|
vm.powerStateReset(conn);
|
||||||
vm.destroy(conn);
|
xenServer56.destroyVm(vm, conn);
|
||||||
}
|
}
|
||||||
return new FenceAnswer(command);
|
return new FenceAnswer(command);
|
||||||
} catch (final XmlRpcException e) {
|
} catch (final XmlRpcException e) {
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ public final class XenServer56FP1FenceCommandWrapper extends CommandWrapper<Fenc
|
||||||
}
|
}
|
||||||
logger.info("Fence command for VM " + command.getVmName());
|
logger.info("Fence command for VM " + command.getVmName());
|
||||||
vm.powerStateReset(conn);
|
vm.powerStateReset(conn);
|
||||||
vm.destroy(conn);
|
xenServer56.destroyVm(vm, conn);
|
||||||
for (final VDI vdi : vdis) {
|
for (final VDI vdi : vdis) {
|
||||||
final Map<String, String> smConfig = vdi.getSmConfig(conn);
|
final Map<String, String> smConfig = vdi.getSmConfig(conn);
|
||||||
for (final String key : smConfig.keySet()) {
|
for (final String key : smConfig.keySet()) {
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ public final class CitrixCreateVMSnapshotCommandWrapper extends CommandWrapper<C
|
||||||
try {
|
try {
|
||||||
// check if VM snapshot already exists
|
// check if VM snapshot already exists
|
||||||
final Set<VM> vmSnapshots = VM.getByNameLabel(conn, command.getTarget().getSnapshotName());
|
final Set<VM> vmSnapshots = VM.getByNameLabel(conn, command.getTarget().getSnapshotName());
|
||||||
if (vmSnapshots == null || vmSnapshots.size() > 0) {
|
if (vmSnapshots == null || !vmSnapshots.isEmpty()) {
|
||||||
return new CreateVMSnapshotAnswer(command, command.getTarget(), command.getVolumeTOs());
|
return new CreateVMSnapshotAnswer(command, command.getTarget(), command.getVolumeTOs());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -98,6 +98,7 @@ public final class CitrixCreateVMSnapshotCommandWrapper extends CommandWrapper<C
|
||||||
vm = citrixResourceBase.getVM(conn, vmName);
|
vm = citrixResourceBase.getVM(conn, vmName);
|
||||||
vmState = vm.getPowerState(conn);
|
vmState = vm.getPowerState(conn);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
|
logger.debug("Failed to find VM with name: {} due to:", vmName, e);
|
||||||
if (!snapshotMemory) {
|
if (!snapshotMemory) {
|
||||||
vm = citrixResourceBase.createWorkingVM(conn, vmName, guestOSType, platformEmulator, listVolumeTo);
|
vm = citrixResourceBase.createWorkingVM(conn, vmName, guestOSType, platformEmulator, listVolumeTo);
|
||||||
}
|
}
|
||||||
|
|
@ -107,7 +108,7 @@ public final class CitrixCreateVMSnapshotCommandWrapper extends CommandWrapper<C
|
||||||
return new CreateVMSnapshotAnswer(command, false, "Creating VM Snapshot Failed due to can not find vm: " + vmName);
|
return new CreateVMSnapshotAnswer(command, false, "Creating VM Snapshot Failed due to can not find vm: " + vmName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// call Xenserver API
|
// call XenServer API
|
||||||
if (!snapshotMemory) {
|
if (!snapshotMemory) {
|
||||||
task = vm.snapshotAsync(conn, vmSnapshotName);
|
task = vm.snapshotAsync(conn, vmSnapshotName);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -136,7 +137,7 @@ public final class CitrixCreateVMSnapshotCommandWrapper extends CommandWrapper<C
|
||||||
vmSnapshot = Types.toVM(ref);
|
vmSnapshot = Types.toVM(ref);
|
||||||
try {
|
try {
|
||||||
Thread.sleep(5000);
|
Thread.sleep(5000);
|
||||||
} catch (final InterruptedException ex) {
|
} catch (final InterruptedException ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
// calculate used capacity for this VM snapshot
|
// calculate used capacity for this VM snapshot
|
||||||
|
|
@ -144,7 +145,7 @@ public final class CitrixCreateVMSnapshotCommandWrapper extends CommandWrapper<C
|
||||||
try {
|
try {
|
||||||
final long size = citrixResourceBase.getVMSnapshotChainSize(conn, volumeTo, command.getVmName(), vmSnapshotName);
|
final long size = citrixResourceBase.getVMSnapshotChainSize(conn, volumeTo, command.getVmName(), vmSnapshotName);
|
||||||
volumeTo.setSize(size);
|
volumeTo.setSize(size);
|
||||||
} catch (final CloudRuntimeException cre) {
|
} catch (final CloudRuntimeException ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -161,13 +162,13 @@ public final class CitrixCreateVMSnapshotCommandWrapper extends CommandWrapper<C
|
||||||
} else {
|
} else {
|
||||||
msg = e.toString();
|
msg = e.toString();
|
||||||
}
|
}
|
||||||
logger.warn("Creating VM Snapshot " + command.getTarget().getSnapshotName() + " failed due to: " + msg, e);
|
logger.warn("Creating VM Snapshot {} failed due to: {}", command.getTarget().getSnapshotName(), msg, e);
|
||||||
return new CreateVMSnapshotAnswer(command, false, msg);
|
return new CreateVMSnapshotAnswer(command, false, msg);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if (!success) {
|
if (!success) {
|
||||||
if (vmSnapshot != null) {
|
if (vmSnapshot != null) {
|
||||||
logger.debug("Delete existing VM Snapshot " + vmSnapshotName + " after making VolumeTO failed");
|
logger.debug("Delete existing VM Snapshot {} after making VolumeTO failed", vmSnapshotName);
|
||||||
final Set<VBD> vbds = vmSnapshot.getVBDs(conn);
|
final Set<VBD> vbds = vmSnapshot.getVBDs(conn);
|
||||||
for (final VBD vbd : vbds) {
|
for (final VBD vbd : vbds) {
|
||||||
final VBD.Record vbdr = vbd.getRecord(conn);
|
final VBD.Record vbdr = vbd.getRecord(conn);
|
||||||
|
|
@ -176,16 +177,14 @@ public final class CitrixCreateVMSnapshotCommandWrapper extends CommandWrapper<C
|
||||||
vdi.destroy(conn);
|
vdi.destroy(conn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vmSnapshot.destroy(conn);
|
citrixResourceBase.destroyVm(vmSnapshot, conn, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (vmState == VmPowerState.HALTED) {
|
if (vmState == VmPowerState.HALTED && vm != null) {
|
||||||
if (vm != null) {
|
citrixResourceBase.destroyVm(vm, conn);
|
||||||
vm.destroy(conn);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (final Exception e2) {
|
} catch (final Exception e2) {
|
||||||
logger.error("delete snapshot error due to " + e2.getMessage());
|
logger.error("delete snapshot error due to {}", e2.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ public final class CitrixDeleteVMSnapshotCommandWrapper extends CommandWrapper<D
|
||||||
if (command.getTarget().getType() == VMSnapshot.Type.DiskAndMemory) {
|
if (command.getTarget().getType() == VMSnapshot.Type.DiskAndMemory) {
|
||||||
vdiList.add(snapshot.getSuspendVDI(conn));
|
vdiList.add(snapshot.getSuspendVDI(conn));
|
||||||
}
|
}
|
||||||
snapshot.destroy(conn);
|
citrixResourceBase.destroyVm(snapshot, conn, true);
|
||||||
for (final VDI vdi : vdiList) {
|
for (final VDI vdi : vdiList) {
|
||||||
vdi.destroy(conn);
|
vdi.destroy(conn);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,12 +51,12 @@ public final class CitrixRevertToVMSnapshotCommandWrapper extends CommandWrapper
|
||||||
final VMSnapshot.Type vmSnapshotType = command.getTarget().getType();
|
final VMSnapshot.Type vmSnapshotType = command.getTarget().getType();
|
||||||
final Boolean snapshotMemory = vmSnapshotType == VMSnapshot.Type.DiskAndMemory;
|
final Boolean snapshotMemory = vmSnapshotType == VMSnapshot.Type.DiskAndMemory;
|
||||||
final Connection conn = citrixResourceBase.getConnection();
|
final Connection conn = citrixResourceBase.getConnection();
|
||||||
PowerState vmState = null;
|
PowerState vmState;
|
||||||
VM vm = null;
|
VM vm;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
final Set<VM> vmSnapshots = VM.getByNameLabel(conn, command.getTarget().getSnapshotName());
|
final Set<VM> vmSnapshots = VM.getByNameLabel(conn, command.getTarget().getSnapshotName());
|
||||||
if (vmSnapshots == null || vmSnapshots.size() == 0) {
|
if (vmSnapshots == null || vmSnapshots.isEmpty()) {
|
||||||
return new RevertToVMSnapshotAnswer(command, false, "Cannot find vmSnapshot with name: " + command.getTarget().getSnapshotName());
|
return new RevertToVMSnapshotAnswer(command, false, "Cannot find vmSnapshot with name: " + command.getTarget().getSnapshotName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,6 +66,7 @@ public final class CitrixRevertToVMSnapshotCommandWrapper extends CommandWrapper
|
||||||
try {
|
try {
|
||||||
vm = citrixResourceBase.getVM(conn, vmName);
|
vm = citrixResourceBase.getVM(conn, vmName);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
|
logger.debug("Failed to find VM with name: {} due to:", vmName, e);
|
||||||
vm = citrixResourceBase.createWorkingVM(conn, vmName, command.getGuestOSType(), command.getPlatformEmulator(), listVolumeTo);
|
vm = citrixResourceBase.createWorkingVM(conn, vmName, command.getGuestOSType(), command.getPlatformEmulator(), listVolumeTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,7 +78,7 @@ public final class CitrixRevertToVMSnapshotCommandWrapper extends CommandWrapper
|
||||||
citrixResourceBase.revertToSnapshot(conn, vmSnapshot, vmName, vm.getUuid(conn), snapshotMemory, citrixResourceBase.getHost().getUuid());
|
citrixResourceBase.revertToSnapshot(conn, vmSnapshot, vmName, vm.getUuid(conn), snapshotMemory, citrixResourceBase.getHost().getUuid());
|
||||||
vm = citrixResourceBase.getVM(conn, vmName);
|
vm = citrixResourceBase.getVM(conn, vmName);
|
||||||
final Set<VBD> vbds = vm.getVBDs(conn);
|
final Set<VBD> vbds = vm.getVBDs(conn);
|
||||||
final Map<String, VDI> vdiMap = new HashMap<String, VDI>();
|
final Map<String, VDI> vdiMap = new HashMap<>();
|
||||||
// get vdi:vbdr to a map
|
// get vdi:vbdr to a map
|
||||||
for (final VBD vbd : vbds) {
|
for (final VBD vbd : vbds) {
|
||||||
final VBD.Record vbdr = vbd.getRecord(conn);
|
final VBD.Record vbdr = vbd.getRecord(conn);
|
||||||
|
|
@ -88,7 +89,7 @@ public final class CitrixRevertToVMSnapshotCommandWrapper extends CommandWrapper
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!snapshotMemory) {
|
if (!snapshotMemory) {
|
||||||
vm.destroy(conn);
|
citrixResourceBase.destroyVm(vm, conn);
|
||||||
vmState = PowerState.PowerOff;
|
vmState = PowerState.PowerOff;
|
||||||
} else {
|
} else {
|
||||||
vmState = PowerState.PowerOn;
|
vmState = PowerState.PowerOn;
|
||||||
|
|
@ -103,7 +104,7 @@ public final class CitrixRevertToVMSnapshotCommandWrapper extends CommandWrapper
|
||||||
|
|
||||||
return new RevertToVMSnapshotAnswer(command, listVolumeTo, vmState);
|
return new RevertToVMSnapshotAnswer(command, listVolumeTo, vmState);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
logger.error("revert vm " + vmName + " to snapshot " + command.getTarget().getSnapshotName() + " failed due to " + e.getMessage());
|
logger.error("revert vm {} to snapshot {} failed due to {}", vmName, command.getTarget().getSnapshotName(), e.getMessage());
|
||||||
return new RevertToVMSnapshotAnswer(command, false, e.getMessage());
|
return new RevertToVMSnapshotAnswer(command, false, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ public final class CitrixStartCommandWrapper extends CommandWrapper<StartCommand
|
||||||
for (final VM v : vms) {
|
for (final VM v : vms) {
|
||||||
final VM.Record vRec = v.getRecord(conn);
|
final VM.Record vRec = v.getRecord(conn);
|
||||||
if (vRec.powerState == VmPowerState.HALTED) {
|
if (vRec.powerState == VmPowerState.HALTED) {
|
||||||
v.destroy(conn);
|
citrixResourceBase.destroyVm(v, conn, true);
|
||||||
} else if (vRec.powerState == VmPowerState.RUNNING) {
|
} else if (vRec.powerState == VmPowerState.RUNNING) {
|
||||||
final String host = vRec.residentOn.getUuid(conn);
|
final String host = vRec.residentOn.getUuid(conn);
|
||||||
final String msg = "VM " + vmName + " is runing on host " + host;
|
final String msg = "VM " + vmName + " is runing on host " + host;
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ public final class CitrixStopCommandWrapper extends CommandWrapper<StopCommand,
|
||||||
for (final VIF vif : vifs) {
|
for (final VIF vif : vifs) {
|
||||||
networks.add(vif.getNetwork(conn));
|
networks.add(vif.getNetwork(conn));
|
||||||
}
|
}
|
||||||
vm.destroy(conn);
|
citrixResourceBase.destroyVm(vm, conn);
|
||||||
final SR sr = citrixResourceBase.getISOSRbyVmName(conn, command.getVmName(), false);
|
final SR sr = citrixResourceBase.getISOSRbyVmName(conn, command.getVmName(), false);
|
||||||
citrixResourceBase.removeSR(conn, sr);
|
citrixResourceBase.removeSR(conn, sr);
|
||||||
final SR configDriveSR = citrixResourceBase.getISOSRbyVmName(conn, command.getVmName(), true);
|
final SR configDriveSR = citrixResourceBase.getISOSRbyVmName(conn, command.getVmName(), true);
|
||||||
|
|
|
||||||
2
pom.xml
2
pom.xml
|
|
@ -50,7 +50,7 @@
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<project.systemvm.template.location>https://download.cloudstack.org/systemvm</project.systemvm.template.location>
|
<project.systemvm.template.location>https://download.cloudstack.org/systemvm</project.systemvm.template.location>
|
||||||
<project.systemvm.template.version>4.20.0.0</project.systemvm.template.version>
|
<project.systemvm.template.version>4.20.1.0</project.systemvm.template.version>
|
||||||
<sonar.organization>apache</sonar.organization>
|
<sonar.organization>apache</sonar.organization>
|
||||||
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
|
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@
|
||||||
"format": "qcow2",
|
"format": "qcow2",
|
||||||
"headless": true,
|
"headless": true,
|
||||||
"http_directory": "http",
|
"http_directory": "http",
|
||||||
"iso_checksum": "sha512:04a2a128852c2dff8bb71779ad325721385051eb1264d897bdb5918ab207a9b1de636ded149c56c61a09eb8c7f428496815e70d3be31b1b1cf4c70bf6427cedd",
|
"iso_checksum": "sha512:022895e699231c94abf7012f86cabc587dc576f07f856c87609d5d40c1f921d805a5a862cba94c1a47d09aaa565ec445222e338e73d1fa1affc4fc5908bb50ad",
|
||||||
"iso_url": "https://cdimage.debian.org/mirror/cdimage/release/12.9.0/arm64/iso-cd/debian-12.9.0-arm64-netinst.iso",
|
"iso_url": "https://cdimage.debian.org/mirror/cdimage/release/12.10.0/arm64/iso-cd/debian-12.10.0-arm64-netinst.iso",
|
||||||
"net_device": "virtio-net",
|
"net_device": "virtio-net",
|
||||||
"output_directory": "../dist",
|
"output_directory": "../dist",
|
||||||
"qemu_binary": "qemu-system-aarch64",
|
"qemu_binary": "qemu-system-aarch64",
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@
|
||||||
"format": "qcow2",
|
"format": "qcow2",
|
||||||
"headless": true,
|
"headless": true,
|
||||||
"http_directory": "http",
|
"http_directory": "http",
|
||||||
"iso_checksum": "sha512:04a2a128852c2dff8bb71779ad325721385051eb1264d897bdb5918ab207a9b1de636ded149c56c61a09eb8c7f428496815e70d3be31b1b1cf4c70bf6427cedd",
|
"iso_checksum": "sha512:022895e699231c94abf7012f86cabc587dc576f07f856c87609d5d40c1f921d805a5a862cba94c1a47d09aaa565ec445222e338e73d1fa1affc4fc5908bb50ad",
|
||||||
"iso_url": "https://cdimage.debian.org/mirror/cdimage/release/12.9.0/arm64/iso-cd/debian-12.9.0-arm64-netinst.iso",
|
"iso_url": "https://cdimage.debian.org/mirror/cdimage/release/12.10.0/arm64/iso-cd/debian-12.10.0-arm64-netinst.iso",
|
||||||
"net_device": "virtio-net",
|
"net_device": "virtio-net",
|
||||||
"output_directory": "../dist",
|
"output_directory": "../dist",
|
||||||
"qemu_binary": "qemu-system-aarch64",
|
"qemu_binary": "qemu-system-aarch64",
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@
|
||||||
"format": "qcow2",
|
"format": "qcow2",
|
||||||
"headless": true,
|
"headless": true,
|
||||||
"http_directory": "http",
|
"http_directory": "http",
|
||||||
"iso_checksum": "sha512:9ebe405c3404a005ce926e483bc6c6841b405c4d85e0c8a7b1707a7fe4957c617ae44bd807a57ec3e5c2d3e99f2101dfb26ef36b3720896906bdc3aaeec4cd80",
|
"iso_checksum": "sha512:cb089def0684fd93c9c2fbe45fd16ecc809c949a6fd0c91ee199faefe7d4b82b64658a264a13109d59f1a40ac3080be2f7bd3d8bf3e9cdf509add6d72576a79b",
|
||||||
"iso_url": "https://cdimage.debian.org/mirror/cdimage/release/12.9.0/amd64/iso-cd/debian-12.9.0-amd64-netinst.iso",
|
"iso_url": "https://cdimage.debian.org/mirror/cdimage/release/12.10.0/amd64/iso-cd/debian-12.10.0-amd64-netinst.iso",
|
||||||
"net_device": "virtio-net",
|
"net_device": "virtio-net",
|
||||||
"output_directory": "../dist",
|
"output_directory": "../dist",
|
||||||
"qemuargs": [
|
"qemuargs": [
|
||||||
|
|
|
||||||
|
|
@ -636,9 +636,9 @@
|
||||||
"label.create.template": "Create Template",
|
"label.create.template": "Create Template",
|
||||||
"label.create.tier.aclid.description": "The ACL associated with the Network Tier.",
|
"label.create.tier.aclid.description": "The ACL associated with the Network Tier.",
|
||||||
"label.create.tier.externalid.description": "ID of the Network in an external system.",
|
"label.create.tier.externalid.description": "ID of the Network in an external system.",
|
||||||
"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.",
|
"label.create.tier.gateway.description": "Gateway IP must be within VPC CIDR ({value})",
|
||||||
"label.create.tier.name.description": "A unique name for the Network Tier.",
|
"label.create.tier.name.description": "A unique name for the Network Tier.",
|
||||||
"label.create.tier.netmask.description": "The Network Tier's netmask. For example 255.255.255.0",
|
"label.create.tier.netmask.description": "Network Tier's netmask must be more restrictive than {value}",
|
||||||
"label.create.tier.networkofferingid.description": "The Network offering for the Network Tier.",
|
"label.create.tier.networkofferingid.description": "The Network offering for the Network Tier.",
|
||||||
"label.create.tungsten.routing.policy": "Create Tungsten-Fabric routing policy",
|
"label.create.tungsten.routing.policy": "Create Tungsten-Fabric routing policy",
|
||||||
"label.create.user": "Create User",
|
"label.create.user": "Create User",
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
>
|
>
|
||||||
<div v-for="(item, index) in dataResource" :key="index">
|
<div v-for="(item, index) in dataResource" :key="index">
|
||||||
<a-form-item
|
<a-form-item
|
||||||
v-if="item.resourcetypename !== 'project'"
|
v-if="item.resourcetypename !== 'project' || !$route.path.startsWith('/project')"
|
||||||
:v-bind="item.resourcetypename"
|
:v-bind="item.resourcetypename"
|
||||||
:label="$t('label.max' + (item.resourcetypename ? item.resourcetypename.replace('_', '') : '')) + (item.tag ? ' [' + item.tag + ']': '')"
|
:label="$t('label.max' + (item.resourcetypename ? item.resourcetypename.replace('_', '') : '')) + (item.tag ? ' [' + item.tag + ']': '')"
|
||||||
:name="item.key"
|
:name="item.key"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
// Parsing CIDR into Gateway,Netmask Placeholders
|
||||||
|
|
||||||
|
export function getNetmaskFromCidr (cidr) {
|
||||||
|
if (!cidr?.includes('/')) return undefined
|
||||||
|
const [, maskBits] = cidr.split('/')
|
||||||
|
const subnetMasks = {
|
||||||
|
8: '255.0.0.0',
|
||||||
|
9: '255.128.0.0',
|
||||||
|
10: '255.192.0.0',
|
||||||
|
11: '255.224.0.0',
|
||||||
|
12: '255.240.0.0',
|
||||||
|
13: '255.248.0.0',
|
||||||
|
14: '255.252.0.0',
|
||||||
|
15: '255.254.0.0',
|
||||||
|
16: '255.255.0.0',
|
||||||
|
17: '255.255.128.0',
|
||||||
|
18: '255.255.192.0',
|
||||||
|
19: '255.255.224.0',
|
||||||
|
20: '255.255.240.0',
|
||||||
|
21: '255.255.248.0',
|
||||||
|
22: '255.255.252.0',
|
||||||
|
23: '255.255.254.0',
|
||||||
|
24: '255.255.255.0',
|
||||||
|
25: '255.255.255.128',
|
||||||
|
26: '255.255.255.192',
|
||||||
|
27: '255.255.255.224',
|
||||||
|
28: '255.255.255.240',
|
||||||
|
29: '255.255.255.248',
|
||||||
|
30: '255.255.255.252',
|
||||||
|
31: '255.255.255.254',
|
||||||
|
32: '255.255.255.255'
|
||||||
|
}
|
||||||
|
return subnetMasks[+maskBits] || '255.255.255.0'
|
||||||
|
}
|
||||||
|
|
@ -463,9 +463,13 @@ export default {
|
||||||
},
|
},
|
||||||
listProject () {
|
listProject () {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
api('listProjects', { id: store.getters.project.id }).then(json => {
|
const params = {
|
||||||
|
id: store.getters.project.id,
|
||||||
|
listall: true
|
||||||
|
}
|
||||||
|
api('listProjects', params).then(json => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
if (json && json.listprojectsresponse && json.listprojectsresponse.project) {
|
if (json?.listprojectsresponse?.project) {
|
||||||
this.project = json.listprojectsresponse.project[0]
|
this.project = json.listprojectsresponse.project[0]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -242,18 +242,18 @@
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item ref="gateway" name="gateway" :colon="false">
|
<a-form-item ref="gateway" name="gateway" :colon="false">
|
||||||
<template #label>
|
<template #label>
|
||||||
<tooltip-label :title="$t('label.gateway')" :tooltip="$t('label.create.tier.gateway.description')"/>
|
<tooltip-label :title="$t('label.gateway')" :tooltip="gatewayPlaceholder"/>
|
||||||
</template>
|
</template>
|
||||||
<a-input
|
<a-input
|
||||||
:placeholder="$t('label.create.tier.gateway.description')"
|
:placeholder="gatewayPlaceholder"
|
||||||
v-model:value="form.gateway"></a-input>
|
v-model:value="form.gateway"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item ref="netmask" name="netmask" :colon="false">
|
<a-form-item ref="netmask" name="netmask" :colon="false">
|
||||||
<template #label>
|
<template #label>
|
||||||
<tooltip-label :title="$t('label.netmask')" :tooltip="$t('label.create.tier.netmask.description')"/>
|
<tooltip-label :title="$t('label.netmask')" :tooltip="netmaskPlaceholder"/>
|
||||||
</template>
|
</template>
|
||||||
<a-input
|
<a-input
|
||||||
:placeholder="$t('label.create.tier.netmask.description')"
|
:placeholder="netmaskPlaceholder"
|
||||||
v-model:value="form.netmask"></a-input>
|
v-model:value="form.netmask"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item ref="externalId" name="externalId" :colon="false">
|
<a-form-item ref="externalId" name="externalId" :colon="false">
|
||||||
|
|
@ -363,6 +363,7 @@ import { api } from '@/api'
|
||||||
import { mixinForm } from '@/utils/mixin'
|
import { mixinForm } from '@/utils/mixin'
|
||||||
import Status from '@/components/widgets/Status'
|
import Status from '@/components/widgets/Status'
|
||||||
import TooltipLabel from '@/components/widgets/TooltipLabel'
|
import TooltipLabel from '@/components/widgets/TooltipLabel'
|
||||||
|
import { getNetmaskFromCidr } from '@/utils/network'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'VpcTiersTab',
|
name: 'VpcTiersTab',
|
||||||
|
|
@ -400,6 +401,8 @@ export default {
|
||||||
selectedNetworkOffering: {},
|
selectedNetworkOffering: {},
|
||||||
privateMtuMax: 1500,
|
privateMtuMax: 1500,
|
||||||
errorPrivateMtu: '',
|
errorPrivateMtu: '',
|
||||||
|
gatewayPlaceholder: '',
|
||||||
|
netmaskPlaceholder: '',
|
||||||
algorithms: {
|
algorithms: {
|
||||||
Source: 'source',
|
Source: 'source',
|
||||||
'Round-robin': 'roundrobin',
|
'Round-robin': 'roundrobin',
|
||||||
|
|
@ -696,6 +699,13 @@ export default {
|
||||||
this.initForm()
|
this.initForm()
|
||||||
this.fetchNetworkAclList()
|
this.fetchNetworkAclList()
|
||||||
this.fetchNetworkOfferings()
|
this.fetchNetworkOfferings()
|
||||||
|
const cidr = this.resource.cidr
|
||||||
|
const netmask = getNetmaskFromCidr(cidr)
|
||||||
|
if (netmask) {
|
||||||
|
this.gatewayPlaceholder = this.$t('label.create.tier.gateway.description', { value: cidr })
|
||||||
|
this.netmaskPlaceholder = this.$t('label.create.tier.netmask.description', { value: netmask })
|
||||||
|
}
|
||||||
|
|
||||||
this.showCreateNetworkModal = true
|
this.showCreateNetworkModal = true
|
||||||
this.rules = {
|
this.rules = {
|
||||||
name: [{ required: true, message: this.$t('label.required') }],
|
name: [{ required: true, message: this.$t('label.required') }],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue