You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2013/11/20 15:50:31 UTC
[01/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Updated Branches:
refs/heads/disk-cache bbae6f82a -> 6f3e4d359 (forced update)
listRemoteAccessVpns: implemented search by networkId and id
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/96b9ebaf
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/96b9ebaf
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/96b9ebaf
Branch: refs/heads/disk-cache
Commit: 96b9ebafc0a9107d75462b37fa8ee270c91d4a95
Parents: 5a12165
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Wed Nov 13 13:34:36 2013 -0800
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Wed Nov 13 14:26:15 2013 -0800
----------------------------------------------------------------------
.../user/firewall/ListFirewallRulesCmd.java | 1 -
.../user/vpn/ListRemoteAccessVpnsCmd.java | 19 ++++++++++++++++++-
.../network/vpn/RemoteAccessVpnManagerImpl.java | 18 +++++++++++++++---
3 files changed, 33 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/96b9ebaf/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java
index 38c8e62..ae1a2dd 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java
@@ -23,7 +23,6 @@ import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.BaseCmd.CommandType;
import org.apache.cloudstack.api.response.FirewallResponse;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.IPAddressResponse;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/96b9ebaf/api/src/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java
index 12ee95b..3b4d6cd 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java
@@ -25,6 +25,7 @@ import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.RemoteAccessVpnResponse;
import org.apache.log4j.Logger;
@@ -41,8 +42,16 @@ public class ListRemoteAccessVpnsCmd extends BaseListProjectAndAccountResourcesC
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.PUBLIC_IP_ID, type=CommandType.UUID, entityType=IPAddressResponse.class,
- required=true, description="public ip address id of the vpn server")
+ description="public ip address id of the vpn server")
private Long publicIpId;
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = RemoteAccessVpnResponse.class,
+ description="Lists remote access vpn rule with the specified ID", since="4.3")
+ private Long id;
+
+ @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class,
+ description="list remote access VPNs for ceratin network", since="4.3")
+ private Long networkId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -52,6 +61,14 @@ public class ListRemoteAccessVpnsCmd extends BaseListProjectAndAccountResourcesC
public Long getPublicIpId() {
return publicIpId;
}
+
+ public Long getId() {
+ return id;
+ }
+
+ public Long getNetworkId() {
+ return networkId;
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/96b9ebaf/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
index 504e5e8..9483465 100755
--- a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
+++ b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
@@ -25,13 +25,13 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
-import org.apache.log4j.Logger;
import org.apache.cloudstack.api.command.user.vpn.ListRemoteAccessVpnsCmd;
import org.apache.cloudstack.api.command.user.vpn.ListVpnUsersCmd;
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.framework.config.ConfigKey;
import org.apache.cloudstack.framework.config.Configurable;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.log4j.Logger;
import com.cloud.configuration.Config;
import com.cloud.domain.DomainVO;
@@ -81,10 +81,10 @@ 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.TransactionCallback;
-import com.cloud.utils.db.TransactionCallbackNoReturn;
import com.cloud.utils.db.SearchCriteria.Op;
import com.cloud.utils.db.Transaction;
+import com.cloud.utils.db.TransactionCallback;
+import com.cloud.utils.db.TransactionCallbackNoReturn;
import com.cloud.utils.db.TransactionCallbackWithException;
import com.cloud.utils.db.TransactionStatus;
import com.cloud.utils.net.NetUtils;
@@ -592,6 +592,8 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc
// do some parameter validation
Account caller = CallContext.current().getCallingAccount();
Long ipAddressId = cmd.getPublicIpId();
+ Long vpnId = cmd.getId();
+ Long networkId = cmd.getNetworkId();
List<Long> permittedAccounts = new ArrayList<Long>();
if (ipAddressId != null) {
@@ -619,6 +621,8 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc
_accountMgr.buildACLSearchBuilder(sb, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
sb.and("serverAddressId", sb.entity().getServerAddressId(), Op.EQ);
+ sb.and("id", sb.entity().getId(), Op.EQ);
+ sb.and("networkId", sb.entity().getNetworkId(), Op.EQ);
sb.and("state", sb.entity().getState(), Op.EQ);
SearchCriteria<RemoteAccessVpnVO> sc = sb.create();
@@ -630,6 +634,14 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc
if (ipAddressId != null) {
sc.setParameters("serverAddressId", ipAddressId);
}
+
+ if (vpnId != null) {
+ sc.setParameters("id", vpnId);
+ }
+
+ if (networkId != null) {
+ sc.setParameters("networkId", networkId);
+ }
Pair<List<RemoteAccessVpnVO>, Integer> result = _remoteAccessVpnDao.searchAndCount(sc, filter);
return new Pair<List<? extends RemoteAccessVpn>, Integer> (result.first(), result.second());
[28/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
Fix marvin to refer to correct random_gen() function
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0b8cc970
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0b8cc970
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0b8cc970
Branch: refs/heads/disk-cache
Commit: 0b8cc9705f2a5d91e3bde503e89465d513b70f9f
Parents: 09c0370
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Fri Nov 15 17:10:40 2013 +0530
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Fri Nov 15 17:13:12 2013 +0530
----------------------------------------------------------------------
tools/marvin/marvin/cloudstackTestClient.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0b8cc970/tools/marvin/marvin/cloudstackTestClient.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/cloudstackTestClient.py b/tools/marvin/marvin/cloudstackTestClient.py
index 0f96a2c..8a41fad 100644
--- a/tools/marvin/marvin/cloudstackTestClient.py
+++ b/tools/marvin/marvin/cloudstackTestClient.py
@@ -23,6 +23,7 @@ import random
import string
import hashlib
from configGenerator import ConfigManager
+from marvin.integration.lib.utils import random_gen
'''
@Desc : CloudStackTestClient is encapsulated class for getting various \
@@ -125,7 +126,7 @@ class cloudstackTestClient(object):
createAcctCmd = createAccount.createAccountCmd()
createAcctCmd.accounttype = acctType
createAcctCmd.domainid = domId
- createAcctCmd.email = "test-" + self.random_gen()\
+ createAcctCmd.email = "test-" + random_gen()\
+ "@cloudstack.org"
createAcctCmd.firstname = UserName
createAcctCmd.lastname = UserName
[47/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-4793: UI > Virtual Routers > add new action "Upgrade Router to Newer Template" in detailView.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/829f1db6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/829f1db6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/829f1db6
Branch: refs/heads/disk-cache
Commit: 829f1db6e8c2d28a032c49b0a2a69b4cfe7dbfdd
Parents: d6a38c2
Author: Jessica Wang <je...@apache.org>
Authored: Tue Nov 19 16:14:47 2013 -0800
Committer: Jessica Wang <je...@apache.org>
Committed: Tue Nov 19 16:15:49 2013 -0800
----------------------------------------------------------------------
ui/scripts/system.js | 689 +++++++++++++++++++++++++---------------------
1 file changed, 370 insertions(+), 319 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/829f1db6/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 472c821..16ae29e 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -7390,325 +7390,341 @@
return listView;
},
virtualRouters: function() {
- var listView = $.extend(true, {}, cloudStack.sections.system.subsections.virtualRouters.listView, {
-
- //???
+ var listView = $.extend(true, {}, cloudStack.sections.system.subsections.virtualRouters.listView, {
actions: {
- upgradeRouterToUseNewerTemplate: {
- isHeader: true,
-
- label: 'Upgrade Router to Use Newer Template',
-
- messages: {
- notification: function(args) {
- return 'Upgrade Router to Use Newer Template';
- }
- },
-
- createForm: {
- title: 'Upgrade Router to Use Newer Template',
- fields: {
- zoneid: {
- label: 'label.zone',
- select: function(args) {
- var items = [{ id: '', description: '' }];
- $.ajax({
- url: createURL('listZones'),
- data: {
- listAll: true
- },
- success: function(json) {
- var objs = json.listzonesresponse.zone;
- if (objs != null) {
- for (var i = 0; i < objs.length; i++) {
- items.push({ id: objs[i].id, description: objs[i].name });
- }
- }
- args.response.success({
- data: items
- });
- }
- });
- }
- },
- podid: {
- label: 'Pod',
- dependsOn: 'zoneid',
- select: function (args) {
- var items = [{ id: '', description: '' }];
- if (args.zoneid.length > 0) {
- $.ajax({
- url: createURL('listPods'),
- data: {
- zoneid: args.zoneid
- },
- success: function (json) {
- var objs = json.listpodsresponse.pod;
- if (objs != null) {
- for (var i = 0; i < objs.length; i++) {
- items.push({ id: objs[i].id, description: objs[i].name });
- }
- }
- args.response.success({
- data: items
- });
- }
- });
- } else {
- args.response.success({
- data: items
- });
- }
- }
- },
- clusterid: {
- label: 'label.cluster',
- dependsOn: 'podid',
- select: function(args) {
- var items = [{ id: '', description: '' }];
- if (args.podid.length > 0) {
- $.ajax({
- url: createURL('listClusters'),
- data: {
- podid: args.podid
- },
- success: function(json) {
- var objs = json.listclustersresponse.cluster;
- if (objs != null) {
- for (var i = 0; i < objs.length; i++) {
- items.push({ id: objs[i].id, description: objs[i].name });
- }
- }
- args.response.success({
- data: items
- });
- }
- });
- } else {
- args.response.success({
- data: items
- });
- }
- }
- }
- }
- },
-
- action: function(args) {
- var data = {};
- if (args.data.clusterid.length > 0) {
- $.extend(data, {
- clusterid: args.data.clusterid
- });
- } else if (args.data.podid.length > 0) {
- $.extend(data, {
- podid: args.data.podid
- });
- } else if (args.data.zoneid.length > 0) {
- $.extend(data, {
- zoneid: args.data.zoneid
- });
- } else {
- args.response.error('Please specify a zone, a pod or a cluster.' );
- return;
- }
-
- $.ajax({
- url: createURL('upgradeRouterTemplate'),
- data: data,
- success: function(json) {
- //example
- /*
- json = {
- "upgraderoutertemplateresponse": {
- "count": 3,
- "asyncjobs": [
- {
- "jobid": "2d51f1f9-ea39-4871-9512-431f4a65a5f2"
- },
- {
- "jobid": "d66fa7ef-c91f-425f-b820-2f8ff2a0da8c"
- },
- {
- "jobid": "850a3cfd-c265-48f1-880a-f001481fc7f7"
- }
- ]
- }
- };
- */
-
- var jobs = json.upgraderoutertemplateresponse.asyncjobs;
- if (jobs != undefined) {
- for (var i = 0; i < jobs.length; i++) {
- var jid = jobs[i].jobid;
- args.response.success({
- _custom: {
- jobId: jid
- }
- });
-
- //example begins
- /*
- {
- "queryasyncjobresultresponse": {
- "accountid": "ce5820a8-5099-11e3-80db-3c970e739c3e",
- "userid": "ce58353e-5099-11e3-80db-3c970e739c3e",
- "cmd": "org.apache.cloudstack.api.command.admin.router.RebootRouterCmd",
- "jobstatus": 2,
- "jobprocstatus": 0,
- "jobresultcode": 530,
- "jobresulttype": "object",
- "jobresult": {
- "errorcode": 530,
- "errortext": "Resource [DataCenter:1] is unreachable: Unable to reboot domR, it is not in right state Stopped"
- },
- "created": "2013-11-19T11:41:40-0800",
- "jobid": "2d51f1f9-ea39-4871-9512-431f4a65a5f2"
- }
- }
- {
- "queryasyncjobresultresponse": {
- "accountid": "9b0ea3b4-a699-431c-932b-570388ef7b86",
- "userid": "ce58353e-5099-11e3-80db-3c970e739c3e",
- "cmd": "org.apache.cloudstack.api.command.admin.router.RebootRouterCmd",
- "jobstatus": 0,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobinstancetype": "DomainRouter",
- "jobinstanceid": "d6e625ea-76f9-4c35-9f89-0998a04a3b9c",
- "created": "2013-11-19T11:41:40-0800",
- "jobid": "d66fa7ef-c91f-425f-b820-2f8ff2a0da8c"
- }
- }
- {
- "queryasyncjobresultresponse": {
- "accountid": "6b5334a2-1c0e-46e0-b4d9-524698549f08",
- "userid": "ce58353e-5099-11e3-80db-3c970e739c3e",
- "cmd": "org.apache.cloudstack.api.command.admin.router.RebootRouterCmd",
- "jobstatus": 2,
- "jobprocstatus": 0,
- "jobresultcode": 530,
- "jobresulttype": "object",
- "jobresult": {
- "errorcode": 530,
- "errortext": "Resource [DataCenter:1] is unreachable: Unable to reboot domR, it is not in right state Starting"
- },
- "created": "2013-11-19T11:41:40-0800",
- "jobid": "850a3cfd-c265-48f1-880a-f001481fc7f7"
- }
- }
-
-
- {
- "queryasyncjobresultresponse": {
- "accountid": "9b0ea3b4-a699-431c-932b-570388ef7b86",
- "userid": "ce58353e-5099-11e3-80db-3c970e739c3e",
- "cmd": "org.apache.cloudstack.api.command.admin.router.RebootRouterCmd",
- "jobstatus": 0,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobinstancetype": "DomainRouter",
- "jobinstanceid": "d6e625ea-76f9-4c35-9f89-0998a04a3b9c",
- "created": "2013-11-19T11:41:40-0800",
- "jobid": "d66fa7ef-c91f-425f-b820-2f8ff2a0da8c"
- }
- }
- {
- "queryasyncjobresultresponse": {
- "accountid": "9b0ea3b4-a699-431c-932b-570388ef7b86",
- "userid": "ce58353e-5099-11e3-80db-3c970e739c3e",
- "cmd": "org.apache.cloudstack.api.command.admin.router.RebootRouterCmd",
- "jobstatus": 0,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobinstancetype": "DomainRouter",
- "jobinstanceid": "d6e625ea-76f9-4c35-9f89-0998a04a3b9c",
- "created": "2013-11-19T11:41:40-0800",
- "jobid": "d66fa7ef-c91f-425f-b820-2f8ff2a0da8c"
- }
- }
- {
- "queryasyncjobresultresponse": {
- "accountid": "9b0ea3b4-a699-431c-932b-570388ef7b86",
- "userid": "ce58353e-5099-11e3-80db-3c970e739c3e",
- "cmd": "org.apache.cloudstack.api.command.admin.router.RebootRouterCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "router": {
- "id": "d6e625ea-76f9-4c35-9f89-0998a04a3b9c",
- "zoneid": "3bfdd7d1-134a-4d75-8621-0ccfc8641660",
- "zonename": "jw-adv",
- "dns1": "8.8.8.8",
- "gateway": "10.223.67.1",
- "name": "r-6-VM",
- "linklocalip": "169.254.2.29",
- "linklocalmacaddress": "0e:00:a9:fe:02:1d",
- "linklocalnetmask": "255.255.0.0",
- "linklocalnetworkid": "4a02a05f-1312-484a-a82b-246a86ed6949",
- "publicip": "10.223.67.6",
- "publicmacaddress": "06:8d:22:00:00:18",
- "publicnetmask": "255.255.255.0",
- "publicnetworkid": "e7056c3c-2c7f-4e84-909e-af288ae170e9",
- "templateid": "cd70f70a-5099-11e3-80db-3c970e739c3e",
- "created": "2013-11-19T11:36:04-0800",
- "state": "Running",
- "account": "aaa_admin",
- "domainid": "b95a5b02-e45d-4971-b0d8-d1620f7bf44e",
- "domain": "aaa",
- "serviceofferingid": "7dd7687c-01f0-4a14-846e-8e46067a8ff9",
- "serviceofferingname": "System Offering For Software Router",
- "isredundantrouter": false,
- "redundantstate": "UNKNOWN",
- "version": "3.0",
- "role": "VIRTUAL_ROUTER",
- "nic": [
- {
- "id": "d41bf67e-1d58-4ec9-bf61-41903140cc53",
- "networkid": "e7056c3c-2c7f-4e84-909e-af288ae170e9",
- "netmask": "255.255.255.0",
- "gateway": "10.223.67.1",
- "ipaddress": "10.223.67.6",
- "isolationuri": "vlan://159",
- "broadcasturi": "vlan://159",
- "traffictype": "Public",
- "isdefault": true,
- "macaddress": "06:8d:22:00:00:18"
- },
- {
- "id": "a6d1f6ac-fc45-474e-b372-3571e639fa8e",
- "networkid": "4a02a05f-1312-484a-a82b-246a86ed6949",
- "netmask": "255.255.0.0",
- "gateway": "169.254.0.1",
- "ipaddress": "169.254.2.29",
- "traffictype": "Control",
- "isdefault": false,
- "macaddress": "0e:00:a9:fe:02:1d"
- }
- ],
- "requiresupgrade": true,
- "jobid": "d66fa7ef-c91f-425f-b820-2f8ff2a0da8c",
- "jobstatus": 0
- }
- },
- "created": "2013-11-19T11:41:40-0800",
- "jobid": "d66fa7ef-c91f-425f-b820-2f8ff2a0da8c"
- }
- }
- */
- //example ends
- }
- }
- }
- });
- },
- notification: {
- poll: pollAsyncJobResult
- }
- }
- },
+ upgradeRouterToUseNewerTemplate: {
+ isHeader: true,
+
+ label: 'Upgrade Router to Use Newer Template',
+
+ messages: {
+ notification: function (args) {
+ return 'Upgrade Router to Use Newer Template';
+ }
+ },
+
+ createForm: {
+ title: 'Upgrade Router to Use Newer Template',
+ fields: {
+ zoneid: {
+ label: 'label.zone',
+ select: function (args) {
+ var items = [{
+ id: '',
+ description: ''
+ }];
+ $.ajax({
+ url: createURL('listZones'),
+ data: {
+ listAll: true
+ },
+ success: function (json) {
+ var objs = json.listzonesresponse.zone;
+ if (objs != null) {
+ for (var i = 0; i < objs.length; i++) {
+ items.push({
+ id: objs[i].id,
+ description: objs[i].name
+ });
+ }
+ }
+ args.response.success({
+ data: items
+ });
+ }
+ });
+ }
+ },
+ podid: {
+ label: 'Pod',
+ dependsOn: 'zoneid',
+ select: function (args) {
+ var items = [{
+ id: '',
+ description: ''
+ }];
+ if (args.zoneid.length > 0) {
+ $.ajax({
+ url: createURL('listPods'),
+ data: {
+ zoneid: args.zoneid
+ },
+ success: function (json) {
+ var objs = json.listpodsresponse.pod;
+ if (objs != null) {
+ for (var i = 0; i < objs.length; i++) {
+ items.push({
+ id: objs[i].id,
+ description: objs[i].name
+ });
+ }
+ }
+ args.response.success({
+ data: items
+ });
+ }
+ });
+ } else {
+ args.response.success({
+ data: items
+ });
+ }
+ }
+ },
+ clusterid: {
+ label: 'label.cluster',
+ dependsOn: 'podid',
+ select: function (args) {
+ var items = [{
+ id: '',
+ description: ''
+ }];
+ if (args.podid.length > 0) {
+ $.ajax({
+ url: createURL('listClusters'),
+ data: {
+ podid: args.podid
+ },
+ success: function (json) {
+ var objs = json.listclustersresponse.cluster;
+ if (objs != null) {
+ for (var i = 0; i < objs.length; i++) {
+ items.push({
+ id: objs[i].id,
+ description: objs[i].name
+ });
+ }
+ }
+ args.response.success({
+ data: items
+ });
+ }
+ });
+ } else {
+ args.response.success({
+ data: items
+ });
+ }
+ }
+ }
+ }
+ },
+
+ action: function (args) {
+ var data = {};
+ if (args.data.clusterid.length > 0) {
+ $.extend(data, {
+ clusterid: args.data.clusterid
+ });
+ } else if (args.data.podid.length > 0) {
+ $.extend(data, {
+ podid: args.data.podid
+ });
+ } else if (args.data.zoneid.length > 0) {
+ $.extend(data, {
+ zoneid: args.data.zoneid
+ });
+ } else {
+ args.response.error('Please specify a zone, a pod or a cluster.');
+ return;
+ }
+
+ $.ajax({
+ url: createURL('upgradeRouterTemplate'),
+ data: data,
+ success: function (json) {
+ //example
+ /*
+ json = {
+ "upgraderoutertemplateresponse": {
+ "count": 3,
+ "asyncjobs": [
+ {
+ "jobid": "2d51f1f9-ea39-4871-9512-431f4a65a5f2"
+ },
+ {
+ "jobid": "d66fa7ef-c91f-425f-b820-2f8ff2a0da8c"
+ },
+ {
+ "jobid": "850a3cfd-c265-48f1-880a-f001481fc7f7"
+ }
+ ]
+ }
+ };
+ */
+
+ var jobs = json.upgraderoutertemplateresponse.asyncjobs;
+ if (jobs != undefined) {
+ for (var i = 0; i < jobs.length; i++) {
+ var jid = jobs[i].jobid;
+ args.response.success({
+ _custom: {
+ jobId: jid
+ }
+ });
+
+ //example begins
+ /*
+ {
+ "queryasyncjobresultresponse": {
+ "accountid": "ce5820a8-5099-11e3-80db-3c970e739c3e",
+ "userid": "ce58353e-5099-11e3-80db-3c970e739c3e",
+ "cmd": "org.apache.cloudstack.api.command.admin.router.RebootRouterCmd",
+ "jobstatus": 2,
+ "jobprocstatus": 0,
+ "jobresultcode": 530,
+ "jobresulttype": "object",
+ "jobresult": {
+ "errorcode": 530,
+ "errortext": "Resource [DataCenter:1] is unreachable: Unable to reboot domR, it is not in right state Stopped"
+ },
+ "created": "2013-11-19T11:41:40-0800",
+ "jobid": "2d51f1f9-ea39-4871-9512-431f4a65a5f2"
+ }
+ }
+ {
+ "queryasyncjobresultresponse": {
+ "accountid": "9b0ea3b4-a699-431c-932b-570388ef7b86",
+ "userid": "ce58353e-5099-11e3-80db-3c970e739c3e",
+ "cmd": "org.apache.cloudstack.api.command.admin.router.RebootRouterCmd",
+ "jobstatus": 0,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobinstancetype": "DomainRouter",
+ "jobinstanceid": "d6e625ea-76f9-4c35-9f89-0998a04a3b9c",
+ "created": "2013-11-19T11:41:40-0800",
+ "jobid": "d66fa7ef-c91f-425f-b820-2f8ff2a0da8c"
+ }
+ }
+ {
+ "queryasyncjobresultresponse": {
+ "accountid": "6b5334a2-1c0e-46e0-b4d9-524698549f08",
+ "userid": "ce58353e-5099-11e3-80db-3c970e739c3e",
+ "cmd": "org.apache.cloudstack.api.command.admin.router.RebootRouterCmd",
+ "jobstatus": 2,
+ "jobprocstatus": 0,
+ "jobresultcode": 530,
+ "jobresulttype": "object",
+ "jobresult": {
+ "errorcode": 530,
+ "errortext": "Resource [DataCenter:1] is unreachable: Unable to reboot domR, it is not in right state Starting"
+ },
+ "created": "2013-11-19T11:41:40-0800",
+ "jobid": "850a3cfd-c265-48f1-880a-f001481fc7f7"
+ }
+ }
+
+
+ {
+ "queryasyncjobresultresponse": {
+ "accountid": "9b0ea3b4-a699-431c-932b-570388ef7b86",
+ "userid": "ce58353e-5099-11e3-80db-3c970e739c3e",
+ "cmd": "org.apache.cloudstack.api.command.admin.router.RebootRouterCmd",
+ "jobstatus": 0,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobinstancetype": "DomainRouter",
+ "jobinstanceid": "d6e625ea-76f9-4c35-9f89-0998a04a3b9c",
+ "created": "2013-11-19T11:41:40-0800",
+ "jobid": "d66fa7ef-c91f-425f-b820-2f8ff2a0da8c"
+ }
+ }
+ {
+ "queryasyncjobresultresponse": {
+ "accountid": "9b0ea3b4-a699-431c-932b-570388ef7b86",
+ "userid": "ce58353e-5099-11e3-80db-3c970e739c3e",
+ "cmd": "org.apache.cloudstack.api.command.admin.router.RebootRouterCmd",
+ "jobstatus": 0,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobinstancetype": "DomainRouter",
+ "jobinstanceid": "d6e625ea-76f9-4c35-9f89-0998a04a3b9c",
+ "created": "2013-11-19T11:41:40-0800",
+ "jobid": "d66fa7ef-c91f-425f-b820-2f8ff2a0da8c"
+ }
+ }
+ {
+ "queryasyncjobresultresponse": {
+ "accountid": "9b0ea3b4-a699-431c-932b-570388ef7b86",
+ "userid": "ce58353e-5099-11e3-80db-3c970e739c3e",
+ "cmd": "org.apache.cloudstack.api.command.admin.router.RebootRouterCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "router": {
+ "id": "d6e625ea-76f9-4c35-9f89-0998a04a3b9c",
+ "zoneid": "3bfdd7d1-134a-4d75-8621-0ccfc8641660",
+ "zonename": "jw-adv",
+ "dns1": "8.8.8.8",
+ "gateway": "10.223.67.1",
+ "name": "r-6-VM",
+ "linklocalip": "169.254.2.29",
+ "linklocalmacaddress": "0e:00:a9:fe:02:1d",
+ "linklocalnetmask": "255.255.0.0",
+ "linklocalnetworkid": "4a02a05f-1312-484a-a82b-246a86ed6949",
+ "publicip": "10.223.67.6",
+ "publicmacaddress": "06:8d:22:00:00:18",
+ "publicnetmask": "255.255.255.0",
+ "publicnetworkid": "e7056c3c-2c7f-4e84-909e-af288ae170e9",
+ "templateid": "cd70f70a-5099-11e3-80db-3c970e739c3e",
+ "created": "2013-11-19T11:36:04-0800",
+ "state": "Running",
+ "account": "aaa_admin",
+ "domainid": "b95a5b02-e45d-4971-b0d8-d1620f7bf44e",
+ "domain": "aaa",
+ "serviceofferingid": "7dd7687c-01f0-4a14-846e-8e46067a8ff9",
+ "serviceofferingname": "System Offering For Software Router",
+ "isredundantrouter": false,
+ "redundantstate": "UNKNOWN",
+ "version": "3.0",
+ "role": "VIRTUAL_ROUTER",
+ "nic": [
+ {
+ "id": "d41bf67e-1d58-4ec9-bf61-41903140cc53",
+ "networkid": "e7056c3c-2c7f-4e84-909e-af288ae170e9",
+ "netmask": "255.255.255.0",
+ "gateway": "10.223.67.1",
+ "ipaddress": "10.223.67.6",
+ "isolationuri": "vlan://159",
+ "broadcasturi": "vlan://159",
+ "traffictype": "Public",
+ "isdefault": true,
+ "macaddress": "06:8d:22:00:00:18"
+ },
+ {
+ "id": "a6d1f6ac-fc45-474e-b372-3571e639fa8e",
+ "networkid": "4a02a05f-1312-484a-a82b-246a86ed6949",
+ "netmask": "255.255.0.0",
+ "gateway": "169.254.0.1",
+ "ipaddress": "169.254.2.29",
+ "traffictype": "Control",
+ "isdefault": false,
+ "macaddress": "0e:00:a9:fe:02:1d"
+ }
+ ],
+ "requiresupgrade": true,
+ "jobid": "d66fa7ef-c91f-425f-b820-2f8ff2a0da8c",
+ "jobstatus": 0
+ }
+ },
+ "created": "2013-11-19T11:41:40-0800",
+ "jobid": "d66fa7ef-c91f-425f-b820-2f8ff2a0da8c"
+ }
+ }
+ */
+ //example ends
+ }
+ }
+ }
+ });
+ },
+ notification: {
+ poll: pollAsyncJobResult
+ }
+ }
+ },
dataProvider: function(args) {
var data = {};
@@ -8148,7 +8164,40 @@
poll: pollAsyncJobResult
}
},
-
+
+ upgradeRouterToUseNewerTemplate: {
+ label: 'Upgrade Router to Use Newer Template',
+ messages: {
+ confirm: function(args) {
+ return 'Please confirm that you want to upgrade router to use newer template';
+ },
+ notification: function (args) {
+ return 'Upgrade Router to Use Newer Template';
+ }
+ },
+ action: function (args) {
+ $.ajax({
+ url: createURL('upgradeRouterTemplate'),
+ data: {
+ id: args.context.routers[0].id
+ },
+ success: function (json) {
+ var jobs = json.upgraderoutertemplateresponse.asyncjobs;
+ if (jobs != undefined) {
+ args.response.success({
+ _custom: {
+ jobId: jobs[0].jobid
+ }
+ });
+ }
+ }
+ });
+ },
+ notification: {
+ poll: pollAsyncJobResult
+ }
+ },
+
'remove': {
label: 'label.destroy.router',
messages: {
@@ -17491,6 +17540,8 @@
var jsonObj = args.context.item;
var allowedActions = [];
+ allowedActions.push('upgradeRouterToUseNewerTemplate');
+
if (jsonObj.state == 'Running') {
allowedActions.push("stop");
[13/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
Make com.cloud.network.vpn.RemoteAccessVpnService an extensible type
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1f7ef652
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1f7ef652
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1f7ef652
Branch: refs/heads/disk-cache
Commit: 1f7ef652cf4be2d2a7ab184e08ac212c6469df81
Parents: 5e2e27d
Author: Darren Shepherd <da...@gmail.com>
Authored: Thu Nov 14 00:34:58 2013 -0700
Committer: Sheng Yang <sh...@citrix.com>
Committed: Thu Nov 14 15:31:33 2013 -0800
----------------------------------------------------------------------
.../core/spring-core-registry-core-context.xml | 10 ++++++++++
...ng-core-lifecycle-network-context-inheritable.xml | 6 ++++++
.../core/spring-server-core-managers-context.xml | 4 +++-
.../network/vpn/RemoteAccessVpnManagerImpl.java | 15 +++++++++++++--
4 files changed, 32 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1f7ef652/core/resources/META-INF/cloudstack/core/spring-core-registry-core-context.xml
----------------------------------------------------------------------
diff --git a/core/resources/META-INF/cloudstack/core/spring-core-registry-core-context.xml b/core/resources/META-INF/cloudstack/core/spring-core-registry-core-context.xml
index a8b2e29..be11a1f 100644
--- a/core/resources/META-INF/cloudstack/core/spring-core-registry-core-context.xml
+++ b/core/resources/META-INF/cloudstack/core/spring-core-registry-core-context.xml
@@ -213,6 +213,16 @@
</list>
</property>
</bean>
+
+ <bean id="remoteAccessVPNServiceProviderRegistry"
+ class="org.apache.cloudstack.spring.lifecycle.registry.ExtensionRegistry">
+ <property name="excludeKey" value="remote.access.vpn.service.provider.exclude" />
+ <property name="preRegistered">
+ <list>
+ <ref bean="VpcVirtualRouter" />
+ </list>
+ </property>
+ </bean>
<bean id="affinityProcessorsRegistry"
class="org.apache.cloudstack.spring.lifecycle.registry.ExtensionRegistry">
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1f7ef652/core/resources/META-INF/cloudstack/network/spring-core-lifecycle-network-context-inheritable.xml
----------------------------------------------------------------------
diff --git a/core/resources/META-INF/cloudstack/network/spring-core-lifecycle-network-context-inheritable.xml b/core/resources/META-INF/cloudstack/network/spring-core-lifecycle-network-context-inheritable.xml
index 3388ca4..a54d588 100644
--- a/core/resources/META-INF/cloudstack/network/spring-core-lifecycle-network-context-inheritable.xml
+++ b/core/resources/META-INF/cloudstack/network/spring-core-lifecycle-network-context-inheritable.xml
@@ -90,5 +90,11 @@
<property name="typeClass"
value="com.cloud.network.element.Site2SiteVpnServiceProvider" />
</bean>
+
+ <bean class="org.apache.cloudstack.spring.lifecycle.registry.RegistryLifecycle">
+ <property name="registry" ref="remoteAccessVPNServiceProviderRegistry" />
+ <property name="typeClass"
+ value="com.cloud.network.element.RemoteAccessVPNServiceProvider" />
+ </bean>
</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1f7ef652/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
----------------------------------------------------------------------
diff --git a/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml b/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
index f7a8d67..2a080f9 100644
--- a/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
+++ b/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
@@ -144,7 +144,9 @@
<bean id="regionServiceImpl" class="org.apache.cloudstack.region.RegionServiceImpl" />
- <bean id="remoteAccessVpnManagerImpl" class="com.cloud.network.vpn.RemoteAccessVpnManagerImpl" />
+ <bean id="remoteAccessVpnManagerImpl" class="com.cloud.network.vpn.RemoteAccessVpnManagerImpl" >
+ <property name="vpnServiceProviders" value="#{remoteAccessVPNServiceProviderRegistry.registered}" />
+ </bean>
<bean id="resourceLimitManagerImpl" class="com.cloud.resourcelimit.ResourceLimitManagerImpl" />
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1f7ef652/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
index 9483465..dd18f74 100755
--- a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
+++ b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
@@ -109,8 +109,9 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc
@Inject FirewallManager _firewallMgr;
@Inject UsageEventDao _usageEventDao;
@Inject ConfigurationDao _configDao;
- @Inject List<RemoteAccessVPNServiceProvider> _vpnServiceProviders;
- @Inject ConfigurationServer _configServer;
+ List<RemoteAccessVPNServiceProvider> _vpnServiceProviders;
+
+ @Inject ConfigurationServer _configServer;
@Inject VpcDao _vpcDao;
int _userLimit;
@@ -695,4 +696,14 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc
public ConfigKey<?>[] getConfigKeys() {
return new ConfigKey<?>[] {RemoteAccessVpnClientIpRange};
}
+
+ public List<RemoteAccessVPNServiceProvider> getVpnServiceProviders() {
+ return _vpnServiceProviders;
+ }
+
+ public void setVpnServiceProviders(
+ List<RemoteAccessVPNServiceProvider> vpnServiceProviders) {
+ this._vpnServiceProviders = vpnServiceProviders;
+ }
+
}
[39/50] [abbrv] Checkstyle adjustments in code and configuration
Posted by wi...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java
index 42e436f..bdcbfee 100644
--- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java
+++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java
@@ -70,6 +70,7 @@ import com.cloud.user.Account;
import com.cloud.vm.ReservationContext;
public class NiciraNvpGuestNetworkGuruTest {
+ private static final long NETWORK_ID = 42L;
PhysicalNetworkDao physnetdao = mock(PhysicalNetworkDao.class);
NiciraNvpDao nvpdao = mock(NiciraNvpDao.class);
DataCenterDao dcdao = mock(DataCenterDao.class);
@@ -87,14 +88,14 @@ public class NiciraNvpGuestNetworkGuruTest {
public void setUp() {
guru = new NiciraNvpGuestNetworkGuru();
((GuestNetworkGuru) guru)._physicalNetworkDao = physnetdao;
- guru._physicalNetworkDao = physnetdao;
- guru._niciraNvpDao = nvpdao;
+ guru.physicalNetworkDao = physnetdao;
+ guru.niciraNvpDao = nvpdao;
guru._dcDao = dcdao;
- guru._ntwkOfferingSrvcDao = nosd;
- guru._networkModel = netmodel;
- guru._hostDao = hostdao;
- guru._agentMgr = agentmgr;
- guru._networkDao = netdao;
+ guru.ntwkOfferingSrvcDao = nosd;
+ guru.networkModel = netmodel;
+ guru.hostDao = hostdao;
+ guru.agentMgr = agentmgr;
+ guru.networkDao = netdao;
DataCenterVO dc = mock(DataCenterVO.class);
when(dc.getNetworkType()).thenReturn(NetworkType.Advanced);
@@ -106,15 +107,15 @@ public class NiciraNvpGuestNetworkGuruTest {
@Test
public void testCanHandle() {
NetworkOffering offering = mock(NetworkOffering.class);
- when(offering.getId()).thenReturn(42L);
+ when(offering.getId()).thenReturn(NETWORK_ID);
when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
when(offering.getGuestType()).thenReturn(GuestType.Isolated);
PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
- when(physnet.getId()).thenReturn(42L);
+ when(physnet.getId()).thenReturn(NETWORK_ID);
- when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(true);
+ when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(true);
assertTrue(guru.canHandle(offering, NetworkType.Advanced, physnet) == true);
@@ -142,18 +143,18 @@ public class NiciraNvpGuestNetworkGuruTest {
PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
when(physnetdao.findById((Long) any())).thenReturn(physnet);
when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
- when(physnet.getId()).thenReturn(42L);
+ when(physnet.getId()).thenReturn(NETWORK_ID);
NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
- when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
+ when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
when(device.getId()).thenReturn(1L);
NetworkOffering offering = mock(NetworkOffering.class);
- when(offering.getId()).thenReturn(42L);
+ when(offering.getId()).thenReturn(NETWORK_ID);
when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
when(offering.getGuestType()).thenReturn(GuestType.Isolated);
- when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(true);
+ when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(true);
DeploymentPlan plan = mock(DeploymentPlan.class);
Network network = mock(Network.class);
@@ -169,13 +170,13 @@ public class NiciraNvpGuestNetworkGuruTest {
PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
when(physnetdao.findById((Long) any())).thenReturn(physnet);
when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
- when(physnet.getId()).thenReturn(42L);
+ when(physnet.getId()).thenReturn(NETWORK_ID);
mock(NiciraNvpDeviceVO.class);
- when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Collections.<NiciraNvpDeviceVO> emptyList());
+ when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Collections.<NiciraNvpDeviceVO> emptyList());
NetworkOffering offering = mock(NetworkOffering.class);
- when(offering.getId()).thenReturn(42L);
+ when(offering.getId()).thenReturn(NETWORK_ID);
when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
when(offering.getGuestType()).thenReturn(GuestType.Isolated);
@@ -192,13 +193,13 @@ public class NiciraNvpGuestNetworkGuruTest {
PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
when(physnetdao.findById((Long) any())).thenReturn(physnet);
when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "VLAN" }));
- when(physnet.getId()).thenReturn(42L);
+ when(physnet.getId()).thenReturn(NETWORK_ID);
mock(NiciraNvpDeviceVO.class);
- when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Collections.<NiciraNvpDeviceVO> emptyList());
+ when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Collections.<NiciraNvpDeviceVO> emptyList());
NetworkOffering offering = mock(NetworkOffering.class);
- when(offering.getId()).thenReturn(42L);
+ when(offering.getId()).thenReturn(NETWORK_ID);
when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
when(offering.getGuestType()).thenReturn(GuestType.Isolated);
@@ -215,18 +216,18 @@ public class NiciraNvpGuestNetworkGuruTest {
PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
when(physnetdao.findById((Long) any())).thenReturn(physnet);
when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
- when(physnet.getId()).thenReturn(42L);
+ when(physnet.getId()).thenReturn(NETWORK_ID);
NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
- when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
+ when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
when(device.getId()).thenReturn(1L);
NetworkOffering offering = mock(NetworkOffering.class);
- when(offering.getId()).thenReturn(42L);
+ when(offering.getId()).thenReturn(NETWORK_ID);
when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
when(offering.getGuestType()).thenReturn(GuestType.Isolated);
- when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false);
+ when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
DeploymentPlan plan = mock(DeploymentPlan.class);
Network network = mock(Network.class);
@@ -241,25 +242,25 @@ public class NiciraNvpGuestNetworkGuruTest {
PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
when(physnetdao.findById((Long) any())).thenReturn(physnet);
when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
- when(physnet.getId()).thenReturn(42L);
+ when(physnet.getId()).thenReturn(NETWORK_ID);
NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
- when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
+ when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
when(device.getId()).thenReturn(1L);
NetworkOffering offering = mock(NetworkOffering.class);
- when(offering.getId()).thenReturn(42L);
+ when(offering.getId()).thenReturn(NETWORK_ID);
when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
when(offering.getGuestType()).thenReturn(GuestType.Isolated);
- when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false);
+ when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
mock(DeploymentPlan.class);
NetworkVO network = mock(NetworkVO.class);
when(network.getName()).thenReturn("testnetwork");
when(network.getState()).thenReturn(State.Implementing);
- when(network.getPhysicalNetworkId()).thenReturn(42L);
+ when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID);
DeployDestination dest = mock(DeployDestination.class);
@@ -270,9 +271,9 @@ public class NiciraNvpGuestNetworkGuruTest {
when(hostdao.findById(anyLong())).thenReturn(niciraHost);
when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa");
when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt");
- when(niciraHost.getId()).thenReturn(42L);
+ when(niciraHost.getId()).thenReturn(NETWORK_ID);
- when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L);
+ when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(NETWORK_ID);
Domain dom = mock(Domain.class);
when(dom.getName()).thenReturn("domain");
Account acc = mock(Account.class);
@@ -284,11 +285,11 @@ public class NiciraNvpGuestNetworkGuruTest {
CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class);
when(answer.getResult()).thenReturn(true);
when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa");
- when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer);
+ when(agentmgr.easySend(eq(NETWORK_ID), (Command)any())).thenReturn(answer);
Network implementednetwork = guru.implement(network, offering, dest, res);
assertTrue(implementednetwork != null);
- verify(agentmgr, times(1)).easySend(eq(42L), (Command)any());
+ verify(agentmgr, times(1)).easySend(eq(NETWORK_ID), (Command)any());
}
@Test
@@ -296,18 +297,18 @@ public class NiciraNvpGuestNetworkGuruTest {
PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
when(physnetdao.findById((Long) any())).thenReturn(physnet);
when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
- when(physnet.getId()).thenReturn(42L);
+ when(physnet.getId()).thenReturn(NETWORK_ID);
NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
- when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
+ when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
when(device.getId()).thenReturn(1L);
NetworkOffering offering = mock(NetworkOffering.class);
- when(offering.getId()).thenReturn(42L);
+ when(offering.getId()).thenReturn(NETWORK_ID);
when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
when(offering.getGuestType()).thenReturn(GuestType.Isolated);
- when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false);
+ when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
mock(DeploymentPlan.class);
@@ -316,7 +317,7 @@ public class NiciraNvpGuestNetworkGuruTest {
when(network.getState()).thenReturn(State.Implementing);
when(network.getGateway()).thenReturn("10.1.1.1");
when(network.getCidr()).thenReturn("10.1.1.0/24");
- when(network.getPhysicalNetworkId()).thenReturn(42L);
+ when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID);
DeployDestination dest = mock(DeployDestination.class);
@@ -327,9 +328,9 @@ public class NiciraNvpGuestNetworkGuruTest {
when(hostdao.findById(anyLong())).thenReturn(niciraHost);
when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa");
when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt");
- when(niciraHost.getId()).thenReturn(42L);
+ when(niciraHost.getId()).thenReturn(NETWORK_ID);
- when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L);
+ when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(NETWORK_ID);
Domain dom = mock(Domain.class);
when(dom.getName()).thenReturn("domain");
Account acc = mock(Account.class);
@@ -341,13 +342,13 @@ public class NiciraNvpGuestNetworkGuruTest {
CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class);
when(answer.getResult()).thenReturn(true);
when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa");
- when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer);
+ when(agentmgr.easySend(eq(NETWORK_ID), (Command)any())).thenReturn(answer);
Network implementednetwork = guru.implement(network, offering, dest, res);
assertTrue(implementednetwork != null);
assertTrue(implementednetwork.getCidr().equals("10.1.1.0/24"));
assertTrue(implementednetwork.getGateway().equals("10.1.1.1"));
- verify(agentmgr, times(1)).easySend(eq(42L), (Command)any());
+ verify(agentmgr, times(1)).easySend(eq(NETWORK_ID), (Command)any());
}
@Test
@@ -355,25 +356,25 @@ public class NiciraNvpGuestNetworkGuruTest {
PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
when(physnetdao.findById((Long) any())).thenReturn(physnet);
when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
- when(physnet.getId()).thenReturn(42L);
+ when(physnet.getId()).thenReturn(NETWORK_ID);
NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
- when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
+ when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
when(device.getId()).thenReturn(1L);
NetworkOffering offering = mock(NetworkOffering.class);
- when(offering.getId()).thenReturn(42L);
+ when(offering.getId()).thenReturn(NETWORK_ID);
when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
when(offering.getGuestType()).thenReturn(GuestType.Isolated);
- when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false);
+ when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
mock(DeploymentPlan.class);
NetworkVO network = mock(NetworkVO.class);
when(network.getName()).thenReturn("testnetwork");
when(network.getState()).thenReturn(State.Implementing);
- when(network.getPhysicalNetworkId()).thenReturn(42L);
+ when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID);
DeployDestination dest = mock(DeployDestination.class);
@@ -384,9 +385,9 @@ public class NiciraNvpGuestNetworkGuruTest {
when(hostdao.findById(anyLong())).thenReturn(niciraHost);
when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa");
when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt");
- when(niciraHost.getId()).thenReturn(42L);
+ when(niciraHost.getId()).thenReturn(NETWORK_ID);
- when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L);
+ when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(NETWORK_ID);
Domain dom = mock(Domain.class);
when(dom.getName()).thenReturn("domain");
Account acc = mock(Account.class);
@@ -398,11 +399,11 @@ public class NiciraNvpGuestNetworkGuruTest {
CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class);
when(answer.getResult()).thenReturn(true);
//when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa");
- when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer);
+ when(agentmgr.easySend(eq(NETWORK_ID), (Command)any())).thenReturn(answer);
Network implementednetwork = guru.implement(network, offering, dest, res);
assertTrue(implementednetwork == null);
- verify(agentmgr, times(1)).easySend(eq(42L), (Command)any());
+ verify(agentmgr, times(1)).easySend(eq(NETWORK_ID), (Command)any());
}
@Test
@@ -410,18 +411,18 @@ public class NiciraNvpGuestNetworkGuruTest {
PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
when(physnetdao.findById((Long) any())).thenReturn(physnet);
when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
- when(physnet.getId()).thenReturn(42L);
+ when(physnet.getId()).thenReturn(NETWORK_ID);
NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
- when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
+ when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
when(device.getId()).thenReturn(1L);
NetworkOffering offering = mock(NetworkOffering.class);
- when(offering.getId()).thenReturn(42L);
+ when(offering.getId()).thenReturn(NETWORK_ID);
when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
when(offering.getGuestType()).thenReturn(GuestType.Isolated);
- when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false);
+ when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
mock(DeploymentPlan.class);
@@ -430,8 +431,8 @@ public class NiciraNvpGuestNetworkGuruTest {
when(network.getState()).thenReturn(State.Implementing);
when(network.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Lswitch);
when(network.getBroadcastUri()).thenReturn(new URI("lswitch:aaaaa"));
- when(network.getPhysicalNetworkId()).thenReturn(42L);
- when(netdao.findById(42L)).thenReturn(network);
+ when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID);
+ when(netdao.findById(NETWORK_ID)).thenReturn(network);
DeployDestination dest = mock(DeployDestination.class);
@@ -442,9 +443,9 @@ public class NiciraNvpGuestNetworkGuruTest {
when(hostdao.findById(anyLong())).thenReturn(niciraHost);
when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa");
when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt");
- when(niciraHost.getId()).thenReturn(42L);
+ when(niciraHost.getId()).thenReturn(NETWORK_ID);
- when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L);
+ when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(NETWORK_ID);
Domain dom = mock(Domain.class);
when(dom.getName()).thenReturn("domain");
Account acc = mock(Account.class);
@@ -455,15 +456,15 @@ public class NiciraNvpGuestNetworkGuruTest {
DeleteLogicalSwitchAnswer answer = mock(DeleteLogicalSwitchAnswer.class);
when(answer.getResult()).thenReturn(true);
- when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer);
+ when(agentmgr.easySend(eq(NETWORK_ID), (Command)any())).thenReturn(answer);
NetworkProfile implementednetwork = mock(NetworkProfile.class);
- when(implementednetwork.getId()).thenReturn(42L);
+ when(implementednetwork.getId()).thenReturn(NETWORK_ID);
when(implementednetwork.getBroadcastUri()).thenReturn(new URI("lswitch:aaaa"));
when(offering.getSpecifyVlan()).thenReturn(false);
guru.shutdown(implementednetwork, offering);
- verify(agentmgr, times(1)).easySend(eq(42L), (Command)any());
+ verify(agentmgr, times(1)).easySend(eq(NETWORK_ID), (Command)any());
verify(implementednetwork, times(1)).setBroadcastUri(null);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraNvpApiTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraNvpApiTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraNvpApiTest.java
index 1467d47..21d2e7f 100644
--- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraNvpApiTest.java
+++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraNvpApiTest.java
@@ -40,87 +40,87 @@ import org.junit.Before;
import org.junit.Test;
public class NiciraNvpApiTest {
- NiciraNvpApi _api;
- HttpClient _client = mock(HttpClient.class);
- HttpMethod _method;
+ NiciraNvpApi api;
+ HttpClient client = mock(HttpClient.class);
+ HttpMethod method;
@Before
public void setUp() {
HttpClientParams hmp = mock(HttpClientParams.class);
- when (_client.getParams()).thenReturn(hmp);
- _api = new NiciraNvpApi() {
+ when (client.getParams()).thenReturn(hmp);
+ api = new NiciraNvpApi() {
@Override
protected HttpClient createHttpClient() {
- return _client;
+ return client;
}
@Override
protected HttpMethod createMethod(String type, String uri) {
- return _method;
+ return method;
}
};
- _api.setAdminCredentials("admin", "adminpass");
- _api.setControllerAddress("localhost");
+ api.setAdminCredentials("admin", "adminpass");
+ api.setControllerAddress("localhost");
}
@Test (expected=NiciraNvpApiException.class)
public void testExecuteLoginWithoutHostname() throws NiciraNvpApiException {
- _api.setControllerAddress(null);
- _api.login();
+ api.setControllerAddress(null);
+ api.login();
}
@Test (expected=NiciraNvpApiException.class)
public void testExecuteLoginWithoutCredentials() throws NiciraNvpApiException {
- _api.setAdminCredentials(null, null);
- _api.login();
+ api.setAdminCredentials(null, null);
+ api.login();
}
@Test (expected=NiciraNvpApiException.class)
public void testExecuteUpdateObjectWithoutHostname() throws NiciraNvpApiException {
- _api.setControllerAddress(null);
- _api.executeUpdateObject(new String(), "/", Collections.<String, String> emptyMap());
+ api.setControllerAddress(null);
+ api.executeUpdateObject(new String(), "/", Collections.<String, String> emptyMap());
}
@Test (expected=NiciraNvpApiException.class)
public void testExecuteUpdateObjectWithoutCredentials() throws NiciraNvpApiException {
- _api.setAdminCredentials(null, null);
- _api.executeUpdateObject(new String(), "/", Collections.<String, String> emptyMap());
+ api.setAdminCredentials(null, null);
+ api.executeUpdateObject(new String(), "/", Collections.<String, String> emptyMap());
}
@Test (expected=NiciraNvpApiException.class)
public void testExecuteCreateObjectWithoutHostname() throws NiciraNvpApiException {
- _api.setControllerAddress(null);
- _api.executeCreateObject(new String(), String.class, "/", Collections.<String, String> emptyMap());
+ api.setControllerAddress(null);
+ api.executeCreateObject(new String(), String.class, "/", Collections.<String, String> emptyMap());
}
@Test (expected=NiciraNvpApiException.class)
public void testExecuteCreateObjectWithoutCredentials() throws NiciraNvpApiException {
- _api.setAdminCredentials(null, null);
- _api.executeCreateObject(new String(), String.class, "/", Collections.<String, String> emptyMap());
+ api.setAdminCredentials(null, null);
+ api.executeCreateObject(new String(), String.class, "/", Collections.<String, String> emptyMap());
}
@Test (expected=NiciraNvpApiException.class)
public void testExecuteDeleteObjectWithoutHostname() throws NiciraNvpApiException {
- _api.setControllerAddress(null);
- _api.executeDeleteObject("/");
+ api.setControllerAddress(null);
+ api.executeDeleteObject("/");
}
@Test (expected=NiciraNvpApiException.class)
public void testExecuteDeleteObjectWithoutCredentials() throws NiciraNvpApiException {
- _api.setAdminCredentials(null, null);
- _api.executeDeleteObject("/");
+ api.setAdminCredentials(null, null);
+ api.executeDeleteObject("/");
}
@Test (expected=NiciraNvpApiException.class)
public void testExecuteRetrieveObjectWithoutHostname() throws NiciraNvpApiException {
- _api.setControllerAddress(null);
- _api.executeRetrieveObject(String.class, "/", Collections.<String, String> emptyMap());
+ api.setControllerAddress(null);
+ api.executeRetrieveObject(String.class, "/", Collections.<String, String> emptyMap());
}
@Test (expected=NiciraNvpApiException.class)
public void testExecuteRetrieveObjectWithoutCredentials() throws NiciraNvpApiException {
- _api.setAdminCredentials(null, null);
- _api.executeDeleteObject("/");
+ api.setAdminCredentials(null, null);
+ api.executeDeleteObject("/");
}
@Test
@@ -128,7 +128,7 @@ public class NiciraNvpApiTest {
GetMethod gm = mock(GetMethod.class);
when(gm.getStatusCode()).thenReturn(HttpStatus.SC_OK);
- _api.executeMethod(gm);
+ api.executeMethod(gm);
verify(gm, times(1)).getStatusCode();
}
@@ -138,172 +138,172 @@ public class NiciraNvpApiTest {
@Test (expected=NiciraNvpApiException.class)
public void executeMethodTestWithLogin() throws NiciraNvpApiException, HttpException, IOException {
GetMethod gm = mock(GetMethod.class);
- when(_client.executeMethod((HttpMethod)any())).thenThrow(new HttpException());
+ when(client.executeMethod((HttpMethod)any())).thenThrow(new HttpException());
when(gm.getStatusCode()).thenReturn(HttpStatus.SC_UNAUTHORIZED).thenReturn(HttpStatus.SC_UNAUTHORIZED);
- _api.executeMethod(gm);
+ api.executeMethod(gm);
verify(gm, times(1)).getStatusCode();
}
@Test
public void testExecuteCreateObject() throws NiciraNvpApiException, IOException {
LogicalSwitch ls = new LogicalSwitch();
- _method = mock(PostMethod.class);
- when(_method.getStatusCode()).thenReturn(HttpStatus.SC_CREATED);
- when(_method.getResponseBodyAsString()).thenReturn("{ \"uuid\" : \"aaaa\" }");
- ls = _api.executeCreateObject(ls, LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
+ method = mock(PostMethod.class);
+ when(method.getStatusCode()).thenReturn(HttpStatus.SC_CREATED);
+ when(method.getResponseBodyAsString()).thenReturn("{ \"uuid\" : \"aaaa\" }");
+ ls = api.executeCreateObject(ls, LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
assertTrue("aaaa".equals(ls.getUuid()));
- verify(_method, times(1)).releaseConnection();
+ verify(method, times(1)).releaseConnection();
}
@Test (expected=NiciraNvpApiException.class)
public void testExecuteCreateObjectFailure() throws NiciraNvpApiException, IOException {
LogicalSwitch ls = new LogicalSwitch();
- _method = mock(PostMethod.class);
- when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ method = mock(PostMethod.class);
+ when(method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
Header header = mock(Header.class);
when(header.getValue()).thenReturn("text/html");
- when(_method.getResponseHeader("Content-Type")).thenReturn(header);
- when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
- when(_method.isRequestSent()).thenReturn(true);
+ when(method.getResponseHeader("Content-Type")).thenReturn(header);
+ when(method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
+ when(method.isRequestSent()).thenReturn(true);
try {
- ls = _api.executeCreateObject(ls, LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
+ ls = api.executeCreateObject(ls, LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
} finally {
- verify(_method, times(1)).releaseConnection();
+ verify(method, times(1)).releaseConnection();
}
}
@Test (expected=NiciraNvpApiException.class)
public void testExecuteCreateObjectException() throws NiciraNvpApiException, IOException {
LogicalSwitch ls = new LogicalSwitch();
- when(_client.executeMethod((HttpMethod) any())).thenThrow(new HttpException());
- _method = mock(PostMethod.class);
- when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ when(client.executeMethod((HttpMethod) any())).thenThrow(new HttpException());
+ method = mock(PostMethod.class);
+ when(method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
Header header = mock(Header.class);
when(header.getValue()).thenReturn("text/html");
- when(_method.getResponseHeader("Content-Type")).thenReturn(header);
- when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
+ when(method.getResponseHeader("Content-Type")).thenReturn(header);
+ when(method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
try {
- ls = _api.executeCreateObject(ls, LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
+ ls = api.executeCreateObject(ls, LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
} finally {
- verify(_method, times(1)).releaseConnection();
+ verify(method, times(1)).releaseConnection();
}
}
@Test
public void testExecuteUpdateObject() throws NiciraNvpApiException, IOException {
LogicalSwitch ls = new LogicalSwitch();
- _method = mock(PutMethod.class);
- when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
- _api.executeUpdateObject(ls, "/", Collections.<String, String> emptyMap());
- verify(_method, times(1)).releaseConnection();
- verify(_client, times(1)).executeMethod(_method);
+ method = mock(PutMethod.class);
+ when(method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
+ api.executeUpdateObject(ls, "/", Collections.<String, String> emptyMap());
+ verify(method, times(1)).releaseConnection();
+ verify(client, times(1)).executeMethod(method);
}
@Test (expected=NiciraNvpApiException.class)
public void testExecuteUpdateObjectFailure() throws NiciraNvpApiException, IOException {
LogicalSwitch ls = new LogicalSwitch();
- _method = mock(PutMethod.class);
- when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ method = mock(PutMethod.class);
+ when(method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
Header header = mock(Header.class);
when(header.getValue()).thenReturn("text/html");
- when(_method.getResponseHeader("Content-Type")).thenReturn(header);
- when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
- when(_method.isRequestSent()).thenReturn(true);
+ when(method.getResponseHeader("Content-Type")).thenReturn(header);
+ when(method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
+ when(method.isRequestSent()).thenReturn(true);
try {
- _api.executeUpdateObject(ls, "/", Collections.<String, String> emptyMap());
+ api.executeUpdateObject(ls, "/", Collections.<String, String> emptyMap());
} finally {
- verify(_method, times(1)).releaseConnection();
+ verify(method, times(1)).releaseConnection();
}
}
@Test (expected=NiciraNvpApiException.class)
public void testExecuteUpdateObjectException() throws NiciraNvpApiException, IOException {
LogicalSwitch ls = new LogicalSwitch();
- _method = mock(PutMethod.class);
- when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
- when(_client.executeMethod((HttpMethod) any())).thenThrow(new IOException());
+ method = mock(PutMethod.class);
+ when(method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
+ when(client.executeMethod((HttpMethod) any())).thenThrow(new IOException());
try {
- _api.executeUpdateObject(ls, "/", Collections.<String, String> emptyMap());
+ api.executeUpdateObject(ls, "/", Collections.<String, String> emptyMap());
} finally {
- verify(_method, times(1)).releaseConnection();
+ verify(method, times(1)).releaseConnection();
}
}
@Test
public void testExecuteDeleteObject() throws NiciraNvpApiException, IOException {
- _method = mock(DeleteMethod.class);
- when(_method.getStatusCode()).thenReturn(HttpStatus.SC_NO_CONTENT);
- _api.executeDeleteObject("/");
- verify(_method, times(1)).releaseConnection();
- verify(_client, times(1)).executeMethod(_method);
+ method = mock(DeleteMethod.class);
+ when(method.getStatusCode()).thenReturn(HttpStatus.SC_NO_CONTENT);
+ api.executeDeleteObject("/");
+ verify(method, times(1)).releaseConnection();
+ verify(client, times(1)).executeMethod(method);
}
@Test (expected=NiciraNvpApiException.class)
public void testExecuteDeleteObjectFailure() throws NiciraNvpApiException, IOException {
- _method = mock(DeleteMethod.class);
- when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ method = mock(DeleteMethod.class);
+ when(method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
Header header = mock(Header.class);
when(header.getValue()).thenReturn("text/html");
- when(_method.getResponseHeader("Content-Type")).thenReturn(header);
- when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
- when(_method.isRequestSent()).thenReturn(true);
+ when(method.getResponseHeader("Content-Type")).thenReturn(header);
+ when(method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
+ when(method.isRequestSent()).thenReturn(true);
try {
- _api.executeDeleteObject("/");
+ api.executeDeleteObject("/");
} finally {
- verify(_method, times(1)).releaseConnection();
+ verify(method, times(1)).releaseConnection();
}
}
@Test (expected=NiciraNvpApiException.class)
public void testExecuteDeleteObjectException() throws NiciraNvpApiException, IOException {
- _method = mock(DeleteMethod.class);
- when(_method.getStatusCode()).thenReturn(HttpStatus.SC_NO_CONTENT);
- when(_client.executeMethod((HttpMethod) any())).thenThrow(new HttpException());
+ method = mock(DeleteMethod.class);
+ when(method.getStatusCode()).thenReturn(HttpStatus.SC_NO_CONTENT);
+ when(client.executeMethod((HttpMethod) any())).thenThrow(new HttpException());
try {
- _api.executeDeleteObject("/");
+ api.executeDeleteObject("/");
} finally {
- verify(_method, times(1)).releaseConnection();
+ verify(method, times(1)).releaseConnection();
}
}
@Test
public void testExecuteRetrieveObject() throws NiciraNvpApiException, IOException {
- _method = mock(GetMethod.class);
- when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
- when(_method.getResponseBodyAsString()).thenReturn("{ \"uuid\" : \"aaaa\" }");
- _api.executeRetrieveObject(LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
- verify(_method, times(1)).releaseConnection();
- verify(_client, times(1)).executeMethod(_method);
+ method = mock(GetMethod.class);
+ when(method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
+ when(method.getResponseBodyAsString()).thenReturn("{ \"uuid\" : \"aaaa\" }");
+ api.executeRetrieveObject(LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
+ verify(method, times(1)).releaseConnection();
+ verify(client, times(1)).executeMethod(method);
}
@Test (expected=NiciraNvpApiException.class)
public void testExecuteRetrieveObjectFailure() throws NiciraNvpApiException, IOException {
- _method = mock(GetMethod.class);
- when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
- when(_method.getResponseBodyAsString()).thenReturn("{ \"uuid\" : \"aaaa\" }");
+ method = mock(GetMethod.class);
+ when(method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ when(method.getResponseBodyAsString()).thenReturn("{ \"uuid\" : \"aaaa\" }");
Header header = mock(Header.class);
when(header.getValue()).thenReturn("text/html");
- when(_method.getResponseHeader("Content-Type")).thenReturn(header);
- when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
- when(_method.isRequestSent()).thenReturn(true);
+ when(method.getResponseHeader("Content-Type")).thenReturn(header);
+ when(method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
+ when(method.isRequestSent()).thenReturn(true);
try {
- _api.executeRetrieveObject(LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
+ api.executeRetrieveObject(LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
} finally {
- verify(_method, times(1)).releaseConnection();
+ verify(method, times(1)).releaseConnection();
}
}
@Test (expected=NiciraNvpApiException.class)
public void testExecuteRetrieveObjectException() throws NiciraNvpApiException, IOException {
- _method = mock(GetMethod.class);
- when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
- when(_method.getResponseBodyAsString()).thenReturn("{ \"uuid\" : \"aaaa\" }");
- when(_client.executeMethod((HttpMethod) any())).thenThrow(new HttpException());
+ method = mock(GetMethod.class);
+ when(method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
+ when(method.getResponseBodyAsString()).thenReturn("{ \"uuid\" : \"aaaa\" }");
+ when(client.executeMethod((HttpMethod) any())).thenThrow(new HttpException());
try {
- _api.executeRetrieveObject(LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
+ api.executeRetrieveObject(LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
} finally {
- verify(_method, times(1)).releaseConnection();
+ verify(method, times(1)).releaseConnection();
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraTagTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraTagTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraTagTest.java
index fd13e07..abf98d4 100644
--- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraTagTest.java
+++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraTagTest.java
@@ -17,7 +17,7 @@
package com.cloud.network.nicira;
import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
public class NiciraTagTest {
@Test
[46/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-4793: UI > Virtual Routers > add new action "Upgrade Router to Newer Template" on top of listView.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d6a38c23
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d6a38c23
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d6a38c23
Branch: refs/heads/disk-cache
Commit: d6a38c238a32a60d2838a6f9a0863480a3609788
Parents: 481af07
Author: Jessica Wang <je...@apache.org>
Authored: Tue Nov 19 14:31:12 2013 -0800
Committer: Jessica Wang <je...@apache.org>
Committed: Tue Nov 19 14:32:18 2013 -0800
----------------------------------------------------------------------
ui/scripts/system.js | 321 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 320 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6a38c23/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 405c5ce..472c821 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -7391,7 +7391,326 @@
},
virtualRouters: function() {
var listView = $.extend(true, {}, cloudStack.sections.system.subsections.virtualRouters.listView, {
- dataProvider: function(args) {
+
+ //???
+ actions: {
+ upgradeRouterToUseNewerTemplate: {
+ isHeader: true,
+
+ label: 'Upgrade Router to Use Newer Template',
+
+ messages: {
+ notification: function(args) {
+ return 'Upgrade Router to Use Newer Template';
+ }
+ },
+
+ createForm: {
+ title: 'Upgrade Router to Use Newer Template',
+ fields: {
+ zoneid: {
+ label: 'label.zone',
+ select: function(args) {
+ var items = [{ id: '', description: '' }];
+ $.ajax({
+ url: createURL('listZones'),
+ data: {
+ listAll: true
+ },
+ success: function(json) {
+ var objs = json.listzonesresponse.zone;
+ if (objs != null) {
+ for (var i = 0; i < objs.length; i++) {
+ items.push({ id: objs[i].id, description: objs[i].name });
+ }
+ }
+ args.response.success({
+ data: items
+ });
+ }
+ });
+ }
+ },
+ podid: {
+ label: 'Pod',
+ dependsOn: 'zoneid',
+ select: function (args) {
+ var items = [{ id: '', description: '' }];
+ if (args.zoneid.length > 0) {
+ $.ajax({
+ url: createURL('listPods'),
+ data: {
+ zoneid: args.zoneid
+ },
+ success: function (json) {
+ var objs = json.listpodsresponse.pod;
+ if (objs != null) {
+ for (var i = 0; i < objs.length; i++) {
+ items.push({ id: objs[i].id, description: objs[i].name });
+ }
+ }
+ args.response.success({
+ data: items
+ });
+ }
+ });
+ } else {
+ args.response.success({
+ data: items
+ });
+ }
+ }
+ },
+ clusterid: {
+ label: 'label.cluster',
+ dependsOn: 'podid',
+ select: function(args) {
+ var items = [{ id: '', description: '' }];
+ if (args.podid.length > 0) {
+ $.ajax({
+ url: createURL('listClusters'),
+ data: {
+ podid: args.podid
+ },
+ success: function(json) {
+ var objs = json.listclustersresponse.cluster;
+ if (objs != null) {
+ for (var i = 0; i < objs.length; i++) {
+ items.push({ id: objs[i].id, description: objs[i].name });
+ }
+ }
+ args.response.success({
+ data: items
+ });
+ }
+ });
+ } else {
+ args.response.success({
+ data: items
+ });
+ }
+ }
+ }
+ }
+ },
+
+ action: function(args) {
+ var data = {};
+ if (args.data.clusterid.length > 0) {
+ $.extend(data, {
+ clusterid: args.data.clusterid
+ });
+ } else if (args.data.podid.length > 0) {
+ $.extend(data, {
+ podid: args.data.podid
+ });
+ } else if (args.data.zoneid.length > 0) {
+ $.extend(data, {
+ zoneid: args.data.zoneid
+ });
+ } else {
+ args.response.error('Please specify a zone, a pod or a cluster.' );
+ return;
+ }
+
+ $.ajax({
+ url: createURL('upgradeRouterTemplate'),
+ data: data,
+ success: function(json) {
+ //example
+ /*
+ json = {
+ "upgraderoutertemplateresponse": {
+ "count": 3,
+ "asyncjobs": [
+ {
+ "jobid": "2d51f1f9-ea39-4871-9512-431f4a65a5f2"
+ },
+ {
+ "jobid": "d66fa7ef-c91f-425f-b820-2f8ff2a0da8c"
+ },
+ {
+ "jobid": "850a3cfd-c265-48f1-880a-f001481fc7f7"
+ }
+ ]
+ }
+ };
+ */
+
+ var jobs = json.upgraderoutertemplateresponse.asyncjobs;
+ if (jobs != undefined) {
+ for (var i = 0; i < jobs.length; i++) {
+ var jid = jobs[i].jobid;
+ args.response.success({
+ _custom: {
+ jobId: jid
+ }
+ });
+
+ //example begins
+ /*
+ {
+ "queryasyncjobresultresponse": {
+ "accountid": "ce5820a8-5099-11e3-80db-3c970e739c3e",
+ "userid": "ce58353e-5099-11e3-80db-3c970e739c3e",
+ "cmd": "org.apache.cloudstack.api.command.admin.router.RebootRouterCmd",
+ "jobstatus": 2,
+ "jobprocstatus": 0,
+ "jobresultcode": 530,
+ "jobresulttype": "object",
+ "jobresult": {
+ "errorcode": 530,
+ "errortext": "Resource [DataCenter:1] is unreachable: Unable to reboot domR, it is not in right state Stopped"
+ },
+ "created": "2013-11-19T11:41:40-0800",
+ "jobid": "2d51f1f9-ea39-4871-9512-431f4a65a5f2"
+ }
+ }
+ {
+ "queryasyncjobresultresponse": {
+ "accountid": "9b0ea3b4-a699-431c-932b-570388ef7b86",
+ "userid": "ce58353e-5099-11e3-80db-3c970e739c3e",
+ "cmd": "org.apache.cloudstack.api.command.admin.router.RebootRouterCmd",
+ "jobstatus": 0,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobinstancetype": "DomainRouter",
+ "jobinstanceid": "d6e625ea-76f9-4c35-9f89-0998a04a3b9c",
+ "created": "2013-11-19T11:41:40-0800",
+ "jobid": "d66fa7ef-c91f-425f-b820-2f8ff2a0da8c"
+ }
+ }
+ {
+ "queryasyncjobresultresponse": {
+ "accountid": "6b5334a2-1c0e-46e0-b4d9-524698549f08",
+ "userid": "ce58353e-5099-11e3-80db-3c970e739c3e",
+ "cmd": "org.apache.cloudstack.api.command.admin.router.RebootRouterCmd",
+ "jobstatus": 2,
+ "jobprocstatus": 0,
+ "jobresultcode": 530,
+ "jobresulttype": "object",
+ "jobresult": {
+ "errorcode": 530,
+ "errortext": "Resource [DataCenter:1] is unreachable: Unable to reboot domR, it is not in right state Starting"
+ },
+ "created": "2013-11-19T11:41:40-0800",
+ "jobid": "850a3cfd-c265-48f1-880a-f001481fc7f7"
+ }
+ }
+
+
+ {
+ "queryasyncjobresultresponse": {
+ "accountid": "9b0ea3b4-a699-431c-932b-570388ef7b86",
+ "userid": "ce58353e-5099-11e3-80db-3c970e739c3e",
+ "cmd": "org.apache.cloudstack.api.command.admin.router.RebootRouterCmd",
+ "jobstatus": 0,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobinstancetype": "DomainRouter",
+ "jobinstanceid": "d6e625ea-76f9-4c35-9f89-0998a04a3b9c",
+ "created": "2013-11-19T11:41:40-0800",
+ "jobid": "d66fa7ef-c91f-425f-b820-2f8ff2a0da8c"
+ }
+ }
+ {
+ "queryasyncjobresultresponse": {
+ "accountid": "9b0ea3b4-a699-431c-932b-570388ef7b86",
+ "userid": "ce58353e-5099-11e3-80db-3c970e739c3e",
+ "cmd": "org.apache.cloudstack.api.command.admin.router.RebootRouterCmd",
+ "jobstatus": 0,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobinstancetype": "DomainRouter",
+ "jobinstanceid": "d6e625ea-76f9-4c35-9f89-0998a04a3b9c",
+ "created": "2013-11-19T11:41:40-0800",
+ "jobid": "d66fa7ef-c91f-425f-b820-2f8ff2a0da8c"
+ }
+ }
+ {
+ "queryasyncjobresultresponse": {
+ "accountid": "9b0ea3b4-a699-431c-932b-570388ef7b86",
+ "userid": "ce58353e-5099-11e3-80db-3c970e739c3e",
+ "cmd": "org.apache.cloudstack.api.command.admin.router.RebootRouterCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "router": {
+ "id": "d6e625ea-76f9-4c35-9f89-0998a04a3b9c",
+ "zoneid": "3bfdd7d1-134a-4d75-8621-0ccfc8641660",
+ "zonename": "jw-adv",
+ "dns1": "8.8.8.8",
+ "gateway": "10.223.67.1",
+ "name": "r-6-VM",
+ "linklocalip": "169.254.2.29",
+ "linklocalmacaddress": "0e:00:a9:fe:02:1d",
+ "linklocalnetmask": "255.255.0.0",
+ "linklocalnetworkid": "4a02a05f-1312-484a-a82b-246a86ed6949",
+ "publicip": "10.223.67.6",
+ "publicmacaddress": "06:8d:22:00:00:18",
+ "publicnetmask": "255.255.255.0",
+ "publicnetworkid": "e7056c3c-2c7f-4e84-909e-af288ae170e9",
+ "templateid": "cd70f70a-5099-11e3-80db-3c970e739c3e",
+ "created": "2013-11-19T11:36:04-0800",
+ "state": "Running",
+ "account": "aaa_admin",
+ "domainid": "b95a5b02-e45d-4971-b0d8-d1620f7bf44e",
+ "domain": "aaa",
+ "serviceofferingid": "7dd7687c-01f0-4a14-846e-8e46067a8ff9",
+ "serviceofferingname": "System Offering For Software Router",
+ "isredundantrouter": false,
+ "redundantstate": "UNKNOWN",
+ "version": "3.0",
+ "role": "VIRTUAL_ROUTER",
+ "nic": [
+ {
+ "id": "d41bf67e-1d58-4ec9-bf61-41903140cc53",
+ "networkid": "e7056c3c-2c7f-4e84-909e-af288ae170e9",
+ "netmask": "255.255.255.0",
+ "gateway": "10.223.67.1",
+ "ipaddress": "10.223.67.6",
+ "isolationuri": "vlan://159",
+ "broadcasturi": "vlan://159",
+ "traffictype": "Public",
+ "isdefault": true,
+ "macaddress": "06:8d:22:00:00:18"
+ },
+ {
+ "id": "a6d1f6ac-fc45-474e-b372-3571e639fa8e",
+ "networkid": "4a02a05f-1312-484a-a82b-246a86ed6949",
+ "netmask": "255.255.0.0",
+ "gateway": "169.254.0.1",
+ "ipaddress": "169.254.2.29",
+ "traffictype": "Control",
+ "isdefault": false,
+ "macaddress": "0e:00:a9:fe:02:1d"
+ }
+ ],
+ "requiresupgrade": true,
+ "jobid": "d66fa7ef-c91f-425f-b820-2f8ff2a0da8c",
+ "jobstatus": 0
+ }
+ },
+ "created": "2013-11-19T11:41:40-0800",
+ "jobid": "d66fa7ef-c91f-425f-b820-2f8ff2a0da8c"
+ }
+ }
+ */
+ //example ends
+ }
+ }
+ }
+ });
+ },
+ notification: {
+ poll: pollAsyncJobResult
+ }
+ }
+ },
+
+ dataProvider: function(args) {
var data = {};
listViewDataProvider(args, data);
[07/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-999: hyper-V: UI > Add Primary Storage > when hypervisor type of selected cluster is Hyperv, populate Protocol dropdown with only one option "SMB/cifs".
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8ec1f3f8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8ec1f3f8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8ec1f3f8
Branch: refs/heads/disk-cache
Commit: 8ec1f3f8d079244a2a1db7d2bc9e13f0d954f6fc
Parents: 59453ea
Author: Jessica Wang <je...@apache.org>
Authored: Thu Nov 14 11:41:32 2013 -0800
Committer: Jessica Wang <je...@apache.org>
Committed: Thu Nov 14 11:42:59 2013 -0800
----------------------------------------------------------------------
ui/scripts/system.js | 37 +++++++++++++------------------------
ui/scripts/zoneWizard.js | 39 ++++++++++++++-------------------------
2 files changed, 27 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ec1f3f8/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index bba5321..6062135 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -13524,11 +13524,7 @@
items.push({
id: "nfs",
description: "nfs"
- });
- items.push({
- id: "SMB",
- description: "SMB/cifs"
- });
+ });
items.push({
id: "SharedMountPoint",
description: "SharedMountPoint"
@@ -13549,11 +13545,7 @@
items.push({
id: "nfs",
description: "nfs"
- });
- items.push({
- id: "SMB",
- description: "SMB/cifs"
- });
+ });
items.push({
id: "PreSetup",
description: "PreSetup"
@@ -13570,15 +13562,20 @@
items.push({
id: "nfs",
description: "nfs"
+ });
+ items.push({
+ id: "vmfs",
+ description: "vmfs"
+ });
+ args.response.success({
+ data: items
});
+ } else if (selectedClusterObj.hypervisortype == "Hyperv") {
+ var items = [];
items.push({
id: "SMB",
description: "SMB/cifs"
});
- items.push({
- id: "vmfs",
- description: "vmfs"
- });
args.response.success({
data: items
});
@@ -13587,11 +13584,7 @@
items.push({
id: "nfs",
description: "nfs"
- });
- items.push({
- id: "SMB",
- description: "SMB/cifs"
- });
+ });
items.push({
id: "ocfs2",
description: "ocfs2"
@@ -13604,11 +13597,7 @@
items.push({
id: "nfs",
description: "nfs"
- });
- items.push({
- id: "SMB",
- description: "SMB/cifs"
- });
+ });
items.push({
id: "SharedMountPoint",
description: "SharedMountPoint"
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ec1f3f8/ui/scripts/zoneWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js
index c5db0f9..f84812e 100755
--- a/ui/scripts/zoneWizard.js
+++ b/ui/scripts/zoneWizard.js
@@ -1473,11 +1473,7 @@
items.push({
id: "nfs",
description: "nfs"
- });
- items.push({
- id: "SMB",
- description: "SMB/cifs"
- });
+ });
items.push({
id: "SharedMountPoint",
description: "SharedMountPoint"
@@ -1494,11 +1490,7 @@
items.push({
id: "nfs",
description: "nfs"
- });
- items.push({
- id: "SMB",
- description: "SMB/cifs"
- });
+ });
items.push({
id: "PreSetup",
description: "PreSetup"
@@ -1515,11 +1507,7 @@
items.push({
id: "nfs",
description: "nfs"
- });
- items.push({
- id: "SMB",
- description: "SMB/cifs"
- });
+ });
items.push({
id: "vmfs",
description: "vmfs"
@@ -1527,16 +1515,21 @@
args.response.success({
data: items
});
+ } else if (selectedClusterObj.hypervisortype == "Hyperv") {
+ var items = [];
+ items.push({
+ id: "SMB",
+ description: "SMB/cifs"
+ });
+ args.response.success({
+ data: items
+ });
} else if (selectedClusterObj.hypervisortype == "Ovm") {
var items = [];
items.push({
id: "nfs",
description: "nfs"
- });
- items.push({
- id: "SMB",
- description: "SMB/cifs"
- });
+ });
items.push({
id: "ocfs2",
description: "ocfs2"
@@ -1549,11 +1542,7 @@
items.push({
id: "nfs",
description: "nfs"
- });
- items.push({
- id: "SMB",
- description: "SMB/cifs"
- });
+ });
items.push({
id: "SharedMountPoint",
description: "SharedMountPoint"
[10/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
Fixed issue with detail view fields marked as 'isPassword' not being obfuscated
CLOUDSTACK-5111
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5fb7c297
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5fb7c297
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5fb7c297
Branch: refs/heads/disk-cache
Commit: 5fb7c297260b5fb61781514c412bfad88dd86870
Parents: ac649b4
Author: Chris Suich <ch...@netapp.com>
Authored: Fri Nov 8 15:30:05 2013 -0500
Committer: Brian Federle <bf...@gmail.com>
Committed: Thu Nov 14 12:17:00 2013 -0800
----------------------------------------------------------------------
ui/scripts/ui/widgets/detailView.js | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5fb7c297/ui/scripts/ui/widgets/detailView.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/detailView.js b/ui/scripts/ui/widgets/detailView.js
index 65f71b3..b0ebaa9 100644
--- a/ui/scripts/ui/widgets/detailView.js
+++ b/ui/scripts/ui/widgets/detailView.js
@@ -462,7 +462,9 @@
$value.html(_s(
$input.attr('value')
));
- else if ($input.is('input[type=checkbox]')) {
+ else if ($input.is('input[type=password]')) {
+ $value.html('');
+ } else if ($input.is('input[type=checkbox]')) {
var val = $input.is(':checked');
$value.data('detail-view-boolean-value', _s(val));
@@ -628,6 +630,7 @@
var isBoolean = $value.data('detail-view-editable-boolean');
var data = !isBoolean ? cloudStack.sanitizeReverse($value.html()) : $value.data('detail-view-boolean-value');
var rules = $value.data('validation-rules') ? $value.data('validation-rules') : {};
+ var isPassword = $value.data('detail-view-is-password');
$value.html('');
@@ -667,7 +670,7 @@
$value.append(
$('<input>').attr({
name: name,
- type: 'text',
+ type: isPassword ? 'password' : 'text',
value: data
}).addClass('disallowSpecialCharacters').data('original-value', data)
);
@@ -1004,6 +1007,8 @@
} else if (value.isBoolean) {
$value.data('detail-view-editable-boolean', true);
$value.data('detail-view-boolean-value', content == 'Yes' ? true : false);
+ } else {
+ $value.data('detail-view-is-password', value.isPassword);
}
return true;
[43/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-4793: UI > Virtual Routers > Advanced Search > add cluster dropdown since API now supports it.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2587e42d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2587e42d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2587e42d
Branch: refs/heads/disk-cache
Commit: 2587e42db6b22d1825db2251d872e46ce91b5241
Parents: 876b7e4
Author: Jessica Wang <je...@apache.org>
Authored: Mon Nov 18 15:00:58 2013 -0800
Committer: Jessica Wang <je...@apache.org>
Committed: Mon Nov 18 15:02:35 2013 -0800
----------------------------------------------------------------------
ui/scripts/system.js | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2587e42d/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index a211a7f..405c5ce 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -7620,7 +7620,29 @@
}
});
}
- },
+ },
+ clusterid: {
+ label: 'label.cluster',
+ dependsOn: 'podid',
+ select: function(args) {
+ $.ajax({
+ url: createURL("listClusters&podid=" + args.podid),
+ dataType: "json",
+ async: false,
+ success: function(json) {
+ var clusters = json.listclustersresponse.cluster ? json.listclustersresponse.cluster : [];
+ args.response.success({
+ data: $.map(clusters, function(cluster) {
+ return {
+ id: cluster.id,
+ description: cluster.name
+ };
+ })
+ });
+ }
+ });
+ }
+ },
domainid: {
label: 'Domain',
select: function(args) {
[22/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-4835: Update global configuration test cases failed in master Changes made in update/list configuration API to use ConfigDepot
CLOUDSTACK-4169: Scoped configuraion parameters logic moved to ConfigDepot
CLOUDSTACK-5163: missing parameters in configuration table
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c29cd9d3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c29cd9d3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c29cd9d3
Branch: refs/heads/disk-cache
Commit: c29cd9d3c72e119dc74ee7070c08fc6d88dbdf05
Parents: 7dceca5
Author: Harikrishna Patnala <ha...@citrix.com>
Authored: Fri Nov 15 12:16:51 2013 +0530
Committer: Koushik Das <ko...@apache.org>
Committed: Fri Nov 15 12:19:31 2013 +0530
----------------------------------------------------------------------
.../cloud/deploy/DeploymentClusterPlanner.java | 10 +++++++++
.../framework/config/ConfigDepot.java | 4 ++++
.../framework/config/impl/ConfigDepotImpl.java | 17 ++++++++++++++-
.../com/cloud/capacity/CapacityManagerImpl.java | 2 +-
server/src/com/cloud/configuration/Config.java | 2 --
.../configuration/ConfigurationManagerImpl.java | 22 ++++++++++++++++----
.../src/com/cloud/deploy/FirstFitPlanner.java | 22 +++++++++++++++-----
.../VirtualNetworkApplianceManagerImpl.java | 13 +++++++++++-
.../cloud/server/ConfigurationServerImpl.java | 5 +++--
.../networkoffering/ChildTestConfiguration.java | 6 ++++++
10 files changed, 87 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c29cd9d3/api/src/com/cloud/deploy/DeploymentClusterPlanner.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/deploy/DeploymentClusterPlanner.java b/api/src/com/cloud/deploy/DeploymentClusterPlanner.java
index ca73267..b478223 100644
--- a/api/src/com/cloud/deploy/DeploymentClusterPlanner.java
+++ b/api/src/com/cloud/deploy/DeploymentClusterPlanner.java
@@ -20,10 +20,20 @@ import java.util.List;
import com.cloud.exception.InsufficientServerCapacityException;
import com.cloud.vm.VirtualMachineProfile;
+import org.apache.cloudstack.framework.config.ConfigKey;
/**
*/
public interface DeploymentClusterPlanner extends DeploymentPlanner {
+
+ static final String ClusterCPUCapacityDisableThresholdCK = "cluster.cpu.allocated.capacity.disablethreshold";
+ static final String ClusterMemoryCapacityDisableThresholdCK = "cluster.memory.allocated.capacity.disablethreshold";
+
+ static final ConfigKey<Float> ClusterCPUCapacityDisableThreshold = new ConfigKey<Float>(Float.class, ClusterCPUCapacityDisableThresholdCK, "Alert", "0.85",
+ "Percentage (as a value between 0 and 1) of cpu utilization above which allocators will disable using the cluster for low cpu available. Keep the corresponding notification threshold lower than this to be notified beforehand.", true, ConfigKey.Scope.Cluster, null);
+ static final ConfigKey<Float> ClusterMemoryCapacityDisableThreshold = new ConfigKey<Float>(Float.class, ClusterMemoryCapacityDisableThresholdCK, "Alert", "0.85",
+ "Percentage (as a value between 0 and 1) of memory utilization above which allocators will disable using the cluster for low memory available. Keep the corresponding notification threshold lower than this to be notified beforehand.", true, ConfigKey.Scope.Cluster, null);
+
/**
* This is called to determine list of possible clusters where a virtual
* machine can be deployed.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c29cd9d3/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java b/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java
index 2fd6efb..22452b9 100644
--- a/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java
+++ b/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java
@@ -16,6 +16,8 @@
// under the License.
package org.apache.cloudstack.framework.config;
+import java.util.List;
+
/**
* ConfigDepot is a repository of configurations.
*
@@ -23,4 +25,6 @@ package org.apache.cloudstack.framework.config;
public interface ConfigDepot {
ConfigKey<?> get(String paramName);
+
+ List<ConfigKey<?>> getConfigListByScope(String scope);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c29cd9d3/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java b/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java
index 254e6d2..305d286 100644
--- a/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java
+++ b/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java
@@ -76,8 +76,14 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin {
HashMap<String, Pair<String, ConfigKey<?>>> _allKeys = new HashMap<String, Pair<String, ConfigKey<?>>>(1007);
+ HashMap<ConfigKey.Scope, List<ConfigKey<?>>> _scopeLevelConfigsMap = new HashMap<ConfigKey.Scope, List<ConfigKey<?>>>();
+
public ConfigDepotImpl() {
ConfigKey.init(this);
+ _scopeLevelConfigsMap.put(ConfigKey.Scope.Zone, new ArrayList<ConfigKey<?>>());
+ _scopeLevelConfigsMap.put(ConfigKey.Scope.Cluster, new ArrayList<ConfigKey<?>>());
+ _scopeLevelConfigsMap.put(ConfigKey.Scope.StoragePool, new ArrayList<ConfigKey<?>>());
+ _scopeLevelConfigsMap.put(ConfigKey.Scope.Account, new ArrayList<ConfigKey<?>>());
}
@Override
@@ -108,7 +114,7 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin {
": " + key.toString());
}
_allKeys.put(key.key(), new Pair<String, ConfigKey<?>>(configurable.getConfigComponentName(), key));
-
+
ConfigurationVO vo = _configDao.findById(key.key());
if (vo == null) {
vo = new ConfigurationVO(configurable.getConfigComponentName(), key);
@@ -125,6 +131,10 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin {
_configDao.persist(vo);
}
}
+ if (key.scope() != ConfigKey.Scope.Global) {
+ List<ConfigKey<?>> currentConfigs = _scopeLevelConfigsMap.get(key.scope());
+ currentConfigs.add(key);
+ }
}
_configured.add(configurable);
@@ -172,4 +182,9 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin {
this._configurables = configurables;
}
+ @Override
+ public List<ConfigKey<?>> getConfigListByScope(String scope) {
+ return _scopeLevelConfigsMap.get(ConfigKey.Scope.valueOf(scope));
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c29cd9d3/server/src/com/cloud/capacity/CapacityManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/capacity/CapacityManagerImpl.java b/server/src/com/cloud/capacity/CapacityManagerImpl.java
index 7245f14..7f73b2f 100755
--- a/server/src/com/cloud/capacity/CapacityManagerImpl.java
+++ b/server/src/com/cloud/capacity/CapacityManagerImpl.java
@@ -964,6 +964,6 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
@Override
public ConfigKey<?>[] getConfigKeys() {
- return new ConfigKey<?>[] {CpuOverprovisioningFactor, MemOverprovisioningFactor};
+ return new ConfigKey<?>[] {CpuOverprovisioningFactor, MemOverprovisioningFactor, StorageCapacityDisableThreshold, StorageOverprovisioningFactor, StorageAllocatedCapacityDisableThreshold};
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c29cd9d3/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index bc805b7..fd26ff0 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -57,8 +57,6 @@ public enum Config {
VlanCapacityThreshold("Alert", ManagementServer.class, Float.class, "zone.vlan.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of Zone Vlan utilization above which alerts will be sent about low number of Zone Vlans.", null),
DirectNetworkPublicIpCapacityThreshold("Alert", ManagementServer.class, Float.class, "zone.directnetwork.publicip.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of Direct Network Public Ip Utilization above which alerts will be sent about low number of direct network public ips.", null),
LocalStorageCapacityThreshold("Alert", ManagementServer.class, Float.class, "cluster.localStorage.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of local storage utilization above which alerts will be sent about low local storage available.", null),
- CPUCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "cluster.cpu.allocated.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of cpu utilization above which allocators will disable using the cluster for low cpu available. Keep the corresponding notification threshold lower than this to be notified beforehand.", null, ConfigKey.Scope.Cluster.toString()),
- MemoryCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "cluster.memory.allocated.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of memory utilization above which allocators will disable using the cluster for low memory available. Keep the corresponding notification threshold lower than this to be notified beforehand.", null, ConfigKey.Scope.Cluster.toString()),
// Storage
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c29cd9d3/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 82256ca..21651ad 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -36,6 +36,8 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
+import com.cloud.deploy.DeploymentClusterPlanner;
+import org.apache.cloudstack.framework.config.ConfigDepot;
import org.apache.log4j.Logger;
import org.apache.cloudstack.acl.SecurityChecker;
@@ -117,6 +119,7 @@ import com.cloud.dc.dao.HostPodDao;
import com.cloud.dc.dao.PodVlanMapDao;
import com.cloud.dc.dao.VlanDao;
import com.cloud.deploy.DataCenterDeployment;
+import com.cloud.deploy.DeploymentPlanner;
import com.cloud.domain.Domain;
import com.cloud.domain.DomainVO;
import com.cloud.domain.dao.DomainDao;
@@ -215,6 +218,8 @@ ConfigurationManagerImpl extends ManagerBase implements ConfigurationManager, Co
@Inject
ConfigurationDao _configDao;
@Inject
+ ConfigDepot _configDepot;
+ @Inject
HostPodDao _podDao;
@Inject
AccountVlanMapDao _accountVlanMapDao;
@@ -372,8 +377,8 @@ ConfigurationManagerImpl extends ManagerBase implements ConfigurationManager, Co
weightBasedParametersForValidation.add(Config.LocalStorageCapacityThreshold.key());
weightBasedParametersForValidation.add(CapacityManager.StorageAllocatedCapacityDisableThreshold.key());
weightBasedParametersForValidation.add(CapacityManager.StorageCapacityDisableThreshold.key());
- weightBasedParametersForValidation.add(Config.CPUCapacityDisableThreshold.key());
- weightBasedParametersForValidation.add(Config.MemoryCapacityDisableThreshold.key());
+ weightBasedParametersForValidation.add(DeploymentClusterPlanner.ClusterCPUCapacityDisableThreshold.key());
+ weightBasedParametersForValidation.add(DeploymentClusterPlanner.ClusterMemoryCapacityDisableThreshold.key());
weightBasedParametersForValidation.add(Config.AgentLoadThreshold.key());
weightBasedParametersForValidation.add(Config.VmUserDispersionWeight.key());
@@ -625,8 +630,17 @@ ConfigurationManagerImpl extends ManagerBase implements ConfigurationManager, Co
+ (((name.toLowerCase()).contains("password")) ? "*****" : (((value == null) ? "" : value))));
// check if config value exists
ConfigurationVO config = _configDao.findByName(name);
+ String catergory = null;
+
+ // FIX ME - All configuration parameters are not moved from config.java to configKey
if (config == null) {
- throw new InvalidParameterValueException("Config parameter with name " + name + " doesn't exist");
+ if ( _configDepot.get(name) == null ) {
+ s_logger.warn("Probably the component manager where configuration variable " + name + " is defined needs to implement Configurable interface");
+ throw new InvalidParameterValueException("Config parameter with name " + name + " doesn't exist");
+ }
+ catergory = _configDepot.get(name).category();
+ } else {
+ catergory = config.getCategory();
}
if (value == null) {
@@ -667,7 +681,7 @@ ConfigurationManagerImpl extends ManagerBase implements ConfigurationManager, Co
"cannot handle multiple IDs, provide only one ID corresponding to the scope");
}
- String updatedValue = updateConfiguration(userId, name, config.getCategory(), value, scope, id);
+ String updatedValue = updateConfiguration(userId, name, catergory, value, scope, id);
if ((value == null && updatedValue == null) || updatedValue.equalsIgnoreCase(value)) {
return _configDao.findByName(name);
} else {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c29cd9d3/server/src/com/cloud/deploy/FirstFitPlanner.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/deploy/FirstFitPlanner.java b/server/src/com/cloud/deploy/FirstFitPlanner.java
index 64b1124..3707d3d 100755
--- a/server/src/com/cloud/deploy/FirstFitPlanner.java
+++ b/server/src/com/cloud/deploy/FirstFitPlanner.java
@@ -29,6 +29,8 @@ import javax.naming.ConfigurationException;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
+import org.apache.cloudstack.framework.config.ConfigKey;
+import org.apache.cloudstack.framework.config.Configurable;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
@@ -83,7 +85,7 @@ import com.cloud.vm.dao.UserVmDao;
import com.cloud.vm.dao.VMInstanceDao;
@Local(value=DeploymentPlanner.class)
-public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPlanner {
+public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPlanner, Configurable{
private static final Logger s_logger = Logger.getLogger(FirstFitPlanner.class);
@Inject protected HostDao _hostDao;
@Inject protected DataCenterDao _dcDao;
@@ -246,11 +248,11 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
// if he changes these values
Map<Short, Float> disableThresholdMap = new HashMap<Short, Float>();
- String cpuDisableThresholdString = _configDao.getValue(Config.CPUCapacityDisableThreshold.key());
+ String cpuDisableThresholdString = ClusterCPUCapacityDisableThreshold.value().toString();
float cpuDisableThreshold = NumbersUtil.parseFloat(cpuDisableThresholdString, 0.85F);
disableThresholdMap.put(Capacity.CAPACITY_TYPE_CPU, cpuDisableThreshold);
- String memoryDisableThresholdString = _configDao.getValue(Config.MemoryCapacityDisableThreshold.key());
+ String memoryDisableThresholdString = ClusterMemoryCapacityDisableThreshold.value().toString();
float memoryDisableThreshold = NumbersUtil.parseFloat(memoryDisableThresholdString, 0.85F);
disableThresholdMap.put(Capacity.CAPACITY_TYPE_MEMORY, memoryDisableThreshold);
@@ -283,10 +285,10 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
}
if (capacity == Capacity.CAPACITY_TYPE_CPU) {
clustersCrossingThreshold = _capacityDao.listClustersCrossingThreshold(capacity,
- plan.getDataCenterId(), Config.CPUCapacityDisableThreshold.key(), cpu_requested);
+ plan.getDataCenterId(), ClusterCPUCapacityDisableThreshold.key(), cpu_requested);
} else if (capacity == Capacity.CAPACITY_TYPE_MEMORY) {
clustersCrossingThreshold = _capacityDao.listClustersCrossingThreshold(capacity,
- plan.getDataCenterId(), Config.MemoryCapacityDisableThreshold.key(), ram_requested);
+ plan.getDataCenterId(), ClusterMemoryCapacityDisableThreshold.key(), ram_requested);
}
if (clustersCrossingThreshold != null && clustersCrossingThreshold.size() != 0) {
@@ -522,4 +524,14 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException {
return PlannerResourceUsage.Shared;
}
+
+ @Override
+ public String getConfigComponentName() {
+ return DeploymentClusterPlanner.class.getSimpleName();
+ }
+
+ @Override
+ public ConfigKey<?>[] getConfigKeys() {
+ return new ConfigKey<?>[] {ClusterCPUCapacityDisableThreshold, ClusterMemoryCapacityDisableThreshold};
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c29cd9d3/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index a088a4a..806e3af 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -119,6 +119,7 @@ import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
import org.apache.cloudstack.framework.config.ConfigDepot;
import org.apache.cloudstack.framework.config.ConfigKey;
+import org.apache.cloudstack.framework.config.Configurable;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.framework.jobs.AsyncJobManager;
import org.apache.cloudstack.framework.jobs.impl.AsyncJobVO;
@@ -137,7 +138,7 @@ import java.util.concurrent.*;
*/
@Local(value = { VirtualNetworkApplianceManager.class, VirtualNetworkApplianceService.class })
public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements VirtualNetworkApplianceManager, VirtualNetworkApplianceService,
- VirtualMachineGuru, Listener {
+ VirtualMachineGuru, Listener, Configurable {
private static final Logger s_logger = Logger.getLogger(VirtualNetworkApplianceManagerImpl.class);
@Inject
@@ -4097,4 +4098,14 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
}
return jobIds;
}
+
+ @Override
+ public String getConfigComponentName() {
+ return VirtualNetworkApplianceManagerImpl.class.getSimpleName();
+ }
+
+ @Override
+ public ConfigKey<?>[] getConfigKeys() {
+ return new ConfigKey<?>[] {UseExternalDnsServers};
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c29cd9d3/server/src/com/cloud/server/ConfigurationServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java
index 8459ada..4020926 100755
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@ -44,6 +44,7 @@ import javax.naming.ConfigurationException;
import org.apache.cloudstack.framework.config.ConfigDepot;
import org.apache.cloudstack.framework.config.ConfigDepotAdmin;
+import org.apache.cloudstack.framework.config.ConfigKey;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
import org.apache.commons.codec.binary.Base64;
@@ -771,9 +772,9 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
public List<ConfigurationVO> getConfigListByScope(String scope, Long resourceId) {
// Getting the list of parameters defined at the scope
- List<Config> configList = Config.getConfigListByScope(scope);
+ List<ConfigKey<?>> configList = _configDepot.getConfigListByScope(scope);
List<ConfigurationVO> configVOList = new ArrayList<ConfigurationVO>();
- for (Config param:configList){
+ for (ConfigKey<?> param:configList){
ConfigurationVO configVo = _configDao.findByName(param.toString());
configVo.setValue(_configDepot.get(param.toString()).valueIn(resourceId).toString());
configVOList.add(configVo);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c29cd9d3/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
----------------------------------------------------------------------
diff --git a/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java b/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
index d7ac3f7..78a2336 100644
--- a/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
+++ b/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
@@ -24,6 +24,7 @@ import javax.inject.Inject;
import org.apache.cloudstack.acl.SecurityChecker;
import org.apache.cloudstack.affinity.AffinityGroupService;
import org.apache.cloudstack.affinity.dao.AffinityGroupDao;
+import org.apache.cloudstack.framework.config.ConfigDepot;
import org.apache.cloudstack.region.PortableIpDaoImpl;
import org.apache.cloudstack.region.dao.RegionDaoImpl;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDaoImpl;
@@ -309,6 +310,11 @@ public class ChildTestConfiguration {
}
@Bean
+ public ConfigDepot configDepot() {
+ return Mockito.mock(ConfigDepot.class);
+ }
+
+ @Bean
public CallContext userContext() {
return Mockito.mock(CallContext.class);
}
[32/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-5186: Increasing the waiting time for router to
come up
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/438cf4ea
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/438cf4ea
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/438cf4ea
Branch: refs/heads/disk-cache
Commit: 438cf4ea63873d422ea23ff2ff4810e122770230
Parents: e2051de
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Sat Nov 16 17:11:32 2013 +0530
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Sat Nov 16 17:15:14 2013 +0530
----------------------------------------------------------------------
test/integration/component/test_egress_fw_rules.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/438cf4ea/test/integration/component/test_egress_fw_rules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_egress_fw_rules.py b/test/integration/component/test_egress_fw_rules.py
index 56ac366..6dcc2c4d 100644
--- a/test/integration/component/test_egress_fw_rules.py
+++ b/test/integration/component/test_egress_fw_rules.py
@@ -280,15 +280,15 @@ class TestEgressFWRules(cloudstackTestCase):
self.debug("%s %s" % (script_file, exec_cmd_params))
exec_success = False
- #Timeout set to 3 minutes
- timeout = 180
+ #Timeout set to 6 minutes
+ timeout = 360
while timeout:
self.debug('sleep %s seconds for egress rule to affect on Router.' % self.services['sleep'])
time.sleep(self.services['sleep'])
result = ssh.execute("%s %s" % (script_file, exec_cmd_params))
self.debug('Result is=%s' % result)
self.debug('Expected result is=%s' % expected_result)
-
+
if str(result).strip() == expected_result:
exec_success = True
break
@@ -301,9 +301,9 @@ class TestEgressFWRules(cloudstackTestCase):
else: # Failed due to some other error
break
#end while
-
+
if timeout == 0:
- self.fail("Router network failed to come up after 3 minutes.")
+ self.fail("Router network failed to come up after 6 minutes.")
ssh.execute('rm -rf %s' % script_file)
[33/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
Tests for DBUtil
This patch adds test for the lock management:
- getGlobalLock
- releaseGlobalLock
Signed-off-by: Laszlo Hornyak <la...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/065e5afa
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/065e5afa
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/065e5afa
Branch: refs/heads/disk-cache
Commit: 065e5afa08a34d414cdb8ced092c0dc8756c8463
Parents: 438cf4e
Author: Laszlo Hornyak <la...@gmail.com>
Authored: Sat Nov 16 14:25:29 2013 +0100
Committer: Laszlo Hornyak <la...@gmail.com>
Committed: Sat Nov 16 15:44:31 2013 +0100
----------------------------------------------------------------------
framework/db/pom.xml | 4 +
framework/db/src/com/cloud/utils/db/DbUtil.java | 31 ++-
.../db/test/com/cloud/utils/DbUtilTest.java | 190 +++++++++++++++++++
3 files changed, 206 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065e5afa/framework/db/pom.xml
----------------------------------------------------------------------
diff --git a/framework/db/pom.xml b/framework/db/pom.xml
index e28628e..b24b742 100644
--- a/framework/db/pom.xml
+++ b/framework/db/pom.xml
@@ -36,6 +36,10 @@
<artifactId>commons-dbcp</artifactId>
</dependency>
<dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ <dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065e5afa/framework/db/src/com/cloud/utils/db/DbUtil.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/DbUtil.java b/framework/db/src/com/cloud/utils/db/DbUtil.java
index 2570093..2a613d2 100755
--- a/framework/db/src/com/cloud/utils/db/DbUtil.java
+++ b/framework/db/src/com/cloud/utils/db/DbUtil.java
@@ -208,13 +208,14 @@ public class DbUtil {
}
PreparedStatement pstmt = null;
+ ResultSet rs = null;
try {
pstmt = conn.prepareStatement("SELECT COALESCE(GET_LOCK(?, ?),0)");
pstmt.setString(1, name);
pstmt.setInt(2, timeoutSeconds);
- ResultSet rs = pstmt.executeQuery();
+ rs = pstmt.executeQuery();
if (rs != null && rs.first()) {
if(rs.getInt(1) > 0) {
return true;
@@ -228,13 +229,8 @@ public class DbUtil {
} catch (Throwable e) {
s_logger.error("GET_LOCK() throws exception ", e);
} finally {
- if (pstmt != null) {
- try {
- pstmt.close();
- } catch (Throwable e) {
- s_logger.error("What the heck? ", e);
- }
- }
+ closeStatement(pstmt);
+ closeResultSet(rs);
}
removeConnectionForGlobalLocks(name);
@@ -259,10 +255,11 @@ public class DbUtil {
}
PreparedStatement pstmt = null;
+ ResultSet rs = null;
try {
pstmt = conn.prepareStatement("SELECT COALESCE(RELEASE_LOCK(?), 0)");
pstmt.setString(1, name);
- ResultSet rs = pstmt.executeQuery();
+ rs = pstmt.executeQuery();
if(rs != null && rs.first())
return rs.getInt(1) > 0;
s_logger.error("RELEASE_LOCK() returns unexpected result : " + rs.getInt(1));
@@ -271,13 +268,9 @@ public class DbUtil {
} catch (Throwable e) {
s_logger.error("RELEASE_LOCK() throws exception ", e);
} finally {
- try {
- if (pstmt != null) {
- pstmt.close();
- }
- conn.close();
- } catch(SQLException e) {
- }
+ closeResultSet(rs);
+ closeStatement(pstmt);
+ closeConnection(conn);
}
return false;
}
@@ -305,7 +298,7 @@ public class DbUtil {
resultSet.close();
}
- } catch (Exception e) {
+ } catch (SQLException e) {
s_logger.warn("Ignored exception while closing result set.",e);
}
@@ -319,7 +312,7 @@ public class DbUtil {
statement.close();
}
- } catch (Exception e) {
+ } catch (SQLException e) {
s_logger.warn("Ignored exception while closing statement.",e);
}
@@ -333,7 +326,7 @@ public class DbUtil {
connection.close();
}
- } catch (Exception e) {
+ } catch (SQLException e) {
s_logger.warn("Ignored exception while close connection.",e);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065e5afa/framework/db/test/com/cloud/utils/DbUtilTest.java
----------------------------------------------------------------------
diff --git a/framework/db/test/com/cloud/utils/DbUtilTest.java b/framework/db/test/com/cloud/utils/DbUtilTest.java
index e9a7287..4839c23 100644
--- a/framework/db/test/com/cloud/utils/DbUtilTest.java
+++ b/framework/db/test/com/cloud/utils/DbUtilTest.java
@@ -16,16 +16,58 @@
// under the License.
package com.cloud.utils;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.persistence.Column;
+import javax.persistence.Table;
+import javax.sql.DataSource;
+import org.junit.After;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
import com.cloud.utils.db.DbUtil;
+import com.cloud.utils.db.TransactionLegacy;
+@RunWith(MockitoJUnitRunner.class)
public class DbUtilTest {
+ @Mock
+ Connection connection;
+
+ @Mock
+ PreparedStatement preparedStatement;
+
+ @Mock
+ Statement statement;
+
+ @Mock
+ ResultSet resultSet;
+
+ @Mock
+ DataSource dataSource;
+
+ DataSource backup;
+
+ Map<String, Connection> connectionMapBackup = null;
+
+ Map<String, Connection> connectionMap = null;
+
+ @Table(name = "test_table")
static class Testbean {
String noAnnotation;
@Column()
@@ -78,4 +120,152 @@ public class DbUtilTest {
.getDeclaredField("instanceField")));
}
+ class Bar {
+
+ }
+
+ @Test
+ public void getTableName() {
+ Assert.assertEquals("test_table", DbUtil.getTableName(Testbean.class));
+ Assert.assertEquals("Bar", DbUtil.getTableName(Bar.class));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Before
+ public void setup() throws SecurityException, NoSuchFieldException,
+ IllegalArgumentException, IllegalAccessException {
+ Field globalLocks = DbUtil.class
+ .getDeclaredField("s_connectionForGlobalLocks");
+ globalLocks.setAccessible(true);
+ connectionMapBackup = (Map<String, Connection>) globalLocks.get(null);
+ connectionMap = new HashMap<String, Connection>();
+ globalLocks.set(null, connectionMap);
+
+ Field dsField = TransactionLegacy.class.getDeclaredField("s_ds");
+ dsField.setAccessible(true);
+ backup = (DataSource) dsField.get(null);
+ dsField.set(null, dataSource);
+ }
+
+ @After
+ public void cleanup() throws SecurityException, NoSuchFieldException,
+ IllegalArgumentException, IllegalAccessException {
+ Field globalLocks = DbUtil.class
+ .getDeclaredField("s_connectionForGlobalLocks");
+ globalLocks.setAccessible(true);
+ globalLocks.set(null, connectionMapBackup);
+
+ Field dsField = TransactionLegacy.class.getDeclaredField("s_ds");
+ dsField.setAccessible(true);
+ dsField.set(null, backup);
+ }
+
+ @Test
+ public void getGlobalLock() throws SQLException {
+ Mockito.when(dataSource.getConnection()).thenReturn(connection);
+ Mockito.when(connection.prepareStatement(Mockito.anyString()))
+ .thenReturn(preparedStatement);
+ Mockito.when(preparedStatement.executeQuery()).thenReturn(resultSet);
+ Mockito.when(resultSet.first()).thenReturn(true);
+ Mockito.when(resultSet.getInt(1)).thenReturn(1);
+ Assert.assertTrue(DbUtil.getGlobalLock("TEST", 600));
+
+ Mockito.verify(connection).prepareStatement(Mockito.anyString());
+ Mockito.verify(preparedStatement).close();
+ Mockito.verify(resultSet).close();
+ }
+
+ @Test
+ public void getGlobalLockTimeout() throws SQLException {
+ Mockito.when(dataSource.getConnection()).thenReturn(connection);
+ Mockito.when(connection.prepareStatement(Mockito.anyString()))
+ .thenReturn(preparedStatement);
+ Mockito.when(preparedStatement.executeQuery()).thenReturn(resultSet);
+ Mockito.when(resultSet.first()).thenReturn(true);
+ Mockito.when(resultSet.getInt(1)).thenReturn(0);
+ Assert.assertFalse(DbUtil.getGlobalLock("TEST", 600));
+
+ Mockito.verify(connection).prepareStatement(Mockito.anyString());
+ Mockito.verify(preparedStatement).close();
+ Mockito.verify(resultSet).close();
+ Mockito.verify(connection).close();
+
+ // if any error happens, the connection map must be cleared
+ Assert.assertTrue(connectionMap.isEmpty());
+ }
+
+ @Test
+ public void closeNull() {
+ DbUtil.closeStatement((Statement) null);
+ DbUtil.closeConnection((Connection) null);
+ DbUtil.closeResultSet((ResultSet) null);
+ // no exception should be thrown
+ }
+
+ @Test
+ public void closeConnection() throws IOException, SQLException {
+ DbUtil.closeConnection(connection);
+ Mockito.verify(connection).close();
+ }
+
+ @Test
+ public void closeConnectionFail() throws IOException, SQLException {
+ Mockito.doThrow(new SQLException("it is all right")).when(connection)
+ .close();
+ DbUtil.closeConnection(connection);
+ Mockito.verify(connection).close();
+ }
+
+ @Test
+ public void closeStatement() throws IOException, SQLException {
+ DbUtil.closeStatement(statement);
+ Mockito.verify(statement).close();
+ }
+
+ @Test
+ public void closeStatementFail() throws IOException, SQLException {
+ Mockito.doThrow(new SQLException("it is all right")).when(statement)
+ .close();
+ DbUtil.closeStatement(statement);
+ Mockito.verify(statement).close();
+ }
+
+ @Test
+ public void closeResultSet() throws IOException, SQLException {
+ DbUtil.closeResultSet(resultSet);
+ Mockito.verify(resultSet).close();
+ }
+
+ @Test
+ public void closeResultSetFail() throws IOException, SQLException {
+ Mockito.doThrow(new SQLException("it is all right")).when(resultSet)
+ .close();
+ DbUtil.closeResultSet(resultSet);
+ Mockito.verify(resultSet).close();
+ }
+
+ @Test
+ @Ignore
+ //can not be performed since assertion embedded in this branch of execution
+ public void releaseGlobalLockNotexisting() throws SQLException {
+ Assert.assertFalse(DbUtil.releaseGlobalLock("notexisting"));
+ Mockito.verify(dataSource, Mockito.never()).getConnection();
+ }
+
+ @Test
+ public void releaseGlobalLock() throws SQLException {
+ Mockito.when(connection.prepareStatement(Mockito.anyString()))
+ .thenReturn(preparedStatement);
+ Mockito.when(preparedStatement.executeQuery()).thenReturn(resultSet);
+ Mockito.when(resultSet.first()).thenReturn(true);
+ Mockito.when(resultSet.getInt(1)).thenReturn(1);
+ connectionMap.put("testLock", connection);
+ Assert.assertTrue(DbUtil.releaseGlobalLock("testLock"));
+
+ Mockito.verify(resultSet).close();
+ Mockito.verify(preparedStatement).close();
+ Mockito.verify(connection).close();
+ Assert.assertFalse(connectionMap.containsKey("testLock"));
+ }
+
}
[20/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-5169: Egress rules - Improved assertion code
related to SSH to avoid assertion error
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/94104235
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/94104235
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/94104235
Branch: refs/heads/disk-cache
Commit: 9410423555d81f9da1c579f8d3c86b448bb9fee3
Parents: b178d06
Author: Ashutosh K <as...@clogeny.com>
Authored: Fri Nov 15 11:28:07 2013 +0530
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Fri Nov 15 11:28:07 2013 +0530
----------------------------------------------------------------------
test/integration/component/test_egress_rules.py | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/94104235/test/integration/component/test_egress_rules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_egress_rules.py b/test/integration/component/test_egress_rules.py
index eb38c1a..590f72a 100644
--- a/test/integration/component/test_egress_rules.py
+++ b/test/integration/component/test_egress_rules.py
@@ -1439,8 +1439,7 @@ class TestMultipleAccountsEgressRuleNeg(cloudstackTestCase):
try:
self.debug("SSHing into VM type B from VM A")
self.debug("VM IP: %s" % self.virtual_machineB.ssh_ip)
- res = ssh.execute("ssh %s@%s" % (
- self.services["virtual_machine"]["username"],
+ res = ssh.execute("ssh -o 'BatchMode=yes' %s" % (
self.virtual_machineB.ssh_ip
))
self.debug("SSH result: %s" % str(res))
@@ -1450,10 +1449,14 @@ class TestMultipleAccountsEgressRuleNeg(cloudstackTestCase):
(self.virtual_machineA.ipaddress, e)
)
result = str(res)
- self.assertEqual(
- result.count("Connection timed out"),
- 1,
- "SSH into management server from VM should not be successful"
+
+ # SSH failure may result in one of the following three error messages
+ ssh_failure_result_set = ["ssh: connect to host %s port 22: No route to host" % self.virtual_machineB.ssh_ip,
+ "ssh: connect to host %s port 22: Connection timed out" % self.virtual_machineB.ssh_ip,
+ "Host key verification failed."]
+
+ self.assertFalse(set(res).isdisjoint(ssh_failure_result_set),
+ "SSH into VM of other account should not be successful"
)
return
[49/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
add mgt.server.vendor global configuration, in case different vendor wants to identify its identity
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8321ea4d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8321ea4d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8321ea4d
Branch: refs/heads/disk-cache
Commit: 8321ea4d78448016adf464ad00c3e39260350290
Parents: 465626f
Author: fjkdf <fj...@fjkd.com>
Authored: Tue Nov 19 17:55:29 2013 -0800
Committer: fjkdf <fj...@fjkd.com>
Committed: Tue Nov 19 17:55:58 2013 -0800
----------------------------------------------------------------------
server/src/com/cloud/configuration/Config.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8321ea4d/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index 640e7fa..2178356 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -413,9 +413,11 @@ public enum Config {
ExecuteInSequenceNetworkElementCommands("Advanced", NetworkOrchestrationService.class, Boolean.class, "execute.in.sequence.network.element.commands", "false", "If set to true, DhcpEntryCommand, SavePasswordCommand, UserDataCommand, VmDataCommand will be synchronized on the agent side." +
" If set to false, these commands become asynchronous. Default value is false.", null),
- UCSSyncBladeInterval("Advanced", ManagementServer.class, Integer.class, "ucs.sync.blade.interval", "3600", "the interval cloudstack sync with UCS manager for available blades in case user remove blades from chassis without notifying CloudStack", null);
+ UCSSyncBladeInterval("Advanced", ManagementServer.class, Integer.class, "ucs.sync.blade.interval", "3600", "the interval cloudstack sync with UCS manager for available blades in case user remove blades from chassis without notifying CloudStack", null),
- private final String _category;
+ ManagementServerVendor("Advanced", ManagementServer.class, String.class, "mgt.server.vendor", "ACS", "the vendor of management server", null);
+
+ private final String _category;
private final Class<?> _componentClass;
private final Class<?> _type;
private final String _name;
[30/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-5187: Fix test_vpc_vm_life_cycle recover tests
The vms were recovered without deleting the vms first
therefore the API failed.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e2051de9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e2051de9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e2051de9
Branch: refs/heads/disk-cache
Commit: e2051de98e1460f8e0ce723b42331566a00e2ba1
Parents: 02c1552
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Fri Nov 15 23:33:44 2013 -0500
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Fri Nov 15 23:38:57 2013 -0500
----------------------------------------------------------------------
.../component/test_vpc_vm_life_cycle.py | 26 ++++++++------------
1 file changed, 10 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2051de9/test/integration/component/test_vpc_vm_life_cycle.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_vm_life_cycle.py b/test/integration/component/test_vpc_vm_life_cycle.py
index 60a8971..beb5b99 100644
--- a/test/integration/component/test_vpc_vm_life_cycle.py
+++ b/test/integration/component/test_vpc_vm_life_cycle.py
@@ -651,15 +651,13 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
""" Test recover an instance in VPC networks
"""
- # Validate the following
- # 1. Recover the virtual machines.
- # 2. Vm should be in stopped state. State both the instances
- # 3. Make sure that all the PF,LB and Static NAT rules on this VM
- # works as expected.
- # 3. Make sure that we are able to access google.com from this user Vm
+ self.debug("Deleted instacnes ..")
+ try:
+ self.vm_1.delete(self.apiclient)
+ self.vm_2.delete(self.apiclient)
+ except Exception as e:
+ self.fail("Failed to stop the virtual instances, %s" % e)
- self.debug("Recovering the expunged virtual machines in account: %s" %
- self.account.name)
try:
self.vm_1.recover(self.apiclient)
self.vm_2.recover(self.apiclient)
@@ -1421,15 +1419,11 @@ class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
""" Test recover an instance in VPC networks
"""
- # Validate the following
- # 1. Recover the virtual machines.
- # 2. Vm should be in stopped state. State both the instances
- # 3. Make sure that all the PF,LB and Static NAT rules on this VM
- # works as expected.
- # 3. Make sure that we are able to access google.com from this user Vm
+ try:
+ self.vm_2.delete(self.apiclient)
+ except Exception as e:
+ self.fail("Failed to destroy the virtual instances, %s" % e)
- self.debug("Recovering the expunged virtual machines in account: %s" %
- self.account.name)
try:
self.vm_2.recover(self.apiclient)
except Exception as e:
[23/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
Add 4.3.x messages.properties to Transifex config tool
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4f302c12
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4f302c12
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4f302c12
Branch: refs/heads/disk-cache
Commit: 4f302c124ed91c7a862d77ae3fbc92d7c889e5f2
Parents: 186b82a
Author: Milamber <mi...@apache.org>
Authored: Fri Nov 15 08:25:23 2013 +0000
Committer: Milamber <mi...@apache.org>
Committed: Fri Nov 15 09:15:11 2013 +0000
----------------------------------------------------------------------
tools/transifex/.tx/config | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4f302c12/tools/transifex/.tx/config
----------------------------------------------------------------------
diff --git a/tools/transifex/.tx/config b/tools/transifex/.tx/config
index 9c495cc..102a47e 100644
--- a/tools/transifex/.tx/config
+++ b/tools/transifex/.tx/config
@@ -30,3 +30,19 @@ trans.pt_BR = work-dir/messages_pt_BR.properties
trans.ru_RU = work-dir/messages_ru_RU.properties
trans.zh_CN = work-dir/messages_zh_CN.properties
+[CloudStack_UI.43xmessagesproperties]
+source_file = work-dir/messages.properties
+source_lang = en
+trans.ar = work-dir/messages_ar.properties
+trans.ca = work-dir/messages_ca.properties
+trans.de_DE = work-dir/messages_de_DE.properties
+trans.es = work-dir/messages_es.properties
+trans.fr_FR = work-dir/messages_fr_FR.properties
+trans.it_IT = work-dir/messages_it_IT.properties
+trans.ja = work-dir/messages_ja.properties
+trans.ko_KR = work-dir/messages_ko_KR.properties
+trans.nb_NO = work-dir/messages_nb_NO.properties
+trans.pt_BR = work-dir/messages_pt_BR.properties
+trans.ru_RU = work-dir/messages_ru_RU.properties
+trans.zh_CN = work-dir/messages_zh_CN.properties
+
[38/50] [abbrv] Checkstyle adjustments in code and configuration
Posted by wi...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java
index 78465e4..eceec2a 100644
--- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java
+++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java
@@ -84,68 +84,67 @@ import com.cloud.network.nicira.NiciraNvpList;
import com.cloud.network.nicira.SourceNatRule;
public class NiciraNvpResourceTest {
- NiciraNvpApi _nvpApi = mock(NiciraNvpApi.class);
- NiciraNvpResource _resource;
- Map<String,Object> _parameters;
+ NiciraNvpApi nvpApi = mock(NiciraNvpApi.class);
+ NiciraNvpResource resource;
+ Map<String,Object> parameters;
@Before
public void setUp() throws ConfigurationException {
- _resource = new NiciraNvpResource() {
+ resource = new NiciraNvpResource() {
@Override
protected NiciraNvpApi createNiciraNvpApi() {
- return _nvpApi;
+ return nvpApi;
}
};
- _parameters = new HashMap<String,Object>();
- _parameters.put("name","nvptestdevice");
- _parameters.put("ip","127.0.0.1");
- _parameters.put("adminuser","adminuser");
- _parameters.put("guid", "aaaaa-bbbbb-ccccc");
- _parameters.put("zoneId", "blublub");
- _parameters.put("adminpass","adminpass");
+ parameters = new HashMap<String,Object>();
+ parameters.put("name","nvptestdevice");
+ parameters.put("ip","127.0.0.1");
+ parameters.put("adminuser","adminuser");
+ parameters.put("guid", "aaaaa-bbbbb-ccccc");
+ parameters.put("zoneId", "blublub");
+ parameters.put("adminpass","adminpass");
}
@Test (expected=ConfigurationException.class)
public void resourceConfigureFailure() throws ConfigurationException {
- _resource.configure("NiciraNvpResource", Collections.<String,Object>emptyMap());
+ resource.configure("NiciraNvpResource", Collections.<String,Object>emptyMap());
}
@Test
public void resourceConfigure() throws ConfigurationException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
- verify(_nvpApi).setAdminCredentials("adminuser", "adminpass");
- verify(_nvpApi).setControllerAddress("127.0.0.1");
-
- assertTrue("nvptestdevice".equals(_resource.getName()));
+ verify(nvpApi).setAdminCredentials("adminuser", "adminpass");
+ verify(nvpApi).setControllerAddress("127.0.0.1");
+ assertTrue("Incorrect resource name", "nvptestdevice".equals(resource.getName()));
/* Pretty lame test, but here to assure this plugin fails
* if the type name ever changes from L2Networking
*/
- assertTrue(_resource.getType() == Host.Type.L2Networking);
+ assertTrue("Incorrect resource type", resource.getType() == Host.Type.L2Networking);
}
@Test
public void testInitialization() throws ConfigurationException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
- StartupCommand[] sc = _resource.initialize();
+ StartupCommand[] sc = resource.initialize();
assertTrue(sc.length ==1);
- assertTrue("aaaaa-bbbbb-ccccc".equals(sc[0].getGuid()));
- assertTrue("nvptestdevice".equals(sc[0].getName()));
- assertTrue("blublub".equals(sc[0].getDataCenter()));
+ assertTrue("Incorrect startup command GUID", "aaaaa-bbbbb-ccccc".equals(sc[0].getGuid()));
+ assertTrue("Incorrect NVP device name", "nvptestdevice".equals(sc[0].getName()));
+ assertTrue("Incorrect Data Center", "blublub".equals(sc[0].getDataCenter()));
}
@Test
public void testPingCommandStatusOk() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
ControlClusterStatus ccs = mock(ControlClusterStatus.class);
when(ccs.getClusterStatus()).thenReturn("stable");
- when(_nvpApi.getControlClusterStatus()).thenReturn(ccs);
+ when(nvpApi.getControlClusterStatus()).thenReturn(ccs);
- PingCommand ping = _resource.getCurrentStatus(42);
+ PingCommand ping = resource.getCurrentStatus(42);
assertTrue(ping != null);
assertTrue(ping.getHostId() == 42);
assertTrue(ping.getHostType() == Host.Type.L2Networking);
@@ -153,98 +152,98 @@ public class NiciraNvpResourceTest {
@Test
public void testPingCommandStatusFail() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
ControlClusterStatus ccs = mock(ControlClusterStatus.class);
when(ccs.getClusterStatus()).thenReturn("unstable");
- when(_nvpApi.getControlClusterStatus()).thenReturn(ccs);
+ when(nvpApi.getControlClusterStatus()).thenReturn(ccs);
- PingCommand ping = _resource.getCurrentStatus(42);
+ PingCommand ping = resource.getCurrentStatus(42);
assertTrue(ping == null);
}
@Test
public void testPingCommandStatusApiException() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
ControlClusterStatus ccs = mock(ControlClusterStatus.class);
when(ccs.getClusterStatus()).thenReturn("unstable");
- when(_nvpApi.getControlClusterStatus()).thenThrow(new NiciraNvpApiException());
+ when(nvpApi.getControlClusterStatus()).thenThrow(new NiciraNvpApiException());
- PingCommand ping = _resource.getCurrentStatus(42);
+ PingCommand ping = resource.getCurrentStatus(42);
assertTrue(ping == null);
}
@Test
public void testRetries() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
LogicalSwitch ls = mock(LogicalSwitch.class);
when(ls.getUuid()).thenReturn("cccc").thenReturn("cccc");
- when(_nvpApi.createLogicalSwitch((LogicalSwitch) any())).thenThrow(new NiciraNvpApiException()).thenThrow(new NiciraNvpApiException()).thenReturn(ls);
+ when(nvpApi.createLogicalSwitch((LogicalSwitch) any())).thenThrow(new NiciraNvpApiException()).thenThrow(new NiciraNvpApiException()).thenReturn(ls);
- CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)_parameters.get("guid"), "stt", "loigicalswitch","owner");
- CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer) _resource.executeRequest(clsc);
+ CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)parameters.get("guid"), "stt", "loigicalswitch","owner");
+ CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer) resource.executeRequest(clsc);
assertTrue(clsa.getResult());
}
@Test
public void testCreateLogicalSwitch() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
LogicalSwitch ls = mock(LogicalSwitch.class);
when(ls.getUuid()).thenReturn("cccc").thenReturn("cccc");
- when(_nvpApi.createLogicalSwitch((LogicalSwitch) any())).thenReturn(ls);
+ when(nvpApi.createLogicalSwitch((LogicalSwitch) any())).thenReturn(ls);
- CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)_parameters.get("guid"), "stt", "loigicalswitch","owner");
- CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer) _resource.executeRequest(clsc);
+ CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)parameters.get("guid"), "stt", "loigicalswitch","owner");
+ CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer) resource.executeRequest(clsc);
assertTrue(clsa.getResult());
assertTrue("cccc".equals(clsa.getLogicalSwitchUuid()));
}
@Test
public void testCreateLogicalSwitchApiException() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
LogicalSwitch ls = mock(LogicalSwitch.class);
when(ls.getUuid()).thenReturn("cccc").thenReturn("cccc");
- when(_nvpApi.createLogicalSwitch((LogicalSwitch) any())).thenThrow(new NiciraNvpApiException());
+ when(nvpApi.createLogicalSwitch((LogicalSwitch) any())).thenThrow(new NiciraNvpApiException());
- CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)_parameters.get("guid"), "stt", "loigicalswitch","owner");
- CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer) _resource.executeRequest(clsc);
+ CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)parameters.get("guid"), "stt", "loigicalswitch","owner");
+ CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer) resource.executeRequest(clsc);
assertFalse(clsa.getResult());
}
@Test
public void testDeleteLogicalSwitch() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
DeleteLogicalSwitchCommand dlsc = new DeleteLogicalSwitchCommand("cccc");
- DeleteLogicalSwitchAnswer dlsa = (DeleteLogicalSwitchAnswer) _resource.executeRequest(dlsc);
+ DeleteLogicalSwitchAnswer dlsa = (DeleteLogicalSwitchAnswer) resource.executeRequest(dlsc);
assertTrue(dlsa.getResult());
}
@Test
public void testDeleteLogicalSwitchApiException() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
- doThrow(new NiciraNvpApiException()).when(_nvpApi).deleteLogicalSwitch((String)any());
+ doThrow(new NiciraNvpApiException()).when(nvpApi).deleteLogicalSwitch((String)any());
DeleteLogicalSwitchCommand dlsc = new DeleteLogicalSwitchCommand("cccc");
- DeleteLogicalSwitchAnswer dlsa = (DeleteLogicalSwitchAnswer) _resource.executeRequest(dlsc);
+ DeleteLogicalSwitchAnswer dlsa = (DeleteLogicalSwitchAnswer) resource.executeRequest(dlsc);
assertFalse(dlsa.getResult());
}
@Test
public void testCreateLogicalSwitchPort() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
LogicalSwitchPort lsp = mock(LogicalSwitchPort.class);
when(lsp.getUuid()).thenReturn("eeee");
- when(_nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort) any())).thenReturn(lsp);
+ when(nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort) any())).thenReturn(lsp);
CreateLogicalSwitchPortCommand clspc = new CreateLogicalSwitchPortCommand("cccc", "dddd", "owner", "nicname");
- CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer) _resource.executeRequest(clspc);
+ CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer) resource.executeRequest(clspc);
assertTrue(clspa.getResult());
assertTrue("eeee".equals(clspa.getLogicalSwitchPortUuid()));
@@ -252,91 +251,91 @@ public class NiciraNvpResourceTest {
@Test
public void testCreateLogicalSwitchPortApiExceptionInCreate() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
LogicalSwitchPort lsp = mock(LogicalSwitchPort.class);
when(lsp.getUuid()).thenReturn("eeee");
- when(_nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort) any())).thenThrow(new NiciraNvpApiException());
+ when(nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort) any())).thenThrow(new NiciraNvpApiException());
CreateLogicalSwitchPortCommand clspc = new CreateLogicalSwitchPortCommand("cccc", "dddd", "owner", "nicname");
- CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer) _resource.executeRequest(clspc);
+ CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer) resource.executeRequest(clspc);
assertFalse(clspa.getResult());
}
@Test
public void testCreateLogicalSwitchPortApiExceptionInModify() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
LogicalSwitchPort lsp = mock(LogicalSwitchPort.class);
when(lsp.getUuid()).thenReturn("eeee");
- when(_nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort) any())).thenReturn(lsp);
- doThrow(new NiciraNvpApiException()).when(_nvpApi).modifyLogicalSwitchPortAttachment((String)any(), (String)any(), (Attachment)any());
+ when(nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort) any())).thenReturn(lsp);
+ doThrow(new NiciraNvpApiException()).when(nvpApi).modifyLogicalSwitchPortAttachment((String)any(), (String)any(), (Attachment)any());
CreateLogicalSwitchPortCommand clspc = new CreateLogicalSwitchPortCommand("cccc", "dddd", "owner", "nicname");
- CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer) _resource.executeRequest(clspc);
+ CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer) resource.executeRequest(clspc);
assertFalse(clspa.getResult());
- verify(_nvpApi, atLeastOnce()).deleteLogicalSwitchPort((String) any(), (String) any());
+ verify(nvpApi, atLeastOnce()).deleteLogicalSwitchPort((String) any(), (String) any());
}
@Test
public void testDeleteLogicalSwitchPortException() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
- doThrow(new NiciraNvpApiException()).when(_nvpApi).deleteLogicalSwitchPort((String) any(), (String) any());
- DeleteLogicalSwitchPortAnswer dlspa = (DeleteLogicalSwitchPortAnswer) _resource.executeRequest(new DeleteLogicalSwitchPortCommand("aaaa","bbbb"));
+ doThrow(new NiciraNvpApiException()).when(nvpApi).deleteLogicalSwitchPort((String) any(), (String) any());
+ DeleteLogicalSwitchPortAnswer dlspa = (DeleteLogicalSwitchPortAnswer) resource.executeRequest(new DeleteLogicalSwitchPortCommand("aaaa","bbbb"));
assertFalse(dlspa.getResult());
}
@Test
public void testUpdateLogicalSwitchPortException() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
- doThrow(new NiciraNvpApiException()).when(_nvpApi).modifyLogicalSwitchPortAttachment((String) any(), (String) any(), (Attachment) any());
- UpdateLogicalSwitchPortAnswer dlspa = (UpdateLogicalSwitchPortAnswer) _resource.executeRequest(
+ doThrow(new NiciraNvpApiException()).when(nvpApi).modifyLogicalSwitchPortAttachment((String) any(), (String) any(), (Attachment) any());
+ UpdateLogicalSwitchPortAnswer dlspa = (UpdateLogicalSwitchPortAnswer) resource.executeRequest(
new UpdateLogicalSwitchPortCommand("aaaa","bbbb","cccc","owner","nicname"));
assertFalse(dlspa.getResult());
}
@Test
public void testFindLogicalSwitchPort() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
@SuppressWarnings("unchecked")
NiciraNvpList<LogicalSwitchPort> lspl = mock(NiciraNvpList.class);
when(lspl.getResultCount()).thenReturn(1);
- when(_nvpApi.findLogicalSwitchPortsByUuid("aaaa", "bbbb")).thenReturn(lspl);
+ when(nvpApi.findLogicalSwitchPortsByUuid("aaaa", "bbbb")).thenReturn(lspl);
- FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer) _resource.executeRequest(new FindLogicalSwitchPortCommand("aaaa", "bbbb"));
+ FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer) resource.executeRequest(new FindLogicalSwitchPortCommand("aaaa", "bbbb"));
assertTrue(flspa.getResult());
}
@Test
public void testFindLogicalSwitchPortNotFound() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
@SuppressWarnings("unchecked")
NiciraNvpList<LogicalSwitchPort> lspl = mock(NiciraNvpList.class);
when(lspl.getResultCount()).thenReturn(0);
- when(_nvpApi.findLogicalSwitchPortsByUuid("aaaa", "bbbb")).thenReturn(lspl);
+ when(nvpApi.findLogicalSwitchPortsByUuid("aaaa", "bbbb")).thenReturn(lspl);
- FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer) _resource.executeRequest(new FindLogicalSwitchPortCommand("aaaa", "bbbb"));
+ FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer) resource.executeRequest(new FindLogicalSwitchPortCommand("aaaa", "bbbb"));
assertFalse(flspa.getResult());
}
@Test
public void testFindLogicalSwitchPortApiException() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
- when(_nvpApi.findLogicalSwitchPortsByUuid("aaaa", "bbbb")).thenThrow(new NiciraNvpApiException());
+ when(nvpApi.findLogicalSwitchPortsByUuid("aaaa", "bbbb")).thenThrow(new NiciraNvpApiException());
- FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer) _resource.executeRequest(new FindLogicalSwitchPortCommand("aaaa", "bbbb"));
+ FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer) resource.executeRequest(new FindLogicalSwitchPortCommand("aaaa", "bbbb"));
assertFalse(flspa.getResult());
}
@Test
public void testCreateLogicalRouter() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
LogicalRouterConfig lrc = mock(LogicalRouterConfig.class);
LogicalRouterPort lrp = mock(LogicalRouterPort.class);
@@ -344,46 +343,46 @@ public class NiciraNvpResourceTest {
when(lrc.getUuid()).thenReturn("ccccc");
when(lrp.getUuid()).thenReturn("ddddd").thenReturn("eeeee");
when(lsp.getUuid()).thenReturn("fffff");
- when(_nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenReturn(lrc);
- when(_nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort)any())).thenReturn(lrp);
- when(_nvpApi.createLogicalSwitchPort(eq("bbbbb"), (LogicalSwitchPort)any())).thenReturn(lsp);
+ when(nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenReturn(lrc);
+ when(nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort)any())).thenReturn(lrp);
+ when(nvpApi.createLogicalSwitchPort(eq("bbbbb"), (LogicalSwitchPort)any())).thenReturn(lsp);
CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb", "lrouter", "publiccidr", "nexthop", "internalcidr", "owner");
- CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) _resource.executeRequest(clrc);
+ CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) resource.executeRequest(clrc);
assertTrue(clra.getResult());
assertTrue("ccccc".equals(clra.getLogicalRouterUuid()));
- verify(_nvpApi, atLeast(1)).createLogicalRouterNatRule((String) any(), (NatRule) any());
+ verify(nvpApi, atLeast(1)).createLogicalRouterNatRule((String) any(), (NatRule) any());
}
@Test
public void testCreateLogicalRouterApiException() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
- when(_nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenThrow(new NiciraNvpApiException());
+ when(nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenThrow(new NiciraNvpApiException());
CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb", "lrouter", "publiccidr", "nexthop", "internalcidr", "owner");
- CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) _resource.executeRequest(clrc);
+ CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) resource.executeRequest(clrc);
assertFalse(clra.getResult());
}
@Test
public void testCreateLogicalRouterApiExceptionRollbackRouter() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
LogicalRouterConfig lrc = mock(LogicalRouterConfig.class);
when(lrc.getUuid()).thenReturn("ccccc");
- when(_nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenReturn(lrc);
- when(_nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort)any())).thenThrow(new NiciraNvpApiException());
+ when(nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenReturn(lrc);
+ when(nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort)any())).thenThrow(new NiciraNvpApiException());
CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb", "lrouter", "publiccidr", "nexthop", "internalcidr", "owner");
- CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) _resource.executeRequest(clrc);
+ CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) resource.executeRequest(clrc);
assertFalse(clra.getResult());
- verify(_nvpApi, atLeast(1)).deleteLogicalRouter(eq("ccccc"));
+ verify(nvpApi, atLeast(1)).deleteLogicalRouter(eq("ccccc"));
}
@Test
public void testCreateLogicalRouterApiExceptionRollbackRouterAndSwitchPort() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
LogicalRouterConfig lrc = mock(LogicalRouterConfig.class);
LogicalRouterPort lrp = mock(LogicalRouterPort.class);
@@ -391,30 +390,30 @@ public class NiciraNvpResourceTest {
when(lrc.getUuid()).thenReturn("ccccc");
when(lrp.getUuid()).thenReturn("ddddd").thenReturn("eeeee");
when(lsp.getUuid()).thenReturn("fffff");
- when(_nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenReturn(lrc);
- when(_nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort)any())).thenReturn(lrp);
- when(_nvpApi.createLogicalSwitchPort(eq("bbbbb"), (LogicalSwitchPort)any())).thenReturn(lsp);
- when(_nvpApi.createLogicalRouterNatRule((String) any(), (NatRule)any())).thenThrow(new NiciraNvpApiException());
+ when(nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenReturn(lrc);
+ when(nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort)any())).thenReturn(lrp);
+ when(nvpApi.createLogicalSwitchPort(eq("bbbbb"), (LogicalSwitchPort)any())).thenReturn(lsp);
+ when(nvpApi.createLogicalRouterNatRule((String) any(), (NatRule)any())).thenThrow(new NiciraNvpApiException());
CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb", "lrouter", "publiccidr", "nexthop", "internalcidr", "owner");
- CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) _resource.executeRequest(clrc);
+ CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) resource.executeRequest(clrc);
assertFalse(clra.getResult());
- verify(_nvpApi, atLeast(1)).deleteLogicalRouter(eq("ccccc"));
- verify(_nvpApi, atLeast(1)).deleteLogicalSwitchPort(eq("bbbbb"), eq("fffff"));
+ verify(nvpApi, atLeast(1)).deleteLogicalRouter(eq("ccccc"));
+ verify(nvpApi, atLeast(1)).deleteLogicalSwitchPort(eq("bbbbb"), eq("fffff"));
}
@Test
public void testDeleteLogicalRouterApiException() throws ConfigurationException,NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
- doThrow(new NiciraNvpApiException()).when(_nvpApi).deleteLogicalRouter(eq("aaaaa"));
- DeleteLogicalRouterAnswer dlspa = (DeleteLogicalRouterAnswer) _resource.executeRequest(new DeleteLogicalRouterCommand("aaaaa"));
+ doThrow(new NiciraNvpApiException()).when(nvpApi).deleteLogicalRouter(eq("aaaaa"));
+ DeleteLogicalRouterAnswer dlspa = (DeleteLogicalRouterAnswer) resource.executeRequest(new DeleteLogicalRouterCommand("aaaaa"));
assertFalse(dlspa.getResult());
}
@Test
public void testConfigurePublicIpsOnLogicalRouterApiException() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
ConfigurePublicIpsOnLogicalRouterCommand cmd = mock(ConfigurePublicIpsOnLogicalRouterCommand.class);
@SuppressWarnings("unchecked")
@@ -422,18 +421,18 @@ public class NiciraNvpResourceTest {
when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa");
when(cmd.getL3GatewayServiceUuid()).thenReturn("bbbbb");
- doThrow(new NiciraNvpApiException()).when(_nvpApi).modifyLogicalRouterPort((String) any(), (LogicalRouterPort) any());
- when(_nvpApi.findLogicalRouterPortByGatewayServiceUuid("aaaaa","bbbbb")).thenReturn(list);
+ doThrow(new NiciraNvpApiException()).when(nvpApi).modifyLogicalRouterPort((String) any(), (LogicalRouterPort) any());
+ when(nvpApi.findLogicalRouterPortByGatewayServiceUuid("aaaaa","bbbbb")).thenReturn(list);
ConfigurePublicIpsOnLogicalRouterAnswer answer =
- (ConfigurePublicIpsOnLogicalRouterAnswer) _resource.executeRequest(cmd);
+ (ConfigurePublicIpsOnLogicalRouterAnswer) resource.executeRequest(cmd);
assertFalse(answer.getResult());
}
@Test
public void testConfigureStaticNatRulesOnLogicalRouter() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
/* StaticNat
* Outside IP: 11.11.11.11
* Inside IP: 10.10.10.10
@@ -450,18 +449,18 @@ public class NiciraNvpResourceTest {
// Mock the api find call
@SuppressWarnings("unchecked")
NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
- when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
+ when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
// Mock the api create calls
- NatRule[] rulepair = _resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
+ NatRule[] rulepair = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
rulepair[0].setUuid(UUID.randomUUID());
rulepair[1].setUuid(UUID.randomUUID());
- when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
+ when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
- ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
+ ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer) resource.executeRequest(cmd);
assertTrue(a.getResult());
- verify(_nvpApi, atLeast(2)).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>() {
+ verify(nvpApi, atLeast(2)).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>() {
@Override
public boolean matches(Object argument) {
NatRule rule = (NatRule) argument;
@@ -479,7 +478,7 @@ public class NiciraNvpResourceTest {
@Test
public void testConfigureStaticNatRulesOnLogicalRouterExistingRules() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
/* StaticNat
* Outside IP: 11.11.11.11
* Inside IP: 10.10.10.10
@@ -494,22 +493,22 @@ public class NiciraNvpResourceTest {
when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa");
// Mock the api create calls
- NatRule[] rulepair = _resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
+ NatRule[] rulepair = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
rulepair[0].setUuid(UUID.randomUUID());
rulepair[1].setUuid(UUID.randomUUID());
- when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
+ when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
// Mock the api find call
@SuppressWarnings("unchecked")
NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
when(storedRules.getResultCount()).thenReturn(2);
when(storedRules.getResults()).thenReturn(Arrays.asList(rulepair));
- when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
+ when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
- ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
+ ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer) resource.executeRequest(cmd);
assertTrue(a.getResult());
- verify(_nvpApi, never()).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>() {
+ verify(nvpApi, never()).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>() {
@Override
public boolean matches(Object argument) {
NatRule rule = (NatRule) argument;
@@ -527,7 +526,7 @@ public class NiciraNvpResourceTest {
@Test
public void testConfigureStaticNatRulesOnLogicalRouterRemoveRules() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
/* StaticNat
* Outside IP: 11.11.11.11
* Inside IP: 10.10.10.10
@@ -542,24 +541,24 @@ public class NiciraNvpResourceTest {
when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa");
// Mock the api create calls
- NatRule[] rulepair = _resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
+ NatRule[] rulepair = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
final UUID rule0Uuid = UUID.randomUUID();
final UUID rule1Uuid = UUID.randomUUID();
rulepair[0].setUuid(rule0Uuid);
rulepair[1].setUuid(rule1Uuid);
- when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
+ when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
// Mock the api find call
@SuppressWarnings("unchecked")
NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
when(storedRules.getResultCount()).thenReturn(2);
when(storedRules.getResults()).thenReturn(Arrays.asList(rulepair));
- when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
+ when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
- ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
+ ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer) resource.executeRequest(cmd);
assertTrue(a.getResult());
- verify(_nvpApi, atLeast(2)).deleteLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<UUID>() {
+ verify(nvpApi, atLeast(2)).deleteLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<UUID>() {
@Override
public boolean matches(Object argument) {
UUID uuid = (UUID) argument;
@@ -572,7 +571,7 @@ public class NiciraNvpResourceTest {
@Test
public void testConfigureStaticNatRulesOnLogicalRouterRollback() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
/* StaticNat
* Outside IP: 11.11.11.11
* Inside IP: 10.10.10.10
@@ -587,26 +586,26 @@ public class NiciraNvpResourceTest {
when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa");
// Mock the api create calls
- NatRule[] rulepair = _resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
+ NatRule[] rulepair = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
rulepair[0].setUuid(UUID.randomUUID());
rulepair[1].setUuid(UUID.randomUUID());
- when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenThrow(new NiciraNvpApiException());
+ when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenThrow(new NiciraNvpApiException());
// Mock the api find call
@SuppressWarnings("unchecked")
NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
when(storedRules.getResultCount()).thenReturn(0);
- when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
+ when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
- ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
+ ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer) resource.executeRequest(cmd);
assertFalse(a.getResult());
- verify(_nvpApi, atLeastOnce()).deleteLogicalRouterNatRule(eq("aaaaa"), eq(rulepair[0].getUuid()));
+ verify(nvpApi, atLeastOnce()).deleteLogicalRouterNatRule(eq("aaaaa"), eq(rulepair[0].getUuid()));
}
@Test
public void testConfigurePortForwardingRulesOnLogicalRouter() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
/* StaticNat
* Outside IP: 11.11.11.11
* Inside IP: 10.10.10.10
@@ -623,18 +622,18 @@ public class NiciraNvpResourceTest {
// Mock the api find call
@SuppressWarnings("unchecked")
NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
- when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
+ when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
// Mock the api create calls
- NatRule[] rulepair = _resource.generatePortForwardingRulePair("10.10.10.10", new int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
+ NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
rulepair[0].setUuid(UUID.randomUUID());
rulepair[1].setUuid(UUID.randomUUID());
- when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
+ when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
- ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
+ ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer) resource.executeRequest(cmd);
assertTrue(a.getResult());
- verify(_nvpApi, atLeast(2)).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>() {
+ verify(nvpApi, atLeast(2)).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>() {
@Override
public boolean matches(Object argument) {
NatRule rule = (NatRule) argument;
@@ -652,7 +651,7 @@ public class NiciraNvpResourceTest {
@Test
public void testConfigurePortForwardingRulesOnLogicalRouterExistingRules() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
/* StaticNat
* Outside IP: 11.11.11.11
* Inside IP: 10.10.10.10
@@ -667,22 +666,22 @@ public class NiciraNvpResourceTest {
when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa");
// Mock the api create calls
- NatRule[] rulepair = _resource.generatePortForwardingRulePair("10.10.10.10", new int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
+ NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
rulepair[0].setUuid(UUID.randomUUID());
rulepair[1].setUuid(UUID.randomUUID());
- when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
+ when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
// Mock the api find call
@SuppressWarnings("unchecked")
NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
when(storedRules.getResultCount()).thenReturn(2);
when(storedRules.getResults()).thenReturn(Arrays.asList(rulepair));
- when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
+ when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
- ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
+ ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer) resource.executeRequest(cmd);
assertTrue(a.getResult());
- verify(_nvpApi, never()).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>() {
+ verify(nvpApi, never()).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>() {
@Override
public boolean matches(Object argument) {
NatRule rule = (NatRule) argument;
@@ -700,7 +699,7 @@ public class NiciraNvpResourceTest {
@Test
public void testConfigurePortForwardingRulesOnLogicalRouterRemoveRules() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
/* StaticNat
* Outside IP: 11.11.11.11
* Inside IP: 10.10.10.10
@@ -715,24 +714,24 @@ public class NiciraNvpResourceTest {
when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa");
// Mock the api create calls
- NatRule[] rulepair = _resource.generatePortForwardingRulePair("10.10.10.10", new int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
+ NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
final UUID rule0Uuid = UUID.randomUUID();
final UUID rule1Uuid = UUID.randomUUID();
rulepair[0].setUuid(rule0Uuid);
rulepair[1].setUuid(rule1Uuid);
- when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
+ when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
// Mock the api find call
@SuppressWarnings("unchecked")
NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
when(storedRules.getResultCount()).thenReturn(2);
when(storedRules.getResults()).thenReturn(Arrays.asList(rulepair));
- when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
+ when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
- ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
+ ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer) resource.executeRequest(cmd);
assertTrue(a.getResult());
- verify(_nvpApi, atLeast(2)).deleteLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<UUID>() {
+ verify(nvpApi, atLeast(2)).deleteLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<UUID>() {
@Override
public boolean matches(Object argument) {
UUID uuid = (UUID) argument;
@@ -745,7 +744,7 @@ public class NiciraNvpResourceTest {
@Test
public void testConfigurePortForwardingRulesOnLogicalRouterRollback() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
/* StaticNat
* Outside IP: 11.11.11.11
* Inside IP: 10.10.10.10
@@ -760,26 +759,26 @@ public class NiciraNvpResourceTest {
when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa");
// Mock the api create calls
- NatRule[] rulepair = _resource.generatePortForwardingRulePair("10.10.10.10", new int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
+ NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
rulepair[0].setUuid(UUID.randomUUID());
rulepair[1].setUuid(UUID.randomUUID());
- when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenThrow(new NiciraNvpApiException());
+ when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenThrow(new NiciraNvpApiException());
// Mock the api find call
@SuppressWarnings("unchecked")
NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
when(storedRules.getResultCount()).thenReturn(0);
- when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
+ when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
- ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
+ ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer) resource.executeRequest(cmd);
assertFalse(a.getResult());
- verify(_nvpApi, atLeastOnce()).deleteLogicalRouterNatRule(eq("aaaaa"), eq(rulepair[0].getUuid()));
+ verify(nvpApi, atLeastOnce()).deleteLogicalRouterNatRule(eq("aaaaa"), eq(rulepair[0].getUuid()));
}
@Test
public void testConfigurePortForwardingRulesOnLogicalRouterPortRange() throws ConfigurationException, NiciraNvpApiException {
- _resource.configure("NiciraNvpResource", _parameters);
+ resource.configure("NiciraNvpResource", parameters);
/* StaticNat
* Outside IP: 11.11.11.11
* Inside IP: 10.10.10.10
@@ -796,15 +795,15 @@ public class NiciraNvpResourceTest {
// Mock the api find call
@SuppressWarnings("unchecked")
NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
- when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
+ when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
// Mock the api create calls
- NatRule[] rulepair = _resource.generatePortForwardingRulePair("10.10.10.10", new int[] { 80, 85 }, "11.11.11.11", new int[] { 80, 85}, "tcp");
+ NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[] { 80, 85 }, "11.11.11.11", new int[] { 80, 85}, "tcp");
rulepair[0].setUuid(UUID.randomUUID());
rulepair[1].setUuid(UUID.randomUUID());
- when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
+ when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
- ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
+ ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer) resource.executeRequest(cmd);
// The expected result is false, Nicira does not support port ranges in DNAT
assertFalse(a.getResult());
@@ -813,7 +812,7 @@ public class NiciraNvpResourceTest {
@Test
public void testGenerateStaticNatRulePair() {
- NatRule[] rules = _resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
+ NatRule[] rules = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
assertTrue("DestinationNatRule".equals(rules[0].getType()));
assertTrue("SourceNatRule".equals(rules[1].getType()));
@@ -830,7 +829,7 @@ public class NiciraNvpResourceTest {
@Test
public void testGeneratePortForwardingRulePair() {
- NatRule[] rules = _resource.generatePortForwardingRulePair("10.10.10.10", new int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80 }, "tcp" );
+ NatRule[] rules = resource.generatePortForwardingRulePair("10.10.10.10", new int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80 }, "tcp" );
assertTrue("DestinationNatRule".equals(rules[0].getType()));
assertTrue("SourceNatRule".equals(rules[1].getType()));
[12/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-3154: UI > zone detail > remove VMware data center action > if API returns error, stop spinning wheel and show returned error text in a pop up dialog.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5e2e27de
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5e2e27de
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5e2e27de
Branch: refs/heads/disk-cache
Commit: 5e2e27dea679ec8abc5c3d54c735db30c531830a
Parents: 9fc81f0
Author: Jessica Wang <je...@apache.org>
Authored: Thu Nov 14 14:35:49 2013 -0800
Committer: Jessica Wang <je...@apache.org>
Committed: Thu Nov 14 14:38:54 2013 -0800
----------------------------------------------------------------------
ui/scripts/system.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5e2e27de/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 6062135..a211a7f 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -6061,6 +6061,10 @@
args.response.success({
data: args.context.physicalResources[0]
});
+ },
+ error: function(XMLHttpResponse) {
+ var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
+ args.response.error(errorMsg);
}
});
},
@@ -16956,7 +16960,7 @@
var zoneActionfilter = function(args) {
var jsonObj = args.context.item;
var allowedActions = ['enableSwift'];
-
+
if (jsonObj.vmwaredcId == null)
allowedActions.push('addVmwareDc');
else
[37/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
dos2unix
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/709b70c6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/709b70c6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/709b70c6
Branch: refs/heads/disk-cache
Commit: 709b70c6d130573caeca13e0e142ce87ed47091a
Parents: 1ece5f0
Author: Daan Hoogland <da...@onecht.net>
Authored: Mon Nov 18 19:22:30 2013 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Nov 18 19:22:30 2013 +0100
----------------------------------------------------------------------
.../src/main/resources/tooling/checkstyle.xml | 78 ++++++++++----------
1 file changed, 39 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/709b70c6/parents/checkstyle/src/main/resources/tooling/checkstyle.xml
----------------------------------------------------------------------
diff --git a/parents/checkstyle/src/main/resources/tooling/checkstyle.xml b/parents/checkstyle/src/main/resources/tooling/checkstyle.xml
index 83493d6..a8e8deb 100644
--- a/parents/checkstyle/src/main/resources/tooling/checkstyle.xml
+++ b/parents/checkstyle/src/main/resources/tooling/checkstyle.xml
@@ -1,39 +1,39 @@
-<?xml version="1.0"?>
-<!--
- 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.
--->
-<!DOCTYPE module PUBLIC
- "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
- "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
-
-<module name="Checker">
- <module name="FileTabCharacter">
- <property name="eachLine" value="true"/>
- </module>
-
- <module name="RegexpSingleline">
- <!-- \s matches whitespace character, $ matches end of line. -->
- <property name="format" value="\s+$"/>
- <property name="message" value="Line has trailing spaces."/>
- </module>
- <module name="TreeWalker">
- <module name="RedundantImport"/>
- <module name="UnusedImports"/>
- </module>
-
-</module>
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+
+<module name="Checker">
+ <module name="FileTabCharacter">
+ <property name="eachLine" value="true"/>
+ </module>
+
+ <module name="RegexpSingleline">
+ <!-- \s matches whitespace character, $ matches end of line. -->
+ <property name="format" value="\s+$"/>
+ <property name="message" value="Line has trailing spaces."/>
+ </module>
+ <module name="TreeWalker">
+ <module name="RedundantImport"/>
+ <module name="UnusedImports"/>
+ </module>
+
+</module>
[48/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
Fixed issues with execute in sequence
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/465626f6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/465626f6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/465626f6
Branch: refs/heads/disk-cache
Commit: 465626f6d13a964ae79891bb210e0ccd874a455b
Parents: 829f1db
Author: Alex Huang <al...@citrix.com>
Authored: Tue Nov 19 17:20:23 2013 -0800
Committer: Alex Huang <al...@citrix.com>
Committed: Tue Nov 19 17:20:58 2013 -0800
----------------------------------------------------------------------
api/src/com/cloud/server/ManagementService.java | 15 ++++++---
.../src/com/cloud/vm/VirtualMachineManager.java | 13 +++++---
.../com/cloud/vm/VirtualMachineManagerImpl.java | 33 ++++++++++----------
.../motion/AncientDataMotionStrategy.java | 20 ++++++------
engine/storage/pom.xml | 2 ++
server/src/com/cloud/configuration/Config.java | 2 --
.../com/cloud/server/ManagementServerImpl.java | 24 +++++---------
7 files changed, 54 insertions(+), 55 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/465626f6/api/src/com/cloud/server/ManagementService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/server/ManagementService.java b/api/src/com/cloud/server/ManagementService.java
index ed46589..1eb4426 100755
--- a/api/src/com/cloud/server/ManagementService.java
+++ b/api/src/com/cloud/server/ManagementService.java
@@ -20,8 +20,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import com.cloud.exception.*;
-
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd;
import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
@@ -34,7 +32,12 @@ import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.ListAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.ListCapacityCmd;
import org.apache.cloudstack.api.command.admin.resource.UploadCustomCertificateCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.*;
+import org.apache.cloudstack.api.command.admin.systemvm.DestroySystemVmCmd;
+import org.apache.cloudstack.api.command.admin.systemvm.ListSystemVMsCmd;
+import org.apache.cloudstack.api.command.admin.systemvm.RebootSystemVmCmd;
+import org.apache.cloudstack.api.command.admin.systemvm.ScaleSystemVMCmd;
+import org.apache.cloudstack.api.command.admin.systemvm.StopSystemVmCmd;
+import org.apache.cloudstack.api.command.admin.systemvm.UpgradeSystemVMCmd;
import org.apache.cloudstack.api.command.admin.vlan.ListVlanIpRangesCmd;
import org.apache.cloudstack.api.command.user.address.ListPublicIpAddressesCmd;
import org.apache.cloudstack.api.command.user.config.ListCapabilitiesCmd;
@@ -55,6 +58,10 @@ import com.cloud.capacity.Capacity;
import com.cloud.dc.Pod;
import com.cloud.dc.Vlan;
import com.cloud.domain.Domain;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.ManagementServerException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.exception.VirtualMachineMigrationException;
import com.cloud.host.Host;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.hypervisor.HypervisorCapabilities;
@@ -365,7 +372,5 @@ public interface ManagementService {
VirtualMachine upgradeSystemVM(ScaleSystemVMCmd cmd) throws ResourceUnavailableException, ManagementServerException, VirtualMachineMigrationException, ConcurrentOperationException;
- boolean getExecuteInSequence();
-
void cleanupVMReservations();
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/465626f6/engine/api/src/com/cloud/vm/VirtualMachineManager.java
----------------------------------------------------------------------
diff --git a/engine/api/src/com/cloud/vm/VirtualMachineManager.java b/engine/api/src/com/cloud/vm/VirtualMachineManager.java
index cb6c62d..35804af 100644
--- a/engine/api/src/com/cloud/vm/VirtualMachineManager.java
+++ b/engine/api/src/com/cloud/vm/VirtualMachineManager.java
@@ -20,6 +20,8 @@ import java.net.URI;
import java.util.LinkedHashMap;
import java.util.Map;
+import org.apache.cloudstack.framework.config.ConfigKey;
+
import com.cloud.agent.api.to.NicTO;
import com.cloud.agent.api.to.VirtualMachineTO;
import com.cloud.deploy.DeployDestination;
@@ -46,11 +48,14 @@ import com.cloud.utils.fsm.NoTransitionException;
* Manages allocating resources to vms.
*/
public interface VirtualMachineManager extends Manager {
-
- public interface Topics {
+ static final ConfigKey<Boolean> ExecuteInSequence = new ConfigKey<Boolean>("Advanced", Boolean.class, "execute.in.sequence.hypervisor.commands", "false",
+ "If set to true, StartCommand, StopCommand, CopyCommand will be synchronized on the agent side."
+ + " If set to false, these commands become asynchronous. Default value is false.", true);
+
+ public interface Topics {
public static final String VM_POWER_STATE = "vm.powerstate";
- }
-
+ }
+
/**
* Allocates a new virtual machine instance in the CloudStack DB. This
* orchestrates the creation of all virtual resources needed in CloudStack
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/465626f6/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 555a58f..75a95c5 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -35,6 +35,8 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
+import org.apache.log4j.Logger;
+
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
@@ -50,7 +52,6 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.cloudstack.storage.to.VolumeObjectTO;
import org.apache.cloudstack.utils.identity.ManagementServerNode;
-import org.apache.log4j.Logger;
import com.cloud.agent.AgentManager;
import com.cloud.agent.Listener;
@@ -281,7 +282,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
Map<VirtualMachine.Type, VirtualMachineGuru> _vmGurus = new HashMap<VirtualMachine.Type, VirtualMachineGuru>();
protected StateMachine2<State, VirtualMachine.Event, VirtualMachine> _stateMachine;
- static final ConfigKey<Integer> StartRetry = new ConfigKey<Integer>(Integer.class, "start.retry", "Advanced", "10", "Number of times to retry create and start commands", true);
+ static final ConfigKey<Integer> StartRetry = new ConfigKey<Integer>("Advanced", Integer.class, "start.retry", "10", "Number of times to retry create and start commands", true);
static final ConfigKey<Integer> VmOpWaitInterval = new ConfigKey<Integer>("Advanced", Integer.class, "vm.op.wait.interval", "120",
"Time (in seconds) to wait before checking if a previous operation has succeeded", true);
@@ -298,6 +299,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
static final ConfigKey<Integer> ClusterDeltaSyncInterval = new ConfigKey<Integer>("Advanced", Integer.class, "sync.interval", "60", "Cluster Delta sync interval in seconds",
false);
+
+
ScheduledExecutorService _executor = null;
protected long _nodeId;
@@ -328,7 +331,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
}
assert (plan.getClusterId() == null && plan.getPoolId() == null) : "We currently don't support cluster and pool preset yet";
final VMInstanceVO vmFinal = _vmDao.persist(vm);
- final LinkedHashMap<? extends DiskOffering, Long> dataDiskOfferingsFinal = dataDiskOfferings == null ?
+ final LinkedHashMap<? extends DiskOffering, Long> dataDiskOfferingsFinal = dataDiskOfferings == null ?
new LinkedHashMap<DiskOffering, Long>() : dataDiskOfferings;
@@ -560,7 +563,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
while (retry-- != 0) {
try {
final ItWorkVO workFinal = work;
- Ternary<VMInstanceVO, ReservationContext, ItWorkVO> result =
+ Ternary<VMInstanceVO, ReservationContext, ItWorkVO> result =
Transaction.execute(new TransactionCallbackWithException<Ternary<VMInstanceVO, ReservationContext, ItWorkVO>, NoTransitionException>() {
@Override
public Ternary<VMInstanceVO, ReservationContext, ItWorkVO> doInTransaction(TransactionStatus status) throws NoTransitionException {
@@ -840,7 +843,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
handlePath(vmTO.getDisks(), vm.getHypervisorType());
cmds = new Commands(Command.OnError.Stop);
- cmds.addCommand(new StartCommand(vmTO, dest.getHost(), getExecuteInSequence()));
+ cmds.addCommand(new StartCommand(vmTO, dest.getHost(), ExecuteInSequence.value()));
vmGuru.finalizeDeployment(cmds, vmProfile, dest, ctx);
@@ -883,7 +886,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
s_logger.info("The guru did not like the answers so stopping " + vm);
}
- StopCommand cmd = new StopCommand(vm, getExecuteInSequence());
+ StopCommand cmd = new StopCommand(vm, ExecuteInSequence.value());
StopAnswer answer = (StopAnswer)_agentMgr.easySend(destHostId, cmd);
if ( answer != null ) {
String hypervisortoolsversion = answer.getHypervisorToolsVersion();
@@ -1043,13 +1046,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
}
}
- protected boolean getExecuteInSequence() {
- return false;
- }
-
protected boolean sendStop(VirtualMachineGuru guru, VirtualMachineProfile profile, boolean force) {
VirtualMachine vm = profile.getVirtualMachine();
- StopCommand stop = new StopCommand(vm, getExecuteInSequence());
+ StopCommand stop = new StopCommand(vm, ExecuteInSequence.value());
try {
StopAnswer answer = (StopAnswer) _agentMgr.send(vm.getHostId(), stop);
if ( answer != null ) {
@@ -1253,7 +1252,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
}
vmGuru.prepareStop(profile);
- StopCommand stop = new StopCommand(vm, getExecuteInSequence());
+ StopCommand stop = new StopCommand(vm, ExecuteInSequence.value());
boolean stopped = false;
StopAnswer answer = null;
try {
@@ -1988,11 +1987,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
}
public Command cleanup(VirtualMachine vm) {
- return new StopCommand(vm, getExecuteInSequence());
+ return new StopCommand(vm, ExecuteInSequence.value());
}
public Command cleanup(String vmName) {
- return new StopCommand(vmName, getExecuteInSequence());
+ return new StopCommand(vmName, ExecuteInSequence.value());
}
public Commands fullHostSync(final long hostId, StartupRoutingCommand startup) {
@@ -2742,7 +2741,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
this.name = name;
this.state = state;
this.vm = vm;
- this.hostUuid = host;
+ hostUuid = host;
this.hvtoolsversion= hvtoolsversion;
}
@@ -3389,7 +3388,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
@Override
public ConfigKey<?>[] getConfigKeys() {
return new ConfigKey<?>[] {ClusterDeltaSyncInterval, StartRetry, VmDestroyForcestop, VmOpCancelInterval, VmOpCleanupInterval, VmOpCleanupWait, VmOpLockStateRetry,
- VmOpWaitInterval};
+ VmOpWaitInterval, ExecuteInSequence};
}
public List<StoragePoolAllocator> getStoragePoolAllocators() {
@@ -3398,7 +3397,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
@Inject
public void setStoragePoolAllocators(List<StoragePoolAllocator> storagePoolAllocators) {
- this._storagePoolAllocators = storagePoolAllocators;
+ _storagePoolAllocators = storagePoolAllocators;
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/465626f6/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
index 67cc324..708e30e 100644
--- a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
+++ b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
@@ -57,7 +57,6 @@ import com.cloud.agent.api.to.NfsTO;
import com.cloud.agent.api.to.VirtualMachineTO;
import com.cloud.configuration.Config;
import com.cloud.host.Host;
-import com.cloud.server.ManagementService;
import com.cloud.storage.DataStoreRole;
import com.cloud.storage.StoragePool;
import com.cloud.storage.VolumeVO;
@@ -65,6 +64,7 @@ import com.cloud.storage.dao.VolumeDao;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.db.DB;
import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.vm.VirtualMachineManager;
@Component
public class
@@ -80,8 +80,6 @@ AncientDataMotionStrategy implements DataMotionStrategy {
DataStoreManager dataStoreMgr;
@Inject
StorageCacheManager cacheMgr;
- @Inject
- ManagementService _mgmtServer;
@Override
public StrategyPriority canHandle(DataObject srcData, DataObject destData) {
@@ -162,7 +160,7 @@ AncientDataMotionStrategy implements DataMotionStrategy {
srcForCopy = cacheData = cacheMgr.createCacheObject(srcData, destScope);
}
- CopyCommand cmd = new CopyCommand(srcForCopy.getTO(), destData.getTO(), _primaryStorageDownloadWait, _mgmtServer.getExecuteInSequence());
+ CopyCommand cmd = new CopyCommand(srcForCopy.getTO(), destData.getTO(), _primaryStorageDownloadWait, VirtualMachineManager.ExecuteInSequence.value());
EndPoint ep = selector.select(srcForCopy, destData);
if (ep == null) {
String errMsg = "No remote endpoint to send command, check if host or ssvm is down?";
@@ -247,7 +245,7 @@ AncientDataMotionStrategy implements DataMotionStrategy {
ep = selector.select(snapObj, volObj);
}
- CopyCommand cmd = new CopyCommand(srcData.getTO(), volObj.getTO(), _createVolumeFromSnapshotWait, _mgmtServer.getExecuteInSequence());
+ CopyCommand cmd = new CopyCommand(srcData.getTO(), volObj.getTO(), _createVolumeFromSnapshotWait, VirtualMachineManager.ExecuteInSequence.value());
Answer answer = null;
if (ep == null) {
String errMsg = "No remote endpoint to send command, check if host or ssvm is down?";
@@ -270,7 +268,7 @@ AncientDataMotionStrategy implements DataMotionStrategy {
}
protected Answer cloneVolume(DataObject template, DataObject volume) {
- CopyCommand cmd = new CopyCommand(template.getTO(), volume.getTO(), 0, _mgmtServer.getExecuteInSequence());
+ CopyCommand cmd = new CopyCommand(template.getTO(), volume.getTO(), 0, VirtualMachineManager.ExecuteInSequence.value());
try {
EndPoint ep = selector.select(volume.getDataStore());
Answer answer = null;
@@ -320,7 +318,7 @@ AncientDataMotionStrategy implements DataMotionStrategy {
objOnImageStore.processEvent(Event.CopyingRequested);
- CopyCommand cmd = new CopyCommand(objOnImageStore.getTO(), destData.getTO(), _copyvolumewait, _mgmtServer.getExecuteInSequence());
+ CopyCommand cmd = new CopyCommand(objOnImageStore.getTO(), destData.getTO(), _copyvolumewait, VirtualMachineManager.ExecuteInSequence.value());
EndPoint ep = selector.select(objOnImageStore, destData);
if (ep == null) {
String errMsg = "No remote endpoint to send command, check if host or ssvm is down?";
@@ -344,7 +342,7 @@ AncientDataMotionStrategy implements DataMotionStrategy {
return answer;
} else {
DataObject cacheData = cacheMgr.createCacheObject(srcData, destScope);
- CopyCommand cmd = new CopyCommand(cacheData.getTO(), destData.getTO(), _copyvolumewait, _mgmtServer.getExecuteInSequence());
+ CopyCommand cmd = new CopyCommand(cacheData.getTO(), destData.getTO(), _copyvolumewait, VirtualMachineManager.ExecuteInSequence.value());
EndPoint ep = selector.select(cacheData, destData);
Answer answer = null;
if (ep == null) {
@@ -457,7 +455,7 @@ AncientDataMotionStrategy implements DataMotionStrategy {
ep = selector.select(srcData, destData);
}
- CopyCommand cmd = new CopyCommand(srcData.getTO(), destData.getTO(), _createprivatetemplatefromsnapshotwait, _mgmtServer.getExecuteInSequence());
+ CopyCommand cmd = new CopyCommand(srcData.getTO(), destData.getTO(), _createprivatetemplatefromsnapshotwait, VirtualMachineManager.ExecuteInSequence.value());
Answer answer = null;
if (ep == null) {
String errMsg = "No remote endpoint to send command, check if host or ssvm is down?";
@@ -486,7 +484,7 @@ AncientDataMotionStrategy implements DataMotionStrategy {
Scope selectedScope = pickCacheScopeForCopy(srcData, destData);
cacheData = cacheMgr.getCacheObject(srcData, selectedScope);
- CopyCommand cmd = new CopyCommand(srcData.getTO(), destData.getTO(), _backupsnapshotwait, _mgmtServer.getExecuteInSequence());
+ CopyCommand cmd = new CopyCommand(srcData.getTO(), destData.getTO(), _backupsnapshotwait, VirtualMachineManager.ExecuteInSequence.value());
cmd.setCacheTO(cacheData.getTO());
EndPoint ep = selector.select(srcData, destData);
if (ep == null) {
@@ -497,7 +495,7 @@ AncientDataMotionStrategy implements DataMotionStrategy {
answer = ep.sendMessage(cmd);
}
} else {
- CopyCommand cmd = new CopyCommand(srcData.getTO(), destData.getTO(), _backupsnapshotwait, _mgmtServer.getExecuteInSequence());
+ CopyCommand cmd = new CopyCommand(srcData.getTO(), destData.getTO(), _backupsnapshotwait, VirtualMachineManager.ExecuteInSequence.value());
EndPoint ep = selector.select(srcData, destData);
if (ep == null) {
String errMsg = "No remote endpoint to send command, check if host or ssvm is down?";
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/465626f6/engine/storage/pom.xml
----------------------------------------------------------------------
diff --git a/engine/storage/pom.xml b/engine/storage/pom.xml
index 91fc879..cc93574 100644
--- a/engine/storage/pom.xml
+++ b/engine/storage/pom.xml
@@ -30,11 +30,13 @@
<artifactId>cloud-core</artifactId>
<version>${project.version}</version>
</dependency>
+ <!--
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-server</artifactId>
<version>${project.version}</version>
</dependency>
+ -->
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine-components-api</artifactId>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/465626f6/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index fd26ff0..640e7fa 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -410,8 +410,6 @@ public enum Config {
BlacklistedRoutes("Advanced", VpcManager.class, String.class, "blacklisted.routes", null, "Routes that are blacklisted, can not be used for Static Routes creation for the VPC Private Gateway",
"routes", ConfigKey.Scope.Zone.toString()),
InternalLbVmServiceOfferingId("Advanced", ManagementServer.class, String.class, "internallbvm.service.offering", null, "Uuid of the service offering used by internal lb vm; if NULL - default system internal lb offering will be used", null),
- ExecuteInSequence("Advanced", ManagementServer.class, Boolean.class, "execute.in.sequence.hypervisor.commands", "false", "If set to true, StartCommand, StopCommand, CopyCommand will be synchronized on the agent side." +
- " If set to false, these commands become asynchronous. Default value is false.", null),
ExecuteInSequenceNetworkElementCommands("Advanced", NetworkOrchestrationService.class, Boolean.class, "execute.in.sequence.network.element.commands", "false", "If set to true, DhcpEntryCommand, SavePasswordCommand, UserDataCommand, VmDataCommand will be synchronized on the agent side." +
" If set to false, these commands become asynchronous. Default value is false.", null),
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/465626f6/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index d083c11..5023e11 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -42,7 +42,6 @@ import javax.crypto.spec.SecretKeySpec;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
-import org.apache.cloudstack.api.command.admin.router.UpgradeRouterTemplateCmd;
import org.apache.commons.codec.binary.Base64;
import org.apache.log4j.Logger;
@@ -145,6 +144,7 @@ import org.apache.cloudstack.api.command.admin.router.RebootRouterCmd;
import org.apache.cloudstack.api.command.admin.router.StartRouterCmd;
import org.apache.cloudstack.api.command.admin.router.StopRouterCmd;
import org.apache.cloudstack.api.command.admin.router.UpgradeRouterCmd;
+import org.apache.cloudstack.api.command.admin.router.UpgradeRouterTemplateCmd;
import org.apache.cloudstack.api.command.admin.storage.AddImageStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.AddS3Cmd;
import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd;
@@ -271,6 +271,7 @@ import org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd;
import org.apache.cloudstack.api.command.user.iso.UpdateIsoPermissionsCmd;
import org.apache.cloudstack.api.command.user.job.ListAsyncJobsCmd;
import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
+import org.apache.cloudstack.api.command.user.loadbalancer.AssignCertToLoadBalancerCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.AssignToLoadBalancerRuleCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.CreateApplicationLoadBalancerCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBHealthCheckPolicyCmd;
@@ -280,18 +281,17 @@ import org.apache.cloudstack.api.command.user.loadbalancer.DeleteApplicationLoad
import org.apache.cloudstack.api.command.user.loadbalancer.DeleteLBHealthCheckPolicyCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.DeleteLBStickinessPolicyCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.DeleteLoadBalancerRuleCmd;
+import org.apache.cloudstack.api.command.user.loadbalancer.DeleteSslCertCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.ListApplicationLoadBalancersCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.ListLBHealthCheckPoliciesCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.ListLBStickinessPoliciesCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRuleInstancesCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRulesCmd;
+import org.apache.cloudstack.api.command.user.loadbalancer.ListSslCertsCmd;
+import org.apache.cloudstack.api.command.user.loadbalancer.RemoveCertFromLoadBalancerCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.RemoveFromLoadBalancerRuleCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.UpdateLoadBalancerRuleCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.UploadSslCertCmd;
-import org.apache.cloudstack.api.command.user.loadbalancer.DeleteSslCertCmd;
-import org.apache.cloudstack.api.command.user.loadbalancer.ListSslCertsCmd;
-import org.apache.cloudstack.api.command.user.loadbalancer.AssignCertToLoadBalancerCmd;
-import org.apache.cloudstack.api.command.user.loadbalancer.RemoveCertFromLoadBalancerCmd;
import org.apache.cloudstack.api.command.user.nat.CreateIpForwardingRuleCmd;
import org.apache.cloudstack.api.command.user.nat.DeleteIpForwardingRuleCmd;
import org.apache.cloudstack.api.command.user.nat.DisableStaticNatCmd;
@@ -574,13 +574,12 @@ import com.cloud.utils.db.DB;
import com.cloud.utils.db.Filter;
import com.cloud.utils.db.GlobalLock;
import com.cloud.utils.db.JoinBuilder;
-import com.cloud.utils.db.TransactionCallback;
-import com.cloud.utils.db.TransactionCallbackNoReturn;
-import com.cloud.utils.db.TransactionStatus;
import com.cloud.utils.db.JoinBuilder.JoinType;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.Transaction;
+import com.cloud.utils.db.TransactionCallbackNoReturn;
+import com.cloud.utils.db.TransactionStatus;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.net.MacAddress;
import com.cloud.utils.net.NetUtils;
@@ -819,8 +818,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
_availableIdsMap.put(id, true);
}
- _executeInSequence = Boolean.parseBoolean(_configDao.getValue(Config.ExecuteInSequence.key()));
-
return true;
}
@@ -3508,11 +3505,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
_encryptionIV = null;
}
- @Override
- public boolean getExecuteInSequence() {
- return _executeInSequence;
- }
-
private static String getBase64EncodedRandomKey(int nBits) {
SecureRandom random;
try {
@@ -3906,6 +3898,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
}
public void setLockMasterListener(LockMasterListener lockMasterListener) {
- this._lockMasterListener = lockMasterListener;
+ _lockMasterListener = lockMasterListener;
}
}
[17/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
Revert "CLOUDSTACK-5176:"
ConfigurationParameterScope class is missing. Possibly an unadded new
file in the git commit.
This reverts commit 1762dbbb17a6cf974db8e145b1c601d954cd4c06.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bf22f6df
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bf22f6df
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bf22f6df
Branch: refs/heads/disk-cache
Commit: bf22f6dfe9cde92b2ab6d05d929b1249eccace6a
Parents: 1292b76
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Fri Nov 15 10:20:26 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Fri Nov 15 10:20:26 2013 +0530
----------------------------------------------------------------------
server/src/com/cloud/configuration/Config.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf22f6df/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index 9f4fc95..bc805b7 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -258,8 +258,8 @@ public enum Config {
VmwareAdditionalVncPortRangeStart("Advanced", ManagementServer.class, Integer.class, "vmware.additional.vnc.portrange.start", "50000", "Start port number of additional VNC port range", null),
VmwareAdditionalVncPortRangeSize("Advanced", ManagementServer.class, Integer.class, "vmware.additional.vnc.portrange.size", "1000", "Start port number of additional VNC port range", null),
//VmwareGuestNicDeviceType("Advanced", ManagementServer.class, String.class, "vmware.guest.nic.device.type", "E1000", "Ethernet card type used in guest VM, valid values are E1000, PCNet32, Vmxnet2, Vmxnet3", null),
- VmwareReserveCpu("Advanced", ManagementServer.class, Boolean.class, "vmware.reserve.cpu", "false", "Specify whether or not to reserve CPU based on CPU overprovisioning factor", null, ConfigurationParameterScope.cluster.toString()),
- VmwareReserveMem("Advanced", ManagementServer.class, Boolean.class, "vmware.reserve.mem", "false", "Specify whether or not to reserve memory based on memory overprovisioning factor", null, ConfigurationParameterScope.cluster.toString()),
+ VmwareReserveCpu("Advanced", ManagementServer.class, Boolean.class, "vmware.reserve.cpu", "false", "Specify whether or not to reserve CPU based on CPU overprovisioning factor", null),
+ VmwareReserveMem("Advanced", ManagementServer.class, Boolean.class, "vmware.reserve.mem", "false", "Specify whether or not to reserve memory based on memory overprovisioning factor", null),
VmwareRootDiskControllerType("Advanced", ManagementServer.class, String.class, "vmware.root.disk.controller", "ide", "Specify the default disk controller for root volumes, valid values are scsi, ide", null),
VmwareSystemVmNicDeviceType("Advanced", ManagementServer.class, String.class, "vmware.systemvm.nic.device.type", "E1000", "Specify the default network device type for system VMs, valid values are E1000, PCNet32, Vmxnet2, Vmxnet3", null),
VmwareRecycleHungWorker("Advanced", ManagementServer.class, Boolean.class, "vmware.recycle.hung.wokervm", "false", "Specify whether or not to recycle hung worker VMs", null),
[40/50] [abbrv] Checkstyle adjustments in code and configuration
Posted by wi...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java
index ea69a09..a3b3542 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java
@@ -72,19 +72,26 @@ import com.google.gson.JsonParseException;
import com.google.gson.reflect.TypeToken;
public class NiciraNvpApi {
+ private static final String TEXT_HTML_CONTENT_TYPE = "text/html";
+ private static final String JSON_CONTENT_TYPE = "application/json";
+ private static final String CONTENT_TYPE = "Content-Type";
+ private static final int BODY_RESP_MAX_LEN = 1024;
+ private static final String SWITCH_URI_PREFIX = "/ws.v1/lswitch";
+ private static final String ROUTER_URI_PREFIX = "/ws.v1/lrouter";
+ private static final int HTTPS_PORT = 443;
private static final Logger s_logger = Logger.getLogger(NiciraNvpApi.class);
- private final static String _protocol = "https";
- private static final MultiThreadedHttpConnectionManager s_httpClientManager = new MultiThreadedHttpConnectionManager();
+ private final static String protocol = "https";
+ private final static MultiThreadedHttpConnectionManager s_httpClientManager = new MultiThreadedHttpConnectionManager();
- private String _name;
- private String _host;
- private String _adminuser;
- private String _adminpass;
+ private String name;
+ private String host;
+ private String adminuser;
+ private String adminpass;
- private HttpClient _client;
- private String _nvpversion;
+ private final HttpClient client;
+ private String nvpVersion;
- private Gson _gson;
+ private final Gson gson;
/* This factory method is protected so we can extend this
* in the unittests.
@@ -93,10 +100,10 @@ public class NiciraNvpApi {
return new HttpClient(s_httpClientManager);
}
- protected HttpMethod createMethod(String type, String uri) throws NiciraNvpApiException {
+ protected HttpMethod createMethod(final String type, final String uri) throws NiciraNvpApiException {
String url;
try {
- url = new URL(_protocol, _host, uri).toString();
+ url = new URL(protocol, host, uri).toString();
} catch (MalformedURLException e) {
s_logger.error("Unable to build Nicira API URL", e);
throw new NiciraNvpApiException("Unable to build Nicira API URL", e);
@@ -104,76 +111,71 @@ public class NiciraNvpApi {
if ("post".equalsIgnoreCase(type)) {
return new PostMethod(url);
- }
- else if ("get".equalsIgnoreCase(type)) {
+ } else if ("get".equalsIgnoreCase(type)) {
return new GetMethod(url);
- }
- else if ("delete".equalsIgnoreCase(type)) {
+ } else if ("delete".equalsIgnoreCase(type)) {
return new DeleteMethod(url);
- }
- else if ("put".equalsIgnoreCase(type)) {
+ } else if ("put".equalsIgnoreCase(type)) {
return new PutMethod(url);
- }
- else {
+ } else {
throw new NiciraNvpApiException("Requesting unknown method type");
}
}
public NiciraNvpApi() {
- _client = createHttpClient();
- _client.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
+ client = createHttpClient();
+ client.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
try {
// Cast to ProtocolSocketFactory to avoid the deprecated constructor with the SecureProtocolSocketFactory parameter
- Protocol.registerProtocol("https", new Protocol("https", (ProtocolSocketFactory) new TrustingProtocolSocketFactory(), 443));
+ Protocol.registerProtocol("https", new Protocol("https", (ProtocolSocketFactory) new TrustingProtocolSocketFactory(), HTTPS_PORT));
} catch (IOException e) {
s_logger.warn("Failed to register the TrustingProtocolSocketFactory, falling back to default SSLSocketFactory", e);
}
- _gson = new GsonBuilder()
- .registerTypeAdapter(NatRule.class, new NatRuleAdapter())
- .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
- .create();
-
+ gson = new GsonBuilder()
+ .registerTypeAdapter(NatRule.class, new NatRuleAdapter())
+ .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
+ .create();
}
- public void setControllerAddress(String address) {
- _host = address;
+ public void setControllerAddress(final String address) {
+ host = address;
}
- public void setAdminCredentials(String username, String password) {
- _adminuser = username;
- _adminpass = password;
+ public void setAdminCredentials(final String username, final String password) {
+ adminuser = username;
+ adminpass = password;
}
/**
- * Logs into the Nicira API. The cookie is stored in the
- * <code>_authcookie<code> variable.
+ * Logs into the Nicira API. The cookie is stored in the <code>_authcookie<code> variable.
* <p>
* The method returns false if the login failed or the connection could not be made.
+ *
*/
protected void login() throws NiciraNvpApiException {
String url;
- if (_host == null || _host.isEmpty() ||
- _adminuser == null || _adminuser.isEmpty() ||
- _adminpass == null || _adminpass.isEmpty()) {
+ if (host == null || host.isEmpty() ||
+ adminuser == null || adminuser.isEmpty() ||
+ adminpass == null || adminpass.isEmpty()) {
throw new NiciraNvpApiException("Hostname/credentials are null or empty");
}
try {
- url = new URL(_protocol, _host, "/ws.v1/login").toString();
+ url = new URL(protocol, host, "/ws.v1/login").toString();
} catch (MalformedURLException e) {
s_logger.error("Unable to build Nicira API URL", e);
throw new NiciraNvpApiException("Unable to build Nicira API URL", e);
}
PostMethod pm = new PostMethod(url);
- pm.addParameter("username", _adminuser);
- pm.addParameter("password", _adminpass);
+ pm.addParameter("username", adminuser);
+ pm.addParameter("password", adminpass);
try {
- _client.executeMethod(pm);
+ client.executeMethod(pm);
} catch (HttpException e) {
throw new NiciraNvpApiException("Nicira NVP API login failed ", e);
} catch (IOException e) {
@@ -189,44 +191,47 @@ public class NiciraNvpApi {
// Extract the version for later use
if (pm.getResponseHeader("Server") != null) {
- _nvpversion = pm.getResponseHeader("Server").getValue();
- s_logger.debug("NVP Controller reports version " + _nvpversion);
+ nvpVersion = pm.getResponseHeader("Server").getValue();
+ s_logger.debug("NVP Controller reports version " + nvpVersion);
}
// Success; the cookie required for login is kept in _client
}
- public LogicalSwitch createLogicalSwitch(LogicalSwitch logicalSwitch) throws NiciraNvpApiException {
- String uri = "/ws.v1/lswitch";
+ public LogicalSwitch createLogicalSwitch(final LogicalSwitch logicalSwitch) throws NiciraNvpApiException {
+ String uri = SWITCH_URI_PREFIX;
LogicalSwitch createdLogicalSwitch = executeCreateObject(logicalSwitch, new TypeToken<LogicalSwitch>(){}.getType(), uri, Collections.<String,String>emptyMap());
return createdLogicalSwitch;
}
- public void deleteLogicalSwitch(String uuid) throws NiciraNvpApiException {
- String uri = "/ws.v1/lswitch/" + uuid;
+ public void deleteLogicalSwitch(final String uuid) throws NiciraNvpApiException {
+ String uri = SWITCH_URI_PREFIX + uuid;
executeDeleteObject(uri);
}
- public LogicalSwitchPort createLogicalSwitchPort(String logicalSwitchUuid, LogicalSwitchPort logicalSwitchPort) throws NiciraNvpApiException {
- String uri = "/ws.v1/lswitch/" + logicalSwitchUuid + "/lport";
- LogicalSwitchPort createdLogicalSwitchPort = executeCreateObject(logicalSwitchPort, new TypeToken<LogicalSwitchPort>(){}.getType(), uri, Collections.<String,String>emptyMap());;
+ public LogicalSwitchPort createLogicalSwitchPort(final String logicalSwitchUuid, final LogicalSwitchPort logicalSwitchPort)
+ throws NiciraNvpApiException {
+ String uri = SWITCH_URI_PREFIX + logicalSwitchUuid + "/lport";
+ LogicalSwitchPort createdLogicalSwitchPort = executeCreateObject(logicalSwitchPort,
+ new TypeToken<LogicalSwitchPort>(){}.getType(), uri, Collections.<String,String>emptyMap());
return createdLogicalSwitchPort;
}
- public void modifyLogicalSwitchPortAttachment(String logicalSwitchUuid, String logicalSwitchPortUuid, Attachment attachment) throws NiciraNvpApiException {
- String uri = "/ws.v1/lswitch/" + logicalSwitchUuid + "/lport/" + logicalSwitchPortUuid + "/attachment";
+ public void modifyLogicalSwitchPortAttachment(final String logicalSwitchUuid, final String logicalSwitchPortUuid,
+ Attachment attachment) throws NiciraNvpApiException {
+ String uri = SWITCH_URI_PREFIX + logicalSwitchUuid + "/lport/" + logicalSwitchPortUuid + "/attachment";
executeUpdateObject(attachment, uri, Collections.<String,String>emptyMap());
}
- public void deleteLogicalSwitchPort(String logicalSwitchUuid, String logicalSwitchPortUuid) throws NiciraNvpApiException {
- String uri = "/ws.v1/lswitch/" + logicalSwitchUuid + "/lport/" + logicalSwitchPortUuid;
+ public void deleteLogicalSwitchPort(final String logicalSwitchUuid, final String logicalSwitchPortUuid) throws NiciraNvpApiException {
+ String uri = SWITCH_URI_PREFIX + logicalSwitchUuid + "/lport/" + logicalSwitchPortUuid;
executeDeleteObject(uri);
}
- public String findLogicalSwitchPortUuidByVifAttachmentUuid(String logicalSwitchUuid, String vifAttachmentUuid) throws NiciraNvpApiException {
- String uri = "/ws.v1/lswitch/" + logicalSwitchUuid + "/lport";
+ public String findLogicalSwitchPortUuidByVifAttachmentUuid(final String logicalSwitchUuid, final String vifAttachmentUuid) throws NiciraNvpApiException {
+ String uri = SWITCH_URI_PREFIX + logicalSwitchUuid + "/lport";
Map<String,String> params = new HashMap<String,String>();
params.put("attachment_vif_uuid", vifAttachmentUuid);
params.put("fields", "uuid");
@@ -248,8 +253,9 @@ public class NiciraNvpApi {
return ccs;
}
- public NiciraNvpList<LogicalSwitchPort> findLogicalSwitchPortsByUuid(String logicalSwitchUuid, String logicalSwitchPortUuid) throws NiciraNvpApiException {
- String uri = "/ws.v1/lswitch/" + logicalSwitchUuid + "/lport";
+ public NiciraNvpList<LogicalSwitchPort> findLogicalSwitchPortsByUuid(final String logicalSwitchUuid,
+ final String logicalSwitchPortUuid) throws NiciraNvpApiException {
+ String uri = SWITCH_URI_PREFIX + logicalSwitchUuid + "/lport";
Map<String,String> params = new HashMap<String,String>();
params.put("uuid", logicalSwitchPortUuid);
params.put("fields", "uuid");
@@ -263,64 +269,66 @@ public class NiciraNvpApi {
return lspl;
}
- public LogicalRouterConfig createLogicalRouter(LogicalRouterConfig logicalRouterConfig) throws NiciraNvpApiException {
- String uri = "/ws.v1/lrouter";
+ public LogicalRouterConfig createLogicalRouter(final LogicalRouterConfig logicalRouterConfig) throws NiciraNvpApiException {
+ String uri = ROUTER_URI_PREFIX;
LogicalRouterConfig lrc = executeCreateObject(logicalRouterConfig, new TypeToken<LogicalRouterConfig>(){}.getType(), uri, Collections.<String,String>emptyMap());
return lrc;
}
- public void deleteLogicalRouter(String logicalRouterUuid) throws NiciraNvpApiException {
- String uri = "/ws.v1/lrouter/" + logicalRouterUuid;
+ public void deleteLogicalRouter(final String logicalRouterUuid) throws NiciraNvpApiException {
+ String uri = ROUTER_URI_PREFIX + logicalRouterUuid;
executeDeleteObject(uri);
}
- public LogicalRouterPort createLogicalRouterPort(String logicalRouterUuid, LogicalRouterPort logicalRouterPort) throws NiciraNvpApiException {
- String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/lport";
+ public LogicalRouterPort createLogicalRouterPort(final String logicalRouterUuid, final LogicalRouterPort logicalRouterPort) throws NiciraNvpApiException {
+ String uri = ROUTER_URI_PREFIX + logicalRouterUuid + "/lport";
LogicalRouterPort lrp = executeCreateObject(logicalRouterPort, new TypeToken<LogicalRouterPort>(){}.getType(), uri, Collections.<String,String>emptyMap());
return lrp;
}
- public void deleteLogicalRouterPort(String logicalRouterUuid, String logicalRouterPortUuid) throws NiciraNvpApiException {
- String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/lport/" + logicalRouterPortUuid;
+ public void deleteLogicalRouterPort(final String logicalRouterUuid, final String logicalRouterPortUuid) throws NiciraNvpApiException {
+ String uri = ROUTER_URI_PREFIX + logicalRouterUuid + "/lport/" + logicalRouterPortUuid;
executeDeleteObject(uri);
}
- public void modifyLogicalRouterPort(String logicalRouterUuid, LogicalRouterPort logicalRouterPort) throws NiciraNvpApiException {
- String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/lport/" + logicalRouterPort.getUuid();
+ public void modifyLogicalRouterPort(final String logicalRouterUuid, final LogicalRouterPort logicalRouterPort) throws NiciraNvpApiException {
+ String uri = ROUTER_URI_PREFIX + logicalRouterUuid + "/lport/" + logicalRouterPort.getUuid();
executeUpdateObject(logicalRouterPort, uri, Collections.<String,String>emptyMap());
}
- public void modifyLogicalRouterPortAttachment(String logicalRouterUuid, String logicalRouterPortUuid, Attachment attachment) throws NiciraNvpApiException {
- String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/lport/" + logicalRouterPortUuid + "/attachment";
+ public void modifyLogicalRouterPortAttachment(final String logicalRouterUuid, final String logicalRouterPortUuid,
+ final Attachment attachment) throws NiciraNvpApiException {
+ String uri = ROUTER_URI_PREFIX + logicalRouterUuid + "/lport/" + logicalRouterPortUuid + "/attachment";
executeUpdateObject(attachment, uri, Collections.<String,String>emptyMap());
}
- public NatRule createLogicalRouterNatRule(String logicalRouterUuid, NatRule natRule) throws NiciraNvpApiException {
- String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/nat";
+ public NatRule createLogicalRouterNatRule(final String logicalRouterUuid, final NatRule natRule) throws NiciraNvpApiException {
+ String uri = ROUTER_URI_PREFIX + logicalRouterUuid + "/nat";
return executeCreateObject(natRule, new TypeToken<NatRule>(){}.getType(), uri, Collections.<String,String>emptyMap());
}
- public void modifyLogicalRouterNatRule(String logicalRouterUuid, NatRule natRule) throws NiciraNvpApiException {
- String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/nat/" + natRule.getUuid();
+ public void modifyLogicalRouterNatRule(final String logicalRouterUuid, final NatRule natRule) throws NiciraNvpApiException {
+ String uri = ROUTER_URI_PREFIX + logicalRouterUuid + "/nat/" + natRule.getUuid();
executeUpdateObject(natRule, uri, Collections.<String,String>emptyMap());
}
- public void deleteLogicalRouterNatRule(String logicalRouterUuid, UUID natRuleUuid) throws NiciraNvpApiException {
- String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/nat/" + natRuleUuid.toString();
+ public void deleteLogicalRouterNatRule(final String logicalRouterUuid, final UUID natRuleUuid) throws NiciraNvpApiException {
+ String uri = ROUTER_URI_PREFIX + logicalRouterUuid + "/nat/" + natRuleUuid.toString();
executeDeleteObject(uri);
}
- public NiciraNvpList<LogicalRouterPort> findLogicalRouterPortByGatewayServiceAndVlanId(String logicalRouterUuid, String gatewayServiceUuid, long vlanId) throws NiciraNvpApiException {
- String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/lport";
+ public NiciraNvpList<LogicalRouterPort> findLogicalRouterPortByGatewayServiceAndVlanId(
+ final String logicalRouterUuid, final String gatewayServiceUuid, final long vlanId) throws NiciraNvpApiException {
+ String uri = ROUTER_URI_PREFIX + logicalRouterUuid + "/lport";
Map<String,String> params = new HashMap<String,String>();
params.put("attachment_gwsvc_uuid", gatewayServiceUuid);
params.put("attachment_vlan", "0");
@@ -329,28 +337,29 @@ public class NiciraNvpApi {
return executeRetrieveObject(new TypeToken<NiciraNvpList<LogicalRouterPort>>(){}.getType(), uri, params);
}
- public LogicalRouterConfig findOneLogicalRouterByUuid(String logicalRouterUuid) throws NiciraNvpApiException {
- String uri = "/ws.v1/lrouter/" + logicalRouterUuid;
+ public LogicalRouterConfig findOneLogicalRouterByUuid(final String logicalRouterUuid) throws NiciraNvpApiException {
+ String uri = ROUTER_URI_PREFIX + logicalRouterUuid;
return executeRetrieveObject(new TypeToken<LogicalRouterConfig>(){}.getType(), uri, Collections.<String,String>emptyMap());
}
- public void updateLogicalRouterPortConfig(String logicalRouterUuid, LogicalRouterPort logicalRouterPort) throws NiciraNvpApiException {
- String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/lport" + logicalRouterPort.getUuid();
+ public void updateLogicalRouterPortConfig(final String logicalRouterUuid, final LogicalRouterPort logicalRouterPort) throws NiciraNvpApiException {
+ String uri = ROUTER_URI_PREFIX + logicalRouterUuid + "/lport" + logicalRouterPort.getUuid();
executeUpdateObject(logicalRouterPort, uri, Collections.<String,String>emptyMap());
}
- public NiciraNvpList<NatRule> findNatRulesByLogicalRouterUuid(String logicalRouterUuid) throws NiciraNvpApiException {
- String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/nat";
+ public NiciraNvpList<NatRule> findNatRulesByLogicalRouterUuid(final String logicalRouterUuid) throws NiciraNvpApiException {
+ String uri = ROUTER_URI_PREFIX + logicalRouterUuid + "/nat";
Map<String,String> params = new HashMap<String,String>();
params.put("fields","*");
return executeRetrieveObject(new TypeToken<NiciraNvpList<NatRule>>(){}.getType(), uri, params);
}
- public NiciraNvpList<LogicalRouterPort> findLogicalRouterPortByGatewayServiceUuid(String logicalRouterUuid, String l3GatewayServiceUuid) throws NiciraNvpApiException {
- String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/lport";
+ public NiciraNvpList<LogicalRouterPort> findLogicalRouterPortByGatewayServiceUuid(final String logicalRouterUuid,
+ final String l3GatewayServiceUuid) throws NiciraNvpApiException {
+ String uri = ROUTER_URI_PREFIX + logicalRouterUuid + "/lport";
Map<String,String> params = new HashMap<String,String>();
params.put("fields", "*");
params.put("attachment_gwsvc_uuid", l3GatewayServiceUuid);
@@ -358,18 +367,18 @@ public class NiciraNvpApi {
return executeRetrieveObject(new TypeToken<NiciraNvpList<LogicalRouterPort>>(){}.getType(), uri, params);
}
- protected <T> void executeUpdateObject(T newObject, String uri, Map<String,String> parameters) throws NiciraNvpApiException {
- if (_host == null || _host.isEmpty() ||
- _adminuser == null || _adminuser.isEmpty() ||
- _adminpass == null || _adminpass.isEmpty()) {
+ protected <T> void executeUpdateObject(final T newObject, final String uri, final Map<String,String> parameters) throws NiciraNvpApiException {
+ if (host == null || host.isEmpty() ||
+ adminuser == null || adminuser.isEmpty() ||
+ adminpass == null || adminpass.isEmpty()) {
throw new NiciraNvpApiException("Hostname/credentials are null or empty");
}
PutMethod pm = (PutMethod) createMethod("put", uri);
- pm.setRequestHeader("Content-Type", "application/json");
+ pm.setRequestHeader(CONTENT_TYPE, JSON_CONTENT_TYPE);
try {
pm.setRequestEntity(new StringRequestEntity(
- _gson.toJson(newObject),"application/json", null));
+ gson.toJson(newObject),JSON_CONTENT_TYPE, null));
} catch (UnsupportedEncodingException e) {
throw new NiciraNvpApiException("Failed to encode json request body", e);
}
@@ -385,18 +394,19 @@ public class NiciraNvpApi {
pm.releaseConnection();
}
- protected <T> T executeCreateObject(T newObject, Type returnObjectType, String uri, Map<String,String> parameters) throws NiciraNvpApiException {
- if (_host == null || _host.isEmpty() ||
- _adminuser == null || _adminuser.isEmpty() ||
- _adminpass == null || _adminpass.isEmpty()) {
+ protected <T> T executeCreateObject(final T newObject, final Type returnObjectType, final String uri,
+ final Map<String,String> parameters) throws NiciraNvpApiException {
+ if (host == null || host.isEmpty() ||
+ adminuser == null || adminuser.isEmpty() ||
+ adminpass == null || adminpass.isEmpty()) {
throw new NiciraNvpApiException("Hostname/credentials are null or empty");
}
PostMethod pm = (PostMethod) createMethod("post", uri);
- pm.setRequestHeader("Content-Type", "application/json");
+ pm.setRequestHeader(CONTENT_TYPE, JSON_CONTENT_TYPE);
try {
pm.setRequestEntity(new StringRequestEntity(
- _gson.toJson(newObject),"application/json", null));
+ gson.toJson(newObject),JSON_CONTENT_TYPE, null));
} catch (UnsupportedEncodingException e) {
throw new NiciraNvpApiException("Failed to encode json request body", e);
}
@@ -412,7 +422,7 @@ public class NiciraNvpApi {
T result;
try {
- result = (T)_gson.fromJson(pm.getResponseBodyAsString(), TypeToken.get(newObject.getClass()).getType());
+ result = (T)gson.fromJson(pm.getResponseBodyAsString(), TypeToken.get(newObject.getClass()).getType());
} catch (IOException e) {
throw new NiciraNvpApiException("Failed to decode json response body", e);
} finally {
@@ -422,15 +432,15 @@ public class NiciraNvpApi {
return result;
}
- protected void executeDeleteObject(String uri) throws NiciraNvpApiException {
- if (_host == null || _host.isEmpty() ||
- _adminuser == null || _adminuser.isEmpty() ||
- _adminpass == null || _adminpass.isEmpty()) {
+ protected void executeDeleteObject(final String uri) throws NiciraNvpApiException {
+ if (host == null || host.isEmpty() ||
+ adminuser == null || adminuser.isEmpty() ||
+ adminpass == null || adminpass.isEmpty()) {
throw new NiciraNvpApiException("Hostname/credentials are null or empty");
}
DeleteMethod dm = (DeleteMethod) createMethod("delete", uri);
- dm.setRequestHeader("Content-Type", "application/json");
+ dm.setRequestHeader(CONTENT_TYPE, JSON_CONTENT_TYPE);
executeMethod(dm);
@@ -443,15 +453,16 @@ public class NiciraNvpApi {
dm.releaseConnection();
}
- protected <T> T executeRetrieveObject(Type returnObjectType, String uri, Map<String,String> parameters) throws NiciraNvpApiException {
- if (_host == null || _host.isEmpty() ||
- _adminuser == null || _adminuser.isEmpty() ||
- _adminpass == null || _adminpass.isEmpty()) {
+ protected <T> T executeRetrieveObject(final Type returnObjectType, final String uri,
+ final Map<String,String> parameters) throws NiciraNvpApiException {
+ if (host == null || host.isEmpty() ||
+ adminuser == null || adminuser.isEmpty() ||
+ adminpass == null || adminpass.isEmpty()) {
throw new NiciraNvpApiException("Hostname/credentials are null or empty");
}
GetMethod gm = (GetMethod) createMethod("get", uri);
- gm.setRequestHeader("Content-Type", "application/json");
+ gm.setRequestHeader(CONTENT_TYPE, JSON_CONTENT_TYPE);
if (parameters != null && !parameters.isEmpty()) {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(parameters.size());
for (Entry<String,String> e : parameters.entrySet()) {
@@ -471,7 +482,7 @@ public class NiciraNvpApi {
T returnValue;
try {
- returnValue = (T)_gson.fromJson(gm.getResponseBodyAsString(), returnObjectType);
+ returnValue = (T)gson.fromJson(gm.getResponseBodyAsString(), returnObjectType);
} catch (IOException e) {
s_logger.error("IOException while retrieving response body",e);
throw new NiciraNvpApiException(e);
@@ -481,14 +492,14 @@ public class NiciraNvpApi {
return returnValue;
}
- protected void executeMethod(HttpMethodBase method) throws NiciraNvpApiException {
+ protected void executeMethod(final HttpMethodBase method) throws NiciraNvpApiException {
try {
- _client.executeMethod(method);
+ client.executeMethod(method);
if (method.getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
method.releaseConnection();
// login and try again
login();
- _client.executeMethod(method);
+ client.executeMethod(method);
}
} catch (HttpException e) {
s_logger.error("HttpException caught while trying to connect to the Nicira NVP Controller", e);
@@ -501,15 +512,15 @@ public class NiciraNvpApi {
}
}
- private String responseToErrorMessage(HttpMethodBase method) {
+ private String responseToErrorMessage(final HttpMethodBase method) {
assert method.isRequestSent() : "no use getting an error message unless the request is sent";
- if ("text/html".equals(method.getResponseHeader("Content-Type").getValue())) {
+ if (TEXT_HTML_CONTENT_TYPE.equals(method.getResponseHeader(CONTENT_TYPE).getValue())) {
// The error message is the response content
// Safety margin of 1024 characters, anything longer is probably useless
// and will clutter the logs
try {
- return method.getResponseBodyAsString(1024);
+ return method.getResponseBodyAsString(BODY_RESP_MAX_LEN);
} catch (IOException e) {
s_logger.debug("Error while loading response body", e);
}
@@ -531,22 +542,22 @@ public class NiciraNvpApi {
public TrustingProtocolSocketFactory() throws IOException {
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[] {
- new X509TrustManager() {
- @Override
- public X509Certificate[] getAcceptedIssuers() {
- return null;
- }
-
- @Override
- public void checkClientTrusted(X509Certificate[] certs, String authType) {
- // Trust always
- }
-
- @Override
- public void checkServerTrusted(X509Certificate[] certs, String authType) {
- // Trust always
- }
+ new X509TrustManager() {
+ @Override
+ public X509Certificate[] getAcceptedIssuers() {
+ return null;
+ }
+
+ @Override
+ public void checkClientTrusted(final X509Certificate[] certs, final String authType) {
+ // Trust always
}
+
+ @Override
+ public void checkServerTrusted(final X509Certificate[] certs, final String authType) {
+ // Trust always
+ }
+ }
};
try {
@@ -562,26 +573,25 @@ public class NiciraNvpApi {
}
@Override
- public Socket createSocket(String host, int port) throws IOException,
- UnknownHostException {
+ public Socket createSocket(final String host, final int port) throws IOException {
return ssf.createSocket(host, port);
}
@Override
- public Socket createSocket(String address, int port, InetAddress localAddress,
- int localPort) throws IOException, UnknownHostException {
+ public Socket createSocket(final String address, final int port, final InetAddress localAddress,
+ final int localPort) throws IOException, UnknownHostException {
return ssf.createSocket(address, port, localAddress, localPort);
}
@Override
- public Socket createSocket(Socket socket, String host, int port,
- boolean autoClose) throws IOException, UnknownHostException {
+ public Socket createSocket(final Socket socket, final String host, final int port,
+ final boolean autoClose) throws IOException, UnknownHostException {
return ssf.createSocket(socket, host, port, autoClose);
}
@Override
- public Socket createSocket(String host, int port, InetAddress localAddress,
- int localPort, HttpConnectionParams params) throws IOException,
+ public Socket createSocket(final String host, final int port, final InetAddress localAddress,
+ final int localPort, final HttpConnectionParams params) throws IOException,
UnknownHostException, ConnectTimeoutException {
int timeout = params.getConnectionTimeout();
if (timeout == 0) {
@@ -594,16 +604,15 @@ public class NiciraNvpApi {
return s;
}
}
-
-
}
public static class NatRuleAdapter implements JsonDeserializer<NatRule> {
@Override
- public NatRule deserialize(JsonElement jsonElement, Type type,
- JsonDeserializationContext context) throws JsonParseException {
+ public NatRule deserialize(final JsonElement jsonElement, final Type type,
+ final JsonDeserializationContext context) throws JsonParseException {
JsonObject jsonObject = jsonElement.getAsJsonObject();
+
if (!jsonObject.has("type")) {
throw new JsonParseException("Deserializing as a NatRule, but no type present in the json object");
}
@@ -611,8 +620,7 @@ public class NiciraNvpApi {
String natRuleType = jsonObject.get("type").getAsString();
if ("SourceNatRule".equals(natRuleType)) {
return context.deserialize(jsonElement, SourceNatRule.class);
- }
- else if ("DestinationNatRule".equals(natRuleType)) {
+ } else if ("DestinationNatRule".equals(natRuleType)) {
return context.deserialize(jsonElement, DestinationNatRule.class);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApiException.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApiException.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApiException.java
index db34a15..facc5ab 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApiException.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApiException.java
@@ -21,15 +21,15 @@ public class NiciraNvpApiException extends Exception {
public NiciraNvpApiException() {
}
- public NiciraNvpApiException(String message) {
+ public NiciraNvpApiException(final String message) {
super(message);
}
- public NiciraNvpApiException(Throwable cause) {
+ public NiciraNvpApiException(final Throwable cause) {
super(cause);
}
- public NiciraNvpApiException(String message, Throwable cause) {
+ public NiciraNvpApiException(final String message, final Throwable cause) {
super(message, cause);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpList.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpList.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpList.java
index 9d78e84..ba6ff97 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpList.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpList.java
@@ -20,10 +20,10 @@ import java.util.List;
public class NiciraNvpList<T> {
private List<T> results;
- private int result_count;
+ private int resultCount;
public List<T> getResults() {
- return results;
+ return this.results;
}
public void setResults(List<T> results) {
@@ -31,15 +31,15 @@ public class NiciraNvpList<T> {
}
public int getResultCount() {
- return result_count;
+ return resultCount;
}
- public void setResultCount(int result_count) {
- this.result_count = result_count;
+ public void setResultCount(int resultCount) {
+ this.resultCount = resultCount;
}
public boolean isEmpty() {
- return result_count == 0;
+ return this.resultCount == 0;
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpTag.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpTag.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpTag.java
index a5dd3bd..0b69cc9 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpTag.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpTag.java
@@ -19,6 +19,7 @@ package com.cloud.network.nicira;
import org.apache.log4j.Logger;
public class NiciraNvpTag {
+ private static final int TAG_MAX_LEN = 40;
private static final Logger s_logger = Logger.getLogger(NiciraNvpTag.class);
private String scope;
private String tag;
@@ -29,7 +30,7 @@ public class NiciraNvpTag {
this.scope = scope;
if (tag.length() > 40) {
s_logger.warn("tag \"" + tag + "\" too long, truncating to 40 characters");
- this.tag = tag.substring(0, 40);
+ this.tag = tag.substring(0, TAG_MAX_LEN);
} else {
this.tag = tag;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/PatchAttachment.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/PatchAttachment.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/PatchAttachment.java
index 137f071..ebad6f9 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/PatchAttachment.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/PatchAttachment.java
@@ -21,18 +21,19 @@ package com.cloud.network.nicira;
*/
public class PatchAttachment extends Attachment {
private final String type = "PatchAttachment";
- private String peer_port_uuid;
+ private String peerPortUuid;
public PatchAttachment(String peerPortUuid) {
- peer_port_uuid = peerPortUuid;
+ this.peerPortUuid = peerPortUuid;
}
public String getPeerPortUuid() {
- return peer_port_uuid;
+ return peerPortUuid;
}
public void setPeerPortUuid(String peerPortUuid) {
- peer_port_uuid = peerPortUuid;
+ this.peerPortUuid = peerPortUuid;
}
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/RouterNextHop.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/RouterNextHop.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/RouterNextHop.java
index a204e55..7622c68 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/RouterNextHop.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/RouterNextHop.java
@@ -20,19 +20,18 @@ package com.cloud.network.nicira;
*
*/
public class RouterNextHop {
- private String gateway_ip_address;
- private String type = "RouterNextHop";
+ private String gatewayIpAddress;
+ private final String type = "RouterNextHop";
public RouterNextHop(String gatewayIpAddress) {
- gateway_ip_address = gatewayIpAddress;
+ this.gatewayIpAddress = gatewayIpAddress;
}
public String getGatewayIpAddress() {
- return gateway_ip_address;
+ return gatewayIpAddress;
}
- public void setGatewayIpAddress(String gateway_ip_address) {
- this.gateway_ip_address = gateway_ip_address;
+ public void setGatewayIpAddress(String gatewayIpAddress) {
+ this.gatewayIpAddress = gatewayIpAddress;
}
-
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SingleDefaultRouteImplictRoutingConfig.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SingleDefaultRouteImplictRoutingConfig.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SingleDefaultRouteImplictRoutingConfig.java
index 1228deb..bbe1cb5 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SingleDefaultRouteImplictRoutingConfig.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SingleDefaultRouteImplictRoutingConfig.java
@@ -20,19 +20,18 @@ package com.cloud.network.nicira;
*
*/
public class SingleDefaultRouteImplictRoutingConfig extends RoutingConfig {
- public RouterNextHop default_route_next_hop;
+ public RouterNextHop defaultRouteNextHop;
public String type = "SingleDefaultRouteImplicitRoutingConfig";
public SingleDefaultRouteImplictRoutingConfig(RouterNextHop routerNextHop) {
- default_route_next_hop = routerNextHop;
+ defaultRouteNextHop = routerNextHop;
}
public RouterNextHop getDefaultRouteNextHop() {
- return default_route_next_hop;
+ return defaultRouteNextHop;
}
- public void setDefaultRouteNextHop(RouterNextHop default_route_next_hop) {
- this.default_route_next_hop = default_route_next_hop;
+ public void setDefaultRouteNextHop(RouterNextHop defaultRouteNextHop) {
+ this.defaultRouteNextHop = defaultRouteNextHop;
}
-
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SourceNatRule.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SourceNatRule.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SourceNatRule.java
index 910f830..db1bdb4 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SourceNatRule.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SourceNatRule.java
@@ -29,7 +29,7 @@ public class SourceNatRule extends NatRule {
return toSourceIpAddressMax;
}
- public void setToSourceIpAddressMax(String toSourceIpAddressMax) {
+ public void setToSourceIpAddressMax(final String toSourceIpAddressMax) {
this.toSourceIpAddressMax = toSourceIpAddressMax;
}
@@ -37,7 +37,7 @@ public class SourceNatRule extends NatRule {
return toSourceIpAddressMin;
}
- public void setToSourceIpAddressMin(String toSourceIpAddressMin) {
+ public void setToSourceIpAddressMin(final String toSourceIpAddressMin) {
this.toSourceIpAddressMin = toSourceIpAddressMin;
}
@@ -45,7 +45,7 @@ public class SourceNatRule extends NatRule {
return toSourcePort;
}
- public void setToSourcePort(Integer toSourcePort) {
+ public void setToSourcePort(final Integer toSourcePort) {
this.toSourcePort = toSourcePort;
}
@@ -67,7 +67,7 @@ public class SourceNatRule extends NatRule {
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
@@ -94,7 +94,7 @@ public class SourceNatRule extends NatRule {
}
@Override
- public boolean equalsIgnoreUuid(Object obj) {
+ public boolean equalsIgnoreUuid(final Object obj) {
if (this == obj)
return true;
if (!super.equalsIgnoreUuid(obj))
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/TransportZoneBinding.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/TransportZoneBinding.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/TransportZoneBinding.java
index 9c5f44d..a5047e0 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/TransportZoneBinding.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/TransportZoneBinding.java
@@ -17,30 +17,30 @@
package com.cloud.network.nicira;
public class TransportZoneBinding {
- private String zone_uuid;
- private String transport_type;
+ private String zoneUuid;
+ private String transportType;
public TransportZoneBinding() {}
- public TransportZoneBinding(String zone_uuid, String transport_type) {
- this.zone_uuid = zone_uuid;
- this.transport_type = transport_type;
+ public TransportZoneBinding(String zoneUuid, String transportType) {
+ this.zoneUuid = zoneUuid;
+ this.transportType = transportType;
}
- public String getZone_uuid() {
- return zone_uuid;
+ public String getZoneUuid() {
+ return zoneUuid;
}
- public void setZone_uuid(String zone_uuid) {
- this.zone_uuid = zone_uuid;
+ public void setZoneUuid(String zoneUuid) {
+ this.zoneUuid = zoneUuid;
}
- public String getTransport_type() {
- return transport_type;
+ public String getTransportType() {
+ return transportType;
}
- public void setTransport_type(String transport_type) {
- this.transport_type = transport_type;
+ public void setTransportType(String transportType) {
+ this.transportType = transportType;
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/VifAttachment.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/VifAttachment.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/VifAttachment.java
index 3a0b5f3..7b37ac1 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/VifAttachment.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/VifAttachment.java
@@ -18,21 +18,21 @@ package com.cloud.network.nicira;
public class VifAttachment extends Attachment {
private final String type = "VifAttachment";
- private String vif_uuid;
+ private String vifUuid;
public VifAttachment() {
}
- public VifAttachment(String vifUuid) {
- vif_uuid = vifUuid;
+ public VifAttachment(final String vifUuid) {
+ this.vifUuid = vifUuid;
}
- public String getVif_uuid() {
- return vif_uuid;
+ public String getVifUuid() {
+ return vifUuid;
}
- public void setVif_uuid(String vif_uuid) {
- this.vif_uuid = vif_uuid;
+ public void setVifUuid(String vifUuid) {
+ this.vifUuid = vifUuid;
}
public String getType() {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/NiciraNvpResource.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/NiciraNvpResource.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/NiciraNvpResource.java
index 3ab5f2b..c04c9ba 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/NiciraNvpResource.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/NiciraNvpResource.java
@@ -82,39 +82,41 @@ import com.cloud.network.nicira.VifAttachment;
import com.cloud.resource.ServerResource;
public class NiciraNvpResource implements ServerResource {
+ private static final int NAME_MAX_LEN = 40;
+
private static final Logger s_logger = Logger.getLogger(NiciraNvpResource.class);
- private String _name;
- private String _guid;
- private String _zoneId;
- private int _numRetries;
+ private String name;
+ private String guid;
+ private String zoneId;
+ private int numRetries;
- private NiciraNvpApi _niciraNvpApi;
+ private NiciraNvpApi niciraNvpApi;
protected NiciraNvpApi createNiciraNvpApi() {
return new NiciraNvpApi();
}
@Override
- public boolean configure(String name, Map<String, Object> params)
+ public boolean configure(String ignoredName, final Map<String, Object> params)
throws ConfigurationException {
- _name = (String) params.get("name");
- if (_name == null) {
+ name = (String) params.get("name");
+ if (name == null) {
throw new ConfigurationException("Unable to find name");
}
- _guid = (String)params.get("guid");
- if (_guid == null) {
+ guid = (String)params.get("guid");
+ if (guid == null) {
throw new ConfigurationException("Unable to find the guid");
}
- _zoneId = (String) params.get("zoneId");
- if (_zoneId == null) {
+ zoneId = (String) params.get("zoneId");
+ if (zoneId == null) {
throw new ConfigurationException("Unable to find zone");
}
- _numRetries = 2;
+ numRetries = 2;
String ip = (String) params.get("ip");
if (ip == null) {
@@ -131,9 +133,9 @@ public class NiciraNvpResource implements ServerResource {
throw new ConfigurationException("Unable to find admin password");
}
- _niciraNvpApi = createNiciraNvpApi();
- _niciraNvpApi.setControllerAddress(ip);
- _niciraNvpApi.setAdminCredentials(adminuser,adminpass);
+ niciraNvpApi = createNiciraNvpApi();
+ niciraNvpApi.setControllerAddress(ip);
+ niciraNvpApi.setAdminCredentials(adminuser,adminpass);
return true;
}
@@ -150,7 +152,7 @@ public class NiciraNvpResource implements ServerResource {
@Override
public String getName() {
- return _name;
+ return name;
}
@Override
@@ -162,9 +164,9 @@ public class NiciraNvpResource implements ServerResource {
@Override
public StartupCommand[] initialize() {
StartupNiciraNvpCommand sc = new StartupNiciraNvpCommand();
- sc.setGuid(_guid);
- sc.setName(_name);
- sc.setDataCenter(_zoneId);
+ sc.setGuid(guid);
+ sc.setName(name);
+ sc.setDataCenter(zoneId);
sc.setPod("");
sc.setPrivateIpAddress("");
sc.setStorageIpAddress("");
@@ -173,9 +175,9 @@ public class NiciraNvpResource implements ServerResource {
}
@Override
- public PingCommand getCurrentStatus(long id) {
+ public PingCommand getCurrentStatus(final long id) {
try {
- ControlClusterStatus ccs = _niciraNvpApi.getControlClusterStatus();
+ ControlClusterStatus ccs = niciraNvpApi.getControlClusterStatus();
if (!"stable".equals(ccs.getClusterStatus())) {
s_logger.error("ControlCluster state is not stable: "
+ ccs.getClusterStatus());
@@ -189,11 +191,11 @@ public class NiciraNvpResource implements ServerResource {
}
@Override
- public Answer executeRequest(Command cmd) {
- return executeRequest(cmd, _numRetries);
+ public Answer executeRequest(final Command cmd) {
+ return executeRequest(cmd, numRetries);
}
- public Answer executeRequest(Command cmd, int numRetries) {
+ public Answer executeRequest(final Command cmd, final int numRetries) {
if (cmd instanceof ReadyCommand) {
return executeRequest((ReadyCommand) cmd);
}
@@ -247,18 +249,18 @@ public class NiciraNvpResource implements ServerResource {
}
@Override
- public void setAgentControl(IAgentControl agentControl) {
+ public void setAgentControl(final IAgentControl agentControl) {
}
- private Answer executeRequest(CreateLogicalSwitchCommand cmd, int numRetries) {
+ private Answer executeRequest(final CreateLogicalSwitchCommand cmd, int numRetries) {
LogicalSwitch logicalSwitch = new LogicalSwitch();
- logicalSwitch.setDisplay_name(truncate("lswitch-" + cmd.getName(), 40));
- logicalSwitch.setPort_isolation_enabled(false);
+ logicalSwitch.setDisplayName(truncate("lswitch-" + cmd.getName(), NAME_MAX_LEN));
+ logicalSwitch.setPortIsolationEnabled(false);
// Set transport binding
List<TransportZoneBinding> ltzb = new ArrayList<TransportZoneBinding>();
ltzb.add(new TransportZoneBinding(cmd.getTransportUuid(), cmd.getTransportType()));
- logicalSwitch.setTransport_zones(ltzb);
+ logicalSwitch.setTransportZones(ltzb);
// Tags set to scope cs_account and account name
List<NiciraNvpTag> tags = new ArrayList<NiciraNvpTag>();
@@ -266,7 +268,7 @@ public class NiciraNvpResource implements ServerResource {
logicalSwitch.setTags(tags);
try {
- logicalSwitch = _niciraNvpApi.createLogicalSwitch(logicalSwitch);
+ logicalSwitch = niciraNvpApi.createLogicalSwitch(logicalSwitch);
return new CreateLogicalSwitchAnswer(cmd, true, "Logicalswitch " + logicalSwitch.getUuid() + " created", logicalSwitch.getUuid());
} catch (NiciraNvpApiException e) {
if (numRetries > 0) {
@@ -279,9 +281,9 @@ public class NiciraNvpResource implements ServerResource {
}
- private Answer executeRequest(DeleteLogicalSwitchCommand cmd, int numRetries) {
+ private Answer executeRequest(final DeleteLogicalSwitchCommand cmd, int numRetries) {
try {
- _niciraNvpApi.deleteLogicalSwitch(cmd.getLogicalSwitchUuid());
+ niciraNvpApi.deleteLogicalSwitch(cmd.getLogicalSwitchUuid());
return new DeleteLogicalSwitchAnswer(cmd, true, "Logicalswitch " + cmd.getLogicalSwitchUuid() + " deleted");
} catch (NiciraNvpApiException e) {
if (numRetries > 0) {
@@ -293,7 +295,7 @@ public class NiciraNvpResource implements ServerResource {
}
}
- private Answer executeRequest(CreateLogicalSwitchPortCommand cmd, int numRetries) {
+ private Answer executeRequest(final CreateLogicalSwitchPortCommand cmd, int numRetries) {
String logicalSwitchUuid = cmd.getLogicalSwitchUuid();
String attachmentUuid = cmd.getAttachmentUuid();
@@ -303,12 +305,12 @@ public class NiciraNvpResource implements ServerResource {
tags.add(new NiciraNvpTag("cs_account",cmd.getOwnerName()));
LogicalSwitchPort logicalSwitchPort = new LogicalSwitchPort(attachmentUuid, tags, true);
- LogicalSwitchPort newPort = _niciraNvpApi.createLogicalSwitchPort(logicalSwitchUuid, logicalSwitchPort);
+ LogicalSwitchPort newPort = niciraNvpApi.createLogicalSwitchPort(logicalSwitchUuid, logicalSwitchPort);
try {
- _niciraNvpApi.modifyLogicalSwitchPortAttachment(cmd.getLogicalSwitchUuid(), newPort.getUuid(), new VifAttachment(attachmentUuid));
+ niciraNvpApi.modifyLogicalSwitchPortAttachment(cmd.getLogicalSwitchUuid(), newPort.getUuid(), new VifAttachment(attachmentUuid));
} catch (NiciraNvpApiException ex) {
s_logger.warn("modifyLogicalSwitchPort failed after switchport was created, removing switchport");
- _niciraNvpApi.deleteLogicalSwitchPort(cmd.getLogicalSwitchUuid(), newPort.getUuid());
+ niciraNvpApi.deleteLogicalSwitchPort(cmd.getLogicalSwitchUuid(), newPort.getUuid());
throw (ex); // Rethrow the original exception
}
return new CreateLogicalSwitchPortAnswer(cmd, true, "Logical switch port " + newPort.getUuid() + " created", newPort.getUuid());
@@ -323,9 +325,9 @@ public class NiciraNvpResource implements ServerResource {
}
- private Answer executeRequest(DeleteLogicalSwitchPortCommand cmd, int numRetries) {
+ private Answer executeRequest(final DeleteLogicalSwitchPortCommand cmd, int numRetries) {
try {
- _niciraNvpApi.deleteLogicalSwitchPort(cmd.getLogicalSwitchUuid(), cmd.getLogicalSwitchPortUuid());
+ niciraNvpApi.deleteLogicalSwitchPort(cmd.getLogicalSwitchUuid(), cmd.getLogicalSwitchPortUuid());
return new DeleteLogicalSwitchPortAnswer(cmd, true, "Logical switch port " + cmd.getLogicalSwitchPortUuid() + " deleted");
} catch (NiciraNvpApiException e) {
if (numRetries > 0) {
@@ -337,7 +339,7 @@ public class NiciraNvpResource implements ServerResource {
}
}
- private Answer executeRequest(UpdateLogicalSwitchPortCommand cmd, int numRetries) {
+ private Answer executeRequest(final UpdateLogicalSwitchPortCommand cmd, int numRetries) {
String logicalSwitchUuid = cmd.getLogicalSwitchUuid();
String logicalSwitchPortUuid = cmd.getLogicalSwitchPortUuid();
String attachmentUuid = cmd.getAttachmentUuid();
@@ -347,7 +349,7 @@ public class NiciraNvpResource implements ServerResource {
List<NiciraNvpTag> tags = new ArrayList<NiciraNvpTag>();
tags.add(new NiciraNvpTag("cs_account",cmd.getOwnerName()));
- _niciraNvpApi.modifyLogicalSwitchPortAttachment(logicalSwitchUuid, logicalSwitchPortUuid, new VifAttachment(attachmentUuid));
+ niciraNvpApi.modifyLogicalSwitchPortAttachment(logicalSwitchUuid, logicalSwitchPortUuid, new VifAttachment(attachmentUuid));
return new UpdateLogicalSwitchPortAnswer(cmd, true, "Attachment for " + logicalSwitchPortUuid + " updated", logicalSwitchPortUuid);
} catch (NiciraNvpApiException e) {
if (numRetries > 0) {
@@ -360,12 +362,12 @@ public class NiciraNvpResource implements ServerResource {
}
- private Answer executeRequest(FindLogicalSwitchPortCommand cmd, int numRetries) {
+ private Answer executeRequest(final FindLogicalSwitchPortCommand cmd, int numRetries) {
String logicalSwitchUuid = cmd.getLogicalSwitchUuid();
String logicalSwitchPortUuid = cmd.getLogicalSwitchPortUuid();
try {
- NiciraNvpList<LogicalSwitchPort> ports = _niciraNvpApi.findLogicalSwitchPortsByUuid(logicalSwitchUuid, logicalSwitchPortUuid);
+ NiciraNvpList<LogicalSwitchPort> ports = niciraNvpApi.findLogicalSwitchPortsByUuid(logicalSwitchUuid, logicalSwitchPortUuid);
if (ports.getResultCount() == 0) {
return new FindLogicalSwitchPortAnswer(cmd, false, "Logical switchport " + logicalSwitchPortUuid + " not found", null);
}
@@ -382,7 +384,7 @@ public class NiciraNvpResource implements ServerResource {
}
}
- private Answer executeRequest(CreateLogicalRouterCommand cmd, int numRetries) {
+ private Answer executeRequest(final CreateLogicalRouterCommand cmd, int numRetries) {
String routerName = cmd.getName();
String gatewayServiceUuid = cmd.getGatewayServiceUuid();
String logicalSwitchUuid = cmd.getLogicalSwitchUuid();
@@ -401,11 +403,11 @@ public class NiciraNvpResource implements ServerResource {
try {
// Create the Router
LogicalRouterConfig lrc = new LogicalRouterConfig();
- lrc.setDisplayName(truncate(routerName, 40));
+ lrc.setDisplayName(truncate(routerName, NAME_MAX_LEN));
lrc.setTags(tags);
lrc.setRoutingConfig(new SingleDefaultRouteImplictRoutingConfig(
new RouterNextHop(publicNetworkNextHopIp)));
- lrc = _niciraNvpApi.createLogicalRouter(lrc);
+ lrc = niciraNvpApi.createLogicalRouter(lrc);
// store the switchport for rollback
LogicalSwitchPort lsp = null;
@@ -414,40 +416,40 @@ public class NiciraNvpResource implements ServerResource {
// Create the outside port for the router
LogicalRouterPort lrpo = new LogicalRouterPort();
lrpo.setAdminStatusEnabled(true);
- lrpo.setDisplayName(truncate(routerName + "-outside-port", 40));
+ lrpo.setDisplayName(truncate(routerName + "-outside-port", NAME_MAX_LEN));
lrpo.setTags(tags);
List<String> outsideIpAddresses = new ArrayList<String>();
outsideIpAddresses.add(publicNetworkIpAddress);
lrpo.setIpAddresses(outsideIpAddresses);
- lrpo = _niciraNvpApi.createLogicalRouterPort(lrc.getUuid(),lrpo);
+ lrpo = niciraNvpApi.createLogicalRouterPort(lrc.getUuid(),lrpo);
// Attach the outside port to the gateway service on the correct VLAN
L3GatewayAttachment attachment = new L3GatewayAttachment(gatewayServiceUuid);
if (cmd.getVlanId() != 0) {
attachment.setVlanId(cmd.getVlanId());
}
- _niciraNvpApi.modifyLogicalRouterPortAttachment(lrc.getUuid(), lrpo.getUuid(), attachment);
+ niciraNvpApi.modifyLogicalRouterPortAttachment(lrc.getUuid(), lrpo.getUuid(), attachment);
// Create the inside port for the router
LogicalRouterPort lrpi = new LogicalRouterPort();
lrpi.setAdminStatusEnabled(true);
- lrpi.setDisplayName(truncate(routerName + "-inside-port", 40));
+ lrpi.setDisplayName(truncate(routerName + "-inside-port", NAME_MAX_LEN));
lrpi.setTags(tags);
List<String> insideIpAddresses = new ArrayList<String>();
insideIpAddresses.add(internalNetworkAddress);
lrpi.setIpAddresses(insideIpAddresses);
- lrpi = _niciraNvpApi.createLogicalRouterPort(lrc.getUuid(),lrpi);
+ lrpi = niciraNvpApi.createLogicalRouterPort(lrc.getUuid(),lrpi);
// Create the inside port on the lswitch
- lsp = new LogicalSwitchPort(truncate(routerName + "-inside-port", 40), tags, true);
- lsp = _niciraNvpApi.createLogicalSwitchPort(logicalSwitchUuid, lsp);
+ lsp = new LogicalSwitchPort(truncate(routerName + "-inside-port", NAME_MAX_LEN), tags, true);
+ lsp = niciraNvpApi.createLogicalSwitchPort(logicalSwitchUuid, lsp);
// Attach the inside router port to the lswitch port with a PatchAttachment
- _niciraNvpApi.modifyLogicalRouterPortAttachment(lrc.getUuid(), lrpi.getUuid(),
+ niciraNvpApi.modifyLogicalRouterPortAttachment(lrc.getUuid(), lrpi.getUuid(),
new PatchAttachment(lsp.getUuid()));
// Attach the inside lswitch port to the router with a PatchAttachment
- _niciraNvpApi.modifyLogicalSwitchPortAttachment(logicalSwitchUuid, lsp.getUuid(),
+ niciraNvpApi.modifyLogicalSwitchPortAttachment(logicalSwitchUuid, lsp.getUuid(),
new PatchAttachment(lrpi.getUuid()));
// Setup the source nat rule
@@ -458,14 +460,14 @@ public class NiciraNvpResource implements ServerResource {
match.setSourceIpAddresses(internalNetworkAddress);
snr.setMatch(match);
snr.setOrder(200);
- _niciraNvpApi.createLogicalRouterNatRule(lrc.getUuid(), snr);
+ niciraNvpApi.createLogicalRouterNatRule(lrc.getUuid(), snr);
} catch (NiciraNvpApiException e) {
// We need to destroy the router if we already created it
// this will also take care of any router ports and rules
try {
- _niciraNvpApi.deleteLogicalRouter(lrc.getUuid());
+ niciraNvpApi.deleteLogicalRouter(lrc.getUuid());
if (lsp != null) {
- _niciraNvpApi.deleteLogicalSwitchPort(logicalSwitchUuid, lsp.getUuid());
+ niciraNvpApi.deleteLogicalSwitchPort(logicalSwitchUuid, lsp.getUuid());
}
} catch (NiciraNvpApiException ex) {}
@@ -483,9 +485,9 @@ public class NiciraNvpResource implements ServerResource {
}
}
- private Answer executeRequest(DeleteLogicalRouterCommand cmd, int numRetries) {
+ private Answer executeRequest(final DeleteLogicalRouterCommand cmd, int numRetries) {
try {
- _niciraNvpApi.deleteLogicalRouter(cmd.getLogicalRouterUuid());
+ niciraNvpApi.deleteLogicalRouter(cmd.getLogicalRouterUuid());
return new DeleteLogicalRouterAnswer(cmd, true, "Logical Router deleted (uuid " + cmd.getLogicalRouterUuid() + ")");
} catch (NiciraNvpApiException e) {
if (numRetries > 0) {
@@ -497,15 +499,15 @@ public class NiciraNvpResource implements ServerResource {
}
}
- private Answer executeRequest(ConfigurePublicIpsOnLogicalRouterCommand cmd, int numRetries) {
+ private Answer executeRequest(final ConfigurePublicIpsOnLogicalRouterCommand cmd, int numRetries) {
try {
- NiciraNvpList<LogicalRouterPort> ports = _niciraNvpApi.findLogicalRouterPortByGatewayServiceUuid(cmd.getLogicalRouterUuid(), cmd.getL3GatewayServiceUuid());
+ NiciraNvpList<LogicalRouterPort> ports = niciraNvpApi.findLogicalRouterPortByGatewayServiceUuid(cmd.getLogicalRouterUuid(), cmd.getL3GatewayServiceUuid());
if (ports.getResultCount() != 1) {
return new ConfigurePublicIpsOnLogicalRouterAnswer(cmd, false, "No logical router ports found, unable to set ip addresses");
}
LogicalRouterPort lrp = ports.getResults().get(0);
lrp.setIpAddresses(cmd.getPublicCidrs());
- _niciraNvpApi.modifyLogicalRouterPort(cmd.getLogicalRouterUuid(), lrp);
+ niciraNvpApi.modifyLogicalRouterPort(cmd.getLogicalRouterUuid(), lrp);
return new ConfigurePublicIpsOnLogicalRouterAnswer(cmd, true, "Configured " + cmd.getPublicCidrs().size() +
" ip addresses on logical router uuid " + cmd.getLogicalRouterUuid());
@@ -520,9 +522,9 @@ public class NiciraNvpResource implements ServerResource {
}
- private Answer executeRequest(ConfigureStaticNatRulesOnLogicalRouterCommand cmd, int numRetries) {
+ private Answer executeRequest(final ConfigureStaticNatRulesOnLogicalRouterCommand cmd, int numRetries) {
try {
- NiciraNvpList<NatRule> existingRules = _niciraNvpApi.findNatRulesByLogicalRouterUuid(cmd.getLogicalRouterUuid());
+ NiciraNvpList<NatRule> existingRules = niciraNvpApi.findNatRulesByLogicalRouterUuid(cmd.getLogicalRouterUuid());
// Rules of the game (also known as assumptions-that-will-make-stuff-break-later-on)
// A SourceNat rule with a match other than a /32 cidr is assumed to be the "main" SourceNat rule
// Any other SourceNat rule should have a corresponding DestinationNat rule
@@ -555,10 +557,10 @@ public class NiciraNvpResource implements ServerResource {
if (incoming != null && outgoing != null) {
if (rule.revoked()) {
s_logger.debug("Deleting incoming rule " + incoming.getUuid());
- _niciraNvpApi.deleteLogicalRouterNatRule(cmd.getLogicalRouterUuid(), incoming.getUuid());
+ niciraNvpApi.deleteLogicalRouterNatRule(cmd.getLogicalRouterUuid(), incoming.getUuid());
s_logger.debug("Deleting outgoing rule " + outgoing.getUuid());
- _niciraNvpApi.deleteLogicalRouterNatRule(cmd.getLogicalRouterUuid(), outgoing.getUuid());
+ niciraNvpApi.deleteLogicalRouterNatRule(cmd.getLogicalRouterUuid(), outgoing.getUuid());
}
}
else {
@@ -568,15 +570,15 @@ public class NiciraNvpResource implements ServerResource {
break;
}
- rulepair[0] = _niciraNvpApi.createLogicalRouterNatRule(cmd.getLogicalRouterUuid(), rulepair[0]);
+ rulepair[0] = niciraNvpApi.createLogicalRouterNatRule(cmd.getLogicalRouterUuid(), rulepair[0]);
s_logger.debug("Created " + natRuleToString(rulepair[0]));
try {
- rulepair[1] = _niciraNvpApi.createLogicalRouterNatRule(cmd.getLogicalRouterUuid(), rulepair[1]);
+ rulepair[1] = niciraNvpApi.createLogicalRouterNatRule(cmd.getLogicalRouterUuid(), rulepair[1]);
s_logger.debug("Created " + natRuleToString(rulepair[1]));
} catch (NiciraNvpApiException ex) {
s_logger.debug("Failed to create SourceNatRule, rolling back DestinationNatRule");
- _niciraNvpApi.deleteLogicalRouterNatRule(cmd.getLogicalRouterUuid(), rulepair[0].getUuid());
+ niciraNvpApi.deleteLogicalRouterNatRule(cmd.getLogicalRouterUuid(), rulepair[0].getUuid());
throw ex; // Rethrow original exception
}
@@ -593,9 +595,9 @@ public class NiciraNvpResource implements ServerResource {
}
}
- private Answer executeRequest(ConfigurePortForwardingRulesOnLogicalRouterCommand cmd, int numRetries) {
+ private Answer executeRequest(final ConfigurePortForwardingRulesOnLogicalRouterCommand cmd, int numRetries) {
try {
- NiciraNvpList<NatRule> existingRules = _niciraNvpApi.findNatRulesByLogicalRouterUuid(cmd.getLogicalRouterUuid());
+ NiciraNvpList<NatRule> existingRules = niciraNvpApi.findNatRulesByLogicalRouterUuid(cmd.getLogicalRouterUuid());
// Rules of the game (also known as assumptions-that-will-make-stuff-break-later-on)
// A SourceNat rule with a match other than a /32 cidr is assumed to be the "main" SourceNat rule
// Any other SourceNat rule should have a corresponding DestinationNat rule
@@ -637,10 +639,10 @@ public class NiciraNvpResource implements ServerResource {
if (incoming != null && outgoing != null) {
if (rule.revoked()) {
s_logger.debug("Deleting incoming rule " + incoming.getUuid());
- _niciraNvpApi.deleteLogicalRouterNatRule(cmd.getLogicalRouterUuid(), incoming.getUuid());
+ niciraNvpApi.deleteLogicalRouterNatRule(cmd.getLogicalRouterUuid(), incoming.getUuid());
s_logger.debug("Deleting outgoing rule " + outgoing.getUuid());
- _niciraNvpApi.deleteLogicalRouterNatRule(cmd.getLogicalRouterUuid(), outgoing.getUuid());
+ niciraNvpApi.deleteLogicalRouterNatRule(cmd.getLogicalRouterUuid(), outgoing.getUuid());
}
}
else {
@@ -650,15 +652,15 @@ public class NiciraNvpResource implements ServerResource {
break;
}
- rulepair[0] = _niciraNvpApi.createLogicalRouterNatRule(cmd.getLogicalRouterUuid(), rulepair[0]);
+ rulepair[0] = niciraNvpApi.createLogicalRouterNatRule(cmd.getLogicalRouterUuid(), rulepair[0]);
s_logger.debug("Created " + natRuleToString(rulepair[0]));
try {
- rulepair[1] = _niciraNvpApi.createLogicalRouterNatRule(cmd.getLogicalRouterUuid(), rulepair[1]);
+ rulepair[1] = niciraNvpApi.createLogicalRouterNatRule(cmd.getLogicalRouterUuid(), rulepair[1]);
s_logger.debug("Created " + natRuleToString(rulepair[1]));
} catch (NiciraNvpApiException ex) {
s_logger.warn("NiciraNvpApiException during create call, rolling back previous create");
- _niciraNvpApi.deleteLogicalRouterNatRule(cmd.getLogicalRouterUuid(), rulepair[0].getUuid());
+ niciraNvpApi.deleteLogicalRouterNatRule(cmd.getLogicalRouterUuid(), rulepair[0].getUuid());
throw ex; // Rethrow the original exception
}
@@ -676,20 +678,20 @@ public class NiciraNvpResource implements ServerResource {
}
- private Answer executeRequest(ReadyCommand cmd) {
+ private Answer executeRequest(final ReadyCommand cmd) {
return new ReadyAnswer(cmd);
}
- private Answer executeRequest(MaintainCommand cmd) {
+ private Answer executeRequest(final MaintainCommand cmd) {
return new MaintainAnswer(cmd);
}
- private Answer retry(Command cmd, int numRetries) {
+ private Answer retry(final Command cmd, final int numRetries) {
s_logger.warn("Retrying " + cmd.getClass().getSimpleName() + ". Number of retries remaining: " + numRetries);
return executeRequest(cmd, numRetries);
}
- private String natRuleToString(NatRule rule) {
+ private String natRuleToString(final NatRule rule) {
StringBuilder natRuleStr = new StringBuilder();
natRuleStr.append("Rule ");
@@ -726,7 +728,7 @@ public class NiciraNvpResource implements ServerResource {
return natRuleStr.toString();
}
- private String truncate(String string, int length) {
+ private String truncate(final String string, final int length) {
if (string.length() <= length) {
return string;
}
@@ -735,7 +737,7 @@ public class NiciraNvpResource implements ServerResource {
}
}
- protected NatRule[] generateStaticNatRulePair(String insideIp, String outsideIp) {
+ protected NatRule[] generateStaticNatRulePair(final String insideIp, final String outsideIp) {
NatRule[] rulepair = new NatRule[2];
rulepair[0] = new DestinationNatRule();
rulepair[0].setType("DestinationNatRule");
@@ -760,8 +762,9 @@ public class NiciraNvpResource implements ServerResource {
}
- protected NatRule[] generatePortForwardingRulePair(String insideIp, int[] insidePorts, String outsideIp, int[] outsidePorts, String protocol) {
- // Start with a basic static nat rule, then add port and protocol details
+ protected NatRule[] generatePortForwardingRulePair(final String insideIp, final int[] insidePorts,
+ final String outsideIp, final int[] outsidePorts, final String protocol) {
+ // Start with a basic static nat rule, then add port and protocol details
NatRule[] rulepair = generateStaticNatRulePair(insideIp, outsideIp);
((DestinationNatRule)rulepair[0]).setToDestinationPort(insidePorts[0]);
@@ -791,15 +794,13 @@ public class NiciraNvpResource implements ServerResource {
}
@Override
- public void setName(String name) {
+ public void setName(final String name) {
// TODO Auto-generated method stub
-
}
@Override
- public void setConfigParams(Map<String, Object> params) {
+ public void setConfigParams(final Map<String, Object> params) {
// TODO Auto-generated method stub
-
}
@Override
@@ -815,9 +816,8 @@ public class NiciraNvpResource implements ServerResource {
}
@Override
- public void setRunLevel(int level) {
+ public void setRunLevel(final int level) {
// TODO Auto-generated method stub
-
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.java
index 9202241..97f5f2f 100644
--- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.java
+++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.java
@@ -72,59 +72,60 @@ import com.cloud.vm.ReservationContext;
public class NiciraNvpElementTest {
- NiciraNvpElement _element = new NiciraNvpElement();
- NetworkOrchestrationService _networkManager = mock(NetworkOrchestrationService.class);
- NetworkModel _networkModel = mock(NetworkModel.class);
- NetworkServiceMapDao _ntwkSrvcDao = mock(NetworkServiceMapDao.class);
- AgentManager _agentManager = mock(AgentManager.class);
- HostDao _hostDao = mock(HostDao.class);
- NiciraNvpDao _niciraNvpDao = mock(NiciraNvpDao.class);
- NiciraNvpRouterMappingDao _niciraNvpRouterMappingDao = mock(NiciraNvpRouterMappingDao.class);
+ private static final long NETWORK_ID = 42L;
+ NiciraNvpElement element = new NiciraNvpElement();
+ NetworkOrchestrationService networkManager = mock(NetworkOrchestrationService.class);
+ NetworkModel networkModel = mock(NetworkModel.class);
+ NetworkServiceMapDao ntwkSrvcDao = mock(NetworkServiceMapDao.class);
+ AgentManager agentManager = mock(AgentManager.class);
+ HostDao hostDao = mock(HostDao.class);
+ NiciraNvpDao niciraNvpDao = mock(NiciraNvpDao.class);
+ NiciraNvpRouterMappingDao niciraNvpRouterMappingDao = mock(NiciraNvpRouterMappingDao.class);
@Before
public void setUp() throws ConfigurationException {
- _element._resourceMgr = mock(ResourceManager.class);
- _element._networkManager = _networkManager;
- _element._ntwkSrvcDao = _ntwkSrvcDao;
- _element._networkModel = _networkModel;
- _element._agentMgr = _agentManager;
- _element._hostDao = _hostDao;
- _element._niciraNvpDao = _niciraNvpDao;
- _element._niciraNvpRouterMappingDao = _niciraNvpRouterMappingDao;
+ element.resourceMgr = mock(ResourceManager.class);
+ element.networkManager = networkManager;
+ element.ntwkSrvcDao = ntwkSrvcDao;
+ element.networkModel = networkModel;
+ element.agentMgr = agentManager;
+ element.hostDao = hostDao;
+ element.niciraNvpDao = niciraNvpDao;
+ element.niciraNvpRouterMappingDao = niciraNvpRouterMappingDao;
// Standard responses
- when(_networkModel.isProviderForNetwork(Provider.NiciraNvp, 42L)).thenReturn(true);
+ when(networkModel.isProviderForNetwork(Provider.NiciraNvp, NETWORK_ID)).thenReturn(true);
- _element.configure("NiciraNvpTestElement", Collections.<String, Object> emptyMap());
+ element.configure("NiciraNvpTestElement", Collections.<String, Object> emptyMap());
}
@Test
public void canHandleTest() {
Network net = mock(Network.class);
when(net.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Lswitch);
- when(net.getId()).thenReturn(42L);
+ when(net.getId()).thenReturn(NETWORK_ID);
- when(_ntwkSrvcDao.canProviderSupportServiceInNetwork(42L, Service.Connectivity, Provider.NiciraNvp)).thenReturn(true);
+ when(ntwkSrvcDao.canProviderSupportServiceInNetwork(NETWORK_ID, Service.Connectivity, Provider.NiciraNvp)).thenReturn(true);
// Golden path
- assertTrue(_element.canHandle(net, Service.Connectivity));
+ assertTrue(element.canHandle(net, Service.Connectivity));
when(net.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Vlan);
// Only broadcastdomaintype lswitch is supported
- assertFalse(_element.canHandle(net, Service.Connectivity));
+ assertFalse(element.canHandle(net, Service.Connectivity));
when(net.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Lswitch);
- when(_ntwkSrvcDao.canProviderSupportServiceInNetwork(42L, Service.Connectivity, Provider.NiciraNvp)).thenReturn(false);
+ when(ntwkSrvcDao.canProviderSupportServiceInNetwork(NETWORK_ID, Service.Connectivity, Provider.NiciraNvp)).thenReturn(false);
// No nvp provider in the network
- assertFalse(_element.canHandle(net, Service.Connectivity));
+ assertFalse(element.canHandle(net, Service.Connectivity));
- when(_networkModel.isProviderForNetwork(Provider.NiciraNvp, 42L)).thenReturn(false);
- when(_ntwkSrvcDao.canProviderSupportServiceInNetwork(42L, Service.Connectivity, Provider.NiciraNvp)).thenReturn(true);
+ when(networkModel.isProviderForNetwork(Provider.NiciraNvp, NETWORK_ID)).thenReturn(false);
+ when(ntwkSrvcDao.canProviderSupportServiceInNetwork(NETWORK_ID, Service.Connectivity, Provider.NiciraNvp)).thenReturn(true);
// NVP provider does not provide Connectivity for this network
- assertFalse(_element.canHandle(net, Service.Connectivity));
+ assertFalse(element.canHandle(net, Service.Connectivity));
- when(_networkModel.isProviderForNetwork(Provider.NiciraNvp, 42L)).thenReturn(true);
+ when(networkModel.isProviderForNetwork(Provider.NiciraNvp, NETWORK_ID)).thenReturn(true);
// Only service Connectivity is supported
- assertFalse(_element.canHandle(net, Service.Dhcp));
+ assertFalse(element.canHandle(net, Service.Dhcp));
}
@@ -132,10 +133,10 @@ public class NiciraNvpElementTest {
public void implementTest() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
Network network = mock(Network.class);
when(network.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Lswitch);
- when(network.getId()).thenReturn(42L);
+ when(network.getId()).thenReturn(NETWORK_ID);
NetworkOffering offering = mock(NetworkOffering.class);
- when(offering.getId()).thenReturn(42L);
+ when(offering.getId()).thenReturn(NETWORK_ID);
when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
when(offering.getGuestType()).thenReturn(GuestType.Isolated);
@@ -148,19 +149,17 @@ public class NiciraNvpElementTest {
ReservationContext context = mock(ReservationContext.class);
when(context.getDomain()).thenReturn(dom);
when(context.getAccount()).thenReturn(acc);
-
- // assertTrue(_element.implement(network, offering, dest, context));
}
@Test
public void applyIpTest() throws ResourceUnavailableException {
Network network = mock(Network.class);
when(network.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Lswitch);
- when(network.getId()).thenReturn(42L);
- when(network.getPhysicalNetworkId()).thenReturn(42L);
+ when(network.getId()).thenReturn(NETWORK_ID);
+ when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID);
NetworkOffering offering = mock(NetworkOffering.class);
- when(offering.getId()).thenReturn(42L);
+ when(offering.getId()).thenReturn(NETWORK_ID);
when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
when(offering.getGuestType()).thenReturn(GuestType.Isolated);
@@ -186,23 +185,23 @@ public class NiciraNvpElementTest {
List<NiciraNvpDeviceVO> deviceList = new ArrayList<NiciraNvpDeviceVO>();
NiciraNvpDeviceVO nndVO = mock(NiciraNvpDeviceVO.class);
NiciraNvpRouterMappingVO nnrmVO = mock(NiciraNvpRouterMappingVO.class);
- when(_niciraNvpRouterMappingDao.findByNetworkId(42L)).thenReturn(nnrmVO);
+ when(niciraNvpRouterMappingDao.findByNetworkId(NETWORK_ID)).thenReturn(nnrmVO);
when(nnrmVO.getLogicalRouterUuid()).thenReturn("abcde");
- when(nndVO.getHostId()).thenReturn(42L);
+ when(nndVO.getHostId()).thenReturn(NETWORK_ID);
HostVO hvo = mock(HostVO.class);
- when(hvo.getId()).thenReturn(42L);
+ when(hvo.getId()).thenReturn(NETWORK_ID);
when(hvo.getDetail("l3gatewayserviceuuid")).thenReturn("abcde");
- when(_hostDao.findById(42L)).thenReturn(hvo);
+ when(hostDao.findById(NETWORK_ID)).thenReturn(hvo);
deviceList.add(nndVO);
- when(_niciraNvpDao.listByPhysicalNetwork(42L)).thenReturn(deviceList);
+ when(niciraNvpDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(deviceList);
ConfigurePublicIpsOnLogicalRouterAnswer answer = mock(ConfigurePublicIpsOnLogicalRouterAnswer.class);
when(answer.getResult()).thenReturn(true);
- when(_agentManager.easySend(eq(42L), any(ConfigurePublicIpsOnLogicalRouterCommand.class))).thenReturn(answer);
+ when(agentManager.easySend(eq(NETWORK_ID), any(ConfigurePublicIpsOnLogicalRouterCommand.class))).thenReturn(answer);
- assertTrue(_element.applyIps(network, ipAddresses, services));
+ assertTrue(element.applyIps(network, ipAddresses, services));
- verify(_agentManager, atLeast(1)).easySend(eq(42L),
+ verify(agentManager, atLeast(1)).easySend(eq(NETWORK_ID),
argThat(new ArgumentMatcher<ConfigurePublicIpsOnLogicalRouterCommand>() {
@Override
public boolean matches(Object argument) {
[29/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
Added one more log file location to .gitignore
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7791d630
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7791d630
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7791d630
Branch: refs/heads/disk-cache
Commit: 7791d630775c8401feff6af5230aba70b84eb148
Parents: 0b8cc97
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Fri Nov 15 09:33:05 2013 -0800
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Fri Nov 15 09:33:05 2013 -0800
----------------------------------------------------------------------
.gitignore | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7791d630/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 8e3b052..dab1b3f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -85,3 +85,4 @@ configure-stamp
engine/storage/integration-test/test-output
tools/apidoc/log/
log/
+plugins/network-elements/juniper-contrail/logs/
[06/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
remove duplicated scheduled tasks from VpcVirtualNetworkApplianceManagerImpl
(cherry picked from commit e444a03819ccf72f61cb04e8428d20cc65b145e1)
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/59453ea6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/59453ea6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/59453ea6
Branch: refs/heads/disk-cache
Commit: 59453ea6be45193a0c141f22d1daa510d627500d
Parents: 67fc2f5
Author: Wei Zhou <w....@leaseweb.com>
Authored: Thu Nov 14 16:51:28 2013 +0100
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Thu Nov 14 19:00:24 2013 +0100
----------------------------------------------------------------------
.../router/VpcVirtualNetworkApplianceManagerImpl.java | 10 ++++++++++
1 file changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/59453ea6/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
index ecfce57..1396e42 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -1361,6 +1361,16 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
public List<DomainRouterVO> getVpcRouters(long vpcId) {
return _routerDao.listByVpcId(vpcId);
}
+
+ @Override
+ public boolean start() {
+ return true;
+ }
+
+ @Override
+ public boolean stop() {
+ return true;
+ }
@Override
public String[] applyVpnUsers(RemoteAccessVpn vpn, List<? extends VpnUser> users, VirtualRouter router) throws ResourceUnavailableException {
[42/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
Checkstyle adjustments in code and configuration
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/876b7e49
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/876b7e49
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/876b7e49
Branch: refs/heads/disk-cache
Commit: 876b7e492f15154591ba132ddbfe6a8e7a4c4c3f
Parents: 709b70c
Author: afornie <af...@schubergphilis.com>
Authored: Mon Nov 18 12:12:07 2013 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Nov 18 19:22:42 2013 +0100
----------------------------------------------------------------------
.../src/main/resources/tooling/checkstyle.xml | 24 +-
plugins/network-elements/nicira-nvp/pom.xml | 2 +-
...ortForwardingRulesOnLogicalRouterAnswer.java | 9 +-
...rtForwardingRulesOnLogicalRouterCommand.java | 9 +-
...ConfigurePublicIpsOnLogicalRouterAnswer.java | 6 +-
...onfigurePublicIpsOnLogicalRouterCommand.java | 9 +-
...gureStaticNatRulesOnLogicalRouterAnswer.java | 6 +-
...ureStaticNatRulesOnLogicalRouterCommand.java | 10 +-
.../agent/api/CreateLogicalRouterAnswer.java | 12 +-
.../agent/api/CreateLogicalRouterCommand.java | 90 +++---
.../agent/api/CreateLogicalSwitchAnswer.java | 12 +-
.../agent/api/CreateLogicalSwitchCommand.java | 29 +-
.../api/CreateLogicalSwitchPortAnswer.java | 12 +-
.../api/CreateLogicalSwitchPortCommand.java | 29 +-
.../agent/api/DeleteLogicalRouterAnswer.java | 6 +-
.../agent/api/DeleteLogicalRouterCommand.java | 9 +-
.../agent/api/DeleteLogicalSwitchAnswer.java | 6 +-
.../agent/api/DeleteLogicalSwitchCommand.java | 8 +-
.../api/DeleteLogicalSwitchPortAnswer.java | 6 +-
.../api/DeleteLogicalSwitchPortCommand.java | 14 +-
.../agent/api/FindLogicalSwitchPortAnswer.java | 12 +-
.../agent/api/FindLogicalSwitchPortCommand.java | 12 +-
.../api/UpdateLogicalSwitchPortAnswer.java | 6 +-
.../api/UpdateLogicalSwitchPortCommand.java | 33 +-
.../api/commands/AddNiciraNvpDeviceCmd.java | 16 +-
.../api/commands/DeleteNiciraNvpDeviceCmd.java | 11 +-
.../ListNiciraNvpDeviceNetworksCmd.java | 10 +-
.../api/commands/ListNiciraNvpDevicesCmd.java | 20 +-
.../api/response/NiciraNvpDeviceResponse.java | 22 +-
.../com/cloud/network/NiciraNvpDeviceVO.java | 4 +-
.../cloud/network/NiciraNvpNicMappingVO.java | 6 +-
.../cloud/network/NiciraNvpRouterMappingVO.java | 11 +-
.../com/cloud/network/dao/NiciraNvpDaoImpl.java | 4 +-
.../network/dao/NiciraNvpNicMappingDao.java | 9 +-
.../network/dao/NiciraNvpNicMappingDaoImpl.java | 4 +-
.../dao/NiciraNvpRouterMappingDaoImpl.java | 3 +-
.../cloud/network/element/NiciraNvpElement.java | 210 ++++++------
.../network/guru/NiciraNvpGuestNetworkGuru.java | 75 +++--
.../network/nicira/ControlClusterStatus.java | 50 ++-
.../network/nicira/DestinationNatRule.java | 49 ++-
.../network/nicira/L3GatewayAttachment.java | 28 +-
.../network/nicira/LogicalRouterConfig.java | 19 +-
.../cloud/network/nicira/LogicalRouterPort.java | 34 +-
.../com/cloud/network/nicira/LogicalSwitch.java | 53 ++-
.../cloud/network/nicira/LogicalSwitchPort.java | 59 ++--
.../src/com/cloud/network/nicira/Match.java | 106 +++---
.../src/com/cloud/network/nicira/NatRule.java | 14 +-
.../com/cloud/network/nicira/NiciraNvpApi.java | 298 ++++++++---------
.../network/nicira/NiciraNvpApiException.java | 6 +-
.../com/cloud/network/nicira/NiciraNvpList.java | 12 +-
.../com/cloud/network/nicira/NiciraNvpTag.java | 3 +-
.../cloud/network/nicira/PatchAttachment.java | 9 +-
.../com/cloud/network/nicira/RouterNextHop.java | 13 +-
.../SingleDefaultRouteImplictRoutingConfig.java | 11 +-
.../com/cloud/network/nicira/SourceNatRule.java | 10 +-
.../network/nicira/TransportZoneBinding.java | 26 +-
.../com/cloud/network/nicira/VifAttachment.java | 14 +-
.../network/resource/NiciraNvpResource.java | 182 +++++------
.../network/element/NiciraNvpElementTest.java | 87 +++--
.../guru/NiciraNvpGuestNetworkGuruTest.java | 125 ++++----
.../cloud/network/nicira/NiciraNvpApiTest.java | 210 ++++++------
.../com/cloud/network/nicira/NiciraTagTest.java | 2 +-
.../network/resource/NiciraNvpResourceTest.java | 319 +++++++++----------
63 files changed, 1289 insertions(+), 1226 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/parents/checkstyle/src/main/resources/tooling/checkstyle.xml
----------------------------------------------------------------------
diff --git a/parents/checkstyle/src/main/resources/tooling/checkstyle.xml b/parents/checkstyle/src/main/resources/tooling/checkstyle.xml
index a8e8deb..289ad67 100644
--- a/parents/checkstyle/src/main/resources/tooling/checkstyle.xml
+++ b/parents/checkstyle/src/main/resources/tooling/checkstyle.xml
@@ -26,14 +26,28 @@
<property name="eachLine" value="true"/>
</module>
+ <module name="TreeWalker">
+ <module name="LineLength">
+ <property name="max" value="180"/>
+ </module>
+
+ <module name="RedundantImport"/>
+ <module name="UnusedImports"/>
+
+ <module name="PackageName"/>
+ <module name="ParameterName"/>
+ <module name="TypeName"/>
+ <module name="AvoidStarImport"/>
+ </module>
<module name="RegexpSingleline">
- <!-- \s matches whitespace character, $ matches end of line. -->
+ <!-- \s matches whitespace character, $ matches end of line.-->
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module>
- <module name="TreeWalker">
- <module name="RedundantImport"/>
- <module name="UnusedImports"/>
- </module>
+
+ <!-- some modules that we should soon add
+ <module name="MagicNumber"/> -->
+
+ <!-- some modules that we should soon add -->
</module>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/pom.xml b/plugins/network-elements/nicira-nvp/pom.xml
index 9341c93..2d88efb 100644
--- a/plugins/network-elements/nicira-nvp/pom.xml
+++ b/plugins/network-elements/nicira-nvp/pom.xml
@@ -42,7 +42,7 @@
</dependencies>
<executions>
<execution>
- <phase>process-sources</phase>
+ <phase>process-classes</phase>
<goals>
<goal>check</goal>
</goals>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePortForwardingRulesOnLogicalRouterAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePortForwardingRulesOnLogicalRouterAnswer.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePortForwardingRulesOnLogicalRouterAnswer.java
index 94931a0..38978ac 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePortForwardingRulesOnLogicalRouterAnswer.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePortForwardingRulesOnLogicalRouterAnswer.java
@@ -21,11 +21,16 @@ package com.cloud.agent.api;
*/
public class ConfigurePortForwardingRulesOnLogicalRouterAnswer extends Answer {
- public ConfigurePortForwardingRulesOnLogicalRouterAnswer(Command command, boolean success, String details) {
+ public ConfigurePortForwardingRulesOnLogicalRouterAnswer(
+ final Command command,
+ final boolean success,
+ final String details) {
super(command, success, details);
}
- public ConfigurePortForwardingRulesOnLogicalRouterAnswer(Command command, Exception e) {
+ public ConfigurePortForwardingRulesOnLogicalRouterAnswer(
+ final Command command,
+ final Exception e) {
super(command, e);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePortForwardingRulesOnLogicalRouterCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePortForwardingRulesOnLogicalRouterCommand.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePortForwardingRulesOnLogicalRouterCommand.java
index 16ef2c4..e0d3f07 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePortForwardingRulesOnLogicalRouterCommand.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePortForwardingRulesOnLogicalRouterCommand.java
@@ -28,7 +28,7 @@ public class ConfigurePortForwardingRulesOnLogicalRouterCommand extends Command
private String logicalRouterUuid;
private List<PortForwardingRuleTO> rules;
- public ConfigurePortForwardingRulesOnLogicalRouterCommand(String logicalRouterUuid, List<PortForwardingRuleTO> rules) {
+ public ConfigurePortForwardingRulesOnLogicalRouterCommand(final String logicalRouterUuid, final List<PortForwardingRuleTO> rules) {
this.logicalRouterUuid = logicalRouterUuid;
this.rules = rules;
}
@@ -37,7 +37,7 @@ public class ConfigurePortForwardingRulesOnLogicalRouterCommand extends Command
return logicalRouterUuid;
}
- public void setLogicalRouterUuid(String logicalRouterUuid) {
+ public void setLogicalRouterUuid(final String logicalRouterUuid) {
this.logicalRouterUuid = logicalRouterUuid;
}
@@ -45,12 +45,11 @@ public class ConfigurePortForwardingRulesOnLogicalRouterCommand extends Command
return rules;
}
- public void setRules(List<PortForwardingRuleTO> rules) {
+ public void setRules(final List<PortForwardingRuleTO> rules) {
this.rules = rules;
}
- /*
- * (non-Javadoc)
+ /* (non-Javadoc)
* @see com.cloud.agent.api.Command#executeInSequence()
*/
@Override
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePublicIpsOnLogicalRouterAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePublicIpsOnLogicalRouterAnswer.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePublicIpsOnLogicalRouterAnswer.java
index 09a3e7e..6226613 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePublicIpsOnLogicalRouterAnswer.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePublicIpsOnLogicalRouterAnswer.java
@@ -18,11 +18,13 @@ package com.cloud.agent.api;
public class ConfigurePublicIpsOnLogicalRouterAnswer extends Answer {
- public ConfigurePublicIpsOnLogicalRouterAnswer(Command command, boolean success, String details) {
+ public ConfigurePublicIpsOnLogicalRouterAnswer(final Command command,
+ final boolean success, final String details) {
super(command, success, details);
}
- public ConfigurePublicIpsOnLogicalRouterAnswer(Command command, Exception e) {
+ public ConfigurePublicIpsOnLogicalRouterAnswer(final Command command,
+ final Exception e) {
super(command, e);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePublicIpsOnLogicalRouterCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePublicIpsOnLogicalRouterCommand.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePublicIpsOnLogicalRouterCommand.java
index c08f540..9371ea6 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePublicIpsOnLogicalRouterCommand.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigurePublicIpsOnLogicalRouterCommand.java
@@ -24,7 +24,8 @@ public class ConfigurePublicIpsOnLogicalRouterCommand extends Command {
private String l3GatewayServiceUuid;
private List<String> publicCidrs;
- public ConfigurePublicIpsOnLogicalRouterCommand(String logicalRouterUuid, String l3GatewayServiceUuid, List<String> publicCidrs) {
+ public ConfigurePublicIpsOnLogicalRouterCommand(final String logicalRouterUuid,
+ final String l3GatewayServiceUuid, final List<String> publicCidrs) {
super();
this.logicalRouterUuid = logicalRouterUuid;
this.publicCidrs = publicCidrs;
@@ -35,7 +36,7 @@ public class ConfigurePublicIpsOnLogicalRouterCommand extends Command {
return logicalRouterUuid;
}
- public void setLogicalRouterUuid(String logicalRouterUuid) {
+ public void setLogicalRouterUuid(final String logicalRouterUuid) {
this.logicalRouterUuid = logicalRouterUuid;
}
@@ -43,7 +44,7 @@ public class ConfigurePublicIpsOnLogicalRouterCommand extends Command {
return l3GatewayServiceUuid;
}
- public void setL3GatewayServiceUuid(String l3GatewayServiceUuid) {
+ public void setL3GatewayServiceUuid(final String l3GatewayServiceUuid) {
this.l3GatewayServiceUuid = l3GatewayServiceUuid;
}
@@ -51,7 +52,7 @@ public class ConfigurePublicIpsOnLogicalRouterCommand extends Command {
return publicCidrs;
}
- public void setPublicCidrs(List<String> publicCidrs) {
+ public void setPublicCidrs(final List<String> publicCidrs) {
this.publicCidrs = publicCidrs;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigureStaticNatRulesOnLogicalRouterAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigureStaticNatRulesOnLogicalRouterAnswer.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigureStaticNatRulesOnLogicalRouterAnswer.java
index caab316..5d9c72c 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigureStaticNatRulesOnLogicalRouterAnswer.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigureStaticNatRulesOnLogicalRouterAnswer.java
@@ -26,7 +26,8 @@ public class ConfigureStaticNatRulesOnLogicalRouterAnswer extends Answer {
* @param success
* @param details
*/
- public ConfigureStaticNatRulesOnLogicalRouterAnswer(Command command, boolean success, String details) {
+ public ConfigureStaticNatRulesOnLogicalRouterAnswer(final Command command,
+ final boolean success, final String details) {
super(command, success, details);
}
@@ -34,7 +35,8 @@ public class ConfigureStaticNatRulesOnLogicalRouterAnswer extends Answer {
* @param command
* @param e
*/
- public ConfigureStaticNatRulesOnLogicalRouterAnswer(Command command, Exception e) {
+ public ConfigureStaticNatRulesOnLogicalRouterAnswer(final Command command,
+ final Exception e) {
super(command, e);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigureStaticNatRulesOnLogicalRouterCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigureStaticNatRulesOnLogicalRouterCommand.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigureStaticNatRulesOnLogicalRouterCommand.java
index 5f79ffc..6f97745 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigureStaticNatRulesOnLogicalRouterCommand.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/ConfigureStaticNatRulesOnLogicalRouterCommand.java
@@ -28,7 +28,8 @@ public class ConfigureStaticNatRulesOnLogicalRouterCommand extends Command {
private String logicalRouterUuid;
private List<StaticNatRuleTO> rules;
- public ConfigureStaticNatRulesOnLogicalRouterCommand(String logicalRouterUuid, List<StaticNatRuleTO> rules) {
+ public ConfigureStaticNatRulesOnLogicalRouterCommand(
+ final String logicalRouterUuid, final List<StaticNatRuleTO> rules) {
super();
this.logicalRouterUuid = logicalRouterUuid;
this.rules = rules;
@@ -39,7 +40,7 @@ public class ConfigureStaticNatRulesOnLogicalRouterCommand extends Command {
return logicalRouterUuid;
}
- public void setLogicalRouterUuid(String logicalRouterUuid) {
+ public void setLogicalRouterUuid(final String logicalRouterUuid) {
this.logicalRouterUuid = logicalRouterUuid;
}
@@ -47,12 +48,11 @@ public class ConfigureStaticNatRulesOnLogicalRouterCommand extends Command {
return rules;
}
- public void setRules(List<StaticNatRuleTO> rules) {
+ public void setRules(final List<StaticNatRuleTO> rules) {
this.rules = rules;
}
- /*
- * (non-Javadoc)
+ /* (non-Javadoc)
* @see com.cloud.agent.api.Command#executeInSequence()
*/
@Override
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalRouterAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalRouterAnswer.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalRouterAnswer.java
index 72a275b..ee56c17 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalRouterAnswer.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalRouterAnswer.java
@@ -21,20 +21,20 @@ package com.cloud.agent.api;
*/
public class CreateLogicalRouterAnswer extends Answer {
- private String _logicalRouterUuid;
+ private String logicalRouterUuid;
- public CreateLogicalRouterAnswer(Command command, boolean success,
- String details, String logicalRouterUuid) {
+ public CreateLogicalRouterAnswer(final Command command, final boolean success,
+ final String details, final String logicalRouterUuid) {
super(command, success, details);
- _logicalRouterUuid = logicalRouterUuid;
+ this.logicalRouterUuid = logicalRouterUuid;
}
- public CreateLogicalRouterAnswer(Command command, Exception e) {
+ public CreateLogicalRouterAnswer(final Command command, final Exception e) {
super(command, e);
}
public String getLogicalRouterUuid() {
- return _logicalRouterUuid;
+ return logicalRouterUuid;
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalRouterCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalRouterCommand.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalRouterCommand.java
index 1f3f24e..0f0d7ad 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalRouterCommand.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalRouterCommand.java
@@ -20,28 +20,28 @@ package com.cloud.agent.api;
*
*/
public class CreateLogicalRouterCommand extends Command {
- private String _gatewayServiceUuid;
- private String _logicalSwitchUuid;
- private long _vlanId;
- private String _name;
- private String _ownerName;
- private String _publicIpCidr;
- private String _publicNextHop;
- private String _internalIpCidr;
-
- public CreateLogicalRouterCommand(String gatewayServiceUuid, long vlanId,
- String logicalSwitchUuid, String name,
- String publicIpCidr, String publicNextHop,
- String internalIpCidr, String ownerName) {
+ private String gatewayServiceUuid;
+ private String logicalSwitchUuid;
+ private long vlanId;
+ private String name;
+ private String ownerName;
+ private String publicIpCidr;
+ private String publicNextHop;
+ private String internalIpCidr;
+
+ public CreateLogicalRouterCommand(final String gatewayServiceUuid, final long vlanId,
+ final String logicalSwitchUuid, final String name,
+ final String publicIpCidr, final String publicNextHop,
+ final String internalIpCidr, final String ownerName) {
super();
- _gatewayServiceUuid = gatewayServiceUuid;
- _logicalSwitchUuid = logicalSwitchUuid;
- _vlanId = vlanId;
- _name = name;
- _ownerName = ownerName;
- _publicIpCidr = publicIpCidr;
- _publicNextHop = publicNextHop;
- _internalIpCidr = internalIpCidr;
+ this.gatewayServiceUuid = gatewayServiceUuid;
+ this.logicalSwitchUuid = logicalSwitchUuid;
+ this.vlanId = vlanId;
+ this.name = name;
+ this.ownerName = ownerName;
+ this.publicIpCidr = publicIpCidr;
+ this.publicNextHop = publicNextHop;
+ this.internalIpCidr = internalIpCidr;
}
@Override
@@ -50,66 +50,66 @@ public class CreateLogicalRouterCommand extends Command {
}
public String getGatewayServiceUuid() {
- return _gatewayServiceUuid;
+ return gatewayServiceUuid;
}
- public void setGatewayServiceUuid(String gatewayServiceUuid) {
- _gatewayServiceUuid = gatewayServiceUuid;
+ public void setGatewayServiceUuid(final String gatewayServiceUuid) {
+ this.gatewayServiceUuid = gatewayServiceUuid;
}
public String getLogicalSwitchUuid() {
- return _logicalSwitchUuid;
+ return logicalSwitchUuid;
}
- public void setLogicalSwitchUuid(String logicalSwitchUuid) {
- _logicalSwitchUuid = logicalSwitchUuid;
+ public void setLogicalSwitchUuid(final String logicalSwitchUuid) {
+ this.logicalSwitchUuid = logicalSwitchUuid;
}
public long getVlanId() {
- return _vlanId;
+ return vlanId;
}
- public void setVlanId(long vlanId) {
- _vlanId = vlanId;
+ public void setVlanId(final long vlanId) {
+ this.vlanId = vlanId;
}
public String getName() {
- return _name;
+ return name;
}
- public void setName(String name) {
- _name = name;
+ public void setName(final String name) {
+ this.name = name;
}
public String getOwnerName() {
- return _ownerName;
+ return ownerName;
}
- public void setOwnerName(String ownerName) {
- _ownerName = ownerName;
+ public void setOwnerName(final String ownerName) {
+ this.ownerName = ownerName;
}
public String getPublicIpCidr() {
- return _publicIpCidr;
+ return publicIpCidr;
}
- public void setPublicIpCidr(String publicIpCidr) {
- _publicIpCidr = publicIpCidr;
+ public void setPublicIpCidr(final String publicIpCidr) {
+ this.publicIpCidr = publicIpCidr;
}
public String getInternalIpCidr() {
- return _internalIpCidr;
+ return internalIpCidr;
}
- public void setInternalIpCidr(String internalIpCidr) {
- _internalIpCidr = internalIpCidr;
+ public void setInternalIpCidr(final String internalIpCidr) {
+ this.internalIpCidr = internalIpCidr;
}
public String getPublicNextHop() {
- return _publicNextHop;
+ return publicNextHop;
}
- public void setPublicNextHop(String publicNextHop) {
- _publicNextHop = publicNextHop;
+ public void setPublicNextHop(final String publicNextHop) {
+ this.publicNextHop = publicNextHop;
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchAnswer.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchAnswer.java
index 753edec..76c4c16 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchAnswer.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchAnswer.java
@@ -17,20 +17,20 @@
package com.cloud.agent.api;
public class CreateLogicalSwitchAnswer extends Answer {
- private String _logicalSwitchUuid;
+ private String logicalSwitchUuid;
- public CreateLogicalSwitchAnswer(Command command, boolean success,
- String details, String logicalSwitchUuid) {
+ public CreateLogicalSwitchAnswer(final Command command, final boolean success,
+ final String details, final String logicalSwitchUuid) {
super(command, success, details);
- _logicalSwitchUuid = logicalSwitchUuid;
+ this.logicalSwitchUuid = logicalSwitchUuid;
}
- public CreateLogicalSwitchAnswer(Command command, Exception e) {
+ public CreateLogicalSwitchAnswer(final Command command, final Exception e) {
super(command, e);
}
public String getLogicalSwitchUuid() {
- return _logicalSwitchUuid;
+ return logicalSwitchUuid;
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchCommand.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchCommand.java
index b2a5aaf..ab08f70 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchCommand.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchCommand.java
@@ -18,16 +18,17 @@ package com.cloud.agent.api;
public class CreateLogicalSwitchCommand extends Command {
- private String _transportUuid;
- private String _transportType;
- private String _name;
- private String _ownerName;
-
- public CreateLogicalSwitchCommand(String transportUuid, String transportType, String name, String ownerName) {
- _transportUuid = transportUuid;
- _transportType = transportType;
- _name = name;
- _ownerName = ownerName;
+ private final String transportUuid;
+ private final String transportType;
+ private final String name;
+ private final String ownerName;
+
+ public CreateLogicalSwitchCommand(final String transportUuid, final String transportType,
+ final String name, final String ownerName) {
+ this.transportUuid = transportUuid;
+ this.transportType = transportType;
+ this.name = name;
+ this.ownerName = ownerName;
}
@Override
@@ -36,19 +37,19 @@ public class CreateLogicalSwitchCommand extends Command {
}
public String getTransportUuid() {
- return _transportUuid;
+ return transportUuid;
}
public String getTransportType() {
- return _transportType;
+ return transportType;
}
public String getName() {
- return _name;
+ return name;
}
public String getOwnerName() {
- return _ownerName;
+ return ownerName;
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchPortAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchPortAnswer.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchPortAnswer.java
index 8fa7927..c884c74 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchPortAnswer.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchPortAnswer.java
@@ -17,19 +17,19 @@
package com.cloud.agent.api;
public class CreateLogicalSwitchPortAnswer extends Answer {
- private String _logicalSwitchPortUuid;
+ private String logicalSwitchPortUuid;
- public CreateLogicalSwitchPortAnswer(Command command, boolean success,
- String details, String localSwitchPortUuid) {
+ public CreateLogicalSwitchPortAnswer(final Command command, final boolean success,
+ final String details, final String localSwitchPortUuid) {
super(command, success, details);
- _logicalSwitchPortUuid = localSwitchPortUuid;
+ logicalSwitchPortUuid = localSwitchPortUuid;
}
public String getLogicalSwitchPortUuid() {
- return _logicalSwitchPortUuid;
+ return logicalSwitchPortUuid;
}
- public CreateLogicalSwitchPortAnswer(Command command, Exception e) {
+ public CreateLogicalSwitchPortAnswer(final Command command, final Exception e) {
super(command, e);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchPortCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchPortCommand.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchPortCommand.java
index fe3f683..bc0c921 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchPortCommand.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchPortCommand.java
@@ -17,36 +17,37 @@
package com.cloud.agent.api;
public class CreateLogicalSwitchPortCommand extends Command {
- private String _logicalSwitchUuid;
- private String _attachmentUuid;
- private String _ownerName;
- private String _nicName;
-
- public CreateLogicalSwitchPortCommand(String logicalSwitchUuid, String attachmentUuid, String ownerName, String nicName) {
- _logicalSwitchUuid = logicalSwitchUuid;
- _attachmentUuid = attachmentUuid;
- _ownerName = ownerName;
- _nicName = nicName;
+ private final String logicalSwitchUuid;
+ private final String attachmentUuid;
+ private final String ownerName;
+ private final String nicName;
+
+ public CreateLogicalSwitchPortCommand(final String logicalSwitchUuid,
+ final String attachmentUuid, final String ownerName, final String nicName) {
+ this.logicalSwitchUuid = logicalSwitchUuid;
+ this.attachmentUuid = attachmentUuid;
+ this.ownerName = ownerName;
+ this.nicName = nicName;
}
public String getLogicalSwitchUuid() {
- return _logicalSwitchUuid;
+ return logicalSwitchUuid;
}
public String getAttachmentUuid() {
- return _attachmentUuid;
+ return attachmentUuid;
}
public String getOwnerName() {
- return _ownerName;
+ return ownerName;
}
public String getNicName() {
- return _nicName;
+ return nicName;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalRouterAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalRouterAnswer.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalRouterAnswer.java
index db07547..4799637 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalRouterAnswer.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalRouterAnswer.java
@@ -21,12 +21,12 @@ package com.cloud.agent.api;
*/
public class DeleteLogicalRouterAnswer extends Answer {
- public DeleteLogicalRouterAnswer(Command command, boolean success,
- String details) {
+ public DeleteLogicalRouterAnswer(final Command command,
+ final boolean success, final String details) {
super(command, success, details);
}
- public DeleteLogicalRouterAnswer(Command command, Exception e) {
+ public DeleteLogicalRouterAnswer(final Command command, final Exception e) {
super(command, e);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalRouterCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalRouterCommand.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalRouterCommand.java
index 96e2cb9..ee59007 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalRouterCommand.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalRouterCommand.java
@@ -21,14 +21,13 @@ package com.cloud.agent.api;
*/
public class DeleteLogicalRouterCommand extends Command {
- private String _logicalRouterUuid;
+ private final String logicalRouterUuid;
public DeleteLogicalRouterCommand(String logicalRouterUuid) {
- _logicalRouterUuid = logicalRouterUuid;
+ this.logicalRouterUuid = logicalRouterUuid;
}
- /*
- * (non-Javadoc)
+ /* (non-Javadoc)
* @see com.cloud.agent.api.Command#executeInSequence()
*/
@Override
@@ -37,6 +36,6 @@ public class DeleteLogicalRouterCommand extends Command {
}
public String getLogicalRouterUuid() {
- return _logicalRouterUuid;
+ return logicalRouterUuid;
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchAnswer.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchAnswer.java
index e9cfbc4..e633099 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchAnswer.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchAnswer.java
@@ -18,12 +18,12 @@ package com.cloud.agent.api;
public class DeleteLogicalSwitchAnswer extends Answer {
- public DeleteLogicalSwitchAnswer(Command command, boolean success,
- String details) {
+ public DeleteLogicalSwitchAnswer(final Command command,
+ final boolean success, final String details) {
super(command, success, details);
}
- public DeleteLogicalSwitchAnswer(Command command, Exception e) {
+ public DeleteLogicalSwitchAnswer(final Command command, final Exception e) {
super(command, e);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchCommand.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchCommand.java
index 25aa339..3a7ba1d 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchCommand.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchCommand.java
@@ -18,10 +18,10 @@ package com.cloud.agent.api;
public class DeleteLogicalSwitchCommand extends Command {
- private String _logicalSwitchUuid;
+ private final String logicalSwitchUuid;
- public DeleteLogicalSwitchCommand(String logicalSwitchUuid) {
- _logicalSwitchUuid = logicalSwitchUuid;
+ public DeleteLogicalSwitchCommand(final String logicalSwitchUuid) {
+ this.logicalSwitchUuid = logicalSwitchUuid;
}
@Override
@@ -30,6 +30,6 @@ public class DeleteLogicalSwitchCommand extends Command {
}
public String getLogicalSwitchUuid() {
- return _logicalSwitchUuid;
+ return logicalSwitchUuid;
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchPortAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchPortAnswer.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchPortAnswer.java
index f779677..d3d2e72 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchPortAnswer.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchPortAnswer.java
@@ -18,12 +18,12 @@ package com.cloud.agent.api;
public class DeleteLogicalSwitchPortAnswer extends Answer {
- public DeleteLogicalSwitchPortAnswer(Command command, boolean success,
- String details) {
+ public DeleteLogicalSwitchPortAnswer(final Command command,
+ final boolean success, final String details) {
super(command, success, details);
}
- public DeleteLogicalSwitchPortAnswer(Command command, Exception e) {
+ public DeleteLogicalSwitchPortAnswer(final Command command, final Exception e) {
super(command, e);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchPortCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchPortCommand.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchPortCommand.java
index e91a032..df06fa3 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchPortCommand.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchPortCommand.java
@@ -17,20 +17,20 @@
package com.cloud.agent.api;
public class DeleteLogicalSwitchPortCommand extends Command {
- private String _logicalSwitchUuid;
- private String _logicalSwithPortUuid;
+ private final String logicalSwitchUuid;
+ private final String logicalSwithPortUuid;
- public DeleteLogicalSwitchPortCommand(String logicalSwitchUuid, String logicalSwitchPortUuid) {
- _logicalSwitchUuid = logicalSwitchUuid;
- _logicalSwithPortUuid = logicalSwitchPortUuid;
+ public DeleteLogicalSwitchPortCommand(final String logicalSwitchUuid, final String logicalSwitchPortUuid) {
+ this.logicalSwitchUuid = logicalSwitchUuid;
+ logicalSwithPortUuid = logicalSwitchPortUuid;
}
public String getLogicalSwitchUuid() {
- return _logicalSwitchUuid;
+ return logicalSwitchUuid;
}
public String getLogicalSwitchPortUuid() {
- return _logicalSwithPortUuid;
+ return logicalSwithPortUuid;
}
@Override
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/FindLogicalSwitchPortAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/FindLogicalSwitchPortAnswer.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/FindLogicalSwitchPortAnswer.java
index edc0c5f..f70a6e1 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/FindLogicalSwitchPortAnswer.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/FindLogicalSwitchPortAnswer.java
@@ -17,19 +17,19 @@
package com.cloud.agent.api;
public class FindLogicalSwitchPortAnswer extends Answer {
- private String _logicalSwitchPortUuid;
+ private String logicalSwitchPortUuid;
- public FindLogicalSwitchPortAnswer(Command command, boolean success,
- String details, String localSwitchPortUuid) {
+ public FindLogicalSwitchPortAnswer(final Command command, final boolean success,
+ final String details, final String localSwitchPortUuid) {
super(command, success, details);
- _logicalSwitchPortUuid = localSwitchPortUuid;
+ logicalSwitchPortUuid = localSwitchPortUuid;
}
public String getLogicalSwitchPortUuid() {
- return _logicalSwitchPortUuid;
+ return logicalSwitchPortUuid;
}
- public FindLogicalSwitchPortAnswer(Command command, Exception e) {
+ public FindLogicalSwitchPortAnswer(final Command command, final Exception e) {
super(command, e);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/FindLogicalSwitchPortCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/FindLogicalSwitchPortCommand.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/FindLogicalSwitchPortCommand.java
index b737c50..1635db9 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/FindLogicalSwitchPortCommand.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/FindLogicalSwitchPortCommand.java
@@ -17,22 +17,22 @@
package com.cloud.agent.api;
public class FindLogicalSwitchPortCommand extends Command {
- private String _logicalSwitchUuid;
- private String _logicalSwitchPortUuid;
+ private final String logicalSwitchUuid;
+ private final String logicalSwitchPortUuid;
public FindLogicalSwitchPortCommand(String logicalSwitchUuid, String logicalSwitchPortUuid) {
- _logicalSwitchUuid = logicalSwitchUuid;
- _logicalSwitchPortUuid = logicalSwitchPortUuid;
+ this.logicalSwitchUuid = logicalSwitchUuid;
+ this.logicalSwitchPortUuid = logicalSwitchPortUuid;
}
public String getLogicalSwitchUuid() {
- return _logicalSwitchUuid;
+ return logicalSwitchUuid;
}
public String getLogicalSwitchPortUuid() {
- return _logicalSwitchPortUuid;
+ return logicalSwitchPortUuid;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/UpdateLogicalSwitchPortAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/UpdateLogicalSwitchPortAnswer.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/UpdateLogicalSwitchPortAnswer.java
index f4c4130..02195aa 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/UpdateLogicalSwitchPortAnswer.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/UpdateLogicalSwitchPortAnswer.java
@@ -17,16 +17,16 @@
package com.cloud.agent.api;
public class UpdateLogicalSwitchPortAnswer extends Answer {
- private String _logicalSwitchPortUuid;
+ private String logicalSwitchPortUuid;
public UpdateLogicalSwitchPortAnswer(Command command, boolean success,
String details, String localSwitchPortUuid) {
super(command, success, details);
- _logicalSwitchPortUuid = localSwitchPortUuid;
+ logicalSwitchPortUuid = localSwitchPortUuid;
}
public String getLogicalSwitchPortUuid() {
- return _logicalSwitchPortUuid;
+ return logicalSwitchPortUuid;
}
public UpdateLogicalSwitchPortAnswer(Command command, Exception e) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/UpdateLogicalSwitchPortCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/UpdateLogicalSwitchPortCommand.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/UpdateLogicalSwitchPortCommand.java
index 1b8b590..79f4be6 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/UpdateLogicalSwitchPortCommand.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/UpdateLogicalSwitchPortCommand.java
@@ -17,43 +17,44 @@
package com.cloud.agent.api;
public class UpdateLogicalSwitchPortCommand extends Command {
- private String _logicalSwitchUuid;
- private String _logicalSwitchPortUuid;
- private String _attachmentUuid;
- private String _ownerName;
- private String _nicName;
+ private final String logicalSwitchUuid;
+ private final String logicalSwitchPortUuid;
+ private final String attachmentUuid;
+ private final String ownerName;
+ private final String nicName;
- public UpdateLogicalSwitchPortCommand(String logicalSwitchPortUuid, String logicalSwitchUuid, String attachmentUuid, String ownerName, String nicName) {
- _logicalSwitchUuid = logicalSwitchUuid;
- _logicalSwitchPortUuid = logicalSwitchPortUuid;
- _attachmentUuid = attachmentUuid;
- _ownerName = ownerName;
- _nicName = nicName;
+ public UpdateLogicalSwitchPortCommand(final String logicalSwitchPortUuid, final String logicalSwitchUuid,
+ final String attachmentUuid, final String ownerName, final String nicName) {
+ this.logicalSwitchUuid = logicalSwitchUuid;
+ this.logicalSwitchPortUuid = logicalSwitchPortUuid;
+ this.attachmentUuid = attachmentUuid;
+ this.ownerName = ownerName;
+ this.nicName = nicName;
}
public String getLogicalSwitchUuid() {
- return _logicalSwitchUuid;
+ return logicalSwitchUuid;
}
public String getLogicalSwitchPortUuid() {
- return _logicalSwitchPortUuid;
+ return logicalSwitchPortUuid;
}
public String getAttachmentUuid() {
- return _attachmentUuid;
+ return attachmentUuid;
}
public String getOwnerName() {
- return _ownerName;
+ return ownerName;
}
public String getNicName() {
- return _nicName;
+ return nicName;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/AddNiciraNvpDeviceCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/AddNiciraNvpDeviceCmd.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/AddNiciraNvpDeviceCmd.java
index 937b665..8f8a917 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/AddNiciraNvpDeviceCmd.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/AddNiciraNvpDeviceCmd.java
@@ -18,8 +18,6 @@ package com.cloud.api.commands;
import javax.inject.Inject;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
@@ -42,9 +40,9 @@ import com.cloud.utils.exception.CloudRuntimeException;
@APICommand(name = "addNiciraNvpDevice", responseObject=NiciraNvpDeviceResponse.class, description="Adds a Nicira NVP device")
public class AddNiciraNvpDeviceCmd extends BaseAsyncCmd {
- private static final Logger s_logger = Logger.getLogger(AddNiciraNvpDeviceCmd.class.getName());
private static final String s_name = "addniciranvpdeviceresponse";
- @Inject NiciraNvpElementService _niciraNvpElementService;
+ @Inject
+ protected NiciraNvpElementService niciraNvpElementService;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@@ -63,10 +61,12 @@ public class AddNiciraNvpDeviceCmd extends BaseAsyncCmd {
@Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required = true, description="Credentials to access the Nicira Controller API")
private String password;
- @Parameter(name=ApiConstants.NICIRA_NVP_TRANSPORT_ZONE_UUID, type=CommandType.STRING, required = true, description="The Transportzone UUID configured on the Nicira Controller")
+ @Parameter(name=ApiConstants.NICIRA_NVP_TRANSPORT_ZONE_UUID, type=CommandType.STRING, required = true,
+ description="The Transportzone UUID configured on the Nicira Controller")
private String transportzoneuuid;
- @Parameter(name=ApiConstants.NICIRA_NVP_GATEWAYSERVICE_UUID, type=CommandType.STRING, required = false, description="The L3 Gateway Service UUID configured on the Nicira Controller")
+ @Parameter(name=ApiConstants.NICIRA_NVP_GATEWAYSERVICE_UUID, type=CommandType.STRING, required = false,
+ description="The L3 Gateway Service UUID configured on the Nicira Controller")
private String l3gatewayserviceuuid;
/////////////////////////////////////////////////////
@@ -104,9 +104,9 @@ public class AddNiciraNvpDeviceCmd extends BaseAsyncCmd {
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
try {
- NiciraNvpDeviceVO niciraNvpDeviceVO = _niciraNvpElementService.addNiciraNvpDevice(this);
+ NiciraNvpDeviceVO niciraNvpDeviceVO = niciraNvpElementService.addNiciraNvpDevice(this);
if (niciraNvpDeviceVO != null) {
- NiciraNvpDeviceResponse response = _niciraNvpElementService.createNiciraNvpDeviceResponse(niciraNvpDeviceVO);
+ NiciraNvpDeviceResponse response = niciraNvpElementService.createNiciraNvpDeviceResponse(niciraNvpDeviceVO);
response.setObjectName("niciranvpdevice");
response.setResponseName(getCommandName());
setResponseObject(response);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java
index 6eb6764..46a9fad 100755
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java
@@ -18,18 +18,17 @@ package com.cloud.api.commands;
import javax.inject.Inject;
-import org.apache.log4j.Logger;
+import com.cloud.api.response.NiciraNvpDeviceResponse;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.context.CallContext;
-import com.cloud.api.response.NiciraNvpDeviceResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
@@ -41,9 +40,9 @@ import com.cloud.utils.exception.CloudRuntimeException;
@APICommand(name = "deleteNiciraNvpDevice", responseObject=SuccessResponse.class, description=" delete a nicira nvp device")
public class DeleteNiciraNvpDeviceCmd extends BaseAsyncCmd {
- private static final Logger s_logger = Logger.getLogger(DeleteNiciraNvpDeviceCmd.class.getName());
private static final String s_name = "deleteniciranvpdeviceresponse";
- @Inject NiciraNvpElementService _niciraNvpElementService;
+ @Inject
+ protected NiciraNvpElementService niciraNvpElementService;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@@ -68,7 +67,7 @@ public class DeleteNiciraNvpDeviceCmd extends BaseAsyncCmd {
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
try {
- boolean result = _niciraNvpElementService.deleteNiciraNvpDevice(this);
+ boolean result = niciraNvpElementService.deleteNiciraNvpDevice(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
response.setResponseName(getCommandName());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDeviceNetworksCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDeviceNetworksCmd.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDeviceNetworksCmd.java
index 53203a7..8595522 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDeviceNetworksCmd.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDeviceNetworksCmd.java
@@ -21,18 +21,17 @@ import java.util.List;
import javax.inject.Inject;
+import com.cloud.api.response.NiciraNvpDeviceResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
-
-import com.cloud.api.response.NiciraNvpDeviceResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
@@ -47,7 +46,8 @@ public class ListNiciraNvpDeviceNetworksCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListNiciraNvpDeviceNetworksCmd.class.getName());
private static final String s_name = "listniciranvpdevicenetworks";
- @Inject NiciraNvpElementService _niciraNvpElementService;
+ @Inject
+ protected NiciraNvpElementService niciraNvpElementService;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@@ -72,7 +72,7 @@ public class ListNiciraNvpDeviceNetworksCmd extends BaseListCmd {
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
try {
- List<? extends Network> networks = _niciraNvpElementService.listNiciraNvpDeviceNetworks(this);
+ List<? extends Network> networks = niciraNvpElementService.listNiciraNvpDeviceNetworks(this);
ListResponse<NetworkResponse> response = new ListResponse<NetworkResponse>();
List<NetworkResponse> networkResponses = new ArrayList<NetworkResponse>();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java
index 3e02e19..8d5ac4a 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java
@@ -21,19 +21,16 @@ import java.util.List;
import javax.inject.Inject;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.response.ListResponse;
import com.cloud.api.response.NiciraNvpDeviceResponse;
-import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
@@ -44,11 +41,12 @@ import com.cloud.utils.exception.CloudRuntimeException;
@APICommand(name = "listNiciraNvpDevices", responseObject=NiciraNvpDeviceResponse.class, description="Lists Nicira NVP devices")
public class ListNiciraNvpDevicesCmd extends BaseListCmd {
- private static final Logger s_logger = Logger.getLogger(ListNiciraNvpDevicesCmd.class.getName());
private static final String s_name = "listniciranvpdeviceresponse";
- @Inject NiciraNvpElementService _niciraNvpElementService;
- /////////////////////////////////////////////////////
+ @Inject
+ protected NiciraNvpElementService niciraNvpElementService;
+
+ /////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@@ -77,15 +75,15 @@ public class ListNiciraNvpDevicesCmd extends BaseListCmd {
/////////////////////////////////////////////////////
@Override
- public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException {
try {
- List<NiciraNvpDeviceVO> niciraDevices = _niciraNvpElementService.listNiciraNvpDevices(this);
+ List<NiciraNvpDeviceVO> niciraDevices = niciraNvpElementService.listNiciraNvpDevices(this);
ListResponse<NiciraNvpDeviceResponse> response = new ListResponse<NiciraNvpDeviceResponse>();
List<NiciraNvpDeviceResponse> niciraDevicesResponse = new ArrayList<NiciraNvpDeviceResponse>();
if (niciraDevices != null && !niciraDevices.isEmpty()) {
for (NiciraNvpDeviceVO niciraDeviceVO : niciraDevices) {
- NiciraNvpDeviceResponse niciraDeviceResponse = _niciraNvpElementService.createNiciraNvpDeviceResponse(niciraDeviceVO);
+ NiciraNvpDeviceResponse niciraDeviceResponse = niciraNvpElementService.createNiciraNvpDeviceResponse(niciraDeviceVO);
niciraDevicesResponse.add(niciraDeviceResponse);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/api/response/NiciraNvpDeviceResponse.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/response/NiciraNvpDeviceResponse.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/response/NiciraNvpDeviceResponse.java
index d6085e2..8612480 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/api/response/NiciraNvpDeviceResponse.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/response/NiciraNvpDeviceResponse.java
@@ -16,15 +16,13 @@
// under the License.
package com.cloud.api.response;
-import com.google.gson.annotations.SerializedName;
-
+import com.cloud.network.NiciraNvpDeviceVO;
import org.apache.cloudstack.api.ApiConstants;
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.EntityReference;
-import com.cloud.network.NiciraNvpDeviceVO;
-import com.cloud.serializer.Param;
-
@EntityReference(value=NiciraNvpDeviceVO.class)
public class NiciraNvpDeviceResponse extends BaseResponse {
@SerializedName(ApiConstants.NICIRA_NVP_DEVICE_ID) @Param(description="device id of the Nicire Nvp")
@@ -49,30 +47,30 @@ public class NiciraNvpDeviceResponse extends BaseResponse {
private String l3GatewayServiceUuid;
public void setId(String nvpDeviceId) {
- id = nvpDeviceId;
+ this.id = nvpDeviceId;
}
- public void setPhysicalNetworkId(String physicalNetworkId) {
+ public void setPhysicalNetworkId(final String physicalNetworkId) {
this.physicalNetworkId = physicalNetworkId;
}
- public void setProviderName(String providerName) {
+ public void setProviderName(final String providerName) {
this.providerName = providerName;
}
- public void setDeviceName(String deviceName) {
+ public void setDeviceName(final String deviceName) {
this.deviceName = deviceName;
}
- public void setHostName(String hostName) {
+ public void setHostName(final String hostName) {
this.hostName = hostName;
}
- public void setTransportZoneUuid(String transportZoneUuid) {
+ public void setTransportZoneUuid(final String transportZoneUuid) {
this.transportZoneUuid = transportZoneUuid;
}
- public void setL3GatewayServiceUuid(String l3GatewayServiceUuid) {
+ public void setL3GatewayServiceUuid(final String l3GatewayServiceUuid) {
this.l3GatewayServiceUuid = l3GatewayServiceUuid;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpDeviceVO.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpDeviceVO.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpDeviceVO.java
index 3832123..d4dd8d9 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpDeviceVO.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpDeviceVO.java
@@ -56,8 +56,8 @@ public class NiciraNvpDeviceVO implements InternalIdentity {
uuid = UUID.randomUUID().toString();
}
- public NiciraNvpDeviceVO(long hostId, long physicalNetworkId,
- String providerName, String deviceName) {
+ public NiciraNvpDeviceVO(final long hostId, final long physicalNetworkId,
+ final String providerName, final String deviceName) {
super();
this.hostId = hostId;
this.physicalNetworkId = physicalNetworkId;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpNicMappingVO.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpNicMappingVO.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpNicMappingVO.java
index d9dbb02..d329a87 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpNicMappingVO.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpNicMappingVO.java
@@ -46,7 +46,7 @@ public class NiciraNvpNicMappingVO implements InternalIdentity {
public NiciraNvpNicMappingVO () {
}
- public NiciraNvpNicMappingVO (String logicalSwitchUuid, String logicalSwitchPortUuid, String nicUuid) {
+ public NiciraNvpNicMappingVO (final String logicalSwitchUuid, final String logicalSwitchPortUuid, final String nicUuid) {
this.logicalSwitchUuid = logicalSwitchUuid;
this.logicalSwitchPortUuid = logicalSwitchPortUuid;
this.nicUuid = nicUuid;
@@ -56,7 +56,7 @@ public class NiciraNvpNicMappingVO implements InternalIdentity {
return logicalSwitchUuid;
}
- public void setLogicalSwitchUuid(String logicalSwitchUuid) {
+ public void setLogicalSwitchUuid(final String logicalSwitchUuid) {
this.logicalSwitchUuid = logicalSwitchUuid;
}
@@ -64,7 +64,7 @@ public class NiciraNvpNicMappingVO implements InternalIdentity {
return logicalSwitchPortUuid;
}
- public void setLogicalSwitchPortUuid(String logicalSwitchPortUuid) {
+ public void setLogicalSwitchPortUuid(final String logicalSwitchPortUuid) {
this.logicalSwitchPortUuid = logicalSwitchPortUuid;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpRouterMappingVO.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpRouterMappingVO.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpRouterMappingVO.java
index 1e2a831..fe7d5c2 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpRouterMappingVO.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpRouterMappingVO.java
@@ -28,6 +28,7 @@ import org.apache.cloudstack.api.InternalIdentity;
@Entity
@Table(name="nicira_nvp_router_map")
public class NiciraNvpRouterMappingVO implements InternalIdentity {
+ //FIXME the ddl for this table should be in one of the upgrade scripts
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="id")
@@ -42,12 +43,12 @@ public class NiciraNvpRouterMappingVO implements InternalIdentity {
public NiciraNvpRouterMappingVO() {
}
- public NiciraNvpRouterMappingVO(String logicalRouterUuid, long networkId) {
+ public NiciraNvpRouterMappingVO(final String logicalRouterUuid, final long networkId) {
this.logicalRouterUuid = logicalRouterUuid;
this.networkId = networkId;
}
- public NiciraNvpRouterMappingVO(long id, String logicalRouterUuid, long networkId) {
+ public NiciraNvpRouterMappingVO(final long id, final String logicalRouterUuid, final long networkId) {
this.id = id;
this.logicalRouterUuid = logicalRouterUuid;
this.networkId = networkId;
@@ -58,7 +59,7 @@ public class NiciraNvpRouterMappingVO implements InternalIdentity {
return id;
}
- public void setId(long id) {
+ public void setId(final long id) {
this.id = id;
}
@@ -66,7 +67,7 @@ public class NiciraNvpRouterMappingVO implements InternalIdentity {
return logicalRouterUuid;
}
- public void setLogicalRouterUuid(String logicalRouterUuid) {
+ public void setLogicalRouterUuid(final String logicalRouterUuid) {
this.logicalRouterUuid = logicalRouterUuid;
}
@@ -74,7 +75,7 @@ public class NiciraNvpRouterMappingVO implements InternalIdentity {
return networkId;
}
- public void setNetworkId(long networkId) {
+ public void setNetworkId(final long networkId) {
this.networkId = networkId;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpDaoImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpDaoImpl.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpDaoImpl.java
index 5e07246..2f53a85 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpDaoImpl.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpDaoImpl.java
@@ -31,7 +31,7 @@ import com.cloud.utils.db.SearchCriteria.Op;
@Component
@Local(value=NiciraNvpDao.class)
public class NiciraNvpDaoImpl extends GenericDaoBase<NiciraNvpDeviceVO, Long>
-implements NiciraNvpDao {
+ implements NiciraNvpDao {
protected final SearchBuilder<NiciraNvpDeviceVO> physicalNetworkIdSearch;
@@ -42,7 +42,7 @@ implements NiciraNvpDao {
}
@Override
- public List<NiciraNvpDeviceVO> listByPhysicalNetwork(long physicalNetworkId) {
+ public List<NiciraNvpDeviceVO> listByPhysicalNetwork(final long physicalNetworkId) {
SearchCriteria<NiciraNvpDeviceVO> sc = physicalNetworkIdSearch.create();
sc.setParameters("physicalNetworkId", physicalNetworkId);
return search(sc, null);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDao.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDao.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDao.java
index f693dcb..1c4754f 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDao.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDao.java
@@ -21,12 +21,9 @@ import com.cloud.utils.db.GenericDao;
public interface NiciraNvpNicMappingDao extends GenericDao<NiciraNvpNicMappingVO, Long> {
- /**
- * find the mapping for a nic
- * @param nicUuid
- * the Uuid of a nic attached to a logical switch port
- * @return NiciraNvpNicMapping for this nic uuid or null if it does not
- * exist
+ /** find the mapping for a nic
+ * @param nicUuid the Uuid of a nic attached to a logical switch port
+ * @return NiciraNvpNicMapping for this nic uuid or null if it does not exist
*/
public NiciraNvpNicMappingVO findByNicUuid(String nicUuid);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDaoImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDaoImpl.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDaoImpl.java
index 1a0fcd1..5c5097c 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDaoImpl.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDaoImpl.java
@@ -29,7 +29,7 @@ import com.cloud.utils.db.SearchCriteria.Op;
@Component
@Local(value=NiciraNvpNicMappingDao.class)
public class NiciraNvpNicMappingDaoImpl extends
-GenericDaoBase<NiciraNvpNicMappingVO, Long> implements NiciraNvpNicMappingDao {
+ GenericDaoBase<NiciraNvpNicMappingVO, Long> implements NiciraNvpNicMappingDao {
protected final SearchBuilder<NiciraNvpNicMappingVO> nicSearch;
@@ -40,7 +40,7 @@ GenericDaoBase<NiciraNvpNicMappingVO, Long> implements NiciraNvpNicMappingDao {
}
@Override
- public NiciraNvpNicMappingVO findByNicUuid(String nicUuid) {
+ public NiciraNvpNicMappingVO findByNicUuid(final String nicUuid) {
SearchCriteria<NiciraNvpNicMappingVO> sc = nicSearch.create();
sc.setParameters("nicUuid", nicUuid);
return findOneBy(sc);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpRouterMappingDaoImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpRouterMappingDaoImpl.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpRouterMappingDaoImpl.java
index dc41f57..06331e1 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpRouterMappingDaoImpl.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpRouterMappingDaoImpl.java
@@ -39,10 +39,11 @@ public class NiciraNvpRouterMappingDaoImpl extends GenericDaoBase<NiciraNvpRoute
}
@Override
- public NiciraNvpRouterMappingVO findByNetworkId(long id) {
+ public NiciraNvpRouterMappingVO findByNetworkId(final long id) {
SearchCriteria<NiciraNvpRouterMappingVO> sc = networkSearch.create();
sc.setParameters("network_id", id);
return findOneBy(sc);
}
+
}
[05/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-4916: Fixing the issue with DB HA when there are more than 2 db nodes (Issue was mysql DriverManager was returning salve db nodes on random basis which was causing issue)
Signed-off-by: Abhinandan Prateek <ap...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/67fc2f53
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/67fc2f53
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/67fc2f53
Branch: refs/heads/disk-cache
Commit: 67fc2f53e2e197f2a8da3b7fc367de9dbe54bb93
Parents: 74153e4
Author: Damodar Reddy <da...@citrix.com>
Authored: Thu Nov 14 10:45:54 2013 +0530
Committer: Abhinandan Prateek <ap...@apache.org>
Committed: Thu Nov 14 11:10:48 2013 +0530
----------------------------------------------------------------------
client/tomcatconf/db.properties.in | 1 +
framework/db/pom.xml | 5 +
.../src/com/cloud/utils/db/StaticStrategy.java | 130 +++++++++++++++++++
.../com/cloud/utils/db/TransactionLegacy.java | 8 +-
4 files changed, 140 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67fc2f53/client/tomcatconf/db.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/db.properties.in b/client/tomcatconf/db.properties.in
index 31e0803..b224cec 100644
--- a/client/tomcatconf/db.properties.in
+++ b/client/tomcatconf/db.properties.in
@@ -85,6 +85,7 @@ db.simulator.autoReconnect=true
# High Availability And Cluster Properties
db.ha.enabled=false
+db.ha.loadBalanceStrategy=com.cloud.utils.db.StaticStrategy
# cloud stack Database
db.cloud.slaves=localhost,localhost
db.cloud.autoReconnect=true
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67fc2f53/framework/db/pom.xml
----------------------------------------------------------------------
diff --git a/framework/db/pom.xml b/framework/db/pom.xml
index 5af00a0..e28628e 100644
--- a/framework/db/pom.xml
+++ b/framework/db/pom.xml
@@ -44,6 +44,11 @@
<artifactId>cloud-utils</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67fc2f53/framework/db/src/com/cloud/utils/db/StaticStrategy.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/StaticStrategy.java b/framework/db/src/com/cloud/utils/db/StaticStrategy.java
new file mode 100644
index 0000000..29e96df
--- /dev/null
+++ b/framework/db/src/com/cloud/utils/db/StaticStrategy.java
@@ -0,0 +1,130 @@
+// 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
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.utils.db;
+
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import com.mysql.jdbc.BalanceStrategy;
+import com.mysql.jdbc.Connection;
+import com.mysql.jdbc.ConnectionImpl;
+import com.mysql.jdbc.LoadBalancingConnectionProxy;
+import com.mysql.jdbc.SQLError;
+
+public class StaticStrategy implements BalanceStrategy {
+
+ public StaticStrategy() {
+ }
+
+ public void destroy() {
+ // we don't have anything to clean up
+ }
+
+ public void init(Connection conn, Properties props) throws SQLException {
+ // we don't have anything to initialize
+ }
+
+ public ConnectionImpl pickConnection(LoadBalancingConnectionProxy proxy,
+ List<String> configuredHosts, Map<String, ConnectionImpl> liveConnections, long[] responseTimes,
+ int numRetries) throws SQLException {
+ int numHosts = configuredHosts.size();
+
+ SQLException ex = null;
+
+ List<String> whiteList = new ArrayList<String>(numHosts);
+ whiteList.addAll(configuredHosts);
+
+ Map<String, Long> blackList = proxy.getGlobalBlacklist();
+
+ whiteList.removeAll(blackList.keySet());
+
+ Map<String, Integer> whiteListMap = this.getArrayIndexMap(whiteList);
+
+
+ for (int attempts = 0; attempts < numRetries;) {
+ if(whiteList.size() == 0){
+ throw SQLError.createSQLException("No hosts configured", null);
+ }
+
+ String hostPortSpec = whiteList.get(0); //Always take the first host
+
+ ConnectionImpl conn = liveConnections.get(hostPortSpec);
+
+ if (conn == null) {
+ try {
+ conn = proxy.createConnectionForHost(hostPortSpec);
+ } catch (SQLException sqlEx) {
+ ex = sqlEx;
+
+ if (proxy.shouldExceptionTriggerFailover(sqlEx)) {
+
+ Integer whiteListIndex = whiteListMap.get(hostPortSpec);
+
+ // exclude this host from being picked again
+ if (whiteListIndex != null) {
+ whiteList.remove(whiteListIndex.intValue());
+ whiteListMap = this.getArrayIndexMap(whiteList);
+ }
+ proxy.addToGlobalBlacklist( hostPortSpec );
+
+ if (whiteList.size() == 0) {
+ attempts++;
+ try {
+ Thread.sleep(250);
+ } catch (InterruptedException e) {
+ }
+
+ // start fresh
+ whiteListMap = new HashMap<String, Integer>(numHosts);
+ whiteList.addAll(configuredHosts);
+ blackList = proxy.getGlobalBlacklist();
+
+ whiteList.removeAll(blackList.keySet());
+ whiteListMap = this.getArrayIndexMap(whiteList);
+ }
+
+ continue;
+ }
+
+ throw sqlEx;
+ }
+ }
+
+ return conn;
+ }
+
+ if (ex != null) {
+ throw ex;
+ }
+
+ return null; // we won't get here, compiler can't tell
+ }
+
+ private Map<String, Integer> getArrayIndexMap(List<String> l) {
+ Map<String, Integer> m = new HashMap<String, Integer>(l.size());
+ for (int i = 0; i < l.size(); i++) {
+ m.put(l.get(i), Integer.valueOf(i));
+ }
+ return m;
+
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67fc2f53/framework/db/src/com/cloud/utils/db/TransactionLegacy.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/TransactionLegacy.java b/framework/db/src/com/cloud/utils/db/TransactionLegacy.java
index 39893bd..d50118b 100755
--- a/framework/db/src/com/cloud/utils/db/TransactionLegacy.java
+++ b/framework/db/src/com/cloud/utils/db/TransactionLegacy.java
@@ -1034,7 +1034,7 @@ public class TransactionLegacy {
s_dbHAEnabled = Boolean.valueOf(dbProps.getProperty("db.ha.enabled"));
s_logger.info("Is Data Base High Availiability enabled? Ans : " + s_dbHAEnabled);
-
+ String loadBalanceStrategy = dbProps.getProperty("db.ha.loadBalanceStrategy");
// FIXME: If params are missing...default them????
final int cloudMaxActive = Integer.parseInt(dbProps.getProperty("db.cloud.maxActive"));
final int cloudMaxIdle = Integer.parseInt(dbProps.getProperty("db.cloud.maxIdle"));
@@ -1090,7 +1090,7 @@ public class TransactionLegacy {
cloudMaxWait, cloudMaxIdle, cloudTestOnBorrow, false, cloudTimeBtwEvictionRunsMillis, 1, cloudMinEvcitableIdleTimeMillis, cloudTestWhileIdle);
final ConnectionFactory cloudConnectionFactory = new DriverManagerConnectionFactory("jdbc:mysql://" + cloudHost + (s_dbHAEnabled ? "," + cloudSlaves : "") + ":" + cloudPort + "/" + cloudDbName +
- "?autoReconnect=" + cloudAutoReconnect + (url != null ? "&" + url : "") + (useSSL ? "&useSSL=true" : "") + (s_dbHAEnabled ? "&" + cloudDbHAParams : ""), cloudUsername, cloudPassword);
+ "?autoReconnect=" + cloudAutoReconnect + (url != null ? "&" + url : "") + (useSSL ? "&useSSL=true" : "") + (s_dbHAEnabled ? "&" + cloudDbHAParams : "") + (s_dbHAEnabled ? "&loadBalanceStrategy=" + loadBalanceStrategy : ""), cloudUsername, cloudPassword);
final KeyedObjectPoolFactory poolableObjFactory = (cloudPoolPreparedStatements ? new StackKeyedObjectPoolFactory() : null);
@@ -1116,7 +1116,7 @@ public class TransactionLegacy {
usageMaxWait, usageMaxIdle);
final ConnectionFactory usageConnectionFactory = new DriverManagerConnectionFactory("jdbc:mysql://" + usageHost + (s_dbHAEnabled ? "," + dbProps.getProperty("db.cloud.slaves") : "") + ":" + usagePort + "/" + usageDbName +
- "?autoReconnect=" + usageAutoReconnect + (usageUrl != null ? "&" + usageUrl : "") + (s_dbHAEnabled ? "&" + getDBHAParams("usage", dbProps) : ""), usageUsername, usagePassword);
+ "?autoReconnect=" + usageAutoReconnect + (usageUrl != null ? "&" + usageUrl : "") + (s_dbHAEnabled ? "&" + getDBHAParams("usage", dbProps) : "") + (s_dbHAEnabled ? "&loadBalanceStrategy=" + loadBalanceStrategy : ""), usageUsername, usagePassword);
final PoolableConnectionFactory usagePoolableConnectionFactory = new PoolableConnectionFactory(usageConnectionFactory, usageConnectionPool,
new StackKeyedObjectPoolFactory(), null, false, false);
@@ -1129,7 +1129,7 @@ public class TransactionLegacy {
final GenericObjectPool awsapiConnectionPool = new GenericObjectPool(null, usageMaxActive, GenericObjectPool.DEFAULT_WHEN_EXHAUSTED_ACTION,
usageMaxWait, usageMaxIdle);
final ConnectionFactory awsapiConnectionFactory = new DriverManagerConnectionFactory("jdbc:mysql://" + cloudHost + (s_dbHAEnabled ? "," + cloudSlaves : "") + ":" + cloudPort + "/" + awsapiDbName +
- "?autoReconnect=" + cloudAutoReconnect + (s_dbHAEnabled ? "&" + cloudDbHAParams : ""), cloudUsername, cloudPassword);
+ "?autoReconnect=" + cloudAutoReconnect + (s_dbHAEnabled ? "&" + cloudDbHAParams : "") + (s_dbHAEnabled ? "&loadBalanceStrategy=" + loadBalanceStrategy : ""), cloudUsername, cloudPassword);
final PoolableConnectionFactory awsapiPoolableConnectionFactory = new PoolableConnectionFactory(awsapiConnectionFactory, awsapiConnectionPool,
new StackKeyedObjectPoolFactory(), null, false, false);
[44/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-5194: portable ip - Improving cleanup code to
avoid cascading failures
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/67b071be
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/67b071be
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/67b071be
Branch: refs/heads/disk-cache
Commit: 67b071beaac34eb5c4427f120ed3f0d5baabb75b
Parents: 2587e42
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Tue Nov 19 11:18:33 2013 +0530
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Tue Nov 19 11:21:33 2013 +0530
----------------------------------------------------------------------
test/integration/component/test_portable_ip.py | 40 ++++++++++-----------
1 file changed, 18 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67b071be/test/integration/component/test_portable_ip.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_portable_ip.py b/test/integration/component/test_portable_ip.py
index 14b6dac..d397ec4 100644
--- a/test/integration/component/test_portable_ip.py
+++ b/test/integration/component/test_portable_ip.py
@@ -235,8 +235,9 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
self.debug("Trying to create portable ip range with non root-admin api client, should raise exception")
with self.assertRaises(Exception):
- PortablePublicIpRange.create(self.api_client_user,
+ portable_ip_range = PortablePublicIpRange.create(self.api_client_user,
portable_ip_range_services)
+ self.cleanup.append(portable_ip_range)
return
@@ -258,8 +259,9 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
self.debug("Trying to create portable ip range with wrong region id")
with self.assertRaises(Exception):
- PortablePublicIpRange.create(self.apiclient,
+ portable_ip_range = PortablePublicIpRange.create(self.apiclient,
portable_ip_range_services)
+ self.cleanup.append(portable_ip_range)
return
@@ -687,8 +689,6 @@ class TestAssociatePublicIp(cloudstackTestCase):
self.debug("Associated default public ip address: %s" % publicipaddress.ipaddress.ipaddress)
-
-
self.debug("Associating public ip address with network: %s with isportable=False" % self.network.id)
publicipaddressnotportable = PublicIPAddress.create(
self.apiclient,
@@ -727,7 +727,7 @@ class TestAssociatePublicIp(cloudstackTestCase):
self.debug("Trying to associate portable public ip with invalid zone id, this should fail")
with self.assertRaises(Exception):
- PublicIPAddress.create(
+ publicipaddress = PublicIPAddress.create(
self.apiclient,
accountid=self.account.name,
zoneid = -1,
@@ -735,6 +735,7 @@ class TestAssociatePublicIp(cloudstackTestCase):
regionid = self.region.id,
isportable=True
)
+ publicipaddress.delete(self.apiclient)
self.debug("Associating ip address failed")
return
@@ -815,14 +816,15 @@ class TestAssociatePublicIp(cloudstackTestCase):
except Exception as e:
self.fail("Exception while SSHing : %s" % e)
- self.debug("Deleting firewall rule")
- fw_rule.delete(self.apiclient)
+ finally:
+ self.debug("Deleting firewall rule")
+ fw_rule.delete(self.apiclient)
- self.debug("Deleting NAT rule")
- nat_rule.delete(self.apiclient)
+ self.debug("Deleting NAT rule")
+ nat_rule.delete(self.apiclient)
- self.debug("disassocoating portable ip: %s" % portableip.ipaddress.ipaddress)
- portableip.delete(self.apiclient)
+ self.debug("disassocoating portable ip: %s" % portableip.ipaddress.ipaddress)
+ portableip.delete(self.apiclient)
return
@attr(tags=["advanced"])
@@ -858,7 +860,7 @@ class TestAssociatePublicIp(cloudstackTestCase):
self.debug("Trying to associate portable public ip when no free ips available, this should fail")
with self.assertRaises(Exception):
- PublicIPAddress.create(
+ portableipaddress = PublicIPAddress.create(
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
@@ -866,6 +868,7 @@ class TestAssociatePublicIp(cloudstackTestCase):
networkid=self.network.id,
isportable=True
)
+ portableipaddress.delete(self.apiclient)
self.debug("Associating portable ip address failed")
@@ -1338,7 +1341,6 @@ class TestDeleteAccount(cloudstackTestCase):
return
-
class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
"""Test Transfer Portable IP Across Networks
"""
@@ -1390,7 +1392,6 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
cls.services["service_offering"]
)
- cls.debug("creating networks and virtual machines in each network for portable ip transfer tests: ")
cls.network1 = Network.create(
cls.api_client,
cls.services["network1"],
@@ -1538,11 +1539,6 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
except Exception as e:
self.fail("Exception while SSHing : %s" % e)
- self.debug("disassociating portable ip: %s" % portableip.ipaddress.ipaddress)
- portableip.delete(self.apiclient)
-
-
-
-
-
-
+ finally:
+ self.debug("disassociating portable ip: %s" % portableip.ipaddress.ipaddress)
+ portableip.delete(self.apiclient)
[03/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-999: hyper-V: UI > zone wizard > Add Secondary Storage step > add "SMB/cifs" option in Provider dropdown > When Provider is selected as SMB/cifs, show SMB username/password/domain fields and send their values into url parameter of addImageStore API.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/253da8f6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/253da8f6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/253da8f6
Branch: refs/heads/disk-cache
Commit: 253da8f6ba5c88f684cfd154a0baa48c3268a6d8
Parents: 4a8e9f8
Author: Jessica Wang <je...@apache.org>
Authored: Wed Nov 13 15:01:32 2013 -0800
Committer: Jessica Wang <je...@apache.org>
Committed: Wed Nov 13 15:01:59 2013 -0800
----------------------------------------------------------------------
ui/scripts/zoneWizard.js | 120 +++++++++++++++++++++++++++++++++++++++---
1 file changed, 113 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/253da8f6/ui/scripts/zoneWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js
index d8ee41f..c5db0f9 100755
--- a/ui/scripts/zoneWizard.js
+++ b/ui/scripts/zoneWizard.js
@@ -1832,7 +1832,9 @@
provider: {
label: 'Provider',
select: function(args) {
- var storageproviders = [];
+ var storageproviders = [];
+ storageproviders.push({ id: '', description: ''});
+
$.ajax({
url: createURL('listImageStores'),
data: {
@@ -1842,7 +1844,7 @@
success: function(json) {
var s3stores = json.listimagestoresresponse.imagestore;
if(s3stores != null && s3stores.length > 0) {
- storageproviders.push({ id: 'S3', description: 'S3'});
+ storageproviders.push({ id: 'S3', description: 'S3'}); //if (region-wide) S3 store exists already, only "S3" option should be included here. Any other type of store is not allowed to be created since cloudstack doesn't support multiple types of store at this point.
} else {
$.ajax({
url: createURL('listStorageProviders'),
@@ -1851,8 +1853,7 @@
},
async: false,
success: function(json) {
- var objs = json.liststorageprovidersresponse.dataStoreProvider;
- storageproviders.push({ id: '', description: ''});
+ var objs = json.liststorageprovidersresponse.dataStoreProvider;
if (objs != null) {
for (var i = 0; i < objs.length; i++) {
storageproviders.push({
@@ -1863,6 +1864,7 @@
}
}
});
+ storageproviders.push({ id: 'SMB', description: 'SMB/cifs'}); //temporary, before Rajesh adds 'SMB' to listStorageProviders API response.
}
args.response.success({
data: storageproviders
@@ -1880,6 +1882,11 @@
$fields.filter('[rel=nfsServer]').hide();
$fields.filter('[rel=path]').hide();
+ //SMB
+ $fields.filter('[rel=smbUsername]').hide();
+ $fields.filter('[rel=smbPassword]').hide();
+ $fields.filter('[rel=smbDomain]').hide();
+
//S3
$fields.filter('[rel=accesskey]').hide();
$fields.filter('[rel=secretkey]').hide();
@@ -1908,6 +1915,44 @@
$fields.filter('[rel=nfsServer]').css('display', 'inline-block');
$fields.filter('[rel=path]').css('display', 'inline-block');
+ //SMB
+ $fields.filter('[rel=smbUsername]').hide();
+ $fields.filter('[rel=smbPassword]').hide();
+ $fields.filter('[rel=smbDomain]').hide();
+
+ //S3
+ $fields.filter('[rel=accesskey]').hide();
+ $fields.filter('[rel=secretkey]').hide();
+ $fields.filter('[rel=bucket]').hide();
+ $fields.filter('[rel=endpoint]').hide();
+ $fields.filter('[rel=usehttps]').hide();
+ $fields.filter('[rel=connectiontimeout]').hide();
+ $fields.filter('[rel=maxerrorretry]').hide();
+ $fields.filter('[rel=sockettimeout]').hide();
+
+ $fields.filter('[rel=createNfsCache]').hide();
+ $fields.filter('[rel=createNfsCache]').find('input').removeAttr('checked');
+ $fields.filter('[rel=nfsCacheNfsServer]').hide();
+ $fields.filter('[rel=nfsCachePath]').hide();
+
+ //Swift
+ $fields.filter('[rel=url]').hide();
+ $fields.filter('[rel=account]').hide();
+ $fields.filter('[rel=username]').hide();
+ $fields.filter('[rel=key]').hide();
+ } else if ($(this).val() == "SMB") {
+ $fields.filter('[rel=name]').css('display', 'inline-block');
+
+ //NFS
+ $fields.filter('[rel=zoneid]').css('display', 'inline-block');
+ $fields.filter('[rel=nfsServer]').css('display', 'inline-block');
+ $fields.filter('[rel=path]').css('display', 'inline-block');
+
+ //SMB
+ $fields.filter('[rel=smbUsername]').css('display', 'inline-block');
+ $fields.filter('[rel=smbPassword]').css('display', 'inline-block');
+ $fields.filter('[rel=smbDomain]').css('display', 'inline-block');
+
//S3
$fields.filter('[rel=accesskey]').hide();
$fields.filter('[rel=secretkey]').hide();
@@ -1944,6 +1989,11 @@
$fields.filter('[rel=nfsServer]').hide();
$fields.filter('[rel=path]').hide();
+ //SMB
+ $fields.filter('[rel=smbUsername]').hide();
+ $fields.filter('[rel=smbPassword]').hide();
+ $fields.filter('[rel=smbDomain]').hide();
+
//S3
if(s3stores != null && s3stores.length > 0) {
$fields.filter('[rel=accesskey]').hide();
@@ -1983,6 +2033,11 @@
$fields.filter('[rel=nfsServer]').hide();
$fields.filter('[rel=path]').hide();
+ //SMB
+ $fields.filter('[rel=smbUsername]').hide();
+ $fields.filter('[rel=smbPassword]').hide();
+ $fields.filter('[rel=smbDomain]').hide();
+
//S3
$fields.filter('[rel=accesskey]').hide();
$fields.filter('[rel=secretkey]').hide();
@@ -2016,7 +2071,7 @@
isHidden: true
},
- //NFS (begin)
+ //NFS, SMB (begin)
nfsServer: {
label: 'label.nfs.server',
validation: {
@@ -2031,9 +2086,31 @@
},
isHidden: true
},
- //NFS (end)
+ //NFS, SMB (end)
+ //SMB (begin)
+ smbUsername: {
+ label: 'SMB Username',
+ validation: {
+ required: true
+ }
+ },
+ smbPassword: {
+ label: 'SMB Password',
+ isPassword: true,
+ validation: {
+ required: true
+ }
+ },
+ smbDomain: {
+ label: 'SMB Domain',
+ validation: {
+ required: true
+ }
+ },
+ //SMB (end)
+
//S3 (begin)
accesskey: {
label: 'label.s3.access_key',
@@ -4152,7 +4229,36 @@
var url = nfsURL(nfs_server, path);
$.extend(data, {
- provider: 'NFS',
+ provider: args.data.secondaryStorage.provider,
+ zoneid: args.data.returnedZone.id,
+ url: url
+ });
+
+ $.ajax({
+ url: createURL('addImageStore'),
+ data: data,
+ success: function(json) {
+ complete({
+ data: $.extend(args.data, {
+ returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage
+ })
+ });
+ },
+ error: function(XMLHttpResponse) {
+ var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
+ error('addSecondaryStorage', errorMsg, {
+ fn: 'addSecondaryStorage',
+ args: args
+ });
+ }
+ });
+ } else if (args.data.secondaryStorage.provider == 'SMB') {
+ var nfs_server = args.data.secondaryStorage.nfsServer;
+ var path = args.data.secondaryStorage.path;
+ var url = smbURL(nfs_server, path, args.data.secondaryStorage.smbUsername, args.data.secondaryStorage.smbPassword, args.data.secondaryStorage.smbDomain);
+
+ $.extend(data, {
+ provider: args.data.secondaryStorage.provider,
zoneid: args.data.returnedZone.id,
url: url
});
[21/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-5177: Fixed issue with running script from cron job
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7dceca59
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7dceca59
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7dceca59
Branch: refs/heads/disk-cache
Commit: 7dceca5995e18442760fe48f7b3dfbb9955d8d5f
Parents: 9410423
Author: Jayapal <ja...@apache.org>
Authored: Fri Nov 15 12:04:38 2013 +0530
Committer: Jayapal <ja...@apache.org>
Committed: Fri Nov 15 12:05:19 2013 +0530
----------------------------------------------------------------------
.../config/opt/cloud/bin/monitor_service.sh | 2 +-
.../debian/config/root/monitorServices.py | 39 +++++++++-----------
2 files changed, 19 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7dceca59/systemvm/patches/debian/config/opt/cloud/bin/monitor_service.sh
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/monitor_service.sh b/systemvm/patches/debian/config/opt/cloud/bin/monitor_service.sh
index a2b789c..c4d99d2 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/monitor_service.sh
+++ b/systemvm/patches/debian/config/opt/cloud/bin/monitor_service.sh
@@ -64,7 +64,7 @@ crontab -l | grep -v monitorServices.py | crontab -
create_config $config
#add cron job
-(crontab -l ; echo "*/3 * * * * python /root/monitorServices.py") | crontab -
+(crontab -l ;echo -e "SHELL=/bin/bash\nPATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin\n */1 * * * * /usr/bin/python /root/monitorServices.py") | crontab -
unlock_exit 0 $lock $locked
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7dceca59/systemvm/patches/debian/config/root/monitorServices.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/root/monitorServices.py b/systemvm/patches/debian/config/root/monitorServices.py
index f0c2afe..2cec672 100755
--- a/systemvm/patches/debian/config/root/monitorServices.py
+++ b/systemvm/patches/debian/config/root/monitorServices.py
@@ -62,8 +62,13 @@ def getConfig( config_file_path = "/etc/monitor.conf" ):
return process_dict
def printd (msg):
+
return 0
- print msg
+
+ f= open(monitor_log,'r+')
+ f.seek(0, 2)
+ f.write(str(msg)+"\n")
+ f.close()
def raisealert(severity, msg, process_name=None):
#timeStr=str(time.ctime())
@@ -76,12 +81,6 @@ def raisealert(severity, msg, process_name=None):
pout = Popen(msg, shell=True, stdout=PIPE)
- #f= open(monitor_log,'r+')
- #f.seek(0, 2)
- #f.write(str(log))
- #f.close()
-
-
def isPidMatchPidFile(pidfile, pids):
if pids is None or isinstance(pids,list) != True or len(pids) == 0:
@@ -119,7 +118,7 @@ def checkProcessStatus( process ):
service_name = process.get('servicename')
pidfile = process.get('pidfile')
#temp_out = None
- restartFailed=0
+ restartFailed=False
pidFileMatched=1
cmd=''
if process_name is None:
@@ -186,34 +185,32 @@ def checkProcessStatus( process ):
for pid in pids:
cmd = 'kill -9 '+pid;
printd(cmd)
- Popen(cmd, shell=True, stdout=PIPE)
+ Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT)
cmd = 'service ' + service_name + ' restart'
- try:
- time.sleep(1)
- return_val= check_call(cmd , shell=True)
- except CalledProcessError:
- restartFailed=1
- msg="service "+ process_name +" restart failed"
- printd(msg)
- continue
+
+ time.sleep(1)
+ #return_val= check_call(cmd , shell=True)
+
+ cout = Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT)
+ return_val = cout.wait()
if return_val == 0:
printd("The process" + process_name +" recovered successfully ")
msg="The process " +process_name+" is recovered successfully "
- raisealert(log.INFO,process_name,msg)
+ raisealert(log.INFO,msg,process_name)
break;
else:
#retry restarting the process for few tries
printd("process restart failing trying again ....")
- restartFailed=1
+ restartFailed=True
time.sleep(1)
continue
#for end here
- if restartFailed == 1:
- msg="The process %s recover failed ", process_name;
+ if restartFailed == True:
+ msg="The process %s recover failed "%process_name
raisealert(log.ALERT,process_name,msg)
printd("Restart failed after number of retries")
[45/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
Adding protocol parameter to loadbalancer response
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/481af07f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/481af07f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/481af07f
Branch: refs/heads/disk-cache
Commit: 481af07fb130d24490efe6a98970cb13104e4046
Parents: 67b071b
Author: Syed Ahmed <sa...@cloudops.com>
Authored: Tue Nov 19 22:10:22 2013 +0530
Committer: Murali Reddy <mu...@gmail.com>
Committed: Tue Nov 19 22:12:44 2013 +0530
----------------------------------------------------------------------
api/src/com/cloud/network/rules/LoadBalancer.java | 1 +
.../com/cloud/network/rules/LoadBalancerContainer.java | 2 ++
.../cloudstack/api/response/LoadBalancerResponse.java | 8 ++++++++
.../cloudstack/lb/ApplicationLoadBalancerRuleVO.java | 11 +++++++++++
server/src/com/cloud/api/ApiResponseHelper.java | 1 +
5 files changed, 23 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/481af07f/api/src/com/cloud/network/rules/LoadBalancer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/rules/LoadBalancer.java b/api/src/com/cloud/network/rules/LoadBalancer.java
index e6dadca..c260b81 100644
--- a/api/src/com/cloud/network/rules/LoadBalancer.java
+++ b/api/src/com/cloud/network/rules/LoadBalancer.java
@@ -25,4 +25,5 @@ public interface LoadBalancer extends FirewallRule, LoadBalancerContainer {
int getDefaultPortEnd();
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/481af07f/api/src/com/cloud/network/rules/LoadBalancerContainer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/rules/LoadBalancerContainer.java b/api/src/com/cloud/network/rules/LoadBalancerContainer.java
index 9d5ea59..c75d0cc 100644
--- a/api/src/com/cloud/network/rules/LoadBalancerContainer.java
+++ b/api/src/com/cloud/network/rules/LoadBalancerContainer.java
@@ -27,6 +27,8 @@ public interface LoadBalancerContainer {
String getDescription();
String getAlgorithm();
+
+ String getLbProtocol();
Scheme getScheme();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/481af07f/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java b/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
index 0f18097..39650d3 100644
--- a/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
@@ -91,6 +91,11 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
@Param(description = "the id of the zone the rule belongs to")
private String zoneId;
+ @SerializedName(ApiConstants.PROTOCOL)
+ @Param(description = "the protocol of the loadbalanacer rule")
+ private String lbProtocol;
+
+
@SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with load balancer", responseObject = ResourceTagResponse.class)
private List<ResourceTagResponse> tags;
@@ -170,4 +175,7 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
this.networkId = networkId;
}
+ public void setLbProtocol(String lbProtocol) {
+ this.lbProtocol = lbProtocol;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/481af07f/engine/schema/src/org/apache/cloudstack/lb/ApplicationLoadBalancerRuleVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/lb/ApplicationLoadBalancerRuleVO.java b/engine/schema/src/org/apache/cloudstack/lb/ApplicationLoadBalancerRuleVO.java
index 37a747e..7bb7293 100644
--- a/engine/schema/src/org/apache/cloudstack/lb/ApplicationLoadBalancerRuleVO.java
+++ b/engine/schema/src/org/apache/cloudstack/lb/ApplicationLoadBalancerRuleVO.java
@@ -58,6 +58,10 @@ public class ApplicationLoadBalancerRuleVO extends FirewallRuleVO implements App
@Column(name="source_ip_address_network_id")
Long sourceIpNetworkId;
+
+ @Column(name="lb_protocol")
+ String lbProtocol;
+
@Column(name="source_ip_address")
@Enumerated(value=EnumType.STRING)
@@ -112,6 +116,11 @@ public class ApplicationLoadBalancerRuleVO extends FirewallRuleVO implements App
}
@Override
+ public String getLbProtocol() {
+ return lbProtocol;
+ }
+
+ @Override
public int getDefaultPortStart() {
return defaultPortStart;
}
@@ -130,4 +139,6 @@ public class ApplicationLoadBalancerRuleVO extends FirewallRuleVO implements App
public int getInstancePort() {
return defaultPortStart;
}
+
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/481af07f/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index 903c485..b74ebf1 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -748,6 +748,7 @@ public class ApiResponseHelper implements ResponseGenerator {
lbResponse.setPublicPort(Integer.toString(loadBalancer.getSourcePortStart()));
lbResponse.setPrivatePort(Integer.toString(loadBalancer.getDefaultPortStart()));
lbResponse.setAlgorithm(loadBalancer.getAlgorithm());
+ lbResponse.setLbProtocol(loadBalancer.getLbProtocol());
FirewallRule.State state = loadBalancer.getState();
String stateToSet = state.toString();
if (state.equals(FirewallRule.State.Revoke)) {
[27/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-2243: base_image_updation - Adding tags to test cases
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/09c0370d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/09c0370d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/09c0370d
Branch: refs/heads/disk-cache
Commit: 09c0370d70721e07ff02cd907a2cab2cabc9ae5b
Parents: 8a1918d
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Fri Nov 15 16:53:33 2013 +0530
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Fri Nov 15 16:53:33 2013 +0530
----------------------------------------------------------------------
test/integration/component/test_base_image_updation.py | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/09c0370d/test/integration/component/test_base_image_updation.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_base_image_updation.py b/test/integration/component/test_base_image_updation.py
index 8a99350..b70bea5 100644
--- a/test/integration/component/test_base_image_updation.py
+++ b/test/integration/component/test_base_image_updation.py
@@ -281,6 +281,7 @@ class TestBaseImageUpdate(cloudstackTestCase):
return
+ @attr(tags=["advanced", "basic"])
def test_01_deploy_instance_with_is_volatile_offering(self):
""" Test deploy an instance with service offerings with IsVolatile set.
"""
@@ -311,6 +312,7 @@ class TestBaseImageUpdate(cloudstackTestCase):
)
return
+ @attr(tags=["advanced", "basic"])
def test_02_reboot_instance_with_is_volatile_offering(self):
""" Test rebooting instances created with isVolatile service offerings
"""
@@ -388,6 +390,7 @@ class TestBaseImageUpdate(cloudstackTestCase):
return
+ @attr(tags=["advanced", "basic"])
def test_03_restore_vm_with_new_template(self):
""" Test restoring a vm with different template than the one it was created with
"""
@@ -503,6 +506,7 @@ class TestBaseImageUpdate(cloudstackTestCase):
return
+ @attr(tags=["advanced", "basic"])
def test_04_reoccuring_snapshot_rules(self):
"""
1) Create a VM using the Service offering IsVolatile enabled
[35/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
StoragePoolResponse.getId() returns a String with an UUID
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1ece5f0c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1ece5f0c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1ece5f0c
Branch: refs/heads/disk-cache
Commit: 1ece5f0c28b90705917a448048a9a9232eb89b8a
Parents: bb8f8fb
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Mon Nov 18 14:26:24 2013 +0100
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Mon Nov 18 14:27:06 2013 +0100
----------------------------------------------------------------------
.../com/cloud/api/query/QueryManagerImpl.java | 70 +++++++++-----------
1 file changed, 33 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1ece5f0c/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 036b9bb..36fab21 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -26,8 +26,9 @@ import java.util.Set;
import javax.ejb.Local;
import javax.inject.Inject;
-import com.cloud.hypervisor.Hypervisor;
-import com.cloud.storage.DiskOfferingVO;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
import org.apache.cloudstack.affinity.AffinityGroupDomainMapVO;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
@@ -89,8 +90,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateState;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.query.QueryService;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
import com.cloud.api.query.dao.AccountJoinDao;
import com.cloud.api.query.dao.AffinityGroupJoinDao;
@@ -144,6 +143,7 @@ import com.cloud.exception.CloudAuthenticationException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.ha.HighAvailabilityManager;
+import com.cloud.hypervisor.Hypervisor;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.network.dao.NetworkDetailsDao;
import com.cloud.network.security.SecurityGroupVMMapVO;
@@ -164,6 +164,7 @@ import com.cloud.server.TaggedResourceService;
import com.cloud.service.ServiceOfferingVO;
import com.cloud.service.dao.ServiceOfferingDao;
import com.cloud.storage.DataStoreRole;
+import com.cloud.storage.DiskOfferingVO;
import com.cloud.storage.ScopeType;
import com.cloud.storage.Storage;
import com.cloud.storage.Storage.ImageFormat;
@@ -177,7 +178,6 @@ import com.cloud.tags.dao.ResourceTagDao;
import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
import com.cloud.user.Account;
import com.cloud.user.AccountManager;
-import com.cloud.user.AccountVO;
import com.cloud.user.DomainManager;
import com.cloud.user.dao.AccountDao;
import com.cloud.utils.DateUtil;
@@ -342,7 +342,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
@Inject
NetworkDetailsDao _networkDetailsDao;
-
+
@Inject
ResourceTagDao _resourceTagDao;
@Inject
@@ -359,7 +359,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
public ListResponse<UserResponse> searchForUsers(ListUsersCmd cmd) throws PermissionDeniedException {
Pair<List<UserAccountJoinVO>, Integer> result = searchForUsersInternal(cmd);
ListResponse<UserResponse> response = new ListResponse<UserResponse>();
- List<UserResponse> userResponses = ViewResponseHelper.createUserResponse(CallContext.current().getCallingAccount().getDomainId(),
+ List<UserResponse> userResponses = ViewResponseHelper.createUserResponse(CallContext.current().getCallingAccount().getDomainId(),
result.first().toArray(new UserAccountJoinVO[result.first().size()]));
response.setResponses(userResponses, result.second());
return response;
@@ -1267,7 +1267,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
Long pageSize = cmd.getPageSizeVal();
boolean listAll = cmd.listAll();
boolean isRecursive = cmd.isRecursive();
- Map<String, String> tags = cmd.getTags();
+ cmd.getTags();
Account caller = CallContext.current().getCallingAccount();
Long accountId = null;
@@ -1499,7 +1499,6 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
sb.and("accountRole", sb.entity().getAccountRole(), Op.EQ);
sb.and("projectId", sb.entity().getProjectId(), Op.EQ);
- SearchBuilder<AccountVO> accountSearch;
if (accountName != null) {
sb.and("accountName", sb.entity().getAccountName(), Op.EQ);
}
@@ -1758,7 +1757,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
if (podId != null) {
sc.setParameters("podId", podId);
}
-
+
if (storageId != null) {
sc.setParameters("storageId", storageId);
}
@@ -1945,7 +1944,6 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
Filter searchFilter = new Filter(AsyncJobJoinVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());
SearchBuilder<AsyncJobJoinVO> sb = _jobJoinDao.createSearchBuilder();
sb.and("accountIdIN", sb.entity().getAccountId(), SearchCriteria.Op.IN);
- SearchBuilder<AccountVO> accountSearch = null;
boolean accountJoinIsDone = false;
if (permittedAccounts.isEmpty() && domainId != null) {
sb.and("domainId", sb.entity().getDomainId(), SearchCriteria.Op.EQ);
@@ -2005,7 +2003,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
List<StoragePoolResponse> poolResponses = ViewResponseHelper.createStoragePoolResponse(result.first().toArray(
new StoragePoolJoinVO[result.first().size()]));
for(StoragePoolResponse poolResponse : poolResponses) {
- DataStore store = dataStoreManager.getPrimaryDataStore(Integer.parseInt(poolResponse.getId()));
+ DataStore store = dataStoreManager.getPrimaryDataStore(poolResponse.getId());
if (store != null) {
DataStoreDriver driver = store.getDriver();
if (driver != null && driver.getCapabilities() != null) {
@@ -2420,7 +2418,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
isAscending = (isAscending == null ? true : isAscending);
Filter searchFilter = new Filter(ServiceOfferingJoinVO.class, "sortKey", isAscending, cmd.getStartIndex(),
cmd.getPageSizeVal());
-
+
Account caller = CallContext.current().getCallingAccount();
Object name = cmd.getServiceOfferingName();
Object id = cmd.getId();
@@ -2429,7 +2427,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
Long domainId = cmd.getDomainId();
Boolean isSystem = cmd.getIsSystem();
String vmTypeStr = cmd.getSystemVmType();
-
+
SearchCriteria<ServiceOfferingJoinVO> sc = _srvOfferingJoinDao.createSearchCriteria();
if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN && isSystem) {
@@ -2480,18 +2478,18 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
List<Long> domainIds = new ArrayList<Long>();
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);
- }
+ 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());
- }
+ 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) {
@@ -2562,7 +2560,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
String name = cmd.getName();
String networkType = cmd.getNetworkType();
Map<String, String> resourceTags = cmd.getTags();
-
+
SearchBuilder<DataCenterJoinVO> sb = _dcJoinDao.createSearchBuilder();
if (resourceTags != null && !resourceTags.isEmpty()) {
SearchBuilder<ResourceTagVO> tagSearch = _resourceTagDao.createSearchBuilder();
@@ -2575,7 +2573,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
sb.groupBy(sb.entity().getId());
sb.join("tagSearch", tagSearch, sb.entity().getId(), tagSearch.entity().getResourceId(), JoinBuilder.JoinType.INNER);
}
-
+
Filter searchFilter = new Filter(DataCenterJoinVO.class, null, false, cmd.getStartIndex(), cmd.getPageSizeVal());
SearchCriteria<DataCenterJoinVO> sc = sb.create();
@@ -2726,7 +2724,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
}
}
}
-
+
if (resourceTags != null && !resourceTags.isEmpty()) {
int count = 0;
sc.setJoinParameters("tagSearch", "resourceType", ResourceObjectType.Zone.toString());
@@ -2923,7 +2921,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
}
// get all child domain ID's
- if (_accountMgr.isAdmin(account.getType())
+ if (_accountMgr.isAdmin(account.getType())
|| (templateFilter == TemplateFilter.featured || templateFilter == TemplateFilter.community)) {
List<DomainVO> allChildDomains = _domainDao.findAllChildren(accountDomain.getPath(),
accountDomain.getId());
@@ -2980,7 +2978,6 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
// add tags criteria
if (tags != null && !tags.isEmpty()) {
SearchCriteria<TemplateJoinVO> scc = _templateJoinDao.createSearchCriteria();
- int count = 0;
for (String key : tags.keySet()) {
SearchCriteria<TemplateJoinVO> scTag = _templateJoinDao.createSearchCriteria();
scTag.addAnd("tagKey", SearchCriteria.Op.EQ, key);
@@ -2991,7 +2988,6 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
scTag.addAnd("tagResourceType", SearchCriteria.Op.EQ, ResourceObjectType.Template);
}
scc.addOr("tagKey", SearchCriteria.Op.SC, scTag);
- count++;
}
sc.addAnd("tagKey", SearchCriteria.Op.SC, scc);
}
@@ -3140,7 +3136,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
Account caller = CallContext.current().getCallingAccount();
- Long accountId = caller.getAccountId();
+ caller.getAccountId();
if (vmId != null) {
UserVmVO userVM = _userVmDao.findById(vmId);
@@ -3164,7 +3160,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
Filter searchFilter = new Filter(AffinityGroupJoinVO.class, "id", true, startIndex, pageSize);
SearchCriteria<AffinityGroupJoinVO> sc = buildAffinityGroupSearchCriteria(domainId, isRecursive,
permittedAccounts, listProjectResourcesCriteria, affinityGroupId, affinityGroupName, affinityGroupType);
-
+
Pair<List<AffinityGroupJoinVO>, Integer> uniqueGroupsPair = _affinityGroupJoinDao.searchAndCount(sc,
searchFilter);
// search group details by ids
@@ -3307,7 +3303,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
ResourceTag.ResourceObjectType resourceType = cmd.getResourceType();
String resourceIdStr = cmd.getResourceId();
long resourceId = _taggedResourceMgr.getResourceId(resourceIdStr, resourceType);
- List<? extends ResourceDetail> detailList = new ArrayList<ResourceDetail>();
+ List<? extends ResourceDetail> detailList = new ArrayList<ResourceDetail>();
ResourceDetail requestedDetail = null;
if (key == null) {
@@ -3318,7 +3314,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
requestedDetail = null;
}
}
-
+
List<ResourceDetailResponse> responseList = new ArrayList<ResourceDetailResponse>();
if (requestedDetail != null) {
ResourceDetailResponse detailResponse = createResourceDetailsResponse(requestedDetail, resourceType);
@@ -3329,11 +3325,11 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
responseList.add(detailResponse);
}
}
-
+
return responseList;
}
-
+
protected ResourceDetailResponse createResourceDetailsResponse(ResourceDetail requestedDetail, ResourceTag.ResourceObjectType resourceType) {
ResourceDetailResponse resourceDetailResponse = new ResourceDetailResponse();
resourceDetailResponse.setResourceId(String.valueOf(requestedDetail.getResourceId()));
[50/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-1302: Allow a cache mode per disk offering
Per disk offering the setting none, writeback or writethrough can be set
This allows for both safety and performance for writes.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6f3e4d35
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6f3e4d35
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6f3e4d35
Branch: refs/heads/disk-cache
Commit: 6f3e4d3592fa4b9889a1b0d6c108a07dc47a20ca
Parents: 8321ea4
Author: Wido den Hollander <wi...@widodh.nl>
Authored: Thu Aug 1 16:49:15 2013 +0200
Committer: Wido den Hollander <wi...@widodh.nl>
Committed: Wed Nov 20 14:17:03 2013 +0100
----------------------------------------------------------------------
api/src/com/cloud/agent/api/to/VolumeTO.java | 9 +++++
api/src/com/cloud/offering/DiskOffering.java | 19 +++++++++++
api/src/com/cloud/vm/DiskProfile.java | 9 +++++
.../api/response/DiskOfferingResponse.java | 11 ++++++
.../classes/resources/messages.properties | 1 +
.../cloud/agent/api/AttachVolumeCommand.java | 9 +++++
.../cloudstack/storage/to/VolumeObjectTO.java | 10 ++++++
.../subsystem/api/storage/VolumeInfo.java | 3 ++
.../src/com/cloud/storage/DiskOfferingVO.java | 36 +++++++++++++++++++-
.../cloudstack/storage/volume/VolumeObject.java | 10 ++++++
.../kvm/resource/LibvirtComputingResource.java | 13 +++++--
.../kvm/resource/LibvirtDomainXMLParser.java | 8 ++++-
.../hypervisor/kvm/resource/LibvirtVMDef.java | 24 ++++++++++++-
.../api/query/dao/DiskOfferingJoinDaoImpl.java | 1 +
.../cloud/api/query/vo/DiskOfferingJoinVO.java | 15 ++++++++
ui/dictionary.jsp | 1 +
ui/scripts/configuration.js | 26 ++++++++++++++
ui/scripts/docs.js | 3 ++
18 files changed, 203 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f3e4d35/api/src/com/cloud/agent/api/to/VolumeTO.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/to/VolumeTO.java b/api/src/com/cloud/agent/api/to/VolumeTO.java
index fb08384..4dec4d8 100644
--- a/api/src/com/cloud/agent/api/to/VolumeTO.java
+++ b/api/src/com/cloud/agent/api/to/VolumeTO.java
@@ -41,6 +41,7 @@ public class VolumeTO implements InternalIdentity {
private Long bytesWriteRate;
private Long iopsReadRate;
private Long iopsWriteRate;
+ private String cacheMode;
private Long chainSize;
public VolumeTO(long id, Volume.Type type, StoragePoolType poolType, String poolUuid, String name, String mountPoint, String path, long size, String chainInfo) {
@@ -176,6 +177,14 @@ public class VolumeTO implements InternalIdentity {
return iopsWriteRate;
}
+ public void setCacheMode(String cacheMode) {
+ this.cacheMode = cacheMode;
+ }
+
+ public String getCacheMode() {
+ return cacheMode;
+ }
+
public Long getChainSize() {
return chainSize;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f3e4d35/api/src/com/cloud/offering/DiskOffering.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/offering/DiskOffering.java b/api/src/com/cloud/offering/DiskOffering.java
index fa6d66b..31bcfb3 100644
--- a/api/src/com/cloud/offering/DiskOffering.java
+++ b/api/src/com/cloud/offering/DiskOffering.java
@@ -35,6 +35,21 @@ public interface DiskOffering extends InfrastructureEntity, Identity, InternalId
State getState();
+ public enum DiskCacheMode {
+ NONE("none"), WRITEBACK("writeback"), WRITETHROUGH("writethrough");
+
+ private final String _diskCacheMode;
+
+ DiskCacheMode(String cacheMode) {
+ _diskCacheMode = cacheMode;
+ }
+
+ @Override
+ public String toString() {
+ return _diskCacheMode;
+ }
+ };
+
String getUniqueName();
boolean getUseLocalStorage();
@@ -92,4 +107,8 @@ public interface DiskOffering extends InfrastructureEntity, Identity, InternalId
void setHypervisorSnapshotReserve(Integer hypervisorSnapshotReserve);
Integer getHypervisorSnapshotReserve();
+
+ DiskCacheMode getCacheMode();
+
+ void setCacheMode(DiskCacheMode cacheMode);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f3e4d35/api/src/com/cloud/vm/DiskProfile.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/DiskProfile.java b/api/src/com/cloud/vm/DiskProfile.java
index 3d4c9e7..4412e3f 100644
--- a/api/src/com/cloud/vm/DiskProfile.java
+++ b/api/src/com/cloud/vm/DiskProfile.java
@@ -39,6 +39,7 @@ public class DiskProfile {
private Long bytesWriteRate;
private Long iopsReadRate;
private Long iopsWriteRate;
+ private String cacheMode;
private HypervisorType hyperType;
@@ -190,4 +191,12 @@ public class DiskProfile {
public Long getIopsWriteRate() {
return iopsWriteRate;
}
+
+ public void setCacheMode(String cacheMode) {
+ this.cacheMode = cacheMode;
+ }
+
+ public String getCacheMode() {
+ return cacheMode;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f3e4d35/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java b/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
index 4291d85..8649890 100644
--- a/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
@@ -79,6 +79,9 @@ public class DiskOfferingResponse extends BaseResponse {
@SerializedName("diskIopsWriteRate") @Param(description="io requests write rate of the disk offering")
private Long iopsWriteRate;
+ @SerializedName("cacheMode") @Param(description="the cache mode to use for this disk offering. none, writeback or writethrough")
+ private String cacheMode;
+
@SerializedName("displayoffering") @Param(description="whether to display the offering to the end user or not.")
private Boolean displayOffering;
@@ -187,6 +190,14 @@ public class DiskOfferingResponse extends BaseResponse {
this.maxIops = maxIops;
}
+ public String getCacheMode() {
+ return this.cacheMode;
+ }
+
+ public void setCacheMode(String cacheMode) {
+ this.cacheMode = cacheMode;
+ }
+
public String getStorageType() {
return storageType;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f3e4d35/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 5885bd0..b870e7f 100644
--- a/client/WEB-INF/classes/resources/messages.properties
+++ b/client/WEB-INF/classes/resources/messages.properties
@@ -1096,6 +1096,7 @@ label.storage.tags=Storage Tags
label.storage.traffic=Storage Traffic
label.storage.type=Storage Type
label.qos.type=QoS Type
+label.cache.mode=Write-cache Type
label.storage=Storage
label.subdomain.access=Subdomain Access
label.submit=Submit
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f3e4d35/core/src/com/cloud/agent/api/AttachVolumeCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/AttachVolumeCommand.java b/core/src/com/cloud/agent/api/AttachVolumeCommand.java
index e927619..e879897 100644
--- a/core/src/com/cloud/agent/api/AttachVolumeCommand.java
+++ b/core/src/com/cloud/agent/api/AttachVolumeCommand.java
@@ -40,6 +40,7 @@ public class AttachVolumeCommand extends Command {
private Long bytesWriteRate;
private Long iopsReadRate;
private Long iopsWriteRate;
+ private String cacheMode;
protected AttachVolumeCommand() {
}
@@ -202,4 +203,12 @@ public class AttachVolumeCommand extends Command {
public Long getIopsWriteRate() {
return iopsWriteRate;
}
+
+ public void setCacheMode(String cacheMode) {
+ this.cacheMode = cacheMode;
+ }
+
+ public String getCacheMode() {
+ return cacheMode;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f3e4d35/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
----------------------------------------------------------------------
diff --git a/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java b/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
index 46659a3..732fa7b 100644
--- a/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
+++ b/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
@@ -17,6 +17,7 @@
package org.apache.cloudstack.storage.to;
import com.cloud.hypervisor.Hypervisor;
+import com.cloud.offering.DiskOffering.DiskCacheMode;
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
import com.cloud.agent.api.to.DataObjectType;
@@ -44,6 +45,7 @@ public class VolumeObjectTO implements DataTO {
private Long bytesWriteRate;
private Long iopsReadRate;
private Long iopsWriteRate;
+ private DiskCacheMode cacheMode;
private Hypervisor.HypervisorType hypervisorType;
public VolumeObjectTO() {
@@ -71,6 +73,7 @@ public class VolumeObjectTO implements DataTO {
this.bytesWriteRate = volume.getBytesWriteRate();
this.iopsReadRate = volume.getIopsReadRate();
this.iopsWriteRate = volume.getIopsWriteRate();
+ this.cacheMode = volume.getCacheMode();
this.hypervisorType = volume.getHypervisorType();
setDeviceId(volume.getDeviceId());
}
@@ -231,5 +234,12 @@ public class VolumeObjectTO implements DataTO {
this.deviceId = deviceId;
}
+ public void setCacheMode(DiskCacheMode cacheMode) {
+ this.cacheMode = cacheMode;
+ }
+
+ public DiskCacheMode getCacheMode() {
+ return cacheMode;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f3e4d35/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java
index 3b4aba9..a7dbf79 100644
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java
@@ -20,6 +20,7 @@ package org.apache.cloudstack.engine.subsystem.api.storage;
import com.cloud.agent.api.Answer;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.offering.DiskOffering.DiskCacheMode;
import com.cloud.storage.Volume;
public interface VolumeInfo extends DataObject, Volume {
@@ -45,4 +46,6 @@ public interface VolumeInfo extends DataObject, Volume {
Long getBytesWriteRate();
Long getIopsReadRate();
Long getIopsWriteRate();
+
+ DiskCacheMode getCacheMode();
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f3e4d35/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/DiskOfferingVO.java b/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
index b5b3451..5960df4 100755
--- a/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
+++ b/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
@@ -24,8 +24,8 @@ import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
-import javax.persistence.EnumType;
import javax.persistence.Enumerated;
+import javax.persistence.EnumType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@@ -37,7 +37,9 @@ import javax.persistence.TemporalType;
import javax.persistence.Transient;
import com.cloud.offering.DiskOffering;
+import com.cloud.offering.DiskOffering.DiskCacheMode;
import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.Identity;
@Entity
@Table(name = "disk_offering")
@@ -120,6 +122,10 @@ public class DiskOfferingVO implements DiskOffering {
@Column(name="iops_write_rate")
Long iopsWriteRate;
+ @Column(name="cache_mode", updatable = true, nullable=false)
+ @Enumerated(value=EnumType.STRING)
+ private DiskCacheMode cacheMode;
+
@Column(name="display_offering")
boolean displayOffering = true;
@@ -135,6 +141,24 @@ public class DiskOfferingVO implements DiskOffering {
}
public DiskOfferingVO(Long domainId, String name, String displayText, long diskSize, String tags, boolean isCustomized,
+ Boolean isCustomizedIops, Long minIops, Long maxIops, DiskCacheMode cacheMode) {
+ this.domainId = domainId;
+ this.name = name;
+ this.displayText = displayText;
+ this.diskSize = diskSize;
+ this.tags = tags;
+ this.recreatable = false;
+ this.type = Type.Disk;
+ this.useLocalStorage = false;
+ this.customized = isCustomized;
+ this.uuid = UUID.randomUUID().toString();
+ this.customizedIops = isCustomizedIops;
+ this.minIops = minIops;
+ this.maxIops = maxIops;
+ this.cacheMode = cacheMode;
+ }
+
+ public DiskOfferingVO(Long domainId, String name, String displayText, long diskSize, String tags, boolean isCustomized,
Boolean isCustomizedIops, Long minIops, Long maxIops) {
this.domainId = domainId;
this.name = name;
@@ -237,6 +261,16 @@ public class DiskOfferingVO implements DiskOffering {
this.maxIops = maxIops;
}
+ @Override
+ public DiskCacheMode getCacheMode() {
+ return cacheMode;
+ }
+
+ @Override
+ public void setCacheMode(DiskCacheMode cacheMode) {
+ this.cacheMode = cacheMode;
+ }
+
@Override
public String getUniqueName() {
return uniqueName;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f3e4d35/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
index f761a0c..cec76c0 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
@@ -39,6 +39,7 @@ import com.cloud.agent.api.storage.DownloadAnswer;
import com.cloud.agent.api.to.DataObjectType;
import com.cloud.agent.api.to.DataTO;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.offering.DiskOffering.DiskCacheMode;
import com.cloud.storage.DataStoreRole;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.Volume;
@@ -214,6 +215,15 @@ public class VolumeObject implements VolumeInfo {
return null;
}
+ @Override
+ public DiskCacheMode getCacheMode() {
+ DiskOfferingVO diskOfferingVO = getDiskOfferingVO();
+ if (diskOfferingVO != null) {
+ return diskOfferingVO.getCacheMode();
+ }
+ return null;
+ }
+
public void update() {
volumeDao.update(volumeVO.getId(), volumeVO);
volumeVO = volumeDao.findById(volumeVO.getId());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f3e4d35/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
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 50561a9..0000bef 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
@@ -193,6 +193,7 @@ import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.CpuTuneDef;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DevicesDef;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef.diskProtocol;
+import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef.diskCacheMode;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.FeaturesDef;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.FilesystemDef;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.GraphicDef;
@@ -1510,6 +1511,7 @@ ServerResource {
volume.setBytesWriteRate(dskch.getBytesWriteRate());
volume.setIopsReadRate(dskch.getIopsReadRate());
volume.setIopsWriteRate(dskch.getIopsWriteRate());
+ volume.setCacheMode(dskch.getCacheMode());
return new CreateAnswer(cmd, volume);
} catch (CloudRuntimeException e) {
s_logger.debug("Failed to create volume: " + e.toString());
@@ -2815,7 +2817,8 @@ ServerResource {
cmd.getPoolUuid());
KVMPhysicalDisk disk = primary.getPhysicalDisk(cmd.getVolumePath());
attachOrDetachDisk(conn, cmd.getAttach(), cmd.getVmName(), disk,
- cmd.getDeviceId().intValue(), cmd.getBytesReadRate(), cmd.getBytesWriteRate(), cmd.getIopsReadRate(), cmd.getIopsWriteRate());
+ cmd.getDeviceId().intValue(), cmd.getBytesReadRate(), cmd.getBytesWriteRate(), cmd.getIopsReadRate(), cmd.getIopsWriteRate(),
+ cmd.getCacheMode());
} catch (LibvirtException e) {
return new AttachVolumeAnswer(cmd, e.toString());
} catch (InternalErrorException e) {
@@ -3775,6 +3778,8 @@ ServerResource {
disk.setIopsReadRate(volumeObjectTO.getIopsReadRate());
if ((volumeObjectTO.getIopsWriteRate() != null) && (volumeObjectTO.getIopsWriteRate() > 0))
disk.setIopsWriteRate(volumeObjectTO.getIopsWriteRate());
+ if (volumeObjectTO.getCacheMode() != null)
+ disk.setCacheMode(DiskDef.diskCacheMode.valueOf(volumeObjectTO.getCacheMode().toString()));
}
vm.getDevices().addDevice(disk);
}
@@ -3886,7 +3891,7 @@ ServerResource {
protected synchronized String attachOrDetachDisk(Connect conn,
boolean attach, String vmName, KVMPhysicalDisk attachingDisk,
- int devId, Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate) throws LibvirtException, InternalErrorException {
+ int devId, Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate, String cacheMode) throws LibvirtException, InternalErrorException {
List<DiskDef> disks = null;
Domain dm = null;
DiskDef diskdef = null;
@@ -3934,6 +3939,10 @@ ServerResource {
diskdef.setIopsReadRate(iopsReadRate);
if ((iopsWriteRate != null) && (iopsWriteRate > 0))
diskdef.setIopsWriteRate(iopsWriteRate);
+
+ if (cacheMode != null) {
+ diskdef.setCacheMode(DiskDef.diskCacheMode.valueOf(cacheMode));
+ }
}
String xml = diskdef.toString();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f3e4d35/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
index a283768..d0b0b61 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
@@ -36,6 +36,7 @@ import org.xml.sax.SAXException;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef.diskProtocol;
+import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef.diskCacheMode;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef.nicModel;
@@ -69,6 +70,7 @@ public class LibvirtDomainXMLParser {
DiskDef def = new DiskDef();
if (type.equalsIgnoreCase("network")) {
String diskFmtType = getAttrValue("driver", "type", disk);
+ String diskCacheMode = getAttrValue("driver", "cache", disk);
String diskPath = getAttrValue("source", "name", disk);
String protocol = getAttrValue("source", "protocol", disk);
String authUserName = getAttrValue("auth", "username", disk);
@@ -78,9 +80,12 @@ public class LibvirtDomainXMLParser {
String diskLabel = getAttrValue("target", "dev", disk);
String bus = getAttrValue("target", "bus", disk);
def.defNetworkBasedDisk(diskPath, host, port, authUserName, poolUuid, diskLabel,
- DiskDef.diskBus.valueOf(bus.toUpperCase()), DiskDef.diskProtocol.valueOf(protocol.toUpperCase()));
+ DiskDef.diskBus.valueOf(bus.toUpperCase()),
+ DiskDef.diskProtocol.valueOf(protocol.toUpperCase()));
+ def.setCacheMode(DiskDef.diskCacheMode.valueOf(diskCacheMode));
} else {
String diskFmtType = getAttrValue("driver", "type", disk);
+ String diskCacheMode = getAttrValue("driver", "cache", disk);
String diskFile = getAttrValue("source", "file", disk);
String diskDev = getAttrValue("source", "dev", disk);
@@ -103,6 +108,7 @@ public class LibvirtDomainXMLParser {
} else if (type.equalsIgnoreCase("block")) {
def.defBlockBasedDisk(diskDev, diskLabel,
DiskDef.diskBus.valueOf(bus.toUpperCase()));
+ def.setCacheMode(DiskDef.diskCacheMode.valueOf(diskCacheMode));
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f3e4d35/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
index 6aaabc5..80dbb23 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
@@ -427,6 +427,23 @@ public class LibvirtVMDef {
}
}
+ public enum diskCacheMode {
+ NONE("none"), WRITEBACK("writeback"), WRITETHROUGH("writethrough");
+ String _diskCacheMode;
+
+ diskCacheMode(String cacheMode) {
+ _diskCacheMode = cacheMode;
+ }
+
+ @Override
+ public String toString() {
+ if (_diskCacheMode == null) {
+ return "none";
+ }
+ return _diskCacheMode;
+ }
+ }
+
private deviceType _deviceType; /* floppy, disk, cdrom */
private diskType _diskType;
private diskProtocol _diskProtocol;
@@ -445,6 +462,7 @@ public class LibvirtVMDef {
private Long _bytesWriteRate;
private Long _iopsReadRate;
private Long _iopsWriteRate;
+ private diskCacheMode _diskCacheMode;
public void setDeviceType(deviceType deviceType) {
_deviceType = deviceType;
@@ -606,6 +624,10 @@ public class LibvirtVMDef {
_iopsWriteRate = iopsWriteRate;
}
+ public void setCacheMode(diskCacheMode cacheMode) {
+ _diskCacheMode = cacheMode;
+ }
+
@Override
public String toString() {
StringBuilder diskBuilder = new StringBuilder();
@@ -616,7 +638,7 @@ public class LibvirtVMDef {
diskBuilder.append(" type='" + _diskType + "'");
diskBuilder.append(">\n");
diskBuilder.append("<driver name='qemu'" + " type='" + _diskFmtType
- + "' cache='none' " + "/>\n");
+ + "' cache='" + _diskCacheMode + "' " + "/>\n");
if (_diskType == diskType.FILE) {
diskBuilder.append("<source ");
if (_sourcePath != null) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f3e4d35/server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java
index e29bb2b..fa620a7 100644
--- a/server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java
@@ -79,6 +79,7 @@ public class DiskOfferingJoinDaoImpl extends GenericDaoBase<DiskOfferingJoinVO,
diskOfferingResponse.setBytesWriteRate(offering.getBytesWriteRate());
diskOfferingResponse.setIopsReadRate(offering.getIopsReadRate());
diskOfferingResponse.setIopsWriteRate(offering.getIopsWriteRate());
+ diskOfferingResponse.setCacheMode(offering.getCacheMode());
diskOfferingResponse.setObjectName("diskoffering");
return diskOfferingResponse;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f3e4d35/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java b/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java
index 9a679de..e925cd1 100644
--- a/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java
@@ -85,6 +85,9 @@ public class DiskOfferingJoinVO extends BaseViewVO implements InternalIdentity,
@Column(name="iops_write_rate")
Long iopsWriteRate;
+ @Column(name="cache_mode")
+ String cacheMode;
+
@Column(name="type")
Type type;
@@ -162,6 +165,18 @@ public class DiskOfferingJoinVO extends BaseViewVO implements InternalIdentity,
return maxIops;
}
+ public void setMaxIops(Long maxIops) {
+ this.maxIops = maxIops;
+ }
+
+ public String getCacheMode() {
+ return cacheMode;
+ }
+
+ public void setCacheMode(String cacheMode) {
+ this.cacheMode = cacheMode;
+ }
+
public boolean isDisplayOffering() {
return displayOffering;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f3e4d35/ui/dictionary.jsp
----------------------------------------------------------------------
diff --git a/ui/dictionary.jsp b/ui/dictionary.jsp
index 0ccfc23..45153d3 100644
--- a/ui/dictionary.jsp
+++ b/ui/dictionary.jsp
@@ -1078,6 +1078,7 @@ dictionary = {
'label.storage.tags': '<fmt:message key="label.storage.tags" />',
'label.storage.type': '<fmt:message key="label.storage.type" />',
'label.qos.type': '<fmt:message key="label.qos.type" />',
+'label.cache.mode': '<fmt:message key="label.cache.mode" />',
'label.subdomain.access': '<fmt:message key="label.subdomain.access" />',
'label.submit': '<fmt:message key="label.submit" />',
'label.submitted.by': '<fmt:message key="label.submitted.by" />',
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f3e4d35/ui/scripts/configuration.js
----------------------------------------------------------------------
diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js
index 9c05169..8144466 100644
--- a/ui/scripts/configuration.js
+++ b/ui/scripts/configuration.js
@@ -1354,6 +1354,28 @@
number: true
}
},
+ cacheMode: {
+ label: 'label.cache.mode',
+ docID: 'helpDiskOfferingCacheMode',
+ select: function(args) {
+ var items = [];
+ items.push({
+ id: 'none',
+ description: 'No disk cache'
+ });
+ items.push({
+ id: 'writeback',
+ description: 'Write-back disk caching'
+ });
+ items.push({
+ id: 'writethrough',
+ description: 'Write-through disk caching'
+ });
+ args.response.success({
+ data: items
+ });
+ }
+ },
tags: {
label: 'label.storage.tags',
docID: 'helpDiskOfferingStorageTags'
@@ -1400,6 +1422,7 @@
name: args.data.name,
displaytext: args.data.description,
storageType: args.data.storageType,
+ cacheMode: args.data.cacheMode,
customized: (args.data.isCustomized == "on")
};
@@ -1626,6 +1649,9 @@
diskIopsWriteRate: {
label: 'label.disk.iops.write.rate'
},
+ cacheMode: {
+ label: 'label.cache.mode',
+ },
tags: {
label: 'label.storage.tags'
},
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f3e4d35/ui/scripts/docs.js
----------------------------------------------------------------------
diff --git a/ui/scripts/docs.js b/ui/scripts/docs.js
index a3151b1..279c84c 100755
--- a/ui/scripts/docs.js
+++ b/ui/scripts/docs.js
@@ -328,6 +328,9 @@ cloudStack.docs = {
},
helpDiskOfferingHypervisorSnapshotReserve: {
desc: 'Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware) (Ex. The value 25 means 25%.)).',
+ },
+ helpDiskOfferingCacheMode: {
+ desc: 'The write caching mode to use for disks created with this disk offering. This can improve write performance.',
externalLink: ''
},
helpDiskOfferingStorageTags: {
[18/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-5166: Fixed test script issue related to egress
rules
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/868e944b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/868e944b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/868e944b
Branch: refs/heads/disk-cache
Commit: 868e944bf1194f0e54f08b02677b2ada66bfc9cf
Parents: bf22f6d
Author: Ashutosh K <as...@clogeny.com>
Authored: Fri Nov 15 11:14:44 2013 +0530
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Fri Nov 15 11:14:44 2013 +0530
----------------------------------------------------------------------
test/integration/component/test_egress_rules.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/868e944b/test/integration/component/test_egress_rules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_egress_rules.py b/test/integration/component/test_egress_rules.py
index 34995ff..983b7ce 100644
--- a/test/integration/component/test_egress_rules.py
+++ b/test/integration/component/test_egress_rules.py
@@ -523,7 +523,7 @@ class TestDefaultGroupEgress(cloudstackTestCase):
# CIDR: 0.0.0.0/0
# 5. deployVirtualMachine into this security group (ssh)
# 6. deployed VM should be Running, ssh should be allowed into the VM,
- # ping out to google.com from the VM should fail,
+ # ping out to google.com from the VM should be successful,
# ssh from within VM to mgt server should pass
security_group = SecurityGroup.create(
@@ -617,7 +617,7 @@ class TestDefaultGroupEgress(cloudstackTestCase):
result = str(res)
self.assertEqual(
- result.count("0 received"),
+ result.count("1 received"),
1,
"Ping to outside world from VM should be successful"
)
@@ -625,8 +625,8 @@ class TestDefaultGroupEgress(cloudstackTestCase):
try:
self.debug("SSHing into management server from VM")
res = ssh.execute("ssh %s@%s" % (
- self.services["mgmt_server"]["username"],
- self.services["mgmt_server"]["ipaddress"]
+ self.apiclient.connection.user,
+ self.apiclient.connection.mgtSvr
))
self.debug("SSH result: %s" % str(res))
@@ -725,7 +725,7 @@ class TestDefaultGroupEgressAfterDeploy(cloudstackTestCase):
# 5. authorizeSecurityGroupEgress to allow ssh access only out to
# CIDR: 0.0.0.0/0
# 6. deployed VM should be Running, ssh should be allowed into the VM,
- # ping out to google.com from the VM should fail
+ # ping out to google.com from the VM should be successful
security_group = SecurityGroup.create(
self.apiclient,
@@ -819,7 +819,7 @@ class TestDefaultGroupEgressAfterDeploy(cloudstackTestCase):
result = str(res)
self.assertEqual(
- result.count("0 received"),
+ result.count("1 received"),
1,
"Ping to outside world from VM should be successful"
)
[15/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
Add a new method on datastoredriver: getCapabilities, which will be called by liststoragepoolcmd. UI can make decision based on the capabilities of the storage.
And also add a new table: snapshotdetails
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1292b76c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1292b76c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1292b76c
Branch: refs/heads/disk-cache
Commit: 1292b76c63094805b2034f2e624a9576e1e1758b
Parents: 1762dbb
Author: Edison Su <su...@gmail.com>
Authored: Thu Nov 14 15:51:56 2013 -0800
Committer: Edison Su <su...@gmail.com>
Committed: Thu Nov 14 15:55:39 2013 -0800
----------------------------------------------------------------------
.../org/apache/cloudstack/api/ApiConstants.java | 1 +
.../api/response/StoragePoolResponse.java | 11 +++
.../api/storage/DataStoreCapabilities.java | 23 +++++++
.../subsystem/api/storage/DataStoreDriver.java | 3 +
.../cloud/storage/dao/SnapshotDetailsDao.java | 25 +++++++
.../storage/dao/SnapshotDetailsDaoImpl.java | 28 ++++++++
.../cloud/storage/dao/SnapshotDetailsVO.java | 72 ++++++++++++++++++++
.../snapshot/XenserverSnapshotStrategy.java | 13 ++--
.../storage/image/BaseImageStoreDriverImpl.java | 14 ++--
.../driver/CloudStackImageStoreDriverImpl.java | 8 +--
.../CloudStackPrimaryDataStoreDriverImpl.java | 21 +++---
.../SamplePrimaryDataStoreDriverImpl.java | 8 +++
.../driver/SolidfirePrimaryDataStoreDriver.java | 16 ++---
.../com/cloud/api/query/QueryManagerImpl.java | 15 ++++
setup/db/db/schema-421to430.sql | 9 +++
15 files changed, 233 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1292b76c/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index 82b2af6..ea3137d 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -223,6 +223,7 @@ public class ApiConstants {
public static final String STATUS = "status";
public static final String STORAGE_TYPE = "storagetype";
public static final String STORAGE_MOTION_ENABLED = "storagemotionenabled";
+ public static final String STORAGE_CAPABILITIES = "storagecapabilities";
public static final String SYSTEM_VM_TYPE = "systemvmtype";
public static final String TAGS = "tags";
public static final String TARGET_IQN = "targetiqn";
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1292b76c/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java b/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
index 7321d98..1c94377 100644
--- a/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
@@ -25,6 +25,7 @@ import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.EntityReference;
import java.util.Date;
+import java.util.Map;
@EntityReference(value=StoragePool.class)
public class StoragePoolResponse extends BaseResponse {
@@ -93,6 +94,16 @@ public class StoragePoolResponse extends BaseResponse {
" false otherwise")
private Boolean suitableForMigration;
+ @SerializedName(ApiConstants.STORAGE_CAPABILITIES) @Param(description="the storage pool capabilities")
+ private Map<String, String> caps;
+
+ public Map<String, String> getCaps() {
+ return caps;
+ }
+
+ public void setCaps(Map<String, String> cap) {
+ this.caps = cap;
+ }
/**
* @return the scope
*/
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1292b76c/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreCapabilities.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreCapabilities.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreCapabilities.java
new file mode 100644
index 0000000..79ce92e
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreCapabilities.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.engine.subsystem.api.storage;
+
+public enum DataStoreCapabilities {
+ VOLUME_SNAPSHOT_QUIESCEVM
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1292b76c/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreDriver.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreDriver.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreDriver.java
index 127b858..9e7329f 100644
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreDriver.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreDriver.java
@@ -23,7 +23,10 @@ import com.cloud.agent.api.to.DataTO;
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
import org.apache.cloudstack.storage.command.CommandResult;
+import java.util.Map;
+
public interface DataStoreDriver {
+ Map<String, String> getCapabilities();
DataTO getTO(DataObject data);
DataStoreTO getStoreTO(DataStore store);
void createAsync(DataStore store, DataObject data, AsyncCompletionCallback<CreateCmdResult> callback);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1292b76c/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsDao.java b/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsDao.java
new file mode 100644
index 0000000..b216de6
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsDao.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.cloud.storage.dao;
+
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.resourcedetail.ResourceDetailsDao;
+
+public interface SnapshotDetailsDao extends GenericDao<SnapshotDetailsVO, Long>, ResourceDetailsDao<SnapshotDetailsVO> {
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1292b76c/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsDaoImpl.java
new file mode 100644
index 0000000..f8d3813
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsDaoImpl.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.cloud.storage.dao;
+
+import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
+
+public class SnapshotDetailsDaoImpl extends ResourceDetailsDaoBase<SnapshotDetailsVO> implements SnapshotDetailsDao {
+ @Override
+ public void addDetail(long resourceId, String key, String value) {
+ super.addDetail(new SnapshotDetailsVO(resourceId, key, value));
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1292b76c/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsVO.java b/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsVO.java
new file mode 100644
index 0000000..5406749
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsVO.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.cloud.storage.dao;
+
+import org.apache.cloudstack.api.ResourceDetail;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "snapshot_details")
+public class SnapshotDetailsVO implements ResourceDetail {
+ @Id
+ @GeneratedValue(strategy= GenerationType.IDENTITY)
+ @Column(name = "id")
+ private long id;
+
+ @Column(name = "snapshot_id")
+ private long resourceId;
+
+ @Column(name = "name")
+ String name;
+
+ @Column(name = "value")
+ String value;
+
+ public SnapshotDetailsVO(Long resourceId, String name, String value) {
+ this.resourceId = resourceId;
+ this.name = name;
+ this.value = value;
+ }
+
+ @Override
+ public long getResourceId() {
+ return resourceId;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public boolean isDisplay() {
+ return false;
+ }
+
+ @Override
+ public long getId() {
+ return id;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1292b76c/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
index 7eec5ff..69900af 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
@@ -21,6 +21,7 @@ import java.util.List;
import javax.inject.Inject;
+import com.cloud.storage.*;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@@ -41,10 +42,6 @@ import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO;
import org.apache.cloudstack.storage.to.SnapshotObjectTO;
import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.storage.DataStoreRole;
-import com.cloud.storage.Snapshot;
-import com.cloud.storage.SnapshotVO;
-import com.cloud.storage.Volume;
import com.cloud.storage.dao.SnapshotDao;
import com.cloud.storage.snapshot.SnapshotManager;
import com.cloud.utils.NumbersUtil;
@@ -260,6 +257,14 @@ public class XenserverSnapshotStrategy extends SnapshotStrategyBase {
@Override
@DB
public SnapshotInfo takeSnapshot(SnapshotInfo snapshot) {
+ Object payload = snapshot.getPayload();
+ if (payload != null) {
+ CreateSnapshotPayload createSnapshotPayload = (CreateSnapshotPayload)payload;
+ if (createSnapshotPayload.getQuiescevm()) {
+ throw new InvalidParameterValueException("can't handle quiescevm equal true for volume snapshot");
+ }
+ }
+
SnapshotVO snapshotVO = snapshotDao.acquireInLockTable(snapshot.getId());
if (snapshotVO == null) {
throw new CloudRuntimeException("Failed to get lock on snapshot:" + snapshot.getId());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1292b76c/engine/storage/src/org/apache/cloudstack/storage/image/BaseImageStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/BaseImageStoreDriverImpl.java b/engine/storage/src/org/apache/cloudstack/storage/image/BaseImageStoreDriverImpl.java
index bd93e73..6a74c45 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/BaseImageStoreDriverImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/BaseImageStoreDriverImpl.java
@@ -21,17 +21,14 @@ package org.apache.cloudstack.storage.image;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
import javax.inject.Inject;
+import org.apache.cloudstack.engine.subsystem.api.storage.*;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
-import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
import org.apache.cloudstack.framework.async.AsyncRpcContext;
@@ -87,6 +84,11 @@ public abstract class BaseImageStoreDriverImpl implements ImageStoreDriver {
}
@Override
+ public Map<String, String> getCapabilities() {
+ return null;
+ }
+
+ @Override
public DataTO getTO(DataObject data) {
return null;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1292b76c/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
index be7c77d..aa60ce6 100644
--- a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
+++ b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
@@ -18,16 +18,15 @@
*/
package org.apache.cloudstack.storage.datastore.driver;
+import java.util.HashMap;
+import java.util.Map;
import java.util.UUID;
import javax.inject.Inject;
+import org.apache.cloudstack.engine.subsystem.api.storage.*;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.storage.image.BaseImageStoreDriverImpl;
import org.apache.cloudstack.storage.image.datastore.ImageStoreEntity;
@@ -49,7 +48,6 @@ public class CloudStackImageStoreDriverImpl extends BaseImageStoreDriverImpl {
@Inject
EndPointSelector _epSelector;
-
@Override
public DataStoreTO getStoreTO(DataStore store) {
ImageStoreImpl nfsStore = (ImageStoreImpl) store;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1292b76c/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
index 327d87c..bf28999 100644
--- a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
+++ b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
@@ -18,26 +18,18 @@
*/
package org.apache.cloudstack.storage.datastore.driver;
+import java.util.HashMap;
+import java.util.Map;
import java.util.UUID;
import javax.inject.Inject;
import com.cloud.storage.*;
+import org.apache.cloudstack.engine.subsystem.api.storage.*;
import org.apache.cloudstack.storage.to.SnapshotObjectTO;
import org.apache.log4j.Logger;
import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService;
-import org.apache.cloudstack.engine.subsystem.api.storage.ChapInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
-import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
-import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
-import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.storage.command.CommandResult;
@@ -70,6 +62,13 @@ import com.cloud.utils.NumbersUtil;
import com.cloud.vm.dao.VMInstanceDao;
public class CloudStackPrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver {
+ @Override
+ public Map<String, String> getCapabilities() {
+ Map<String, String> caps = new HashMap<String, String>();
+ caps.put(DataStoreCapabilities.VOLUME_SNAPSHOT_QUIESCEVM.toString(), "false");
+ return caps;
+ }
+
private static final Logger s_logger = Logger.getLogger(CloudStackPrimaryDataStoreDriverImpl.class);
@Inject
DiskOfferingDao diskOfferingDao;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1292b76c/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java b/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java
index 8f4c7bb..fcd7855 100644
--- a/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java
+++ b/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java
@@ -43,6 +43,9 @@ import com.cloud.agent.api.to.DataTO;
import com.cloud.storage.dao.StoragePoolHostDao;
import com.cloud.utils.exception.CloudRuntimeException;
+import java.util.HashMap;
+import java.util.Map;
+
public class SamplePrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver {
private static final Logger s_logger = Logger.getLogger(SamplePrimaryDataStoreDriverImpl.class);
@Inject
@@ -57,6 +60,11 @@ public class SamplePrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver
}
@Override
+ public Map<String, String> getCapabilities() {
+ return null;
+ }
+
+ @Override
public DataTO getTO(DataObject data) {
return null;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1292b76c/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java
index 1c726cd..4301bfa 100644
--- a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java
+++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java
@@ -17,18 +17,13 @@
package org.apache.cloudstack.storage.datastore.driver;
import java.text.NumberFormat;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.inject.Inject;
-import org.apache.cloudstack.engine.subsystem.api.storage.ChapInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
-import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
-import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.*;
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
import org.apache.cloudstack.storage.command.CommandResult;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
@@ -62,6 +57,11 @@ public class SolidfirePrimaryDataStoreDriver implements PrimaryDataStoreDriver {
@Inject private AccountDetailsDao _accountDetailsDao;
@Override
+ public Map<String, String> getCapabilities() {
+ return null;
+ }
+
+ @Override
public DataTO getTO(DataObject data) {
return null;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1292b76c/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 f251000..35a539a 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -83,6 +83,9 @@ import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.context.CallContext;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateState;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.query.QueryService;
@@ -342,6 +345,8 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
@Inject
ResourceTagDao _resourceTagDao;
+ @Inject
+ DataStoreManager dataStoreManager;
/*
* (non-Javadoc)
@@ -1994,6 +1999,16 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
List<StoragePoolResponse> poolResponses = ViewResponseHelper.createStoragePoolResponse(result.first().toArray(
new StoragePoolJoinVO[result.first().size()]));
+ for(StoragePoolResponse poolResponse : poolResponses) {
+ DataStore store = dataStoreManager.getPrimaryDataStore(Integer.parseInt(poolResponse.getId()));
+ if (store != null) {
+ DataStoreDriver driver = store.getDriver();
+ if (driver != null && driver.getCapabilities() != null) {
+ poolResponse.setCaps(driver.getCapabilities());
+ }
+ }
+ }
+
response.setResponses(poolResponses, result.second());
return response;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1292b76c/setup/db/db/schema-421to430.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-421to430.sql b/setup/db/db/schema-421to430.sql
index 6507148..1c305f9 100644
--- a/setup/db/db/schema-421to430.sql
+++ b/setup/db/db/schema-421to430.sql
@@ -52,6 +52,15 @@ CREATE TABLE `cloud`.`vm_snapshot_details` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+DROP TABLE IF EXISTS `cloud`.`snapshot_details`;
+CREATE TABLE `cloud`.`snapshot_details` (
+ `id` bigint unsigned UNIQUE NOT NULL,
+ `snapshot_id` bigint unsigned NOT NULL,
+ `name` varchar(255) NOT NULL,
+ `value` varchar(255) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
CREATE TABLE `cloud`.`vm_work_job` (
`id` bigint unsigned UNIQUE NOT NULL,
`step` char(32) NOT NULL COMMENT 'state',
[31/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-5185: test_egress_fw_rules - failed the test case
if vm deployment failed instead of going on executing rest
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/02c15528
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/02c15528
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/02c15528
Branch: refs/heads/disk-cache
Commit: 02c15528c8ad5a40998cc8d910560ce759c5d039
Parents: 7791d63
Author: Ashutosh K <as...@clogeny.com>
Authored: Sat Nov 16 14:57:59 2013 +0530
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Sat Nov 16 14:57:59 2013 +0530
----------------------------------------------------------------------
test/integration/component/test_egress_fw_rules.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/02c15528/test/integration/component/test_egress_fw_rules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_egress_fw_rules.py b/test/integration/component/test_egress_fw_rules.py
index 0aed957..56ac366 100644
--- a/test/integration/component/test_egress_fw_rules.py
+++ b/test/integration/component/test_egress_fw_rules.py
@@ -214,7 +214,7 @@ class TestEgressFWRules(cloudstackTestCase):
networkids=[str(self.network.id)],
projectid=project.id if project else None)
except Exception as e:
- self.debug('error=%s' % e)
+ self.fail("Virtual machine deployment failed with exception: %s" % e)
self.debug("Deployed instance in account: %s" % self.account.name)
def exec_script_on_user_vm(self, script, exec_cmd_params, expected_result, negative_test=False):
[41/50] [abbrv] Checkstyle adjustments in code and configuration
Posted by wi...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java
index 3e9e16a..7ce9190 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java
@@ -129,48 +129,52 @@ import com.cloud.vm.dao.NicDao;
SourceNatServiceProvider.class, StaticNatServiceProvider.class,
PortForwardingServiceProvider.class, IpDeployer.class} )
public class NiciraNvpElement extends AdapterBase implements
-ConnectivityProvider, SourceNatServiceProvider,
-PortForwardingServiceProvider, StaticNatServiceProvider,
-NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
+ ConnectivityProvider, SourceNatServiceProvider,
+ PortForwardingServiceProvider, StaticNatServiceProvider,
+ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
+
+ private static final int MAX_PORT = 65535;
+ private static final int MIN_PORT = 0;
+
private static final Logger s_logger = Logger
.getLogger(NiciraNvpElement.class);
private static final Map<Service, Map<Capability, String>> capabilities = setCapabilities();
@Inject
- NicDao _nicDao;
+ protected NicDao nicDao;
@Inject
- ResourceManager _resourceMgr;
+ protected ResourceManager resourceMgr;
@Inject
- PhysicalNetworkDao _physicalNetworkDao;
+ protected PhysicalNetworkDao physicalNetworkDao;
@Inject
- PhysicalNetworkServiceProviderDao _physicalNetworkServiceProviderDao;
+ protected PhysicalNetworkServiceProviderDao physicalNetworkServiceProviderDao;
@Inject
- NiciraNvpDao _niciraNvpDao;
+ protected NiciraNvpDao niciraNvpDao;
@Inject
- HostDetailsDao _hostDetailsDao;
+ protected HostDetailsDao hostDetailsDao;
@Inject
- HostDao _hostDao;
+ protected HostDao hostDao;
@Inject
- AgentManager _agentMgr;
+ protected AgentManager agentMgr;
@Inject
- NiciraNvpNicMappingDao _niciraNvpNicMappingDao;
+ protected NiciraNvpNicMappingDao niciraNvpNicMappingDao;
@Inject
- NiciraNvpRouterMappingDao _niciraNvpRouterMappingDao;
+ protected NiciraNvpRouterMappingDao niciraNvpRouterMappingDao;
@Inject
- NetworkDao _networkDao;
+ protected NetworkDao networkDao;
@Inject
- NetworkOrchestrationService _networkManager;
+ protected NetworkOrchestrationService networkManager;
@Inject
- NetworkModel _networkModel;
+ protected NetworkModel networkModel;
@Inject
- ConfigurationManager _configMgr;
+ protected ConfigurationManager configMgr;
@Inject
- NetworkServiceMapDao _ntwkSrvcDao;
+ protected NetworkServiceMapDao ntwkSrvcDao;
@Inject
- VlanDao _vlanDao;
+ protected VlanDao vlanDao;
@Inject
- IpAddressManager _ipAddrMgr;
+ protected IpAddressManager ipAddrMgr;
@Override
public Map<Service, Map<Capability, String>> getCapabilities() {
@@ -189,14 +193,14 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
return false;
}
- if (!_networkModel.isProviderForNetwork(getProvider(),
+ if (!networkModel.isProviderForNetwork(getProvider(),
network.getId())) {
s_logger.debug("NiciraNvpElement is not a provider for network "
+ network.getDisplayText());
return false;
}
- if (!_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(),
+ if (!ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(),
service, Network.Provider.NiciraNvp)) {
s_logger.debug("NiciraNvpElement can't provide the "
+ service.getName() + " service on network "
@@ -211,15 +215,15 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
public boolean configure(String name, Map<String, Object> params)
throws ConfigurationException {
super.configure(name, params);
- _resourceMgr.registerResourceStateAdapter(name, this);
+ resourceMgr.registerResourceStateAdapter(name, this);
return true;
}
@Override
public boolean implement(Network network, NetworkOffering offering,
DeployDestination dest, ReservationContext context)
- throws ConcurrentOperationException, ResourceUnavailableException,
- InsufficientCapacityException {
+ throws ConcurrentOperationException, ResourceUnavailableException,
+ InsufficientCapacityException {
s_logger.debug("entering NiciraNvpElement implement function for network "
+ network.getDisplayText()
+ " (state "
@@ -235,7 +239,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
return false;
}
- List<NiciraNvpDeviceVO> devices = _niciraNvpDao
+ List<NiciraNvpDeviceVO> devices = niciraNvpDao
.listByPhysicalNetwork(network.getPhysicalNetworkId());
if (devices.isEmpty()) {
s_logger.error("No NiciraNvp Controller on physical network "
@@ -243,17 +247,22 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
return false;
}
NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
- HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId());
- _hostDao.loadDetails(niciraNvpHost);
+ HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());
+ hostDao.loadDetails(niciraNvpHost);
Account owner = context.getAccount();
+ /*
+ * TODO Shouldn't we lock the network as we might need to do
+ * multiple operations that should be done only once.
+ */
+
// Implement SourceNat immediately as we have al the info already
- if (_networkModel.isProviderSupportServiceInNetwork(
+ if (networkModel.isProviderSupportServiceInNetwork(
network.getId(), Service.SourceNat, Provider.NiciraNvp)) {
s_logger.debug("Apparently we are supposed to provide SourceNat on this network");
- PublicIp sourceNatIp = _ipAddrMgr
+ PublicIp sourceNatIp = ipAddrMgr
.assignSourceNatIpAddressToGuestNetwork(owner, network);
String publicCidr = sourceNatIp.getAddress().addr() + "/"
+ NetUtils.getCidrSize(sourceNatIp.getVlanNetmask());
@@ -267,10 +276,10 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
BroadcastDomainType.getValue(network.getBroadcastUri()),
"router-" + network.getDisplayText(), publicCidr,
sourceNatIp.getGateway(), internalCidr, context
- .getDomain().getName()
- + "-"
- + context.getAccount().getAccountName());
- CreateLogicalRouterAnswer answer = (CreateLogicalRouterAnswer)_agentMgr
+ .getDomain().getName()
+ + "-"
+ + context.getAccount().getAccountName());
+ CreateLogicalRouterAnswer answer = (CreateLogicalRouterAnswer)agentMgr
.easySend(niciraNvpHost.getId(), cmd);
if (answer.getResult() == false) {
s_logger.error("Failed to create Logical Router for network "
@@ -281,7 +290,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
// Store the uuid so we can easily find it during cleanup
NiciraNvpRouterMappingVO routermapping =
new NiciraNvpRouterMappingVO(answer.getLogicalRouterUuid(), network.getId());
- _niciraNvpRouterMappingDao.persist(routermapping);
+ niciraNvpRouterMappingDao.persist(routermapping);
}
return true;
@@ -303,9 +312,9 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
return false;
}
- NicVO nicVO = _nicDao.findById(nic.getId());
+ NicVO nicVO = nicDao.findById(nic.getId());
- List<NiciraNvpDeviceVO> devices = _niciraNvpDao
+ List<NiciraNvpDeviceVO> devices = niciraNvpDao
.listByPhysicalNetwork(network.getPhysicalNetworkId());
if (devices.isEmpty()) {
s_logger.error("No NiciraNvp Controller on physical network "
@@ -313,15 +322,15 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
return false;
}
NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
- HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId());
+ HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());
- NiciraNvpNicMappingVO existingNicMap = _niciraNvpNicMappingDao
+ NiciraNvpNicMappingVO existingNicMap = niciraNvpNicMappingDao
.findByNicUuid(nicVO.getUuid());
if (existingNicMap != null) {
FindLogicalSwitchPortCommand findCmd = new FindLogicalSwitchPortCommand(
existingNicMap.getLogicalSwitchUuid(),
existingNicMap.getLogicalSwitchPortUuid());
- FindLogicalSwitchPortAnswer answer = (FindLogicalSwitchPortAnswer)_agentMgr
+ FindLogicalSwitchPortAnswer answer = (FindLogicalSwitchPortAnswer)agentMgr
.easySend(niciraNvpHost.getId(), findCmd);
if (answer.getResult()) {
@@ -333,14 +342,14 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
BroadcastDomainType.getValue(network.getBroadcastUri()),
nicVO.getUuid(), context.getDomain().getName() + "-"
+ context.getAccount().getAccountName(),
- nic.getName());
- _agentMgr.easySend(niciraNvpHost.getId(), cmd);
+ nic.getName());
+ agentMgr.easySend(niciraNvpHost.getId(), cmd);
return true;
} else {
s_logger.error("Stale entry found for nic " + nic.getName()
+ " with logical switchport uuid "
+ existingNicMap.getLogicalSwitchPortUuid());
- _niciraNvpNicMappingDao.remove(existingNicMap.getId());
+ niciraNvpNicMappingDao.remove(existingNicMap.getId());
}
}
@@ -348,7 +357,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
BroadcastDomainType.getValue(network.getBroadcastUri()),
nicVO.getUuid(), context.getDomain().getName() + "-"
+ context.getAccount().getAccountName(), nic.getName());
- CreateLogicalSwitchPortAnswer answer = (CreateLogicalSwitchPortAnswer)_agentMgr
+ CreateLogicalSwitchPortAnswer answer = (CreateLogicalSwitchPortAnswer)agentMgr
.easySend(niciraNvpHost.getId(), cmd);
if (answer == null || !answer.getResult()) {
@@ -358,7 +367,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
NiciraNvpNicMappingVO nicMap = new NiciraNvpNicMappingVO(BroadcastDomainType.getValue(network.getBroadcastUri()),
answer.getLogicalSwitchPortUuid(), nicVO.getUuid());
- _niciraNvpNicMappingDao.persist(nicMap);
+ niciraNvpNicMappingDao.persist(nicMap);
return true;
}
@@ -378,9 +387,9 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
return false;
}
- NicVO nicVO = _nicDao.findById(nic.getId());
+ NicVO nicVO = nicDao.findById(nic.getId());
- List<NiciraNvpDeviceVO> devices = _niciraNvpDao
+ List<NiciraNvpDeviceVO> devices = niciraNvpDao
.listByPhysicalNetwork(network.getPhysicalNetworkId());
if (devices.isEmpty()) {
s_logger.error("No NiciraNvp Controller on physical network "
@@ -388,9 +397,9 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
return false;
}
NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
- HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId());
+ HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());
- NiciraNvpNicMappingVO nicMap = _niciraNvpNicMappingDao
+ NiciraNvpNicMappingVO nicMap = niciraNvpNicMappingDao
.findByNicUuid(nicVO.getUuid());
if (nicMap == null) {
s_logger.error("No mapping for nic " + nic.getName());
@@ -400,7 +409,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
DeleteLogicalSwitchPortCommand cmd = new DeleteLogicalSwitchPortCommand(
nicMap.getLogicalSwitchUuid(),
nicMap.getLogicalSwitchPortUuid());
- DeleteLogicalSwitchPortAnswer answer = (DeleteLogicalSwitchPortAnswer)_agentMgr
+ DeleteLogicalSwitchPortAnswer answer = (DeleteLogicalSwitchPortAnswer)agentMgr
.easySend(niciraNvpHost.getId(), cmd);
if (answer == null || !answer.getResult()) {
@@ -408,7 +417,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
return false;
}
- _niciraNvpNicMappingDao.remove(nicMap.getId());
+ niciraNvpNicMappingDao.remove(nicMap.getId());
return true;
}
@@ -421,7 +430,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
return false;
}
- List<NiciraNvpDeviceVO> devices = _niciraNvpDao
+ List<NiciraNvpDeviceVO> devices = niciraNvpDao
.listByPhysicalNetwork(network.getPhysicalNetworkId());
if (devices.isEmpty()) {
s_logger.error("No NiciraNvp Controller on physical network "
@@ -429,15 +438,15 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
return false;
}
NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
- HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId());
+ HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());
- if (_networkModel.isProviderSupportServiceInNetwork(network.getId(),
+ if (networkModel.isProviderSupportServiceInNetwork(network.getId(),
Service.SourceNat, Provider.NiciraNvp)) {
s_logger.debug("Apparently we were providing SourceNat on this network");
// Deleting the LogicalRouter will also take care of all provisioned
// nat rules.
- NiciraNvpRouterMappingVO routermapping = _niciraNvpRouterMappingDao
+ NiciraNvpRouterMappingVO routermapping = niciraNvpRouterMappingDao
.findByNetworkId(network.getId());
if (routermapping == null) {
s_logger.warn("No logical router uuid found for network "
@@ -448,14 +457,14 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
DeleteLogicalRouterCommand cmd = new DeleteLogicalRouterCommand(routermapping.getLogicalRouterUuid());
DeleteLogicalRouterAnswer answer =
- (DeleteLogicalRouterAnswer)_agentMgr.easySend(niciraNvpHost.getId(), cmd);
+ (DeleteLogicalRouterAnswer)agentMgr.easySend(niciraNvpHost.getId(), cmd);
if (answer.getResult() == false) {
s_logger.error("Failed to delete LogicalRouter for network "
+ network.getDisplayText());
return false;
}
- _niciraNvpRouterMappingDao.remove(routermapping.getId());
+ niciraNvpRouterMappingDao.remove(routermapping.getId());
}
return true;
@@ -479,7 +488,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
@Override
public boolean shutdownProviderInstances(
PhysicalNetworkServiceProvider provider, ReservationContext context)
- throws ConcurrentOperationException, ResourceUnavailableException {
+ throws ConcurrentOperationException, ResourceUnavailableException {
// Nothing to do here.
return true;
}
@@ -547,7 +556,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
NetworkDevice networkDevice = NetworkDevice
.getNetworkDevice(deviceName);
final Long physicalNetworkId = cmd.getPhysicalNetworkId();
- PhysicalNetworkVO physicalNetwork = _physicalNetworkDao
+ PhysicalNetworkVO physicalNetwork = physicalNetworkDao
.findById(physicalNetworkId);
if (physicalNetwork == null) {
throw new InvalidParameterValueException(
@@ -556,7 +565,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
}
long zoneId = physicalNetwork.getDataCenterId();
- final PhysicalNetworkServiceProviderVO ntwkSvcProvider = _physicalNetworkServiceProviderDao
+ final PhysicalNetworkServiceProviderVO ntwkSvcProvider = physicalNetworkServiceProviderDao
.findByServiceProvider(physicalNetwork.getId(),
networkDevice.getNetworkServiceProvder());
if (ntwkSvcProvider == null) {
@@ -571,7 +580,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
+ physicalNetworkId + "to add this device");
}
- if (_niciraNvpDao.listByPhysicalNetwork(physicalNetworkId).size() != 0) {
+ if (niciraNvpDao.listByPhysicalNetwork(physicalNetworkId).size() != 0) {
throw new CloudRuntimeException(
"A NiciraNvp device is already configured on this physical network");
}
@@ -598,7 +607,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
try {
resource.configure(cmd.getHost(), hostdetails);
- final Host host = _resourceMgr.addHost(zoneId, resource,
+ final Host host = resourceMgr.addHost(zoneId, resource,
Host.Type.L2Networking, params);
if (host != null) {
return Transaction.execute(new TransactionCallback<NiciraNvpDeviceVO>() {
@@ -607,12 +616,12 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
NiciraNvpDeviceVO niciraNvpDevice = new NiciraNvpDeviceVO(host.getId(),
physicalNetworkId, ntwkSvcProvider.getProviderName(),
deviceName);
- _niciraNvpDao.persist(niciraNvpDevice);
+ niciraNvpDao.persist(niciraNvpDevice);
DetailVO detail = new DetailVO(host.getId(),
"niciranvpdeviceid", String.valueOf(niciraNvpDevice
.getId()));
- _hostDetailsDao.persist(detail);
+ hostDetailsDao.persist(detail);
return niciraNvpDevice;
}
@@ -629,8 +638,8 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
@Override
public NiciraNvpDeviceResponse createNiciraNvpDeviceResponse(
NiciraNvpDeviceVO niciraNvpDeviceVO) {
- HostVO niciraNvpHost = _hostDao.findById(niciraNvpDeviceVO.getHostId());
- _hostDao.loadDetails(niciraNvpHost);
+ HostVO niciraNvpHost = hostDao.findById(niciraNvpDeviceVO.getHostId());
+ hostDao.loadDetails(niciraNvpHost);
NiciraNvpDeviceResponse response = new NiciraNvpDeviceResponse();
response.setDeviceName(niciraNvpDeviceVO.getDeviceName());
@@ -650,7 +659,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
@Override
public boolean deleteNiciraNvpDevice(DeleteNiciraNvpDeviceCmd cmd) {
Long niciraDeviceId = cmd.getNiciraNvpDeviceId();
- NiciraNvpDeviceVO niciraNvpDevice = _niciraNvpDao
+ NiciraNvpDeviceVO niciraNvpDevice = niciraNvpDao
.findById(niciraDeviceId);
if (niciraNvpDevice == null) {
throw new InvalidParameterValueException(
@@ -659,12 +668,12 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
// Find the physical network we work for
Long physicalNetworkId = niciraNvpDevice.getPhysicalNetworkId();
- PhysicalNetworkVO physicalNetwork = _physicalNetworkDao
+ PhysicalNetworkVO physicalNetwork = physicalNetworkDao
.findById(physicalNetworkId);
if (physicalNetwork != null) {
// Lets see if there are networks that use us
// Find the nicira networks on this physical network
- List<NetworkVO> networkList = _networkDao
+ List<NetworkVO> networkList = networkDao
.listByPhysicalNetwork(physicalNetworkId);
// Networks with broadcast type lswitch are ours
@@ -679,14 +688,14 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
}
}
- HostVO niciraHost = _hostDao.findById(niciraNvpDevice.getHostId());
+ HostVO niciraHost = hostDao.findById(niciraNvpDevice.getHostId());
Long hostId = niciraHost.getId();
niciraHost.setResourceState(ResourceState.Maintenance);
- _hostDao.update(hostId, niciraHost);
- _resourceMgr.deleteHost(hostId, false, false);
+ hostDao.update(hostId, niciraHost);
+ resourceMgr.deleteHost(hostId, false, false);
- _niciraNvpDao.remove(niciraDeviceId);
+ niciraNvpDao.remove(niciraDeviceId);
return true;
}
@@ -703,7 +712,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
}
if (niciraNvpDeviceId != null) {
- NiciraNvpDeviceVO niciraNvpDevice = _niciraNvpDao
+ NiciraNvpDeviceVO niciraNvpDevice = niciraNvpDao
.findById(niciraNvpDeviceId);
if (niciraNvpDevice == null) {
throw new InvalidParameterValueException(
@@ -712,14 +721,14 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
}
responseList.add(niciraNvpDevice);
} else {
- PhysicalNetworkVO physicalNetwork = _physicalNetworkDao
+ PhysicalNetworkVO physicalNetwork = physicalNetworkDao
.findById(physicalNetworkId);
if (physicalNetwork == null) {
throw new InvalidParameterValueException(
"Could not find a physical network with id: "
+ physicalNetworkId);
}
- responseList = _niciraNvpDao
+ responseList = niciraNvpDao
.listByPhysicalNetwork(physicalNetworkId);
}
@@ -730,7 +739,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
public List<? extends Network> listNiciraNvpDeviceNetworks(
ListNiciraNvpDeviceNetworksCmd cmd) {
Long niciraDeviceId = cmd.getNiciraNvpDeviceId();
- NiciraNvpDeviceVO niciraNvpDevice = _niciraNvpDao
+ NiciraNvpDeviceVO niciraNvpDevice = niciraNvpDao
.findById(niciraDeviceId);
if (niciraNvpDevice == null) {
throw new InvalidParameterValueException(
@@ -739,7 +748,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
// Find the physical network we work for
Long physicalNetworkId = niciraNvpDevice.getPhysicalNetworkId();
- PhysicalNetworkVO physicalNetwork = _physicalNetworkDao
+ PhysicalNetworkVO physicalNetwork = physicalNetworkDao
.findById(physicalNetworkId);
if (physicalNetwork == null) {
// No such physical network, so no provisioned networks
@@ -747,7 +756,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
}
// Find the nicira networks on this physical network
- List<NetworkVO> networkList = _networkDao
+ List<NetworkVO> networkList = networkDao
.listByPhysicalNetwork(physicalNetworkId);
// Networks with broadcast type lswitch are ours
@@ -808,11 +817,11 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
@Override
public boolean applyIps(Network network,
List<? extends PublicIpAddress> ipAddress, Set<Service> services)
- throws ResourceUnavailableException {
+ throws ResourceUnavailableException {
if (services.contains(Service.SourceNat)) {
// Only if we need to provide SourceNat we need to configure the logical router
// SourceNat is required for StaticNat and PortForwarding
- List<NiciraNvpDeviceVO> devices = _niciraNvpDao
+ List<NiciraNvpDeviceVO> devices = niciraNvpDao
.listByPhysicalNetwork(network.getPhysicalNetworkId());
if (devices.isEmpty()) {
s_logger.error("No NiciraNvp Controller on physical network "
@@ -820,10 +829,10 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
return false;
}
NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
- HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId());
- _hostDao.loadDetails(niciraNvpHost);
+ HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());
+ hostDao.loadDetails(niciraNvpHost);
- NiciraNvpRouterMappingVO routermapping = _niciraNvpRouterMappingDao
+ NiciraNvpRouterMappingVO routermapping = niciraNvpRouterMappingDao
.findByNetworkId(network.getId());
if (routermapping == null) {
s_logger.error("No logical router uuid found for network "
@@ -842,11 +851,10 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
}
ConfigurePublicIpsOnLogicalRouterCommand cmd = new ConfigurePublicIpsOnLogicalRouterCommand(routermapping.getLogicalRouterUuid(),
niciraNvpHost.getDetail("l3gatewayserviceuuid"), cidrs);
- ConfigurePublicIpsOnLogicalRouterAnswer answer = (ConfigurePublicIpsOnLogicalRouterAnswer)_agentMgr.easySend(niciraNvpHost.getId(), cmd);
+ ConfigurePublicIpsOnLogicalRouterAnswer answer = (ConfigurePublicIpsOnLogicalRouterAnswer)agentMgr.easySend(niciraNvpHost.getId(), cmd);
//FIXME answer can be null if the host is down
return answer.getResult();
- }
- else {
+ } else {
s_logger.debug("No need to provision ip addresses as we are not providing L3 services.");
}
@@ -859,12 +867,12 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
@Override
public boolean applyStaticNats(Network network,
List<? extends StaticNat> rules)
- throws ResourceUnavailableException {
+ throws ResourceUnavailableException {
if (!canHandle(network, Service.StaticNat)) {
return false;
}
- List<NiciraNvpDeviceVO> devices = _niciraNvpDao
+ List<NiciraNvpDeviceVO> devices = niciraNvpDao
.listByPhysicalNetwork(network.getPhysicalNetworkId());
if (devices.isEmpty()) {
s_logger.error("No NiciraNvp Controller on physical network "
@@ -872,9 +880,9 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
return false;
}
NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
- HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId());
+ HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());
- NiciraNvpRouterMappingVO routermapping = _niciraNvpRouterMappingDao
+ NiciraNvpRouterMappingVO routermapping = niciraNvpRouterMappingDao
.findByNetworkId(network.getId());
if (routermapping == null) {
s_logger.error("No logical router uuid found for network "
@@ -884,20 +892,20 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
List<StaticNatRuleTO> staticNatRules = new ArrayList<StaticNatRuleTO>();
for (StaticNat rule : rules) {
- IpAddress sourceIp = _networkModel.getIp(rule.getSourceIpAddressId());
+ IpAddress sourceIp = networkModel.getIp(rule.getSourceIpAddressId());
// Force the nat rule into the StaticNatRuleTO, no use making a new TO object
// we only need the source and destination ip. Unfortunately no mention if a rule
// is new.
StaticNatRuleTO ruleTO = new StaticNatRuleTO(1,
- sourceIp.getAddress().addr(), 0, 65535,
- rule.getDestIpAddress(), 0, 65535,
+ sourceIp.getAddress().addr(), MIN_PORT, MAX_PORT,
+ rule.getDestIpAddress(), MIN_PORT, MAX_PORT,
"any", rule.isForRevoke(), false);
staticNatRules.add(ruleTO);
}
ConfigureStaticNatRulesOnLogicalRouterCommand cmd =
new ConfigureStaticNatRulesOnLogicalRouterCommand(routermapping.getLogicalRouterUuid(), staticNatRules);
- ConfigureStaticNatRulesOnLogicalRouterAnswer answer = (ConfigureStaticNatRulesOnLogicalRouterAnswer)_agentMgr.easySend(niciraNvpHost.getId(), cmd);
+ ConfigureStaticNatRulesOnLogicalRouterAnswer answer = (ConfigureStaticNatRulesOnLogicalRouterAnswer)agentMgr.easySend(niciraNvpHost.getId(), cmd);
return answer.getResult();
}
@@ -912,7 +920,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
return false;
}
- List<NiciraNvpDeviceVO> devices = _niciraNvpDao
+ List<NiciraNvpDeviceVO> devices = niciraNvpDao
.listByPhysicalNetwork(network.getPhysicalNetworkId());
if (devices.isEmpty()) {
s_logger.error("No NiciraNvp Controller on physical network "
@@ -920,9 +928,9 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
return false;
}
NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
- HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId());
+ HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());
- NiciraNvpRouterMappingVO routermapping = _niciraNvpRouterMappingDao
+ NiciraNvpRouterMappingVO routermapping = niciraNvpRouterMappingDao
.findByNetworkId(network.getId());
if (routermapping == null) {
s_logger.error("No logical router uuid found for network "
@@ -932,15 +940,15 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
List<PortForwardingRuleTO> portForwardingRules = new ArrayList<PortForwardingRuleTO>();
for (PortForwardingRule rule : rules) {
- IpAddress sourceIp = _networkModel.getIp(rule.getSourceIpAddressId());
- Vlan vlan = _vlanDao.findById(sourceIp.getVlanId());
+ IpAddress sourceIp = networkModel.getIp(rule.getSourceIpAddressId());
+ Vlan vlan = vlanDao.findById(sourceIp.getVlanId());
PortForwardingRuleTO ruleTO = new PortForwardingRuleTO(rule, vlan.getVlanTag(), sourceIp.getAddress().addr());
portForwardingRules.add(ruleTO);
}
ConfigurePortForwardingRulesOnLogicalRouterCommand cmd =
new ConfigurePortForwardingRulesOnLogicalRouterCommand(routermapping.getLogicalRouterUuid(), portForwardingRules);
- ConfigurePortForwardingRulesOnLogicalRouterAnswer answer = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)_agentMgr.easySend(niciraNvpHost.getId(), cmd);
+ ConfigurePortForwardingRulesOnLogicalRouterAnswer answer = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)agentMgr.easySend(niciraNvpHost.getId(), cmd);
return answer.getResult();
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
index 7057915..15c4bb7 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
@@ -66,30 +66,32 @@ import com.cloud.vm.VirtualMachineProfile;
@Local(value = NetworkGuru.class)
public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
+ private static final int MAX_NAME_LENGTH = 40;
+
private static final Logger s_logger = Logger.getLogger(NiciraNvpGuestNetworkGuru.class);
@Inject
- NetworkModel _networkModel;
+ protected NetworkModel networkModel;
@Inject
- NetworkDao _networkDao;
+ protected NetworkDao networkDao;
@Inject
- DataCenterDao _zoneDao;
+ protected DataCenterDao zoneDao;
@Inject
- PhysicalNetworkDao _physicalNetworkDao;
+ protected PhysicalNetworkDao physicalNetworkDao;
@Inject
- AccountDao _accountDao;
+ protected AccountDao accountDao;
@Inject
- NiciraNvpDao _niciraNvpDao;
+ protected NiciraNvpDao niciraNvpDao;
@Inject
- HostDao _hostDao;
+ protected HostDao hostDao;
@Inject
- ResourceManager _resourceMgr;
+ protected ResourceManager resourceMgr;
@Inject
- AgentManager _agentMgr;
+ protected AgentManager agentMgr;
@Inject
- HostDetailsDao _hostDetailsDao;
+ protected HostDetailsDao hostDetailsDao;
@Inject
- NetworkOfferingServiceMapDao _ntwkOfferingSrvcDao;
+ protected NetworkOfferingServiceMapDao ntwkOfferingSrvcDao;
public NiciraNvpGuestNetworkGuru() {
super();
@@ -97,13 +99,13 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
}
@Override
- protected boolean canHandle(NetworkOffering offering, final NetworkType networkType, final PhysicalNetwork physicalNetwork) {
+ protected boolean canHandle(final NetworkOffering offering, final NetworkType networkType, final PhysicalNetwork physicalNetwork) {
// This guru handles only Guest Isolated network that supports Source nat service
if (networkType == NetworkType.Advanced
&& isMyTrafficType(offering.getTrafficType())
&& offering.getGuestType() == Network.GuestType.Isolated
&& isMyIsolationMethod(physicalNetwork)
- && _ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(offering.getId(), Service.Connectivity)) {
+ && ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(offering.getId(), Service.Connectivity)) {
return true;
} else {
s_logger.trace("We only take care of Guest networks of type " + GuestType.Isolated + " in zone of type " + NetworkType.Advanced);
@@ -112,17 +114,17 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
}
@Override
- public Network design(NetworkOffering offering, DeploymentPlan plan,
- Network userSpecified, Account owner) {
+ public Network design(final NetworkOffering offering, final DeploymentPlan plan,
+ final Network userSpecified, final Account owner) {
// Check of the isolation type of the related physical network is STT
- PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan.getPhysicalNetworkId());
+ PhysicalNetworkVO physnet = physicalNetworkDao.findById(plan.getPhysicalNetworkId());
DataCenter dc = _dcDao.findById(plan.getDataCenterId());
if (!canHandle(offering, dc.getNetworkType(), physnet)) {
s_logger.debug("Refusing to design this network");
return null;
}
- List<NiciraNvpDeviceVO> devices = _niciraNvpDao.listByPhysicalNetwork(physnet.getId());
+ List<NiciraNvpDeviceVO> devices = niciraNvpDao.listByPhysicalNetwork(physnet.getId());
if (devices.isEmpty()) {
s_logger.error("No NiciraNvp Controller on physical network " + physnet.getName());
return null;
@@ -141,8 +143,8 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
}
@Override
- public Network implement(Network network, NetworkOffering offering,
- DeployDestination dest, ReservationContext context)
+ public Network implement(final Network network, final NetworkOffering offering,
+ final DeployDestination dest, final ReservationContext context)
throws InsufficientVirtualNetworkCapcityException {
assert (network.getState() == State.Implementing) : "Why are we implementing " + network;
@@ -153,7 +155,7 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
// physical network id can be null in Guest Network in Basic zone, so locate the physical network
if (physicalNetworkId == null) {
- physicalNetworkId = _networkModel.findPhysicalNetworkId(dcId, offering.getTags(), offering.getTrafficType());
+ physicalNetworkId = networkModel.findPhysicalNetworkId(dcId, offering.getTags(), offering.getTrafficType());
}
NetworkVO implemented = new NetworkVO(network.getTrafficType(), network.getMode(), network.getBroadcastDomainType(), network.getNetworkOfferingId(), State.Allocated,
@@ -172,24 +174,24 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
if (name == null || name.isEmpty()) {
name = ((NetworkVO)network).getUuid();
}
- if (name.length() > 40) {
- name = name.substring(0, 39); // max length 40
+ if (name.length() > MAX_NAME_LENGTH) {
+ name = name.substring(0, MAX_NAME_LENGTH - 1); // max length 40
}
- List<NiciraNvpDeviceVO> devices = _niciraNvpDao.listByPhysicalNetwork(physicalNetworkId);
+ List<NiciraNvpDeviceVO> devices = niciraNvpDao.listByPhysicalNetwork(physicalNetworkId);
if (devices.isEmpty()) {
s_logger.error("No NiciraNvp Controller on physical network " + physicalNetworkId);
return null;
}
NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
- HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId());
- _hostDao.loadDetails(niciraNvpHost);
+ HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());
+ hostDao.loadDetails(niciraNvpHost);
String transportzoneuuid = niciraNvpHost.getDetail("transportzoneuuid");
String transportzoneisotype = niciraNvpHost.getDetail("transportzoneisotype");
CreateLogicalSwitchCommand cmd = new CreateLogicalSwitchCommand(transportzoneuuid, transportzoneisotype, name,
context.getDomain().getName() + "-" + context.getAccount().getAccountName());
- CreateLogicalSwitchAnswer answer = (CreateLogicalSwitchAnswer)_agentMgr.easySend(niciraNvpHost.getId(), cmd);
+ CreateLogicalSwitchAnswer answer = (CreateLogicalSwitchAnswer)agentMgr.easySend(niciraNvpHost.getId(), cmd);
if (answer == null || !answer.getResult()) {
s_logger.error("CreateLogicalSwitchCommand failed");
@@ -209,9 +211,8 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
}
@Override
- public void reserve(NicProfile nic, Network network,
- VirtualMachineProfile vm,
- DeployDestination dest, ReservationContext context)
+ public void reserve(final NicProfile nic, final Network network, final VirtualMachineProfile vm,
+ final DeployDestination dest, final ReservationContext context)
throws InsufficientVirtualNetworkCapcityException,
InsufficientAddressCapacityException {
// TODO Auto-generated method stub
@@ -219,32 +220,30 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
}
@Override
- public boolean release(NicProfile nic,
- VirtualMachineProfile vm,
- String reservationId) {
+ public boolean release(final NicProfile nic, final VirtualMachineProfile vm, final String reservationId) {
// TODO Auto-generated method stub
return super.release(nic, vm, reservationId);
}
@Override
- public void shutdown(NetworkProfile profile, NetworkOffering offering) {
- NetworkVO networkObject = _networkDao.findById(profile.getId());
+ public void shutdown(final NetworkProfile profile, final NetworkOffering offering) {
+ NetworkVO networkObject = networkDao.findById(profile.getId());
if (networkObject.getBroadcastDomainType() != BroadcastDomainType.Lswitch ||
networkObject.getBroadcastUri() == null) {
s_logger.warn("BroadcastUri is empty or incorrect for guestnetwork " + networkObject.getDisplayText());
return;
}
- List<NiciraNvpDeviceVO> devices = _niciraNvpDao.listByPhysicalNetwork(networkObject.getPhysicalNetworkId());
+ List<NiciraNvpDeviceVO> devices = niciraNvpDao.listByPhysicalNetwork(networkObject.getPhysicalNetworkId());
if (devices.isEmpty()) {
s_logger.error("No NiciraNvp Controller on physical network " + networkObject.getPhysicalNetworkId());
return;
}
NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
- HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId());
+ HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());
DeleteLogicalSwitchCommand cmd = new DeleteLogicalSwitchCommand(BroadcastDomainType.getValue(networkObject.getBroadcastUri()));
- DeleteLogicalSwitchAnswer answer = (DeleteLogicalSwitchAnswer) _agentMgr.easySend(niciraNvpHost.getId(), cmd);
+ DeleteLogicalSwitchAnswer answer = (DeleteLogicalSwitchAnswer) agentMgr.easySend(niciraNvpHost.getId(), cmd);
if (answer == null || !answer.getResult()) {
s_logger.error("DeleteLogicalSwitchCommand failed");
@@ -254,7 +253,7 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
}
@Override
- public boolean trash(Network network, NetworkOffering offering) {
+ public boolean trash(final Network network, final NetworkOffering offering) {
return super.trash(network, offering);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/ControlClusterStatus.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/ControlClusterStatus.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/ControlClusterStatus.java
index 2914d35..457f161 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/ControlClusterStatus.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/ControlClusterStatus.java
@@ -17,67 +17,65 @@
package com.cloud.network.nicira;
public class ControlClusterStatus {
- private String cluster_status;
- private Stats node_stats;
- private Stats lqueue_stats;
- private Stats lport_stats;
- private Stats lrouterport_stats;
- private Stats lswitch_stats;
- private Stats zone_stats;
- private Stats lrouter_stats;
- private Stats security_profile_stats;
+ private String clusterStatus;
+ private Stats nodeStats;
+ private Stats queueStats;
+ private Stats portStats;
+ private Stats routerportStats;
+ private Stats switchStats;
+ private Stats zoneStats;
+ private Stats routerStats;
+ private Stats securityProfileStats;
public String getClusterStatus() {
- return cluster_status;
+ return clusterStatus;
}
public Stats getNodeStats() {
- return node_stats;
+ return nodeStats;
}
public Stats getLqueueStats() {
- return lqueue_stats;
+ return queueStats;
}
public Stats getLportStats() {
- return lport_stats;
+ return portStats;
}
public Stats getLrouterportStats() {
- return lrouterport_stats;
+ return routerportStats;
}
public Stats getLswitchStats() {
- return lswitch_stats;
+ return switchStats;
}
public Stats getZoneStats() {
- return zone_stats;
+ return zoneStats;
}
public Stats getLrouterStats() {
- return lrouter_stats;
+ return routerStats;
}
public Stats getSecurityProfileStats() {
- return security_profile_stats;
+ return securityProfileStats;
}
public class Stats {
- private int error_state_count;
- private int registered_count;
- private int active_count;
+ private int errorStateCount;
+ private int registeredCount;
+ private int activeCount;
public int getErrorStateCount() {
- return error_state_count;
+ return errorStateCount;
}
-
public int getRegisteredCount() {
- return registered_count;
+ return registeredCount;
}
-
public int getActiveCount() {
- return active_count;
+ return activeCount;
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java
index d149c4b..2a31dd5 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java
@@ -28,15 +28,18 @@ public class DestinationNatRule extends NatRule {
return toDestinationIpAddress;
}
- public void setToDestinationIpAddress(String toDestinationIpAddress) {
+
+ public void setToDestinationIpAddress(final String toDestinationIpAddress) {
this.toDestinationIpAddress = toDestinationIpAddress;
}
+
public Integer getToDestinationPort() {
return toDestinationPort;
}
- public void setToDestinationPort(Integer toDestinationPort) {
+
+ public void setToDestinationPort(final Integer toDestinationPort) {
this.toDestinationPort = toDestinationPort;
}
@@ -57,45 +60,59 @@ public class DestinationNatRule extends NatRule {
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (!super.equals(obj))
+ }
+ if (!super.equals(obj)) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
DestinationNatRule other = (DestinationNatRule) obj;
if (toDestinationIpAddress == null) {
- if (other.toDestinationIpAddress != null)
+ if (other.toDestinationIpAddress != null) {
return false;
- } else if (!toDestinationIpAddress.equals(other.toDestinationIpAddress))
+ }
+ } else if (!toDestinationIpAddress.equals(other.toDestinationIpAddress)) {
return false;
+ }
if (toDestinationPort == null) {
- if (other.toDestinationPort != null)
+ if (other.toDestinationPort != null) {
return false;
- } else if (!toDestinationPort.equals(other.toDestinationPort))
+ }
+ } else if (!toDestinationPort.equals(other.toDestinationPort)) {
return false;
+ }
return true;
}
@Override
public boolean equalsIgnoreUuid(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (!super.equalsIgnoreUuid(obj))
+ }
+ if (!super.equalsIgnoreUuid(obj)) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
DestinationNatRule other = (DestinationNatRule) obj;
if (toDestinationIpAddress == null) {
- if (other.toDestinationIpAddress != null)
+ if (other.toDestinationIpAddress != null) {
return false;
- } else if (!toDestinationIpAddress.equals(other.toDestinationIpAddress))
+ }
+ } else if (!toDestinationIpAddress.equals(other.toDestinationIpAddress)) {
return false;
+ }
if (toDestinationPort == null) {
- if (other.toDestinationPort != null)
+ if (other.toDestinationPort != null) {
return false;
- } else if (!toDestinationPort.equals(other.toDestinationPort))
+ }
+ } else if (!toDestinationPort.equals(other.toDestinationPort)) {
return false;
+ }
return true;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/L3GatewayAttachment.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/L3GatewayAttachment.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/L3GatewayAttachment.java
index 96d1991..515a751 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/L3GatewayAttachment.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/L3GatewayAttachment.java
@@ -20,33 +20,33 @@ package com.cloud.network.nicira;
*
*/
public class L3GatewayAttachment extends Attachment {
- private String l3_gateway_service_uuid;
- private String type = "L3GatewayAttachment";
- private Long vlan_id;
+ private String l3GatewayServiceUuid;
+ private final String type = "L3GatewayAttachment";
+ private Long vlanId;
- public L3GatewayAttachment(String l3_gateway_service_uuid) {
- this.l3_gateway_service_uuid = l3_gateway_service_uuid;
+ public L3GatewayAttachment(String l3GatewayServiceUuid) {
+ this.l3GatewayServiceUuid = l3GatewayServiceUuid;
}
- public L3GatewayAttachment(String l3_gateway_service_uuid, long vlan_id) {
- this.l3_gateway_service_uuid = l3_gateway_service_uuid;
- this.vlan_id = vlan_id;
+ public L3GatewayAttachment(final String l3GatewayServiceUuid, final long vlanId) {
+ this.l3GatewayServiceUuid = l3GatewayServiceUuid;
+ this.vlanId = vlanId;
}
public String getL3GatewayServiceUuid() {
- return l3_gateway_service_uuid;
+ return l3GatewayServiceUuid;
}
- public void setL3GatewayServiceUuid(String l3_gateway_service_uuid) {
- this.l3_gateway_service_uuid = l3_gateway_service_uuid;
+ public void setL3GatewayServiceUuid(final String l3GatewayServiceUuid) {
+ this.l3GatewayServiceUuid = l3GatewayServiceUuid;
}
public long getVlanId() {
- return vlan_id;
+ return vlanId;
}
- public void setVlanId(long vlan_id) {
- this.vlan_id = vlan_id;
+ public void setVlanId(long vlanId) {
+ this.vlanId = vlanId;
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterConfig.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterConfig.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterConfig.java
index 088cefc..5c99e15 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterConfig.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterConfig.java
@@ -22,26 +22,26 @@ import java.util.List;
*
*/
public class LogicalRouterConfig {
- private String display_name;
- private RoutingConfig routing_config;
- private String type = "LogicalRouterConfig";
+ private String displayName;
+ private RoutingConfig routingConfig;
+ private final String type = "LogicalRouterConfig";
private String uuid;
private List<NiciraNvpTag> tags;
public RoutingConfig getRoutingConfig() {
- return routing_config;
+ return routingConfig;
}
- public void setRoutingConfig(RoutingConfig routing_config) {
- this.routing_config = routing_config;
+ public void setRoutingConfig(RoutingConfig routingConfig) {
+ this.routingConfig = routingConfig;
}
public String getDisplayName() {
- return display_name;
+ return displayName;
}
- public void setDisplayName(String display_name) {
- this.display_name = display_name;
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
}
public String getUuid() {
@@ -59,5 +59,4 @@ public class LogicalRouterConfig {
public void setTags(List<NiciraNvpTag> tags) {
this.tags = tags;
}
-
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterPort.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterPort.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterPort.java
index 112825d..ed1b8da 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterPort.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterPort.java
@@ -22,13 +22,13 @@ import java.util.List;
*
*/
public class LogicalRouterPort {
- private String display_name;
+ private String displayName;
private List<NiciraNvpTag> tags;
private Integer portno;
- private boolean admin_status_enabled;
- private List<String> ip_addresses;
- private String mac_address;
- private String type = "LogicalRouterPortConfig";
+ private boolean adminStatusEnabled;
+ private List<String> ipAddresses;
+ private String macAddress;
+ private final String type = "LogicalRouterPortConfig";
private String uuid;
public int getPortno() {
@@ -40,35 +40,35 @@ public class LogicalRouterPort {
}
public boolean isAdminStatusEnabled() {
- return admin_status_enabled;
+ return adminStatusEnabled;
}
- public void setAdminStatusEnabled(boolean admin_status_enabled) {
- this.admin_status_enabled = admin_status_enabled;
+ public void setAdminStatusEnabled(boolean adminStatusEnabled) {
+ this.adminStatusEnabled = adminStatusEnabled;
}
public List<String> getIpAddresses() {
- return ip_addresses;
+ return ipAddresses;
}
- public void setIpAddresses(List<String> ip_addresses) {
- this.ip_addresses = ip_addresses;
+ public void setIpAddresses(List<String> ipAddresses) {
+ this.ipAddresses = ipAddresses;
}
public String getMacAddress() {
- return mac_address;
+ return macAddress;
}
- public void setMacAddress(String mac_address) {
- this.mac_address = mac_address;
+ public void setMacAddress(String macAddress) {
+ this.macAddress = macAddress;
}
public String getDisplayName() {
- return display_name;
+ return displayName;
}
- public void setDisplayName(String display_name) {
- this.display_name = display_name;
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
}
public List<NiciraNvpTag> getTags() {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitch.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitch.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitch.java
index f022ff7..c2d75a7 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitch.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitch.java
@@ -19,31 +19,29 @@ package com.cloud.network.nicira;
import java.util.List;
public class LogicalSwitch {
- private String display_name;
- private boolean port_isolation_enabled;
+ private String displayName;
+ private boolean portIsolationEnabled;
private List<NiciraNvpTag> tags;
- private List<TransportZoneBinding> transport_zones;
+ private List<TransportZoneBinding> transportZones;
private String type;
private String uuid;
- private String _href;
- //private RequestQueryParameters _query;
- //private LogicalSwitchRelations _relations;
- private String _schema;
+ private String href;
+ private String schema;
- public String getDisplay_name() {
- return display_name;
+ public String getDisplayName() {
+ return displayName;
}
- public void setDisplay_name(String display_name) {
- this.display_name = display_name;
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
}
- public boolean isPort_isolation_enabled() {
- return port_isolation_enabled;
+ public boolean isPortIsolationEnabled() {
+ return portIsolationEnabled;
}
- public void setPort_isolation_enabled(boolean port_isolation_enabled) {
- this.port_isolation_enabled = port_isolation_enabled;
+ public void setPortIsolationEnabled(boolean portIsolationEnabled) {
+ this.portIsolationEnabled = portIsolationEnabled;
}
public String getType() {
@@ -62,20 +60,20 @@ public class LogicalSwitch {
this.uuid = uuid;
}
- public String get_href() {
- return _href;
+ public String getHref() {
+ return href;
}
- public void set_href(String _href) {
- this._href = _href;
+ public void setHref(String href) {
+ this.href = href;
}
- public String get_schema() {
- return _schema;
+ public String getSchema() {
+ return schema;
}
- public void set_schema(String _schema) {
- this._schema = _schema;
+ public void setSchema(String schema) {
+ this.schema = schema;
}
public List<NiciraNvpTag> getTags() {
@@ -86,13 +84,12 @@ public class LogicalSwitch {
this.tags = tags;
}
- public List<TransportZoneBinding> getTransport_zones() {
- return transport_zones;
+ public List<TransportZoneBinding> getTransportZones() {
+ return transportZones;
}
- public void setTransport_zones(List<TransportZoneBinding> transport_zones) {
- this.transport_zones = transport_zones;
+ public void setTransportZones(List<TransportZoneBinding> transportZones) {
+ this.transportZones = transportZones;
}
-
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitchPort.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitchPort.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitchPort.java
index aaf5494..fb21e93 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitchPort.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitchPort.java
@@ -19,14 +19,13 @@ package com.cloud.network.nicira;
import java.util.List;
public class LogicalSwitchPort {
- private String display_name;
+ private String displayName;
private List<NiciraNvpTag> tags;
private Integer portno;
- private boolean admin_status_enabled;
- //private List<AddressPairs> allowed_address_pairs;
- private String queue_uuid;
- private List<String> security_profiles;
- private List<String> mirror_targets;
+ private boolean adminStatusEnabled;
+ private String queueUuid;
+ private List<String> securityProfiles;
+ private List<String> mirrorTargets;
private String type;
private String uuid;
@@ -34,20 +33,20 @@ public class LogicalSwitchPort {
super();
}
- public LogicalSwitchPort(String display_name, List<NiciraNvpTag> tags,
- boolean admin_status_enabled) {
+ public LogicalSwitchPort(final String displayName, final List<NiciraNvpTag> tags,
+ final boolean adminStatusEnabled) {
super();
- this.display_name = display_name;
+ this.displayName = displayName;
this.tags = tags;
- this.admin_status_enabled = admin_status_enabled;
+ this.adminStatusEnabled = adminStatusEnabled;
}
- public String getDisplay_name() {
- return display_name;
+ public String getDisplayName() {
+ return displayName;
}
- public void setDisplay_name(String display_name) {
- this.display_name = display_name;
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
}
public List<NiciraNvpTag> getTags() {
@@ -66,36 +65,36 @@ public class LogicalSwitchPort {
this.portno = portno;
}
- public boolean isAdmin_status_enabled() {
- return admin_status_enabled;
+ public boolean isAdminStatusEnabled() {
+ return adminStatusEnabled;
}
- public void setAdmin_status_enabled(boolean admin_status_enabled) {
- this.admin_status_enabled = admin_status_enabled;
+ public void setAdminStatusEnabled(boolean adminStatusEnabled) {
+ this.adminStatusEnabled = adminStatusEnabled;
}
- public String getQueue_uuid() {
- return queue_uuid;
+ public String getQueueUuid() {
+ return queueUuid;
}
- public void setQueue_uuid(String queue_uuid) {
- this.queue_uuid = queue_uuid;
+ public void setQueueUuid(String queueUuid) {
+ this.queueUuid = queueUuid;
}
- public List<String> getSecurity_profiles() {
- return security_profiles;
+ public List<String> getSecurityProfiles() {
+ return securityProfiles;
}
- public void setSecurity_profiles(List<String> security_profiles) {
- this.security_profiles = security_profiles;
+ public void setSecurityProfiles(List<String> securityProfiles) {
+ this.securityProfiles = securityProfiles;
}
- public List<String> getMirror_targets() {
- return mirror_targets;
+ public List<String> getMirrorTargets() {
+ return mirrorTargets;
}
- public void setMirror_targets(List<String> mirror_targets) {
- this.mirror_targets = mirror_targets;
+ public void setMirrorTargets(List<String> mirrorTargets) {
+ this.mirrorTargets = mirrorTargets;
}
public String getType() {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Match.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Match.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Match.java
index e437344..85c83a6 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Match.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Match.java
@@ -21,112 +21,134 @@ package com.cloud.network.nicira;
*/
public class Match {
private Integer protocol;
- private String source_ip_addresses;
- private String destination_ip_addresses;
- private Integer source_port;
- private Integer destination_port;
+ private String sourceIpAddresses;
+ private String destinationIpAddresses;
+ private Integer sourcePort;
+ private Integer destinationPort;
private String ethertype = "IPv4";
public Integer getProtocol() {
return protocol;
}
- public void setProtocol(Integer protocol) {
+ public void setProtocol(final Integer protocol) {
this.protocol = protocol;
}
public Integer getSourcePort() {
- return source_port;
+ return sourcePort;
}
- public void setSourcePort(Integer source_port) {
- this.source_port = source_port;
+ public void setSourcePort(final Integer sourcePort) {
+ this.sourcePort = sourcePort;
}
public Integer getDestinationPort() {
- return destination_port;
+ return destinationPort;
}
- public void setDestinationPort(Integer destination_port) {
- this.destination_port = destination_port;
+ public void setDestinationPort(final Integer destinationPort) {
+ this.destinationPort = destinationPort;
}
public String getEthertype() {
return ethertype;
}
- public void setEthertype(String ethertype) {
+ public void setEthertype(final String ethertype) {
this.ethertype = ethertype;
}
public String getSourceIpAddresses() {
- return source_ip_addresses;
+ return sourceIpAddresses;
}
- public void setSourceIpAddresses(String source_ip_addresses) {
- this.source_ip_addresses = source_ip_addresses;
+ public void setSourceIpAddresses(final String sourceIpAddresses) {
+ this.sourceIpAddresses = sourceIpAddresses;
}
public String getDestinationIpAddresses() {
- return destination_ip_addresses;
+ return destinationIpAddresses;
}
- public void setDestinationIpAddresses(String destination_ip_addresses) {
- this.destination_ip_addresses = destination_ip_addresses;
+ public void setDestinationIpAddresses(final String destinationIpAddresses) {
+ this.destinationIpAddresses = destinationIpAddresses;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((destination_ip_addresses == null) ? 0 : destination_ip_addresses.hashCode());
- result = prime * result + ((destination_port == null) ? 0 : destination_port.hashCode());
- result = prime * result + ((ethertype == null) ? 0 : ethertype.hashCode());
- result = prime * result + ((protocol == null) ? 0 : protocol.hashCode());
- result = prime * result + ((source_ip_addresses == null) ? 0 : source_ip_addresses.hashCode());
- result = prime * result + ((source_port == null) ? 0 : source_port.hashCode());
+ result = prime
+ * result
+ + ((destinationIpAddresses == null) ? 0
+ : destinationIpAddresses.hashCode());
+ result = prime
+ * result
+ + ((destinationPort == null) ? 0 : destinationPort
+ .hashCode());
+ result = prime * result
+ + ((ethertype == null) ? 0 : ethertype.hashCode());
+ result = prime * result
+ + ((protocol == null) ? 0 : protocol.hashCode());
+ result = prime
+ * result
+ + ((sourceIpAddresses == null) ? 0 : sourceIpAddresses
+ .hashCode());
+ result = prime * result
+ + ((sourcePort == null) ? 0 : sourcePort.hashCode());
return result;
}
@Override
- public boolean equals(Object obj) {
- if (this == obj)
+ public boolean equals(final Object obj) {
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
Match other = (Match) obj;
- if (destination_ip_addresses == null) {
- if (other.destination_ip_addresses != null)
+ if (destinationIpAddresses == null) {
+ if (other.destinationIpAddresses != null)
return false;
- } else if (!destination_ip_addresses.equals(other.destination_ip_addresses))
+ } else if (!destinationIpAddresses.equals(other.destinationIpAddresses)) {
return false;
- if (destination_port == null) {
- if (other.destination_port != null)
+ }
+ if (destinationPort == null) {
+ if (other.destinationPort != null) {
return false;
- } else if (!destination_port.equals(other.destination_port))
+ }
+ } else if (!destinationPort.equals(other.destinationPort)) {
return false;
+ }
if (ethertype == null) {
if (other.ethertype != null)
return false;
- } else if (!ethertype.equals(other.ethertype))
+ } else if (!ethertype.equals(other.ethertype)) {
return false;
+ }
if (protocol == null) {
if (other.protocol != null)
return false;
- } else if (!protocol.equals(other.protocol))
+ } else if (!protocol.equals(other.protocol)) {
return false;
- if (source_ip_addresses == null) {
- if (other.source_ip_addresses != null)
+ }
+ if (sourceIpAddresses == null) {
+ if (other.sourceIpAddresses != null)
return false;
- } else if (!source_ip_addresses.equals(other.source_ip_addresses))
+ } else if (!sourceIpAddresses.equals(other.sourceIpAddresses)) {
return false;
- if (source_port == null) {
- if (other.source_port != null)
+ }
+ if (sourcePort == null) {
+ if (other.sourcePort != null)
return false;
- } else if (!source_port.equals(other.source_port))
+ } else if (!sourcePort.equals(other.sourcePort)) {
return false;
+ }
return true;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NatRule.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NatRule.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NatRule.java
index f33f249..dd5720d 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NatRule.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NatRule.java
@@ -34,7 +34,7 @@ public abstract class NatRule {
return match;
}
- public void setMatch(Match match) {
+ public void setMatch(final Match match) {
this.match = match;
}
@@ -42,7 +42,7 @@ public abstract class NatRule {
return uuid;
}
- public void setUuid(UUID uuid) {
+ public void setUuid(final UUID uuid) {
this.uuid = uuid;
}
@@ -50,7 +50,7 @@ public abstract class NatRule {
return type;
}
- public void setType(String type) {
+ public void setType(final String type) {
this.type = type;
}
@@ -58,7 +58,7 @@ public abstract class NatRule {
return order;
}
- public void setOrder(int order) {
+ public void setOrder(final int order) {
this.order = order;
}
@@ -74,7 +74,7 @@ public abstract class NatRule {
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
@@ -102,7 +102,7 @@ public abstract class NatRule {
return true;
}
- public boolean equalsIgnoreUuid(Object obj) {
+ public boolean equalsIgnoreUuid(final Object obj) {
if (this == obj)
return true;
if (obj == null)
@@ -124,6 +124,4 @@ public abstract class NatRule {
return false;
return true;
}
-
-
}
[08/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
Revert "Revert "XS host free memory might change, if user manually changes dom0 memory,""
This reverts commit 74153e4a79a064139a6ecce48f8eb1308318beab.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9c739ef9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9c739ef9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9c739ef9
Branch: refs/heads/disk-cache
Commit: 9c739ef93dd3cf995c6b47cb3ad938cc0be989de
Parents: 8ec1f3f
Author: Anthony Xu <an...@citrix.com>
Authored: Thu Nov 14 11:58:55 2013 -0800
Committer: Anthony Xu <an...@citrix.com>
Committed: Thu Nov 14 11:58:55 2013 -0800
----------------------------------------------------------------------
.../src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java | 2 +-
server/src/com/cloud/capacity/CapacityManagerImpl.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9c739ef9/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index aadfc17..7a112ae 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -6035,7 +6035,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
Set<VM> vms = host.getResidentVMs(conn);
for (VM vm : vms) {
if (vm.getIsControlDomain(conn)) {
- dom0Ram = vm.getMemoryDynamicMax(conn);
+ dom0Ram = vm.getMemoryStaticMax(conn);
break;
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9c739ef9/server/src/com/cloud/capacity/CapacityManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/capacity/CapacityManagerImpl.java b/server/src/com/cloud/capacity/CapacityManagerImpl.java
index 70491bc..19cf70e 100755
--- a/server/src/com/cloud/capacity/CapacityManagerImpl.java
+++ b/server/src/com/cloud/capacity/CapacityManagerImpl.java
@@ -589,7 +589,7 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
CapacityVO cpuCap = _capacityDao.findByHostIdType(host.getId(), CapacityVO.CAPACITY_TYPE_CPU);
CapacityVO memCap = _capacityDao.findByHostIdType(host.getId(), CapacityVO.CAPACITY_TYPE_MEMORY);
-
+ memCap.setTotalCapacity(host.getTotalMemory());
if (cpuCap != null && memCap != null){
long hostTotalCpu = host.getCpus().longValue() * host.getSpeed().longValue();
[34/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
Fix listRouter by clusterId and upgradeRouterTemplate by clusterId
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a9413707
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a9413707
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a9413707
Branch: refs/heads/disk-cache
Commit: a9413707c9d3ade2b0244bd287353693991494fa
Parents: 065e5af
Author: Kishan Kavala <ki...@cloud.com>
Authored: Mon Nov 18 13:04:49 2013 +0530
Committer: Kishan Kavala <ki...@cloud.com>
Committed: Mon Nov 18 13:05:34 2013 +0530
----------------------------------------------------------------------
.../command/admin/router/ListRoutersCmd.java | 9 ++
.../com/cloud/vm/dao/DomainRouterDaoImpl.java | 17 +--
.../com/cloud/api/query/QueryManagerImpl.java | 13 ++-
.../cloud/api/query/vo/DomainRouterJoinVO.java | 7 ++
setup/db/db/schema-421to430.sql | 103 +++++++++++++++++++
5 files changed, 137 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a9413707/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
index 2752a13..528d1a9 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
@@ -21,6 +21,7 @@ import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.ClusterResponse;
import org.apache.cloudstack.api.response.DomainRouterResponse;
import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.ListResponse;
@@ -65,6 +66,10 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
description="the Zone ID of the router")
private Long zoneId;
+ @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType=ClusterResponse.class,
+ description="the cluster ID of the router")
+ private Long clusterId;
+
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType=NetworkResponse.class,
description="list by network id")
private Long networkId;
@@ -107,6 +112,10 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
return zoneId;
}
+ public Long getClusterId() {
+ return clusterId;
+ }
+
public Long getNetworkId() {
return networkId;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a9413707/engine/schema/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/DomainRouterDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
index 5158e98..1e5dc94 100755
--- a/engine/schema/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
+++ b/engine/schema/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
@@ -27,19 +27,15 @@ import org.springframework.stereotype.Component;
import com.cloud.host.HostVO;
import com.cloud.host.dao.HostDao;
-import com.cloud.host.dao.HostDaoImpl;
import com.cloud.network.Network;
import com.cloud.network.dao.RouterNetworkDao;
-import com.cloud.network.dao.RouterNetworkDaoImpl;
import com.cloud.network.dao.RouterNetworkVO;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.router.VirtualRouter.Role;
import com.cloud.offering.NetworkOffering;
import com.cloud.offerings.dao.NetworkOfferingDao;
-import com.cloud.offerings.dao.NetworkOfferingDaoImpl;
import com.cloud.user.UserStatisticsVO;
import com.cloud.user.dao.UserStatisticsDao;
-import com.cloud.user.dao.UserStatisticsDaoImpl;
import com.cloud.utils.db.DB;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.JoinBuilder.JoinType;
@@ -50,7 +46,6 @@ import com.cloud.utils.db.SearchCriteria.Op;
import com.cloud.utils.db.TransactionLegacy;
import com.cloud.utils.db.UpdateBuilder;
import com.cloud.vm.DomainRouterVO;
-import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.State;
@Component
@@ -63,6 +58,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
protected SearchBuilder<DomainRouterVO> HostUpSearch;
protected SearchBuilder<DomainRouterVO> StateNetworkTypeSearch;
protected SearchBuilder<DomainRouterVO> OutsidePodSearch;
+ protected SearchBuilder<DomainRouterVO> clusterSearch;
@Inject HostDao _hostsDao;
@Inject RouterNetworkDao _routerNetworkDao;
@Inject UserStatisticsDao _userStatsDao;
@@ -117,7 +113,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
StateNetworkTypeSearch = createSearchBuilder();
StateNetworkTypeSearch.select(null, Func.DISTINCT, StateNetworkTypeSearch.entity().getId());
StateNetworkTypeSearch.and("state", StateNetworkTypeSearch.entity().getState(), Op.EQ);
- SearchBuilder<RouterNetworkVO> joinRouterNetwork4 = _routerNetworkDao.createSearchBuilder();
+ SearchBuilder<RouterNetworkVO> joinRouterNetwork4 =_routerNetworkDao.createSearchBuilder();
joinRouterNetwork4.and("networkId", joinRouterNetwork4.entity().getNetworkId(), Op.EQ);
joinRouterNetwork4.and("type", joinRouterNetwork4.entity().getGuestType(), Op.EQ);
StateNetworkTypeSearch.join("networkRouter", joinRouterNetwork4, joinRouterNetwork4.entity().getRouterId(), StateNetworkTypeSearch.entity().getId(), JoinType.INNER);
@@ -139,6 +135,11 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
OutsidePodSearch.and("role", OutsidePodSearch.entity().getRole(), Op.EQ);
OutsidePodSearch.done();
+ clusterSearch = createSearchBuilder();
+ SearchBuilder<HostVO> clusterHost = _hostsDao.createSearchBuilder();
+ clusterHost.and("clusterId", clusterHost.entity().getClusterId(), Op.EQ);
+ clusterSearch.join("host", clusterHost, clusterSearch.entity().getHostId(), clusterHost.entity().getId(),JoinType.INNER);
+ clusterSearch.done();
}
@Override
@@ -205,8 +206,8 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
@Override
public List<DomainRouterVO> listByClusterId(Long clusterId) {
- SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
- //ToDo: Add cluster criteria
+ SearchCriteria<DomainRouterVO> sc = clusterSearch.create();
+ sc.setJoinParameters("host", "clusterId", clusterId);
return listBy(sc);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a9413707/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 35a539a..036b9bb 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -1095,7 +1095,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
@Override
public ListResponse<DomainRouterResponse> searchForRouters(ListRoutersCmd cmd) {
Pair<List<DomainRouterJoinVO>, Integer> result = searchForRoutersInternal(cmd, cmd.getId(), cmd.getRouterName(),
- cmd.getState(), cmd.getZoneId(), cmd.getPodId(), cmd.getHostId(), cmd.getKeyword(), cmd.getNetworkId(),
+ cmd.getState(), cmd.getZoneId(), cmd.getPodId(), cmd.getClusterId(), cmd.getHostId(), cmd.getKeyword(), cmd.getNetworkId(),
cmd.getVpcId(), cmd.getForVpc(), cmd.getRole(), cmd.getVersion());
ListResponse<DomainRouterResponse> response = new ListResponse<DomainRouterResponse>();
@@ -1108,7 +1108,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
@Override
public ListResponse<DomainRouterResponse> searchForInternalLbVms(ListInternalLBVMsCmd cmd) {
Pair<List<DomainRouterJoinVO>, Integer> result = searchForRoutersInternal(cmd, cmd.getId(), cmd.getRouterName(),
- cmd.getState(), cmd.getZoneId(), cmd.getPodId(), cmd.getHostId(), cmd.getKeyword(), cmd.getNetworkId(),
+ cmd.getState(), cmd.getZoneId(), cmd.getPodId(), null, cmd.getHostId(), cmd.getKeyword(), cmd.getNetworkId(),
cmd.getVpcId(), cmd.getForVpc(), cmd.getRole(), null);
ListResponse<DomainRouterResponse> response = new ListResponse<DomainRouterResponse>();
@@ -1119,7 +1119,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
}
private Pair<List<DomainRouterJoinVO>, Integer> searchForRoutersInternal(BaseListProjectAndAccountResourcesCmd cmd, Long id,
- String name, String state, Long zoneId, Long podId, Long hostId, String keyword, Long networkId, Long vpcId, Boolean forVpc,
+ String name, String state, Long zoneId, Long podId, Long clusterId, Long hostId, String keyword, Long networkId, Long vpcId, Boolean forVpc,
String role, String version) {
Account caller = CallContext.current().getCallingAccount();
@@ -1151,10 +1151,11 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
sb.and("state", sb.entity().getState(), SearchCriteria.Op.EQ);
sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
+ sb.and("clusterId", sb.entity().getClusterId(), SearchCriteria.Op.EQ);
sb.and("hostId", sb.entity().getHostId(), SearchCriteria.Op.EQ);
sb.and("vpcId", sb.entity().getVpcId(), SearchCriteria.Op.EQ);
sb.and("role", sb.entity().getRole(), SearchCriteria.Op.EQ);
- sb.and("version", sb.entity().getTemplateVersion(), SearchCriteria.Op.EQ);
+ sb.and("version", sb.entity().getTemplateVersion(), SearchCriteria.Op.LIKE);
if (forVpc != null) {
if (forVpc) {
@@ -1202,6 +1203,10 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
sc.setParameters("podId", podId);
}
+ if (clusterId != null) {
+ sc.setParameters("clusterId", clusterId);
+ }
+
if (hostId != null) {
sc.setParameters("hostId", hostId);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a9413707/server/src/com/cloud/api/query/vo/DomainRouterJoinVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/vo/DomainRouterJoinVO.java b/server/src/com/cloud/api/query/vo/DomainRouterJoinVO.java
index 33865e2..bba8943 100644
--- a/server/src/com/cloud/api/query/vo/DomainRouterJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/DomainRouterJoinVO.java
@@ -101,6 +101,9 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti
@Column(name="data_center_name")
private String dataCenterName = null;
+ @Column(name="cluster_id")
+ private long clusterId;
+
@Column(name="dns1")
private String dns1 = null;
@@ -334,6 +337,10 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti
return hostName;
}
+ public Long getClusterId() {
+ return clusterId;
+ }
+
public long getTemplateId() {
return templateId;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a9413707/setup/db/db/schema-421to430.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-421to430.sql b/setup/db/db/schema-421to430.sql
index 1c305f9..7191274 100644
--- a/setup/db/db/schema-421to430.sql
+++ b/setup/db/db/schema-421to430.sql
@@ -648,3 +648,106 @@ CREATE TABLE `cloud`.`remote_access_vpn_details` (
PRIMARY KEY (`id`),
CONSTRAINT `fk_remote_access_vpn_details__remote_access_vpn_id` FOREIGN KEY `fk_remote_access_vpn_details__remote_access_vpn_id`(`remote_access_vpn_id`) REFERENCES `remote_access_vpn`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+DROP VIEW IF EXISTS `cloud`.`domain_router_view`;
+CREATE VIEW `cloud`.`domain_router_view` AS
+ select
+ vm_instance.id id,
+ vm_instance.name name,
+ account.id account_id,
+ account.uuid account_uuid,
+ account.account_name account_name,
+ account.type account_type,
+ domain.id domain_id,
+ domain.uuid domain_uuid,
+ domain.name domain_name,
+ domain.path domain_path,
+ projects.id project_id,
+ projects.uuid project_uuid,
+ projects.name project_name,
+ vm_instance.uuid uuid,
+ vm_instance.created created,
+ vm_instance.state state,
+ vm_instance.removed removed,
+ vm_instance.pod_id pod_id,
+ vm_instance.instance_name instance_name,
+ host_pod_ref.uuid pod_uuid,
+ data_center.id data_center_id,
+ data_center.uuid data_center_uuid,
+ data_center.name data_center_name,
+ data_center.networktype data_center_type,
+ data_center.dns1 dns1,
+ data_center.dns2 dns2,
+ data_center.ip6_dns1 ip6_dns1,
+ data_center.ip6_dns2 ip6_dns2,
+ host.id host_id,
+ host.uuid host_uuid,
+ host.name host_name,
+ host.cluster_id cluster_id,
+ vm_template.id template_id,
+ vm_template.uuid template_uuid,
+ service_offering.id service_offering_id,
+ disk_offering.uuid service_offering_uuid,
+ disk_offering.name service_offering_name,
+ nics.id nic_id,
+ nics.uuid nic_uuid,
+ nics.network_id network_id,
+ nics.ip4_address ip_address,
+ nics.ip6_address ip6_address,
+ nics.ip6_gateway ip6_gateway,
+ nics.ip6_cidr ip6_cidr,
+ nics.default_nic is_default_nic,
+ nics.gateway gateway,
+ nics.netmask netmask,
+ nics.mac_address mac_address,
+ nics.broadcast_uri broadcast_uri,
+ nics.isolation_uri isolation_uri,
+ vpc.id vpc_id,
+ vpc.uuid vpc_uuid,
+ networks.uuid network_uuid,
+ networks.name network_name,
+ networks.network_domain network_domain,
+ networks.traffic_type traffic_type,
+ networks.guest_type guest_type,
+ async_job.id job_id,
+ async_job.uuid job_uuid,
+ async_job.job_status job_status,
+ async_job.account_id job_account_id,
+ domain_router.template_version template_version,
+ domain_router.scripts_version scripts_version,
+ domain_router.is_redundant_router is_redundant_router,
+ domain_router.redundant_state redundant_state,
+ domain_router.stop_pending stop_pending,
+ domain_router.role role
+ from
+ `cloud`.`domain_router`
+ inner join
+ `cloud`.`vm_instance` ON vm_instance.id = domain_router.id
+ inner join
+ `cloud`.`account` ON vm_instance.account_id = account.id
+ inner join
+ `cloud`.`domain` ON vm_instance.domain_id = domain.id
+ left join
+ `cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id
+ left join
+ `cloud`.`projects` ON projects.project_account_id = account.id
+ left join
+ `cloud`.`data_center` ON vm_instance.data_center_id = data_center.id
+ left join
+ `cloud`.`host` ON vm_instance.host_id = host.id
+ left join
+ `cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id
+ left join
+ `cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id
+ left join
+ `cloud`.`disk_offering` ON vm_instance.service_offering_id = disk_offering.id
+ left join
+ `cloud`.`nics` ON vm_instance.id = nics.instance_id and nics.removed is null
+ left join
+ `cloud`.`networks` ON nics.network_id = networks.id
+ left join
+ `cloud`.`vpc` ON domain_router.vpc_id = vpc.id and vpc.removed is null
+ left join
+ `cloud`.`async_job` ON async_job.instance_id = vm_instance.id
+ and async_job.instance_type = 'DomainRouter'
+ and async_job.job_status = 0;
[14/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-5176:
Added the cluster scope to vmware.reserve factors
Signed off by : nitin mehta<ni...@citrix.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1762dbbb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1762dbbb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1762dbbb
Branch: refs/heads/disk-cache
Commit: 1762dbbb17a6cf974db8e145b1c601d954cd4c06
Parents: 1f7ef65
Author: Nitin Mehta <ni...@citrix.com>
Authored: Thu Nov 14 15:19:49 2013 -0800
Committer: Nitin Mehta <ni...@citrix.com>
Committed: Thu Nov 14 15:44:13 2013 -0800
----------------------------------------------------------------------
server/src/com/cloud/configuration/Config.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1762dbbb/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index bc805b7..9f4fc95 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -258,8 +258,8 @@ public enum Config {
VmwareAdditionalVncPortRangeStart("Advanced", ManagementServer.class, Integer.class, "vmware.additional.vnc.portrange.start", "50000", "Start port number of additional VNC port range", null),
VmwareAdditionalVncPortRangeSize("Advanced", ManagementServer.class, Integer.class, "vmware.additional.vnc.portrange.size", "1000", "Start port number of additional VNC port range", null),
//VmwareGuestNicDeviceType("Advanced", ManagementServer.class, String.class, "vmware.guest.nic.device.type", "E1000", "Ethernet card type used in guest VM, valid values are E1000, PCNet32, Vmxnet2, Vmxnet3", null),
- VmwareReserveCpu("Advanced", ManagementServer.class, Boolean.class, "vmware.reserve.cpu", "false", "Specify whether or not to reserve CPU based on CPU overprovisioning factor", null),
- VmwareReserveMem("Advanced", ManagementServer.class, Boolean.class, "vmware.reserve.mem", "false", "Specify whether or not to reserve memory based on memory overprovisioning factor", null),
+ VmwareReserveCpu("Advanced", ManagementServer.class, Boolean.class, "vmware.reserve.cpu", "false", "Specify whether or not to reserve CPU based on CPU overprovisioning factor", null, ConfigurationParameterScope.cluster.toString()),
+ VmwareReserveMem("Advanced", ManagementServer.class, Boolean.class, "vmware.reserve.mem", "false", "Specify whether or not to reserve memory based on memory overprovisioning factor", null, ConfigurationParameterScope.cluster.toString()),
VmwareRootDiskControllerType("Advanced", ManagementServer.class, String.class, "vmware.root.disk.controller", "ide", "Specify the default disk controller for root volumes, valid values are scsi, ide", null),
VmwareSystemVmNicDeviceType("Advanced", ManagementServer.class, String.class, "vmware.systemvm.nic.device.type", "E1000", "Specify the default network device type for system VMs, valid values are E1000, PCNet32, Vmxnet2, Vmxnet3", null),
VmwareRecycleHungWorker("Advanced", ManagementServer.class, Boolean.class, "vmware.recycle.hung.wokervm", "false", "Specify whether or not to recycle hung worker VMs", null),
[36/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
Expose getPrimaryDataStore(String uuid) through the DatastoreManager interface so it can be used clients.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bb8f8fb2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bb8f8fb2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bb8f8fb2
Branch: refs/heads/disk-cache
Commit: bb8f8fb20b0e73d323301c5e084d4550f951c5db
Parents: a941370
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Mon Nov 18 14:11:18 2013 +0100
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Mon Nov 18 14:27:06 2013 +0100
----------------------------------------------------------------------
.../engine/subsystem/api/storage/DataStoreManager.java | 2 ++
.../cloudstack/storage/datastore/DataStoreManagerImpl.java | 5 +++++
2 files changed, 7 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bb8f8fb2/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreManager.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreManager.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreManager.java
index 7fbec0a..210d4ae 100644
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreManager.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreManager.java
@@ -27,6 +27,8 @@ public interface DataStoreManager {
DataStore getPrimaryDataStore(long storeId);
+ DataStore getPrimaryDataStore(String storeUuid);
+
DataStore getDataStore(String uuid, DataStoreRole role);
List<DataStore> getImageStoresByScope(ZoneScope scope);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bb8f8fb2/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java
index 88061aa..e6b2715 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java
@@ -88,6 +88,11 @@ public class DataStoreManagerImpl implements DataStoreManager {
}
@Override
+ public DataStore getPrimaryDataStore(String storeUuid) {
+ return primaryStoreMgr.getPrimaryDataStore(storeUuid);
+ }
+
+ @Override
public List<DataStore> getImageCacheStores(Scope scope) {
return imageDataStoreMgr.listImageCacheStores(scope);
}
[25/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-5147: Removing basic and sg tags from the test
case which is invalid for basic zone
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a6c2c6a2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a6c2c6a2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a6c2c6a2
Branch: refs/heads/disk-cache
Commit: a6c2c6a261af4871b0a8872f43068f15cc1da3cd
Parents: c141e41
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Fri Nov 15 16:25:10 2013 +0530
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Fri Nov 15 16:25:10 2013 +0530
----------------------------------------------------------------------
test/integration/component/test_resource_limits.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a6c2c6a2/test/integration/component/test_resource_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_resource_limits.py b/test/integration/component/test_resource_limits.py
index 377aa74..07fc5a5 100644
--- a/test/integration/component/test_resource_limits.py
+++ b/test/integration/component/test_resource_limits.py
@@ -1401,7 +1401,7 @@ class TestMaxAccountNetworks(cloudstackTestCase):
return
@attr(tags=["advanced", "advancedns", "simulator",
- "api", "basic", "eip", "sg"])
+ "api", "eip"])
def test_maxAccountNetworks(self):
"""Test Limit number of guest account specific networks
"""
[09/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
XS host free memory might change, if user manually changes dom0 memory,
this patch makes CS update latest XS host free memory on host connect process.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ac649b43
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ac649b43
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ac649b43
Branch: refs/heads/disk-cache
Commit: ac649b43e6863ffaef6d74e02a3ab450223cb170
Parents: 9c739ef
Author: Anthony Xu <an...@citrix.com>
Authored: Thu Nov 14 12:07:29 2013 -0800
Committer: Anthony Xu <an...@citrix.com>
Committed: Thu Nov 14 12:07:29 2013 -0800
----------------------------------------------------------------------
server/src/com/cloud/capacity/CapacityManagerImpl.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ac649b43/server/src/com/cloud/capacity/CapacityManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/capacity/CapacityManagerImpl.java b/server/src/com/cloud/capacity/CapacityManagerImpl.java
index 19cf70e..7245f14 100755
--- a/server/src/com/cloud/capacity/CapacityManagerImpl.java
+++ b/server/src/com/cloud/capacity/CapacityManagerImpl.java
@@ -589,9 +589,10 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
CapacityVO cpuCap = _capacityDao.findByHostIdType(host.getId(), CapacityVO.CAPACITY_TYPE_CPU);
CapacityVO memCap = _capacityDao.findByHostIdType(host.getId(), CapacityVO.CAPACITY_TYPE_MEMORY);
- memCap.setTotalCapacity(host.getTotalMemory());
if (cpuCap != null && memCap != null){
-
+ if ( host.getTotalMemory() != null ) {
+ memCap.setTotalCapacity(host.getTotalMemory());
+ }
long hostTotalCpu = host.getCpus().longValue() * host.getSpeed().longValue();
if (cpuCap.getTotalCapacity() != hostTotalCpu) {
[24/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-5180: Increasing the timeout for uploading volume
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c141e418
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c141e418
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c141e418
Branch: refs/heads/disk-cache
Commit: c141e418e927dadc90a87ad4e1a939091cfbe54e
Parents: 4f302c1
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Fri Nov 15 16:20:46 2013 +0530
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Fri Nov 15 16:23:18 2013 +0530
----------------------------------------------------------------------
tools/marvin/marvin/integration/lib/base.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c141e418/tools/marvin/marvin/integration/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base.py b/tools/marvin/marvin/integration/lib/base.py
index a3a5f58..b03c552 100755
--- a/tools/marvin/marvin/integration/lib/base.py
+++ b/tools/marvin/marvin/integration/lib/base.py
@@ -742,7 +742,7 @@ class Volume:
cmd.url = services["url"]
return Volume(apiclient.uploadVolume(cmd).__dict__)
- def wait_for_upload(self, apiclient, timeout=5, interval=60):
+ def wait_for_upload(self, apiclient, timeout=10, interval=60):
"""Wait for upload"""
# Sleep to ensure template is in proper state before download
time.sleep(interval)
[04/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
Revert "XS host free memory might change, if user manually changes dom0 memory,"
This reverts commit a1d09ae16f08c86bfca5c4a89dec371ef6d3ee67.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/74153e4a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/74153e4a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/74153e4a
Branch: refs/heads/disk-cache
Commit: 74153e4a79a064139a6ecce48f8eb1308318beab
Parents: 253da8f
Author: Anthony Xu <an...@citrix.com>
Authored: Wed Nov 13 15:37:45 2013 -0800
Committer: Anthony Xu <an...@citrix.com>
Committed: Wed Nov 13 15:38:42 2013 -0800
----------------------------------------------------------------------
.../src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java | 2 +-
server/src/com/cloud/capacity/CapacityManagerImpl.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/74153e4a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 7a112ae..aadfc17 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -6035,7 +6035,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
Set<VM> vms = host.getResidentVMs(conn);
for (VM vm : vms) {
if (vm.getIsControlDomain(conn)) {
- dom0Ram = vm.getMemoryStaticMax(conn);
+ dom0Ram = vm.getMemoryDynamicMax(conn);
break;
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/74153e4a/server/src/com/cloud/capacity/CapacityManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/capacity/CapacityManagerImpl.java b/server/src/com/cloud/capacity/CapacityManagerImpl.java
index 19cf70e..70491bc 100755
--- a/server/src/com/cloud/capacity/CapacityManagerImpl.java
+++ b/server/src/com/cloud/capacity/CapacityManagerImpl.java
@@ -589,7 +589,7 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
CapacityVO cpuCap = _capacityDao.findByHostIdType(host.getId(), CapacityVO.CAPACITY_TYPE_CPU);
CapacityVO memCap = _capacityDao.findByHostIdType(host.getId(), CapacityVO.CAPACITY_TYPE_MEMORY);
- memCap.setTotalCapacity(host.getTotalMemory());
+
if (cpuCap != null && memCap != null){
long hostTotalCpu = host.getCpus().longValue() * host.getSpeed().longValue();
[11/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-999: hyper-V: UI > zone wizard > Edit Traffic Type > send hypervnetworklabel to addTrafficType API.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9fc81f0b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9fc81f0b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9fc81f0b
Branch: refs/heads/disk-cache
Commit: 9fc81f0b4d6ccf236c6c0f2ec9c7382f68938049
Parents: 5fb7c29
Author: Jessica Wang <je...@apache.org>
Authored: Thu Nov 14 12:55:53 2013 -0800
Committer: Jessica Wang <je...@apache.org>
Committed: Thu Nov 14 12:56:59 2013 -0800
----------------------------------------------------------------------
ui/scripts/zoneWizard.js | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9fc81f0b/ui/scripts/zoneWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js
index f84812e..42fa799 100755
--- a/ui/scripts/zoneWizard.js
+++ b/ui/scripts/zoneWizard.js
@@ -79,6 +79,9 @@
case 'VMware':
hypervisorAttr = 'vmwarenetworklabel';
break;
+ case 'Hyperv':
+ hypervisorAttr = 'hypervnetworklabel';
+ break;
case 'BareMetal':
hypervisorAttr = 'baremetalnetworklabel';
break;
[02/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
Resource Metadata: added implementation for Remote Access VPN
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4a8e9f8b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4a8e9f8b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4a8e9f8b
Branch: refs/heads/disk-cache
Commit: 4a8e9f8b8da93a230843d22891676f9bdc1d17d7
Parents: 96b9eba
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Wed Nov 13 13:43:01 2013 -0800
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Wed Nov 13 14:26:16 2013 -0800
----------------------------------------------------------------------
api/src/com/cloud/server/ResourceTag.java | 2 +-
.../spring-engine-schema-core-daos-context.xml | 2 +-
.../resourcedetail/FirewallRuleDetailVO.java | 4 +-
.../resourcedetail/RemoteAccessVpnDetailVO.java | 80 ++++++++++++++++++++
.../resourcedetail/UserIpAddressDetailVO.java | 4 +-
.../dao/RemoteAccessVpnDetailsDao.java | 26 +++++++
.../dao/RemoteAccessVpnDetailsDaoImpl.java | 35 +++++++++
.../metadata/ResourceMetaDataManagerImpl.java | 4 +
setup/db/db/schema-421to430.sql | 10 +++
9 files changed, 161 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a8e9f8b/api/src/com/cloud/server/ResourceTag.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/server/ResourceTag.java b/api/src/com/cloud/server/ResourceTag.java
index e15a070..ba1aeb8 100644
--- a/api/src/com/cloud/server/ResourceTag.java
+++ b/api/src/com/cloud/server/ResourceTag.java
@@ -41,7 +41,7 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
NetworkACL (true, false),
StaticRoute (true, false),
VMSnapshot (true, false),
- RemoteAccessVpn (true, false),
+ RemoteAccessVpn (true, true),
Zone (false, true),
ServiceOffering (false, true),
Storage(false, true);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a8e9f8b/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml
----------------------------------------------------------------------
diff --git a/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml b/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml
index 0a5ae50..a8a1bff 100644
--- a/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml
+++ b/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml
@@ -322,7 +322,7 @@
<bean id="AffinityGroupDomainMapDaoImpl" class="org.apache.cloudstack.affinity.dao.AffinityGroupDomainMapDaoImpl" />
<bean id="FirewallRuleDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.FirewallRuleDetailsDaoImpl" />
<bean id="UserIpAddressDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.UserIpAddressDetailsDaoImpl" />
-
+ <bean id="RemoteAccessVpnDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.RemoteAccessVpnDetailsDaoImpl" />
<bean id="databaseIntegrityChecker" class="com.cloud.upgrade.DatabaseIntegrityChecker" />
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a8e9f8b/engine/schema/src/org/apache/cloudstack/resourcedetail/FirewallRuleDetailVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/FirewallRuleDetailVO.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/FirewallRuleDetailVO.java
index a2ec6ff..9b431f2 100644
--- a/engine/schema/src/org/apache/cloudstack/resourcedetail/FirewallRuleDetailVO.java
+++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/FirewallRuleDetailVO.java
@@ -47,8 +47,8 @@ public class FirewallRuleDetailVO implements ResourceDetail{
public FirewallRuleDetailVO() {}
- public FirewallRuleDetailVO(long networkId, String name, String value) {
- this.resourceId = networkId;
+ public FirewallRuleDetailVO(long id, String name, String value) {
+ this.resourceId = id;
this.name = name;
this.value = value;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a8e9f8b/engine/schema/src/org/apache/cloudstack/resourcedetail/RemoteAccessVpnDetailVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/RemoteAccessVpnDetailVO.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/RemoteAccessVpnDetailVO.java
new file mode 100644
index 0000000..625feb5
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/RemoteAccessVpnDetailVO.java
@@ -0,0 +1,80 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.resourcedetail;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.ResourceDetail;
+
+@Entity
+@Table(name="remote_access_vpn_details")
+public class RemoteAccessVpnDetailVO implements ResourceDetail{
+ @Id
+ @GeneratedValue(strategy= GenerationType.IDENTITY)
+ @Column(name="id")
+ private long id;
+
+ @Column(name="remote_access_vpn_id")
+ private long resourceId;
+
+ @Column(name="name")
+ private String name;
+
+ @Column(name="value", length=1024)
+ private String value;
+
+ @Column(name="display")
+ private boolean display;
+
+ public RemoteAccessVpnDetailVO() {}
+
+ public RemoteAccessVpnDetailVO(long id, String name, String value) {
+ this.resourceId = id;
+ this.name = name;
+ this.value = value;
+ }
+
+ @Override
+ public long getId() {
+ return id;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public long getResourceId() {
+ return resourceId;
+ }
+
+ @Override
+ public boolean isDisplay() {
+ return display;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a8e9f8b/engine/schema/src/org/apache/cloudstack/resourcedetail/UserIpAddressDetailVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/UserIpAddressDetailVO.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/UserIpAddressDetailVO.java
index 56a47c2..2b2f5e1 100644
--- a/engine/schema/src/org/apache/cloudstack/resourcedetail/UserIpAddressDetailVO.java
+++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/UserIpAddressDetailVO.java
@@ -47,8 +47,8 @@ public class UserIpAddressDetailVO implements ResourceDetail{
public UserIpAddressDetailVO() {}
- public UserIpAddressDetailVO(long networkId, String name, String value) {
- this.resourceId = networkId;
+ public UserIpAddressDetailVO(long id, String name, String value) {
+ this.resourceId = id;
this.name = name;
this.value = value;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a8e9f8b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/RemoteAccessVpnDetailsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/RemoteAccessVpnDetailsDao.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/RemoteAccessVpnDetailsDao.java
new file mode 100644
index 0000000..697c91b
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/RemoteAccessVpnDetailsDao.java
@@ -0,0 +1,26 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.resourcedetail.dao;
+
+import org.apache.cloudstack.resourcedetail.RemoteAccessVpnDetailVO;
+import org.apache.cloudstack.resourcedetail.ResourceDetailsDao;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface RemoteAccessVpnDetailsDao extends GenericDao<RemoteAccessVpnDetailVO, Long>, ResourceDetailsDao<RemoteAccessVpnDetailVO>{
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a8e9f8b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/RemoteAccessVpnDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/RemoteAccessVpnDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/RemoteAccessVpnDetailsDaoImpl.java
new file mode 100644
index 0000000..46e6be9
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/RemoteAccessVpnDetailsDaoImpl.java
@@ -0,0 +1,35 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.resourcedetail.dao;
+
+import javax.ejb.Local;
+
+import org.apache.cloudstack.resourcedetail.RemoteAccessVpnDetailVO;
+import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
+import org.springframework.stereotype.Component;
+
+
+@Component
+@Local (value={RemoteAccessVpnDetailsDao.class})
+public class RemoteAccessVpnDetailsDaoImpl extends ResourceDetailsDaoBase<RemoteAccessVpnDetailVO> implements RemoteAccessVpnDetailsDao {
+
+ @Override
+ public void addDetail(long resourceId, String key, String value) {
+ super.addDetail(new RemoteAccessVpnDetailVO(resourceId, key, value));
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a8e9f8b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
index 12ac26a..cf1254b 100644
--- a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
+++ b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
@@ -27,6 +27,7 @@ import javax.naming.ConfigurationException;
import org.apache.cloudstack.api.ResourceDetail;
import org.apache.cloudstack.resourcedetail.ResourceDetailsDao;
import org.apache.cloudstack.resourcedetail.dao.FirewallRuleDetailsDao;
+import org.apache.cloudstack.resourcedetail.dao.RemoteAccessVpnDetailsDao;
import org.apache.cloudstack.resourcedetail.dao.UserIpAddressDetailsDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
import org.apache.log4j.Logger;
@@ -78,6 +79,8 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
FirewallRuleDetailsDao _firewallRuleDetailsDao;
@Inject
UserIpAddressDetailsDao _userIpAddressDetailsDao;
+ @Inject
+ RemoteAccessVpnDetailsDao _vpnDetailsDao;
private static Map<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>> _daoMap=
new HashMap<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>>();
@@ -97,6 +100,7 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
_daoMap.put(ResourceObjectType.PublicIpAddress, _userIpAddressDetailsDao);
_daoMap.put(ResourceObjectType.PortForwardingRule, _firewallRuleDetailsDao);
_daoMap.put(ResourceObjectType.LoadBalancer, _firewallRuleDetailsDao);
+ _daoMap.put(ResourceObjectType.RemoteAccessVpn, _vpnDetailsDao);
return true;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a8e9f8b/setup/db/db/schema-421to430.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-421to430.sql b/setup/db/db/schema-421to430.sql
index 8b0d136..6507148 100644
--- a/setup/db/db/schema-421to430.sql
+++ b/setup/db/db/schema-421to430.sql
@@ -629,3 +629,13 @@ CREATE TABLE `cloud`.`user_ip_address_details` (
PRIMARY KEY (`id`),
CONSTRAINT `fk_user_ip_address_details__user_ip_address_id` FOREIGN KEY `fk_user_ip_address_details__user_ip_address_id`(`user_ip_address_id`) REFERENCES `user_ip_address`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE `cloud`.`remote_access_vpn_details` (
+ `id` bigint unsigned NOT NULL auto_increment,
+ `remote_access_vpn_id` bigint unsigned NOT NULL COMMENT 'Remote access vpn id',
+ `name` varchar(255) NOT NULL,
+ `value` varchar(1024) NOT NULL,
+ `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user',
+ PRIMARY KEY (`id`),
+ CONSTRAINT `fk_remote_access_vpn_details__remote_access_vpn_id` FOREIGN KEY `fk_remote_access_vpn_details__remote_access_vpn_id`(`remote_access_vpn_id`) REFERENCES `remote_access_vpn`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
[16/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-5148: Fix test_createSharedNetwork_projectSpecific
VM was being created with accountid and also project. By doing
this create vm or any other resource will fail. Only specify
project in which resource is created.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/186b82ae
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/186b82ae
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/186b82ae
Branch: refs/heads/disk-cache
Commit: 186b82ae3a420ae4d79efd2b04c4892fb9656f6f
Parents: c29cd9d
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Thu Nov 14 21:16:01 2013 -0500
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Thu Nov 14 21:16:01 2013 -0500
----------------------------------------------------------------------
test/integration/component/test_shared_networks.py | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/186b82ae/test/integration/component/test_shared_networks.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_shared_networks.py b/test/integration/component/test_shared_networks.py
index 66a9d26..28468c9 100644
--- a/test/integration/component/test_shared_networks.py
+++ b/test/integration/component/test_shared_networks.py
@@ -1696,25 +1696,19 @@ class TestSharedNetworks(cloudstackTestCase):
self.debug("Shared Network created: %s" % self.network.id)
- try:
+ with self.assertRaises(Exception):
self.project2_admin_account_virtual_machine = VirtualMachine.create(
self.api_client,
self.services["virtual_machine"],
- accountid=self.admin_account.name,
- domainid=self.admin_account.domainid,
networkids=self.network.id,
projectid=self.project2.id,
serviceofferingid=self.service_offering.id
)
- self.fail("Virtual Machine got created in admin account with network specified but the network used is of scope project and the project2 is not assigned for the network.")
- except Exception as e:
- self.debug("Virtual Machine creation failed as network used have scoped only for project project1. Exception: %s" % e)
-
+ self.debug("Deploying a vm to project other than the one in which \
+ network is created raised an Exception as expected")
self.project1_admin_account_virtual_machine = VirtualMachine.create(
self.api_client,
self.services["virtual_machine"],
- accountid=self.admin_account.name,
- domainid=self.admin_account.domainid,
networkids=self.network.id,
projectid=self.project1.id,
serviceofferingid=self.service_offering.id
[19/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-5168: Fixed test script issue related to SSH
command
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b178d064
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b178d064
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b178d064
Branch: refs/heads/disk-cache
Commit: b178d0645418faa947c414be4241e01657dcadb4
Parents: 868e944
Author: Ashutosh K <as...@clogeny.com>
Authored: Fri Nov 15 11:20:44 2013 +0530
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Fri Nov 15 11:24:30 2013 +0530
----------------------------------------------------------------------
test/integration/component/test_egress_rules.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b178d064/test/integration/component/test_egress_rules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_egress_rules.py b/test/integration/component/test_egress_rules.py
index 983b7ce..eb38c1a 100644
--- a/test/integration/component/test_egress_rules.py
+++ b/test/integration/component/test_egress_rules.py
@@ -907,7 +907,7 @@ class TestRevokeEgressRule(cloudstackTestCase):
# CIDR: 0.0.0.0/0
# 5. deployVirtualMachine into this security group (ssh)
# 6. deployed VM should be Running, ssh should be allowed into the VM,
- # ping out to google.com from the VM should fail,
+ # ping out to google.com from the VM should be successful,
# ssh from within VM to mgt server should pass
# 7. Revoke egress rule. Verify ping and SSH access to management server
# is restored
@@ -1005,7 +1005,7 @@ class TestRevokeEgressRule(cloudstackTestCase):
result = str(res)
self.assertEqual(
- result.count("0 received"),
+ result.count("1 received"),
1,
"Ping to outside world from VM should be successful"
)
@@ -1014,7 +1014,7 @@ class TestRevokeEgressRule(cloudstackTestCase):
self.debug("SSHing into management server from VM")
res = ssh.execute("ssh %s@%s" % (
self.services["mgmt_server"]["username"],
- self.services["mgmt_server"]["ipaddress"]
+ self.apiclient.connection.mgtSvr
))
self.debug("SSH result: %s" % str(res))
@@ -1062,16 +1062,16 @@ class TestRevokeEgressRule(cloudstackTestCase):
result = str(res)
self.assertEqual(
- result.count("1 received"),
+ result.count("0 received"),
1,
- "Ping to outside world from VM should be successful"
+ "Ping to outside world from VM should fail"
)
try:
self.debug("SSHing into management server from VM")
res = ssh.execute("ssh %s@%s" % (
self.services["mgmt_server"]["username"],
- self.services["mgmt_server"]["ipaddress"]
+ self.apiclient.connection.mgtSvr
))
self.debug("SSH result: %s" % str(res))
[26/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Posted by wi...@apache.org.
CLOUDSTACK-5179: Fixed test script issue related to detach
volume
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8a1918db
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8a1918db
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8a1918db
Branch: refs/heads/disk-cache
Commit: 8a1918dbe1c5fbbb60c21fa89d880a99e7b33bd6
Parents: a6c2c6a
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Fri Nov 15 16:31:05 2013 +0530
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Fri Nov 15 16:33:37 2013 +0530
----------------------------------------------------------------------
test/integration/component/test_stopped_vm.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8a1918db/test/integration/component/test_stopped_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_stopped_vm.py b/test/integration/component/test_stopped_vm.py
index 4514bb7..4ba94bf 100644
--- a/test/integration/component/test_stopped_vm.py
+++ b/test/integration/component/test_stopped_vm.py
@@ -770,7 +770,7 @@ class TestDeployVM(cloudstackTestCase):
type='DATADISK',
account=self.account.name,
domainid=self.account.domainid,
- listall=True
+ virtualmachineid=self.virtual_machine_2.id
)
self.assertEqual(
isinstance(volumes, list),