Skip to content

Commit e964ad3

Browse files
author
Landry JUGE
committed
Merge remote-tracking branch 'origin/service_offering_category_feature' into service_offering_category_feature
2 parents f345279 + e3f09e6 commit e964ad3

File tree

57 files changed

+819
-503
lines changed

Some content is hidden

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

57 files changed

+819
-503
lines changed

agent/conf/uefi.properties.in

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
# Configuration file for UEFI
19+
20+
guest.nvram.template.legacy=@GUESTNVRAMTEMPLATELEGACY@
21+
guest.loader.legacy=@GUESTLOADERLEGACY@
22+
guest.nvram.template.secure=@GUESTNVRAMTEMPLATESECURE@
23+
guest.loader.secure=@GUESTLOADERSECURE@
24+
guest.nvram.path=@GUESTNVRAMPATH@

api/src/main/java/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class ListPublicIpAddressesCmd extends BaseListRetrieveOnlyResourceCountC
5353
@Parameter(name = ApiConstants.ALLOCATED_ONLY, type = CommandType.BOOLEAN, description = "limits search results to allocated public IP addresses")
5454
private Boolean allocatedOnly;
5555

56-
@Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "lists all public IP addresses by state")
56+
@Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "lists all public IP addresses by state. A comma-separated list of states can be passed")
5757
private String state;
5858

5959
@Parameter(name = ApiConstants.FOR_VIRTUAL_NETWORK, type = CommandType.BOOLEAN, description = "the virtual network for the IP address")

debian/cloudstack-agent.install

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# under the License.
1717

1818
/etc/cloudstack/agent/agent.properties
19+
/etc/cloudstack/agent/uefi.properties
1920
/etc/cloudstack/agent/environment.properties
2021
/etc/cloudstack/agent/log4j-cloud.xml
2122
/etc/default/cloudstack-agent

debian/cloudstack-agent.postinst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ case "$1" in
2323
configure)
2424
OLDCONFDIR="/etc/cloud/agent"
2525
NEWCONFDIR="/etc/cloudstack/agent"
26-
CONFFILES="agent.properties log4j.xml log4j-cloud.xml"
26+
CONFFILES="agent.properties uefi.properties log4j.xml log4j-cloud.xml"
2727

2828
mkdir -m 0755 -p /usr/share/cloudstack-agent/tmp
2929

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Description: CloudStack server library
2424

2525
Package: cloudstack-agent
2626
Architecture: all
27-
Depends: ${python:Depends}, ${python3:Depends}, openjdk-17-jre-headless | java17-runtime-headless | java17-runtime | zulu-17, cloudstack-common (= ${source:Version}), lsb-base (>= 9), openssh-client, qemu-kvm (>= 2.5) | qemu-system-x86 (>= 5.2), libvirt-bin (>= 1.3) | libvirt-daemon-system (>= 3.0), iproute2, ebtables, vlan, ipset, python3-libvirt, ethtool, iptables, cryptsetup, rng-tools, rsync, lsb-release, ufw, apparmor, cpu-checker, libvirt-daemon-driver-storage-rbd, sysstat
27+
Depends: ${python:Depends}, ${python3:Depends}, openjdk-17-jre-headless | java17-runtime-headless | java17-runtime | zulu-17, cloudstack-common (= ${source:Version}), lsb-base (>= 9), openssh-client, qemu-kvm (>= 2.5) | qemu-system-x86 (>= 5.2), libvirt-bin (>= 1.3) | libvirt-daemon-system (>= 3.0), iproute2, ebtables, vlan, ipset, python3-libvirt, ethtool, iptables, cryptsetup, rng-tools, rsync, ovmf, swtpm, lsb-release, ufw, apparmor, cpu-checker, libvirt-daemon-driver-storage-rbd, sysstat
2828
Recommends: init-system-helpers
2929
Conflicts: cloud-agent, cloud-agent-libs, cloud-agent-deps, cloud-agent-scripts
3030
Description: CloudStack agent

engine/components-api/src/main/java/com/cloud/event/UsageEventUtils.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ public static void publishUsageEvent(String usageType, long accountId, long zone
9494

9595
}
9696

