Skip to content

Commit d983a7d

Browse files
committed
Merge branch 'main' into disk-controller-mappings
2 parents 991af0a + 3d6ec29 commit d983a7d

17 files changed

Lines changed: 63 additions & 42 deletions

File tree

debian/rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ override_dh_auto_install:
8787
cp client/target/lib/*jar $(DESTDIR)/usr/share/$(PACKAGE)-management/lib/
8888
cp -r engine/schema/dist/systemvm-templates/* $(DESTDIR)/usr/share/$(PACKAGE)-management/templates/systemvm/
8989
cp -r plugins/integrations/kubernetes-service/src/main/resources/conf/* $(DESTDIR)/usr/share/$(PACKAGE)-management/cks/conf/
90-
rm -rf $(DESTDIR)/usr/share/$(PACKAGE)-management/templates/systemvm/md5sum.txt
90+
rm -rf $(DESTDIR)/usr/share/$(PACKAGE)-management/templates/systemvm/sha512sum.txt
9191

9292
# Bundle cmk in cloudstack-management
9393
wget https://github.com/apache/cloudstack-cloudmonkey/releases/download/$(CMK_REL)/cmk.linux.x86-64 -O $(DESTDIR)/usr/bin/cmk

engine/schema/pom.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
templateList.add("systemvmtemplate-${csVersion}.${patch}-x86_64-xen")
107107
templateList.add("systemvmtemplate-${csVersion}.${patch}-x86_64-ovm")
108108
templateList.add("systemvmtemplate-${csVersion}.${patch}-x86_64-hyperv")
109-
File file = new File("./engine/schema/dist/systemvm-templates/md5sum.txt")
109+
File file = new File("./engine/schema/dist/systemvm-templates/sha512sum.txt")
110110
def lines = file.readLines()
111111
for (template in templateList) {
112112
def data = lines.findAll { it.contains(template) }
@@ -135,7 +135,7 @@
135135
<goal>wget</goal>
136136
</goals>
137137
<configuration>
138-
<url>${project.systemvm.template.location}/${cs.version}/md5sum.txt</url>
138+
<url>${project.systemvm.template.location}/${cs.version}/sha512sum.txt</url>
139139
<outputDirectory>${basedir}/dist/systemvm-templates/</outputDirectory>
140140
<skipCache>true</skipCache>
141141
<overwrite>true</overwrite>
@@ -205,7 +205,7 @@
205205
<checkSignature>true</checkSignature>
206206
<url>${project.systemvm.template.location}/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-x86_64-kvm.qcow2.bz2</url>
207207
<outputDirectory>${basedir}/dist/systemvm-templates/</outputDirectory>
208-
<md5>${kvm.checksum}</md5>
208+
<sha512>${kvm.checksum}</sha512>
209209
</configuration>
210210
</execution>
211211
</executions>
@@ -241,7 +241,7 @@
241241
<checkSignature>true</checkSignature>
242242
<url>${project.systemvm.template.location}/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-x86_64-vmware.ova</url>
243243
<outputDirectory>${basedir}/dist/systemvm-templates/</outputDirectory>
244-
<md5>${vmware.checksum}</md5>
244+
<sha512>${vmware.checksum}</sha512>
245245
</configuration>
246246
</execution>
247247
</executions>
@@ -277,7 +277,7 @@
277277
<checkSignature>true</checkSignature>
278278
<url>${project.systemvm.template.location}/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-x86_64-xen.vhd.bz2</url>
279279
<outputDirectory>${basedir}/dist/systemvm-templates/</outputDirectory>
280-
<md5>${xen.checksum}</md5>
280+
<sha512>${xen.checksum}</sha512>
281281
</configuration>
282282
</execution>
283283
</executions>
@@ -313,7 +313,7 @@
313313
<checkSignature>true</checkSignature>
314314
<url>${project.systemvm.template.location}/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-x86_64-ovm.raw.bz2</url>
315315
<outputDirectory>${basedir}/dist/systemvm-templates/</outputDirectory>
316-
<md5>${ovm.checksum}</md5>
316+
<sha512>${ovm.checksum}</sha512>
317317
</configuration>
318318
</execution>
319319
</executions>
@@ -349,7 +349,7 @@
349349
<checkSignature>true</checkSignature>
350350
<url>${project.systemvm.template.location}/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-x86_64-hyperv.vhd.zip</url>
351351
<outputDirectory>${basedir}/dist/systemvm-templates/</outputDirectory>
352-
<md5>${hyperv.checksum}</md5>
352+
<sha512>${hyperv.checksum}</sha512>
353353
</configuration>
354354
</execution>
355355
</executions>

engine/schema/src/main/resources/META-INF/db/schema-42100to42200.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
-- Schema upgrade from 4.21.0.0 to 4.22.0.0
2020
--;
2121

22+
-- Increase length of scripts_version column to 128 due to md5sum to sha512sum change
23+
CALL `cloud`.`IDEMPOTENT_CHANGE_COLUMN`('cloud.domain_router', 'scripts_version', 'scripts_version', 'VARCHAR(128)');
24+
2225
-- Disk controller mappings
2326
CREATE TABLE IF NOT EXISTS `cloud`.`disk_controller_mapping` (
2427
`id` bigint(20) unsigned NOT NULL auto_increment,

engine/schema/templateConfig.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,5 @@ PARENTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/dist/systemvm-
9494
mkdir -p $PARENTPATH
9595
METADATAFILE=${PARENTPATH}"metadata.ini"
9696
echo > $METADATAFILE
97-
SOURCEFILE=${PARENTPATH}'md5sum.txt'
97+
SOURCEFILE=${PARENTPATH}'sha512sum.txt'
9898
createMetadataFile

packaging/el8/cloud.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ install -D plugins/integrations/kubernetes-service/src/main/resources/conf/k8s-n
317317
# SystemVM template
318318
mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/templates/systemvm
319319
cp -r engine/schema/dist/systemvm-templates/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/templates/systemvm
320-
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/templates/systemvm/md5sum.txt
320+
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/templates/systemvm/sha512sum.txt
321321

322322
# Sample Extensions
323323
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/extensions

plugins/backup/dummy/src/main/java/org/apache/cloudstack/backup/DummyBackupProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public boolean supportsInstanceFromBackup() {
191191

192192
@Override
193193
public Pair<Long, Long> getBackupStorageStats(Long zoneId) {
194-
return new Pair<>(8L * 1024 * 1024 * 1024, 10L * 1024 * 1024 * 1024);
194+
return new Pair<>(0L, 0L);
195195
}
196196

197197
@Override

server/src/main/java/com/cloud/storage/StorageManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4052,7 +4052,7 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
40524052
}
40534053
}
40544054
} catch (Exception e) {
4055-
logger.error("Failed to register systemVM template(s)");
4055+
logger.error("Failed to register systemVM template(s) due to: ", e);
40564056
} finally {
40574057
SystemVmTemplateRegistration.unmountStore(filePath);
40584058
txn.close();

server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2161,6 +2161,9 @@ public BackupResponse createBackupResponse(Backup backup, Boolean listVmDetails)
21612161

21622162
@Override
21632163
public CapacityVO getBackupStorageUsedStats(Long zoneId) {
2164+
if (isDisabled(zoneId)) {
2165+
return new CapacityVO(null, zoneId, null, null, 0L, 0L, Capacity.CAPACITY_TYPE_BACKUP_STORAGE);
2166+
}
21642167
final BackupProvider backupProvider = getBackupProvider(zoneId);
21652168
Pair<Long, Long> backupUsage = backupProvider.getBackupStorageStats(zoneId);
21662169
return new CapacityVO(null, zoneId, null, null, backupUsage.first(), backupUsage.second(), Capacity.CAPACITY_TYPE_BACKUP_STORAGE);

systemvm/debian/opt/cloud/bin/setup/bootstrap.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ bootstrap() {
118118
/opt/cloud/bin/setup/default.sh
119119
fi
120120

121+
if [ -f /var/cache/cloud/cloud-scripts.tgz ];then
122+
sha512sum /var/cache/cloud/cloud-scripts.tgz | awk '{print $1}' > /var/cache/cloud/cloud-scripts-signature
123+
fi
124+
121125
log_it "Finished setting up systemvm"
122126
exit 0
123127
}

systemvm/debian/opt/cloud/bin/setup/cloud-early-config

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ log_it() {
3232
}
3333

3434
validate_checksums() {
35-
local oldmd5=
36-
[ -f ${1} ] && oldmd5=$(cat ${1})
37-
local newmd5=
38-
[ -f ${2} ] && newmd5=$(md5sum ${2} | awk '{print $1}')
39-
log_it "Scripts checksum detected: oldmd5=$oldmd5 newmd5=$newmd5" >> /dev/null 2>&1
40-
echo "oldmd5='${oldmd5}'; newmd5='${newmd5}'"
35+
local oldchecksum=
36+
[ -f ${1} ] && oldchecksum=$(cat ${1})
37+
local newchecksum=
38+
[ -f ${2} ] && newchecksum=$(sha512sum ${2} | awk '{print $1}')
39+
log_it "Scripts checksum detected: oldchecksum=$oldchecksum newchecksum=$newchecksum" >> /dev/null 2>&1
40+
echo "oldchecksum='${oldchecksum}'; newchecksum='${newchecksum}'"
4141
}
4242

4343
patch() {
@@ -46,15 +46,15 @@ patch() {
4646
local oldpatchfile=/usr/share/cloud/$PATCH_SCRIPTS
4747
local patchfile=$PATCH_MOUNT/$PATCH_SCRIPTS
4848
local privkey=$PATCH_MOUNT/authorized_keys
49-
local md5file=/var/cache/cloud/cloud-scripts-signature
49+
local checksumfile=/var/cache/cloud/cloud-scripts-signature
5050
mkdir -p $PATCH_MOUNT
5151

5252
if [ -f /var/cache/cloud/authorized_keys ]; then
5353
privkey=/var/cache/cloud/authorized_keys
5454
fi
5555

56-
eval $(validate_checksums $md5file $oldpatchfile)
57-
if [ "$oldmd5" == "$newmd5" ] && [ -d /usr/local/cloud/systemvm ] && [ "$(ls -A /usr/local/cloud/systemvm)" ]; then
56+
eval $(validate_checksums $checksumfile $oldpatchfile)
57+
if [ "$oldchecksum" == "$newchecksum" ] && [ -d /usr/local/cloud/systemvm ] && [ "$(ls -A /usr/local/cloud/systemvm)" ]; then
5858
log_it "Checksum matches, no need to patch"
5959
return 0
6060
fi
@@ -67,11 +67,11 @@ patch() {
6767
while [ $retry -gt 0 ]
6868
do
6969
if tar tf $patchfile &> /dev/null; then
70-
eval $(validate_checksums $md5file $patchfile)
71-
if [ "$oldmd5" != "$newmd5" ] && [ -f ${patchfile} ] && [ "$newmd5" != "" ]
70+
eval $(validate_checksums $checksumfile $patchfile)
71+
if [ "$oldchecksum" != "$newchecksum" ] && [ -f ${patchfile} ] && [ "$newchecksum" != "" ]
7272
then
7373
tar xzf $patchfile -C /
74-
echo ${newmd5} > ${md5file}
74+
echo ${newchecksum} > ${checksumfile}
7575
log_it "Patched scripts using $patchfile"
7676
touch /var/cache/cloud/patch.required
7777
fi

0 commit comments

Comments
 (0)