From 3d2fefabdd12e3a84067a3d5d02d664aad7ce2d6 Mon Sep 17 00:00:00 2001 From: Wido den Hollander Date: Wed, 2 Jan 2013 17:01:23 +0100 Subject: [PATCH 01/13] db / upgrade: Add columns to sync_queue and sync_queue_item These columns were not added by the upgrade from 4.0 to 4.1 causing SQL-errors These columns are present in create-schema.sql, so by adding them here the upgrade also works to 4.1 --- setup/db/db/schema-40to410.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/setup/db/db/schema-40to410.sql b/setup/db/db/schema-40to410.sql index 73289bca35b..b09ebb94fea 100644 --- a/setup/db/db/schema-40to410.sql +++ b/setup/db/db/schema-40to410.sql @@ -60,3 +60,8 @@ ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `eip_associate_public_ip` int INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network','DEFAULT','NetworkManager','network.dhcp.nondefaultnetwork.setgateway.guestos','Windows','The guest OS\'s name start with this fields would result in DHCP server response gateway information even when the network it\'s on is not default network. Names are separated by comma.'); +ALTER TABLE `sync_queue` ADD `queue_size` SMALLINT NOT NULL DEFAULT '0' COMMENT 'number of items being processed by the queue'; + +ALTER TABLE `sync_queue` ADD `queue_size_limit` SMALLINT NOT NULL DEFAULT '1' COMMENT 'max number of items the queue can process concurrently'; + +ALTER TABLE `sync_queue_item` ADD `queue_proc_time` DATETIME NOT NULL COMMENT 'when processing started for the item' AFTER `queue_proc_number`; From e4583ced2e1bc9b4abf7b8f9dbf53edd2baa1704 Mon Sep 17 00:00:00 2001 From: John Burwell Date: Thu, 20 Dec 2012 20:35:56 -0500 Subject: [PATCH 02/13] S3-backed Secondary Storage --- .../com/cloud/api/commands/ListS3sCmd.java | 37 ----- build/package.xml | 4 + .../ConfigurationManagerImpl.java | 108 +++++++++++--- .../cloud/server/ManagementServerImpl.java | 26 ++++ .../com/cloud/storage/dao/VMTemplateDao.java | 4 + .../cloud/storage/dao/VMTemplateDaoImpl.java | 140 ++++++++++++++++++ .../com/cloud/storage/s3/S3ManagerImpl.java | 5 - tools/marvin/marvin/cloudstackConnection.py | 1 - tools/marvin/marvin/configGenerator.py | 11 ++ tools/marvin/marvin/deployDataCenter.py | 8 +- utils/src/com/cloud/utils/db/DbUtil.java | 59 ++++++++ 11 files changed, 337 insertions(+), 66 deletions(-) diff --git a/api/src/com/cloud/api/commands/ListS3sCmd.java b/api/src/com/cloud/api/commands/ListS3sCmd.java index 507053dd89f..d536cfcf80a 100644 --- a/api/src/com/cloud/api/commands/ListS3sCmd.java +++ b/api/src/com/cloud/api/commands/ListS3sCmd.java @@ -18,15 +18,11 @@ */ package com.cloud.api.commands; -import static com.cloud.api.ApiConstants.ID; -import static com.cloud.api.BaseCmd.CommandType.LONG; - import java.util.ArrayList; import java.util.List; import com.cloud.api.BaseListCmd; import com.cloud.api.Implementation; -import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.api.response.ListResponse; import com.cloud.api.response.S3Response; @@ -42,9 +38,6 @@ public final class ListS3sCmd extends BaseListCmd { private static final String COMMAND_NAME = "lists3sresponse"; - @Parameter(name = ID, type = LONG, required = true, description = "The ID of the S3") - private Long id; - @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, @@ -74,39 +67,9 @@ public final class ListS3sCmd extends BaseListCmd { } - @Override - public boolean equals(final Object thatObject) { - - if (this == thatObject) { - return true; - } - - if (thatObject == null || getClass() != thatObject.getClass()) { - return false; - } - - final ListS3sCmd thatListS3sCmd = (ListS3sCmd) thatObject; - - if (this.id != null ? !this.id.equals(thatListS3sCmd.id) : thatListS3sCmd.id != null) { - return false; - } - - return true; - - } - - @Override - public int hashCode() { - return this.id != null ? this.id.hashCode() : 0; - } - @Override public String getCommandName() { return COMMAND_NAME; } - public Long getId() { - return this.id; - } - } diff --git a/build/package.xml b/build/package.xml index 09ed939c6d7..3efdd7dda05 100755 --- a/build/package.xml +++ b/build/package.xml @@ -217,6 +217,10 @@ + + + + diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 2d7dfe290a6..c7a5d64ac7e 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -16,35 +16,110 @@ // under the License. package com.cloud.configuration; +import java.net.URI; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import javax.ejb.Local; +import javax.naming.ConfigurationException; +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.directory.DirContext; +import javax.naming.directory.InitialDirContext; + +import org.apache.log4j.Logger; + import com.cloud.acl.SecurityChecker; import com.cloud.alert.AlertManager; import com.cloud.api.ApiConstants.LDAPParams; import com.cloud.api.ApiDBUtils; -import com.cloud.api.commands.*; +import com.cloud.api.commands.CreateDiskOfferingCmd; +import com.cloud.api.commands.CreateNetworkOfferingCmd; +import com.cloud.api.commands.CreateServiceOfferingCmd; +import com.cloud.api.commands.CreateVlanIpRangeCmd; +import com.cloud.api.commands.CreateZoneCmd; +import com.cloud.api.commands.DeleteDiskOfferingCmd; +import com.cloud.api.commands.DeleteNetworkOfferingCmd; +import com.cloud.api.commands.DeletePodCmd; +import com.cloud.api.commands.DeleteServiceOfferingCmd; +import com.cloud.api.commands.DeleteVlanIpRangeCmd; +import com.cloud.api.commands.DeleteZoneCmd; +import com.cloud.api.commands.LDAPConfigCmd; +import com.cloud.api.commands.LDAPRemoveCmd; +import com.cloud.api.commands.ListNetworkOfferingsCmd; +import com.cloud.api.commands.UpdateCfgCmd; +import com.cloud.api.commands.UpdateDiskOfferingCmd; +import com.cloud.api.commands.UpdateNetworkOfferingCmd; +import com.cloud.api.commands.UpdatePodCmd; +import com.cloud.api.commands.UpdateServiceOfferingCmd; +import com.cloud.api.commands.UpdateZoneCmd; import com.cloud.capacity.dao.CapacityDao; import com.cloud.configuration.Resource.ResourceType; import com.cloud.configuration.dao.ConfigurationDao; -import com.cloud.dc.*; +import com.cloud.dc.AccountVlanMapVO; +import com.cloud.dc.ClusterVO; +import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter.NetworkType; +import com.cloud.dc.DataCenterIpAddressVO; +import com.cloud.dc.DataCenterLinkLocalIpAddressVO; +import com.cloud.dc.DataCenterVO; +import com.cloud.dc.HostPodVO; +import com.cloud.dc.Pod; +import com.cloud.dc.PodVlanMapVO; +import com.cloud.dc.Vlan; import com.cloud.dc.Vlan.VlanType; -import com.cloud.dc.dao.*; +import com.cloud.dc.VlanVO; +import com.cloud.dc.dao.AccountVlanMapDao; +import com.cloud.dc.dao.ClusterDao; +import com.cloud.dc.dao.DataCenterDao; +import com.cloud.dc.dao.DataCenterIpAddressDao; +import com.cloud.dc.dao.DataCenterLinkLocalIpAddressDaoImpl; +import com.cloud.dc.dao.HostPodDao; +import com.cloud.dc.dao.PodVlanMapDao; +import com.cloud.dc.dao.VlanDao; import com.cloud.deploy.DataCenterDeployment; import com.cloud.domain.Domain; 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.*; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.exception.PermissionDeniedException; +import com.cloud.exception.ResourceAllocationException; +import com.cloud.exception.ResourceUnavailableException; import com.cloud.host.HostVO; import com.cloud.hypervisor.Hypervisor.HypervisorType; -import com.cloud.network.*; +import com.cloud.network.IPAddressVO; +import com.cloud.network.Network; import com.cloud.network.Network.Capability; import com.cloud.network.Network.GuestType; import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; +import com.cloud.network.NetworkManager; +import com.cloud.network.NetworkVO; import com.cloud.network.Networks.BroadcastDomainType; import com.cloud.network.Networks.TrafficType; -import com.cloud.network.dao.*; +import com.cloud.network.PhysicalNetwork; +import com.cloud.network.PhysicalNetworkVO; +import com.cloud.network.dao.FirewallRulesDao; +import com.cloud.network.dao.IPAddressDao; +import com.cloud.network.dao.NetworkDao; +import com.cloud.network.dao.PhysicalNetworkDao; +import com.cloud.network.dao.PhysicalNetworkTrafficTypeDao; +import com.cloud.network.dao.PhysicalNetworkTrafficTypeVO; import com.cloud.network.vpc.VpcManager; import com.cloud.offering.DiskOffering; import com.cloud.offering.NetworkOffering; @@ -69,7 +144,12 @@ import com.cloud.storage.s3.S3Manager; import com.cloud.storage.secondary.SecondaryStorageVmManager; import com.cloud.storage.swift.SwiftManager; import com.cloud.test.IPRangeConfig; -import com.cloud.user.*; +import com.cloud.user.Account; +import com.cloud.user.AccountManager; +import com.cloud.user.AccountVO; +import com.cloud.user.ResourceLimitService; +import com.cloud.user.User; +import com.cloud.user.UserContext; import com.cloud.user.dao.AccountDao; import com.cloud.utils.NumbersUtil; import com.cloud.utils.StringUtils; @@ -85,20 +165,8 @@ import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.net.NetUtils; import com.cloud.vm.VirtualMachine; import com.cloud.vm.dao.NicDao; -import edu.emory.mathcs.backport.java.util.Arrays; -import org.apache.log4j.Logger; -import javax.ejb.Local; -import javax.naming.ConfigurationException; -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.directory.DirContext; -import javax.naming.directory.InitialDirContext; -import java.net.URI; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.*; +import edu.emory.mathcs.backport.java.util.Arrays; @Local(value = { ConfigurationManager.class, ConfigurationService.class }) public class ConfigurationManagerImpl implements ConfigurationManager, ConfigurationService { diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 117be5797b0..500c067fbb7 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -203,6 +203,7 @@ import com.cloud.storage.dao.StoragePoolDao; import com.cloud.storage.dao.UploadDao; import com.cloud.storage.dao.VMTemplateDao; import com.cloud.storage.dao.VolumeDao; +import com.cloud.storage.s3.S3Manager; import com.cloud.storage.secondary.SecondaryStorageVmManager; import com.cloud.storage.snapshot.SnapshotManager; import com.cloud.storage.swift.SwiftManager; @@ -292,6 +293,7 @@ public class ManagementServerImpl implements ManagementServer { private final ConsoleProxyManager _consoleProxyMgr; private final SecondaryStorageVmManager _secStorageVmMgr; private final SwiftManager _swiftMgr; + private final S3Manager _s3Mgr; private final ServiceOfferingDao _offeringsDao; private final DiskOfferingDao _diskOfferingDao; private final VMTemplateDao _templateDao; @@ -370,6 +372,7 @@ public class ManagementServerImpl implements ManagementServer { _consoleProxyMgr = locator.getManager(ConsoleProxyManager.class); _secStorageVmMgr = locator.getManager(SecondaryStorageVmManager.class); _swiftMgr = locator.getManager(SwiftManager.class); + _s3Mgr = locator.getManager(S3Manager.class); _storageMgr = locator.getManager(StorageManager.class); _publicIpAddressDao = locator.getDao(IPAddressDao.class); _consoleProxyDao = locator.getDao(ConsoleProxyDao.class); @@ -1399,6 +1402,29 @@ public class ManagementServerImpl implements ManagementServer { } templateZonePairSet.add(new Pair(template.getId(), zoneId)); } + } else if (_s3Mgr.isS3Enabled()) { + if (template == null) { + templateZonePairSet = _templateDao.searchSwiftTemplates(name, keyword, templateFilter, isIso, + hypers, bootable, domain, pageSize, startIndex, zoneId, hyperType, onlyReady, showDomr, + permittedAccounts, caller, tags); + Set> templateZonePairSet2 = new HashSet>(); + templateZonePairSet2 = _templateDao.searchTemplates(name, keyword, templateFilter, isIso, hypers, + bootable, domain, pageSize, startIndex, zoneId, hyperType, onlyReady, showDomr, + permittedAccounts, caller, listProjectResourcesCriteria, tags); + + for (Pair tmpltPair : templateZonePairSet2) { + if (!templateZonePairSet.contains(new Pair(tmpltPair.first(), -1L))) { + templateZonePairSet.add(tmpltPair); + } + } + } else { + // if template is not public, perform permission check here + if (!template.isPublicTemplate() && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) { + Account owner = _accountMgr.getAccount(template.getAccountId()); + _accountMgr.checkAccess(caller, null, true, owner); + } + templateZonePairSet.add(new Pair(template.getId(), zoneId)); + } } else { if (template == null) { templateZonePairSet = _templateDao.searchTemplates(name, keyword, templateFilter, isIso, hypers, diff --git a/server/src/com/cloud/storage/dao/VMTemplateDao.java b/server/src/com/cloud/storage/dao/VMTemplateDao.java index 1284ba103cf..a043a2c6079 100755 --- a/server/src/com/cloud/storage/dao/VMTemplateDao.java +++ b/server/src/com/cloud/storage/dao/VMTemplateDao.java @@ -58,6 +58,10 @@ public interface VMTemplateDao extends GenericDao { boolean isIso, List hypers, Boolean bootable, DomainVO domain, Long pageSize, Long startIndex, Long zoneId, HypervisorType hyperType, boolean onlyReady, boolean showDomr, List permittedAccounts, Account caller, Map tags); + public Set> searchS3Templates(String name, String keyword, TemplateFilter templateFilter, + boolean isIso, List hypers, Boolean bootable, DomainVO domain, Long pageSize, Long startIndex, + Long zoneId, HypervisorType hyperType, boolean onlyReady, boolean showDomr, List permittedAccounts, Account caller, Map tags); + public long addTemplateToZone(VMTemplateVO tmplt, long zoneId); public List listAllInZone(long dataCenterId); diff --git a/server/src/com/cloud/storage/dao/VMTemplateDaoImpl.java b/server/src/com/cloud/storage/dao/VMTemplateDaoImpl.java index 5c71f1bdb0c..7ef9c9fc9d9 100755 --- a/server/src/com/cloud/storage/dao/VMTemplateDaoImpl.java +++ b/server/src/com/cloud/storage/dao/VMTemplateDaoImpl.java @@ -16,6 +16,9 @@ // under the License. package com.cloud.storage.dao; +import static com.cloud.utils.StringUtils.*; +import static com.cloud.utils.db.DbUtil.*; + import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -93,6 +96,9 @@ public class VMTemplateDaoImpl extends GenericDaoBase implem private final String SELECT_TEMPLATE_SWIFT_REF = "SELECT t.id, t.unique_name, t.name, t.public, t.featured, t.type, t.hvm, t.bits, t.url, t.format, t.created, t.account_id, " + "t.checksum, t.display_text, t.enable_password, t.guest_os_id, t.bootable, t.prepopulate, t.cross_zones, t.hypervisor_type FROM vm_template t"; + private final String SELECT_TEMPLATE_S3_REF = "SELECT t.id, t.unique_name, t.name, t.public, t.featured, t.type, t.hvm, t.bits, t.url, t.format, t.created, t.account_id, " + + "t.checksum, t.display_text, t.enable_password, t.guest_os_id, t.bootable, t.prepopulate, t.cross_zones, t.hypervisor_type FROM vm_template t"; + private static final String SELECT_S3_CANDIDATE_TEMPLATES = "SELECT t.id, t.unique_name, t.name, t.public, t.featured, " + "t.type, t.hvm, t.bits, t.url, t.format, t.created, t.account_id, t.checksum, t.display_text, " + "t.enable_password, t.guest_os_id, t.bootable, t.prepopulate, t.cross_zones, t.hypervisor_type " + @@ -931,4 +937,138 @@ public class VMTemplateDaoImpl extends GenericDaoBase implem return executeList(SELECT_S3_CANDIDATE_TEMPLATES, new Object[] {}); } + @Override + public Set> searchS3Templates(final String name, + final String keyword, final TemplateFilter templateFilter, + final boolean isIso, final List hypers, + final Boolean bootable, final DomainVO domain, final Long pageSize, + final Long startIndex, final Long zoneId, + final HypervisorType hyperType, final boolean onlyReady, + final boolean showDomr, final List permittedAccounts, + final Account caller, final Map tags) { + + final String permittedAccountsStr = join(",", permittedAccounts); + + final Transaction txn = Transaction.currentTxn(); + txn.start(); + + Set> templateZonePairList = new HashSet>(); + PreparedStatement pstmt = null; + ResultSet rs = null; + try { + + final StringBuilder joinClause = new StringBuilder(); + final StringBuilder whereClause = new StringBuilder(" WHERE t.removed IS NULL"); + + if (isIso) { + whereClause.append(" AND t.format = 'ISO'"); + if (!hyperType.equals(HypervisorType.None)) { + joinClause.append(" INNER JOIN guest_os guestOS on (guestOS.id = t.guest_os_id) INNER JOIN guest_os_hypervisor goh on ( goh.guest_os_id = guestOS.id) "); + whereClause.append(" AND goh.hypervisor_type = '"); + whereClause.append(hyperType); + whereClause.append("'"); + } + } else { + whereClause.append(" AND t.format <> 'ISO'"); + if (hypers.isEmpty()) { + return templateZonePairList; + } else { + final StringBuilder relatedHypers = new StringBuilder(); + for (HypervisorType hyper : hypers) { + relatedHypers.append("'"); + relatedHypers.append(hyper.toString()); + relatedHypers.append("'"); + relatedHypers.append(","); + } + relatedHypers.setLength(relatedHypers.length() - 1); + whereClause.append(" AND t.hypervisor_type IN ("); + whereClause.append(relatedHypers); + whereClause.append(")"); + } + } + + joinClause.append(" INNER JOIN template_s3_ref tsr on (t.id = tsr.template_id)"); + + whereClause.append("AND t.name LIKE \"%"); + whereClause.append(keyword == null ? keyword : name); + whereClause.append("%\""); + + if (bootable != null) { + whereClause.append(" AND t.bootable = "); + whereClause.append(bootable); + } + + if (!showDomr) { + whereClause.append(" AND t.type != '"); + whereClause.append(Storage.TemplateType.SYSTEM); + whereClause.append("'"); + } + + if (templateFilter == TemplateFilter.featured) { + whereClause.append(" AND t.public = 1 AND t.featured = 1"); + } else if ((templateFilter == TemplateFilter.self || templateFilter == TemplateFilter.selfexecutable) + && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) { + if (caller.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN + || caller.getType() == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) { + joinClause.append(" INNER JOIN account a on (t.account_id = a.id) INNER JOIN domain d on (a.domain_id = d.id)"); + whereClause.append(" AND d.path LIKE '"); + whereClause.append(domain.getPath()); + whereClause.append("%'"); + } else { + whereClause.append(" AND t.account_id IN ("); + whereClause.append(permittedAccountsStr); + whereClause.append(")"); + } + } else if (templateFilter == TemplateFilter.sharedexecutable + && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) { + if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL) { + joinClause.append(" LEFT JOIN launch_permission lp ON t.id = lp.template_id WHERE (t.account_id IN ("); + joinClause.append(permittedAccountsStr); + joinClause.append(") OR lp.account_id IN ("); + joinClause.append(permittedAccountsStr); + joinClause.append("))"); + } else { + joinClause.append(" INNER JOIN account a on (t.account_id = a.id) "); + } + } else if (templateFilter == TemplateFilter.executable + && !permittedAccounts.isEmpty()) { + whereClause.append(" AND (t.public = 1 OR t.account_id IN ("); + whereClause.append(permittedAccountsStr); + whereClause.append("))"); + } else if (templateFilter == TemplateFilter.community) { + whereClause.append(" AND t.public = 1 AND t.featured = 0"); + } else if (templateFilter == TemplateFilter.all + && caller.getType() == Account.ACCOUNT_TYPE_ADMIN) { + } else if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN) { + return templateZonePairList; + } + + final StringBuilder sql = new StringBuilder(SELECT_TEMPLATE_S3_REF); + sql.append(joinClause); + sql.append(whereClause); + sql.append(getOrderByLimit(pageSize, startIndex)); + + pstmt = txn.prepareStatement(sql.toString()); + rs = pstmt.executeQuery(); + while (rs.next()) { + final Pair templateZonePair = new Pair( + rs.getLong(1), -1L); + templateZonePairList.add(templateZonePair); + } + txn.commit(); + } catch (Exception e) { + s_logger.warn("Error listing S3 templates", e); + if (txn != null) { + txn.rollback(); + } + } finally { + closeResources(pstmt, rs); + if (txn != null) { + txn.close(); + } + } + + return templateZonePairList; + } + } diff --git a/server/src/com/cloud/storage/s3/S3ManagerImpl.java b/server/src/com/cloud/storage/s3/S3ManagerImpl.java index 6b072540c66..0da11ffa590 100644 --- a/server/src/com/cloud/storage/s3/S3ManagerImpl.java +++ b/server/src/com/cloud/storage/s3/S3ManagerImpl.java @@ -27,7 +27,6 @@ import static com.cloud.utils.S3Utils.checkClientOptions; import static com.cloud.utils.S3Utils.doesBucketExist; import static com.cloud.utils.StringUtils.join; import static com.cloud.utils.db.GlobalLock.executeWithNoWaitLock; -import static com.cloud.utils.db.SearchCriteria.Op.EQ; import static java.lang.Boolean.TRUE; import static java.lang.String.format; import static java.util.Arrays.asList; @@ -433,10 +432,6 @@ public class S3ManagerImpl implements S3Manager { cmd.getStartIndex(), cmd.getPageSizeVal()); final SearchCriteria criteria = this.s3Dao.createSearchCriteria(); - if (cmd.getId() != null) { - criteria.addAnd(ID_COLUMN_NAME, EQ, cmd.getId()); - } - return this.s3Dao.search(criteria, filter); } diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py index 8c4e3251690..e8b861eedb2 100644 --- a/tools/marvin/marvin/cloudstackConnection.py +++ b/tools/marvin/marvin/cloudstackConnection.py @@ -46,7 +46,6 @@ class cloudConnection(object): self.auth = False else: self.auth = True - self.retries = 5 self.asyncTimeout = asyncTimeout diff --git a/tools/marvin/marvin/configGenerator.py b/tools/marvin/marvin/configGenerator.py index 11fbce997dd..d494beb6444 100644 --- a/tools/marvin/marvin/configGenerator.py +++ b/tools/marvin/marvin/configGenerator.py @@ -180,6 +180,17 @@ class secondaryStorage(): def __init__(self): self.url = None +class s3(): + def __init__(self): + self.accesskey = None + self.secretkey = None + self.bucket = None + self.endpoint = None + self.sockettimeout = None + self.connectiontimeout = None + self.maxerrorrety = None + self.usehttps = None + class netscaler(): def __init__(self, hostname=None, username='nsroot', password='nsroot'): self.hostname = hostname diff --git a/tools/marvin/marvin/deployDataCenter.py b/tools/marvin/marvin/deployDataCenter.py index ba124cbced4..0d5f3bdc659 100644 --- a/tools/marvin/marvin/deployDataCenter.py +++ b/tools/marvin/marvin/deployDataCenter.py @@ -399,9 +399,11 @@ class deployDataCenters(): logging=self.testClientLogger) """config database""" - #dbSvr = self.config.dbSvr - #self.testClient.dbConfigure(dbSvr.dbSvr, dbSvr.port, dbSvr.user, \ - # dbSvr.passwd, dbSvr.db) + dbSvr = self.config.dbSvr + if dbSvr is not None: + self.testClient.dbConfigure(dbSvr.dbSvr, dbSvr.port, dbSvr.user, \ + dbSvr.passwd, dbSvr.db) + self.apiClient = self.testClient.getApiClient() def updateConfiguration(self, globalCfg): diff --git a/utils/src/com/cloud/utils/db/DbUtil.java b/utils/src/com/cloud/utils/db/DbUtil.java index feef7b3b236..da0efbbe8cb 100755 --- a/utils/src/com/cloud/utils/db/DbUtil.java +++ b/utils/src/com/cloud/utils/db/DbUtil.java @@ -23,6 +23,7 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.sql.Statement; import java.util.HashMap; import java.util.Map; @@ -280,4 +281,62 @@ public class DbUtil { } return false; } + + public static void closeResources(final Connection connection, + final Statement statement, final ResultSet resultSet) { + + closeResultSet(resultSet); + closeStatement(statement); + closeConnection(connection); + + } + + public static void closeResources(final Statement statement, final ResultSet resultSet) { + + closeResources(null, statement, resultSet); + + } + + public static void closeResultSet(final ResultSet resultSet) { + + try { + + if (resultSet != null) { + resultSet.close(); + } + + } catch (Exception e) { + s_logger.warn("Ignored exception while closing result set.",e); + } + + } + + public static void closeStatement(final Statement statement) { + + try { + + if (statement != null) { + statement.close(); + } + + } catch (Exception e) { + s_logger.warn("Ignored exception while closing statement.",e); + } + + } + + public static void closeConnection(final Connection connection) { + + try { + + if (connection != null) { + connection.close(); + } + + } catch (Exception e) { + s_logger.warn("Ignored exception while close connection.",e); + } + + } + } From bba43f51dc2d7415410d5e95de4bf5dd1035a5a3 Mon Sep 17 00:00:00 2001 From: Edison Su Date: Wed, 2 Jan 2013 16:25:17 -0800 Subject: [PATCH 03/13] vmware stuff should be compile time dependency --- plugins/hypervisors/vmware/pom.xml | 6 +++--- vmware-base/pom.xml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/hypervisors/vmware/pom.xml b/plugins/hypervisors/vmware/pom.xml index 0aa6340c866..d990e89b388 100644 --- a/plugins/hypervisors/vmware/pom.xml +++ b/plugins/hypervisors/vmware/pom.xml @@ -36,19 +36,19 @@ com.cloud.com.vmware vmware-vim25 ${cs.vmware.api.version} - provided + compile com.cloud.com.vmware vmware-vim ${cs.vmware.api.version} - provided + compile com.cloud.com.vmware vmware-apputils ${cs.vmware.api.version} - provided + compile org.apache.axis diff --git a/vmware-base/pom.xml b/vmware-base/pom.xml index 9b119e5156a..bd536fb574a 100644 --- a/vmware-base/pom.xml +++ b/vmware-base/pom.xml @@ -41,19 +41,19 @@ com.cloud.com.vmware vmware-vim25 ${cs.vmware.api.version} - provided + compile com.cloud.com.vmware vmware-vim ${cs.vmware.api.version} - provided + compile com.cloud.com.vmware vmware-apputils ${cs.vmware.api.version} - provided + compile org.apache.axis From 9122809e00949230cb18211c3a3af0a44f57fd28 Mon Sep 17 00:00:00 2001 From: Hugo Trippaers Date: Thu, 3 Jan 2013 11:44:24 +0100 Subject: [PATCH 04/13] Summary: nothing to see here, move along Fix for a stupid mistake. --- .../nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java index 3e8e0285bfe..039c174be2d 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java @@ -84,7 +84,7 @@ public class NiciraNvpApi { protected HttpMethod createMethod(String type, String uri) throws NiciraNvpApiException { String url; try { - url = new URL(_protocol, _host, "/ws.v1/login").toString(); + url = new URL(_protocol, _host, uri).toString(); } catch (MalformedURLException e) { s_logger.error("Unable to build Nicira API URL", e); throw new NiciraNvpApiException("Unable to build Nicira API URL", e); From 6cf0c5683d518bd6dcd6c51bfa0290e96c6804f3 Mon Sep 17 00:00:00 2001 From: Hugo Trippaers Date: Thu, 3 Jan 2013 11:47:40 +0100 Subject: [PATCH 05/13] Summary: Make canHandle protected Change access to canHandle so it's easier to unittest. Make a note that answers can be null if the host is down, there should be a way to deal with this, but for now an NPE is an adequate indication that something is wrong. --- .../src/com/cloud/network/element/NiciraNvpElement.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java index b1e9af2fd52..0a7d042a96d 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java @@ -173,7 +173,7 @@ public class NiciraNvpElement extends AdapterBase implements return Provider.NiciraNvp; } - private boolean canHandle(Network network, Service service) { + protected boolean canHandle(Network network, Service service) { s_logger.debug("Checking if NiciraNvpElement can handle service " + service.getName() + " on network " + network.getDisplayText()); if (network.getBroadcastDomainType() != BroadcastDomainType.Lswitch) { @@ -845,6 +845,7 @@ public class NiciraNvpElement extends AdapterBase implements ConfigurePublicIpsOnLogicalRouterCommand cmd = new ConfigurePublicIpsOnLogicalRouterCommand(routermapping.getLogicalRouterUuid(), niciraNvpHost.getDetail("l3gatewayserviceuuid"), cidrs); ConfigurePublicIpsOnLogicalRouterAnswer answer = (ConfigurePublicIpsOnLogicalRouterAnswer) _agentMgr.easySend(niciraNvpHost.getId(), cmd); + //FIXME answer can be null if the host is down return answer.getResult(); } else { From 00847482cc5cd4c9eda7c3d73b2a30aff4f44a5a Mon Sep 17 00:00:00 2001 From: Hugo Trippaers Date: Thu, 3 Jan 2013 11:49:17 +0100 Subject: [PATCH 06/13] Summary: Small fixes for issues found during unittests --- .../com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java index 1046a5a96b7..99be680a5c6 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java @@ -29,6 +29,7 @@ import com.cloud.agent.api.CreateLogicalSwitchAnswer; import com.cloud.agent.api.CreateLogicalSwitchCommand; import com.cloud.agent.api.DeleteLogicalSwitchAnswer; import com.cloud.agent.api.DeleteLogicalSwitchCommand; +import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter.NetworkType; import com.cloud.dc.dao.DataCenterDao; import com.cloud.deploy.DeployDestination; @@ -119,8 +120,9 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru { Network userSpecified, Account owner) { // Check of the isolation type of the related physical network is STT PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan.getPhysicalNetworkId()); - if (physnet == null || physnet.getIsolationMethods() == null || !physnet.getIsolationMethods().contains("STT")) { - s_logger.debug("Refusing to design this network, the physical isolation type is not STT"); + DataCenter dc = _dcDao.findById(plan.getDataCenterId()); + if (!canHandle(offering,dc.getNetworkType(),physnet)) { + s_logger.debug("Refusing to design this network"); return null; } @@ -199,6 +201,7 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru { s_logger.info("Implemented OK, network linked to = " + implemented.getBroadcastUri().toString()); } catch (URISyntaxException e) { s_logger.error("Unable to store logical switch id in broadcast uri, uuid = " + implemented.getUuid(), e); + return null; } return implemented; From 282eb5fcf514cb4e885cf30ec9a31156f8fb8c9f Mon Sep 17 00:00:00 2001 From: Hugo Trippaers Date: Thu, 3 Jan 2013 11:50:30 +0100 Subject: [PATCH 07/13] Summary: Unittest for nicira plugin More unittests for the Guru Add unittests for the Element --- .../network/element/NiciraNvpElementTest.java | 119 ++++++++++++++++++ .../guru/NiciraNvpGuestNetworkGuruTest.java | 114 +++++++++++++++++ 2 files changed, 233 insertions(+) create mode 100644 plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.java diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.java new file mode 100644 index 00000000000..acfd3bcdb9e --- /dev/null +++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.java @@ -0,0 +1,119 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.network.element; + +import java.util.Collections; + +import javax.naming.ConfigurationException; + +import org.junit.Before; +import org.junit.Test; + +import com.cloud.deploy.DeployDestination; +import com.cloud.domain.Domain; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.network.Network; +import com.cloud.network.Network.GuestType; +import com.cloud.network.Network.Provider; +import com.cloud.network.Network.Service; +import com.cloud.network.NetworkManager; +import com.cloud.network.Networks.BroadcastDomainType; +import com.cloud.network.Networks.TrafficType; +import com.cloud.network.dao.NetworkServiceMapDao; +import com.cloud.offering.NetworkOffering; +import com.cloud.resource.ResourceManager; +import com.cloud.user.Account; +import com.cloud.vm.ReservationContext; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; + +public class NiciraNvpElementTest { + + NiciraNvpElement _element = new NiciraNvpElement(); + NetworkManager _networkManager = mock(NetworkManager.class); + NetworkServiceMapDao _ntwkSrvcDao = mock (NetworkServiceMapDao.class); + + @Before + public void setUp() throws ConfigurationException { + _element._resourceMgr = mock(ResourceManager.class); + _element._networkManager = _networkManager; + _element._ntwkSrvcDao = _ntwkSrvcDao; + + // Standard responses + when(_networkManager.isProviderForNetwork(Provider.NiciraNvp, 42L)).thenReturn(true); + + _element.configure("NiciraNvpTestElement", Collections. emptyMap()); + } + + @Test + public void canHandleTest() { + Network net = mock(Network.class); + when(net.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Lswitch); + when(net.getId()).thenReturn(42L); + + when(_ntwkSrvcDao.canProviderSupportServiceInNetwork(42L, Service.Connectivity, Provider.NiciraNvp)).thenReturn(true); + // Golden path + assertTrue(_element.canHandle(net, Service.Connectivity)); + + when(net.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Vlan); + // Only broadcastdomaintype lswitch is supported + assertFalse(_element.canHandle(net, Service.Connectivity)); + + when(net.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Lswitch); + when(_ntwkSrvcDao.canProviderSupportServiceInNetwork(42L, Service.Connectivity, Provider.NiciraNvp)).thenReturn(false); + // No nvp provider in the network + assertFalse(_element.canHandle(net, Service.Connectivity)); + + when(_networkManager.isProviderForNetwork(Provider.NiciraNvp, 42L)).thenReturn(false); + when(_ntwkSrvcDao.canProviderSupportServiceInNetwork(42L, Service.Connectivity, Provider.NiciraNvp)).thenReturn(true); + // NVP provider does not provide Connectivity for this network + assertFalse(_element.canHandle(net, Service.Connectivity)); + + when(_networkManager.isProviderForNetwork(Provider.NiciraNvp, 42L)).thenReturn(true); + // Only service Connectivity is supported + assertFalse(_element.canHandle(net, Service.Dhcp)); + + } + + @Test + public void implementTest() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { + Network network = mock(Network.class); + when(network.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Lswitch); + when(network.getId()).thenReturn(42L); + + NetworkOffering offering = mock(NetworkOffering.class); + when(offering.getId()).thenReturn(42L); + when(offering.getTrafficType()).thenReturn(TrafficType.Guest); + when(offering.getGuestType()).thenReturn(GuestType.Isolated); + + DeployDestination dest = mock(DeployDestination.class); + + Domain dom = mock(Domain.class); + when(dom.getName()).thenReturn("domain"); + Account acc = mock(Account.class); + when(acc.getAccountName()).thenReturn("accountname"); + ReservationContext context = mock(ReservationContext.class); + when(context.getDomain()).thenReturn(dom); + when(context.getAccount()).thenReturn(acc); + + //assertTrue(_element.implement(network, offering, dest, context)); + } + +} diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java index f8d9652da60..e37b2f42105 100644 --- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java +++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java @@ -272,12 +272,126 @@ public class NiciraNvpGuestNetworkGuruTest { CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class); when(answer.getResult()).thenReturn(true); + when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa"); when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer); Network implementednetwork = guru.implement(network, offering, dest, res); assertTrue(implementednetwork != null); verify(agentmgr, times(1)).easySend(eq(42L), (Command)any()); } + + @Test + public void testImplementWithCidr() throws InsufficientVirtualNetworkCapcityException { + PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); + when(physnetdao.findById((Long) any())).thenReturn(physnet); + when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" })); + when(physnet.getId()).thenReturn(42L); + + NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class); + when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device })); + when(device.getId()).thenReturn(1L); + + NetworkOffering offering = mock(NetworkOffering.class); + when(offering.getId()).thenReturn(42L); + when(offering.getTrafficType()).thenReturn(TrafficType.Guest); + when(offering.getGuestType()).thenReturn(GuestType.Isolated); + + when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false); + + DeploymentPlan plan = mock(DeploymentPlan.class); + + NetworkVO network = mock(NetworkVO.class); + when(network.getName()).thenReturn("testnetwork"); + when(network.getState()).thenReturn(State.Implementing); + when(network.getGateway()).thenReturn("10.1.1.1"); + when(network.getCidr()).thenReturn("10.1.1.0/24"); + + + DeployDestination dest = mock(DeployDestination.class); + + DataCenter dc = mock(DataCenter.class); + when(dest.getDataCenter()).thenReturn(dc); + + HostVO niciraHost = mock(HostVO.class); + when(hostdao.findById(anyLong())).thenReturn(niciraHost); + when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa"); + when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt"); + when(niciraHost.getId()).thenReturn(42L); + + when(netmgr.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L); + Domain dom = mock(Domain.class); + when(dom.getName()).thenReturn("domain"); + Account acc = mock(Account.class); + when(acc.getAccountName()).thenReturn("accountname"); + ReservationContext res = mock(ReservationContext.class); + when(res.getDomain()).thenReturn(dom); + when(res.getAccount()).thenReturn(acc); + + CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class); + when(answer.getResult()).thenReturn(true); + when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa"); + when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer); + + Network implementednetwork = guru.implement(network, offering, dest, res); + assertTrue(implementednetwork != null); + assertTrue(implementednetwork.getCidr().equals("10.1.1.0/24")); + assertTrue(implementednetwork.getGateway().equals("10.1.1.1")); + verify(agentmgr, times(1)).easySend(eq(42L), (Command)any()); + } + + @Test + public void testImplementURIException() throws InsufficientVirtualNetworkCapcityException { + PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); + when(physnetdao.findById((Long) any())).thenReturn(physnet); + when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" })); + when(physnet.getId()).thenReturn(42L); + + NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class); + when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device })); + when(device.getId()).thenReturn(1L); + + NetworkOffering offering = mock(NetworkOffering.class); + when(offering.getId()).thenReturn(42L); + when(offering.getTrafficType()).thenReturn(TrafficType.Guest); + when(offering.getGuestType()).thenReturn(GuestType.Isolated); + + when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false); + + DeploymentPlan plan = mock(DeploymentPlan.class); + + NetworkVO network = mock(NetworkVO.class); + when(network.getName()).thenReturn("testnetwork"); + when(network.getState()).thenReturn(State.Implementing); + + DeployDestination dest = mock(DeployDestination.class); + + DataCenter dc = mock(DataCenter.class); + when(dest.getDataCenter()).thenReturn(dc); + + HostVO niciraHost = mock(HostVO.class); + when(hostdao.findById(anyLong())).thenReturn(niciraHost); + when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa"); + when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt"); + when(niciraHost.getId()).thenReturn(42L); + + when(netmgr.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L); + Domain dom = mock(Domain.class); + when(dom.getName()).thenReturn("domain"); + Account acc = mock(Account.class); + when(acc.getAccountName()).thenReturn("accountname"); + ReservationContext res = mock(ReservationContext.class); + when(res.getDomain()).thenReturn(dom); + when(res.getAccount()).thenReturn(acc); + + CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class); + when(answer.getResult()).thenReturn(true); + //when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa"); + when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer); + + Network implementednetwork = guru.implement(network, offering, dest, res); + assertTrue(implementednetwork == null); + verify(agentmgr, times(1)).easySend(eq(42L), (Command)any()); + } @Test public void testShutdown() throws InsufficientVirtualNetworkCapcityException, URISyntaxException { From cc3d692ab8cdb23ed468723d1021d0640bd390c4 Mon Sep 17 00:00:00 2001 From: Hugo Trippaers Date: Thu, 3 Jan 2013 11:51:44 +0100 Subject: [PATCH 08/13] Summary: Remove useless and commented code --- .../cloud/network/guru/GuestNetworkGuru.java | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/server/src/com/cloud/network/guru/GuestNetworkGuru.java b/server/src/com/cloud/network/guru/GuestNetworkGuru.java index 2a8a092b835..91b95f953cc 100755 --- a/server/src/com/cloud/network/guru/GuestNetworkGuru.java +++ b/server/src/com/cloud/network/guru/GuestNetworkGuru.java @@ -153,25 +153,7 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur } protected abstract boolean canHandle(NetworkOffering offering, final NetworkType networkType, PhysicalNetwork physicalNetwork); -/* protected boolean canHandle(NetworkOffering offering, final NetworkType networkType, final List isolationMethods) { - // This guru handles only Guest Isolated network that supports Source nat service -<<<<<<< HEAD - if (dc.getNetworkType() == NetworkType.Advanced && isMyTrafficType(offering.getTrafficType()) - && offering.getGuestType() == Network.GuestType.Isolated && !offering.isSystemOnly()) { -======= - if (networkType == NetworkType.Advanced - && isMyTrafficType(offering.getTrafficType()) - && offering.getGuestType() == Network.GuestType.Isolated - && isMyIsolationMethod(isolationMethods)) { ->>>>>>> master - return true; - } else { - s_logger.trace("We only take care of non-system Guest networks of type " + GuestType.Isolated + " in zone of type " - + NetworkType.Advanced); - return false; - } - } -*/ + @Override public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) { DataCenter dc = _dcDao.findById(plan.getDataCenterId()); From 6ce01c46fc73a2753e540130bdce194a3ce57dea Mon Sep 17 00:00:00 2001 From: Isaac Chiang Date: Wed, 2 Jan 2013 10:50:06 +0800 Subject: [PATCH 09/13] UI: add generate key button to appropriate roles --- client/tomcatconf/commands.properties.in | 2 +- ui/scripts/accounts.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in index e55017ce5ea..27e0c2fc3cf 100755 --- a/client/tomcatconf/commands.properties.in +++ b/client/tomcatconf/commands.properties.in @@ -260,7 +260,7 @@ migrateVolume=com.cloud.api.commands.MigrateVolumeCmd;15 #### use that key...the key is stored in the db associated w/ #### the userId...every request to the developer API should be #### checked against the key -registerUserKeys=com.cloud.api.commands.RegisterCmd;1 +registerUserKeys=com.cloud.api.commands.RegisterCmd;15 ### async-query command queryAsyncJobResult=com.cloud.api.commands.QueryAsyncJobResultCmd;15 diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js index ba741a4f063..de8149fe877 100644 --- a/ui/scripts/accounts.js +++ b/ui/scripts/accounts.js @@ -1282,6 +1282,7 @@ } else { if(isSelfOrChildDomainUser(jsonObj.username, jsonObj.accounttype, jsonObj.domainid, jsonObj.iscallerchilddomain)) { allowedActions.push("changePassword"); + allowedActions.push("generateKeys"); } } return allowedActions; From 9c5c626546b414c6990fef8b04291c1a28264559 Mon Sep 17 00:00:00 2001 From: Marcus Sorensen Date: Thu, 3 Jan 2013 17:26:26 -0700 Subject: [PATCH 10/13] Summary: bring up KVM network bridge immediately Detail: Users can experience long delays during VM migration, because the linux bridge by default will have a forwarding delay set. This means that the network will likely miss any gratuitous ARP from qemu notifying the network that the MAC has moved. This change is a common reccommendation for virtualization running on Linux bridges. Signed-off-by: Marcus Sorensen 1357259186 -0700 --- scripts/vm/network/vnet/modifyvlan.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/vm/network/vnet/modifyvlan.sh b/scripts/vm/network/vnet/modifyvlan.sh index 5577825ea54..8ed3905a579 100755 --- a/scripts/vm/network/vnet/modifyvlan.sh +++ b/scripts/vm/network/vnet/modifyvlan.sh @@ -67,6 +67,8 @@ addVlan() { return 2 fi fi + + brctl setfd $vlanBr 0 fi #pif is eslaved into vlanBr? From 8cf2cb1f4e9b09041782678640d46ddc46ef4ba4 Mon Sep 17 00:00:00 2001 From: Gavin Lee Date: Fri, 4 Jan 2013 10:25:34 +0800 Subject: [PATCH 11/13] [DOC]Delete duplicated, mis-spelling xml files. --- .../changing-secondary-storage-servers.xml | 2 +- .../changing-secondary-storage-serversp.xml | 36 ------------------- docs/en-US/configure-xenserver-dom-memory.xml | 29 --------------- 3 files changed, 1 insertion(+), 66 deletions(-) delete mode 100644 docs/en-US/changing-secondary-storage-serversp.xml delete mode 100644 docs/en-US/configure-xenserver-dom-memory.xml diff --git a/docs/en-US/changing-secondary-storage-servers.xml b/docs/en-US/changing-secondary-storage-servers.xml index 62ad65015a3..a628eec9b39 100644 --- a/docs/en-US/changing-secondary-storage-servers.xml +++ b/docs/en-US/changing-secondary-storage-servers.xml @@ -22,7 +22,7 @@ under the License. --> -
+
Changing Secondary Storage Servers You can change the secondary storage NFS mount. Perform the following steps to do so: diff --git a/docs/en-US/changing-secondary-storage-serversp.xml b/docs/en-US/changing-secondary-storage-serversp.xml deleted file mode 100644 index 62ad65015a3..00000000000 --- a/docs/en-US/changing-secondary-storage-serversp.xml +++ /dev/null @@ -1,36 +0,0 @@ - - -%BOOK_ENTITIES; -]> - - - -
- Changing Secondary Storage Servers - You can change the secondary storage NFS mount. Perform the following steps to do so: - - Stop all running Management Servers. - Wait 30 minutes. This allows any writes to secondary storage to complete. - Copy all files from the old secondary storage mount to the new. - Use the procedure above to change the IP address for secondary storage if required. - Start the Management Server. - -
- diff --git a/docs/en-US/configure-xenserver-dom-memory.xml b/docs/en-US/configure-xenserver-dom-memory.xml deleted file mode 100644 index 0a02d3e3818..00000000000 --- a/docs/en-US/configure-xenserver-dom-memory.xml +++ /dev/null @@ -1,29 +0,0 @@ - - -%BOOK_ENTITIES; -]> - - - -
- Configure XenServer dom0 Memory - Configure the XenServer dom0 settings to allocate more memory to dom0. This can enable XenServer to handle larger numbers of virtual machines. We recommend 2940 MB of RAM for XenServer dom0. For instructions on how to do this, see Citrix Knowledgebase Article.The article refers to XenServer 5.6, but the same information applies to XenServer 6 -
- From 287d7f4df0d0898656eca00b6b6fa43fd3b2eb43 Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Fri, 28 Dec 2012 16:17:16 -0800 Subject: [PATCH 12/13] marvin tests: marking the xen specific tests these tests do verification assuming xenserver style disks /dev/xvda/b Signed-off-by: Prasanna Santhanam --- test/integration/component/test_snapshots.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/integration/component/test_snapshots.py b/test/integration/component/test_snapshots.py index 8659f14309a..825b8c6877e 100644 --- a/test/integration/component/test_snapshots.py +++ b/test/integration/component/test_snapshots.py @@ -582,7 +582,7 @@ class TestSnapshots(cloudstackTestCase): return @attr(speed = "slow") - @attr(tags = ["advanced", "advancedns", "smoke"]) + @attr(tags = ["advanced", "advancedns", "smoke", "xen"]) def test_03_volume_from_snapshot(self): """Create volumes from snapshots """ @@ -995,7 +995,7 @@ class TestSnapshots(cloudstackTestCase): return @attr(speed = "slow") - @attr(tags = ["advanced", "advancedns", "smoke"]) + @attr(tags = ["advanced", "advancedns", "smoke", "xen"]) def test_07_template_from_snapshot(self): """Create Template from snapshot """ @@ -1901,7 +1901,7 @@ class TestSnapshotDetachedDisk(cloudstackTestCase): return @attr(speed = "slow") - @attr(tags = ["advanced", "advancedns"]) + @attr(tags = ["advanced", "advancedns", "xen"]) def test_03_snapshot_detachedDisk(self): """Test snapshot from detached disk """ From 42f3804fbdde7bfe4f3676ef0c18a54dfe95354c Mon Sep 17 00:00:00 2001 From: Noa Resare Date: Thu, 3 Jan 2013 15:48:06 +0000 Subject: [PATCH 13/13] Work around maven dependency problems Disable the transitive dependency from axis2-webapp to xercesImpl and from all rampart artifacts to opensaml. This fixes reproducible problem where maven tries to download artifacts from the wrong repositories. Signed-off-by: Prasanna Santhanam Signed-off-by: Rohit Yadav Reviewed-by: Likitha Shetty --- awsapi/pom.xml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/awsapi/pom.xml b/awsapi/pom.xml index 2e426550afa..06c9d7e058a 100644 --- a/awsapi/pom.xml +++ b/awsapi/pom.xml @@ -47,6 +47,12 @@ axis2-webapp war ${cs.axis2.version} + + + xerces + xercesImpl + + org.apache.ws.commons.axiom @@ -123,6 +129,10 @@ org.apache.xalan xalan + + org.opensaml + opensaml + @@ -139,6 +149,10 @@ org.apache.xalan xalan + + org.opensaml + opensaml + @@ -151,6 +165,10 @@ org.apache.xalan xalan + + org.opensaml + opensaml + @@ -163,6 +181,10 @@ org.apache.xalan xalan + + org.opensaml + opensaml + @@ -175,6 +197,10 @@ org.apache.xalan xalan + + org.opensaml + opensaml +