97+
public static void publishUsageEvent(String usageType, long accountId, long zoneId, long resourceId, String resourceName, Long offeringId, Long templateId,
98+
Long size, String entityType, String entityUUID, Long vmId, boolean displayResource) {
99+
if (displayResource) {
100+
saveUsageEvent(usageType, accountId, zoneId, resourceId, offeringId, templateId, size, vmId, resourceName);
101+
}
102+
publishUsageEvent(usageType, accountId, zoneId, entityType, entityUUID);
103+
}
104+
97105
public static void publishUsageEvent(String usageType, long accountId, long zoneId, long resourceId, String resourceName, Long offeringId, Long templateId,
98106
Long size, Long virtualSize, String entityType, String entityUUID, Map<String, String> details) {
99107
saveUsageEvent(usageType, accountId, zoneId, resourceId, resourceName, offeringId, templateId, size, virtualSize, details);
@@ -202,6 +210,10 @@ public static void saveUsageEvent(String usageType, long accountId, long zoneId,
202210
s_usageEventDao.persist(new UsageEventVO(usageType, accountId, zoneId, vmId, securityGroupId));
203211
}
204212

213+
public static void saveUsageEvent(String usageType, long accountId, long zoneId, long resourceId, Long offeringId, Long templateId, Long size, Long vmId, String resourceName) {
214+
s_usageEventDao.persist(new UsageEventVO(usageType, accountId, zoneId, resourceId, offeringId, templateId, size, vmId, resourceName));
215+
}
216+
205217
private static void publishUsageEvent(String usageEventType, Long accountId, Long zoneId, String resourceType, String resourceUUID) {
206218
String configKey = "publish.usage.events";
207219
String value = s_configDao.getValue(configKey);

engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ public DiskProfile allocateRawVolume(Type type, String name, DiskOffering offeri
903903
// Save usage event and update resource count for user vm volumes
904904
if (vm.getType() == VirtualMachine.Type.User) {
905905
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_CREATE, vol.getAccountId(), vol.getDataCenterId(), vol.getId(), vol.getName(), offering.getId(), null, size,
906-
Volume.class.getName(), vol.getUuid(), vol.isDisplayVolume());
906+
Volume.class.getName(), vol.getUuid(), vol.getInstanceId(), vol.isDisplayVolume());
907907
_resourceLimitMgr.incrementVolumeResourceCount(vm.getAccountId(), vol.isDisplayVolume(), vol.getSize(), offering);
908908
}
909909
DiskProfile diskProfile = toDiskProfile(vol, offering);
@@ -981,7 +981,7 @@ private DiskProfile allocateTemplatedVolume(Type type, String name, DiskOffering
981981
}
982982

983983
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_CREATE, vol.getAccountId(), vol.getDataCenterId(), vol.getId(), vol.getName(), offeringId, vol.getTemplateId(), size,
984-
Volume.class.getName(), vol.getUuid(), vol.isDisplayVolume());
984+
Volume.class.getName(), vol.getUuid(), vol.getInstanceId(), vol.isDisplayVolume());
985985

986986
_resourceLimitMgr.incrementVolumeResourceCount(vm.getAccountId(), vol.isDisplayVolume(), vol.getSize(), offering);
987987
}

