From 0dd6bb7c67b9bc99d91445330bfb01d6a4f3ff77 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Fri, 25 Aug 2023 16:46:32 +0200 Subject: [PATCH 1/8] systemvm: update size and state of systemvm template during registration (#7874) --- .../upgrade/SystemVmTemplateRegistration.java | 28 ++++++++++--------- .../com/cloud/storage/StorageManagerImpl.java | 2 +- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java b/engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java index 0ddaf00643f..dc94dd708b1 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java @@ -509,13 +509,12 @@ public class SystemVmTemplateRegistration { } } - public void updateTemplateDetails(SystemVMTemplateDetails details, boolean updateTemplateDetails) { + public void updateTemplateDetails(SystemVMTemplateDetails details) { VMTemplateVO template = vmTemplateDao.findById(details.getId()); - if (updateTemplateDetails) { - template.setSize(details.getSize()); - template.setState(VirtualMachineTemplate.State.Active); - vmTemplateDao.update(template.getId(), template); - } + template.setSize(details.getSize()); + template.setState(VirtualMachineTemplate.State.Active); + vmTemplateDao.update(template.getId(), template); + TemplateDataStoreVO templateDataStoreVO = templateDataStoreDao.findByStoreTemplate(details.getStoreId(), template.getId()); templateDataStoreVO.setSize(details.getSize()); templateDataStoreVO.setPhysicalSize(details.getPhysicalSize()); @@ -613,7 +612,7 @@ public class SystemVmTemplateRegistration { private Long performTemplateRegistrationOperations(Pair hypervisorAndTemplateName, String url, String checksum, ImageFormat format, long guestOsId, - Long storeId, Long templateId, String filePath, boolean updateTmpltDetails) { + Long storeId, Long templateId, String filePath, TemplateDataStoreVO templateDataStoreVO) { Hypervisor.HypervisorType hypervisor = hypervisorAndTemplateName.first(); String templateName = UUID.randomUUID().toString(); Date created = new Date(DateUtil.currentGMTTime().getTime()); @@ -631,21 +630,24 @@ public class SystemVmTemplateRegistration { String destTempFolderName = String.valueOf(templateId); String destTempFolder = filePath + PARTIAL_TEMPLATE_FOLDER + destTempFolderName; details.setInstallPath(PARTIAL_TEMPLATE_FOLDER + destTempFolderName + File.separator + templateName + "." + hypervisorImageFormat.get(hypervisor).getFileExtension()); - createTemplateStoreRefEntry(details); + if (templateDataStoreVO == null) { + createTemplateStoreRefEntry(details); + } setupTemplate(templateName, hypervisorAndTemplateName, destTempFolder); readTemplateProperties(destTempFolder + "/template.properties", details); details.setUpdated(new Date(DateUtil.currentGMTTime().getTime())); - updateTemplateDetails(details, updateTmpltDetails); + updateTemplateDetails(details); return templateId; } public void registerTemplate(Pair hypervisorAndTemplateName, - Pair storeUrlAndId, VMTemplateVO templateVO, String filePath) { + Pair storeUrlAndId, VMTemplateVO templateVO, + TemplateDataStoreVO templateDataStoreVO, String filePath) { Long templateId = null; try { templateId = templateVO.getId(); performTemplateRegistrationOperations(hypervisorAndTemplateName, templateVO.getUrl(), templateVO.getChecksum(), - templateVO.getFormat(), templateVO.getGuestOSId(), storeUrlAndId.second(), templateId, filePath, false); + templateVO.getFormat(), templateVO.getGuestOSId(), storeUrlAndId.second(), templateId, filePath, templateDataStoreVO); } catch (Exception e) { String errMsg = String.format("Failed to register template for hypervisor: %s", hypervisorAndTemplateName.first()); LOGGER.error(errMsg, e); @@ -662,7 +664,7 @@ public class SystemVmTemplateRegistration { try { Hypervisor.HypervisorType hypervisor = hypervisorAndTemplateName.first(); templateId = performTemplateRegistrationOperations(hypervisorAndTemplateName, NewTemplateUrl.get(hypervisor), NewTemplateChecksum.get(hypervisor), - hypervisorImageFormat.get(hypervisor), hypervisorGuestOsMap.get(hypervisor), storeUrlAndId.second(), null, filePath, true); + hypervisorImageFormat.get(hypervisor), hypervisorGuestOsMap.get(hypervisor), storeUrlAndId.second(), null, filePath, null); Map configParams = new HashMap<>(); configParams.put(RouterTemplateConfigurationNames.get(hypervisorAndTemplateName.first()), hypervisorAndTemplateName.second()); configParams.put("minreq.sysvmtemplate.version", getSystemVmTemplateVersion()); @@ -783,7 +785,7 @@ public class SystemVmTemplateRegistration { if (validateIfSeeded(storeUrlAndId.first(), installPath)) { continue; } else if (templateVO != null) { - registerTemplate(hypervisorAndTemplateName, storeUrlAndId, templateVO, filePath); + registerTemplate(hypervisorAndTemplateName, storeUrlAndId, templateVO, templateDataStoreVO, filePath); continue; } } diff --git a/server/src/main/java/com/cloud/storage/StorageManagerImpl.java b/server/src/main/java/com/cloud/storage/StorageManagerImpl.java index 7bafbcc77b8..643f29287e2 100644 --- a/server/src/main/java/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/main/java/com/cloud/storage/StorageManagerImpl.java @@ -2919,7 +2919,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C } SystemVmTemplateRegistration.mountStore(storeUrlAndId.first(), filePath); if (templateVO != null && vmTemplateVO != null) { - systemVmTemplateRegistration.registerTemplate(hypervisorAndTemplateName, storeUrlAndId, vmTemplateVO, filePath); + systemVmTemplateRegistration.registerTemplate(hypervisorAndTemplateName, storeUrlAndId, vmTemplateVO, templateVO, filePath); } else { systemVmTemplateRegistration.registerTemplate(hypervisorAndTemplateName, storeUrlAndId, filePath); } From 26581b774116df48740d0511004201ad34993cf2 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Mon, 28 Aug 2023 08:57:40 +0200 Subject: [PATCH 2/8] server: throw new exception when rootdisksize is required but not set (#7913) * server: throw new exception when rootdisksize is required but not set * PR7913: fix an issue with PR6441 --- .../api/command/user/vm/DeployVMCmd.java | 4 ++-- .../java/com/cloud/vm/UserVmManagerImpl.java | 17 ++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java index ef6dba63166..107bd817516 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java @@ -315,8 +315,8 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd implements SecurityG customparameterMap.put(getBootType().toString(), getBootMode().toString()); } - if (rootdisksize != null && !customparameterMap.containsKey("rootdisksize")) { - customparameterMap.put("rootdisksize", rootdisksize.toString()); + if (rootdisksize != null && !customparameterMap.containsKey(VmDetailConstants.ROOT_DISK_SIZE)) { + customparameterMap.put(VmDetailConstants.ROOT_DISK_SIZE, rootdisksize.toString()); } IoDriverPolicy ioPolicy = getIoDriverPolicy(); diff --git a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java index c1840065603..c9085b385f5 100644 --- a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java @@ -3933,7 +3933,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir rootDiskOfferingId = diskOfferingId; diskOfferingId = null; } - if (!customParameters.containsKey(VmDetailConstants.ROOT_DISK_SIZE)) { + if (!customParameters.containsKey(VmDetailConstants.ROOT_DISK_SIZE) && diskSize != null) { customParameters.put(VmDetailConstants.ROOT_DISK_SIZE, String.valueOf(diskSize)); } } @@ -4320,7 +4320,14 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir */ protected long configureCustomRootDiskSize(Map customParameters, VMTemplateVO template, HypervisorType hypervisorType, DiskOfferingVO rootDiskOffering) { verifyIfHypervisorSupportsRootdiskSizeOverride(hypervisorType); - long rootDiskSizeInBytes = verifyAndGetDiskSize(rootDiskOffering, NumbersUtil.parseLong(customParameters.get(VmDetailConstants.ROOT_DISK_SIZE), -1)); + Long rootDiskSizeCustomParam = null; + if (customParameters.containsKey(VmDetailConstants.ROOT_DISK_SIZE)) { + rootDiskSizeCustomParam = NumbersUtil.parseLong(customParameters.get(VmDetailConstants.ROOT_DISK_SIZE), -1); + if (rootDiskSizeCustomParam <= 0) { + throw new InvalidParameterValueException("Root disk size should be a positive number."); + } + } + long rootDiskSizeInBytes = verifyAndGetDiskSize(rootDiskOffering, rootDiskSizeCustomParam); if (rootDiskSizeInBytes > 0) { //if the size at DiskOffering is not zero then the Service Offering had it configured, it holds priority over the User custom size _volumeService.validateVolumeSizeInBytes(rootDiskSizeInBytes); long rootDiskSizeInGiB = rootDiskSizeInBytes / GiB_TO_BYTES; @@ -4329,11 +4336,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir } if (customParameters.containsKey(VmDetailConstants.ROOT_DISK_SIZE)) { - Long rootDiskSize = NumbersUtil.parseLong(customParameters.get(VmDetailConstants.ROOT_DISK_SIZE), -1); - if (rootDiskSize <= 0) { - throw new InvalidParameterValueException("Root disk size should be a positive number."); - } - rootDiskSize *= GiB_TO_BYTES; + Long rootDiskSize = rootDiskSizeCustomParam * GiB_TO_BYTES; _volumeService.validateVolumeSizeInBytes(rootDiskSize); return rootDiskSize; } else { From 439d70fd2b907a4ed12ed9b67b3be78969b01a8b Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Mon, 28 Aug 2023 14:26:20 +0200 Subject: [PATCH 3/8] xen/xcpng: set vmr.VCPUsMax to minimum of global setting and host cpu cores (#7887) Co-authored-by: dahn --- .../main/java/com/cloud/hypervisor/XenServerGuru.java | 10 +--------- .../xenserver/resource/CitrixResourceBase.java | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/XenServerGuru.java b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/XenServerGuru.java index a8d7a6e268e..9de6ba8ab4f 100644 --- a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/XenServerGuru.java +++ b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/XenServerGuru.java @@ -17,7 +17,6 @@ package com.cloud.hypervisor; import java.util.ArrayList; -import java.util.Comparator; import java.util.List; import java.util.Map; @@ -96,14 +95,7 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru, if (userVmVO != null) { HostVO host = hostDao.findById(userVmVO.getHostId()); if (host != null) { - List clusterHosts = hostDao.listByClusterAndHypervisorType(host.getClusterId(), host.getHypervisorType()); - HostVO hostWithMinSocket = clusterHosts.stream().min(Comparator.comparing(HostVO::getCpuSockets)).orElse(null); - Integer vCpus = MaxNumberOfVCPUSPerVM.valueIn(host.getClusterId()); - if (hostWithMinSocket != null && hostWithMinSocket.getCpuSockets() != null && - hostWithMinSocket.getCpuSockets() < vCpus) { - vCpus = hostWithMinSocket.getCpuSockets(); - } - to.setVcpuMaxLimit(vCpus); + to.setVcpuMaxLimit(MaxNumberOfVCPUSPerVM.valueIn(host.getClusterId())); } } diff --git a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java index 7fcf8858469..79a1ef03483 100644 --- a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java +++ b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java @@ -1338,7 +1338,7 @@ public abstract class CitrixResourceBase extends ServerResourceBase implements S vmr.VCPUsMax = (long)vmSpec.getCpus(); } else { if (vmSpec.getVcpuMaxLimit() != null) { - vmr.VCPUsMax = (long)vmSpec.getVcpuMaxLimit(); + vmr.VCPUsMax = Math.min(vmSpec.getVcpuMaxLimit(), (long) _host.getCpus()); } } } else { From 2f701e1f8939f76a0a71f23aaadd41cb91725a43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Jandre?= <48719461+JoaoJandre@users.noreply.github.com> Date: Tue, 29 Aug 2023 15:00:12 -0300 Subject: [PATCH 4/8] New configs for quota email's headers and footers (#7852) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: João Jandre --- .../quota/QuotaAlertManagerImpl.java | 22 ++++++++++++-- .../quota/constant/QuotaConfig.java | 6 ++++ .../quota/QuotaAlertManagerImplTest.java | 29 ++++++++++++++++++- .../cloudstack/quota/QuotaServiceImpl.java | 3 +- 4 files changed, 55 insertions(+), 5 deletions(-) diff --git a/framework/quota/src/main/java/org/apache/cloudstack/quota/QuotaAlertManagerImpl.java b/framework/quota/src/main/java/org/apache/cloudstack/quota/QuotaAlertManagerImpl.java index 8ef2c96f2aa..6be739919ea 100644 --- a/framework/quota/src/main/java/org/apache/cloudstack/quota/QuotaAlertManagerImpl.java +++ b/framework/quota/src/main/java/org/apache/cloudstack/quota/QuotaAlertManagerImpl.java @@ -36,6 +36,7 @@ import org.apache.cloudstack.quota.vo.QuotaAccountVO; import org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO; import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.text.StrSubstitutor; +import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; import org.springframework.stereotype.Component; @@ -223,7 +224,7 @@ public class QuotaAlertManagerImpl extends ManagerBase implements QuotaAlertMana final String body = bodySubstitutor.replace(emailTemplate.getTemplateBody()); try { - sendQuotaAlert(account.getUuid(), emailRecipients, subject, body); + sendQuotaAlert(account, emailRecipients, subject, body); emailToBeSent.sentSuccessfully(_quotaAcc); } catch (Exception e) { s_logger.error(String.format("Unable to send quota alert email (subject=%s; body=%s) to account %s (%s) recipients (%s) due to error (%s)", subject, body, account.getAccountName(), @@ -354,17 +355,20 @@ public class QuotaAlertManagerImpl extends ManagerBase implements QuotaAlertMana } }; - protected void sendQuotaAlert(String accountUuid, List emails, String subject, String body) { + protected void sendQuotaAlert(Account account, List emails, String subject, String body) { SMTPMailProperties mailProperties = new SMTPMailProperties(); mailProperties.setSender(new MailAddress(senderAddress)); + + body = addHeaderAndFooter(body, QuotaConfig.QuotaEmailHeader.valueIn(account.getDomainId()), QuotaConfig.QuotaEmailFooter.valueIn(account.getDomainId())); + mailProperties.setSubject(subject); mailProperties.setContent(body); mailProperties.setContentType("text/html; charset=utf-8"); if (CollectionUtils.isEmpty(emails)) { s_logger.warn(String.format("Account [%s] does not have users with email registered, " - + "therefore we are unable to send quota alert email with subject [%s] and content [%s].", accountUuid, subject, body)); + + "therefore we are unable to send quota alert email with subject [%s] and content [%s].", account.getUuid(), subject, body)); return; } @@ -378,4 +382,16 @@ public class QuotaAlertManagerImpl extends ManagerBase implements QuotaAlertMana mailSender.sendMail(mailProperties); } + protected String addHeaderAndFooter(String body, String header, String footer) { + + if (StringUtils.isNotEmpty(header)) { + body = String.format("%s%s", header, body); + } + if (StringUtils.isNotEmpty(footer)) { + body = String.format("%s%s", body, footer); + } + + return body; + } + } diff --git a/framework/quota/src/main/java/org/apache/cloudstack/quota/constant/QuotaConfig.java b/framework/quota/src/main/java/org/apache/cloudstack/quota/constant/QuotaConfig.java index fa9af8f822a..f1426f397b3 100644 --- a/framework/quota/src/main/java/org/apache/cloudstack/quota/constant/QuotaConfig.java +++ b/framework/quota/src/main/java/org/apache/cloudstack/quota/constant/QuotaConfig.java @@ -63,6 +63,12 @@ public interface QuotaConfig { ConfigKey QuotaAccountEnabled = new ConfigKey<>("Advanced", Boolean.class, "quota.account.enabled", "true", "Indicates whether Quota plugin is enabled or not for " + "the account.", true, ConfigKey.Scope.Account); + ConfigKey QuotaEmailHeader = new ConfigKey<>("Advanced", String.class, "quota.email.header", "", + "Text to be added as a header for quota emails. Line breaks are not automatically inserted between this section and the body.", true, ConfigKey.Scope.Domain); + + ConfigKey QuotaEmailFooter = new ConfigKey<>("Advanced", String.class, "quota.email.footer", "", + "Text to be added as a footer for quota emails. Line breaks are not automatically inserted between this section and the body.", true, ConfigKey.Scope.Domain); + enum QuotaEmailTemplateTypes { QUOTA_LOW, QUOTA_EMPTY, QUOTA_UNLOCK_ACCOUNT, QUOTA_STATEMENT } diff --git a/framework/quota/src/test/java/org/apache/cloudstack/quota/QuotaAlertManagerImplTest.java b/framework/quota/src/test/java/org/apache/cloudstack/quota/QuotaAlertManagerImplTest.java index 7a1e7b7e456..ae2f2e9926e 100644 --- a/framework/quota/src/test/java/org/apache/cloudstack/quota/QuotaAlertManagerImplTest.java +++ b/framework/quota/src/test/java/org/apache/cloudstack/quota/QuotaAlertManagerImplTest.java @@ -71,6 +71,21 @@ public class QuotaAlertManagerImplTest extends TestCase { @Mock private ConfigurationDao configDao; + @Mock + private QuotaAccountVO quotaAccountVOMock; + + @Mock + private List deferredQuotaEmailListMock; + + @Mock + private QuotaManagerImpl quotaManagerMock; + + @Mock + private Date balanceDateMock; + + @Mock + private AccountVO accountMock; + @Spy @InjectMocks private QuotaAlertManagerImpl quotaAlertManager = new QuotaAlertManagerImpl(); @@ -162,10 +177,22 @@ public class QuotaAlertManagerImplTest extends TestCase { quotaAlertManager.sendQuotaAlert(email); assertTrue(email.getSendDate() != null); - Mockito.verify(quotaAlertManager, Mockito.times(1)).sendQuotaAlert(Mockito.anyString(), Mockito.anyListOf(String.class), Mockito.anyString(), Mockito.anyString()); + Mockito.verify(quotaAlertManager, Mockito.times(1)).sendQuotaAlert(Mockito.any(), Mockito.anyListOf(String.class), Mockito.anyString(), Mockito.anyString()); Mockito.verify(quotaAlertManager.mailSender, Mockito.times(1)).sendMail(Mockito.any(SMTPMailProperties.class)); } + @Test + public void addHeaderAndFooterTestIfHeaderAndFootersAreAdded() { + String body = quotaAlertManager.addHeaderAndFooter("body", "Header", "Footer"); + assertEquals("HeaderbodyFooter", body); + } + + @Test + public void addHeaderAndFooterTestIfHeaderAndFootersAreNotAddedIfEmpty() { + String body = quotaAlertManager.addHeaderAndFooter("body", "", ""); + assertEquals("body", body); + } + @Test public void testGetDifferenceDays() { Date now = new Date(); diff --git a/plugins/database/quota/src/main/java/org/apache/cloudstack/quota/QuotaServiceImpl.java b/plugins/database/quota/src/main/java/org/apache/cloudstack/quota/QuotaServiceImpl.java index afcfe3ead99..1a4007ca5de 100644 --- a/plugins/database/quota/src/main/java/org/apache/cloudstack/quota/QuotaServiceImpl.java +++ b/plugins/database/quota/src/main/java/org/apache/cloudstack/quota/QuotaServiceImpl.java @@ -141,7 +141,8 @@ public class QuotaServiceImpl extends ManagerBase implements QuotaService, Confi @Override public ConfigKey[] getConfigKeys() { return new ConfigKey[] {QuotaPluginEnabled, QuotaEnableEnforcement, QuotaCurrencySymbol, QuotaStatementPeriod, QuotaSmtpHost, QuotaSmtpPort, QuotaSmtpTimeout, - QuotaSmtpUser, QuotaSmtpPassword, QuotaSmtpAuthType, QuotaSmtpSender, QuotaSmtpEnabledSecurityProtocols, QuotaSmtpUseStartTLS, QuotaActivationRuleTimeout, QuotaAccountEnabled}; + QuotaSmtpUser, QuotaSmtpPassword, QuotaSmtpAuthType, QuotaSmtpSender, QuotaSmtpEnabledSecurityProtocols, QuotaSmtpUseStartTLS, QuotaActivationRuleTimeout, QuotaAccountEnabled, + QuotaEmailHeader, QuotaEmailFooter}; } @Override From 819dd7b75c1b61ae444c45476f5834dbfb9094d0 Mon Sep 17 00:00:00 2001 From: GaOrtiga <49285692+GaOrtiga@users.noreply.github.com> Date: Wed, 30 Aug 2023 06:29:16 -0300 Subject: [PATCH 5/8] server: remove supportedOwner from Resource.ResourceType (#7416) --- .../com/cloud/configuration/Resource.java | 47 ++++----------- .../dao/ResourceCountDaoImpl.java | 15 ----- .../ResourceLimitManagerImpl.java | 59 ++++++++----------- .../cloud/server/ConfigurationServerImpl.java | 27 +++------ 4 files changed, 43 insertions(+), 105 deletions(-) diff --git a/api/src/main/java/com/cloud/configuration/Resource.java b/api/src/main/java/com/cloud/configuration/Resource.java index fefeeb15ef5..32db2fcafea 100644 --- a/api/src/main/java/com/cloud/configuration/Resource.java +++ b/api/src/main/java/com/cloud/configuration/Resource.java @@ -22,29 +22,27 @@ public interface Resource { String UNLIMITED = "Unlimited"; enum ResourceType { // Primary and Secondary storage are allocated_storage and not the physical storage. - user_vm("user_vm", 0, ResourceOwnerType.Account, ResourceOwnerType.Domain), - public_ip("public_ip", 1, ResourceOwnerType.Account, ResourceOwnerType.Domain), - volume("volume", 2, ResourceOwnerType.Account, ResourceOwnerType.Domain), - snapshot("snapshot", 3, ResourceOwnerType.Account, ResourceOwnerType.Domain), - template("template", 4, ResourceOwnerType.Account, ResourceOwnerType.Domain), - project("project", 5, ResourceOwnerType.Account, ResourceOwnerType.Domain), - network("network", 6, ResourceOwnerType.Account, ResourceOwnerType.Domain), - vpc("vpc", 7, ResourceOwnerType.Account, ResourceOwnerType.Domain), - cpu("cpu", 8, ResourceOwnerType.Account, ResourceOwnerType.Domain), - memory("memory", 9, ResourceOwnerType.Account, ResourceOwnerType.Domain), - primary_storage("primary_storage", 10, ResourceOwnerType.Account, ResourceOwnerType.Domain), - secondary_storage("secondary_storage", 11, ResourceOwnerType.Account, ResourceOwnerType.Domain); + user_vm("user_vm", 0), + public_ip("public_ip", 1), + volume("volume", 2), + snapshot("snapshot", 3), + template("template", 4), + project("project", 5), + network("network", 6), + vpc("vpc", 7), + cpu("cpu", 8), + memory("memory", 9), + primary_storage("primary_storage", 10), + secondary_storage("secondary_storage", 11); private String name; - private ResourceOwnerType[] supportedOwners; private int ordinal; public static final long bytesToKiB = 1024; public static final long bytesToMiB = bytesToKiB * 1024; public static final long bytesToGiB = bytesToMiB * 1024; - ResourceType(String name, int ordinal, ResourceOwnerType... supportedOwners) { + ResourceType(String name, int ordinal) { this.name = name; - this.supportedOwners = supportedOwners; this.ordinal = ordinal; } @@ -52,25 +50,6 @@ public interface Resource { return name; } - public ResourceOwnerType[] getSupportedOwners() { - return supportedOwners; - } - - public boolean supportsOwner(ResourceOwnerType ownerType) { - boolean success = false; - if (supportedOwners != null) { - int length = supportedOwners.length; - for (int i = 0; i < length; i++) { - if (supportedOwners[i].getName().equalsIgnoreCase(ownerType.getName())) { - success = true; - break; - } - } - } - - return success; - } - public int getOrdinal() { return ordinal; } diff --git a/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java b/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java index f14cef9d92c..ca6f13d2d64 100644 --- a/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java @@ -36,7 +36,6 @@ import com.cloud.configuration.ResourceCountVO; import com.cloud.configuration.ResourceLimit; import com.cloud.domain.DomainVO; import com.cloud.domain.dao.DomainDao; -import com.cloud.exception.UnsupportedServiceException; import com.cloud.user.AccountVO; import com.cloud.user.dao.AccountDao; import com.cloud.utils.db.DB; @@ -171,9 +170,6 @@ public class ResourceCountDaoImpl extends GenericDaoBase ResourceType[] resourceTypes = Resource.ResourceType.values(); for (ResourceType resourceType : resourceTypes) { - if (!resourceType.supportsOwner(ownerType)) { - continue; - } ResourceCountVO resourceCountVO = new ResourceCountVO(resourceType, 0, ownerId, ownerType); persist(resourceCountVO); } @@ -217,17 +213,6 @@ public class ResourceCountDaoImpl extends GenericDaoBase } } - @Override - public ResourceCountVO persist(ResourceCountVO resourceCountVO) { - ResourceOwnerType ownerType = resourceCountVO.getResourceOwnerType(); - ResourceType resourceType = resourceCountVO.getType(); - if (!resourceType.supportsOwner(ownerType)) { - throw new UnsupportedServiceException("Resource type " + resourceType + " is not supported for owner of type " + ownerType.getName()); - } - - return super.persist(resourceCountVO); - } - @Override public long removeEntriesByOwner(long ownerId, ResourceOwnerType ownerType) { SearchCriteria sc = TypeSearch.create(); diff --git a/server/src/main/java/com/cloud/resourcelimit/ResourceLimitManagerImpl.java b/server/src/main/java/com/cloud/resourcelimit/ResourceLimitManagerImpl.java index 37c135d3462..903b851f918 100644 --- a/server/src/main/java/com/cloud/resourcelimit/ResourceLimitManagerImpl.java +++ b/server/src/main/java/com/cloud/resourcelimit/ResourceLimitManagerImpl.java @@ -701,7 +701,7 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim if (isAccount) { if (accountLimitStr.size() < resourceTypes.length) { for (ResourceType rt : resourceTypes) { - if (!accountLimitStr.contains(rt.toString()) && rt.supportsOwner(ResourceOwnerType.Account)) { + if (!accountLimitStr.contains(rt.toString())) { limits.add(new ResourceLimitVO(rt, findCorrectResourceLimitForAccount(_accountMgr.getAccount(accountId), rt), accountId, ResourceOwnerType.Account)); } } @@ -710,7 +710,7 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim } else { if (domainLimitStr.size() < resourceTypes.length) { for (ResourceType rt : resourceTypes) { - if (!domainLimitStr.contains(rt.toString()) && rt.supportsOwner(ResourceOwnerType.Domain)) { + if (!domainLimitStr.contains(rt.toString())) { limits.add(new ResourceLimitVO(rt, findCorrectResourceLimitForDomain(_domainDao.findById(domainId), rt), domainId, ResourceOwnerType.Domain)); } } @@ -855,16 +855,12 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim for (ResourceType type : resourceTypes) { if (accountId != null) { - if (type.supportsOwner(ResourceOwnerType.Account)) { - count = recalculateAccountResourceCount(accountId, type); - counts.add(new ResourceCountVO(type, count, accountId, ResourceOwnerType.Account)); - } + count = recalculateAccountResourceCount(accountId, type); + counts.add(new ResourceCountVO(type, count, accountId, ResourceOwnerType.Account)); } else { - if (type.supportsOwner(ResourceOwnerType.Domain)) { - count = recalculateDomainResourceCount(domainId, type); - counts.add(new ResourceCountVO(type, count, domainId, ResourceOwnerType.Domain)); - } + count = recalculateDomainResourceCount(domainId, type); + counts.add(new ResourceCountVO(type, count, domainId, ResourceOwnerType.Domain)); } } @@ -921,25 +917,20 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim List domainChildren = _domainDao.findImmediateChildrenForParent(domainId); // for each child domain update the resource count - if (type.supportsOwner(ResourceOwnerType.Domain)) { - // calculate project count here - if (type == ResourceType.project) { - newResourceCount += _projectDao.countProjectsForDomain(domainId); - } - - for (DomainVO childDomain : domainChildren) { - long childDomainResourceCount = recalculateDomainResourceCount(childDomain.getId(), type); - newResourceCount += childDomainResourceCount; // add the child domain count to parent domain count - } + // calculate project count here + if (type == ResourceType.project) { + newResourceCount += _projectDao.countProjectsForDomain(domainId); } - if (type.supportsOwner(ResourceOwnerType.Account)) { - List accounts = _accountDao.findActiveAccountsForDomain(domainId); - for (AccountVO account : accounts) { - long accountResourceCount = recalculateAccountResourceCount(account.getId(), type); - newResourceCount += accountResourceCount; // add account's resource count to parent domain count - } + for (DomainVO childDomain : domainChildren) { + long childDomainResourceCount = recalculateDomainResourceCount(childDomain.getId(), type); + newResourceCount += childDomainResourceCount; // add the child domain count to parent domain count + } + List accounts = _accountDao.findActiveAccountsForDomain(domainId); + for (AccountVO account : accounts) { + long accountResourceCount = recalculateAccountResourceCount(account.getId(), type); + newResourceCount += accountResourceCount; // add account's resource count to parent domain count } _resourceCountDao.setResourceCount(domainId, ResourceOwnerType.Domain, type, newResourceCount); @@ -1201,18 +1192,14 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim } for (ResourceType type : ResourceType.values()) { - if (type.supportsOwner(ResourceOwnerType.Domain)) { - recalculateDomainResourceCountInContext(Domain.ROOT_DOMAIN, type); - for (Domain domain : domains) { - recalculateDomainResourceCount(domain.getId(), type); - } + recalculateDomainResourceCountInContext(Domain.ROOT_DOMAIN, type); + for (Domain domain : domains) { + recalculateDomainResourceCount(domain.getId(), type); } - if (type.supportsOwner(ResourceOwnerType.Account)) { - // run through the accounts in the root domain - for (AccountVO account : accounts) { - recalculateAccountResourceCountInContext(account.getId(), type); - } + // run through the accounts in the root domain + for (AccountVO account : accounts) { + recalculateAccountResourceCountInContext(account.getId(), type); } } } diff --git a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java index 3f9447812a7..cb6f9961b64 100644 --- a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java @@ -1315,22 +1315,9 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio List domainResourceCount = _resourceCountDao.listResourceCountByOwnerType(ResourceOwnerType.Domain); List accountResourceCount = _resourceCountDao.listResourceCountByOwnerType(ResourceOwnerType.Account); - final List accountSupportedResourceTypes = new ArrayList(); - final List domainSupportedResourceTypes = new ArrayList(); + final int expectedCount = resourceTypes.length; - for (ResourceType resourceType : resourceTypes) { - if (resourceType.supportsOwner(ResourceOwnerType.Account)) { - accountSupportedResourceTypes.add(resourceType); - } - if (resourceType.supportsOwner(ResourceOwnerType.Domain)) { - domainSupportedResourceTypes.add(resourceType); - } - } - - final int accountExpectedCount = accountSupportedResourceTypes.size(); - final int domainExpectedCount = domainSupportedResourceTypes.size(); - - if ((domainResourceCount.size() < domainExpectedCount * domains.size())) { + if ((domainResourceCount.size() < expectedCount * domains.size())) { s_logger.debug("resource_count table has records missing for some domains...going to insert them"); for (final DomainVO domain : domains) { // Lock domain @@ -1344,8 +1331,8 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio domainCountStr.add(domainCount.getType().toString()); } - if (domainCountStr.size() < domainExpectedCount) { - for (ResourceType resourceType : domainSupportedResourceTypes) { + if (domainCountStr.size() < expectedCount) { + for (ResourceType resourceType : resourceTypes) { if (!domainCountStr.contains(resourceType.toString())) { ResourceCountVO resourceCountVO = new ResourceCountVO(resourceType, 0, domain.getId(), ResourceOwnerType.Domain); s_logger.debug("Inserting resource count of type " + resourceType + " for domain id=" + domain.getId()); @@ -1359,7 +1346,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio } } - if ((accountResourceCount.size() < accountExpectedCount * accounts.size())) { + if ((accountResourceCount.size() < expectedCount * accounts.size())) { s_logger.debug("resource_count table has records missing for some accounts...going to insert them"); for (final AccountVO account : accounts) { // lock account @@ -1373,8 +1360,8 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio accountCountStr.add(accountCount.getType().toString()); } - if (accountCountStr.size() < accountExpectedCount) { - for (ResourceType resourceType : accountSupportedResourceTypes) { + if (accountCountStr.size() < expectedCount) { + for (ResourceType resourceType : resourceTypes) { if (!accountCountStr.contains(resourceType.toString())) { ResourceCountVO resourceCountVO = new ResourceCountVO(resourceType, 0, account.getId(), ResourceOwnerType.Account); s_logger.debug("Inserting resource count of type " + resourceType + " for account id=" + account.getId()); From 78411fd405c6dfe83381f010c143d6bb90b6b7e4 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Wed, 30 Aug 2023 23:51:52 +0200 Subject: [PATCH 6/8] test: fix test_vm_autoscaling.py which does not work due to userdata improvement (#7921) --- test/integration/smoke/test_vm_autoscaling.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/integration/smoke/test_vm_autoscaling.py b/test/integration/smoke/test_vm_autoscaling.py index 316f94fd5fd..7ae61ce57da 100644 --- a/test/integration/smoke/test_vm_autoscaling.py +++ b/test/integration/smoke/test_vm_autoscaling.py @@ -204,7 +204,10 @@ class TestVmAutoScaling(cloudstackTestCase): cls.apiUserdata = UserData.register( cls.apiclient, name="ApiUserdata", - userdata="QVBJdXNlcmRhdGE=", #APIuserdata + userdata="IyEvYmluL2Jhc2gKCmVjaG8gIkFQSVVzZXJkYXRhIgoK", + # #!/bin/bash + # + # echo "APIUserData" account=cls.regular_user.name, domainid=cls.regular_user.domainid ) @@ -327,7 +330,10 @@ class TestVmAutoScaling(cloudstackTestCase): serviceofferingid=cls.service_offering.id, zoneid=cls.zone.id, templateid=cls.template.id, - userdata="VGVzdFVzZXJEYXRh", #TestUserData + userdata="IyEvYmluL2Jhc2gKCmVjaG8gIlRlc3RVc2VyRGF0YSIKCg==", + # #!/bin/bash + # + # echo "TestUserData" expungevmgraceperiod=DEFAULT_EXPUNGE_VM_GRACE_PERIOD, otherdeployparams=cls.otherdeployparams ) From 5917fed773c29d81b1271d623bad14949728d1ff Mon Sep 17 00:00:00 2001 From: sato03 Date: Thu, 31 Aug 2023 18:11:00 -0300 Subject: [PATCH 7/8] refactor getUploadParamsForIso (#7813) Co-authored-by: Henrique Sato --- .../api/AbstractGetUploadParamsCmd.java | 10 ++++----- .../user/iso/GetUploadParamsForIsoCmd.java | 21 ++----------------- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/api/src/main/java/org/apache/cloudstack/api/AbstractGetUploadParamsCmd.java b/api/src/main/java/org/apache/cloudstack/api/AbstractGetUploadParamsCmd.java index c82f4789367..ed3381ae97c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/AbstractGetUploadParamsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/AbstractGetUploadParamsCmd.java @@ -31,18 +31,18 @@ public abstract class AbstractGetUploadParamsCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(AbstractGetUploadParamsCmd.class.getName()); - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the volume/template") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the volume/template/iso") private String name; - @Parameter(name = ApiConstants.FORMAT, type = CommandType.STRING, required = true, description = "the format for the volume/template. Possible values include QCOW2, OVA, " + @Parameter(name = ApiConstants.FORMAT, type = CommandType.STRING, required = true, description = "the format for the volume/template/iso. Possible values include QCOW2, OVA, " + "and VHD.") private String format; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "the ID of the zone the volume/template is " + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "the ID of the zone the volume/template/iso is " + "to be hosted on") private Long zoneId; - @Parameter(name = ApiConstants.CHECKSUM, type = CommandType.STRING, description = "the checksum value of this volume/template " + ApiConstants.CHECKSUM_PARAMETER_PREFIX_DESCRIPTION) + @Parameter(name = ApiConstants.CHECKSUM, type = CommandType.STRING, description = "the checksum value of this volume/template/iso " + ApiConstants.CHECKSUM_PARAMETER_PREFIX_DESCRIPTION) private String checksum; @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional accountName. Must be used with domainId.") @@ -52,7 +52,7 @@ public abstract class AbstractGetUploadParamsCmd extends BaseCmd { + "domainId must also be used.") private Long domainId; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Upload volume/template for the project") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Upload volume/template/iso for the project") private Long projectId; public String getName() { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/GetUploadParamsForIsoCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/GetUploadParamsForIsoCmd.java index 6f25afd1e44..a7a418f5a86 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/GetUploadParamsForIsoCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/GetUploadParamsForIsoCmd.java @@ -28,7 +28,6 @@ import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.GetUploadParamsResponse; import org.apache.cloudstack.api.response.GuestOSResponse; -import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.cloudstack.context.CallContext; import com.cloud.exception.ConcurrentOperationException; @@ -37,15 +36,13 @@ import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -@APICommand(name = GetUploadParamsForIsoCmd.APINAME, +@APICommand(name = "getUploadParamsForIso", description = "upload an existing ISO into the CloudStack cloud.", responseObject = GetUploadParamsResponse.class, since = "4.13", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class GetUploadParamsForIsoCmd extends AbstractGetUploadParamsCmd { - public static final String APINAME = "getUploadParamsForIso"; - private static final String s_name = "postuploadisoresponse"; ///////////////////////////////////////////////////// @@ -73,19 +70,12 @@ public class GetUploadParamsForIsoCmd extends AbstractGetUploadParamsCmd { @Parameter(name = ApiConstants.IS_EXTRACTABLE, type = BaseCmd.CommandType.BOOLEAN, description = "true if the ISO or its derivatives are extractable; default is false") private Boolean extractable; - @Parameter(name = ApiConstants.NAME, type = BaseCmd.CommandType.STRING, required = true, description = "the name of the ISO") - private String isoName; - @Parameter(name = ApiConstants.OS_TYPE_ID, type = BaseCmd.CommandType.UUID, entityType = GuestOSResponse.class, description = "the ID of the OS type that best represents the OS of this ISO. If the ISO is bootable this parameter needs to be passed") private Long osTypeId; - @Parameter(name=ApiConstants.ZONE_ID, type= BaseCmd.CommandType.UUID, entityType = ZoneResponse.class, - required=true, description="the ID of the zone you wish to register the ISO to.") - protected Long zoneId; - ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -110,17 +100,10 @@ public class GetUploadParamsForIsoCmd extends AbstractGetUploadParamsCmd { return extractable; } - public String getIsoName() { - return isoName; - } - public Long getOsTypeId() { return osTypeId; } - public Long getZoneId() { - return zoneId; - } ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// @@ -134,7 +117,7 @@ public class GetUploadParamsForIsoCmd extends AbstractGetUploadParamsCmd { response.setResponseName(getCommandName()); setResponseObject(response); } catch (ResourceAllocationException | MalformedURLException e) { - s_logger.error("Exception while registering template", e); + s_logger.error("Exception while registering ISO", e); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Exception while registering ISO: " + e.getMessage()); } } From 2e6100d85bb408bd1ccfa062cd10ca20b2db3383 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Fri, 1 Sep 2023 18:44:34 +0200 Subject: [PATCH 8/8] utils: build both SHADED and original jars (#7912) --- debian/rules | 2 +- packaging/centos7/cloud.spec | 2 +- packaging/centos8/cloud.spec | 2 +- utils/pom.xml | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/debian/rules b/debian/rules index 16f10ad8047..2f160cc5c24 100755 --- a/debian/rules +++ b/debian/rules @@ -135,7 +135,7 @@ override_dh_auto_install: install -D systemvm/dist/* $(DESTDIR)/usr/share/$(PACKAGE)-common/vms/ # We need jasypt for cloud-install-sys-tmplt, so this is a nasty hack to get it into the right place install -D agent/target/dependencies/jasypt-1.9.3.jar $(DESTDIR)/usr/share/$(PACKAGE)-common/lib - install -D utils/target/cloud-utils-$(VERSION).jar $(DESTDIR)/usr/share/$(PACKAGE)-common/lib/$(PACKAGE)-utils.jar + install -D utils/target/cloud-utils-$(VERSION)-SHADED.jar $(DESTDIR)/usr/share/$(PACKAGE)-common/lib/$(PACKAGE)-utils.jar # cloudstack-python mkdir -p $(DESTDIR)/usr/share/pyshared diff --git a/packaging/centos7/cloud.spec b/packaging/centos7/cloud.spec index 9a1cf92ce89..e498fed25a1 100644 --- a/packaging/centos7/cloud.spec +++ b/packaging/centos7/cloud.spec @@ -302,7 +302,7 @@ ln -sf log4j-cloud.xml ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/log4j install python/bindir/cloud-external-ipallocator.py ${RPM_BUILD_ROOT}%{_bindir}/%{name}-external-ipallocator.py install -D client/target/pythonlibs/jasypt-1.9.3.jar ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/lib/jasypt-1.9.3.jar -install -D utils/target/cloud-utils-%{_maventag}.jar ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/lib/%{name}-utils.jar +install -D utils/target/cloud-utils-%{_maventag}-SHADED.jar ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/lib/%{name}-utils.jar install -D packaging/centos7/cloud-ipallocator.rc ${RPM_BUILD_ROOT}%{_initrddir}/%{name}-ipallocator install -D packaging/centos7/cloud.limits ${RPM_BUILD_ROOT}%{_sysconfdir}/security/limits.d/cloud diff --git a/packaging/centos8/cloud.spec b/packaging/centos8/cloud.spec index 8d567f217ce..57b16543ba8 100644 --- a/packaging/centos8/cloud.spec +++ b/packaging/centos8/cloud.spec @@ -284,7 +284,7 @@ ln -sf log4j-cloud.xml ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/log4j install python/bindir/cloud-external-ipallocator.py ${RPM_BUILD_ROOT}%{_bindir}/%{name}-external-ipallocator.py install -D client/target/pythonlibs/jasypt-1.9.3.jar ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/lib/jasypt-1.9.3.jar -install -D utils/target/cloud-utils-%{_maventag}.jar ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/lib/%{name}-utils.jar +install -D utils/target/cloud-utils-%{_maventag}-SHADED.jar ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/lib/%{name}-utils.jar install -D packaging/centos8/cloud-ipallocator.rc ${RPM_BUILD_ROOT}%{_initrddir}/%{name}-ipallocator install -D packaging/centos8/cloud.limits ${RPM_BUILD_ROOT}%{_sysconfdir}/security/limits.d/cloud diff --git a/utils/pom.xml b/utils/pom.xml index 4360e187f75..c65de9cb901 100755 --- a/utils/pom.xml +++ b/utils/pom.xml @@ -261,6 +261,7 @@ shade + ${project.artifactId}-${project.version}-SHADED false