From 26fea7b660f96292f62c857a03fd6e4faaeba220 Mon Sep 17 00:00:00 2001 From: Marcus Sorensen Date: Wed, 17 Apr 2013 12:52:55 -0600 Subject: [PATCH 01/30] CLOUDSTACK-2067 - ACS4.2 - throw LibvirtException instead of squelching it so that callers of startVM in LibvirtComputingResource know that a vm failed to start Signed-off-by: Marcus Sorensen 1366224775 -0600 --- .../hypervisor/kvm/resource/LibvirtComputingResource.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index 3de7a485fa5..0064edf6a68 100755 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -1077,8 +1077,7 @@ ServerResource { */ conn.domainCreateXML(domainXML, 0); } catch (final LibvirtException e) { - s_logger.warn("Failed to start domain " + vmName + ": " - + e.getMessage(), e); + throw e; } return null; } From 9584815d4f35073214d7893704ff4bf6729a3155 Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Wed, 17 Apr 2013 12:02:09 -0700 Subject: [PATCH 02/30] CLOUDSTACK-1941: introduced "default" flag to account/user objects. Admin/System accounts that come with the CS install are default, and can never be removed. All accounts created by the CS admin, have default flag set to false, and can be removed at any time. --- api/src/com/cloud/user/Account.java | 4 ++++ api/src/com/cloud/user/User.java | 2 ++ core/src/com/cloud/user/AccountVO.java | 7 +++++++ core/src/com/cloud/user/UserVO.java | 11 ++++++++++- .../cloud/server/ConfigurationServerImpl.java | 17 +++++++++++------ .../src/com/cloud/user/AccountManagerImpl.java | 15 ++++++++------- setup/db/db/schema-410to420.sql | 6 ++++++ 7 files changed, 48 insertions(+), 14 deletions(-) diff --git a/api/src/com/cloud/user/Account.java b/api/src/com/cloud/user/Account.java index 5d32fb23253..940a0eb2667 100755 --- a/api/src/com/cloud/user/Account.java +++ b/api/src/com/cloud/user/Account.java @@ -22,6 +22,7 @@ import org.apache.cloudstack.acl.ControlledEntity; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; + public interface Account extends ControlledEntity, InternalIdentity, Identity { public enum Type { Normal, @@ -64,4 +65,7 @@ public interface Account extends ControlledEntity, InternalIdentity, Identity { public Long getDefaultZoneId(); public String getUuid(); + + boolean isDefault(); + } diff --git a/api/src/com/cloud/user/User.java b/api/src/com/cloud/user/User.java index 3742c7bf3e2..dcf27a0de69 100644 --- a/api/src/com/cloud/user/User.java +++ b/api/src/com/cloud/user/User.java @@ -72,5 +72,7 @@ public interface User extends OwnedBy, InternalIdentity { String getRegistrationToken(); boolean isRegistered(); + + boolean isDefault(); } diff --git a/core/src/com/cloud/user/AccountVO.java b/core/src/com/cloud/user/AccountVO.java index 5e939c52173..77110aedb95 100644 --- a/core/src/com/cloud/user/AccountVO.java +++ b/core/src/com/cloud/user/AccountVO.java @@ -65,6 +65,9 @@ public class AccountVO implements Account { @Column(name="default_zone_id") private Long defaultZoneId = null; + + @Column(name = "default") + boolean isDefault; public AccountVO() { this.uuid = UUID.randomUUID().toString(); @@ -179,4 +182,8 @@ public class AccountVO implements Account { this.uuid = uuid; } + @Override + public boolean isDefault() { + return isDefault; + } } diff --git a/core/src/com/cloud/user/UserVO.java b/core/src/com/cloud/user/UserVO.java index 8b7c4e3f1e1..2a857580506 100644 --- a/core/src/com/cloud/user/UserVO.java +++ b/core/src/com/cloud/user/UserVO.java @@ -29,10 +29,11 @@ import javax.persistence.Id; import javax.persistence.Table; import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + import com.cloud.user.Account.State; import com.cloud.utils.db.Encrypt; import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.InternalIdentity; /** * A bean representing a user @@ -92,6 +93,9 @@ public class UserVO implements User, Identity, InternalIdentity { @Column(name="uuid") private String uuid; + + @Column(name = "default") + boolean isDefault; public UserVO() { this.uuid = UUID.randomUUID().toString(); @@ -262,4 +266,9 @@ public class UserVO implements User, Identity, InternalIdentity { this.uuid = uuid; } + @Override + public boolean isDefault() { + return isDefault; + } + } diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java index 852c00b4c5d..06b787172d1 100755 --- a/server/src/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/com/cloud/server/ConfigurationServerImpl.java @@ -333,21 +333,24 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio @DB protected void saveUser() { // insert system account - String insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id) VALUES (1, UUID(), 'system', '1', '1')"; + String insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, account.default) VALUES (1, UUID(), 'system', '1', '1', 1)"; Transaction txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); stmt.executeUpdate(); } catch (SQLException ex) { + s_logger.warn("Failed to system account due to ", ex); + } // insert system user - insertSql = "INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, lastname, created)" + - " VALUES (1, UUID(), 'system', RAND(), 1, 'system', 'cloud', now())"; + insertSql = "INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, lastname, created, user.default)" + + " VALUES (1, UUID(), 'system', RAND(), 1, 'system', 'cloud', now(), 1)"; txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); stmt.executeUpdate(); } catch (SQLException ex) { + s_logger.warn("Failed to create system user due to ", ex); } // insert admin user, but leave the account disabled until we set a @@ -358,23 +361,25 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio String lastname = "cloud"; // create an account for the admin user first - insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id) VALUES (" + id + ", UUID(), '" + username + "', '1', '1')"; + insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, account.default) VALUES (" + id + ", UUID(), '" + username + "', '1', '1', 1)"; txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); stmt.executeUpdate(); } catch (SQLException ex) { + s_logger.warn("Failed to create admin account due to ", ex); } // now insert the user - insertSql = "INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, lastname, created, state) " + - "VALUES (" + id + ", UUID(), '" + username + "', RAND(), 2, '" + firstname + "','" + lastname + "',now(), 'disabled')"; + insertSql = "INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, lastname, created, state, user.default) " + + "VALUES (" + id + ", UUID(), '" + username + "', RAND(), 2, '" + firstname + "','" + lastname + "',now(), 'disabled', 1)"; txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); stmt.executeUpdate(); } catch (SQLException ex) { + s_logger.warn("Failed to create admin user due to ", ex); } try { diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java index e74c49124f7..8de73fbd582 100755 --- a/server/src/com/cloud/user/AccountManagerImpl.java +++ b/server/src/com/cloud/user/AccountManagerImpl.java @@ -37,7 +37,6 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import com.cloud.event.ActionEventUtils; import org.apache.cloudstack.acl.ControlledEntity; import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.acl.SecurityChecker; @@ -53,7 +52,6 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiDBUtils; import com.cloud.api.query.dao.UserAccountJoinDao; import com.cloud.api.query.vo.ControlledViewEntity; - import com.cloud.configuration.Config; import com.cloud.configuration.ConfigurationManager; import com.cloud.configuration.ResourceLimit; @@ -65,6 +63,7 @@ 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.ActionEventUtils; import com.cloud.event.EventTypes; import com.cloud.exception.AgentUnavailableException; import com.cloud.exception.CloudAuthenticationException; @@ -1178,8 +1177,9 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M checkAccess(caller, null, true, account); - if (account.getId() == Account.ACCOUNT_ID_SYSTEM) { - throw new PermissionDeniedException("Account id : " + accountId + " is a system account, delete is not allowed"); + //don't allow to delete default account (system and admin) + if (account.isDefault()) { + throw new InvalidParameterValueException("The account is default and can't be removed"); } // Account that manages project(s) can't be removed @@ -1384,9 +1384,10 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) { throw new InvalidParameterValueException("The specified user doesn't exist in the system"); } - - if (account.getId() == Account.ACCOUNT_ID_SYSTEM) { - throw new InvalidParameterValueException("Account id : " + user.getAccountId() + " is a system account, delete for user associated with this account is not allowed"); + + //don't allow to delete default user (system and admin users) + if (user.isDefault()) { + throw new InvalidParameterValueException("The user is default and can't be removed"); } checkAccess(UserContext.current().getCaller(), null, true, account); diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql index 6a7a72c5d2d..bd145cb82f2 100644 --- a/setup/db/db/schema-410to420.sql +++ b/setup/db/db/schema-410to420.sql @@ -720,3 +720,9 @@ ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `eip_associate_public_ip` int -- Re-enable foreign key checking, at the end of the upgrade path SET foreign_key_checks = 1; + +-- Add "default" field to account/user tables +ALTER TABLE `cloud`.`account` ADD COLUMN `default` int(1) unsigned NOT NULL DEFAULT '0' COMMENT '1 if account is default'; +ALTER TABLE `cloud`.`user` ADD COLUMN `default` int(1) unsigned NOT NULL DEFAULT '0' COMMENT '1 if user is default'; +UPDATE `cloud`.`account` SET `cloud`.`account`.`default`=1 WHERE id IN (1,2); +UPDATE `cloud`.`user` SET `cloud`.`user`.`default`=1 WHERE id IN (1,2); From 8d0bea994dcd74cd6707b58ac2e4060a93f52d96 Mon Sep 17 00:00:00 2001 From: Marcus Sorensen Date: Wed, 17 Apr 2013 13:10:29 -0600 Subject: [PATCH 03/30] CLOUDSTACK-2071 - VirtualMachineManagerImpl.java start() method for instance can fail to start a VM without notifying caller, if no exception is triggered. The result is that VM start looks successful but was not. This fixes it by throwing an exception at the very end if the object to be passed back is still null. Signed-off-by: Marcus Sorensen 1366225829 -0600 --- server/src/com/cloud/vm/VirtualMachineManagerImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java index 40725314f46..a53e38072ff 100755 --- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -866,6 +866,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac } } + if (startedVm == null) { + throw new CloudRuntimeException("Unable to start instance '" + vm.getHostName() + + "' (" + vm.getUuid() + "), see management server log for details"); + } + return startedVm; } From 11480c3af8b7d55625e791f955d7d077ea7f488e Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Wed, 17 Apr 2013 12:29:09 -0700 Subject: [PATCH 04/30] CLOUDSTACK-1941: added isDefault parameter to account/user response --- .../api/response/AccountResponse.java | 7 + .../cloudstack/api/response/UserResponse.java | 8 + .../com/cloud/api/query/QueryManagerImpl.java | 11 +- .../api/query/dao/AccountJoinDaoImpl.java | 8 +- .../api/query/dao/UserAccountJoinDaoImpl.java | 1 + .../com/cloud/api/query/vo/AccountJoinVO.java | 10 + .../cloud/api/query/vo/UserAccountJoinVO.java | 16 +- .../cloud/server/ConfigurationServerImpl.java | 5 - setup/db/db/schema-410to420.sql | 330 ++++++++++-------- 9 files changed, 234 insertions(+), 162 deletions(-) diff --git a/api/src/org/apache/cloudstack/api/response/AccountResponse.java b/api/src/org/apache/cloudstack/api/response/AccountResponse.java index c109a6325c8..1e59822180f 100644 --- a/api/src/org/apache/cloudstack/api/response/AccountResponse.java +++ b/api/src/org/apache/cloudstack/api/response/AccountResponse.java @@ -183,6 +183,9 @@ public class AccountResponse extends BaseResponse { @SerializedName(ApiConstants.ACCOUNT_DETAILS) @Param(description="details for the account") private Map details; + + @SerializedName(ApiConstants.IS_DEFAULT) @Param(description="true if account is default, false otherwise", since="4.2.0") + private Boolean isDefault; @Override @@ -381,4 +384,8 @@ public class AccountResponse extends BaseResponse { public void setDefaultZone(String defaultZoneId) { this.defaultZoneId = defaultZoneId; } + + public void setIsDefault(Boolean isDefault) { + this.isDefault = isDefault; + } } diff --git a/api/src/org/apache/cloudstack/api/response/UserResponse.java b/api/src/org/apache/cloudstack/api/response/UserResponse.java index 9cd25cb7ad6..e70a310bf06 100644 --- a/api/src/org/apache/cloudstack/api/response/UserResponse.java +++ b/api/src/org/apache/cloudstack/api/response/UserResponse.java @@ -18,6 +18,7 @@ package org.apache.cloudstack.api.response; import java.util.Date; +import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; @@ -74,6 +75,9 @@ public class UserResponse extends BaseResponse { @SerializedName("iscallerchilddomain") @Param(description="the boolean value representing if the updating target is in caller's child domain") private boolean isCallerChildDomain; + + @SerializedName(ApiConstants.IS_DEFAULT) @Param(description="true if user is default, false otherwise", since="4.2.0") + private Boolean isDefault; @Override public String getObjectId() { @@ -206,4 +210,8 @@ public class UserResponse extends BaseResponse { public void setIsCallerChildDomain(boolean isCallerChildDomain) { this.isCallerChildDomain = isCallerChildDomain; } + + public void setIsDefault(Boolean isDefault) { + this.isDefault = isDefault; + } } diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java index 5ffc2db995c..3114ea5c243 100644 --- a/server/src/com/cloud/api/query/QueryManagerImpl.java +++ b/server/src/com/cloud/api/query/QueryManagerImpl.java @@ -25,12 +25,9 @@ import java.util.Set; import javax.ejb.Local; import javax.inject.Inject; -import javax.naming.ConfigurationException; -import org.apache.cloudstack.affinity.AffinityGroup; import org.apache.cloudstack.affinity.AffinityGroupResponse; import org.apache.cloudstack.affinity.AffinityGroupVMMapVO; -import org.apache.cloudstack.affinity.AffinityGroupVO; import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao; import org.apache.cloudstack.api.command.admin.host.ListHostsCmd; import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd; @@ -111,7 +108,6 @@ import com.cloud.api.query.vo.UserAccountJoinVO; import com.cloud.api.query.vo.UserVmJoinVO; import com.cloud.api.query.vo.VolumeJoinVO; import com.cloud.configuration.dao.ConfigurationDao; -import com.cloud.dc.DataCenterVO; import com.cloud.domain.Domain; import com.cloud.domain.DomainVO; import com.cloud.domain.dao.DomainDao; @@ -124,9 +120,9 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.network.security.SecurityGroupVMMapVO; import com.cloud.network.security.dao.SecurityGroupVMMapDao; import com.cloud.org.Grouping; -import com.cloud.projects.ProjectInvitation; -import com.cloud.projects.Project.ListProjectResourcesCriteria; import com.cloud.projects.Project; +import com.cloud.projects.Project.ListProjectResourcesCriteria; +import com.cloud.projects.ProjectInvitation; import com.cloud.projects.ProjectManager; import com.cloud.projects.dao.ProjectAccountDao; import com.cloud.projects.dao.ProjectDao; @@ -142,10 +138,8 @@ import com.cloud.user.dao.AccountDao; import com.cloud.utils.DateUtil; import com.cloud.utils.Pair; import com.cloud.utils.Ternary; -import com.cloud.utils.component.Manager; import com.cloud.utils.component.ManagerBase; import com.cloud.utils.db.Filter; -import com.cloud.utils.db.JoinBuilder; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria.Func; @@ -1699,6 +1693,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { sb.and("typeNEQ", sb.entity().getType(), SearchCriteria.Op.NEQ); sb.and("idNEQ", sb.entity().getId(), SearchCriteria.Op.NEQ); + if (listForDomain && isRecursive) { sb.and("path", sb.entity().getDomainPath(), SearchCriteria.Op.LIKE); } diff --git a/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java index 51ac5e61edb..796ae54d52f 100644 --- a/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java +++ b/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java @@ -20,17 +20,16 @@ import java.util.List; import javax.ejb.Local; +import org.apache.cloudstack.api.response.AccountResponse; +import org.apache.cloudstack.api.response.UserResponse; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.api.ApiDBUtils; import com.cloud.api.query.ViewResponseHelper; import com.cloud.api.query.vo.AccountJoinVO; import com.cloud.api.query.vo.UserAccountJoinVO; import com.cloud.configuration.Resource.ResourceType; -import org.apache.cloudstack.api.response.AccountResponse; -import org.apache.cloudstack.api.response.UserResponse; -import org.springframework.stereotype.Component; - import com.cloud.user.Account; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; @@ -66,6 +65,7 @@ public class AccountJoinDaoImpl extends GenericDaoBase impl accountResponse.setState(account.getState().toString()); accountResponse.setNetworkDomain(account.getNetworkDomain()); accountResponse.setDefaultZone(account.getDataCenterUuid()); + accountResponse.setIsDefault(account.isDefault()); // get network stat accountResponse.setBytesReceived(account.getBytesReceived()); diff --git a/server/src/com/cloud/api/query/dao/UserAccountJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/UserAccountJoinDaoImpl.java index 7072324080d..43b3a2d0a1f 100644 --- a/server/src/com/cloud/api/query/dao/UserAccountJoinDaoImpl.java +++ b/server/src/com/cloud/api/query/dao/UserAccountJoinDaoImpl.java @@ -80,6 +80,7 @@ public class UserAccountJoinDaoImpl extends GenericDaoBase Date: Wed, 17 Apr 2013 16:59:03 -0400 Subject: [PATCH 05/30] Removing the VMware template upgrade step from the 4.0.x to 4.1.0 upgrade process, as it's actually only needed from 3.x --- docs/en-US/Release_Notes.xml | 88 +----------------------------------- 1 file changed, 1 insertion(+), 87 deletions(-) diff --git a/docs/en-US/Release_Notes.xml b/docs/en-US/Release_Notes.xml index 97531afe5cd..f243a26cce2 100644 --- a/docs/en-US/Release_Notes.xml +++ b/docs/en-US/Release_Notes.xml @@ -4112,7 +4112,7 @@ under the License. If you run into any issues during upgrades, please feel free to ask questions on users@apache.cloudstack.org or dev@apache.cloudstack.org.
Upgrade from 4.0.x to 4.1.0 - This section will guide you from Apache CloudStack 4.0.x versions to &PRODUCT; 4.1.0. + This section will guide you from &PRODUCT; 4.0.x versions to &PRODUCT; 4.1.0. Any steps that are hypervisor-specific will be called out with a note. Package Structure Changes The package structure for &PRODUCT; has changed significantly since the 4.0.x releases. If you've compiled your own packages, you'll notice that the package names and the number of packages has changed. This is not a bug. @@ -4125,92 +4125,6 @@ under the License. Create RPM or Debian packages (as appropriate) and a repository from the 4.1.0 source, or check the Apache CloudStack downloads page at http://cloudstack.apache.org/downloads.html for package repositories supplied by community members. You will need them for step or step . Instructions for creating packages from the &PRODUCT; source are in the Installation Guide. - - For VMware Only - This step is only required if you are using VMware. You can safely skip this step if you are using KVM and/or Xen only. - - In each zone that includes VMware hosts, you need to add a new system VM template. - - - While running the existing 3.0.2 system, log in to the UI as root administrator. - - - In the left navigation bar, click Templates. - - - In Select view, click Templates. - - - Click Register template. - The Register template dialog box is displayed. - - - In the Register template dialog box, specify the following values (do not change these): - - - - - - - Field - Value - - - - - Name - systemvm-vmware-4.1 - - - Description - systemvm-vmware-4.1 - - - URL - http://download.cloud.com/templates/burbank/burbank-systemvm-08012012.ova - - - Zone - Choose the zone where this hypervisor is used - - - Hypervisor - VMware - - - Format - OVA - - - OS Type - Debian GNU/Linux 5.0 (32-bit) - - - Extractable - no - - - Password Enabled - no - - - Public - no - - - Featured - no - - - - - - - Watch the screen to be sure that the template downloads successfully and enters - the READY state. Do not proceed until this is successful. - - - Stop your management server or servers. Run this on all management server hosts: # service cloud-management stop From 112446602d119a7599e7077831ea73892d889a66 Mon Sep 17 00:00:00 2001 From: Prachi Damle Date: Wed, 17 Apr 2013 14:59:04 -0700 Subject: [PATCH 06/30] (CLOUDSTACK-2068) Anti-Affinity - When Vm deployment associated with anity-affinity group fails , it is still included in the vmlist of the anti-affiity group Changes: - Added removal of the groups association when VM reaches 'Error' state. --- .../org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java | 2 +- .../apache/cloudstack/affinity/AffinityGroupServiceImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java index 30f03b88995..08f94570ee8 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java @@ -95,7 +95,7 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd { @Parameter(name=ApiConstants.DETAILS, type=CommandType.LIST, collectionType=CommandType.STRING, description="comma separated list of host details requested, " + - "value can be a list of [all, group, nics, stats, secgrp, tmpl, servoff, iso, volume, min]." + + "value can be a list of [all, group, nics, stats, secgrp, tmpl, servoff, iso, volume, min, affgrp]." + " If no parameter is passed in, the details will be defaulted to all" ) private List viewDetails; diff --git a/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java b/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java index 2b490efe6e5..fc2cfcf8d95 100644 --- a/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java +++ b/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java @@ -295,7 +295,7 @@ public class AffinityGroupServiceImpl extends ManagerBase implements AffinityGro if (!status) { return false; } - if ((newState == State.Expunging)) { + if ((newState == State.Expunging) || (newState == State.Error)) { // cleanup all affinity groups associations of the Expunged VM SearchCriteria sc = _affinityGroupVMMapDao.createSearchCriteria(); sc.addAnd("instanceId", SearchCriteria.Op.EQ, vo.getId()); From 11162f5917ab194f85e41bca7b3dc39bd3bbaeef Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Wed, 17 Apr 2013 15:04:36 -0700 Subject: [PATCH 07/30] Removed set() methods from IpAddress related interfaces --- api/src/com/cloud/network/IpAddress.java | 9 --------- api/src/com/cloud/network/PublicIpAddress.java | 3 --- .../src/com/cloud/network/addr/PublicIp.java | 18 +----------------- .../src/com/cloud/network/dao/IPAddressVO.java | 2 -- 4 files changed, 1 insertion(+), 31 deletions(-) diff --git a/api/src/com/cloud/network/IpAddress.java b/api/src/com/cloud/network/IpAddress.java index fce8f38c2f2..71c9b4e0bf3 100644 --- a/api/src/com/cloud/network/IpAddress.java +++ b/api/src/com/cloud/network/IpAddress.java @@ -78,16 +78,7 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity boolean getSystem(); - /** - * @return - */ Long getVpcId(); - /** - * @param vpcId - */ - void setVpcId(Long vpcId); String getVmIp(); - void setVmIp(String vmIp); - } diff --git a/api/src/com/cloud/network/PublicIpAddress.java b/api/src/com/cloud/network/PublicIpAddress.java index d81e9c1ee6c..916d43428e9 100644 --- a/api/src/com/cloud/network/PublicIpAddress.java +++ b/api/src/com/cloud/network/PublicIpAddress.java @@ -30,7 +30,4 @@ public interface PublicIpAddress extends ControlledEntity, IpAddress, Vlan, Inte public String getNetmask(); public String getGateway(); - - @Override - public String getVlanTag(); } diff --git a/server/src/com/cloud/network/addr/PublicIp.java b/server/src/com/cloud/network/addr/PublicIp.java index 8217e4e47b9..25e9d308b14 100644 --- a/server/src/com/cloud/network/addr/PublicIp.java +++ b/server/src/com/cloud/network/addr/PublicIp.java @@ -194,23 +194,12 @@ public class PublicIp implements PublicIpAddress { public boolean getSystem() { return _addr.getSystem(); } - - /* (non-Javadoc) - * @see com.cloud.network.IpAddress#getVpcId() - */ + @Override public Long getVpcId() { return _addr.getVpcId(); } - /* (non-Javadoc) - * @see com.cloud.network.IpAddress#setVpcId(java.lang.Long) - */ - @Override - public void setVpcId(Long vpcId) { - _addr.setVpcId(vpcId); - } - @Override public String getIp6Gateway() { return _vlan.getIp6Gateway(); @@ -230,9 +219,4 @@ public class PublicIp implements PublicIpAddress { public String getVmIp() { return _addr.getVmIp(); } - - @Override - public void setVmIp(String vmIp) { - _addr.setVmIp(vmIp); - } } diff --git a/server/src/com/cloud/network/dao/IPAddressVO.java b/server/src/com/cloud/network/dao/IPAddressVO.java index 8ce8d3382b2..c5c78e557ae 100644 --- a/server/src/com/cloud/network/dao/IPAddressVO.java +++ b/server/src/com/cloud/network/dao/IPAddressVO.java @@ -292,7 +292,6 @@ public class IPAddressVO implements IpAddress { return vpcId; } - @Override public void setVpcId(Long vpcId) { this.vpcId = vpcId; } @@ -302,7 +301,6 @@ public class IPAddressVO implements IpAddress { return vmIp; } - @Override public void setVmIp(String vmIp) { this.vmIp = vmIp; } From 7182a939a89b50280ec374f8a295e71837b71e3a Mon Sep 17 00:00:00 2001 From: Chip Childers Date: Wed, 17 Apr 2013 20:47:11 -0400 Subject: [PATCH 08/30] Initial pass at RPM upgrade instructions from 4.0.x to 4.1.0 Signed-off-by: Chip Childers --- docs/en-US/Release_Notes.xml | 45 ++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/docs/en-US/Release_Notes.xml b/docs/en-US/Release_Notes.xml index f243a26cce2..d51e9fbae25 100644 --- a/docs/en-US/Release_Notes.xml +++ b/docs/en-US/Release_Notes.xml @@ -4201,10 +4201,51 @@ under the License. - The package names have changed between 4.0 and 4.1, so upgrading the packages won't happen automatically with a yum update + If you are using CentOS or RHEL, follow this procedure to upgrade your packages. If not, skip to step . + Community Packages + This section assumes you're using the community supplied packages for &PRODUCT;. If you've created your own packages and yum repository, substitute your own URL for the ones used in these examples. + + + + The first order of business will be to change the yum repository for each system with &PRODUCT; packages. This means all management servers, and any hosts that have the KVM agent. (No changes should be necessary for hosts that are running VMware or Xen.) + Start by opening /etc/yum.repos.d/cloudstack.repo on any systems that have &PRODUCT; packages installed. + This file should have content similar to the following: + +[apache-cloudstack] +name=Apache CloudStack +baseurl=http://cloudstack.apt-get.eu/rhel/4.0/ +enabled=1 +gpgcheck=0 + + If you are using the community provided package repository, change the baseurl to http://cloudstack.apt-get.eu/rhel/4.1/ + If you're using your own package repository, change this line to read as appropriate for your 4.1.0 repository. + + + Now that you have the repository configured, it's time to install the cloudstack-management package. This will pull in any other dependencies you need. + $ sudo yum install cloudstack-management + + + For KVM hosts, you will need to upgrade the cloudstack-agent package: + $ sudo yum install cloudstack-agent + During the installation of cloudstack-agent, the RPM will copy your agent.properties, log4j-cloud.xml, and environment.properties from /etc/cloud/agent to /etc/cloudstack/agent. + + + Verify that the file /etc/cloudstack/agent/environment.properties has a line that reads: + paths.script=/usr/share/cloudstack-common + If not, add the line. + + + Restart the agent: + + service cloud-agent stop + killall jsvc + service cloudstack-agent start + + + - Once you've upgraded the packages on your management servers, you'll need to restart the system VMs. Make sure port 8096 is open to do this. + Once you've upgraded the packages on your management servers, you'll need to restart the system VMs. Make sure port 8096 is open in your local host firewall to do this. There is a script that will do this for you, all you need to do is run the script and supply the IP address for your MySQL instance and your MySQL credentials: # nohup cloudstack-sysvmadm -d IP address -u cloud -p -a > sysvm.log 2>&1 & You can monitor the log for progress. The process of restarting the system VMs can take an hour or more. From 6dccf63a3229eb48be5c2ff941a1550b7741764d Mon Sep 17 00:00:00 2001 From: Prachi Damle Date: Wed, 17 Apr 2013 17:46:06 -0700 Subject: [PATCH 09/30] set Objectname to CreateAffinityGroupResponse Object. Also the listAffinityGroups is missing the 'type' property --- server/src/com/cloud/api/ApiResponseHelper.java | 7 ++++++- .../cloud/api/query/dao/AffinityGroupJoinDaoImpl.java | 1 + .../com/cloud/api/query/vo/AffinityGroupJoinVO.java | 11 +++++++++++ setup/db/db/schema-410to420.sql | 1 + 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index 50d8de25702..819c88b8c1d 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -3664,8 +3664,13 @@ public class ApiResponseHelper implements ResponseGenerator { response.setName(group.getName()); response.setType(group.getType()); response.setDescription(group.getDescription()); - // response.setDomainId(account.) + Domain domain = ApiDBUtils.findDomainById(account.getDomainId()); + if (domain != null) { + response.setDomainId(domain.getUuid()); + response.setDomainName(domain.getName()); + } + response.setObjectName("affinitygroup"); return response; } diff --git a/server/src/com/cloud/api/query/dao/AffinityGroupJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/AffinityGroupJoinDaoImpl.java index a17679313d6..8743bcb2028 100644 --- a/server/src/com/cloud/api/query/dao/AffinityGroupJoinDaoImpl.java +++ b/server/src/com/cloud/api/query/dao/AffinityGroupJoinDaoImpl.java @@ -63,6 +63,7 @@ public class AffinityGroupJoinDaoImpl extends GenericDaoBase Date: Wed, 17 Apr 2013 17:48:52 -0700 Subject: [PATCH 10/30] CLOUDSTACK-2069: Anti-Affinity - listVirtualmachines - affinitygroup entity does not include other Vms that are part of this affinity group. Removed the virtualmachineIds:[] sent in the API response. The listVirtualMachines Resopnse need not list details beyond the id, name,description etc. If the user wants to get the list of VMs in the group, listAffinityGroups APi can be used. --- .../apache/cloudstack/affinity/AffinityGroupResponse.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/src/org/apache/cloudstack/affinity/AffinityGroupResponse.java b/api/src/org/apache/cloudstack/affinity/AffinityGroupResponse.java index afd33da84b7..b6d4ff64b31 100644 --- a/api/src/org/apache/cloudstack/affinity/AffinityGroupResponse.java +++ b/api/src/org/apache/cloudstack/affinity/AffinityGroupResponse.java @@ -64,7 +64,6 @@ public class AffinityGroupResponse extends BaseResponse implements ControlledVie private List vmIdList; public AffinityGroupResponse() { - this.vmIdList = new ArrayList(); } @Override @@ -149,6 +148,10 @@ public class AffinityGroupResponse extends BaseResponse implements ControlledVie } public void addVMId(String vmId) { + if (this.vmIdList == null) { + this.vmIdList = new ArrayList(); + } + this.vmIdList.add(vmId); } From e03176c4d47d4c109f935beceb557e0c2de9a6c6 Mon Sep 17 00:00:00 2001 From: Prachi Damle Date: Wed, 17 Apr 2013 18:03:34 -0700 Subject: [PATCH 11/30] Apart from the UUID, we need not log any other details for AffinityGroup in error messages. --- .../apache/cloudstack/api/command/user/vm/DeployVMCmd.java | 5 ++--- .../src/org/apache/cloudstack/affinity/AffinityGroupVO.java | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java index 77ba9fed59e..70c0159dffe 100755 --- a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java @@ -230,7 +230,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd { for (String groupName : securityGroupNameList) { Long groupId = _responseGenerator.getSecurityGroupId(groupName, getEntityOwnerId()); if (groupId == null) { - throw new InvalidParameterValueException("Unable to find group by name " + groupName + " for account " + getEntityOwnerId()); + throw new InvalidParameterValueException("Unable to find group by name " + groupName); } else { securityGroupIds.add(groupId); } @@ -344,8 +344,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd { for (String groupName : affinityGroupNameList) { Long groupId = _responseGenerator.getAffinityGroupId(groupName, getEntityOwnerId()); if (groupId == null) { - throw new InvalidParameterValueException("Unable to find group by name " + groupName - + " for account " + getEntityOwnerId()); + throw new InvalidParameterValueException("Unable to find affinity group by name " + groupName); } else { affinityGroupIds.add(groupId); } diff --git a/server/src/org/apache/cloudstack/affinity/AffinityGroupVO.java b/server/src/org/apache/cloudstack/affinity/AffinityGroupVO.java index b6c4a027484..f418cefd781 100644 --- a/server/src/org/apache/cloudstack/affinity/AffinityGroupVO.java +++ b/server/src/org/apache/cloudstack/affinity/AffinityGroupVO.java @@ -107,7 +107,7 @@ public class AffinityGroupVO implements AffinityGroup { @Override public String toString() { StringBuilder buf = new StringBuilder("AffinityGroup["); - buf.append(id).append("|").append(name).append("|").append(type).append("]"); + buf.append(uuid).append("]"); return buf.toString(); } From b12905b7a828a0766a521ca9859158d4356405ed Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Thu, 18 Apr 2013 07:44:25 +0530 Subject: [PATCH 12/30] pep8 compliance for cloudstackConnection Signed-off-by: Prasanna Santhanam --- .../integration/smoke/test_public_ip_range.py | 2 +- tools/marvin/marvin/cloudstackConnection.py | 92 ++++++++++++------- 2 files changed, 58 insertions(+), 36 deletions(-) diff --git a/test/integration/smoke/test_public_ip_range.py b/test/integration/smoke/test_public_ip_range.py index a7aad6b795c..7c965ea1d94 100644 --- a/test/integration/smoke/test_public_ip_range.py +++ b/test/integration/smoke/test_public_ip_range.py @@ -49,7 +49,7 @@ class Services: "endip": "10.102.197.73", "zoneid": "1", "podid": "", - "vlan": "101", + "vlan": "4444", } class TesDedicatePublicIPRange(cloudstackTestCase): diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py index 5fd3e1226a4..14b12e7910b 100644 --- a/tools/marvin/marvin/cloudstackConnection.py +++ b/tools/marvin/marvin/cloudstackConnection.py @@ -5,9 +5,9 @@ # 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 @@ -22,16 +22,20 @@ import hmac import hashlib import time import cloudstackException -from cloudstackAPI import * +from cloudstackAPI import * import jsonHelper from requests import ConnectionError from requests import HTTPError from requests import Timeout from requests import RequestException + class cloudConnection(object): - def __init__(self, mgtSvr, port=8096, apiKey=None, securityKey=None, asyncTimeout=3600, logging=None, - scheme='http', path='client/api'): + """ Connections to make API calls to the cloudstack management server + """ + def __init__(self, mgtSvr, port=8096, apiKey=None, securityKey=None, + asyncTimeout=3600, logging=None, scheme='http', + path='client/api'): self.apiKey = apiKey self.securityKey = securityKey self.mgtSvr = mgtSvr @@ -42,16 +46,18 @@ class cloudConnection(object): self.asyncTimeout = asyncTimeout self.auth = True if port == 8096 or \ - (self.apiKey == None and self.securityKey == None): + (self.apiKey is None and self.securityKey is None): self.auth = False if scheme not in ['http', 'https']: raise RequestException("Protocol must be HTTP") self.protocol = scheme - self.baseurl = "%s://%s:%d/%s"%(self.protocol, self.mgtSvr, self.port, self.path) + self.baseurl = "%s://%s:%d/%s"\ + % (self.protocol, self.mgtSvr, self.port, self.path) def __copy__(self): - return cloudConnection(self.mgtSvr, self.port, self.apiKey, self.securityKey, self.asyncTimeout, - self.logging, self.protocol, self.path) + return cloudConnection(self.mgtSvr, self.port, self.apiKey, + self.securityKey, self.asyncTimeout, + self.logging, self.protocol, self.path) def poll(self, jobid, response): """ @@ -68,16 +74,19 @@ class cloudConnection(object): asyncResonse = self.marvin_request(cmd, response_type=response) if asyncResonse.jobstatus == 2: - raise cloudstackException.cloudstackAPIException("asyncquery", asyncResonse.jobresult) + raise cloudstackException.cloudstackAPIException( + "asyncquery", asyncResonse.jobresult) elif asyncResonse.jobstatus == 1: return asyncResonse time.sleep(5) if self.logging is not None: - self.logging.debug("job: %s still processing, will timeout in %ds"%(jobid, timeout)) + self.logging.debug("job: %s still processing," + " will timeout in %ds" % (jobid, timeout)) timeout = timeout - 5 - raise cloudstackException.cloudstackAPIException("asyncquery", "Async job timeout %s"%jobid) + raise cloudstackException.cloudstackAPIException( + "asyncquery", "Async job timeout %s" % jobid) def sign(self, payload): """ @@ -90,19 +99,26 @@ class cloudConnection(object): params.sort(key=lambda k: str.lower(k[0])) hashStr = "&".join( ["=".join( - [str.lower(r[0]), str.lower(urllib.quote_plus(str(r[1]))).replace("+", "%20")] + [str.lower(r[0]), + str.lower( + urllib.quote_plus(str(r[1])) + ).replace("+", "%20")] ) for r in params] ) - signature = base64.encodestring(hmac.new(self.securityKey, hashStr, hashlib.sha1).digest()).strip() - self.logging.info("Computed Signature by Marvin: %s"%signature) + signature = base64.encodestring(hmac.new( + self.securityKey, hashStr, hashlib.sha1).digest()).strip() + self.logging.info("Computed Signature by Marvin: %s" % signature) return signature def request(self, command, auth=True, payload={}, data={}): """ - Makes requests on the `integration.api.port` - @param command: cloudstack API command name eg: deployVirtualMachineCommand - @param auth: Authentication (apikey,secretKey) => True, else False - @param payload: GET param data composed as a dictionary of key,value pairs + Makes requests using auth or over integration port + @param command: cloudstack API command name + eg: deployVirtualMachineCommand + @param auth: Authentication (apikey,secretKey) => True + else False for integration.api.port + @param payload: GET param data composed as a dictionary + of key,value pairs @param data: POST data as a dictionary @return: """ @@ -114,23 +130,24 @@ class cloudConnection(object): signature = self.sign(payload) payload["signature"] = signature - try: if data: - response = requests.get(self.baseurl, params=payload, data=data) + response = requests.get(self.baseurl, params=payload, + data=data) else: response = requests.get(self.baseurl, params=payload) except ConnectionError, c: - self.logging.debug("Connection refused. Reason: %s"%(self.baseurl, c)) + self.logging.debug("Connection refused. Reason: %s" % + (self.baseurl, c)) raise c except HTTPError, h: - self.logging.debug("Server returned error code: %s"%h) + self.logging.debug("Server returned error code: %s" % h) raise h except Timeout, t: - self.logging.debug("Connection timed out with %s"%t) + self.logging.debug("Connection timed out with %s" % t) raise t - except RequestException,r: - self.logging.debug("Error returned by server %s"%r) + except RequestException, r: + self.logging.debug("Error returned by server %s" % r) raise r else: return response @@ -144,7 +161,8 @@ class cloudConnection(object): requests = {} required = [] for attribute in dir(cmd): - if attribute != "__doc__" and attribute != "__init__" and attribute != "__module__": + if attribute != "__doc__" and attribute != "__init__" and \ + attribute != "__module__": if attribute == "isAsync": isAsync = getattr(cmd, attribute) elif attribute == "required": @@ -155,7 +173,8 @@ class cloudConnection(object): cmdname = cmd.__class__.__name__.replace("Cmd", "") for requiredPara in required: if requests[requiredPara] is None: - raise cloudstackException.cloudstackAPIException(cmdname, "%s is required"%requiredPara) + raise cloudstackException.cloudstackAPIException( + cmdname, "%s is required" % requiredPara) for param, value in requests.items(): if value is None: requests.pop(param) @@ -169,8 +188,8 @@ class cloudConnection(object): requests.pop(param) i = 0 for val in value: - for k,v in val.iteritems(): - requests["%s[%d].%s"%(param,i,k)] = v + for k, v in val.iteritems(): + requests["%s[%d].%s" % (param, i, k)] = v i = i + 1 return cmdname, isAsync, requests @@ -184,14 +203,17 @@ class cloudConnection(object): @return: """ cmdname, isAsync, payload = self.sanitize_command(cmd) - self.logging.info("sending command: %s %s"%(cmdname, str(payload))) + self.logging.info("sending command: %s %s" % (cmdname, str(payload))) if self.auth: - response = self.request(cmdname, auth=True, payload=payload, data=data) + response = self.request( + cmdname, auth=True, payload=payload, data=data) else: - response = self.request(cmdname, auth=False, payload=payload, data=data) + response = self.request( + cmdname, auth=False, payload=payload, data=data) - self.logging.info("Request: %s Response: %s"%(response.url, response.text)) - response = jsonHelper.getResultObj(response.json, response_type) + self.logging.info("Request: %s Response: %s" % + (response.url, response.text)) + response = jsonHelper.getResultObj(response.json(), response_type) if isAsync == "false": return response From 985b2aa88d4d02db98a2e9be7ac081e4efbff879 Mon Sep 17 00:00:00 2001 From: Sanjay Tripathi Date: Wed, 17 Apr 2013 12:03:47 +0530 Subject: [PATCH 13/30] CLOUDSTACK-2046: Primary Storage & Secondary Storage is max limit is set 0 with listResourceLimits API response as ROOT admin Signed-off-by: Sateesh Chodapuneedi --- server/src/com/cloud/api/ApiResponseHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index 819c88b8c1d..7629e5e5e59 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -379,7 +379,7 @@ public class ApiResponseHelper implements ResponseGenerator { populateDomain(resourceLimitResponse, accountTemp.getDomainId()); } resourceLimitResponse.setResourceType(Integer.valueOf(limit.getType().getOrdinal()).toString()); - if(limit.getType() == ResourceType.primary_storage || limit.getType() == ResourceType.secondary_storage) { + if((limit.getType() == ResourceType.primary_storage || limit.getType() == ResourceType.secondary_storage) && limit.getMax() >= 0) { resourceLimitResponse.setMax((long) Math.ceil(limit.getMax()/ResourceType.bytesToGiB)); } else { resourceLimitResponse.setMax(limit.getMax()); From dfbe11355c40a5dbe022f022426c100c53428901 Mon Sep 17 00:00:00 2001 From: Mice Xia Date: Thu, 18 Apr 2013 14:56:44 +0800 Subject: [PATCH 14/30] fix CLOUDSTACK-2061 Hitting java NPE in addNicToVirtualMachine api when trying to add a shared network to a VM --- server/src/com/cloud/network/element/VirtualRouterElement.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/com/cloud/network/element/VirtualRouterElement.java b/server/src/com/cloud/network/element/VirtualRouterElement.java index 169db3283e3..f601f4fa2e4 100755 --- a/server/src/com/cloud/network/element/VirtualRouterElement.java +++ b/server/src/com/cloud/network/element/VirtualRouterElement.java @@ -876,8 +876,8 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl if (publicNetwork) { routers = _routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER); } else { - Long podId = dest.getPod().getId(); if (isPodBased) { + Long podId = dest.getPod().getId(); routers = _routerDao.listByNetworkAndPodAndRole(network.getId(), podId, Role.VIRTUAL_ROUTER); } else { routers = _routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER); From 96cf79535fb68881d7d191109ffa6d8f504e3136 Mon Sep 17 00:00:00 2001 From: Wido den Hollander Date: Thu, 18 Apr 2013 10:26:09 +0200 Subject: [PATCH 15/30] CLOUDSTACK-2033 Fix usage server logging under Debian and Ubuntu --- packaging/debian/replace.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/debian/replace.properties b/packaging/debian/replace.properties index 8c852060c02..5a0bd58ab67 100644 --- a/packaging/debian/replace.properties +++ b/packaging/debian/replace.properties @@ -57,6 +57,6 @@ SYSCONFDIR=/etc SYSTEMCLASSPATH= SYSTEMJARS= USAGECLASSPATH= -USAGELOG=/var/log/cloudstack/usage +USAGELOG=/var/log/cloudstack/usage/usage.log USAGESYSCONFDIR=/etc/cloudstack/usage PACKAGE=cloudstack From 34899f9b999e0d92573aa7b8872e07a111811b53 Mon Sep 17 00:00:00 2001 From: Isaac Chiang Date: Thu, 18 Apr 2013 21:19:00 +0530 Subject: [PATCH 16/30] CLOUDSTACK-2077:The updatePhysicalNetwork command fails to update the database --- server/src/com/cloud/network/NetworkServiceImpl.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java index 12c6068925f..c4effc96271 100755 --- a/server/src/com/cloud/network/NetworkServiceImpl.java +++ b/server/src/com/cloud/network/NetworkServiceImpl.java @@ -2445,10 +2445,6 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { network.setVnet(vnetString); } - - - _physicalNetworkDao.update(id, network); - for (Pair vnetToAdd : vnetsToAdd) { s_logger.debug("Adding vnet range " + vnetToAdd.first() + "-" + vnetToAdd.second() + " for the physicalNetwork id= " + id + " and zone id=" + network.getDataCenterId() + " as a part of updatePhysicalNetwork call"); @@ -2456,6 +2452,8 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { } } + _physicalNetworkDao.update(id, network); + return network; } From 7023920d3459516e07ae674bf0d1eb2ebcb99b2c Mon Sep 17 00:00:00 2001 From: Chip Childers Date: Thu, 18 Apr 2013 12:06:50 -0400 Subject: [PATCH 17/30] Modifying some extra tabs that cause rendering silliness in the release notes Signed-off-by: Chip Childers --- docs/en-US/Release_Notes.xml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/en-US/Release_Notes.xml b/docs/en-US/Release_Notes.xml index d51e9fbae25..09cf2e2ac48 100644 --- a/docs/en-US/Release_Notes.xml +++ b/docs/en-US/Release_Notes.xml @@ -4181,17 +4181,17 @@ under the License. Restart the agent: - service cloud-agent stop - killall jsvc - service cloudstack-agent start +service cloud-agent stop +killall jsvc +service cloudstack-agent start During the upgrade, log4j-cloud.xml was simply copied over, so the logs will continue to be added to /var/log/cloud/agent/agent.log. There's nothing wrong with this, but if you prefer to be consistent, you can change this by copying over the sample configuration file: - cd /etc/cloudstack/agent - mv log4j-cloud.xml.dpkg-dist log4j-cloud.xml - service cloudstack-agent restart +cd /etc/cloudstack/agent +mv log4j-cloud.xml.dpkg-dist log4j-cloud.xml +service cloudstack-agent restart @@ -4237,9 +4237,9 @@ gpgcheck=0 Restart the agent: - service cloud-agent stop - killall jsvc - service cloudstack-agent start +service cloud-agent stop +killall jsvc +service cloudstack-agent start @@ -4252,12 +4252,12 @@ gpgcheck=0 # tail -f sysvm.log The output to sysvm.log will look something like this: - Stopping and starting 1 secondary storage vm(s)... - Done stopping and starting secondary storage vm(s) - Stopping and starting 1 console proxy vm(s)... - Done stopping and starting console proxy vm(s). - Stopping and starting 4 running routing vm(s)... - Done restarting router(s). +Stopping and starting 1 secondary storage vm(s)... +Done stopping and starting secondary storage vm(s) +Stopping and starting 1 console proxy vm(s)... +Done stopping and starting console proxy vm(s). +Stopping and starting 4 running routing vm(s)... +Done restarting router(s). From bf120917f99df0e3d03d50f619ea5809f4c914c4 Mon Sep 17 00:00:00 2001 From: Chip Childers Date: Thu, 18 Apr 2013 12:12:02 -0400 Subject: [PATCH 18/30] Removing inappropriate note about an upgrade *to* 3.0.2 in the *from* 3.0.2 section of the release notes Signed-off-by: Chip Childers --- docs/en-US/Release_Notes.xml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/docs/en-US/Release_Notes.xml b/docs/en-US/Release_Notes.xml index 09cf2e2ac48..28102697583 100644 --- a/docs/en-US/Release_Notes.xml +++ b/docs/en-US/Release_Notes.xml @@ -4272,15 +4272,6 @@ Done restarting router(s). Upgrade from 3.0.2 to 4.1.0 This section will guide you from Citrix CloudStack 3.0.2 to Apache CloudStack 4.1.0. Sections that are hypervisor-specific will be called out with a note. - - Ensure that you query your IP address usage records and process them or make a - backup. During the upgrade you will lose the old IP address usage records. - Starting in 3.0.2, the usage record format for IP addresses is the same as the rest - of the usage types. Instead of a single record with the assignment and release dates, - separate records are generated per aggregation period with start and end dates. After - upgrading, any existing IP address usage records in the old format will no longer be - available. - The following upgrade instructions apply only if you're using VMware hosts. If From f4240e1cea58be0ea7b50c77a018d7c63e3faf15 Mon Sep 17 00:00:00 2001 From: Chip Childers Date: Thu, 18 Apr 2013 12:25:26 -0400 Subject: [PATCH 19/30] Adding RPM and DEB upgrade steps from 3.0.2 to 4.1.0 in release notes Signed-off-by: Chip Childers --- docs/en-US/Release_Notes.xml | 114 ++++++++++++++++++++++++++++++----- 1 file changed, 99 insertions(+), 15 deletions(-) diff --git a/docs/en-US/Release_Notes.xml b/docs/en-US/Release_Notes.xml index 28102697583..b07b5842bc5 100644 --- a/docs/en-US/Release_Notes.xml +++ b/docs/en-US/Release_Notes.xml @@ -4382,23 +4382,107 @@ Done restarting router(s). the community provided yum/apt repositories to gain access to the &PRODUCT; binaries. - - After you have configured an appropriate yum or apt repository, you may execute the - one of the following commands as appropriate for your environment in order to upgrade - &PRODUCT;: # yum update cloud-* - # apt-get update - # apt-get upgrade cloud-* - - You will, of course, have to agree to the changes suggested by Yum or APT. - - If the upgrade output includes a message similar to the following, then some - custom content was found in your old components.xml, and you need to merge the two - files: - warning: /etc/cloud/management/components.xml created as /etc/cloud/management/components.xml.rpmnew - Instructions follow in the next step. + + If you are using Ubuntu, follow this procedure to upgrade your packages. If not, skip to step . + Community Packages + This section assumes you're using the community supplied packages for &PRODUCT;. If you've created your own packages and APT repository, substitute your own URL for the ones used in these examples. + + + The first order of business will be to change the sources list for each system with &PRODUCT; packages. This means all management servers, and any hosts that have the KVM agent. (No changes should be necessary for hosts that are running VMware or Xen.) + Start by opening /etc/apt/sources.list.d/cloudstack.list on any systems that have &PRODUCT; packages installed. + This file should have one line, which contains: + deb http://cloudstack.apt-get.eu/ubuntu precise 4.0 + We'll change it to point to the new package repository: + deb http://cloudstack.apt-get.eu/ubuntu precise 4.1 + If you're using your own package repository, change this line to read as appropriate for your 4.1.0 repository. + + + Now update your apt package list: + $ sudo apt-get update + + + Now that you have the repository configured, it's time to install the cloudstack-management package. This will pull in any other dependencies you need. + $ sudo apt-get install cloudstack-management + + + You will need to manually install the cloudstack-agent package: + $ sudo apt-get install cloudstack-agent + During the installation of cloudstack-agent, APT will copy your agent.properties, log4j-cloud.xml, and environment.properties from /etc/cloud/agent to /etc/cloudstack/agent. + When prompted whether you wish to keep your configuration, say Yes. + + + Verify that the file /etc/cloudstack/agent/environment.properties has a line that reads: + paths.script=/usr/share/cloudstack-common + If not, add the line. + + + Restart the agent: + +service cloud-agent stop +killall jsvc +service cloudstack-agent start + + + + During the upgrade, log4j-cloud.xml was simply copied over, so the logs will continue to be added to /var/log/cloud/agent/agent.log. There's nothing wrong with this, but if you prefer to be consistent, you can change this by copying over the sample configuration file: + +cd /etc/cloudstack/agent +mv log4j-cloud.xml.dpkg-dist log4j-cloud.xml +service cloudstack-agent restart + + + + Once the agent is running, you can uninstall the old cloud-* packages from your system: + sudo dpkg --purge cloud-agent + + - + + If you are using CentOS or RHEL, follow this procedure to upgrade your packages. If not, skip to step . + Community Packages + This section assumes you're using the community supplied packages for &PRODUCT;. If you've created your own packages and yum repository, substitute your own URL for the ones used in these examples. + + + + The first order of business will be to change the yum repository for each system with &PRODUCT; packages. This means all management servers, and any hosts that have the KVM agent. (No changes should be necessary for hosts that are running VMware or Xen.) + Start by opening /etc/yum.repos.d/cloudstack.repo on any systems that have &PRODUCT; packages installed. + This file should have content similar to the following: + +[apache-cloudstack] +name=Apache CloudStack +baseurl=http://cloudstack.apt-get.eu/rhel/4.0/ +enabled=1 +gpgcheck=0 + + If you are using the community provided package repository, change the baseurl to http://cloudstack.apt-get.eu/rhel/4.1/ + If you're using your own package repository, change this line to read as appropriate for your 4.1.0 repository. + + + Now that you have the repository configured, it's time to install the cloudstack-management package. This will pull in any other dependencies you need. + $ sudo yum install cloudstack-management + + + For KVM hosts, you will need to upgrade the cloudstack-agent package: + $ sudo yum install cloudstack-agent + During the installation of cloudstack-agent, the RPM will copy your agent.properties, log4j-cloud.xml, and environment.properties from /etc/cloud/agent to /etc/cloudstack/agent. + + + Verify that the file /etc/cloudstack/agent/environment.properties has a line that reads: + paths.script=/usr/share/cloudstack-common + If not, add the line. + + + Restart the agent: + +service cloud-agent stop +killall jsvc +service cloudstack-agent start + + + + + If you have made changes to your copy of /etc/cloud/management/components.xml the changes will be preserved in the upgrade. However, you need to do the following steps to place these From 31531fa9a6662ef523bdb2e66ee961ae23093bf9 Mon Sep 17 00:00:00 2001 From: Chip Childers Date: Thu, 18 Apr 2013 12:48:41 -0400 Subject: [PATCH 20/30] Switched to yum upgrade vs yum install for RPM upgrade instructions Signed-off-by: Chip Childers --- docs/en-US/Release_Notes.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/en-US/Release_Notes.xml b/docs/en-US/Release_Notes.xml index b07b5842bc5..d5311e47fa8 100644 --- a/docs/en-US/Release_Notes.xml +++ b/docs/en-US/Release_Notes.xml @@ -4221,12 +4221,12 @@ gpgcheck=0 If you're using your own package repository, change this line to read as appropriate for your 4.1.0 repository. - Now that you have the repository configured, it's time to install the cloudstack-management package. This will pull in any other dependencies you need. - $ sudo yum install cloudstack-management + Now that you have the repository configured, it's time to install the cloudstack-management package by upgrading the older cloud-client package. + $ sudo yum upgrade cloud-client - For KVM hosts, you will need to upgrade the cloudstack-agent package: - $ sudo yum install cloudstack-agent + For KVM hosts, you will need to upgrade the cloud-agent package, similarly installing the new version as cloudstack-agent. + $ sudo yum upgrade cloud-agent During the installation of cloudstack-agent, the RPM will copy your agent.properties, log4j-cloud.xml, and environment.properties from /etc/cloud/agent to /etc/cloudstack/agent. @@ -4459,12 +4459,12 @@ gpgcheck=0 If you're using your own package repository, change this line to read as appropriate for your 4.1.0 repository. - Now that you have the repository configured, it's time to install the cloudstack-management package. This will pull in any other dependencies you need. - $ sudo yum install cloudstack-management + Now that you have the repository configured, it's time to install the cloudstack-management package by upgrading the older cloud-client package. + $ sudo yum upgrade cloud-client - For KVM hosts, you will need to upgrade the cloudstack-agent package: - $ sudo yum install cloudstack-agent + For KVM hosts, you will need to upgrade the cloud-agent package, similarly installing the new version as cloudstack-agent. + $ sudo yum upgrade cloud-agent During the installation of cloudstack-agent, the RPM will copy your agent.properties, log4j-cloud.xml, and environment.properties from /etc/cloud/agent to /etc/cloudstack/agent. From 7a4f70ff16706c17d1b408f48d72a7e0387cde08 Mon Sep 17 00:00:00 2001 From: Chip Childers Date: Thu, 18 Apr 2013 12:54:59 -0400 Subject: [PATCH 21/30] Adding 2.2 to 4.1 upgrade instructions for RPM and DEB to release notes Signed-off-by: Chip Childers --- docs/en-US/Release_Notes.xml | 109 ++++++++++++++++++++++++++++++++--- 1 file changed, 100 insertions(+), 9 deletions(-) diff --git a/docs/en-US/Release_Notes.xml b/docs/en-US/Release_Notes.xml index d5311e47fa8..60209f660d5 100644 --- a/docs/en-US/Release_Notes.xml +++ b/docs/en-US/Release_Notes.xml @@ -4912,16 +4912,107 @@ service cloudstack-agent start the community provided yum/apt repositories to gain access to the &PRODUCT; binaries. - - After you have configured an appropriate yum or apt repository, you may execute the - one of the following commands as appropriate for your environment in order to upgrade - &PRODUCT;: # yum update cloud-* - # apt-get update - # apt-get upgrade cloud-* - - You will, of course, have to agree to the changes suggested by Yum or APT. + + If you are using Ubuntu, follow this procedure to upgrade your packages. If not, skip to step . + Community Packages + This section assumes you're using the community supplied packages for &PRODUCT;. If you've created your own packages and APT repository, substitute your own URL for the ones used in these examples. + + + + The first order of business will be to change the sources list for each system with &PRODUCT; packages. This means all management servers, and any hosts that have the KVM agent. (No changes should be necessary for hosts that are running VMware or Xen.) + Start by opening /etc/apt/sources.list.d/cloudstack.list on any systems that have &PRODUCT; packages installed. + This file should have one line, which contains: + deb http://cloudstack.apt-get.eu/ubuntu precise 4.0 + We'll change it to point to the new package repository: + deb http://cloudstack.apt-get.eu/ubuntu precise 4.1 + If you're using your own package repository, change this line to read as appropriate for your 4.1.0 repository. + + + Now update your apt package list: + $ sudo apt-get update + + + Now that you have the repository configured, it's time to install the cloudstack-management package. This will pull in any other dependencies you need. + $ sudo apt-get install cloudstack-management + + + You will need to manually install the cloudstack-agent package: + $ sudo apt-get install cloudstack-agent + During the installation of cloudstack-agent, APT will copy your agent.properties, log4j-cloud.xml, and environment.properties from /etc/cloud/agent to /etc/cloudstack/agent. + When prompted whether you wish to keep your configuration, say Yes. + + + Verify that the file /etc/cloudstack/agent/environment.properties has a line that reads: + paths.script=/usr/share/cloudstack-common + If not, add the line. + + + Restart the agent: + +service cloud-agent stop +killall jsvc +service cloudstack-agent start + + + + During the upgrade, log4j-cloud.xml was simply copied over, so the logs will continue to be added to /var/log/cloud/agent/agent.log. There's nothing wrong with this, but if you prefer to be consistent, you can change this by copying over the sample configuration file: + +cd /etc/cloudstack/agent +mv log4j-cloud.xml.dpkg-dist log4j-cloud.xml +service cloudstack-agent restart + + + + Once the agent is running, you can uninstall the old cloud-* packages from your system: + sudo dpkg --purge cloud-agent + + - + + If you are using CentOS or RHEL, follow this procedure to upgrade your packages. If not, skip to step . + Community Packages + This section assumes you're using the community supplied packages for &PRODUCT;. If you've created your own packages and yum repository, substitute your own URL for the ones used in these examples. + + + + The first order of business will be to change the yum repository for each system with &PRODUCT; packages. This means all management servers, and any hosts that have the KVM agent. (No changes should be necessary for hosts that are running VMware or Xen.) + Start by opening /etc/yum.repos.d/cloudstack.repo on any systems that have &PRODUCT; packages installed. + This file should have content similar to the following: + +[apache-cloudstack] +name=Apache CloudStack +baseurl=http://cloudstack.apt-get.eu/rhel/4.0/ +enabled=1 +gpgcheck=0 + + If you are using the community provided package repository, change the baseurl to http://cloudstack.apt-get.eu/rhel/4.1/ + If you're using your own package repository, change this line to read as appropriate for your 4.1.0 repository. + + + Now that you have the repository configured, it's time to install the cloudstack-management package by upgrading the older cloud-client package. + $ sudo yum upgrade cloud-client + + + For KVM hosts, you will need to upgrade the cloud-agent package, similarly installing the new version as cloudstack-agent. + $ sudo yum upgrade cloud-agent + During the installation of cloudstack-agent, the RPM will copy your agent.properties, log4j-cloud.xml, and environment.properties from /etc/cloud/agent to /etc/cloudstack/agent. + + + Verify that the file /etc/cloudstack/agent/environment.properties has a line that reads: + paths.script=/usr/share/cloudstack-common + If not, add the line. + + + Restart the agent: + +service cloud-agent stop +killall jsvc +service cloudstack-agent start + + + + + If you have made changes to your existing copy of the file components.xml in your previous-version CloudStack installation, the changes will be preserved in the upgrade. However, you need to do the following steps to place these changes in a new version of From fca7b3ef22b00f6003fbb6fa601c9b7c1a79dcec Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Thu, 18 Apr 2013 10:38:03 -0700 Subject: [PATCH 22/30] Rename widget 'plugins' to 'pluginListing' For better clarity on its function, rename the 'plugins' widget to 'pluginListing,' as it does not handle the actual plugin logic. --- ui/index.jsp | 2 +- ui/scripts/plugins.js | 4 +--- ui/scripts/ui-custom/{plugins.js => pluginListing.js} | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) rename ui/scripts/ui-custom/{plugins.js => pluginListing.js} (98%) diff --git a/ui/index.jsp b/ui/index.jsp index 46f49f00984..550661e546a 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -1681,7 +1681,7 @@ under the License. - + diff --git a/ui/scripts/plugins.js b/ui/scripts/plugins.js index 5a33d56ef9f..d3e07055299 100644 --- a/ui/scripts/plugins.js +++ b/ui/scripts/plugins.js @@ -51,7 +51,7 @@ cloudStack.sections.plugins = { title: 'label.plugins', - show: cloudStack.uiCustom.plugins + show: cloudStack.uiCustom.pluginListing }; // Load plugins @@ -70,7 +70,5 @@ ui: pluginAPI }); }); - - // Load CSS }); }(jQuery, cloudStack, require)); diff --git a/ui/scripts/ui-custom/plugins.js b/ui/scripts/ui-custom/pluginListing.js similarity index 98% rename from ui/scripts/ui-custom/plugins.js rename to ui/scripts/ui-custom/pluginListing.js index aaf95319da1..3dcce983943 100644 --- a/ui/scripts/ui-custom/plugins.js +++ b/ui/scripts/ui-custom/pluginListing.js @@ -95,7 +95,7 @@ } }; - cloudStack.uiCustom.plugins = function() { + cloudStack.uiCustom.pluginListing = function() { var plugins = cloudStack.plugins; return elems.pluginListing({ From ce8c2eb8a59922ed83e08296b25591c43dac03e6 Mon Sep 17 00:00:00 2001 From: Chip Childers Date: Thu, 18 Apr 2013 14:52:45 -0400 Subject: [PATCH 23/30] Removing 'incubator' from the default source dir Signed-off-by: Chip Childers --- tools/build/build_asf.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build/build_asf.sh b/tools/build/build_asf.sh index c692febb143..f58f5e0011d 100755 --- a/tools/build/build_asf.sh +++ b/tools/build/build_asf.sh @@ -17,7 +17,7 @@ # under the License. version='TESTBUILD' -sourcedir=~/incubator-cloudstack/ +sourcedir=~/cloudstack/ outputdir=~/cs-asf-build/ branch='master' tag='no' From 9573f51d3b5c79209262c398c4f13897ceaa19a8 Mon Sep 17 00:00:00 2001 From: Wido den Hollander Date: Thu, 18 Apr 2013 21:32:08 +0200 Subject: [PATCH 24/30] CLOUDSTACK-1977: Add management setup directory to classpath This way the DB upgrade process can locate the SQL files --- packaging/debian/init/cloud-management | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/debian/init/cloud-management b/packaging/debian/init/cloud-management index 1e008312e09..8431eec8811 100755 --- a/packaging/debian/init/cloud-management +++ b/packaging/debian/init/cloud-management @@ -125,7 +125,7 @@ fi # Define other required variables CATALINA_PID="/var/run/$NAME.pid" BOOTSTRAP_CLASS=org.apache.catalina.startup.Bootstrap -JSVC_CLASSPATH="/usr/share/java/commons-daemon.jar:$CATALINA_HOME/bin/bootstrap.jar:/etc/cloudstack/management" +JSVC_CLASSPATH="/usr/share/java/commons-daemon.jar:$CATALINA_HOME/bin/bootstrap.jar:/etc/cloudstack/management:/usr/share/cloudstack-management/setup" # Look for Java Secure Sockets Extension (JSSE) JARs if [ -z "${JSSE_HOME}" -a -r "${JAVA_HOME}/jre/lib/jsse.jar" ]; then From 6babaf96163f18453eeb7de69857ec62f01d88b3 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Thu, 18 Apr 2013 12:34:59 -0700 Subject: [PATCH 25/30] Add UI 'module' API Add a variant to a plugin, called a 'module.' It is designed for features that are build-in to the standard UI (i.e., not installed dynamically), but can still utilize the modular nature of UI plugins. It works exactly the same way as a plugin, except: -Modules are added to modules/ folder -Modules are registered in modules/modules.js -No config.js (no need for metadata, since they are built-in features) - /ui/modules/ folder will not be touched by the build system, so any modules are committed directly to the ui/ folder. In other words, modules are not installed automatically. --- ui/index.jsp | 3 +- ui/modules/modules.js | 20 +++++++++++ ui/scripts/plugins.js | 78 ++++++++++++++++++++++++++++++------------- 3 files changed, 77 insertions(+), 24 deletions(-) create mode 100644 ui/modules/modules.js diff --git a/ui/index.jsp b/ui/index.jsp index 550661e546a..5e5a7f2becf 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -1680,9 +1680,10 @@ under the License. - + + diff --git a/ui/modules/modules.js b/ui/modules/modules.js new file mode 100644 index 00000000000..490749ff085 --- /dev/null +++ b/ui/modules/modules.js @@ -0,0 +1,20 @@ +// 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. +(function($, cloudStack) { + cloudStack.modules = [ + ]; +}(jQuery, cloudStack)); diff --git a/ui/scripts/plugins.js b/ui/scripts/plugins.js index d3e07055299..9d1991cc759 100644 --- a/ui/scripts/plugins.js +++ b/ui/scripts/plugins.js @@ -15,6 +15,8 @@ // specific language governing permissions and limitations // under the License. (function($, cloudStack, require) { + if (!cloudStack.pluginAPI) cloudStack.pluginAPI = {}; + var loadCSS = function(path) { var $link = $(''); @@ -27,27 +29,29 @@ $('head').append($link); }; - var pluginAPI = { - pollAsyncJob: pollAsyncJobResult, - apiCall: function(command, args) { - $.ajax({ - url: createURL(command), - data: args.data, - success: args.success, - error: function(json) { - args.error(parseXMLHttpResponse(json)); - } - }) - }, - addSection: function(section) { - cloudStack.sections[section.id] = $.extend(section, { - customIcon: 'plugins/' + section.id + '/icon.png' - }); - }, - extend: function(obj) { - $.extend(true, cloudStack, obj); + $.extend(cloudStack.pluginAPI, { + ui: { + pollAsyncJob: pollAsyncJobResult, + apiCall: function(command, args) { + $.ajax({ + url: createURL(command), + data: args.data, + success: args.success, + error: function(json) { + args.error(parseXMLHttpResponse(json)); + } + }) + }, + addSection: function(section) { + cloudStack.sections[section.id] = $.extend(section, { + customIcon: 'plugins/' + section.id + '/icon.png' + }); + }, + extend: function(obj) { + $.extend(true, cloudStack, obj); + } } - }; + }); cloudStack.sections.plugins = { title: 'label.plugins', @@ -66,9 +70,37 @@ loadCSS(pluginCSS); // Execute plugin - cloudStack.plugins[pluginID]({ - ui: pluginAPI - }); + cloudStack.plugins[pluginID]( + $.extend(true, {}, cloudStack.pluginAPI, { + pluginAPI: { + extend: function(api) { + cloudStack.pluginAPI[pluginID] = api; + } + } + }) + ); + }); + }); + + // Load modules + $(cloudStack.modules).map(function(index, moduleID) { + var basePath = 'modules/' + moduleID + '/'; + var moduleJS = basePath + moduleID + '.js'; + var moduleCSS = basePath + moduleID + '.css'; + + require([moduleJS], function() { + loadCSS(moduleCSS); + + // Execute module + cloudStack.modules[moduleID]( + $.extend(true, {}, cloudStack.pluginAPI, { + pluginAPI: { + extend: function(api) { + cloudStack.pluginAPI[moduleID] = api; + } + } + }) + ); }); }); }(jQuery, cloudStack, require)); From a51b566fb6eb70f6459f894c4c7dc3e75e610d7c Mon Sep 17 00:00:00 2001 From: Chip Childers Date: Thu, 18 Apr 2013 15:03:11 -0400 Subject: [PATCH 26/30] Adding release plugin to pom --- pom.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pom.xml b/pom.xml index dbc39076f2d..7d5b4c3bdef 100644 --- a/pom.xml +++ b/pom.xml @@ -237,6 +237,22 @@ install + + org.apache.maven.plugins + maven-release-plugin + 2.2.1 + + + default + + perform + + + pom.xml + + + + From 73d87f1ad21c7312517f04038b54a0ec084a5d64 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Thu, 18 Apr 2013 13:49:43 -0700 Subject: [PATCH 27/30] UI Plugin/module API: Fix load order, refactor -Fixes issue with load order, where plugin's initialization function were not called in order of the list -Refactor so that modules and plugins are loaded via the same block, to avoid redundant code -Load modules before plugins --- ui/scripts/plugins.js | 77 ++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 42 deletions(-) diff --git a/ui/scripts/plugins.js b/ui/scripts/plugins.js index 9d1991cc759..122f4a03491 100644 --- a/ui/scripts/plugins.js +++ b/ui/scripts/plugins.js @@ -15,7 +15,9 @@ // specific language governing permissions and limitations // under the License. (function($, cloudStack, require) { - if (!cloudStack.pluginAPI) cloudStack.pluginAPI = {}; + if (!cloudStack.pluginAPI) { + cloudStack.pluginAPI = {}; + } var loadCSS = function(path) { var $link = $(''); @@ -40,7 +42,7 @@ error: function(json) { args.error(parseXMLHttpResponse(json)); } - }) + }); }, addSection: function(section) { cloudStack.sections[section.id] = $.extend(section, { @@ -58,49 +60,40 @@ show: cloudStack.uiCustom.pluginListing }; - // Load plugins - $(cloudStack.plugins).map(function(index, pluginID) { - var basePath = 'plugins/' + pluginID + '/'; - var pluginJS = basePath + pluginID + '.js'; - var configJS = basePath + 'config.js'; - var pluginCSS = basePath + pluginID + '.css'; + // Load + $(['modules', 'plugins']).each(function() { + var type = this; + var paths = $(cloudStack[type]).map(function(index, id) { + return type + '/' + id + '/' + id; + }).toArray(); - require([pluginJS], function() { - require([configJS]); - loadCSS(pluginCSS); + // Load modules + require( + paths, + function() { + $(cloudStack[type]).map(function(index, id) { + var basePath = type + '/' + id + '/'; + var css = basePath + id + '.css'; + var configJS = type == 'plugins' ? basePath + 'config' : null; - // Execute plugin - cloudStack.plugins[pluginID]( - $.extend(true, {}, cloudStack.pluginAPI, { - pluginAPI: { - extend: function(api) { - cloudStack.pluginAPI[pluginID] = api; - } + if (configJS) { + // Load config metadata + require([configJS]); } - }) - ); - }); - }); - // Load modules - $(cloudStack.modules).map(function(index, moduleID) { - var basePath = 'modules/' + moduleID + '/'; - var moduleJS = basePath + moduleID + '.js'; - var moduleCSS = basePath + moduleID + '.css'; - - require([moduleJS], function() { - loadCSS(moduleCSS); - - // Execute module - cloudStack.modules[moduleID]( - $.extend(true, {}, cloudStack.pluginAPI, { - pluginAPI: { - extend: function(api) { - cloudStack.pluginAPI[moduleID] = api; - } - } - }) - ); - }); + // Execute module + cloudStack[type][id]( + $.extend(true, {}, cloudStack.pluginAPI, { + pluginAPI: { + extend: function(api) { + cloudStack.pluginAPI[id] = api; + } + } + }) + ); + loadCSS(css); + }); + } + ); }); }(jQuery, cloudStack, require)); From 320cad3806ec091d604779695979b1b34f671873 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 18 Apr 2013 14:28:28 -0700 Subject: [PATCH 28/30] CLOUDSTACK-1343: cloudstack UI - baremetal - zone wizard - fix a JS error "args.data.cluster is undefined" that happened right after Configuring guest traffic. --- ui/scripts/zoneWizard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js index 08cadd0913e..6299faba8c7 100755 --- a/ui/scripts/zoneWizard.js +++ b/ui/scripts/zoneWizard.js @@ -3053,7 +3053,7 @@ args.data.returnedGuestNetwork.returnedVlanIpRange = json.createvlaniprangeresponse.vlan; //when hypervisor is BareMetal (begin) - if(args.data.cluster.hypervisor == "BareMetal") { + if(args.data.zone.hypervisor == "BareMetal") { alert('Zone creation is completed. Please refresh this page.'); } else { From d51d596baa35755c65ea72925bf9d3c36808ed8d Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Thu, 18 Apr 2013 15:15:24 -0700 Subject: [PATCH 29/30] Dashboard UI: Fix unwanted line breaks on event/alert text --- ui/css/cloudstack3.css | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css index 2b6d4976001..18d86b72333 100644 --- a/ui/css/cloudstack3.css +++ b/ui/css/cloudstack3.css @@ -4372,6 +4372,17 @@ Dialogs*/ display: block; clear: both; font-size: 11px; + float: left; + height: 10px; + max-width: 287px; + margin-top: 1px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.dashboard.admin .dashboard-container.sub.alerts ul li p br { + display: none; } /*** User*/ From 977162b9f09436f08c7139e43ec63826a47ef7f9 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Thu, 18 Apr 2013 15:16:49 -0700 Subject: [PATCH 30/30] CSS: Cleanup formatting --- ui/css/cloudstack3.css | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css index 18d86b72333..d4c670cbdbf 100644 --- a/ui/css/cloudstack3.css +++ b/ui/css/cloudstack3.css @@ -11776,12 +11776,11 @@ div.ui-dialog div.autoscaler div.field-group div.form-container form div.form-it .updateResourceLimits:hover .icon { background-position: -100px -614px; } - + .addVlanRange .icon { background-position: -168px -31px; } - .addVlanRange:hover .icon { background-position: -168px -613px; } @@ -11811,8 +11810,8 @@ div.ui-dialog div.autoscaler div.field-group div.form-container form div.form-it background-position: -168px -31px; } -.reset .icon , -.scaleUp .icon{ +.reset .icon, +.scaleUp .icon { background-position: -168px -31px; }