engine/schema/src/main/java/com/cloud/event/UsageEventVO.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ public enum DynamicParameters {
7575
@Column(name = "virtual_size")
7676
private Long virtualSize;
7777

78+
@Column(name = "vm_id")
79+
private Long vmId;
80+
7881
public UsageEventVO() {
7982
}
8083

@@ -143,6 +146,18 @@ public UsageEventVO(String usageType, long accountId, long zoneId, long vmId, lo
143146
this.offeringId = securityGroupId;
144147
}
145148

149+
public UsageEventVO(String usageType, long accountId, long zoneId, long resourceId, Long offeringId, Long templateId, Long size, Long vmId, String resourceName) {
150+
this.type = usageType;
151+
this.accountId = accountId;
152+
this.zoneId = zoneId;
153+
this.resourceId = resourceId;
154+
this.offeringId = offeringId;
155+
this.templateId = templateId;
156+
this.size = size;
157+
this.vmId = vmId;
158+
this.resourceName = resourceName;
159+
}
160+
146161
@Override
147162
public long getId() {
148163
return id;
@@ -248,4 +263,11 @@ public void setVirtualSize(Long virtualSize) {
248263
this.virtualSize = virtualSize;
249264
}
250265

266+
public Long getVmId() {
267+
return vmId;
268+
}
269+
270+
public void setVmId(Long vmId) {
271+
this.vmId = vmId;
272+
}
251273
}

engine/schema/src/main/java/com/cloud/event/dao/UsageEventDaoImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ public class UsageEventDaoImpl extends GenericDaoBase<UsageEventVO, Long> implem
4545
private final SearchBuilder<UsageEventVO> latestEventsSearch;
4646
private final SearchBuilder<UsageEventVO> IpeventsSearch;
4747
private static final String COPY_EVENTS =
48-
"INSERT INTO cloud_usage.usage_event (id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size) "
49-
+ "SELECT id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size FROM cloud.usage_event vmevt WHERE vmevt.id > ? and vmevt.id <= ? ";
48+
"INSERT INTO cloud_usage.usage_event (id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size, vm_id) "
49+
+ "SELECT id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size, vm_id FROM cloud.usage_event vmevt WHERE vmevt.id > ? and vmevt.id <= ? ";
5050
private static final String COPY_ALL_EVENTS =
51-
"INSERT INTO cloud_usage.usage_event (id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size) "
52-
+ "SELECT id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size FROM cloud.usage_event vmevt WHERE vmevt.id <= ?";
51+
"INSERT INTO cloud_usage.usage_event (id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size, vm_id) "
52+
+ "SELECT id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size, vm_id FROM cloud.usage_event vmevt WHERE vmevt.id <= ?";
5353
private static final String COPY_EVENT_DETAILS = "INSERT INTO cloud_usage.usage_event_details (id, usage_event_id, name, value) "
5454
+ "SELECT id, usage_event_id, name, value FROM cloud.usage_event_details vmevtDetails WHERE vmevtDetails.usage_event_id > ? and vmevtDetails.usage_event_id <= ? ";
5555
private static final String COPY_ALL_EVENT_DETAILS = "INSERT INTO cloud_usage.usage_event_details (id, usage_event_id, name, value) "

engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,11 @@
8989
import com.cloud.upgrade.dao.Upgrade41910to42000;
9090
import com.cloud.upgrade.dao.Upgrade42000to42010;
9191
import com.cloud.upgrade.dao.Upgrade42010to42100;
92-
import com.cloud.upgrade.dao.Upgrade420to421;
9392
import com.cloud.upgrade.dao.Upgrade42100to42200;
93+
import com.cloud.upgrade.dao.Upgrade42200to42210;
94+
import com.cloud.upgrade.dao.Upgrade420to421;
9495
import com.cloud.upgrade.dao.Upgrade421to430;
95-
import com.cloud.upgrade.dao.Upgrade42200to42300;
96+
import com.cloud.upgrade.dao.Upgrade42210to42300;
9697
import com.cloud.upgrade.dao.Upgrade430to440;
9798
import com.cloud.upgrade.dao.Upgrade431to440;
9899
import com.cloud.upgrade.dao.Upgrade432to440;
@@ -237,7 +238,8 @@ public DatabaseUpgradeChecker() {
237238
.next("4.20.0.0", new Upgrade42000to42010())
238239
.next("4.20.1.0", new Upgrade42010to42100())
239240
.next("4.21.0.0", new Upgrade42100to42200())
240-
.next("4.22.0.0", new Upgrade42200to42300())
241+
.next("4.22.0.0", new Upgrade42200to42210())
242+
.next("4.22.1.0", new Upgrade42210to42300())
241243
.build();
242244
}
243245

@@ -315,20 +317,20 @@ protected void upgrade(CloudStackVersion dbVersion, CloudStackVersion currentVer
315317
}
316318

317319
protected void executeProcedureScripts() {
318-
LOGGER.info(String.format("Executing Stored Procedure scripts that are under resource directory [%s].", PROCEDURES_DIRECTORY));
320+
LOGGER.info("Executing Stored Procedure scripts that are under resource directory [{}].", PROCEDURES_DIRECTORY);
319321
List<String> filesPathUnderViewsDirectory = FileUtil.getFilesPathsUnderResourceDirectory(PROCEDURES_DIRECTORY);
320322

321323
try (TransactionLegacy txn = TransactionLegacy.open("execute-procedure-scripts")) {
322324
Connection conn = txn.getConnection();
323325

324326
for (String filePath : filesPathUnderViewsDirectory) {
325-
LOGGER.debug(String.format("Executing PROCEDURE script [%s].", filePath));
327+
LOGGER.debug("Executing PROCEDURE script [{}].", filePath);
326328

327329
InputStream viewScript = Thread.currentThread().getContextClassLoader().getResourceAsStream(filePath);
328330
runScript(conn, viewScript);
329331
}
330332

331-
LOGGER.info(String.format("Finished execution of PROCEDURE scripts that are under resource directory [%s].", PROCEDURES_DIRECTORY));
333+
LOGGER.info("Finished execution of PROCEDURE scripts that are under resource directory [{}].", PROCEDURES_DIRECTORY);
332334
} catch (SQLException e) {
333335
String message = String.format("Unable to execute PROCEDURE scripts due to [%s].", e.getMessage());
334336
LOGGER.error(message, e);
@@ -337,7 +339,7 @@ protected void executeProcedureScripts() {
337339
}
338340

339341
private DbUpgrade[] executeUpgrades(CloudStackVersion dbVersion, CloudStackVersion currentVersion) {
340-
LOGGER.info("Database upgrade must be performed from " + dbVersion + " to " + currentVersion);
342+
LOGGER.info("Database upgrade must be performed from {} to {}", dbVersion, currentVersion);
341343

342344
final DbUpgrade[] upgrades = calculateUpgradePath(dbVersion, currentVersion);
343345

@@ -350,8 +352,8 @@ private DbUpgrade[] executeUpgrades(CloudStackVersion dbVersion, CloudStackVersi
350352

351353
private VersionVO executeUpgrade(DbUpgrade upgrade) {
352354
VersionVO version;
353-
LOGGER.debug("Running upgrade " + upgrade.getClass().getSimpleName() + " to upgrade from " + upgrade.getUpgradableVersionRange()[0] + "-" + upgrade
354-
.getUpgradableVersionRange()[1] + " to " + upgrade.getUpgradedVersion());
355+
LOGGER.debug("Running upgrade {} to upgrade from {}-{} to {}", upgrade.getClass().getSimpleName(), upgrade.getUpgradableVersionRange()[0], upgrade
356+
.getUpgradableVersionRange()[1], upgrade.getUpgradedVersion());
355357
TransactionLegacy txn = TransactionLegacy.open("Upgrade");
356358
txn.start();
357359
try {
@@ -394,8 +396,8 @@ private void executeUpgradeCleanup(DbUpgrade upgrade, VersionVO version) {
394396
// Run the corresponding '-cleanup.sql' script
395397
txn = TransactionLegacy.open("Cleanup");
396398
try {
397-
LOGGER.info("Cleanup upgrade " + upgrade.getClass().getSimpleName() + " to upgrade from " + upgrade.getUpgradableVersionRange()[0] + "-" + upgrade
398-
.getUpgradableVersionRange()[1] + " to " + upgrade.getUpgradedVersion());
399+
LOGGER.info("Cleanup upgrade {} to upgrade from {}-{} to {}", upgrade.getClass().getSimpleName(), upgrade.getUpgradableVersionRange()[0], upgrade
400+
.getUpgradableVersionRange()[1], upgrade.getUpgradedVersion());
399401

400402
txn.start();
401403
Connection conn;
@@ -410,7 +412,7 @@ private void executeUpgradeCleanup(DbUpgrade upgrade, VersionVO version) {
410412
if (scripts != null) {
411413
for (InputStream script : scripts) {
412414
runScript(conn, script);
413-
LOGGER.debug("Cleanup script " + upgrade.getClass().getSimpleName() + " is executed successfully");
415+
LOGGER.debug("Cleanup script {} is executed successfully", upgrade.getClass().getSimpleName());
414416
}
415417
}
416418
txn.commit();
@@ -420,27 +422,27 @@ private void executeUpgradeCleanup(DbUpgrade upgrade, VersionVO version) {
420422
version.setUpdated(new Date());
421423
_dao.update(version.getId(), version);
422424
txn.commit();
423-
LOGGER.debug("Upgrade completed for version " + version.getVersion());
425+
LOGGER.debug("Upgrade completed for version {}", version.getVersion());
424426
} finally {
425427
txn.close();
426428
}
427429
}
428430

429431
protected void executeViewScripts() {
430-
LOGGER.info(String.format("Executing VIEW scripts that are under resource directory [%s].", VIEWS_DIRECTORY));
432+
LOGGER.info("Executing VIEW scripts that are under resource directory [{}].", VIEWS_DIRECTORY);
431433
List<String> filesPathUnderViewsDirectory = FileUtil.getFilesPathsUnderResourceDirectory(VIEWS_DIRECTORY);
432434

433435
try (TransactionLegacy txn = TransactionLegacy.open("execute-view-scripts")) {
434436
Connection conn = txn.getConnection();
435437

436438
for (String filePath : filesPathUnderViewsDirectory) {
437-
LOGGER.debug(String.format("Executing VIEW script [%s].", filePath));
439+
LOGGER.debug("Executing VIEW script [{}].", filePath);
438440

439441
InputStream viewScript = Thread.currentThread().getContextClassLoader().getResourceAsStream(filePath);
440442
runScript(conn, viewScript);
441443
}
442444

443-
LOGGER.info(String.format("Finished execution of VIEW scripts that are under resource directory [%s].", VIEWS_DIRECTORY));
445+
LOGGER.info("Finished execution of VIEW scripts that are under resource directory [{}].", VIEWS_DIRECTORY);
444446
} catch (SQLException e) {
445447
String message = String.format("Unable to execute VIEW scripts due to [%s].", e.getMessage());
446448
LOGGER.error(message, e);
@@ -470,10 +472,10 @@ public void check() {
470472
String csVersion = SystemVmTemplateRegistration.parseMetadataFile();
471473
final CloudStackVersion sysVmVersion = CloudStackVersion.parse(csVersion);
472474
final CloudStackVersion currentVersion = CloudStackVersion.parse(currentVersionValue);
473-
SystemVmTemplateRegistration.CS_MAJOR_VERSION = String.valueOf(sysVmVersion.getMajorRelease()) + "." + String.valueOf(sysVmVersion.getMinorRelease());
475+
SystemVmTemplateRegistration.CS_MAJOR_VERSION = sysVmVersion.getMajorRelease() + "." + sysVmVersion.getMinorRelease();
474476
SystemVmTemplateRegistration.CS_TINY_VERSION = String.valueOf(sysVmVersion.getPatchRelease());
475477

476-
LOGGER.info("DB version = " + dbVersion + " Code Version = " + currentVersion);
478+
LOGGER.info("DB version = {} Code Version = {}", dbVersion, currentVersion);
477479

478480
if (dbVersion.compareTo(currentVersion) > 0) {
479481
throw new CloudRuntimeException("Database version " + dbVersion + " is higher than management software version " + currentVersionValue);
@@ -522,7 +524,7 @@ private void decryptInit(Connection conn) throws SQLException {
522524
ResultSet result = pstmt.executeQuery()) {
523525
if (result.next()) {
524526
String init = result.getString(1);
525-
LOGGER.info("init = " + DBEncryptionUtil.decrypt(init));
527+
LOGGER.info("init = {}", DBEncryptionUtil.decrypt(init));
526528
}
527529
}
528530
}
@@ -553,21 +555,11 @@ public String getUpgradedVersion() {
553555
return upgradedVersion;
554556
}
555557

556-
@Override
557-
public boolean supportsRollingUpgrade() {
558-
return false;
559-
}
560-
561558
@Override
562559
public InputStream[] getPrepareScripts() {
563560
return new InputStream[0];
564561
}
565562

566-
@Override
567-
public void performDataMigration(Connection conn) {
568-
569-
}
570-
571563
@Override
572564
public InputStream[] getCleanupScripts() {
573565
return new InputStream[0];

0 commit comments

Comments
 (0)