Skip to content

Commit 2f6234b

Browse files
committed
Merge remote-tracking branch 'apache/main' into proxmox-console
2 parents d5c642a + 8089d32 commit 2f6234b

File tree

42 files changed

+453
-130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+453
-130
lines changed

api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotFromVMSnapshotCmd.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,9 @@ public Long getSyncObjId() {
209209
}
210210
return null;
211211
}
212+
213+
@Override
214+
public Long getApiResourceId() {
215+
return getEntityId();
216+
}
212217
}

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
@@ -18,3 +18,6 @@
1818
--;
1919
-- Schema upgrade from 4.21.0.0 to 4.22.0.0
2020
--;
21+
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)');

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

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,21 @@ protected boolean isValidProtocolAndVnetId(final String vNetId, final String pro
188188
return vNetId != null && protocol != null && !vNetId.equalsIgnoreCase("untagged");
189189
}
190190

191+
protected String createStorageVnetBridgeIfNeeded(NicTO nic, String trafficLabel,
192+
String storageBrName) throws InternalErrorException {
193+
if (!Networks.BroadcastDomainType.Storage.equals(nic.getBroadcastType()) || nic.getBroadcastUri() == null) {
194+
return storageBrName;
195+
}
196+
String vNetId = Networks.BroadcastDomainType.getValue(nic.getBroadcastUri());
197+
String protocol = Networks.BroadcastDomainType.Vlan.scheme();
198+
if (!isValidProtocolAndVnetId(vNetId, protocol)) {
199+
return storageBrName;
200+
}
201+
logger.debug(String.format("creating a vNet dev and bridge for %s traffic per traffic label %s",
202+
Networks.TrafficType.Storage.name(), trafficLabel));
203+
return createVnetBr(vNetId, storageBrName, protocol);
204+
}
205+
191206
@Override
192207
public LibvirtVMDef.InterfaceDef plug(NicTO nic, String guestOsType, String nicAdapter, Map<String, String> extraConfig) throws InternalErrorException, LibvirtException {
193208

@@ -254,15 +269,7 @@ public LibvirtVMDef.InterfaceDef plug(NicTO nic, String guestOsType, String nicA
254269
intf.defBridgeNet(_bridges.get("private"), null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter));
255270
} else if (nic.getType() == Networks.TrafficType.Storage) {
256271
String storageBrName = nic.getName() == null ? _bridges.get("private") : nic.getName();
257-
if (nic.getBroadcastType() == Networks.BroadcastDomainType.Storage) {
258-
vNetId = Networks.BroadcastDomainType.getValue(nic.getBroadcastUri());
259-
protocol = Networks.BroadcastDomainType.Vlan.scheme();
260-
}
261-
if (isValidProtocolAndVnetId(vNetId, protocol)) {
262-
logger.debug(String.format("creating a vNet dev and bridge for %s traffic per traffic label %s",
263-
Networks.TrafficType.Storage.name(), trafficLabel));
264-
storageBrName = createVnetBr(vNetId, storageBrName, protocol);
265-
}
272+
storageBrName = createStorageVnetBridgeIfNeeded(nic, trafficLabel, storageBrName);
266273
intf.defBridgeNet(storageBrName, null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter));
267274
}
268275
if (nic.getPxeDisable()) {
@@ -295,7 +302,7 @@ private String generateVxnetBrName(String pifName, String vnetId) {
295302
return "brvx-" + vnetId;
296303
}
297304

298-
private String createVnetBr(String vNetId, String pifKey, String protocol) throws InternalErrorException {
305+
protected String createVnetBr(String vNetId, String pifKey, String protocol) throws InternalErrorException {
299306
String nic = _pifs.get(pifKey);
300307
if (nic == null || isVxlanOrNetris(protocol)) {
301308
// if not found in bridge map, maybe traffic label refers to pif already?

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.WatchDogDef;
4949
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.WatchDogDef.WatchDogAction;
5050
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.WatchDogDef.WatchDogModel;
51+
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.GuestDef;
5152

5253
public class LibvirtDomainXMLParser {
5354
protected Logger logger = LogManager.getLogger(getClass());
@@ -63,6 +64,8 @@ public class LibvirtDomainXMLParser {
6364
private LibvirtVMDef.CpuTuneDef cpuTuneDef;
6465
private LibvirtVMDef.CpuModeDef cpuModeDef;
6566
private String name;
67+
private GuestDef.BootType bootType;
68+
private GuestDef.BootMode bootMode;
6669

6770
public boolean parseDomainXML(String domXML) {
6871
DocumentBuilder builder;
@@ -388,6 +391,7 @@ public boolean parseDomainXML(String domXML) {
388391
}
389392
extractCpuTuneDef(rootElement);
390393
extractCpuModeDef(rootElement);
394+
extractBootDef(rootElement);
391395
return true;
392396
} catch (ParserConfigurationException e) {
393397
logger.debug(e.toString());
@@ -516,6 +520,14 @@ public LibvirtVMDef.CpuModeDef getCpuModeDef() {
516520
return cpuModeDef;
517521
}
518522

523+
public GuestDef.BootType getBootType() {
524+
return bootType;
525+
}
526+
527+
public GuestDef.BootMode getBootMode() {
528+
return bootMode;
529+
}
530+
519531
private void extractCpuTuneDef(final Element rootElement) {
520532
NodeList cpuTunesList = rootElement.getElementsByTagName("cputune");
521533
if (cpuTunesList.getLength() > 0) {
@@ -569,4 +581,26 @@ private void extractCpuModeDef(final Element rootElement){
569581
}
570582
}
571583
}
584+
585+
protected void extractBootDef(final Element rootElement) {
586+
bootType = GuestDef.BootType.BIOS;
587+
bootMode = GuestDef.BootMode.LEGACY;
588+
Element osElement = (Element) rootElement.getElementsByTagName("os").item(0);
589+
if (osElement == null) {
590+
return;
591+
}
592+
NodeList loaderList = osElement.getElementsByTagName("loader");
593+
if (loaderList.getLength() == 0) {
594+
return;
595+
}
596+
Element loader = (Element) loaderList.item(0);
597+
String type = loader.getAttribute("type");
598+
String secure = loader.getAttribute("secure");
599+
if ("pflash".equalsIgnoreCase(type) || loader.getTextContent().toLowerCase().contains("uefi")) {
600+
bootType = GuestDef.BootType.UEFI;
601+
}
602+
if ("yes".equalsIgnoreCase(secure)) {
603+
bootMode = GuestDef.BootMode.SECURE;
604+
}
605+
}
572606
}

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public String toString() {
6565
}
6666
}
6767

68-
enum BootType {
68+
public enum BootType {
6969
UEFI("UEFI"), BIOS("BIOS");
7070

7171
String _type;
@@ -80,7 +80,7 @@ public String toString() {
8080
}
8181
}
8282

83-
enum BootMode {
83+
public enum BootMode {
8484
LEGACY("LEGACY"), SECURE("SECURE");
8585

8686
String _mode;

0 commit comments

Comments
 (0)