You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by we...@apache.org on 2013/10/23 14:45:51 UTC
[1/5] git commit: updated refs/heads/4.2 to 622f076
Updated Branches:
refs/heads/4.2 f4149ba0a -> 622f0762d
CLOUDSTACK-4931: Do not setDetails for system VMs
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/13a4ec36
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/13a4ec36
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/13a4ec36
Branch: refs/heads/4.2
Commit: 13a4ec366b0505893ecbc0487f037e37d8fae273
Parents: f4149ba
Author: Wei Zhou <w....@leaseweb.com>
Authored: Wed Oct 23 14:08:23 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Wed Oct 23 14:08:23 2013 +0200
----------------------------------------------------------------------
pom.xml | 3 ---
server/src/com/cloud/vm/VirtualMachineManagerImpl.java | 8 +++++---
2 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/13a4ec36/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index a7c2099..7da0751 100644
--- a/pom.xml
+++ b/pom.xml
@@ -174,7 +174,6 @@
<module>test</module>
<module>client</module>
<module>services</module>
- <module>tools</module>
</modules>
<dependencyManagement>
@@ -511,9 +510,7 @@
</properties>
<modules>
<module>developer</module>
- <!--
<module>tools</module>
--->
</modules>
</profile>
<profile>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/13a4ec36/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 354b3ab..1cb2f91 100755
--- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -2470,9 +2470,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
if( info.hvtoolsversion != null && !info.hvtoolsversion.isEmpty() ) {
UserVmVO userVm = _userVmDao.findById(vm.getId());
- _userVmDao.loadDetails(userVm);
- userVm.setDetail("hypervisortoolsversion", info.hvtoolsversion);
- _userVmDao.saveDetails(userVm);
+ if (userVm != null) {
+ _userVmDao.loadDetails(userVm);
+ userVm.setDetail("hypervisortoolsversion", info.hvtoolsversion);
+ _userVmDao.saveDetails(userVm);
+ }
}
if (trackExternalChange) {
[4/5] git commit: updated refs/heads/4.2 to 622f076
Posted by we...@apache.org.
allow Domain Admin to list usage records in the domain
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/87c897ff
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/87c897ff
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/87c897ff
Branch: refs/heads/4.2
Commit: 87c897ff7556179f09d9bfb3514790183df047fb
Parents: 9767de4
Author: Wei Zhou <w....@leaseweb.com>
Authored: Mon Oct 21 14:30:17 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Wed Oct 23 14:30:05 2013 +0200
----------------------------------------------------------------------
client/tomcatconf/commands.properties.in | 2 +-
server/src/com/cloud/usage/UsageServiceImpl.java | 18 ++++++++++++++++--
2 files changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/87c897ff/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index d4aff29..66223f5 100644
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -495,7 +495,7 @@ listVirtualRouterElements=7
#### usage commands
generateUsageRecords=1
-listUsageRecords=1
+listUsageRecords=7
listUsageTypes=1
#### traffic monitor commands
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/87c897ff/server/src/com/cloud/usage/UsageServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/usage/UsageServiceImpl.java b/server/src/com/cloud/usage/UsageServiceImpl.java
index 836a505..5c175d2 100755
--- a/server/src/com/cloud/usage/UsageServiceImpl.java
+++ b/server/src/com/cloud/usage/UsageServiceImpl.java
@@ -38,6 +38,7 @@ import org.springframework.stereotype.Component;
import com.cloud.configuration.Config;
import com.cloud.configuration.dao.ConfigurationDao;
+import com.cloud.domain.DomainVO;
import com.cloud.domain.dao.DomainDao;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@@ -151,7 +152,8 @@ public class UsageServiceImpl extends ManagerBase implements UsageService, Manag
}
boolean isAdmin = false;
-
+ boolean isDomainAdmin = false;
+
//If accountId couldn't be found using accountName and domainId, get it from userContext
if(accountId == null){
accountId = caller.getId();
@@ -159,6 +161,8 @@ public class UsageServiceImpl extends ManagerBase implements UsageService, Manag
//If account_id or account_name is explicitly mentioned, list records for the specified account only even if the caller is of type admin
if(caller.getType() == Account.ACCOUNT_TYPE_ADMIN){
isAdmin = true;
+ } else if(caller.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN){
+ isDomainAdmin = true;
}
s_logger.debug("Account details not available. Using userContext accountId: " + accountId);
}
@@ -180,10 +184,20 @@ public class UsageServiceImpl extends ManagerBase implements UsageService, Manag
SearchCriteria<UsageVO> sc = _usageDao.createSearchCriteria();
- if (accountId != -1 && accountId != Account.ACCOUNT_ID_SYSTEM && !isAdmin) {
+ if (accountId != -1 && accountId != Account.ACCOUNT_ID_SYSTEM && !isAdmin && !isDomainAdmin) {
sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId);
}
+ if (isDomainAdmin) {
+ SearchCriteria<DomainVO> sdc = _domainDao.createSearchCriteria();
+ sdc.addOr("path", SearchCriteria.Op.LIKE, _domainDao.findById(caller.getDomainId()).getPath() + "%");
+ List<DomainVO> domains = _domainDao.search(sdc, null);
+ List<Long> domainIds = new ArrayList<Long>();
+ for(DomainVO domain:domains)
+ domainIds.add(domain.getId());
+ sc.addAnd("domainId", SearchCriteria.Op.IN, domainIds.toArray());
+ }
+
if (domainId != null) {
sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId);
}
[3/5] git commit: updated refs/heads/4.2 to 622f076
Posted by we...@apache.org.
fix a bug in listServiceOffering with vmId
(cherry picked from commit cd72e2afeef0e74db499963971720ff4a8dbd3af)
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9767de45
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9767de45
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9767de45
Branch: refs/heads/4.2
Commit: 9767de451cdf2fe2731f1bd1b61c6b77a32c5977
Parents: f0a9237
Author: Wei Zhou <w....@leaseweb.com>
Authored: Mon Oct 21 14:05:53 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Wed Oct 23 14:28:40 2013 +0200
----------------------------------------------------------------------
.../com/cloud/api/query/QueryManagerImpl.java | 59 ++++++++++++--------
1 file changed, 35 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9767de45/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java
index 57b9ca9..6003534 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -2370,6 +2370,27 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
}
}
+ if (vmId != null) {
+ UserVmVO vmInstance = _userVmDao.findById(vmId);
+ if ((vmInstance == null) || (vmInstance.getRemoved() != null)) {
+ InvalidParameterValueException ex = new InvalidParameterValueException(
+ "unable to find a virtual machine with specified id");
+ ex.addProxyObject(vmId.toString(), "vmId");
+ throw ex;
+ }
+
+ _accountMgr.checkAccess(caller, null, true, vmInstance);
+
+ ServiceOfferingVO offering = _srvOfferingDao.findByIdIncludingRemoved(vmInstance.getServiceOfferingId());
+ sc.addAnd("id", SearchCriteria.Op.NEQ, offering.getId());
+
+ // Only return offerings with the same Guest IP type and storage
+ // pool preference
+ // sc.addAnd("guestIpType", SearchCriteria.Op.EQ,
+ // offering.getGuestIpType());
+ sc.addAnd("useLocalStorage", SearchCriteria.Op.EQ, offering.getUseLocalStorage());
+ }
+
// boolean includePublicOfferings = false;
if ((caller.getType() == Account.ACCOUNT_TYPE_NORMAL || caller.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN)
|| caller.getType() == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) {
@@ -2379,11 +2400,20 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
}
// find all domain Id up to root domain for this account
List<Long> domainIds = new ArrayList<Long>();
- DomainVO domainRecord = _domainDao.findById(caller.getDomainId());
- if (domainRecord == null) {
- s_logger.error("Could not find the domainId for account:" + caller.getAccountName());
- throw new CloudAuthenticationException("Could not find the domainId for account:"
- + caller.getAccountName());
+ DomainVO domainRecord;
+ if (vmId != null) {
+ UserVmVO vmInstance = _userVmDao.findById(vmId);
+ domainRecord = _domainDao.findById(vmInstance.getDomainId());
+ if ( domainRecord == null ){
+ s_logger.error("Could not find the domainId for vmId:" + vmId);
+ throw new CloudAuthenticationException("Could not find the domainId for vmId:" + vmId);
+ }
+ } else {
+ domainRecord = _domainDao.findById(caller.getDomainId());
+ if ( domainRecord == null ){
+ s_logger.error("Could not find the domainId for account:" + caller.getAccountName());
+ throw new CloudAuthenticationException("Could not find the domainId for account:" + caller.getAccountName());
+ }
}
domainIds.add(domainRecord.getId());
while (domainRecord.getParent() != null) {
@@ -2413,25 +2443,6 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
sc.addAnd("name", SearchCriteria.Op.SC, ssc);
- } else if (vmId != null) {
- UserVmVO vmInstance = _userVmDao.findById(vmId);
- if ((vmInstance == null) || (vmInstance.getRemoved() != null)) {
- InvalidParameterValueException ex = new InvalidParameterValueException(
- "unable to find a virtual machine with specified id");
- ex.addProxyObject(vmId.toString(), "vmId");
- throw ex;
- }
-
- _accountMgr.checkAccess(caller, null, true, vmInstance);
-
- ServiceOfferingVO offering = _srvOfferingDao.findByIdIncludingRemoved(vmInstance.getServiceOfferingId());
- sc.addAnd("id", SearchCriteria.Op.NEQ, offering.getId());
-
- // Only return offerings with the same Guest IP type and storage
- // pool preference
- // sc.addAnd("guestIpType", SearchCriteria.Op.EQ,
- // offering.getGuestIpType());
- sc.addAnd("useLocalStorage", SearchCriteria.Op.EQ, offering.getUseLocalStorage());
}
if (id != null) {
[2/5] git commit: updated refs/heads/4.2 to 622f076
Posted by we...@apache.org.
fix a bug in findAllChildren of domains
(cherry picked from commit db890bc71e10855285c64f006a0153a21834182a)
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f0a92376
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f0a92376
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f0a92376
Branch: refs/heads/4.2
Commit: f0a9237612efac3d44d938eb1c25760287460498
Parents: 13a4ec3
Author: Wei Zhou <w....@leaseweb.com>
Authored: Mon Oct 21 14:02:53 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Wed Oct 23 14:28:11 2013 +0200
----------------------------------------------------------------------
engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f0a92376/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java b/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
index c84aa60..d63c877 100644
--- a/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
+++ b/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
@@ -224,7 +224,7 @@ public class DomainDaoImpl extends GenericDaoBase<DomainVO, Long> implements Dom
@Override
public List<DomainVO> findAllChildren(String path, Long parentId){
SearchCriteria<DomainVO> sc = FindAllChildrenSearch.create();
- sc.setParameters("path", "%"+path+"%");
+ sc.setParameters("path", path+"%");
sc.setParameters("id", parentId);
return listBy(sc);
}
[5/5] git commit: updated refs/heads/4.2 to 622f076
Posted by we...@apache.org.
CLOUDSTAC.K-4923: add missing Network limits in Accounts details page
(cherry picked from commit 0f976fd328ed5632201553ddeb69d9fa9ab500a4)
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/622f0762
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/622f0762
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/622f0762
Branch: refs/heads/4.2
Commit: 622f0762defcc63f443a07329ef8c5b53c2159f5
Parents: 87c897f
Author: Wei Zhou <w....@leaseweb.com>
Authored: Tue Oct 22 15:58:17 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Wed Oct 23 14:30:48 2013 +0200
----------------------------------------------------------------------
.../classes/resources/messages.properties | 1 +
ui/dictionary.jsp | 1 +
ui/scripts/accounts.js | 30 ++++++++++++++++++++
3 files changed, 32 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/622f0762/client/WEB-INF/classes/resources/messages.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties
index 50f7a65..eb11fe4 100644
--- a/client/WEB-INF/classes/resources/messages.properties
+++ b/client/WEB-INF/classes/resources/messages.properties
@@ -800,6 +800,7 @@ label.network.domain.text=Network domain
label.network.domain=Network Domain
label.network.id=Network ID
label.network.label.display.for.blank.value=Use default gateway
+label.network.limits=Network limits
label.network.name=Network Name
label.network.offering.display.text=Network Offering Display Text
label.network.offering.id=Network Offering ID
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/622f0762/ui/dictionary.jsp
----------------------------------------------------------------------
diff --git a/ui/dictionary.jsp b/ui/dictionary.jsp
index 8d6a716..ab37781 100644
--- a/ui/dictionary.jsp
+++ b/ui/dictionary.jsp
@@ -794,6 +794,7 @@ dictionary = {
'label.network.id': '<fmt:message key="label.network.id" />',
'label.networking.and.security': '<fmt:message key="label.networking.and.security" />',
'label.network.label.display.for.blank.value': '<fmt:message key="label.network.label.display.for.blank.value" />',
+'label.network.limits': '<fmt:message key="label.network.limits" />',
'label.network.name': '<fmt:message key="label.network.name" />',
'label.network.offering.display.text': '<fmt:message key="label.network.offering.display.text" />',
'label.network.offering': '<fmt:message key="label.network.offering" />',
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/622f0762/ui/scripts/accounts.js
----------------------------------------------------------------------
diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js
index dcf2885..9ba3ebf 100644
--- a/ui/scripts/accounts.js
+++ b/ui/scripts/accounts.js
@@ -493,6 +493,24 @@
});
}
+ if (args.data.networkLimit != null) {
+ var data = {
+ resourceType: 6,
+ max: args.data.networkLimit,
+ domainid: accountObj.domainid,
+ account: accountObj.name
+ };
+
+ $.ajax({
+ url: createURL('updateResourceLimit'),
+ data: data,
+ async: false,
+ success: function(json) {
+ accountObj["networkLimit"] = args.data.networkLimit;
+ }
+ });
+ }
+
if (args.data.primaryStorageLimit != null) {
var data = {
resourceType: 10,
@@ -853,6 +871,15 @@
return false;
}
},
+ networkLimit: {
+ label: 'label.network.limits',
+ isEditable: function(context) {
+ if (context.accounts[0].accounttype == roleTypeUser || context.accounts[0].accounttype == roleTypeDomainAdmin) //updateResourceLimits is only allowed on account whose type is user or domain-admin
+ return true;
+ else
+ return false;
+ }
+ },
primaryStorageLimit: {
label: 'label.primary.storage.limits',
isEditable: function(context) {
@@ -935,6 +962,9 @@
case "4":
accountObj["templateLimit"] = limit.max;
break;
+ case "6":
+ accountObj["networkLimit"] = limit.max;
+ break;
case "7":
accountObj["vpcLimit"] = limit.max;
break;