mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge remote-tracking branch 'origin/4.19' into main
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
commit
f358813e1d
@ -593,6 +593,7 @@ public class ApiConstants {
|
||||
public static final String AGGREGATE_NAME = "aggregatename";
|
||||
public static final String POOL_NAME = "poolname";
|
||||
public static final String VOLUME_NAME = "volumename";
|
||||
public static final String VOLUME_STATE = "volumestate";
|
||||
public static final String SNAPSHOT_POLICY = "snapshotpolicy";
|
||||
public static final String SNAPSHOT_RESERVATION = "snapshotreservation";
|
||||
public static final String IP_NETWORK_LIST = "iptonetworklist";
|
||||
|
||||
@ -71,6 +71,10 @@ public class SnapshotResponse extends BaseResponseWithTagInformation implements
|
||||
@Param(description = "type of the disk volume")
|
||||
private String volumeType;
|
||||
|
||||
@SerializedName(ApiConstants.VOLUME_STATE)
|
||||
@Param(description = "state of the disk volume")
|
||||
private String volumeState;
|
||||
|
||||
@SerializedName(ApiConstants.CREATED)
|
||||
@Param(description = " the date the snapshot was created")
|
||||
private Date created;
|
||||
@ -199,6 +203,10 @@ public class SnapshotResponse extends BaseResponseWithTagInformation implements
|
||||
this.volumeType = volumeType;
|
||||
}
|
||||
|
||||
public void setVolumeState(String volumeState) {
|
||||
this.volumeState = volumeState;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
@ -48,6 +48,7 @@ SELECT
|
||||
`volumes`.`uuid` AS `volume_uuid`,
|
||||
`volumes`.`name` AS `volume_name`,
|
||||
`volumes`.`volume_type` AS `volume_type`,
|
||||
`volumes`.`state` AS `volume_state`,
|
||||
`volumes`.`size` AS `volume_size`,
|
||||
`data_center`.`id` AS `data_center_id`,
|
||||
`data_center`.`uuid` AS `data_center_uuid`,
|
||||
|
||||
@ -669,6 +669,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
snapshotResponse.setVolumeId(volume.getUuid());
|
||||
snapshotResponse.setVolumeName(volume.getName());
|
||||
snapshotResponse.setVolumeType(volume.getVolumeType().name());
|
||||
snapshotResponse.setVolumeState(volume.getState().name());
|
||||
snapshotResponse.setVirtualSize(volume.getSize());
|
||||
DataCenter zone = ApiDBUtils.findZoneById(volume.getDataCenterId());
|
||||
if (zone != null) {
|
||||
|
||||
@ -125,6 +125,7 @@ public class SnapshotJoinDaoImpl extends GenericDaoBaseWithTagInformation<Snapsh
|
||||
snapshotResponse.setVolumeId(snapshot.getVolumeUuid());
|
||||
snapshotResponse.setVolumeName(snapshot.getVolumeName());
|
||||
snapshotResponse.setVolumeType(snapshot.getVolumeType().name());
|
||||
snapshotResponse.setVolumeState(snapshot.getVolumeState().name());
|
||||
snapshotResponse.setVirtualSize(snapshot.getVolumeSize());
|
||||
VolumeVO volume = ApiDBUtils.findVolumeById(snapshot.getVolumeId());
|
||||
if (volume != null && volume.getVolumeType() == Type.ROOT && volume.getInstanceId() != null) {
|
||||
|
||||
@ -132,6 +132,10 @@ public class SnapshotJoinVO extends BaseViewWithTagInformationVO implements Cont
|
||||
@Enumerated(EnumType.STRING)
|
||||
Volume.Type volumeType = Volume.Type.UNKNOWN;
|
||||
|
||||
@Column(name = "volume_state")
|
||||
@Enumerated(EnumType.STRING)
|
||||
Volume.State volumeState;
|
||||
|
||||
@Column(name = "volume_size")
|
||||
Long volumeSize;
|
||||
|
||||
@ -299,6 +303,10 @@ public class SnapshotJoinVO extends BaseViewWithTagInformationVO implements Cont
|
||||
return volumeType;
|
||||
}
|
||||
|
||||
public Volume.State getVolumeState() {
|
||||
return volumeState;
|
||||
}
|
||||
|
||||
public Long getVolumeSize() {
|
||||
return volumeSize;
|
||||
}
|
||||
|
||||
@ -25,7 +25,8 @@ CentOS based built-in user VM template.
|
||||
|
||||
# Setting up Tools and Environment
|
||||
|
||||
- Install packer and latest KVM, qemu on a Linux machine
|
||||
- Install packer (v1.8.x, v1.9.x tested) and latest KVM, qemu on a Linux x86
|
||||
machine (Ubuntu 20.04 tested)
|
||||
- Install tools for exporting appliances: qemu-img, ovftool, faketime, sharutils
|
||||
- Build and install `vhd-util` as described in build.sh or use pre-built
|
||||
binaries at:
|
||||
@ -33,10 +34,18 @@ CentOS based built-in user VM template.
|
||||
http://packages.shapeblue.com/systemvmtemplate/vhd-util
|
||||
http://packages.shapeblue.com/systemvmtemplate/libvhd.so.1.0
|
||||
|
||||
- For building ARM64 systemvm template on amd64 systems, please also install:
|
||||
qemu-utils qemu-system-arm qemu-efi-aarch64
|
||||
|
||||
# How to build appliances
|
||||
|
||||
Just run build.sh, it will export archived appliances for KVM, XenServer,
|
||||
VMWare and HyperV in `dist` directory:
|
||||
|
||||
bash build.sh systemvmtemplate
|
||||
bash build.sh <name> <version> <arch>
|
||||
bash build.sh systemvmtemplate 4.19.1.0 x86_64
|
||||
bash build.sh systemvmtemplate 4.19.1.0 aarch64
|
||||
|
||||
For building builtin x86_64 template run:
|
||||
|
||||
bash build.sh builtin
|
||||
|
||||
@ -27,6 +27,8 @@ Usage:
|
||||
(or use command line arg, default systemvmtemplate)
|
||||
* Set \$version to provide version to apply to built appliance
|
||||
(or use command line arg, default empty)
|
||||
* Set \$target_arch to provide target architecture
|
||||
(or use command line arg, default to current architecture. Currently x86_64 and aarch64 are implemented)
|
||||
* Set \$BUILD_NUMBER to provide build number to apply to built appliance
|
||||
(or use command line arg, default empty)
|
||||
* Set \$DEBUG=1 to enable debug logging
|
||||
@ -85,12 +87,18 @@ if [[ ! -z "${JENKINS_HOME}" ]]; then
|
||||
DEBUG=1
|
||||
fi
|
||||
|
||||
# get current system architecture
|
||||
base_arch=`arch`
|
||||
|
||||
# which packer definition to use
|
||||
appliance="${1:-${appliance:-systemvmtemplate}}"
|
||||
|
||||
# optional version tag to put into the image filename
|
||||
version="${2:-${version:-}}"
|
||||
|
||||
# which architecture to build the template for
|
||||
target_arch="${3:-${target_arch:-${base_arch}}}"
|
||||
|
||||
# optional (jenkins) build number tag to put into the image filename
|
||||
BUILD_NUMBER="${4:-${BUILD_NUMBER:-}}"
|
||||
|
||||
@ -105,7 +113,7 @@ elif [ ! -z "${BUILD_NUMBER}" ]; then
|
||||
version_tag="-${BUILD_NUMBER}"
|
||||
fi
|
||||
|
||||
appliance_build_name=${appliance}${version_tag}
|
||||
appliance_build_name="${appliance}${version_tag}-${target_arch}"
|
||||
|
||||
###
|
||||
### Generic helper functions
|
||||
@ -218,7 +226,7 @@ function prepare() {
|
||||
|
||||
function packer_build() {
|
||||
log INFO "building new image with packer"
|
||||
cd ${appliance_build_name} && packer build template.json && cd ..
|
||||
cd ${appliance_build_name} && packer build template-base_${base_arch}-target_${target_arch}.json && cd ..
|
||||
}
|
||||
|
||||
function stage_vmx() {
|
||||
@ -349,10 +357,12 @@ function main() {
|
||||
|
||||
# process the disk at dist
|
||||
kvm_export
|
||||
if [ "${target_arch}" == "x86_64" ]; then
|
||||
ovm_export
|
||||
xen_server_export
|
||||
vmware_export
|
||||
hyperv_export
|
||||
fi
|
||||
rm -f "dist/${appliance}"
|
||||
cd dist && chmod +r * && cd ..
|
||||
cd dist && md5sum * > md5sum.txt && cd ..
|
||||
|
||||
122
tools/appliance/systemvmtemplate/http/preseed_aarch64.cfg
Normal file
122
tools/appliance/systemvmtemplate/http/preseed_aarch64.cfg
Normal file
@ -0,0 +1,122 @@
|
||||
# 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.
|
||||
|
||||
### Localization
|
||||
# Locale sets language and country.
|
||||
d-i debian-installer/locale string en_US.UTF-8
|
||||
d-i debian-installer/country string IN
|
||||
|
||||
# Keyboard selection.
|
||||
d-i keymap select us
|
||||
d-i keyboard-configuration/xkb-keymap select us
|
||||
|
||||
### Network configuration
|
||||
d-i netcfg/choose_interface select auto
|
||||
d-i netcfg/get_hostname string systemvm
|
||||
d-i netcfg/get_domain string apache.org
|
||||
d-i netcfg/wireless_wep string
|
||||
|
||||
d-i hw-detect/load_firmware boolean true
|
||||
|
||||
### Mirror settings
|
||||
d-i mirror/country string manual
|
||||
d-i mirror/http/hostname string deb.debian.org
|
||||
d-i mirror/http/directory string /debian
|
||||
d-i mirror/http/proxy string
|
||||
|
||||
### Apt setup
|
||||
d-i apt-setup/cdrom/set-first false
|
||||
d-i apt-setup/security-updates boolean true
|
||||
d-i apt-setup/services-select multiselect security, updates
|
||||
d-i apt-setup/security_host string security.debian.org
|
||||
d-i apt-setup/local0/source boolean false
|
||||
d-i apt-setup/multiarch string i386
|
||||
d-i apt-setup/backports boolean true
|
||||
d-i apt-setup/contrib boolean true
|
||||
d-i apt-setup/multiverse boolean true
|
||||
d-i apt-setup/universe boolean true
|
||||
|
||||
### Clock and time zone setup
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string UTC
|
||||
d-i clock-setup/ntp boolean true
|
||||
|
||||
### Partitioning
|
||||
d-i partman-auto/disk string /dev/vda
|
||||
d-i partman-auto/method string regular
|
||||
d-i partman-auto/expert_recipe string \
|
||||
boot-root :: \
|
||||
538 538 1075 free \
|
||||
$iflabel{ gpt } \
|
||||
$reusemethod{ } \
|
||||
method{ efi } \
|
||||
format{ } \
|
||||
. \
|
||||
400 60 400 ext2 \
|
||||
$primary{ } $bootable{ } \
|
||||
method{ format } format{ } \
|
||||
use_filesystem{ } filesystem{ ext2 } \
|
||||
mountpoint{ /boot } \
|
||||
. \
|
||||
256 1000 256 linux-swap \
|
||||
method{ swap } format{ } \
|
||||
. \
|
||||
2240 40 4000 ext4 \
|
||||
method{ format } format{ } \
|
||||
use_filesystem{ } filesystem{ ext4 } \
|
||||
mountpoint{ / } \
|
||||
.
|
||||
|
||||
d-i partman-md/confirm boolean true
|
||||
d-i partman-partitioning/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
grub-efi-arm64 grub2/force_efi_extra_removable boolean true
|
||||
d-i partman-partitioning/choose_label select gpt
|
||||
d-i partman-partitioning/default_label string gpt
|
||||
|
||||
### Base system installation
|
||||
# ...
|
||||
|
||||
### Account setup
|
||||
d-i passwd/root-login boolean false
|
||||
d-i passwd/root-password password password
|
||||
d-i passwd/root-password-again password password
|
||||
d-i passwd/user-fullname string Cloud User
|
||||
d-i passwd/username string cloud
|
||||
d-i passwd/user-password password cloud
|
||||
d-i passwd/user-password-again password cloud
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i passwd/user-default-groups string audio cdrom video admin
|
||||
|
||||
### Package selection
|
||||
tasksel tasksel/first multiselect ssh-server
|
||||
d-i pkgsel/include string openssh-server ntp acpid sudo bzip2 openssl
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select full-upgrade
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
popularity-contest popularity-contest/participate boolean false
|
||||
|
||||
### Boot loader installation
|
||||
d-i grub-installer/only_debian boolean true
|
||||
d-i grub-installer/bootdev string default
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
#### Advanced options
|
||||
@ -83,7 +83,7 @@ function install_packages() {
|
||||
apt_clean
|
||||
|
||||
# 32 bit architecture support for vhd-util
|
||||
if [ "${arch}" != "i386" ]; then
|
||||
if [[ "${arch}" != "i386" && "${arch}" != "arm64" ]]; then
|
||||
dpkg --add-architecture i386
|
||||
apt-get update
|
||||
${apt_get} install libuuid1:i386 libc6:i386
|
||||
@ -92,17 +92,25 @@ function install_packages() {
|
||||
# Install docker and containerd for CKS
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
|
||||
apt-key fingerprint 0EBFCD88
|
||||
if [ "${arch}" == "arm64" ]; then
|
||||
add-apt-repository "deb [arch=arm64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
|
||||
elif [ "${arch}" == "amd64" ]; then
|
||||
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
|
||||
else
|
||||
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
|
||||
fi
|
||||
apt-get update
|
||||
${apt_get} install containerd.io
|
||||
|
||||
apt_clean
|
||||
|
||||
if [ "${arch}" != "arm64" ]; then
|
||||
install_vhd_util
|
||||
# Install xenserver guest utilities as debian repos don't have it
|
||||
wget --no-check-certificate https://download.cloudstack.org/systemvm/debian/xe-guest-utilities_7.20.2-0ubuntu1_amd64.deb
|
||||
dpkg -i xe-guest-utilities_7.20.2-0ubuntu1_amd64.deb
|
||||
rm -f xe-guest-utilities_7.20.2-0ubuntu1_amd64.deb
|
||||
fi
|
||||
}
|
||||
|
||||
return 2>/dev/null || install_packages
|
||||
|
||||
@ -0,0 +1,93 @@
|
||||
{
|
||||
"_license": "Apache License 2.0",
|
||||
"builders": [
|
||||
{
|
||||
"accelerator": "kvm",
|
||||
"boot_command": [
|
||||
"c<wait>",
|
||||
"linux /install.a64/vmlinuz <wait>",
|
||||
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed_aarch64.cfg <wait>",
|
||||
"debian-installer=en_US.UTF-8 <wait>",
|
||||
"auto <wait>",
|
||||
"language=en locale=en_US.UTF-8 <wait>",
|
||||
"kbd-chooser/method=us <wait>",
|
||||
"keyboard-configuration/xkb-keymap=us <wait>",
|
||||
"netcfg/get_hostname=systemvm <wait>",
|
||||
"netcfg/get_domain=apache.org <wait>",
|
||||
"country=IN keymap=us <wait>",
|
||||
"fb=false <wait>",
|
||||
"debconf/frontend=noninteractive <wait>",
|
||||
"console-setup/ask_detect=false <wait>",
|
||||
"console-keymaps-at/keymap=us <wait>",
|
||||
"---",
|
||||
"<enter><wait>",
|
||||
"initrd /install.a64/initrd.gz",
|
||||
"<enter><wait>",
|
||||
"boot<enter><wait>"
|
||||
],
|
||||
"boot_wait": "180s",
|
||||
"disk_interface": "virtio",
|
||||
"cdrom_interface": "virtio-scsi",
|
||||
"disk_size": "5000M",
|
||||
"format": "qcow2",
|
||||
"headless": true,
|
||||
"http_directory": "http",
|
||||
"iso_checksum": "sha512:14c2ca243ee7f6e447cc4466296d974ee36645c06d72043236c3fbea78f1948d3af88d65139105a475288f270e4b636e6885143d01bdf69462620d1825e470ae",
|
||||
"iso_url": "https://cdimage.debian.org/mirror/cdimage/archive/12.5.0/arm64/iso-cd/debian-12.5.0-arm64-netinst.iso",
|
||||
"net_device": "virtio-net",
|
||||
"output_directory": "../dist",
|
||||
"qemu_binary": "qemu-system-aarch64",
|
||||
"qemuargs": [
|
||||
[
|
||||
"-m",
|
||||
"500M"
|
||||
],
|
||||
[
|
||||
"-machine",
|
||||
"virt"
|
||||
],
|
||||
[
|
||||
"-cpu",
|
||||
"host"
|
||||
],
|
||||
[
|
||||
"-smp",
|
||||
"1"
|
||||
],
|
||||
[ "-pflash", "/usr/share/AAVMF/AAVMF_CODE.fd" ],
|
||||
[ "-monitor", "none" ],
|
||||
[ "-enable-kvm" ],
|
||||
[ "-boot", "strict=off" ]
|
||||
],
|
||||
"shutdown_command": "sudo halt -p",
|
||||
"ssh_password": "cloud",
|
||||
"ssh_timeout": "120m",
|
||||
"ssh_username": "cloud",
|
||||
"type": "qemu",
|
||||
"vm_name": "systemvmtemplate"
|
||||
}
|
||||
],
|
||||
"description": "CloudStack SystemVM template",
|
||||
"provisioners": [
|
||||
{
|
||||
"execute_command": "echo 'cloud' | sudo -u root -S bash {{.Path}}",
|
||||
"scripts": [
|
||||
"scripts/apt_upgrade.sh",
|
||||
"scripts/configure_grub.sh",
|
||||
"scripts/configure_locale.sh",
|
||||
"scripts/configure_networking.sh",
|
||||
"scripts/configure_acpid.sh",
|
||||
"scripts/install_systemvm_packages.sh",
|
||||
"scripts/configure_conntrack.sh",
|
||||
"scripts/authorized_keys.sh",
|
||||
"scripts/configure_persistent_config.sh",
|
||||
"scripts/configure_login.sh",
|
||||
"../cloud_scripts_shar_archive.sh",
|
||||
"scripts/configure_systemvm_services.sh",
|
||||
"scripts/cleanup.sh",
|
||||
"scripts/finalize.sh"
|
||||
],
|
||||
"type": "shell"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
{
|
||||
"_license": "Apache License 2.0",
|
||||
"builders": [
|
||||
{
|
||||
"boot_command": [
|
||||
"c<wait>",
|
||||
"linux /install.a64/vmlinuz <wait>",
|
||||
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed_aarch64.cfg <wait>",
|
||||
"debian-installer=en_US.UTF-8 <wait>",
|
||||
"auto <wait>",
|
||||
"language=en locale=en_US.UTF-8 <wait>",
|
||||
"kbd-chooser/method=us <wait>",
|
||||
"keyboard-configuration/xkb-keymap=us <wait>",
|
||||
"netcfg/get_hostname=systemvm <wait>",
|
||||
"netcfg/get_domain=apache.org <wait>",
|
||||
"country=IN keymap=us <wait>",
|
||||
"fb=false <wait>",
|
||||
"debconf/frontend=noninteractive <wait>",
|
||||
"console-setup/ask_detect=false <wait>",
|
||||
"console-keymaps-at/keymap=us <wait>",
|
||||
"---",
|
||||
"<enter><wait>",
|
||||
"initrd /install.a64/initrd.gz",
|
||||
"<enter><wait>",
|
||||
"boot<enter><wait>"
|
||||
],
|
||||
"boot_wait": "60s",
|
||||
"disk_interface": "virtio",
|
||||
"cdrom_interface": "virtio-scsi",
|
||||
"disk_size": "5000M",
|
||||
"format": "qcow2",
|
||||
"headless": true,
|
||||
"http_directory": "http",
|
||||
"iso_checksum": "sha512:14c2ca243ee7f6e447cc4466296d974ee36645c06d72043236c3fbea78f1948d3af88d65139105a475288f270e4b636e6885143d01bdf69462620d1825e470ae",
|
||||
"iso_url": "https://cdimage.debian.org/mirror/cdimage/archive/12.5.0/arm64/iso-cd/debian-12.5.0-arm64-netinst.iso",
|
||||
"net_device": "virtio-net",
|
||||
"output_directory": "../dist",
|
||||
"qemu_binary": "qemu-system-aarch64",
|
||||
"qemuargs": [
|
||||
[
|
||||
"-m",
|
||||
"500M"
|
||||
],
|
||||
[
|
||||
"-machine",
|
||||
"virt"
|
||||
],
|
||||
[
|
||||
"-cpu",
|
||||
"cortex-a72"
|
||||
],
|
||||
[
|
||||
"-smp",
|
||||
"1"
|
||||
],
|
||||
[ "-bios", "/usr/share/qemu-efi-aarch64/QEMU_EFI.fd" ],
|
||||
[ "-monitor", "none" ],
|
||||
[ "-boot", "strict=off" ]
|
||||
],
|
||||
"shutdown_command": "sudo halt -p",
|
||||
"ssh_password": "cloud",
|
||||
"ssh_timeout": "120m",
|
||||
"ssh_username": "cloud",
|
||||
"type": "qemu",
|
||||
"vm_name": "systemvmtemplate"
|
||||
}
|
||||
],
|
||||
"description": "CloudStack SystemVM template",
|
||||
"provisioners": [
|
||||
{
|
||||
"execute_command": "echo 'cloud' | sudo -u root -S bash {{.Path}}",
|
||||
"scripts": [
|
||||
"scripts/apt_upgrade.sh",
|
||||
"scripts/configure_grub.sh",
|
||||
"scripts/configure_locale.sh",
|
||||
"scripts/configure_networking.sh",
|
||||
"scripts/configure_acpid.sh",
|
||||
"scripts/install_systemvm_packages.sh",
|
||||
"scripts/configure_conntrack.sh",
|
||||
"scripts/authorized_keys.sh",
|
||||
"scripts/configure_persistent_config.sh",
|
||||
"scripts/configure_login.sh",
|
||||
"../cloud_scripts_shar_archive.sh",
|
||||
"scripts/configure_systemvm_services.sh",
|
||||
"scripts/cleanup.sh",
|
||||
"scripts/finalize.sh"
|
||||
],
|
||||
"type": "shell"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -6,7 +6,7 @@
|
||||
"boot_command": [
|
||||
"<esc><wait>",
|
||||
"install <wait>",
|
||||
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg <wait>",
|
||||
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed_x86_64.cfg <wait>",
|
||||
"debian-installer=en_US.UTF-8 <wait>",
|
||||
"auto <wait>",
|
||||
"language=en locale=en_US.UTF-8 <wait>",
|
||||
@ -448,7 +448,8 @@
|
||||
<div class="resource-detail-item__label">{{ $t('label.volume') }}</div>
|
||||
<div class="resource-detail-item__details">
|
||||
<hdd-outlined />
|
||||
<router-link :to="{ path: '/volume/' + resource.volumeid }">{{ resource.volumename || resource.volume || resource.volumeid }} </router-link>
|
||||
<router-link v-if="validLinks.volume" :to="{ path: '/volume/' + resource.volumeid }">{{ resource.volumename || resource.volume || resource.volumeid }} </router-link>
|
||||
<span v-else>{{ resource.volumename || resource.volume || resource.volumeid }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="resource-detail-item" v-if="resource.associatednetworkid">
|
||||
@ -812,6 +813,7 @@
|
||||
<script>
|
||||
import { api } from '@/api'
|
||||
import { createPathBasedOnVmType } from '@/utils/plugins'
|
||||
import { validateLinks } from '@/utils/links'
|
||||
import Console from '@/components/widgets/Console'
|
||||
import OsLogo from '@/components/widgets/OsLogo'
|
||||
import Status from '@/components/widgets/Status'
|
||||
@ -877,7 +879,8 @@ export default {
|
||||
vpc: '',
|
||||
network: ''
|
||||
},
|
||||
newResource: {}
|
||||
newResource: {},
|
||||
validLinks: {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -894,6 +897,7 @@ export default {
|
||||
this.newResource = newData
|
||||
this.showKeys = false
|
||||
this.setData()
|
||||
this.validLinks = validateLinks(this.$router, this.isStatic, this.resource)
|
||||
|
||||
if ('apikey' in this.resource) {
|
||||
this.getUserKeys()
|
||||
|
||||
@ -167,7 +167,8 @@
|
||||
<router-link :to="{ path: getVmRouteUsingType(record) + record.virtualmachineid }">{{ text }}</router-link>
|
||||
</template>
|
||||
<template v-if="column.key === 'volumename'">
|
||||
<router-link :to="{ path: '/volume/' + record.volumeid }">{{ text }}</router-link>
|
||||
<router-link v-if="resourceIdToValidLinksMap[record.id]?.volume" :to="{ path: '/volume/' + record.volumeid }">{{ text }}</router-link>
|
||||
<span v-else>{{ text }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'size'">
|
||||
<span v-if="text && $route.path === '/kubernetes'">
|
||||
@ -523,6 +524,7 @@ import TooltipButton from '@/components/widgets/TooltipButton'
|
||||
import ResourceIcon from '@/components/view/ResourceIcon'
|
||||
import ResourceLabel from '@/components/widgets/ResourceLabel'
|
||||
import { createPathBasedOnVmType } from '@/utils/plugins'
|
||||
import { validateLinks } from '@/utils/links'
|
||||
import cronstrue from 'cronstrue/i18n'
|
||||
import moment from 'moment-timezone'
|
||||
|
||||
@ -615,6 +617,18 @@ export default {
|
||||
notification: 'storageallocatedthreshold',
|
||||
disable: 'storageallocateddisablethreshold'
|
||||
}
|
||||
},
|
||||
resourceIdToValidLinksMap: {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
items: {
|
||||
deep: true,
|
||||
handler (newData, oldData) {
|
||||
if (newData === oldData) return
|
||||
this.items.forEach(record => {
|
||||
this.resourceIdToValidLinksMap[record.id] = validateLinks(this.$router, false, record)
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
36
ui/src/utils/links.js
Normal file
36
ui/src/utils/links.js
Normal file
@ -0,0 +1,36 @@
|
||||
// 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.
|
||||
|
||||
export function validateLinks (router, isStatic, resource) {
|
||||
const validLinks = {
|
||||
volume: false
|
||||
}
|
||||
|
||||
if (isStatic) {
|
||||
return validLinks
|
||||
}
|
||||
|
||||
if (resource.volumeid && router.resolve('/volume/' + resource.volumeid).matched[0].redirect !== '/exception/404') {
|
||||
if (resource.volumestate) {
|
||||
validLinks.volume = resource.volumestate !== 'Expunged'
|
||||
} else {
|
||||
validLinks.volume = true
|
||||
}
|
||||
}
|
||||
|
||||
return validLinks
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user