mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-10196: Remove ejb-api 3.0 dependency (#2348)
Fixed QuotaAlertManagerImplTest, which was injecting mock objects manually.
This commit is contained in:
parent
973a9c1dce
commit
3c6df7c970
@ -23,8 +23,6 @@ import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@ -37,7 +35,6 @@ import com.cloud.utils.PropertiesUtil;
|
||||
* @config {@table || Param Name | Description | Values | Default || || path |
|
||||
* path to the properties _file | String | db/db.properties || * }
|
||||
**/
|
||||
@Local(value = {StorageComponent.class})
|
||||
public class PropertiesStorage implements StorageComponent {
|
||||
private static final Logger s_logger = Logger.getLogger(PropertiesStorage.class);
|
||||
Properties _properties = new Properties();
|
||||
|
||||
@ -24,7 +24,6 @@ import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
@ -32,7 +31,6 @@ import org.apache.log4j.Logger;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
|
||||
@Local(value = {DhcpSnooper.class})
|
||||
public class FakeDhcpSnooper implements DhcpSnooper {
|
||||
private static final Logger s_logger = Logger.getLogger(FakeDhcpSnooper.class);
|
||||
private Queue<String> _ipAddresses = new ConcurrentLinkedQueue<String>();
|
||||
|
||||
@ -22,8 +22,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.agent.IAgentControl;
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.CheckNetworkAnswer;
|
||||
@ -43,7 +41,6 @@ import com.cloud.storage.Storage;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
import com.cloud.utils.StringUtils;
|
||||
|
||||
@Local(value = {ServerResource.class})
|
||||
public class DummyResource implements ServerResource {
|
||||
String _name;
|
||||
Host.Type _type;
|
||||
|
||||
@ -16,12 +16,9 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.config;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.Configurable;
|
||||
|
||||
@Local(value = {ApiServiceConfiguration.class})
|
||||
public class ApiServiceConfiguration implements Configurable {
|
||||
public static final ConfigKey<String> ManagementHostIPAdr = new ConfigKey<String>("Advanced", String.class, "host", "localhost", "The ip address of management server", true);
|
||||
public static final ConfigKey<String> ApiServletPath = new ConfigKey<String>("Advanced", String.class, "endpointe.url", "http://localhost:8080/client/api",
|
||||
|
||||
@ -26,10 +26,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
@Local(value = StorageLayer.class)
|
||||
public class JavaStorageLayer implements StorageLayer {
|
||||
|
||||
String _name;
|
||||
@ -150,8 +148,9 @@ public class JavaStorageLayer implements StorageLayer {
|
||||
return mountPaths;
|
||||
}
|
||||
for (File file : files) {
|
||||
if (file.getName().startsWith(String.valueOf(msHostId) + "."))
|
||||
if (file.getName().startsWith(String.valueOf(msHostId) + ".")) {
|
||||
mountPaths.add(file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
return mountPaths;
|
||||
}
|
||||
@ -208,8 +207,9 @@ public class JavaStorageLayer implements StorageLayer {
|
||||
dir = new File(dirPath);
|
||||
if (!dir.exists()) {
|
||||
success = dir.mkdir();
|
||||
if (_makeWorldWriteable)
|
||||
if (_makeWorldWriteable) {
|
||||
success = success && setWorldReadableAndWriteable(dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,32 +284,24 @@ public class JavaStorageLayer implements StorageLayer {
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfigParams(Map<String, Object> params) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getConfigParams() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRunLevel() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRunLevel(int level) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -18,8 +18,6 @@ package com.cloud.dc.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.dc.DomainVlanMapVO;
|
||||
@ -28,7 +26,6 @@ import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
|
||||
@Component
|
||||
@Local(value={DomainVlanMapDao.class})
|
||||
public class DomainVlanMapDaoImpl extends GenericDaoBase<DomainVlanMapVO, Long> implements DomainVlanMapDao {
|
||||
protected SearchBuilder<DomainVlanMapVO> DomainSearch;
|
||||
protected SearchBuilder<DomainVlanMapVO> VlanSearch;
|
||||
|
||||
@ -27,7 +27,6 @@ import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.TableGenerator;
|
||||
|
||||
@ -71,7 +70,6 @@ import com.cloud.utils.db.UpdateBuilder;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
@Component
|
||||
@Local(value = {HostDao.class})
|
||||
@DB
|
||||
@TableGenerator(name = "host_req_sq", table = "op_host", pkColumnName = "id", valueColumnName = "sequence", allocationSize = 1)
|
||||
public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao { //FIXME: , ExternalIdDao {
|
||||
|
||||
@ -25,12 +25,10 @@ import com.cloud.utils.db.TransactionCallbackNoReturn;
|
||||
import com.cloud.utils.db.TransactionStatus;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Local(value = FirewallRulesDcidrsDao.class)
|
||||
public class FirewallRulesDcidrsDaoImpl extends GenericDaoBase<FirewallRulesDestCidrsVO, Long> implements FirewallRulesDcidrsDao {
|
||||
|
||||
protected final SearchBuilder<FirewallRulesDestCidrsVO> cidrsSearch;
|
||||
|
||||
@ -24,11 +24,9 @@ import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.acl.RoleVO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Local(value = {RoleDao.class})
|
||||
public class RoleDaoImpl extends GenericDaoBase<RoleVO, Long> implements RoleDao {
|
||||
private final SearchBuilder<RoleVO> RoleByNameSearch;
|
||||
private final SearchBuilder<RoleVO> RoleByTypeSearch;
|
||||
|
||||
@ -34,7 +34,6 @@ import org.apache.cloudstack.acl.RolePermissionVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@ -42,7 +41,6 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Component
|
||||
@Local(value = {RolePermissionsDao.class})
|
||||
public class RolePermissionsDaoImpl extends GenericDaoBase<RolePermissionVO, Long> implements RolePermissionsDao {
|
||||
protected static final Logger LOGGER = Logger.getLogger(RolePermissionsDaoImpl.class);
|
||||
|
||||
|
||||
@ -16,14 +16,11 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.resourcedetail.dao;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.apache.cloudstack.resourcedetail.GuestOsDetailVO;
|
||||
import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Local(value = {GuestOsDetailsDao.class})
|
||||
public class GuestOsDetailsDaoImpl extends ResourceDetailsDaoBase<GuestOsDetailVO> implements GuestOsDetailsDao {
|
||||
|
||||
@Override
|
||||
|
||||
@ -19,10 +19,6 @@
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax.ejb</groupId>
|
||||
<artifactId>ejb-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.ehcache</groupId>
|
||||
<artifactId>ehcache-core</artifactId>
|
||||
|
||||
@ -16,6 +16,37 @@
|
||||
//under the License.
|
||||
package org.apache.cloudstack.quota;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.mail.Authenticator;
|
||||
import javax.mail.Message;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.PasswordAuthentication;
|
||||
import javax.mail.Session;
|
||||
import javax.mail.URLName;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.quota.constant.QuotaConfig;
|
||||
import org.apache.cloudstack.quota.constant.QuotaConfig.QuotaEmailTemplateTypes;
|
||||
import org.apache.cloudstack.quota.dao.QuotaAccountDao;
|
||||
import org.apache.cloudstack.quota.dao.QuotaEmailTemplatesDao;
|
||||
import org.apache.cloudstack.quota.vo.QuotaAccountVO;
|
||||
import org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO;
|
||||
import org.apache.commons.lang3.text.StrSubstitutor;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.domain.DomainVO;
|
||||
import com.cloud.domain.dao.DomainDao;
|
||||
import com.cloud.user.Account;
|
||||
@ -31,40 +62,8 @@ import com.google.common.base.Strings;
|
||||
import com.sun.mail.smtp.SMTPMessage;
|
||||
import com.sun.mail.smtp.SMTPSSLTransport;
|
||||
import com.sun.mail.smtp.SMTPTransport;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.quota.constant.QuotaConfig;
|
||||
import org.apache.cloudstack.quota.constant.QuotaConfig.QuotaEmailTemplateTypes;
|
||||
import org.apache.cloudstack.quota.dao.QuotaAccountDao;
|
||||
import org.apache.cloudstack.quota.dao.QuotaEmailTemplatesDao;
|
||||
import org.apache.cloudstack.quota.dao.QuotaUsageDao;
|
||||
import org.apache.cloudstack.quota.vo.QuotaAccountVO;
|
||||
import org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO;
|
||||
import org.apache.commons.lang3.text.StrSubstitutor;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.mail.Authenticator;
|
||||
import javax.mail.Message;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.PasswordAuthentication;
|
||||
import javax.mail.Session;
|
||||
import javax.mail.URLName;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.naming.ConfigurationException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Component
|
||||
@Local(value = QuotaAlertManager.class)
|
||||
public class QuotaAlertManagerImpl extends ManagerBase implements QuotaAlertManager {
|
||||
private static final Logger s_logger = Logger.getLogger(QuotaAlertManagerImpl.class);
|
||||
|
||||
@ -81,8 +80,6 @@ public class QuotaAlertManagerImpl extends ManagerBase implements QuotaAlertMana
|
||||
@Inject
|
||||
private ConfigurationDao _configDao;
|
||||
@Inject
|
||||
private QuotaUsageDao _quotaUsage;
|
||||
@Inject
|
||||
private QuotaManager _quotaManager;
|
||||
|
||||
private EmailQuotaAlert _emailQuotaAlert;
|
||||
@ -154,7 +151,9 @@ public class QuotaAlertManagerImpl extends ManagerBase implements QuotaAlertMana
|
||||
BigDecimal thresholdBalance = quotaAccount.getQuotaMinBalance();
|
||||
if (accountBalance != null) {
|
||||
AccountVO account = _accountDao.findById(quotaAccount.getId());
|
||||
if (account == null) continue; // the account is removed
|
||||
if (account == null) {
|
||||
continue; // the account is removed
|
||||
}
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("checkAndSendQuotaAlertEmails: Check id=" + account.getId() + " bal=" + accountBalance + ", alertDate=" + alertDate + ", lockable=" + lockable);
|
||||
}
|
||||
@ -186,6 +185,7 @@ public class QuotaAlertManagerImpl extends ManagerBase implements QuotaAlertMana
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendQuotaAlert(DeferredQuotaEmail emailToBeSent) {
|
||||
final AccountVO account = emailToBeSent.getAccount();
|
||||
final BigDecimal balance = emailToBeSent.getQuotaBalance();
|
||||
@ -221,8 +221,8 @@ public class QuotaAlertManagerImpl extends ManagerBase implements QuotaAlertMana
|
||||
}
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("accountName" + account.getAccountName() + "accountID" + account.getUuid() + "accountUsers" + userNames + "domainName" + accountDomain.getName()
|
||||
+ "domainID" + accountDomain.getUuid());
|
||||
s_logger.debug("accountName" + account.getAccountName() + "accountID" + account.getUuid() + "accountUsers" + userNames + "domainName" + accountDomain.getName() + "domainID"
|
||||
+ accountDomain.getUuid());
|
||||
}
|
||||
|
||||
final StrSubstitutor templateEngine = new StrSubstitutor(optionMap);
|
||||
@ -232,15 +232,14 @@ public class QuotaAlertManagerImpl extends ManagerBase implements QuotaAlertMana
|
||||
_emailQuotaAlert.sendQuotaAlert(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(), account.getUuid(), emailRecipients, 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(),
|
||||
account.getUuid(), emailRecipients, e));
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Exception", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
s_logger.error(String.format("No quota email template found for type %s, cannot send quota alert email to account %s(%s)", emailType, account.getAccountName(),
|
||||
account.getUuid()));
|
||||
s_logger.error(String.format("No quota email template found for type %s, cannot send quota alert email to account %s(%s)", emailType, account.getAccountName(), account.getUuid()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -16,12 +16,16 @@
|
||||
//under the License.
|
||||
package org.apache.cloudstack.quota;
|
||||
|
||||
import com.cloud.usage.UsageVO;
|
||||
import com.cloud.usage.dao.UsageDao;
|
||||
import com.cloud.user.AccountVO;
|
||||
import com.cloud.user.dao.AccountDao;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.quota.constant.QuotaTypes;
|
||||
@ -39,19 +43,14 @@ import org.apache.cloudstack.utils.usage.UsageUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
import com.cloud.usage.UsageVO;
|
||||
import com.cloud.usage.dao.UsageDao;
|
||||
import com.cloud.user.AccountVO;
|
||||
import com.cloud.user.dao.AccountDao;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
|
||||
@Component
|
||||
@Local(value = QuotaManager.class)
|
||||
public class QuotaManagerImpl extends ManagerBase implements QuotaManager {
|
||||
private static final Logger s_logger = Logger.getLogger(QuotaManagerImpl.class.getName());
|
||||
|
||||
@ -360,7 +359,9 @@ public class QuotaManagerImpl extends ManagerBase implements QuotaManager {
|
||||
BigDecimal rawusage;
|
||||
// get service offering details
|
||||
ServiceOfferingVO serviceoffering = _serviceOfferingDao.findServiceOffering(usageRecord.getVmInstanceId(), usageRecord.getOfferingId());
|
||||
if (serviceoffering == null) return quotalist;
|
||||
if (serviceoffering == null) {
|
||||
return quotalist;
|
||||
}
|
||||
rawusage = new BigDecimal(usageRecord.getRawUsage());
|
||||
|
||||
QuotaTariffVO tariff = _quotaTariffDao.findTariffPlanByUsageType(QuotaTypes.CPU_NUMBER, usageRecord.getEndDate());
|
||||
|
||||
@ -24,7 +24,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
@ -42,7 +41,6 @@ import com.cloud.user.dao.AccountDao;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
|
||||
@Component
|
||||
@Local(value = QuotaStatement.class)
|
||||
public class QuotaStatementImpl extends ManagerBase implements QuotaStatement {
|
||||
private static final Logger s_logger = Logger.getLogger(QuotaStatementImpl.class);
|
||||
|
||||
|
||||
@ -16,25 +16,23 @@
|
||||
//under the License.
|
||||
package org.apache.cloudstack.quota.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.quota.vo.QuotaAccountVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.db.TransactionCallback;
|
||||
import com.cloud.utils.db.TransactionLegacy;
|
||||
import com.cloud.utils.db.TransactionStatus;
|
||||
|
||||
import org.apache.cloudstack.quota.vo.QuotaAccountVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Local(value = { QuotaAccountDao.class })
|
||||
public class QuotaAccountDaoImpl extends GenericDaoBase<QuotaAccountVO, Long> implements QuotaAccountDao {
|
||||
public static final Logger s_logger = Logger.getLogger(QuotaAccountDaoImpl.class);
|
||||
|
||||
@Override
|
||||
public List<QuotaAccountVO> listAllQuotaAccount() {
|
||||
return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<List<QuotaAccountVO>>() {
|
||||
@Override
|
||||
@ -44,6 +42,7 @@ public class QuotaAccountDaoImpl extends GenericDaoBase<QuotaAccountVO, Long> im
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuotaAccountVO findByIdQuotaAccount(final Long id) {
|
||||
return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<QuotaAccountVO>() {
|
||||
@Override
|
||||
@ -53,6 +52,7 @@ public class QuotaAccountDaoImpl extends GenericDaoBase<QuotaAccountVO, Long> im
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuotaAccountVO persistQuotaAccount(final QuotaAccountVO entity) {
|
||||
return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<QuotaAccountVO>() {
|
||||
@Override
|
||||
@ -62,6 +62,7 @@ public class QuotaAccountDaoImpl extends GenericDaoBase<QuotaAccountVO, Long> im
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateQuotaAccount(final Long id, final QuotaAccountVO entity) {
|
||||
return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<Boolean>() {
|
||||
@Override
|
||||
|
||||
@ -16,6 +16,16 @@
|
||||
//under the License.
|
||||
package org.apache.cloudstack.quota.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.quota.vo.QuotaBalanceVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.utils.db.Filter;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.QueryBuilder;
|
||||
@ -25,23 +35,11 @@ import com.cloud.utils.db.TransactionCallback;
|
||||
import com.cloud.utils.db.TransactionLegacy;
|
||||
import com.cloud.utils.db.TransactionStatus;
|
||||
|
||||
import org.apache.cloudstack.quota.vo.QuotaBalanceVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Local(value = {QuotaBalanceDao.class})
|
||||
public class QuotaBalanceDaoImpl extends GenericDaoBase<QuotaBalanceVO, Long> implements QuotaBalanceDao {
|
||||
private static final Logger s_logger = Logger.getLogger(QuotaBalanceDaoImpl.class.getName());
|
||||
|
||||
@Override
|
||||
public QuotaBalanceVO findLastBalanceEntry(final Long accountId, final Long domainId, final Date beforeThis) {
|
||||
return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<QuotaBalanceVO>() {
|
||||
@Override
|
||||
@ -59,6 +57,7 @@ public class QuotaBalanceDaoImpl extends GenericDaoBase<QuotaBalanceVO, Long> im
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuotaBalanceVO findLaterBalanceEntry(final Long accountId, final Long domainId, final Date afterThis) {
|
||||
return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<QuotaBalanceVO>() {
|
||||
@Override
|
||||
@ -76,6 +75,7 @@ public class QuotaBalanceDaoImpl extends GenericDaoBase<QuotaBalanceVO, Long> im
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuotaBalanceVO saveQuotaBalance(final QuotaBalanceVO qb) {
|
||||
return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<QuotaBalanceVO>() {
|
||||
@Override
|
||||
@ -85,6 +85,7 @@ public class QuotaBalanceDaoImpl extends GenericDaoBase<QuotaBalanceVO, Long> im
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QuotaBalanceVO> findCreditBalance(final Long accountId, final Long domainId, final Date lastbalancedate, final Date beforeThis) {
|
||||
return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<List<QuotaBalanceVO>>() {
|
||||
@Override
|
||||
@ -104,6 +105,7 @@ public class QuotaBalanceDaoImpl extends GenericDaoBase<QuotaBalanceVO, Long> im
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QuotaBalanceVO> findQuotaBalance(final Long accountId, final Long domainId, final Date startDate, final Date endDate) {
|
||||
return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<List<QuotaBalanceVO>>() {
|
||||
@Override
|
||||
@ -132,6 +134,7 @@ public class QuotaBalanceDaoImpl extends GenericDaoBase<QuotaBalanceVO, Long> im
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QuotaBalanceVO> lastQuotaBalanceVO(final Long accountId, final Long domainId, final Date pivotDate) {
|
||||
return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<List<QuotaBalanceVO>>() {
|
||||
@Override
|
||||
@ -170,6 +173,7 @@ public class QuotaBalanceDaoImpl extends GenericDaoBase<QuotaBalanceVO, Long> im
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal lastQuotaBalance(final Long accountId, final Long domainId, Date startDate) {
|
||||
List<QuotaBalanceVO> quotaBalance = lastQuotaBalanceVO(accountId, domainId, startDate);
|
||||
BigDecimal finalBalance = new BigDecimal(0);
|
||||
|
||||
@ -20,12 +20,11 @@ import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.apache.cloudstack.quota.vo.QuotaBalanceVO;
|
||||
import org.apache.cloudstack.quota.vo.QuotaCreditsVO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.utils.db.Filter;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
@ -37,7 +36,6 @@ import com.cloud.utils.db.TransactionLegacy;
|
||||
import com.cloud.utils.db.TransactionStatus;
|
||||
|
||||
@Component
|
||||
@Local(value = { QuotaCreditsDao.class })
|
||||
public class QuotaCreditsDaoImpl extends GenericDaoBase<QuotaCreditsVO, Long> implements QuotaCreditsDao {
|
||||
|
||||
@Inject
|
||||
|
||||
@ -16,6 +16,12 @@
|
||||
//under the License.
|
||||
package org.apache.cloudstack.quota.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
@ -25,16 +31,7 @@ import com.cloud.utils.db.TransactionLegacy;
|
||||
import com.cloud.utils.db.TransactionStatus;
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Local(value = { QuotaEmailTemplatesDao.class })
|
||||
public class QuotaEmailTemplatesDaoImpl extends GenericDaoBase<QuotaEmailTemplatesVO, Long> implements QuotaEmailTemplatesDao {
|
||||
private static final Logger s_logger = Logger.getLogger(QuotaEmailTemplatesDaoImpl.class);
|
||||
|
||||
|
||||
@ -16,6 +16,15 @@
|
||||
//under the License.
|
||||
package org.apache.cloudstack.quota.dao;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.quota.constant.QuotaTypes;
|
||||
import org.apache.cloudstack.quota.vo.QuotaTariffVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.utils.db.Filter;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
@ -24,19 +33,8 @@ import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.db.TransactionCallback;
|
||||
import com.cloud.utils.db.TransactionLegacy;
|
||||
import com.cloud.utils.db.TransactionStatus;
|
||||
import org.apache.cloudstack.quota.constant.QuotaTypes;
|
||||
import org.apache.cloudstack.quota.vo.QuotaTariffVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Local(value = {QuotaTariffDao.class})
|
||||
public class QuotaTariffDaoImpl extends GenericDaoBase<QuotaTariffVO, Long> implements QuotaTariffDao {
|
||||
private static final Logger s_logger = Logger.getLogger(QuotaTariffDaoImpl.class.getName());
|
||||
|
||||
@ -55,6 +53,7 @@ public class QuotaTariffDaoImpl extends GenericDaoBase<QuotaTariffVO, Long> impl
|
||||
listAllIncludedUsageType.done();
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuotaTariffVO findTariffPlanByUsageType(final int quotaType, final Date effectiveDate) {
|
||||
return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<QuotaTariffVO>() {
|
||||
@Override
|
||||
@ -77,6 +76,7 @@ public class QuotaTariffDaoImpl extends GenericDaoBase<QuotaTariffVO, Long> impl
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QuotaTariffVO> listAllTariffPlans() {
|
||||
return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<List<QuotaTariffVO>>() {
|
||||
@Override
|
||||
@ -86,6 +86,7 @@ public class QuotaTariffDaoImpl extends GenericDaoBase<QuotaTariffVO, Long> impl
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QuotaTariffVO> listAllTariffPlans(final Date effectiveDate) {
|
||||
return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<List<QuotaTariffVO>>() {
|
||||
@Override
|
||||
@ -110,6 +111,7 @@ public class QuotaTariffDaoImpl extends GenericDaoBase<QuotaTariffVO, Long> impl
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateQuotaTariff(final QuotaTariffVO plan) {
|
||||
return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<Boolean>() {
|
||||
@Override
|
||||
@ -119,6 +121,7 @@ public class QuotaTariffDaoImpl extends GenericDaoBase<QuotaTariffVO, Long> impl
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuotaTariffVO addQuotaTariff(final QuotaTariffVO plan) {
|
||||
if (plan.getIdObj() != null) {
|
||||
throw new IllegalStateException("The QuotaTariffVO being added should not have an Id set ");
|
||||
|
||||
@ -16,6 +16,15 @@
|
||||
//under the License.
|
||||
package org.apache.cloudstack.quota.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.quota.vo.QuotaUsageVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.utils.db.Filter;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.QueryBuilder;
|
||||
@ -25,22 +34,11 @@ import com.cloud.utils.db.TransactionCallback;
|
||||
import com.cloud.utils.db.TransactionLegacy;
|
||||
import com.cloud.utils.db.TransactionStatus;
|
||||
|
||||
import org.apache.cloudstack.quota.vo.QuotaUsageVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Local(value = {QuotaUsageDao.class})
|
||||
public class QuotaUsageDaoImpl extends GenericDaoBase<QuotaUsageVO, Long> implements QuotaUsageDao {
|
||||
private static final Logger s_logger = Logger.getLogger(QuotaUsageDaoImpl.class);
|
||||
|
||||
@Override
|
||||
public BigDecimal findTotalQuotaUsage(final Long accountId, final Long domainId, final Integer usageType, final Date startDate, final Date endDate) {
|
||||
List<QuotaUsageVO> quotaUsage = findQuotaUsage(accountId, domainId, null, startDate, endDate);
|
||||
BigDecimal total = new BigDecimal(0);
|
||||
@ -50,6 +48,7 @@ public class QuotaUsageDaoImpl extends GenericDaoBase<QuotaUsageVO, Long> implem
|
||||
return total;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QuotaUsageVO> findQuotaUsage(final Long accountId, final Long domainId, final Integer usageType, final Date startDate, final Date endDate) {
|
||||
return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<List<QuotaUsageVO>>() {
|
||||
@Override
|
||||
@ -88,6 +87,7 @@ public class QuotaUsageDaoImpl extends GenericDaoBase<QuotaUsageVO, Long> implem
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuotaUsageVO findLastQuotaUsageEntry(final Long accountId, final Long domainId, final Date beforeThis) {
|
||||
return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<QuotaUsageVO>() {
|
||||
@Override
|
||||
@ -104,6 +104,7 @@ public class QuotaUsageDaoImpl extends GenericDaoBase<QuotaUsageVO, Long> implem
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuotaUsageVO persistQuotaUsage(final QuotaUsageVO quotaUsage) {
|
||||
return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<QuotaUsageVO>() {
|
||||
@Override
|
||||
|
||||
@ -18,12 +18,11 @@ package org.apache.cloudstack.quota.dao;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.quota.vo.ServiceOfferingVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.apache.cloudstack.quota.vo.ServiceOfferingVO;
|
||||
|
||||
import com.cloud.event.UsageEventVO;
|
||||
import com.cloud.utils.db.DB;
|
||||
@ -35,7 +34,6 @@ import com.cloud.utils.db.TransactionStatus;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
@Component
|
||||
@Local(value = {ServiceOfferingDao.class})
|
||||
@DB()
|
||||
public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Long> implements ServiceOfferingDao {
|
||||
protected static final Logger s_logger = Logger.getLogger(ServiceOfferingDaoImpl.class);
|
||||
@ -43,6 +41,7 @@ public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Lo
|
||||
@Inject
|
||||
UserVmDetailsDao userVmDetailsDao;
|
||||
|
||||
@Override
|
||||
public ServiceOfferingVO findServiceOffering(final Long vmId, final long serviceOfferingId) {
|
||||
return Transaction.execute(TransactionLegacy.CLOUD_DB, new TransactionCallback<ServiceOfferingVO>() {
|
||||
@Override
|
||||
|
||||
@ -20,17 +20,14 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.apache.cloudstack.quota.vo.UserVmDetailVO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
|
||||
@Component
|
||||
@Local(value = UserVmDetailsDao.class)
|
||||
public class UserVmDetailsDaoImpl extends GenericDaoBase<UserVmDetailVO, Long> implements UserVmDetailsDao {
|
||||
private SearchBuilder<UserVmDetailVO> AllFieldsSearch;
|
||||
|
||||
|
||||
@ -16,6 +16,32 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.quota;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.quota.constant.QuotaConfig;
|
||||
import org.apache.cloudstack.quota.dao.QuotaAccountDao;
|
||||
import org.apache.cloudstack.quota.dao.QuotaEmailTemplatesDao;
|
||||
import org.apache.cloudstack.quota.vo.QuotaAccountVO;
|
||||
import org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.Spy;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
import com.cloud.domain.DomainVO;
|
||||
import com.cloud.domain.dao.DomainDao;
|
||||
import com.cloud.user.Account;
|
||||
@ -24,75 +50,35 @@ import com.cloud.user.UserVO;
|
||||
import com.cloud.user.dao.AccountDao;
|
||||
import com.cloud.user.dao.UserDao;
|
||||
import com.cloud.utils.db.TransactionLegacy;
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.quota.constant.QuotaConfig;
|
||||
import org.apache.cloudstack.quota.dao.QuotaAccountDao;
|
||||
import org.apache.cloudstack.quota.dao.QuotaEmailTemplatesDao;
|
||||
import org.apache.cloudstack.quota.dao.QuotaUsageDao;
|
||||
import org.apache.cloudstack.quota.vo.QuotaAccountVO;
|
||||
import org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.Spy;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.naming.ConfigurationException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class QuotaAlertManagerImplTest extends TestCase {
|
||||
|
||||
@Mock
|
||||
AccountDao accountDao;
|
||||
private AccountDao accountDao;
|
||||
@Mock
|
||||
QuotaAccountDao quotaAcc;
|
||||
private QuotaAccountDao quotaAcc;
|
||||
@Mock
|
||||
UserDao userDao;
|
||||
private UserDao userDao;
|
||||
@Mock
|
||||
DomainDao domainDao;
|
||||
private DomainDao domainDao;
|
||||
@Mock
|
||||
QuotaEmailTemplatesDao quotaEmailTemplateDao;
|
||||
private QuotaEmailTemplatesDao quotaEmailTemplateDao;
|
||||
@Mock
|
||||
ConfigurationDao configDao;
|
||||
private ConfigurationDao configDao;
|
||||
@Mock
|
||||
QuotaUsageDao quotaUsage;
|
||||
@Mock
|
||||
QuotaAlertManagerImpl.EmailQuotaAlert emailQuotaAlert;
|
||||
private QuotaAlertManagerImpl.EmailQuotaAlert emailQuotaAlert;
|
||||
|
||||
@Spy
|
||||
QuotaAlertManagerImpl quotaAlertManager = new QuotaAlertManagerImpl();
|
||||
|
||||
private void injectMockToField(Object mock, String fieldName) throws NoSuchFieldException, IllegalAccessException {
|
||||
Field f = QuotaAlertManagerImpl.class.getDeclaredField(fieldName);
|
||||
f.setAccessible(true);
|
||||
f.set(quotaAlertManager, mock);
|
||||
}
|
||||
@InjectMocks
|
||||
private QuotaAlertManagerImpl quotaAlertManager = new QuotaAlertManagerImpl();
|
||||
|
||||
@Before
|
||||
public void setup() throws IllegalAccessException, NoSuchFieldException, ConfigurationException {
|
||||
// Dummy transaction stack setup
|
||||
TransactionLegacy.open("QuotaAlertManagerImplTest");
|
||||
|
||||
injectMockToField(accountDao, "_accountDao");
|
||||
injectMockToField(quotaAcc, "_quotaAcc");
|
||||
injectMockToField(userDao, "_userDao");
|
||||
injectMockToField(domainDao, "_domainDao");
|
||||
injectMockToField(quotaEmailTemplateDao, "_quotaEmailTemplateDao");
|
||||
injectMockToField(configDao, "_configDao");
|
||||
injectMockToField(quotaUsage, "_quotaUsage");
|
||||
injectMockToField(emailQuotaAlert, "_emailQuotaAlert");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -149,8 +135,7 @@ public class QuotaAlertManagerImplTest extends TestCase {
|
||||
quotaAccount.setQuotaAlertDate(null);
|
||||
quotaAccount.setQuotaEnforce(0);
|
||||
|
||||
QuotaAlertManagerImpl.DeferredQuotaEmail email = new QuotaAlertManagerImpl.DeferredQuotaEmail(account, quotaAccount, new BigDecimal(100),
|
||||
QuotaConfig.QuotaEmailTemplateTypes.QUOTA_LOW);
|
||||
QuotaAlertManagerImpl.DeferredQuotaEmail email = new QuotaAlertManagerImpl.DeferredQuotaEmail(account, quotaAccount, new BigDecimal(100), QuotaConfig.QuotaEmailTemplateTypes.QUOTA_LOW);
|
||||
|
||||
QuotaEmailTemplatesVO quotaEmailTemplatesVO = new QuotaEmailTemplatesVO();
|
||||
quotaEmailTemplatesVO.setTemplateSubject("Low quota");
|
||||
@ -172,8 +157,8 @@ public class QuotaAlertManagerImplTest extends TestCase {
|
||||
Mockito.when(userDao.listByAccount(Mockito.anyLong())).thenReturn(users);
|
||||
|
||||
quotaAlertManager.sendQuotaAlert(email);
|
||||
assertTrue(email.getSendDate()!= null);
|
||||
Mockito.verify(emailQuotaAlert, Mockito.times(1)).sendQuotaAlert(Mockito.anyList(), Mockito.anyString(), Mockito.anyString());
|
||||
assertTrue(email.getSendDate() != null);
|
||||
Mockito.verify(emailQuotaAlert, Mockito.times(1)).sendQuotaAlert(Mockito.anyListOf(String.class), Mockito.anyString(), Mockito.anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -182,7 +167,7 @@ public class QuotaAlertManagerImplTest extends TestCase {
|
||||
assertTrue(QuotaAlertManagerImpl.getDifferenceDays(now, now) == 0L);
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
Calendar c2 = (Calendar) c.clone();
|
||||
Calendar c2 = (Calendar)c.clone();
|
||||
c2.add(Calendar.DATE, 1);
|
||||
assertEquals(1L, QuotaAlertManagerImpl.getDifferenceDays(c.getTime(), c2.getTime()));
|
||||
}
|
||||
|
||||
@ -16,6 +16,17 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.acl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountService;
|
||||
@ -23,18 +34,7 @@ import com.cloud.user.User;
|
||||
import com.cloud.utils.component.AdapterBase;
|
||||
import com.cloud.utils.component.PluggableService;
|
||||
import com.google.common.base.Strings;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Local(value = APIChecker.class)
|
||||
public class DynamicRoleBasedAPIAccessChecker extends AdapterBase implements APIChecker {
|
||||
|
||||
@Inject
|
||||
|
||||
@ -16,21 +16,22 @@
|
||||
//under the License.
|
||||
package org.apache.cloudstack.quota;
|
||||
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.domain.dao.DomainDao;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountVO;
|
||||
import com.cloud.user.dao.AccountDao;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.utils.db.Filter;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.api.command.QuotaBalanceCmd;
|
||||
import org.apache.cloudstack.api.command.QuotaCreditsCmd;
|
||||
import org.apache.cloudstack.api.command.QuotaEmailTemplateListCmd;
|
||||
import org.apache.cloudstack.api.command.QuotaEmailTemplateUpdateCmd;
|
||||
import org.apache.cloudstack.api.command.QuotaEnabledCmd;
|
||||
import org.apache.cloudstack.api.command.QuotaEmailTemplateListCmd;
|
||||
import org.apache.cloudstack.api.command.QuotaStatementCmd;
|
||||
import org.apache.cloudstack.api.command.QuotaSummaryCmd;
|
||||
import org.apache.cloudstack.api.command.QuotaTariffListCmd;
|
||||
@ -52,20 +53,17 @@ import org.apache.cloudstack.utils.usage.UsageUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.domain.dao.DomainDao;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountVO;
|
||||
import com.cloud.user.dao.AccountDao;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.utils.db.Filter;
|
||||
|
||||
@Component
|
||||
@Local(value = QuotaService.class)
|
||||
public class QuotaServiceImpl extends ManagerBase implements QuotaService, Configurable, QuotaConfig {
|
||||
private static final Logger s_logger = Logger.getLogger(QuotaServiceImpl.class);
|
||||
|
||||
|
||||
@ -20,13 +20,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.affinity.AffinityGroup;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupService;
|
||||
import org.apache.cloudstack.affinity.dao.AffinityGroupDao;
|
||||
@ -48,6 +44,8 @@ import org.apache.cloudstack.api.response.DedicatePodResponse;
|
||||
import org.apache.cloudstack.api.response.DedicateZoneResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
@ -84,7 +82,6 @@ import com.cloud.vm.UserVmVO;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
|
||||
@Component
|
||||
@Local({DedicatedService.class})
|
||||
public class DedicatedResourceManagerImpl implements DedicatedService {
|
||||
private static final Logger s_logger = Logger.getLogger(DedicatedResourceManagerImpl.class);
|
||||
|
||||
|
||||
@ -26,16 +26,14 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.utils.identity.ManagementServerNode;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.storage.JavaStorageLayer;
|
||||
@ -48,7 +46,6 @@ import com.cloud.utils.script.Script;
|
||||
import com.cloud.vm.dao.NicDao;
|
||||
import com.cloud.vm.dao.VMInstanceDao;
|
||||
|
||||
@Local(value = {HypervManager.class})
|
||||
public class HypervManagerImpl implements HypervManager {
|
||||
public static final Logger s_logger = Logger.getLogger(HypervManagerImpl.class);
|
||||
|
||||
@ -126,6 +123,7 @@ public class HypervManagerImpl implements HypervManager {
|
||||
runLevel = level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String prepareSecondaryStorageStore(long zoneId) {
|
||||
String secondaryStorageUri = getSecondaryStorageStoreUrl(zoneId);
|
||||
if (secondaryStorageUri == null) {
|
||||
|
||||
@ -32,7 +32,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import org.joda.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@ -40,7 +39,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
@ -63,6 +61,7 @@ import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.impl.conn.BasicClientConnectionManager;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.CheckRouterAnswer;
|
||||
@ -161,7 +160,6 @@ import com.google.gson.reflect.TypeToken;
|
||||
/**
|
||||
* Implementation of dummy resource to be returned from discoverer.
|
||||
**/
|
||||
@Local(value = ServerResource.class)
|
||||
public class HypervDirectConnectResource extends ServerResourceBase implements ServerResource, VirtualRouterDeployer {
|
||||
public static final int DEFAULT_AGENT_PORT = 8250;
|
||||
public static final String HOST_VM_STATE_REPORT_COMMAND = "org.apache.cloudstack.HostVmStateReportCommand";
|
||||
|
||||
@ -26,7 +26,6 @@ import java.io.StringReader;
|
||||
import java.net.InetAddress;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import org.joda.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
@ -43,13 +42,11 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import org.apache.cloudstack.storage.to.PrimaryDataStoreTO;
|
||||
import org.apache.cloudstack.storage.to.VolumeObjectTO;
|
||||
import org.apache.cloudstack.utils.hypervisor.HypervisorUtils;
|
||||
@ -61,22 +58,23 @@ import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.joda.time.Duration;
|
||||
import org.libvirt.Connect;
|
||||
import org.libvirt.Domain;
|
||||
import org.libvirt.DomainBlockStats;
|
||||
import org.libvirt.DomainInfo;
|
||||
import org.libvirt.DomainInfo.DomainState;
|
||||
import org.libvirt.DomainInterfaceStats;
|
||||
import org.libvirt.DomainSnapshot;
|
||||
import org.libvirt.LibvirtException;
|
||||
import org.libvirt.MemoryStatistic;
|
||||
import org.libvirt.NodeInfo;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.libvirt.DomainInterfaceStats;
|
||||
import org.libvirt.DomainSnapshot;
|
||||
import org.libvirt.LibvirtException;
|
||||
import org.libvirt.MemoryStatistic;
|
||||
import org.libvirt.NodeInfo;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.Command;
|
||||
@ -127,15 +125,15 @@ import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.GuestResourceDef;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InputDef;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef.GuestNetType;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.RngDef;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.RngDef.RngBackendModel;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.SCSIDef;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.SerialDef;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.TermPolicy;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.VideoDef;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.RngDef;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.RngDef.RngBackendModel;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.WatchDogDef;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.WatchDogDef.WatchDogModel;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.WatchDogDef.WatchDogAction;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.WatchDogDef.WatchDogModel;
|
||||
import com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRequestWrapper;
|
||||
import com.cloud.hypervisor.kvm.resource.wrapper.LibvirtUtilitiesHelper;
|
||||
import com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk;
|
||||
@ -156,9 +154,9 @@ import com.cloud.storage.resource.StorageSubsystemCommandHandler;
|
||||
import com.cloud.storage.resource.StorageSubsystemCommandHandlerBase;
|
||||
import com.cloud.utils.ExecutionResult;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.StringUtils;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import com.cloud.utils.StringUtils;
|
||||
import com.cloud.utils.Ternary;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
@ -169,6 +167,7 @@ import com.cloud.utils.ssh.SshHelper;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachine.PowerState;
|
||||
import com.cloud.vm.VmDetailConstants;
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
/**
|
||||
* LibvirtComputingResource execute requests on the computing/routing host using
|
||||
@ -192,7 +191,6 @@ import com.cloud.vm.VmDetailConstants;
|
||||
* private mac addresses for domrs | mac address | start + 126 || ||
|
||||
* pool | the parent of the storage pool hierarchy * }
|
||||
**/
|
||||
@Local(value = {ServerResource.class})
|
||||
public class LibvirtComputingResource extends ServerResourceBase implements ServerResource, VirtualRouterDeployer {
|
||||
private static final Logger s_logger = Logger.getLogger(LibvirtComputingResource.class);
|
||||
|
||||
@ -1793,7 +1791,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
||||
}
|
||||
|
||||
final IpAddressTO[] ips = cmd.getIpAddresses();
|
||||
final int numOfIps = ips.length;
|
||||
int nicNum = 0;
|
||||
for (final IpAddressTO ip : ips) {
|
||||
|
||||
|
||||
@ -18,22 +18,19 @@
|
||||
package com.cloud.hypervisor.ovm3.resources;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.storage.command.AttachCommand;
|
||||
import org.apache.cloudstack.storage.command.CopyCommand;
|
||||
import org.apache.cloudstack.storage.command.CreateObjectCommand;
|
||||
import org.apache.cloudstack.storage.command.DeleteCommand;
|
||||
import org.apache.cloudstack.storage.command.DettachCommand;
|
||||
import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.IAgentControl;
|
||||
import com.cloud.agent.api.Answer;
|
||||
@ -104,14 +101,9 @@ import com.cloud.template.VirtualMachineTemplate.BootloaderType;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachine.State;
|
||||
/**
|
||||
* Hypervisor related
|
||||
*/
|
||||
@Local(value = HypervisorResource.class)
|
||||
public class Ovm3HypervisorResource extends ServerResourceBase implements
|
||||
HypervisorResource {
|
||||
private static final Logger LOGGER = Logger
|
||||
.getLogger(Ovm3HypervisorResource.class);
|
||||
|
||||
public class Ovm3HypervisorResource extends ServerResourceBase implements HypervisorResource {
|
||||
private static final Logger LOGGER = Logger.getLogger(Ovm3HypervisorResource.class);
|
||||
@Inject
|
||||
private VirtualRoutingResource vrResource;
|
||||
private StorageSubsystemCommandHandler storageHandler;
|
||||
@ -127,12 +119,6 @@ public class Ovm3HypervisorResource extends ServerResourceBase implements
|
||||
private Ovm3VmGuestTypes guesttypes;
|
||||
private final OvmObject ovmObject = new OvmObject();
|
||||
|
||||
/*
|
||||
* TODO: Add a network map, so we know which tagged interfaces we can remove
|
||||
* and switch to ConcurrentHashMap
|
||||
*/
|
||||
private final Map<String, Xen.Vm> vmMap = new HashMap<String, Xen.Vm>();
|
||||
|
||||
@Override
|
||||
public Type getType() {
|
||||
return Type.Routing;
|
||||
@ -155,7 +141,7 @@ public class Ovm3HypervisorResource extends ServerResourceBase implements
|
||||
hypervisorsupport.fillHostInfo(srCmd);
|
||||
hypervisorsupport.vmStateMapClear();
|
||||
LOGGER.debug("Ovm3 pool " + ssCmd + " " + srCmd);
|
||||
return new StartupCommand[] { srCmd, ssCmd };
|
||||
return new StartupCommand[] {srCmd, ssCmd};
|
||||
} catch (Exception e) {
|
||||
LOGGER.debug("Ovm3 resource initializes failed", e);
|
||||
return new StartupCommand[] {};
|
||||
@ -172,26 +158,17 @@ public class Ovm3HypervisorResource extends ServerResourceBase implements
|
||||
if (pong.contains(ping)) {
|
||||
hypervisorsupport.syncState();
|
||||
CloudstackPlugin cSp = new CloudstackPlugin(c);
|
||||
if (!cSp.dom0CheckStorageHealthCheck(configuration .getAgentScriptsDir(),
|
||||
configuration.getAgentCheckStorageScript(),
|
||||
configuration.getCsHostGuid(),
|
||||
configuration.getAgentStorageCheckTimeout(),
|
||||
configuration.getAgentStorageCheckInterval())
|
||||
&& !cSp.dom0CheckStorageHealthCheck()) {
|
||||
LOGGER.error("Storage health check not running on "
|
||||
+ configuration.getAgentHostname());
|
||||
if (!cSp.dom0CheckStorageHealthCheck(configuration.getAgentScriptsDir(), configuration.getAgentCheckStorageScript(), configuration.getCsHostGuid(),
|
||||
configuration.getAgentStorageCheckTimeout(), configuration.getAgentStorageCheckInterval()) && !cSp.dom0CheckStorageHealthCheck()) {
|
||||
LOGGER.error("Storage health check not running on " + configuration.getAgentHostname());
|
||||
} else if (cSp.dom0CheckStorageHealthCheck()) {
|
||||
LOGGER.error("Storage health check started on "
|
||||
+ configuration.getAgentHostname());
|
||||
LOGGER.error("Storage health check started on " + configuration.getAgentHostname());
|
||||
} else {
|
||||
LOGGER.debug("Storage health check running on "
|
||||
+ configuration.getAgentHostname());
|
||||
LOGGER.debug("Storage health check running on " + configuration.getAgentHostname());
|
||||
}
|
||||
return new PingRoutingCommand(getType(), id,
|
||||
hypervisorsupport.hostVmStateReport());
|
||||
return new PingRoutingCommand(getType(), id, hypervisorsupport.hostVmStateReport());
|
||||
} else {
|
||||
LOGGER.debug("Agent did not respond correctly: " + ping
|
||||
+ " but got " + pong);
|
||||
LOGGER.debug("Agent did not respond correctly: " + ping + " but got " + pong);
|
||||
}
|
||||
|
||||
} catch (Ovm3ResourceException | NullPointerException e) {
|
||||
@ -206,86 +183,84 @@ public class Ovm3HypervisorResource extends ServerResourceBase implements
|
||||
Class<? extends Command> clazz = cmd.getClass();
|
||||
LOGGER.debug("executeRequest called: " + cmd.getClass());
|
||||
if (cmd instanceof NetworkElementCommand) {
|
||||
return vrResource.executeRequest((NetworkElementCommand) cmd);
|
||||
return vrResource.executeRequest((NetworkElementCommand)cmd);
|
||||
} else if (clazz == NetworkRulesSystemVmCommand.class) {
|
||||
return virtualroutingsupport
|
||||
.execute((NetworkRulesSystemVmCommand) cmd);
|
||||
return virtualroutingsupport.execute((NetworkRulesSystemVmCommand)cmd);
|
||||
} else if (clazz == CheckSshCommand.class) {
|
||||
return virtualroutingsupport.execute((CheckSshCommand) cmd);
|
||||
return virtualroutingsupport.execute((CheckSshCommand)cmd);
|
||||
} else if (clazz == NetworkUsageCommand.class) {
|
||||
return virtualroutingsupport.execute((NetworkUsageCommand) cmd);
|
||||
/* double check order! */
|
||||
return virtualroutingsupport.execute((NetworkUsageCommand)cmd);
|
||||
/* double check order! */
|
||||
} else if (clazz == CopyCommand.class) {
|
||||
return storageprocessor.execute((CopyCommand) cmd);
|
||||
return storageprocessor.execute((CopyCommand)cmd);
|
||||
} else if (cmd instanceof StorageSubSystemCommand) {
|
||||
return storageHandler.handleStorageCommands((StorageSubSystemCommand) cmd);
|
||||
return storageHandler.handleStorageCommands((StorageSubSystemCommand)cmd);
|
||||
} else if (clazz == DeleteCommand.class) {
|
||||
return storageprocessor.execute((DeleteCommand) cmd);
|
||||
return storageprocessor.execute((DeleteCommand)cmd);
|
||||
} else if (clazz == CreateCommand.class) {
|
||||
return storageprocessor.execute((CreateCommand) cmd);
|
||||
return storageprocessor.execute((CreateCommand)cmd);
|
||||
} else if (clazz == CreateObjectCommand.class) {
|
||||
return storageprocessor.execute((CreateObjectCommand) cmd);
|
||||
return storageprocessor.execute((CreateObjectCommand)cmd);
|
||||
} else if (clazz == AttachIsoCommand.class) {
|
||||
return storageprocessor.attachIso((AttachCommand) cmd);
|
||||
} else if (clazz == DettachCommand.class) {
|
||||
return storageprocessor.execute((DettachCommand) cmd);
|
||||
} else if (clazz == AttachCommand.class) {
|
||||
return storageprocessor.execute((AttachCommand) cmd);
|
||||
} else if (clazz == CreatePrivateTemplateFromVolumeCommand.class) {
|
||||
return storageprocessor
|
||||
.execute((CreatePrivateTemplateFromVolumeCommand) cmd);
|
||||
} else if (clazz == DestroyCommand.class) {
|
||||
return storageprocessor.execute((DestroyCommand) cmd);
|
||||
} else if (clazz == CopyVolumeCommand.class) {
|
||||
return storageprocessor.execute((CopyVolumeCommand) cmd);
|
||||
return storageprocessor.attachIso((AttachCommand)cmd);
|
||||
} else if (clazz == DettachCommand.class) {
|
||||
return storageprocessor.execute((DettachCommand)cmd);
|
||||
} else if (clazz == AttachCommand.class) {
|
||||
return storageprocessor.execute((AttachCommand)cmd);
|
||||
} else if (clazz == CreatePrivateTemplateFromVolumeCommand.class) {
|
||||
return storageprocessor.execute((CreatePrivateTemplateFromVolumeCommand)cmd);
|
||||
} else if (clazz == DestroyCommand.class) {
|
||||
return storageprocessor.execute((DestroyCommand)cmd);
|
||||
} else if (clazz == CopyVolumeCommand.class) {
|
||||
return storageprocessor.execute((CopyVolumeCommand)cmd);
|
||||
} else if (clazz == CreateStoragePoolCommand.class) {
|
||||
return storagepool.execute((CreateStoragePoolCommand) cmd);
|
||||
return storagepool.execute((CreateStoragePoolCommand)cmd);
|
||||
} else if (clazz == ModifyStoragePoolCommand.class) {
|
||||
return storagepool.execute((ModifyStoragePoolCommand) cmd);
|
||||
return storagepool.execute((ModifyStoragePoolCommand)cmd);
|
||||
} else if (clazz == PrimaryStorageDownloadCommand.class) {
|
||||
return storagepool.execute((PrimaryStorageDownloadCommand) cmd);
|
||||
return storagepool.execute((PrimaryStorageDownloadCommand)cmd);
|
||||
} else if (clazz == DeleteStoragePoolCommand.class) {
|
||||
return storagepool.execute((DeleteStoragePoolCommand) cmd);
|
||||
return storagepool.execute((DeleteStoragePoolCommand)cmd);
|
||||
} else if (clazz == GetStorageStatsCommand.class) {
|
||||
return storagepool.execute((GetStorageStatsCommand) cmd);
|
||||
return storagepool.execute((GetStorageStatsCommand)cmd);
|
||||
} else if (clazz == GetHostStatsCommand.class) {
|
||||
return hypervisorsupport.execute((GetHostStatsCommand) cmd);
|
||||
return hypervisorsupport.execute((GetHostStatsCommand)cmd);
|
||||
} else if (clazz == CheckVirtualMachineCommand.class) {
|
||||
return hypervisorsupport.execute((CheckVirtualMachineCommand) cmd);
|
||||
return hypervisorsupport.execute((CheckVirtualMachineCommand)cmd);
|
||||
} else if (clazz == MaintainCommand.class) {
|
||||
return hypervisorsupport.execute((MaintainCommand) cmd);
|
||||
return hypervisorsupport.execute((MaintainCommand)cmd);
|
||||
} else if (clazz == CheckHealthCommand.class) {
|
||||
return hypervisorsupport.execute((CheckHealthCommand) cmd);
|
||||
return hypervisorsupport.execute((CheckHealthCommand)cmd);
|
||||
} else if (clazz == ReadyCommand.class) {
|
||||
return hypervisorsupport.execute((ReadyCommand) cmd);
|
||||
return hypervisorsupport.execute((ReadyCommand)cmd);
|
||||
} else if (clazz == FenceCommand.class) {
|
||||
return hypervisorsupport.execute((FenceCommand) cmd);
|
||||
return hypervisorsupport.execute((FenceCommand)cmd);
|
||||
} else if (clazz == CheckOnHostCommand.class) {
|
||||
return hypervisorsupport.execute((CheckOnHostCommand)cmd);
|
||||
} else if (clazz == PingTestCommand.class) {
|
||||
return hypervisornetwork.execute((PingTestCommand) cmd);
|
||||
return hypervisornetwork.execute((PingTestCommand)cmd);
|
||||
} else if (clazz == CheckNetworkCommand.class) {
|
||||
return hypervisornetwork.execute((CheckNetworkCommand) cmd);
|
||||
return hypervisornetwork.execute((CheckNetworkCommand)cmd);
|
||||
} else if (clazz == GetVmStatsCommand.class) {
|
||||
return vmsupport.execute((GetVmStatsCommand) cmd);
|
||||
return vmsupport.execute((GetVmStatsCommand)cmd);
|
||||
} else if (clazz == PrepareForMigrationCommand.class) {
|
||||
return vmsupport.execute((PrepareForMigrationCommand) cmd);
|
||||
return vmsupport.execute((PrepareForMigrationCommand)cmd);
|
||||
} else if (clazz == MigrateCommand.class) {
|
||||
return vmsupport.execute((MigrateCommand) cmd);
|
||||
return vmsupport.execute((MigrateCommand)cmd);
|
||||
} else if (clazz == GetVncPortCommand.class) {
|
||||
return vmsupport.execute((GetVncPortCommand) cmd);
|
||||
return vmsupport.execute((GetVncPortCommand)cmd);
|
||||
} else if (clazz == PlugNicCommand.class) {
|
||||
return vmsupport.execute((PlugNicCommand) cmd);
|
||||
return vmsupport.execute((PlugNicCommand)cmd);
|
||||
} else if (clazz == UnPlugNicCommand.class) {
|
||||
return vmsupport.execute((UnPlugNicCommand) cmd);
|
||||
return vmsupport.execute((UnPlugNicCommand)cmd);
|
||||
} else if (clazz == StartCommand.class) {
|
||||
return execute((StartCommand) cmd);
|
||||
return execute((StartCommand)cmd);
|
||||
} else if (clazz == StopCommand.class) {
|
||||
return execute((StopCommand) cmd);
|
||||
return execute((StopCommand)cmd);
|
||||
} else if (clazz == RebootCommand.class) {
|
||||
return execute((RebootCommand) cmd);
|
||||
return execute((RebootCommand)cmd);
|
||||
}
|
||||
LOGGER.debug("Can't find class for executeRequest " + cmd.getClass() +", is your direct call missing?");
|
||||
LOGGER.debug("Can't find class for executeRequest " + cmd.getClass() + ", is your direct call missing?");
|
||||
return Answer.createUnsupportedCommandAnswer(cmd);
|
||||
}
|
||||
|
||||
@ -339,47 +314,38 @@ public class Ovm3HypervisorResource extends ServerResourceBase implements
|
||||
* Base configuration of the plugins components.
|
||||
*/
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params)
|
||||
throws ConfigurationException {
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
LOGGER.debug("configure " + name + " with params: " + params);
|
||||
/* check if we're master or not and if we can connect */
|
||||
try {
|
||||
configuration = new Ovm3Configuration(params);
|
||||
if (!configuration.getIsTest()) {
|
||||
c = new Connection(configuration.getAgentIp(),
|
||||
configuration.getAgentOvsAgentPort(),
|
||||
configuration.getAgentOvsAgentUser(),
|
||||
c = new Connection(configuration.getAgentIp(), configuration.getAgentOvsAgentPort(), configuration.getAgentOvsAgentUser(),
|
||||
configuration.getAgentOvsAgentPassword());
|
||||
c.setHostName(configuration.getAgentHostname());
|
||||
}
|
||||
hypervisorsupport = new Ovm3HypervisorSupport(c, configuration);
|
||||
if (!configuration.getIsTest()) {
|
||||
hypervisorsupport.setupServer(configuration
|
||||
.getAgentSshKeyFileName());
|
||||
hypervisorsupport.setupServer(configuration.getAgentSshKeyFileName());
|
||||
}
|
||||
hypervisorsupport.masterCheck();
|
||||
} catch (Exception e) {
|
||||
throw new CloudRuntimeException("Base checks failed for "
|
||||
+ configuration.getAgentHostname(), e);
|
||||
throw new CloudRuntimeException("Base checks failed for " + configuration.getAgentHostname(), e);
|
||||
}
|
||||
hypervisornetwork = new Ovm3HypervisorNetwork(c, configuration);
|
||||
hypervisornetwork.configureNetworking();
|
||||
virtualroutingresource = new Ovm3VirtualRoutingResource(c);
|
||||
storagepool = new Ovm3StoragePool(c, configuration);
|
||||
storagepool.prepareForPool();
|
||||
storageprocessor = new Ovm3StorageProcessor(c, configuration,
|
||||
storagepool);
|
||||
vmsupport = new Ovm3VmSupport(c, configuration, hypervisorsupport,
|
||||
storageprocessor, storagepool, hypervisornetwork);
|
||||
storageprocessor = new Ovm3StorageProcessor(c, configuration, storagepool);
|
||||
vmsupport = new Ovm3VmSupport(c, configuration, hypervisorsupport, storageprocessor, storagepool, hypervisornetwork);
|
||||
vrResource = new VirtualRoutingResource(virtualroutingresource);
|
||||
if (!vrResource.configure(name, params)) {
|
||||
throw new ConfigurationException(
|
||||
"Unable to configure VirtualRoutingResource");
|
||||
throw new ConfigurationException("Unable to configure VirtualRoutingResource");
|
||||
}
|
||||
guesttypes = new Ovm3VmGuestTypes();
|
||||
storageHandler = new StorageSubsystemCommandHandlerBase(storageprocessor);
|
||||
virtualroutingsupport = new Ovm3VirtualRoutingSupport(c, configuration,
|
||||
virtualroutingresource);
|
||||
virtualroutingsupport = new Ovm3VirtualRoutingSupport(c, configuration, virtualroutingresource);
|
||||
setConfigParams(params);
|
||||
return true;
|
||||
}
|
||||
@ -413,8 +379,7 @@ public class Ovm3HypervisorResource extends ServerResourceBase implements
|
||||
vm.setVmCpus(vmSpec.getCpus());
|
||||
/* in mb not in bytes */
|
||||
vm.setVmMemory(vmSpec.getMinRam() / 1024 / 1024);
|
||||
vm.setVmUuid(UUID.nameUUIDFromBytes(vmSpec.getName().
|
||||
getBytes(Charset.defaultCharset())).toString());
|
||||
vm.setVmUuid(UUID.nameUUIDFromBytes(vmSpec.getName().getBytes(Charset.defaultCharset())).toString());
|
||||
vm.setVmName(vmName);
|
||||
|
||||
String domType = guesttypes.getOvm3GuestType(vmSpec.getOs());
|
||||
@ -422,8 +387,7 @@ public class Ovm3HypervisorResource extends ServerResourceBase implements
|
||||
domType = "default";
|
||||
LOGGER.debug("VM Virt type missing setting to: " + domType);
|
||||
} else {
|
||||
LOGGER.debug("VM Virt type set to " + domType + " for "
|
||||
+ vmSpec.getOs());
|
||||
LOGGER.debug("VM Virt type set to " + domType + " for " + vmSpec.getOs());
|
||||
}
|
||||
vm.setVmDomainType(domType);
|
||||
|
||||
@ -440,10 +404,8 @@ public class Ovm3HypervisorResource extends ServerResourceBase implements
|
||||
// double check control network if we run a non user VM
|
||||
hypervisornetwork.configureNetworking();
|
||||
vm.setVmExtra(vmSpec.getBootArgs().replace(" ", "%"));
|
||||
String svmPath = configuration.getAgentOvmRepoPath() + "/"
|
||||
+ ovmObject.deDash(vm.getPrimaryPoolUuid()) + "/ISOs";
|
||||
String svmIso = svmPath + "/"
|
||||
+ storagepool.getSystemVMPatchIsoFile().getName();
|
||||
String svmPath = configuration.getAgentOvmRepoPath() + "/" + ovmObject.deDash(vm.getPrimaryPoolUuid()) + "/ISOs";
|
||||
String svmIso = svmPath + "/" + storagepool.getSystemVMPatchIsoFile().getName();
|
||||
vm.addIso(svmIso);
|
||||
}
|
||||
/* OVS/Network stuff should go here! */
|
||||
@ -451,10 +413,8 @@ public class Ovm3HypervisorResource extends ServerResourceBase implements
|
||||
vm.setupVifs();
|
||||
|
||||
vm.setVnc("0.0.0.0", vmSpec.getVncPassword());
|
||||
xen.createVm(ovmObject.deDash(vm.getPrimaryPoolUuid()),
|
||||
vm.getVmUuid());
|
||||
xen.startVm(ovmObject.deDash(vm.getPrimaryPoolUuid()),
|
||||
vm.getVmUuid());
|
||||
xen.createVm(ovmObject.deDash(vm.getPrimaryPoolUuid()), vm.getVmUuid());
|
||||
xen.startVm(ovmObject.deDash(vm.getPrimaryPoolUuid()), vm.getVmUuid());
|
||||
state = State.Running;
|
||||
|
||||
if (vmSpec.getType() != VirtualMachine.Type.User) {
|
||||
@ -469,9 +429,7 @@ public class Ovm3HypervisorResource extends ServerResourceBase implements
|
||||
CloudstackPlugin cSp = new CloudstackPlugin(c);
|
||||
/* skip a beat to make sure we didn't miss start */
|
||||
if (hypervisorsupport.getVmState(vmName) == null && count > 1) {
|
||||
String msg = "VM " + vmName + " went missing on "
|
||||
+ configuration.getAgentHostname()
|
||||
+ ", returning stopped";
|
||||
String msg = "VM " + vmName + " went missing on " + configuration.getAgentHostname() + ", returning stopped";
|
||||
LOGGER.debug(msg);
|
||||
state = State.Stopped;
|
||||
return new StartAnswer(cmd, msg);
|
||||
@ -479,16 +437,12 @@ public class Ovm3HypervisorResource extends ServerResourceBase implements
|
||||
/* creative fix? */
|
||||
try {
|
||||
Boolean res = cSp.domrCheckSsh(controlIp);
|
||||
LOGGER.debug("connected to " + controlIp
|
||||
+ " on attempt " + count + " result: " + res);
|
||||
LOGGER.debug("connected to " + controlIp + " on attempt " + count + " result: " + res);
|
||||
if (res) {
|
||||
break;
|
||||
}
|
||||
} catch (Exception x) {
|
||||
LOGGER.trace(
|
||||
"unable to connect to " + controlIp
|
||||
+ " on attempt " + count + " "
|
||||
+ x.getMessage(), x);
|
||||
LOGGER.trace("unable to connect to " + controlIp + " on attempt " + count + " " + x.getMessage(), x);
|
||||
}
|
||||
Thread.sleep(5000);
|
||||
}
|
||||
@ -496,10 +450,8 @@ public class Ovm3HypervisorResource extends ServerResourceBase implements
|
||||
/*
|
||||
* Can't remember if HA worked if we were only a pool ?
|
||||
*/
|
||||
if (configuration.getAgentInOvm3Pool()
|
||||
&& configuration.getAgentInOvm3Cluster()) {
|
||||
xen.configureVmHa(ovmObject.deDash(vm.getPrimaryPoolUuid()),
|
||||
vm.getVmUuid(), true);
|
||||
if (configuration.getAgentInOvm3Pool() && configuration.getAgentInOvm3Cluster()) {
|
||||
xen.configureVmHa(ovmObject.deDash(vm.getPrimaryPoolUuid()), vm.getVmUuid(), true);
|
||||
}
|
||||
/* should be starting no ? */
|
||||
state = State.Running;
|
||||
@ -529,8 +481,7 @@ public class Ovm3HypervisorResource extends ServerResourceBase implements
|
||||
|
||||
if (vm == null) {
|
||||
state = State.Stopping;
|
||||
LOGGER.debug("Unable to get details of vm: " + vmName
|
||||
+ ", treating it as Stopping");
|
||||
LOGGER.debug("Unable to get details of vm: " + vmName + ", treating it as Stopping");
|
||||
return new StopAnswer(cmd, "success", true);
|
||||
}
|
||||
String repoId = ovmObject.deDash(vm.getVmRootDiskPoolId());
|
||||
@ -576,8 +527,7 @@ public class Ovm3HypervisorResource extends ServerResourceBase implements
|
||||
if (vm == null) {
|
||||
return new RebootAnswer(cmd, vmName + " not present", false);
|
||||
}
|
||||
xen.rebootVm(ovmObject.deDash(vm.getVmRootDiskPoolId()),
|
||||
vm.getVmUuid());
|
||||
xen.rebootVm(ovmObject.deDash(vm.getVmRootDiskPoolId()), vm.getVmUuid());
|
||||
vm = xen.getRunningVmConfig(vmName);
|
||||
Integer vncPort = vm.getVncPort();
|
||||
return new RebootAnswer(cmd, null, vncPort);
|
||||
|
||||
@ -17,11 +17,8 @@
|
||||
|
||||
package com.cloud.hypervisor.ovm3.resources;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import com.cloud.agent.api.SetupGuestNetworkCommand;
|
||||
import com.cloud.agent.api.routing.IpAssocCommand;
|
||||
@ -36,7 +33,6 @@ import com.cloud.hypervisor.ovm3.objects.Connection;
|
||||
import com.cloud.hypervisor.ovm3.objects.Xen;
|
||||
import com.cloud.utils.ExecutionResult;
|
||||
|
||||
@Local(value = VirtualRouterDeployer.class)
|
||||
public class Ovm3VirtualRoutingResource implements VirtualRouterDeployer {
|
||||
private final Logger logger = Logger
|
||||
.getLogger(Ovm3VirtualRoutingResource.class);
|
||||
|
||||
@ -26,12 +26,9 @@ import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.AddUcsManagerCmd;
|
||||
import org.apache.cloudstack.api.AssociateUcsProfileToBladeCmd;
|
||||
import org.apache.cloudstack.api.DeleteUcsManagerCmd;
|
||||
@ -44,6 +41,7 @@ import org.apache.cloudstack.api.response.UcsManagerResponse;
|
||||
import org.apache.cloudstack.api.response.UcsProfileResponse;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.managed.context.ManagedContextRunnable;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.dc.ClusterDetailsDao;
|
||||
@ -68,7 +66,6 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.xmlobject.XmlObject;
|
||||
import com.cloud.utils.xmlobject.XmlObjectParser;
|
||||
|
||||
@Local(value = {UcsManager.class})
|
||||
public class UcsManagerImpl implements UcsManager {
|
||||
public static final Logger s_logger = Logger.getLogger(UcsManagerImpl.class);
|
||||
public static final Long COOKIE_TTL = TimeUnit.MILLISECONDS.convert(100L, TimeUnit.MINUTES);
|
||||
|
||||
@ -16,18 +16,14 @@
|
||||
// under the License.
|
||||
package com.cloud.hypervisor.xenserver.resource;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.xensource.xenapi.Connection;
|
||||
import com.xensource.xenapi.Host;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
import com.xensource.xenapi.VM;
|
||||
|
||||
@Local(value = ServerResource.class)
|
||||
public class XcpServerResource extends CitrixResourceBase {
|
||||
|
||||
private final static Logger s_logger = Logger.getLogger(XcpServerResource.class);
|
||||
|
||||
@ -18,16 +18,12 @@ package com.cloud.hypervisor.xenserver.resource;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.xensource.xenapi.Connection;
|
||||
import com.xensource.xenapi.Host;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
@Local(value = ServerResource.class)
|
||||
public class XenServer56FP1Resource extends XenServer56Resource {
|
||||
|
||||
@Override
|
||||
|
||||
@ -16,12 +16,9 @@
|
||||
// under the License.
|
||||
package com.cloud.hypervisor.xenserver.resource;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.api.StartupCommand;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.ssh.SSHCmdHelper;
|
||||
import com.xensource.xenapi.Connection;
|
||||
@ -31,7 +28,6 @@ import com.xensource.xenapi.PIF;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
import com.xensource.xenapi.VLAN;
|
||||
|
||||
@Local(value = ServerResource.class)
|
||||
public class XenServer56Resource extends CitrixResourceBase {
|
||||
private final static Logger s_logger = Logger.getLogger(XenServer56Resource.class);
|
||||
|
||||
|
||||
@ -16,11 +16,6 @@
|
||||
// under the License.
|
||||
package com.cloud.hypervisor.xenserver.resource;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.resource.ServerResource;
|
||||
|
||||
@Local(value = ServerResource.class)
|
||||
public class XenServer56SP2Resource extends XenServer56FP1Resource {
|
||||
|
||||
public XenServer56SP2Resource() {
|
||||
|
||||
@ -16,11 +16,6 @@
|
||||
// under the License.
|
||||
package com.cloud.hypervisor.xenserver.resource;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.resource.ServerResource;
|
||||
|
||||
@Local(value = ServerResource.class)
|
||||
public class XenServer600Resource extends XenServer56SP2Resource {
|
||||
|
||||
@Override
|
||||
|
||||
@ -22,14 +22,11 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.apache.cloudstack.storage.to.VolumeObjectTO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
import com.cloud.agent.api.to.DiskTO;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.xensource.xenapi.Connection;
|
||||
@ -40,7 +37,6 @@ import com.xensource.xenapi.VDI;
|
||||
import com.xensource.xenapi.VIF;
|
||||
import com.xensource.xenapi.VM;
|
||||
|
||||
@Local(value = ServerResource.class)
|
||||
public class XenServer610Resource extends XenServer600Resource {
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(XenServer610Resource.class);
|
||||
|
||||
@ -18,19 +18,15 @@ package com.cloud.hypervisor.xenserver.resource;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.apache.cloudstack.hypervisor.xenserver.XenserverConfigs;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.api.StartupRoutingCommand;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.xensource.xenapi.Connection;
|
||||
import com.xensource.xenapi.Host;
|
||||
import com.xensource.xenapi.HostPatch;
|
||||
import com.xensource.xenapi.PoolPatch;
|
||||
|
||||
@Local(value = ServerResource.class)
|
||||
public class XenServer620Resource extends XenServer610Resource {
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(XenServer620Resource.class);
|
||||
|
||||
@ -23,8 +23,6 @@ import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
@ -32,7 +30,6 @@ import com.cloud.agent.api.StartCommand;
|
||||
import com.cloud.agent.api.StartupRoutingCommand;
|
||||
import com.cloud.agent.api.VgpuTypesInfo;
|
||||
import com.cloud.agent.api.to.GPUDeviceTO;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.xensource.xenapi.Connection;
|
||||
import com.xensource.xenapi.GPUGroup;
|
||||
import com.xensource.xenapi.Host;
|
||||
@ -43,7 +40,6 @@ import com.xensource.xenapi.VGPUType;
|
||||
import com.xensource.xenapi.VGPUType.Record;
|
||||
import com.xensource.xenapi.VM;
|
||||
|
||||
@Local(value=ServerResource.class)
|
||||
public class XenServer620SP1Resource extends XenServer620Resource {
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(XenServer620SP1Resource.class);
|
||||
|
||||
@ -18,11 +18,6 @@
|
||||
*/
|
||||
package com.cloud.hypervisor.xenserver.resource;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.resource.ServerResource;
|
||||
|
||||
@Local(value=ServerResource.class)
|
||||
public class XenServer650Resource extends Xenserver625Resource {
|
||||
|
||||
@Override
|
||||
|
||||
@ -18,13 +18,10 @@
|
||||
*/
|
||||
package com.cloud.hypervisor.xenserver.resource;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.apache.cloudstack.hypervisor.xenserver.XenServerResourceNewBase;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.storage.resource.StorageSubsystemCommandHandler;
|
||||
import com.cloud.storage.resource.StorageSubsystemCommandHandlerBase;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
@ -34,7 +31,6 @@ import com.xensource.xenapi.Host;
|
||||
import com.xensource.xenapi.Types;
|
||||
import com.xensource.xenapi.VM;
|
||||
|
||||
@Local(value=ServerResource.class)
|
||||
public class Xenserver625Resource extends XenServerResourceNewBase {
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(Xenserver625Resource.class);
|
||||
|
||||
@ -24,12 +24,8 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import net.juniper.contrail.api.ApiConnector;
|
||||
import net.juniper.contrail.api.types.ServiceInstance;
|
||||
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.network.contrail.api.response.ServiceInstanceResponse;
|
||||
import org.apache.cloudstack.network.contrail.model.ServiceInstanceModel;
|
||||
@ -63,7 +59,9 @@ import com.cloud.vm.VirtualMachineName;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
@Local(value = {ServiceManager.class})
|
||||
import net.juniper.contrail.api.ApiConnector;
|
||||
import net.juniper.contrail.api.types.ServiceInstance;
|
||||
|
||||
public class ServiceManagerImpl implements ServiceManager {
|
||||
private static final Logger s_logger = Logger.getLogger(ServiceManager.class);
|
||||
|
||||
|
||||
@ -23,16 +23,14 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.api.Answer;
|
||||
@ -96,7 +94,6 @@ import com.cloud.vm.dao.DomainRouterDao;
|
||||
import com.cloud.vm.dao.NicDao;
|
||||
import com.cloud.vm.dao.VMInstanceDao;
|
||||
|
||||
@Local(value = {NetScalerVMManager.class})
|
||||
public class NetScalerVMManagerImpl extends ManagerBase implements NetScalerVMManager, VirtualMachineGuru {
|
||||
private static final Logger s_logger = Logger.getLogger(NetScalerVMManagerImpl.class);
|
||||
static final private String NetScalerLbVmNamePrefix = "NS";
|
||||
|
||||
@ -20,18 +20,10 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.NamingException;
|
||||
import javax.naming.ldap.LdapContext;
|
||||
|
||||
import org.apache.cloudstack.api.command.LinkDomainToLdapCmd;
|
||||
import org.apache.cloudstack.api.response.LinkDomainToLdapResponse;
|
||||
import org.apache.cloudstack.ldap.dao.LdapTrustMapDao;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.api.LdapValidator;
|
||||
import org.apache.cloudstack.api.command.LDAPConfigCmd;
|
||||
import org.apache.cloudstack.api.command.LDAPRemoveCmd;
|
||||
@ -42,15 +34,20 @@ import org.apache.cloudstack.api.command.LdapImportUsersCmd;
|
||||
import org.apache.cloudstack.api.command.LdapListConfigurationCmd;
|
||||
import org.apache.cloudstack.api.command.LdapListUsersCmd;
|
||||
import org.apache.cloudstack.api.command.LdapUserSearchCmd;
|
||||
import org.apache.cloudstack.api.command.LinkDomainToLdapCmd;
|
||||
import org.apache.cloudstack.api.response.LdapConfigurationResponse;
|
||||
import org.apache.cloudstack.api.response.LdapUserResponse;
|
||||
import org.apache.cloudstack.api.response.LinkDomainToLdapResponse;
|
||||
import org.apache.cloudstack.ldap.dao.LdapConfigurationDao;
|
||||
import org.apache.cloudstack.ldap.dao.LdapTrustMapDao;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
@Component
|
||||
@Local(value = LdapManager.class)
|
||||
public class LdapManagerImpl implements LdapManager, LdapValidator {
|
||||
private static final Logger s_logger = Logger.getLogger(LdapManagerImpl.class.getName());
|
||||
|
||||
|
||||
7
pom.xml
7
pom.xml
@ -56,7 +56,7 @@
|
||||
<cs.configuration.version>1.10</cs.configuration.version>
|
||||
<cs.logging.version>1.1.1</cs.logging.version>
|
||||
<cs.discovery.version>0.5</cs.discovery.version>
|
||||
<cs.ejb.version>3.0</cs.ejb.version>
|
||||
|
||||
<!-- do not forget to also upgrade hamcrest library with junit -->
|
||||
<cs.junit.version>4.12</cs.junit.version>
|
||||
<cs.hamcrest.version>1.3</cs.hamcrest.version>
|
||||
@ -342,11 +342,6 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.ejb</groupId>
|
||||
<artifactId>ejb-api</artifactId>
|
||||
<version>${cs.ejb.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.java-ipv6</groupId>
|
||||
<artifactId>java-ipv6</artifactId>
|
||||
|
||||
@ -1581,9 +1581,6 @@
|
||||
<Component Id="cmp9FAD7DAD071299E1AAF045F54DE9F495" Guid="{73188CEE-DB1A-48F0-AF78-A37662859327}">
|
||||
<File Id="filF642ECE1D8F64EBCECFA04A5600BF8E3" KeyPath="yes" Source="!(wix.SourceClient)\WEB-INF\lib\ehcache-core-2.6.6.jar" />
|
||||
</Component>
|
||||
<Component Id="cmp89F65AB47003394DE45F2F27D9992C86" Guid="{A523C269-1E43-4512-BDC1-48D76556443C}">
|
||||
<File Id="fil15FE2F49ABA53F783D33C935E0703143" KeyPath="yes" Source="!(wix.SourceClient)\WEB-INF\lib\ejb-api-3.0.jar" />
|
||||
</Component>
|
||||
<Component Id="cmp0C3372A952450A4EED8FDCC1B8EAF4A3" Guid="{D0DA328A-0956-4341-9D5D-CEAF84470F46}">
|
||||
<File Id="filD619AEE8A024E5F335662217E6852A4C" KeyPath="yes" Source="!(wix.SourceClient)\WEB-INF\lib\esapi-2.0.1.jar" />
|
||||
</Component>
|
||||
|
||||
@ -25,18 +25,12 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import com.cloud.configuration.Config;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.network.lb.LoadBalancingRule;
|
||||
import com.cloud.network.rules.LbStickinessMethod;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.cloud.network.router.deployment.RouterDeploymentDefinition;
|
||||
|
||||
@ -45,6 +39,7 @@ import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.to.NicTO;
|
||||
import com.cloud.agent.manager.Commands;
|
||||
import com.cloud.alert.AlertManager;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.Pod;
|
||||
@ -58,6 +53,7 @@ import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.InsufficientServerCapacityException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.OperationTimedoutException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
@ -75,8 +71,10 @@ import com.cloud.network.addr.PublicIp;
|
||||
import com.cloud.network.dao.IPAddressDao;
|
||||
import com.cloud.network.dao.NetworkDao;
|
||||
import com.cloud.network.dao.UserIpv6AddressDao;
|
||||
import com.cloud.network.lb.LoadBalancingRule;
|
||||
import com.cloud.network.router.VirtualRouter.RedundantState;
|
||||
import com.cloud.network.router.VirtualRouter.Role;
|
||||
import com.cloud.network.rules.LbStickinessMethod;
|
||||
import com.cloud.network.vpn.Site2SiteVpnManager;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.resource.ResourceManager;
|
||||
@ -92,6 +90,7 @@ import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.user.UserVO;
|
||||
import com.cloud.user.dao.UserDao;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
import com.cloud.vm.DomainRouterVO;
|
||||
@ -105,7 +104,6 @@ import com.cloud.vm.VirtualMachineProfile.Param;
|
||||
import com.cloud.vm.dao.DomainRouterDao;
|
||||
import com.cloud.vm.dao.NicDao;
|
||||
|
||||
@Local(value = { NetworkHelper.class })
|
||||
public class NetworkHelperImpl implements NetworkHelper {
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(NetworkHelperImpl.class);
|
||||
@ -779,6 +777,7 @@ public class NetworkHelperImpl implements NetworkHelper {
|
||||
public static void setVMInstanceName(final String vmInstanceName) {
|
||||
s_vmInstanceName = vmInstanceName;
|
||||
}
|
||||
@Override
|
||||
public boolean validateHAProxyLBRule(final LoadBalancingRule rule) {
|
||||
final String timeEndChar = "dhms";
|
||||
int haproxy_stats_port = Integer.parseInt(_configDao.getValue(Config.NetworkLBHaproxyStatsPort.key()));
|
||||
|
||||
@ -19,7 +19,6 @@ package com.cloud.network.router;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.cloud.network.router.deployment.RouterDeploymentDefinition;
|
||||
@ -43,7 +42,6 @@ import com.cloud.vm.dao.NicDao;
|
||||
import com.cloud.vm.dao.VMInstanceDao;
|
||||
|
||||
|
||||
@Local(value = {NicProfileHelper.class})
|
||||
public class NicProfileHelperImpl implements NicProfileHelper {
|
||||
|
||||
@Inject
|
||||
|
||||
@ -27,7 +27,6 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
@ -35,7 +34,6 @@ import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.ejb.ConcurrentAccessException;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
@ -61,7 +59,6 @@ import com.cloud.agent.api.SecurityGroupRulesCmd;
|
||||
import com.cloud.agent.api.SecurityGroupRulesCmd.IpPortAndProto;
|
||||
import com.cloud.agent.manager.Commands;
|
||||
import com.cloud.api.query.dao.SecurityGroupJoinDao;
|
||||
import com.cloud.api.query.vo.SecurityGroupJoinVO;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.domain.dao.DomainDao;
|
||||
import com.cloud.event.ActionEvent;
|
||||
@ -95,7 +92,6 @@ import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.utils.concurrency.NamedThreadFactory;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.Filter;
|
||||
import com.cloud.utils.db.GlobalLock;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.db.TransactionCallback;
|
||||
@ -197,7 +193,7 @@ public class SecurityGroupManagerImpl extends ManagerBase implements SecurityGro
|
||||
try {
|
||||
work();
|
||||
} catch (Throwable th) {
|
||||
s_logger.error("Problem with SG work", th);
|
||||
s_logger.error("Problem with SG work", th);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -372,8 +368,9 @@ public class SecurityGroupManagerImpl extends ManagerBase implements SecurityGro
|
||||
}
|
||||
|
||||
public void handleVmStarted(VMInstanceVO vm) {
|
||||
if (vm.getType() != VirtualMachine.Type.User || !isVmSecurityGroupEnabled(vm.getId()))
|
||||
if (vm.getType() != VirtualMachine.Type.User || !isVmSecurityGroupEnabled(vm.getId())) {
|
||||
return;
|
||||
}
|
||||
List<Long> affectedVms = getAffectedVmsForVmStart(vm);
|
||||
scheduleRulesetUpdateToHosts(affectedVms, true, null);
|
||||
}
|
||||
@ -437,7 +434,6 @@ public class SecurityGroupManagerImpl extends ManagerBase implements SecurityGro
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for (Long vmId : affectedVms) {
|
||||
_executorPool.schedule(new WorkerThread(), delayMs, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
@ -504,7 +500,7 @@ public class SecurityGroupManagerImpl extends ManagerBase implements SecurityGro
|
||||
Set<String> cidrs = ingressRules.get(pAp);
|
||||
if (cidrs.size() > 0) {
|
||||
IpPortAndProto ipPortAndProto = new SecurityGroupRulesCmd.IpPortAndProto(pAp.getProto(), pAp.getStartPort(), pAp.getEndPort(), cidrs.toArray(new String[cidrs
|
||||
.size()]));
|
||||
.size()]));
|
||||
ingressResult.add(ipPortAndProto);
|
||||
}
|
||||
}
|
||||
@ -512,7 +508,7 @@ public class SecurityGroupManagerImpl extends ManagerBase implements SecurityGro
|
||||
Set<String> cidrs = egressRules.get(pAp);
|
||||
if (cidrs.size() > 0) {
|
||||
IpPortAndProto ipPortAndProto = new SecurityGroupRulesCmd.IpPortAndProto(pAp.getProto(), pAp.getStartPort(), pAp.getEndPort(), cidrs.toArray(new String[cidrs
|
||||
.size()]));
|
||||
.size()]));
|
||||
egressResult.add(ipPortAndProto);
|
||||
}
|
||||
}
|
||||
@ -521,15 +517,17 @@ public class SecurityGroupManagerImpl extends ManagerBase implements SecurityGro
|
||||
}
|
||||
|
||||
protected void handleVmStopped(VMInstanceVO vm) {
|
||||
if (vm.getType() != VirtualMachine.Type.User || !isVmSecurityGroupEnabled(vm.getId()))
|
||||
if (vm.getType() != VirtualMachine.Type.User || !isVmSecurityGroupEnabled(vm.getId())) {
|
||||
return;
|
||||
}
|
||||
List<Long> affectedVms = getAffectedVmsForVmStop(vm);
|
||||
scheduleRulesetUpdateToHosts(affectedVms, true, null);
|
||||
}
|
||||
|
||||
protected void handleVmMigrated(VMInstanceVO vm) {
|
||||
if (!isVmSecurityGroupEnabled(vm.getId()))
|
||||
if (!isVmSecurityGroupEnabled(vm.getId())) {
|
||||
return;
|
||||
}
|
||||
if (vm.getType() != VirtualMachine.Type.User) {
|
||||
Commands cmds = null;
|
||||
NetworkRulesSystemVmCommand nrc = new NetworkRulesSystemVmCommand(vm.getInstanceName(), vm.getType());
|
||||
@ -726,7 +724,7 @@ public class SecurityGroupManagerImpl extends ManagerBase implements SecurityGro
|
||||
final SecurityGroupVO tmpGrp = _securityGroupDao.lockRow(ngId, false);
|
||||
if (tmpGrp == null) {
|
||||
s_logger.warn("Failed to acquire lock on security group: " + ngId);
|
||||
throw new ConcurrentAccessException("Failed to acquire lock on security group: " + ngId);
|
||||
throw new CloudRuntimeException("Failed to acquire lock on security group: " + ngId);
|
||||
}
|
||||
}
|
||||
SecurityGroupRuleVO securityGroupRule = _securityGroupRuleDao.findByProtoPortsAndAllowedGroupId(securityGroup.getId(), protocolFinal, startPortOrTypeFinal,
|
||||
@ -1001,7 +999,6 @@ public class SecurityGroupManagerImpl extends ManagerBase implements SecurityGro
|
||||
if (nic != null) {
|
||||
if (nic.getSecondaryIp()) {
|
||||
//get secondary ips of the vm
|
||||
long networkId = nic.getNetworkId();
|
||||
nicSecIps = _nicSecIpDao.getSecondaryIpAddressesForNic(nic.getId());
|
||||
}
|
||||
}
|
||||
@ -1144,24 +1141,6 @@ public class SecurityGroupManagerImpl extends ManagerBase implements SecurityGro
|
||||
|
||||
}
|
||||
|
||||
private Pair<List<SecurityGroupJoinVO>, Integer> listSecurityGroupRulesByVM(long vmId, long pageInd, long pageSize) {
|
||||
Filter sf = new Filter(SecurityGroupVMMapVO.class, null, true, pageInd, pageSize);
|
||||
Pair<List<SecurityGroupVMMapVO>, Integer> sgVmMappingPair = _securityGroupVMMapDao.listByInstanceId(vmId, sf);
|
||||
Integer count = sgVmMappingPair.second();
|
||||
if (count.intValue() == 0) {
|
||||
// handle empty result cases
|
||||
return new Pair<List<SecurityGroupJoinVO>, Integer>(new ArrayList<SecurityGroupJoinVO>(), count);
|
||||
}
|
||||
List<SecurityGroupVMMapVO> sgVmMappings = sgVmMappingPair.first();
|
||||
Long[] sgIds = new Long[sgVmMappings.size()];
|
||||
int i = 0;
|
||||
for (SecurityGroupVMMapVO sgVm : sgVmMappings) {
|
||||
sgIds[i++] = sgVm.getSecurityGroupId();
|
||||
}
|
||||
List<SecurityGroupJoinVO> sgs = _securityGroupJoinDao.searchByIds(sgIds);
|
||||
return new Pair<List<SecurityGroupJoinVO>, Integer>(sgs, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fullSync(long agentId, HashMap<String, Pair<Long, Long>> newGroupStates) {
|
||||
ArrayList<Long> affectedVms = new ArrayList<Long>();
|
||||
@ -1207,20 +1186,6 @@ public class SecurityGroupManagerImpl extends ManagerBase implements SecurityGro
|
||||
}
|
||||
}
|
||||
|
||||
private void processScheduledWork() {
|
||||
List<SecurityGroupWorkVO> scheduled = _workDao.findScheduledWork();
|
||||
int numJobs = scheduled.size();
|
||||
if (numJobs > 0) {
|
||||
s_logger.debug("Security group work: found scheduled jobs " + numJobs);
|
||||
Random rand = new Random();
|
||||
for (int i = 0; i < numJobs; i++) {
|
||||
long delayMs = 100 + 10 * rand.nextInt(numJobs);
|
||||
_executorPool.schedule(new WorkerThread(), delayMs, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSecurityGroupsNamesForVm(long vmId) {
|
||||
try {
|
||||
@ -1272,34 +1237,34 @@ public class SecurityGroupManagerImpl extends ManagerBase implements SecurityGro
|
||||
|
||||
@Override
|
||||
public boolean postStateTransitionEvent(StateMachine2.Transition<State, Event> transition, VirtualMachine vm, boolean status, Object opaque) {
|
||||
if (!status) {
|
||||
return false;
|
||||
}
|
||||
if (!status) {
|
||||
return false;
|
||||
}
|
||||
|
||||
State oldState = transition.getCurrentState();
|
||||
State newState = transition.getToState();
|
||||
Event event = transition.getEvent();
|
||||
if (VirtualMachine.State.isVmStarted(oldState, event, newState)) {
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("Security Group Mgr: handling start of vm id" + vm.getId());
|
||||
State oldState = transition.getCurrentState();
|
||||
State newState = transition.getToState();
|
||||
Event event = transition.getEvent();
|
||||
if (VirtualMachine.State.isVmStarted(oldState, event, newState)) {
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("Security Group Mgr: handling start of vm id" + vm.getId());
|
||||
}
|
||||
handleVmStarted((VMInstanceVO)vm);
|
||||
} else if (VirtualMachine.State.isVmStopped(oldState, event, newState)) {
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("Security Group Mgr: handling stop of vm id" + vm.getId());
|
||||
}
|
||||
handleVmStopped((VMInstanceVO)vm);
|
||||
} else if (VirtualMachine.State.isVmMigrated(oldState, event, newState)) {
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("Security Group Mgr: handling migration of vm id" + vm.getId());
|
||||
}
|
||||
handleVmMigrated((VMInstanceVO)vm);
|
||||
}
|
||||
handleVmStarted((VMInstanceVO)vm);
|
||||
} else if (VirtualMachine.State.isVmStopped(oldState, event, newState)) {
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("Security Group Mgr: handling stop of vm id" + vm.getId());
|
||||
}
|
||||
handleVmStopped((VMInstanceVO)vm);
|
||||
} else if (VirtualMachine.State.isVmMigrated(oldState, event, newState)) {
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("Security Group Mgr: handling migration of vm id" + vm.getId());
|
||||
}
|
||||
handleVmMigrated((VMInstanceVO)vm);
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean isVmSecurityGroupEnabled(Long vmId) {
|
||||
VirtualMachine vm = _vmDao.findByIdIncludingRemoved(vmId);
|
||||
List<NicProfile> nics = _networkMgr.getNicProfiles(vm);
|
||||
|
||||
@ -26,24 +26,22 @@ import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.Configurable;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.Configurable;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.managed.context.ManagedContextRunnable;
|
||||
import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO;
|
||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.alert.AlertManager;
|
||||
import com.cloud.configuration.Config;
|
||||
@ -109,7 +107,6 @@ import com.cloud.vm.dao.UserVmDao;
|
||||
import com.cloud.vm.dao.VMInstanceDao;
|
||||
|
||||
@Component
|
||||
@Local(value = {ResourceLimitService.class})
|
||||
public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLimitService, Configurable{
|
||||
public static final Logger s_logger = Logger.getLogger(ResourceLimitManagerImpl.class);
|
||||
|
||||
@ -876,8 +873,9 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim
|
||||
|
||||
ResourceCountVO accountRC = _resourceCountDao.findByOwnerAndType(accountId, ResourceOwnerType.Account, type);
|
||||
long oldCount = 0;
|
||||
if (accountRC != null)
|
||||
if (accountRC != null) {
|
||||
oldCount = accountRC.getCount();
|
||||
}
|
||||
|
||||
if (type == Resource.ResourceType.user_vm) {
|
||||
newCount = _userVmDao.countAllocatedVMsForAccount(accountId);
|
||||
@ -1007,10 +1005,11 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim
|
||||
dedicatedCount += new Long(ips.size());
|
||||
}
|
||||
allocatedCount = _ipAddressDao.countAllocatedIPsForAccount(accountId);
|
||||
if (dedicatedCount > allocatedCount)
|
||||
if (dedicatedCount > allocatedCount) {
|
||||
return dedicatedCount;
|
||||
else
|
||||
} else {
|
||||
return allocatedCount;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1053,8 +1052,9 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim
|
||||
public void changeResourceCount(long accountId, ResourceType type, Boolean displayResource, Long... delta) {
|
||||
|
||||
// meaning that the display flag is not changed so neither increment or decrement
|
||||
if (displayResource == null)
|
||||
if (displayResource == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Increment because the display is turned on.
|
||||
if (displayResource) {
|
||||
|
||||
@ -23,17 +23,14 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.utils.fsm.StateMachine2;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.framework.events.EventBus;
|
||||
import org.apache.cloudstack.framework.events.EventBusException;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.event.EventCategory;
|
||||
@ -44,9 +41,9 @@ import com.cloud.storage.Snapshot.State;
|
||||
import com.cloud.storage.SnapshotVO;
|
||||
import com.cloud.utils.component.ComponentContext;
|
||||
import com.cloud.utils.fsm.StateListener;
|
||||
import com.cloud.utils.fsm.StateMachine2;
|
||||
|
||||
@Component
|
||||
@Local(value = {SnapshotStateListener.class})
|
||||
public class SnapshotStateListener implements StateListener<State, Event, SnapshotVO> {
|
||||
|
||||
protected static EventBus s_eventBus = null;
|
||||
@ -74,17 +71,18 @@ public class SnapshotStateListener implements StateListener<State, Event, Snapsh
|
||||
|
||||
@Override
|
||||
public boolean postStateTransitionEvent(StateMachine2.Transition<State, Event> transition, SnapshotVO vo, boolean status, Object opaque) {
|
||||
pubishOnEventBus(transition.getEvent().name(), "postStateTransitionEvent", vo, transition.getCurrentState(), transition.getToState());
|
||||
return true;
|
||||
pubishOnEventBus(transition.getEvent().name(), "postStateTransitionEvent", vo, transition.getCurrentState(), transition.getToState());
|
||||
return true;
|
||||
}
|
||||
|
||||
private void pubishOnEventBus(String event, String status, Snapshot vo, State oldState, State newState) {
|
||||
private void pubishOnEventBus(String event, String status, Snapshot vo, State oldState, State newState) {
|
||||
|
||||
String configKey = Config.PublishResourceStateEvent.key();
|
||||
String value = s_configDao.getValue(configKey);
|
||||
boolean configValue = Boolean.parseBoolean(value);
|
||||
if(!configValue)
|
||||
if(!configValue) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
s_eventBus = ComponentContext.getComponent(EventBus.class);
|
||||
} catch (NoSuchBeanDefinitionException nbe) {
|
||||
@ -93,8 +91,8 @@ public class SnapshotStateListener implements StateListener<State, Event, Snapsh
|
||||
|
||||
String resourceName = getEntityFromClassName(Snapshot.class.getName());
|
||||
org.apache.cloudstack.framework.events.Event eventMsg =
|
||||
new org.apache.cloudstack.framework.events.Event(ManagementService.Name, EventCategory.RESOURCE_STATE_CHANGE_EVENT.getName(), event, resourceName,
|
||||
vo.getUuid());
|
||||
new org.apache.cloudstack.framework.events.Event(ManagementService.Name, EventCategory.RESOURCE_STATE_CHANGE_EVENT.getName(), event, resourceName,
|
||||
vo.getUuid());
|
||||
Map<String, String> eventDescription = new HashMap<String, String>();
|
||||
eventDescription.put("resource", resourceName);
|
||||
eventDescription.put("id", vo.getUuid());
|
||||
|
||||
@ -18,7 +18,6 @@ package com.cloud.uuididentity;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
@ -31,7 +30,6 @@ import com.cloud.utils.db.EntityManager;
|
||||
import com.cloud.utils.db.UUIDManager;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
@Local(value = {UUIDManager.class})
|
||||
public class UUIDManagerImpl implements UUIDManager {
|
||||
|
||||
@Inject
|
||||
@ -44,8 +42,9 @@ public class UUIDManagerImpl implements UUIDManager {
|
||||
@Override
|
||||
public <T> void checkUuid(String uuid, Class<T> entityType) {
|
||||
|
||||
if (uuid == null)
|
||||
if (uuid == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Account caller = CallContext.current().getCallingAccount();
|
||||
|
||||
@ -60,16 +59,19 @@ public class UUIDManagerImpl implements UUIDManager {
|
||||
@Override
|
||||
public <T> void checkUuidSimple(String uuid, Class<T> entityType) {
|
||||
|
||||
if (uuid == null)
|
||||
if (uuid == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// check format
|
||||
if (!IsUuidFormat(uuid))
|
||||
if (!IsUuidFormat(uuid)) {
|
||||
throw new InvalidParameterValueException("UUID: " + uuid + " doesn't follow the UUID format");
|
||||
}
|
||||
|
||||
// check unique
|
||||
if (!IsUuidUnique(entityType, uuid))
|
||||
if (!IsUuidUnique(entityType, uuid)) {
|
||||
throw new InvalidParameterValueException("UUID: " + uuid + " already exists so can't create/update with custom id");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -83,10 +85,11 @@ public class UUIDManagerImpl implements UUIDManager {
|
||||
public <T> boolean IsUuidUnique(Class<T> entityType, String uuid) {
|
||||
|
||||
T obj = _entityMgr.findByUuid(entityType, uuid);
|
||||
if (obj != null)
|
||||
if (obj != null) {
|
||||
return false;
|
||||
else
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -96,8 +99,9 @@ public class UUIDManagerImpl implements UUIDManager {
|
||||
int retry = UUID_RETRY;
|
||||
while (retry-- != 0) { // there might be collision so retry
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
if (IsUuidUnique(entityType, uuid))
|
||||
if (IsUuidUnique(entityType, uuid)) {
|
||||
return uuid;
|
||||
}
|
||||
}
|
||||
|
||||
throw new CloudRuntimeException("Unable to generate a unique uuid, please try again");
|
||||
|
||||
@ -21,7 +21,6 @@ import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.acl.dao.RoleDao;
|
||||
@ -53,7 +52,6 @@ import com.cloud.utils.db.TransactionCallback;
|
||||
import com.cloud.utils.db.TransactionStatus;
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
@Local(value = {RoleService.class})
|
||||
public class RoleManagerImpl extends ManagerBase implements RoleService, Configurable, PluggableService {
|
||||
@Inject
|
||||
private AccountDao accountDao;
|
||||
|
||||
@ -16,47 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.network.ssl;
|
||||
|
||||
import com.cloud.domain.DomainVO;
|
||||
import com.cloud.domain.dao.DomainDao;
|
||||
import com.cloud.event.ActionEvent;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.network.dao.LoadBalancerCertMapDao;
|
||||
import com.cloud.network.dao.LoadBalancerCertMapVO;
|
||||
import com.cloud.network.dao.LoadBalancerVO;
|
||||
import com.cloud.network.dao.SslCertDao;
|
||||
import com.cloud.network.dao.SslCertVO;
|
||||
import org.apache.cloudstack.network.tls.CertService;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.projects.Project;
|
||||
import com.cloud.projects.ProjectService;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.dao.AccountDao;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.EntityManager;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.security.CertificateHelper;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Strings;
|
||||
import org.apache.cloudstack.acl.SecurityChecker;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.DeleteSslCertCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListSslCertsCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.UploadSslCertCmd;
|
||||
import org.apache.cloudstack.api.response.SslCertResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.bouncycastle.util.io.pem.PemObject;
|
||||
import org.bouncycastle.util.io.pem.PemReader;
|
||||
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
@ -89,7 +48,48 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Local(value = {CertService.class})
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.acl.SecurityChecker;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.DeleteSslCertCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListSslCertsCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.UploadSslCertCmd;
|
||||
import org.apache.cloudstack.api.response.SslCertResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.network.tls.CertService;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.bouncycastle.util.io.pem.PemObject;
|
||||
import org.bouncycastle.util.io.pem.PemReader;
|
||||
|
||||
import com.cloud.domain.DomainVO;
|
||||
import com.cloud.domain.dao.DomainDao;
|
||||
import com.cloud.event.ActionEvent;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.network.dao.LoadBalancerCertMapDao;
|
||||
import com.cloud.network.dao.LoadBalancerCertMapVO;
|
||||
import com.cloud.network.dao.LoadBalancerVO;
|
||||
import com.cloud.network.dao.SslCertDao;
|
||||
import com.cloud.network.dao.SslCertVO;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.projects.Project;
|
||||
import com.cloud.projects.ProjectService;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.dao.AccountDao;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.EntityManager;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.security.CertificateHelper;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
public class CertServiceImpl implements CertService {
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(CertServiceImpl.class);
|
||||
@ -438,6 +438,7 @@ public class CertServiceImpl implements CertService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Certificate parseCertificate(final String cert) {
|
||||
Preconditions.checkArgument(!Strings.isNullOrEmpty(cert));
|
||||
final PemReader certPem = new PemReader(new StringReader(cert));
|
||||
|
||||
@ -22,11 +22,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.SecurityChecker;
|
||||
import org.apache.cloudstack.api.command.user.region.ha.gslb.AssignToGlobalLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.region.ha.gslb.CreateGlobalLoadBalancerRuleCmd;
|
||||
@ -38,6 +35,7 @@ import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.region.Region;
|
||||
import org.apache.cloudstack.region.dao.RegionDao;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.api.routing.GlobalLoadBalancerConfigCommand;
|
||||
@ -69,7 +67,6 @@ import com.cloud.utils.db.TransactionStatus;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
|
||||
@Local(value = {GlobalLoadBalancingRulesService.class})
|
||||
public class GlobalLoadBalancingRulesServiceImpl implements GlobalLoadBalancingRulesService {
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(GlobalLoadBalancingRulesServiceImpl.class);
|
||||
@ -477,12 +474,10 @@ public class GlobalLoadBalancingRulesServiceImpl implements GlobalLoadBalancingR
|
||||
}
|
||||
});
|
||||
|
||||
boolean success = false;
|
||||
try {
|
||||
if (gslbLbMapVos != null) {
|
||||
applyGlobalLoadBalancerRuleConfig(gslbRuleId, true);
|
||||
}
|
||||
success = true;
|
||||
} catch (ResourceUnavailableException e) {
|
||||
throw new CloudRuntimeException("Failed to update the gloabal load balancer");
|
||||
}
|
||||
|
||||
@ -1959,10 +1959,10 @@ below. If you did not receive this Content directly from the Eclipse Foundation,
|
||||
the following is provided for informational purposes only, and you should look
|
||||
to the Redistributor's license for terms and conditions of use.
|
||||
|
||||
Foundation Dependencies ASM EclipseLink JPA ANTLR Java Persistence API (JPA) 1.0
|
||||
- EJB 3.0 Java Persistence API (JPA) 2.0 EARLY ACCESS EclipseLink MOXy Java
|
||||
Architecture for XML Binding (JAXB) Java Mail Java Activation Framework
|
||||
Streaming API for XML (StAX) EclipseLink SDO Service Data Objects (SDO)
|
||||
Foundation Dependencies ASM EclipseLink JPA ANTLR Java Persistence API (JPA) 2.0
|
||||
EARLY ACCESS EclipseLink MOXy Java Architecture for XML Binding (JAXB)
|
||||
Java Mail Java Activation Framework Streaming API for XML (StAX)
|
||||
EclipseLink SDO Service Data Objects (SDO)
|
||||
Utilities Java Connector Xerces WSDL4J 1.6.2 ASM v1.5.3
|
||||
|
||||
The EclipseLink Project includes ASM for the purpose of byte code weaving. The
|
||||
@ -2019,19 +2019,19 @@ EclipseLink Project to enable the MOXY component's implementation of JAXB.
|
||||
|
||||
JAXB Libraries:
|
||||
|
||||
/jlib/moxy/javax.xml.bind_2.1.12.v20090708-1500.jar /jlib/moxy/jaxb-impl.jar
|
||||
/jlib/moxy/jaxb.xjc.jar Java Persistence (JPA) 1.0 - EJB 3.0
|
||||
/jlib/moxy/javax.xml.bind_2.1.12.v20090708-1500.jar
|
||||
/jlib/moxy/jaxb-impl.jar
|
||||
/jlib/moxy/jaxb.xjc.jar
|
||||
|
||||
The Java Persistence API, included with EJB 3.0, is available for download from
|
||||
the ejb-api directory in the glassfish CVS repository.It is distributed under
|
||||
CDDLv1.0 . The jar is being shipped as an OSGi bundle and is required for
|
||||
compilation of some container based fuctionality.
|
||||
Java Persistence (JPA) 2.0:
|
||||
|
||||
Java Persistence (JPA) 2.0.
|
||||
|
||||
EclipseLink is the Java Persistence (JPA) 2.0 Reference Implementation (JSR
|
||||
317). The JPA 2.0 specification API is included in EclipseLink under the EPL and
|
||||
EDL licenses.
|
||||
The Java Persistence API used is available in the Maven central repository
|
||||
under the "org.eclipse.persistence" groupId. This jar is being shipped as
|
||||
an OSGi bundle and is required for compilation of some container based
|
||||
functionality. The JAR "javax.persistence" is distributed under Eclipse
|
||||
Public License v1.0 and Eclipse Distribution License v. 1.0 licenses.
|
||||
EclipseLink is the Java Persistence (JPA) 2.0 Reference Implementation
|
||||
(JSR 317).
|
||||
|
||||
Java Mail v1.4
|
||||
|
||||
@ -2723,10 +2723,6 @@ Copyright (c) 2003-2007 Luck Consulting Pty Ltd
|
||||
<copyright-notice>
|
||||
Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
</copyright-notice>
|
||||
<by-organisation id='glassfish.org'>
|
||||
<resource name='cloud-ejb-api-3.0.jar' source='http://repo1.maven.org/maven2/javax/ejb/ejb-api/3.0/ejb-api-3.0-sources.jar' notice='cddlnotice' />
|
||||
<resource name='cloud-jstl-1.2.jar' source='http://jstl.java.net/' notice='cddlnotice' />
|
||||
</by-organisation>
|
||||
</with-license>
|
||||
<with-license id='CDDL'>
|
||||
<copyright-notice>
|
||||
|
||||
@ -1959,8 +1959,8 @@ below. If you did not receive this Content directly from the Eclipse Foundation,
|
||||
the following is provided for informational purposes only, and you should look
|
||||
to the Redistributor's license for terms and conditions of use.
|
||||
|
||||
Foundation Dependencies ASM EclipseLink JPA ANTLR Java Persistence API (JPA) 1.0
|
||||
- EJB 3.0 Java Persistence API (JPA) 2.0 EARLY ACCESS EclipseLink MOXy Java
|
||||
Foundation Dependencies
|
||||
ASM EclipseLink JPA ANTLR Java Persistence API (JPA) 2.0 EARLY ACCESS EclipseLink MOXy Java
|
||||
Architecture for XML Binding (JAXB) Java Mail Java Activation Framework
|
||||
Streaming API for XML (StAX) EclipseLink SDO Service Data Objects (SDO)
|
||||
Utilities Java Connector Xerces WSDL4J 1.6.2 ASM v1.5.3
|
||||
@ -2019,19 +2019,19 @@ EclipseLink Project to enable the MOXY component's implementation of JAXB.
|
||||
|
||||
JAXB Libraries:
|
||||
|
||||
/jlib/moxy/javax.xml.bind_2.1.12.v20090708-1500.jar /jlib/moxy/jaxb-impl.jar
|
||||
/jlib/moxy/jaxb.xjc.jar Java Persistence (JPA) 1.0 - EJB 3.0
|
||||
/jlib/moxy/javax.xml.bind_2.1.12.v20090708-1500.jar
|
||||
/jlib/moxy/jaxb-impl.jar
|
||||
/jlib/moxy/jaxb.xjc.jar
|
||||
|
||||
The Java Persistence API, included with EJB 3.0, is available for download from
|
||||
the ejb-api directory in the glassfish CVS repository.It is distributed under
|
||||
CDDLv1.0 . The jar is being shipped as an OSGi bundle and is required for
|
||||
compilation of some container based fuctionality.
|
||||
Java Persistence (JPA) 2.0:
|
||||
|
||||
Java Persistence (JPA) 2.0.
|
||||
|
||||
EclipseLink is the Java Persistence (JPA) 2.0 Reference Implementation (JSR
|
||||
317). The JPA 2.0 specification API is included in EclipseLink under the EPL and
|
||||
EDL licenses.
|
||||
The Java Persistence API used is available in the Maven central repository
|
||||
under the "org.eclipse.persistence" groupId. This jar is being shipped as
|
||||
an OSGi bundle and is required for compilation of some container based
|
||||
functionality. The JAR "javax.persistence" is distributed under Eclipse
|
||||
Public License v1.0 and Eclipse Distribution License v. 1.0 licenses.
|
||||
EclipseLink is the Java Persistence (JPA) 2.0 Reference Implementation
|
||||
(JSR 317).
|
||||
|
||||
Java Mail v1.4
|
||||
|
||||
|
||||
@ -105,10 +105,6 @@
|
||||
<artifactId>apache-log4j-extras</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.ejb</groupId>
|
||||
<artifactId>ejb-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.java-ipv6</groupId>
|
||||
<artifactId>java-ipv6</artifactId>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user