Skip to content

Commit f358813

Browse files
Merge remote-tracking branch 'origin/4.19' into main
Signed-off-by: Rohit Yadav <[email protected]>
2 parents 1662af1 + f8385a4 commit f358813

File tree

17 files changed

+426
-19
lines changed

17 files changed

+426
-19
lines changed

api/src/main/java/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ public class ApiConstants {
593593
public static final String AGGREGATE_NAME = "aggregatename";
594594
public static final String POOL_NAME = "poolname";
595595
public static final String VOLUME_NAME = "volumename";
596+
public static final String VOLUME_STATE = "volumestate";
596597
public static final String SNAPSHOT_POLICY = "snapshotpolicy";
597598
public static final String SNAPSHOT_RESERVATION = "snapshotreservation";
598599
public static final String IP_NETWORK_LIST = "iptonetworklist";

api/src/main/java/org/apache/cloudstack/api/response/SnapshotResponse.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ public class SnapshotResponse extends BaseResponseWithTagInformation implements
7171
@Param(description = "type of the disk volume")
7272
private String volumeType;
7373

74+
@SerializedName(ApiConstants.VOLUME_STATE)
75+
@Param(description = "state of the disk volume")
76+
private String volumeState;
77+
7478
@SerializedName(ApiConstants.CREATED)
7579
@Param(description = " the date the snapshot was created")
7680
private Date created;
@@ -199,6 +203,10 @@ public void setVolumeType(String volumeType) {
199203
this.volumeType = volumeType;
200204
}
201205

206+
public void setVolumeState(String volumeState) {
207+
this.volumeState = volumeState;
208+
}
209+
202210
public void setCreated(Date created) {
203211
this.created = created;
204212
}

engine/schema/src/main/resources/META-INF/db/views/cloud.snapshot_view.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ SELECT
4848
`volumes`.`uuid` AS `volume_uuid`,
4949
`volumes`.`name` AS `volume_name`,
5050
`volumes`.`volume_type` AS `volume_type`,
51+
`volumes`.`state` AS `volume_state`,
5152
`volumes`.`size` AS `volume_size`,
5253
`data_center`.`id` AS `data_center_id`,
5354
`data_center`.`uuid` AS `data_center_uuid`,

server/src/main/java/com/cloud/api/ApiResponseHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,7 @@ public SnapshotResponse createSnapshotResponse(Snapshot snapshot) {
669669
snapshotResponse.setVolumeId(volume.getUuid());
670670
snapshotResponse.setVolumeName(volume.getName());
671671
snapshotResponse.setVolumeType(volume.getVolumeType().name());
672+
snapshotResponse.setVolumeState(volume.getState().name());
672673
snapshotResponse.setVirtualSize(volume.getSize());
673674
DataCenter zone = ApiDBUtils.findZoneById(volume.getDataCenterId());
674675
if (zone != null) {

server/src/main/java/com/cloud/api/query/dao/SnapshotJoinDaoImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ public SnapshotResponse newSnapshotResponse(ResponseObject.ResponseView view, bo
125125
snapshotResponse.setVolumeId(snapshot.getVolumeUuid());
126126
snapshotResponse.setVolumeName(snapshot.getVolumeName());
127127
snapshotResponse.setVolumeType(snapshot.getVolumeType().name());
128+
snapshotResponse.setVolumeState(snapshot.getVolumeState().name());
128129
snapshotResponse.setVirtualSize(snapshot.getVolumeSize());
129130
VolumeVO volume = ApiDBUtils.findVolumeById(snapshot.getVolumeId());
130131
if (volume != null && volume.getVolumeType() == Type.ROOT && volume.getInstanceId() != null) {

server/src/main/java/com/cloud/api/query/vo/SnapshotJoinVO.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ public class SnapshotJoinVO extends BaseViewWithTagInformationVO implements Cont
132132
@Enumerated(EnumType.STRING)
133133
Volume.Type volumeType = Volume.Type.UNKNOWN;
134134

135+
@Column(name = "volume_state")
136+
@Enumerated(EnumType.STRING)
137+
Volume.State volumeState;
138+
135139
@Column(name = "volume_size")
136140
Long volumeSize;
137141

@@ -299,6 +303,10 @@ public Volume.Type getVolumeType() {
299303
return volumeType;
300304
}
301305

306+
public Volume.State getVolumeState() {
307+
return volumeState;
308+
}
309+
302310
public Long getVolumeSize() {
303311
return volumeSize;
304312
}

tools/appliance/README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,27 @@ CentOS based built-in user VM template.
2525

2626
# Setting up Tools and Environment
2727

28-
- Install packer and latest KVM, qemu on a Linux machine
28+
- Install packer (v1.8.x, v1.9.x tested) and latest KVM, qemu on a Linux x86
29+
machine (Ubuntu 20.04 tested)
2930
- Install tools for exporting appliances: qemu-img, ovftool, faketime, sharutils
3031
- Build and install `vhd-util` as described in build.sh or use pre-built
3132
binaries at:
3233

3334
http://packages.shapeblue.com/systemvmtemplate/vhd-util
3435
http://packages.shapeblue.com/systemvmtemplate/libvhd.so.1.0
3536

37+
- For building ARM64 systemvm template on amd64 systems, please also install:
38+
qemu-utils qemu-system-arm qemu-efi-aarch64
39+
3640
# How to build appliances
3741

3842
Just run build.sh, it will export archived appliances for KVM, XenServer,
3943
VMWare and HyperV in `dist` directory:
4044

41-
bash build.sh systemvmtemplate
45+
bash build.sh <name> <version> <arch>
46+
bash build.sh systemvmtemplate 4.19.1.0 x86_64
47+
bash build.sh systemvmtemplate 4.19.1.0 aarch64
48+
49+
For building builtin x86_64 template run:
50+
4251
bash build.sh builtin

tools/appliance/build.sh

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Usage:
2727
(or use command line arg, default systemvmtemplate)
2828
* Set \$version to provide version to apply to built appliance
2929
(or use command line arg, default empty)
30+
* Set \$target_arch to provide target architecture
31+
(or use command line arg, default to current architecture. Currently x86_64 and aarch64 are implemented)
3032
* Set \$BUILD_NUMBER to provide build number to apply to built appliance
3133
(or use command line arg, default empty)
3234
* Set \$DEBUG=1 to enable debug logging
@@ -85,12 +87,18 @@ if [[ ! -z "${JENKINS_HOME}" ]]; then
8587
DEBUG=1
8688
fi
8789

90+
# get current system architecture
91+
base_arch=`arch`
92+
8893
# which packer definition to use
8994
appliance="${1:-${appliance:-systemvmtemplate}}"
9095

9196
# optional version tag to put into the image filename
9297
version="${2:-${version:-}}"
9398

99+
# which architecture to build the template for
100+
target_arch="${3:-${target_arch:-${base_arch}}}"
101+
94102
# optional (jenkins) build number tag to put into the image filename
95103
BUILD_NUMBER="${4:-${BUILD_NUMBER:-}}"
96104

@@ -105,7 +113,7 @@ elif [ ! -z "${BUILD_NUMBER}" ]; then
105113
version_tag="-${BUILD_NUMBER}"
106114
fi
107115

108-
appliance_build_name=${appliance}${version_tag}
116+
appliance_build_name="${appliance}${version_tag}-${target_arch}"
109117

110118
###
111119
### Generic helper functions
@@ -218,7 +226,7 @@ function prepare() {
218226

219227
function packer_build() {
220228
log INFO "building new image with packer"
221-
cd ${appliance_build_name} && packer build template.json && cd ..
229+
cd ${appliance_build_name} && packer build template-base_${base_arch}-target_${target_arch}.json && cd ..
222230
}
223231

224232
function stage_vmx() {
@@ -349,10 +357,12 @@ function main() {
349357

350358
# process the disk at dist
351359
kvm_export
352-
ovm_export
353-
xen_server_export
354-
vmware_export
355-
hyperv_export
360+
if [ "${target_arch}" == "x86_64" ]; then
361+
ovm_export
362+
xen_server_export
363+
vmware_export
364+
hyperv_export
365+
fi
356366
rm -f "dist/${appliance}"
357367
cd dist && chmod +r * && cd ..
358368
cd dist && md5sum * > md5sum.txt && cd ..
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
### Localization
19+
# Locale sets language and country.
20+
d-i debian-installer/locale string en_US.UTF-8
21+
d-i debian-installer/country string IN
22+
23+
# Keyboard selection.
24+
d-i keymap select us
25+
d-i keyboard-configuration/xkb-keymap select us
26+
27+
### Network configuration
28+
d-i netcfg/choose_interface select auto
29+
d-i netcfg/get_hostname string systemvm
30+
d-i netcfg/get_domain string apache.org
31+
d-i netcfg/wireless_wep string
32+
33+
d-i hw-detect/load_firmware boolean true
34+
35+
### Mirror settings
36+
d-i mirror/country string manual
37+
d-i mirror/http/hostname string deb.debian.org
38+
d-i mirror/http/directory string /debian
39+
d-i mirror/http/proxy string
40+
41+
### Apt setup
42+
d-i apt-setup/cdrom/set-first false
43+
d-i apt-setup/security-updates boolean true
44+
d-i apt-setup/services-select multiselect security, updates
45+
d-i apt-setup/security_host string security.debian.org
46+
d-i apt-setup/local0/source boolean false
47+
d-i apt-setup/multiarch string i386
48+
d-i apt-setup/backports boolean true
49+
d-i apt-setup/contrib boolean true
50+
d-i apt-setup/multiverse boolean true
51+
d-i apt-setup/universe boolean true
52+
53+
### Clock and time zone setup
54+
d-i clock-setup/utc boolean true
55+
d-i time/zone string UTC
56+
d-i clock-setup/ntp boolean true
57+
58+
### Partitioning
59+
d-i partman-auto/disk string /dev/vda
60+
d-i partman-auto/method string regular
61+
d-i partman-auto/expert_recipe string \
62+
boot-root :: \
63+
538 538 1075 free \
64+
$iflabel{ gpt } \
65+
$reusemethod{ } \
66+
method{ efi } \
67+
format{ } \
68+
. \
69+
400 60 400 ext2 \
70+
$primary{ } $bootable{ } \
71+
method{ format } format{ } \
72+
use_filesystem{ } filesystem{ ext2 } \
73+
mountpoint{ /boot } \
74+
. \
75+
256 1000 256 linux-swap \
76+
method{ swap } format{ } \
77+
. \
78+
2240 40 4000 ext4 \
79+
method{ format } format{ } \
80+
use_filesystem{ } filesystem{ ext4 } \
81+
mountpoint{ / } \
82+
.
83+
84+
d-i partman-md/confirm boolean true
85+
d-i partman-partitioning/confirm_write_new_label boolean true
86+
d-i partman/choose_partition select finish
87+
d-i partman/confirm boolean true
88+
d-i partman/confirm_nooverwrite boolean true
89+
grub-efi-arm64 grub2/force_efi_extra_removable boolean true
90+
d-i partman-partitioning/choose_label select gpt
91+
d-i partman-partitioning/default_label string gpt
92+
93+
### Base system installation
94+
# ...
95+
96+
### Account setup
97+
d-i passwd/root-login boolean false
98+
d-i passwd/root-password password password
99+
d-i passwd/root-password-again password password
100+
d-i passwd/user-fullname string Cloud User
101+
d-i passwd/username string cloud
102+
d-i passwd/user-password password cloud
103+
d-i passwd/user-password-again password cloud
104+
d-i user-setup/encrypt-home boolean false
105+
d-i user-setup/allow-password-weak boolean true
106+
d-i passwd/user-default-groups string audio cdrom video admin
107+
108+
### Package selection
109+
tasksel tasksel/first multiselect ssh-server
110+
d-i pkgsel/include string openssh-server ntp acpid sudo bzip2 openssl
111+
# Allowed values: none, safe-upgrade, full-upgrade
112+
d-i pkgsel/upgrade select full-upgrade
113+
d-i pkgsel/update-policy select none
114+
115+
popularity-contest popularity-contest/participate boolean false
116+
117+
### Boot loader installation
118+
d-i grub-installer/only_debian boolean true
119+
d-i grub-installer/bootdev string default
120+
d-i finish-install/reboot_in_progress note
121+
122+
#### Advanced options

0 commit comments

Comments
 (0)