You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ml...@apache.org on 2014/03/14 06:33:54 UTC
[02/53] [abbrv] Merge branch 'master' into rbac.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java
index e28e4ab,96adf5f..d405c17
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java
@@@ -16,9 -16,7 +16,10 @@@
// under the License.
package org.apache.cloudstack.api.command.user.vpn;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.IAMEntityType;
+ import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
@@@ -37,7 -36,8 +38,9 @@@ import com.cloud.network.Site2SiteVpnCo
import com.cloud.network.Site2SiteVpnGateway;
import com.cloud.network.vpc.Vpc;
- @APICommand(name = "createVpnConnection", description = "Create site to site vpn connection", responseObject = Site2SiteVpnConnectionResponse.class, entityType = { IAMEntityType.Site2SiteVpnConnection })
-@APICommand(name = "createVpnConnection", description = "Create site to site vpn connection", responseObject = Site2SiteVpnConnectionResponse.class,
++
++@APICommand(name = "createVpnConnection", description = "Create site to site vpn connection", responseObject = Site2SiteVpnConnectionResponse.class, entityType = { IAMEntityType.Site2SiteVpnConnection },
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateVpnConnectionCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateVpnConnectionCmd.class.getName());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java
index 3cc6e17,1894835..b8de6e0
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java
@@@ -32,7 -31,8 +32,8 @@@ import org.apache.cloudstack.context.Ca
import com.cloud.event.EventTypes;
import com.cloud.network.Site2SiteCustomerGateway;
- @APICommand(name = "createVpnCustomerGateway", description = "Creates site to site vpn customer gateway", responseObject = Site2SiteCustomerGatewayResponse.class, entityType = { IAMEntityType.Site2SiteCustomerGateway })
-@APICommand(name = "createVpnCustomerGateway", description = "Creates site to site vpn customer gateway", responseObject = Site2SiteCustomerGatewayResponse.class,
++@APICommand(name = "createVpnCustomerGateway", description = "Creates site to site vpn customer gateway", responseObject = Site2SiteCustomerGatewayResponse.class, entityType = {IAMEntityType.Site2SiteCustomerGateway},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateVpnCustomerGatewayCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(CreateVpnCustomerGatewayCmd.class.getName());
@@@ -166,7 -166,7 +167,7 @@@
if (result != null) {
Site2SiteCustomerGatewayResponse response = _responseGenerator.createSite2SiteCustomerGatewayResponse(result);
response.setResponseName(getCommandName());
-- this.setResponseObject(response);
++ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create customer VPN gateway");
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java
index 19be21b,03fa9c4..12abfb6
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java
@@@ -16,9 -16,7 +16,10 @@@
// under the License.
package org.apache.cloudstack.api.command.user.vpn;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.IAMEntityType;
+ import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
@@@ -32,7 -31,8 +33,8 @@@ import com.cloud.event.EventTypes
import com.cloud.network.Site2SiteVpnGateway;
import com.cloud.network.vpc.Vpc;
- @APICommand(name = "createVpnGateway", description = "Creates site to site vpn local gateway", responseObject = Site2SiteVpnGatewayResponse.class, entityType = { IAMEntityType.Site2SiteVpnGateway })
-@APICommand(name = "createVpnGateway", description = "Creates site to site vpn local gateway", responseObject = Site2SiteVpnGatewayResponse.class,
++@APICommand(name = "createVpnGateway", description = "Creates site to site vpn local gateway", responseObject = Site2SiteVpnGatewayResponse.class, entityType = { IAMEntityType.Site2SiteVpnGateway },
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateVpnGatewayCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(CreateVpnGatewayCmd.class.getName());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java
index d3eacf5,c9464e0..7d0c5aa
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java
@@@ -33,7 -32,8 +33,8 @@@ import com.cloud.exception.InvalidParam
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.RemoteAccessVpn;
- @APICommand(name = "deleteRemoteAccessVpn", description = "Destroys a l2tp/ipsec remote access vpn", responseObject = SuccessResponse.class, entityType = { IAMEntityType.RemoteAccessVpn })
-@APICommand(name = "deleteRemoteAccessVpn", description = "Destroys a l2tp/ipsec remote access vpn", responseObject = SuccessResponse.class,
++@APICommand(name = "deleteRemoteAccessVpn", description = "Destroys a l2tp/ipsec remote access vpn", responseObject = SuccessResponse.class, entityType = {IAMEntityType.RemoteAccessVpn},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteRemoteAccessVpnCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteRemoteAccessVpnCmd.class.getName());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java
index 6fe8820,7014ed7..6034bcb
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java
@@@ -33,7 -32,8 +33,8 @@@ import com.cloud.exception.ResourceUnav
import com.cloud.network.Site2SiteVpnConnection;
import com.cloud.user.Account;
- @APICommand(name = "deleteVpnConnection", description = "Delete site to site vpn connection", responseObject = SuccessResponse.class, entityType = { IAMEntityType.Site2SiteVpnConnection })
-@APICommand(name = "deleteVpnConnection", description = "Delete site to site vpn connection", responseObject = SuccessResponse.class,
++@APICommand(name = "deleteVpnConnection", description = "Delete site to site vpn connection", responseObject = SuccessResponse.class, entityType = {IAMEntityType.Site2SiteVpnConnection},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteVpnConnectionCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteVpnConnectionCmd.class.getName());
@@@ -87,7 -87,7 +88,7 @@@
boolean result = _s2sVpnService.deleteVpnConnection(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
-- this.setResponseObject(response);
++ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete site to site VPN connection");
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java
index e24f231,4ba5b43..3faf5fd
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java
@@@ -34,7 -31,8 +34,8 @@@ import com.cloud.event.EventTypes
import com.cloud.network.Site2SiteCustomerGateway;
import com.cloud.user.Account;
- @APICommand(name = "deleteVpnCustomerGateway", description = "Delete site to site vpn customer gateway", responseObject = SuccessResponse.class, entityType = { IAMEntityType.Site2SiteCustomerGateway })
-@APICommand(name = "deleteVpnCustomerGateway", description = "Delete site to site vpn customer gateway", responseObject = SuccessResponse.class,
++@APICommand(name = "deleteVpnCustomerGateway", description = "Delete site to site vpn customer gateway", responseObject = SuccessResponse.class, entityType = {IAMEntityType.Site2SiteCustomerGateway},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteVpnCustomerGatewayCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteVpnCustomerGatewayCmd.class.getName());
@@@ -92,7 -89,7 +93,7 @@@
boolean result = _s2sVpnService.deleteCustomerGateway(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
-- this.setResponseObject(response);
++ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete customer VPN gateway");
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java
index 6f28037,41b78d9..66fd55b
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java
@@@ -32,7 -31,8 +32,8 @@@ import com.cloud.event.EventTypes
import com.cloud.network.Site2SiteVpnGateway;
import com.cloud.user.Account;
- @APICommand(name = "deleteVpnGateway", description = "Delete site to site vpn gateway", responseObject = SuccessResponse.class, entityType = { IAMEntityType.Site2SiteVpnGateway })
-@APICommand(name = "deleteVpnGateway", description = "Delete site to site vpn gateway", responseObject = SuccessResponse.class,
++@APICommand(name = "deleteVpnGateway", description = "Delete site to site vpn gateway", responseObject = SuccessResponse.class, entityType = {IAMEntityType.Site2SiteVpnGateway},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteVpnGatewayCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteVpnGatewayCmd.class.getName());
@@@ -86,7 -86,7 +87,7 @@@
result = _s2sVpnService.deleteVpnGateway(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
-- this.setResponseObject(response);
++ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete customer VPN gateway");
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/api/src/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java
index fde143c,bcf00d9..61a3a29
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java
@@@ -19,9 -19,7 +19,10 @@@ package org.apache.cloudstack.api.comma
import java.util.ArrayList;
import java.util.List;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.IAMEntityType;
+ import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
@@@ -34,7 -33,8 +35,8 @@@ import org.apache.cloudstack.api.respon
import com.cloud.network.RemoteAccessVpn;
import com.cloud.utils.Pair;
- @APICommand(name = "listRemoteAccessVpns", description = "Lists remote access vpns", responseObject = RemoteAccessVpnResponse.class, entityType = { IAMEntityType.RemoteAccessVpn })
-@APICommand(name = "listRemoteAccessVpns", description = "Lists remote access vpns", responseObject = RemoteAccessVpnResponse.class,
++@APICommand(name = "listRemoteAccessVpns", description = "Lists remote access vpns", responseObject = RemoteAccessVpnResponse.class, entityType = { IAMEntityType.RemoteAccessVpn },
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListRemoteAccessVpnsCmd extends BaseListProjectAndAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListRemoteAccessVpnsCmd.class.getName());
@@@ -97,6 -108,6 +110,6 @@@
}
response.setResponses(vpnResponses, vpns.second());
response.setResponseName(getCommandName());
-- this.setResponseObject(response);
++ setResponseObject(response);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java
index ed93741,1da2166..f8e81c2
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java
@@@ -19,9 -19,7 +19,10 @@@ package org.apache.cloudstack.api.comma
import java.util.ArrayList;
import java.util.List;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.IAMEntityType;
+ import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
@@@ -33,7 -32,8 +34,8 @@@ import org.apache.cloudstack.api.respon
import com.cloud.network.Site2SiteVpnConnection;
import com.cloud.utils.Pair;
- @APICommand(name = "listVpnConnections", description = "Lists site to site vpn connection gateways", responseObject = Site2SiteVpnConnectionResponse.class, entityType = { IAMEntityType.Site2SiteVpnConnection })
-@APICommand(name = "listVpnConnections", description = "Lists site to site vpn connection gateways", responseObject = Site2SiteVpnConnectionResponse.class,
++@APICommand(name = "listVpnConnections", description = "Lists site to site vpn connection gateways", responseObject = Site2SiteVpnConnectionResponse.class, entityType = { IAMEntityType.Site2SiteVpnConnection },
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListVpnConnectionsCmd extends BaseListProjectAndAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListVpnConnectionsCmd.class.getName());
@@@ -85,6 -96,6 +98,6 @@@
response.setResponses(connResponses, conns.second());
response.setResponseName(getCommandName());
-- this.setResponseObject(response);
++ setResponseObject(response);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java
index 2304964,e5bc1dc..fed96a7
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java
@@@ -32,7 -31,8 +32,8 @@@ import org.apache.cloudstack.api.respon
import com.cloud.network.Site2SiteCustomerGateway;
import com.cloud.utils.Pair;
- @APICommand(name = "listVpnCustomerGateways", description = "Lists site to site vpn customer gateways", responseObject = Site2SiteCustomerGatewayResponse.class, entityType = { IAMEntityType.Site2SiteCustomerGateway })
-@APICommand(name = "listVpnCustomerGateways", description = "Lists site to site vpn customer gateways", responseObject = Site2SiteCustomerGatewayResponse.class,
++@APICommand(name = "listVpnCustomerGateways", description = "Lists site to site vpn customer gateways", responseObject = Site2SiteCustomerGatewayResponse.class, entityType = {IAMEntityType.Site2SiteCustomerGateway},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListVpnCustomerGatewaysCmd extends BaseListProjectAndAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListVpnCustomerGatewaysCmd.class.getName());
@@@ -78,6 -78,6 +79,6 @@@
response.setResponses(gwResponses, gws.second());
response.setResponseName(getCommandName());
-- this.setResponseObject(response);
++ setResponseObject(response);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java
index 7f8a33f,359360b..1770225
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java
@@@ -19,9 -19,7 +19,10 @@@ package org.apache.cloudstack.api.comma
import java.util.ArrayList;
import java.util.List;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.IAMEntityType;
+ import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
@@@ -33,7 -32,8 +34,8 @@@ import org.apache.cloudstack.api.respon
import com.cloud.network.Site2SiteVpnGateway;
import com.cloud.utils.Pair;
- @APICommand(name = "listVpnGateways", description = "Lists site 2 site vpn gateways", responseObject = Site2SiteVpnGatewayResponse.class, entityType = { IAMEntityType.Site2SiteVpnGateway })
-@APICommand(name = "listVpnGateways", description = "Lists site 2 site vpn gateways", responseObject = Site2SiteVpnGatewayResponse.class,
++@APICommand(name = "listVpnGateways", description = "Lists site 2 site vpn gateways", responseObject = Site2SiteVpnGatewayResponse.class, entityType = { IAMEntityType.Site2SiteVpnGateway },
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListVpnGatewaysCmd extends BaseListProjectAndAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListVpnGatewaysCmd.class.getName());
@@@ -86,6 -97,6 +99,6 @@@
response.setResponses(gwResponses, gws.second());
response.setResponseName(getCommandName());
-- this.setResponseObject(response);
++ setResponseObject(response);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java
index 6efdaa1,16b7ced..1d8ea85
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java
@@@ -32,7 -31,8 +32,8 @@@ import org.apache.cloudstack.api.respon
import com.cloud.network.VpnUser;
import com.cloud.utils.Pair;
- @APICommand(name = "listVpnUsers", description = "Lists vpn users", responseObject = VpnUsersResponse.class, entityType = { IAMEntityType.VpnUser })
-@APICommand(name = "listVpnUsers", description = "Lists vpn users", responseObject = VpnUsersResponse.class,
++@APICommand(name = "listVpnUsers", description = "Lists vpn users", responseObject = VpnUsersResponse.class, entityType = {IAMEntityType.VpnUser},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListVpnUsersCmd extends BaseListProjectAndAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListVpnUsersCmd.class.getName());
@@@ -80,6 -80,6 +81,6 @@@
response.setResponses(vpnResponses, vpnUsers.second());
response.setResponseName(getCommandName());
-- this.setResponseObject(response);
++ setResponseObject(response);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java
index d39c1a4,d49a208..ed39c90
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java
@@@ -33,7 -32,8 +33,8 @@@ import org.apache.cloudstack.context.Ca
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
- @APICommand(name = "removeVpnUser", description = "Removes vpn user", responseObject = SuccessResponse.class, entityType = { IAMEntityType.VpnUser })
-@APICommand(name = "removeVpnUser", description = "Removes vpn user", responseObject = SuccessResponse.class,
++@APICommand(name = "removeVpnUser", description = "Removes vpn user", responseObject = SuccessResponse.class, entityType = {IAMEntityType.VpnUser},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class RemoveVpnUserCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(RemoveVpnUserCmd.class.getName());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java
index 025cc86,8c3f1d6..dcd60a4
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java
@@@ -34,7 -33,8 +34,8 @@@ import com.cloud.exception.ResourceUnav
import com.cloud.network.Site2SiteVpnConnection;
import com.cloud.user.Account;
- @APICommand(name = "resetVpnConnection", description = "Reset site to site vpn connection", responseObject = Site2SiteVpnConnectionResponse.class, entityType = { IAMEntityType.Site2SiteVpnConnection })
-@APICommand(name = "resetVpnConnection", description = "Reset site to site vpn connection", responseObject = Site2SiteVpnConnectionResponse.class,
++@APICommand(name = "resetVpnConnection", description = "Reset site to site vpn connection", responseObject = Site2SiteVpnConnectionResponse.class, entityType = {IAMEntityType.Site2SiteVpnConnection},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ResetVpnConnectionCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(ResetVpnConnectionCmd.class.getName());
@@@ -106,7 -106,7 +107,7 @@@
if (result != null) {
Site2SiteVpnConnectionResponse response = _responseGenerator.createSite2SiteVpnConnectionResponse(result);
response.setResponseName(getCommandName());
-- this.setResponseObject(response);
++ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset site to site VPN connection");
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java
index f88fa30,e0cafed..8425964
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java
@@@ -32,7 -31,8 +32,8 @@@ import org.apache.cloudstack.context.Ca
import com.cloud.event.EventTypes;
import com.cloud.network.Site2SiteCustomerGateway;
- @APICommand(name = "updateVpnCustomerGateway", description = "Update site to site vpn customer gateway", responseObject = Site2SiteCustomerGatewayResponse.class, entityType = { IAMEntityType.Site2SiteCustomerGateway })
-@APICommand(name = "updateVpnCustomerGateway", description = "Update site to site vpn customer gateway", responseObject = Site2SiteCustomerGatewayResponse.class,
++@APICommand(name = "updateVpnCustomerGateway", description = "Update site to site vpn customer gateway", responseObject = Site2SiteCustomerGatewayResponse.class, entityType = {IAMEntityType.Site2SiteCustomerGateway},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateVpnCustomerGatewayCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(UpdateVpnCustomerGatewayCmd.class.getName());
@@@ -169,7 -169,7 +170,7 @@@
if (result != null) {
Site2SiteCustomerGatewayResponse response = _responseGenerator.createSite2SiteCustomerGatewayResponse(result);
response.setResponseName(getCommandName());
-- this.setResponseObject(response);
++ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update customer VPN gateway");
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/zone/ListZonesCmd.java
index 1b2969d,0000000..34a5440
mode 100644,000000..100644
--- a/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesCmd.java
@@@ -1,132 -1,0 +1,134 @@@
+// 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.api.command.user.zone;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+
+import com.cloud.exception.InvalidParameterValueException;
+
- @APICommand(name = "listZones", description = "Lists zones", responseObject = ZoneResponse.class, responseView = ResponseView.Restricted)
++@APICommand(name = "listZones", description = "Lists zones", responseObject = ZoneResponse.class, responseView = ResponseView.Restricted,
++ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class ListZonesCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListZonesCmd.class.getName());
++
+ private static final String s_name = "listzonesresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the ID of the zone")
+ private Long id;
+
+ @Parameter(name = ApiConstants.AVAILABLE,
+ type = CommandType.BOOLEAN,
+ description = "true if you want to retrieve all available Zones. False if you only want to return the Zones"
+ + " from which you have at least one VM. Default is false.")
+ private Boolean available;
+
+ @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "the ID of the domain associated with the zone")
+ private Long domainId;
+
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the zone")
+ private String name;
+
+ @Parameter(name = ApiConstants.NETWORK_TYPE, type = CommandType.STRING, description = "the network type of the zone that the virtual machine belongs to")
+ private String networkType;
+
+ @Parameter(name = ApiConstants.SHOW_CAPACITIES, type = CommandType.BOOLEAN, description = "flag to display the capacity of the zones")
+ private Boolean showCapacities;
+
+ @Parameter(name = ApiConstants.TAGS, type = CommandType.MAP, description = "List zones by resource tags (key/value pairs)", since = "4.3")
+ private Map tags;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ public Boolean isAvailable() {
+ return available;
+ }
+
+ public Long getDomainId() {
+ return domainId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getNetworkType() {
+ return networkType;
+ }
+
+ public Boolean getShowCapacities() {
+ return showCapacities;
+ }
+
+ public Map<String, String> getTags() {
+ Map<String, String> tagsMap = null;
+ if (tags != null && !tags.isEmpty()) {
+ tagsMap = new HashMap<String, String>();
+ Collection<?> servicesCollection = tags.values();
+ Iterator<?> iter = servicesCollection.iterator();
+ while (iter.hasNext()) {
+ HashMap<String, String> services = (HashMap<String, String>)iter.next();
+ String key = services.get("key");
+ String value = services.get("value");
+ if (value == null) {
+ throw new InvalidParameterValueException("No value is passed in for key " + key);
+ }
+ tagsMap.put(key, value);
+ }
+ }
+ return tagsMap;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute() {
+
+ ListResponse<ZoneResponse> response = _queryService.listDataCenters(this);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/client/pom.xml
----------------------------------------------------------------------
diff --cc client/pom.xml
index cf2dab3,af724b1..eadd6e9
--- a/client/pom.xml
+++ b/client/pom.xml
@@@ -220,23 -220,8 +220,18 @@@
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-mom-inmemory</artifactId>
<version>${project.version}</version>
- </dependency>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-plugin-iam</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-iam</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-framework-ipc</artifactId>
<version>${project.version}</version>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/engine/components-api/src/com/cloud/network/addr/PublicIp.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
----------------------------------------------------------------------
diff --cc engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
index 0005983,7853c3b..6e55bd2
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
@@@ -706,60 -692,75 +706,75 @@@ public class NetworkOrchestrator extend
@Override
public void doInTransactionWithoutResult(TransactionStatus status) throws InsufficientCapacityException {
int deviceId = 0;
+ int size = 0;
+ for (Network ntwk : networks.keySet()) {
+ List<? extends NicProfile> profiles = networks.get(ntwk);
+ if (profiles != null && !profiles.isEmpty()) {
+ size = size + profiles.size();
+ } else {
+ size = size + 1;
+ }
+ }
- boolean[] deviceIds = new boolean[networks.size()];
+ boolean[] deviceIds = new boolean[size];
Arrays.fill(deviceIds, false);
- List<NicProfile> nics = new ArrayList<NicProfile>(networks.size());
+ List<NicProfile> nics = new ArrayList<NicProfile>(size);
NicProfile defaultNic = null;
- for (Map.Entry<? extends Network, ? extends NicProfile> network : networks.entrySet()) {
+ for (Map.Entry<? extends Network, List<? extends NicProfile>> network : networks.entrySet()) {
Network config = network.getKey();
- NicProfile requested = network.getValue();
+ List<? extends NicProfile> requestedProfiles = network.getValue();
+ if (requestedProfiles == null) {
+ requestedProfiles = new ArrayList<NicProfile>();
+ }
+ if (requestedProfiles.isEmpty()) {
+ requestedProfiles.add(null);
+ }
+ for (NicProfile requested : requestedProfiles) {
- Boolean isDefaultNic = false;
- if (vm != null && (requested != null && requested.isDefaultNic())) {
- isDefaultNic = true;
- }
+ Boolean isDefaultNic = false;
+ if (vm != null && (requested != null && requested.isDefaultNic())) {
+ isDefaultNic = true;
+ }
- while (deviceIds[deviceId] && deviceId < deviceIds.length) {
- deviceId++;
- }
+ while (deviceIds[deviceId] && deviceId < deviceIds.length) {
+ deviceId++;
+ }
- Pair<NicProfile, Integer> vmNicPair = allocateNic(requested, config, isDefaultNic, deviceId, vm);
+ Pair<NicProfile, Integer> vmNicPair = allocateNic(requested, config, isDefaultNic, deviceId, vm);
- NicProfile vmNic = vmNicPair.first();
- if (vmNic == null) {
- continue;
- }
+ NicProfile vmNic = vmNicPair.first();
+ if (vmNic == null) {
+ continue;
+ }
- deviceId = vmNicPair.second();
+ deviceId = vmNicPair.second();
- int devId = vmNic.getDeviceId();
- if (devId > deviceIds.length) {
- throw new IllegalArgumentException("Device id for nic is too large: " + vmNic);
- }
- if (deviceIds[devId]) {
- throw new IllegalArgumentException("Conflicting device id for two different nics: " + vmNic);
- }
+ int devId = vmNic.getDeviceId();
+ if (devId > deviceIds.length) {
+ throw new IllegalArgumentException("Device id for nic is too large: " + vmNic);
+ }
+ if (deviceIds[devId]) {
+ throw new IllegalArgumentException("Conflicting device id for two different nics: " + vmNic);
+ }
- deviceIds[devId] = true;
+ deviceIds[devId] = true;
- if (vmNic.isDefaultNic()) {
- if (defaultNic != null) {
- throw new IllegalArgumentException("You cannot specify two nics as default nics: nic 1 = " + defaultNic + "; nic 2 = " + vmNic);
- }
- defaultNic = vmNic;
+ if (vmNic.isDefaultNic()) {
+ if (defaultNic != null) {
+ throw new IllegalArgumentException("You cannot specify two nics as default nics: nic 1 = " + defaultNic + "; nic 2 = " + vmNic);
}
-
- nics.add(vmNic);
- vm.addNic(vmNic);
+ defaultNic = vmNic;
}
+
+ nics.add(vmNic);
+ vm.addNic(vmNic);
-
+ }
-
- if (nics.size() != networks.size()) {
- s_logger.warn("Number of nics " + nics.size() + " doesn't match number of requested networks " + networks.size());
- throw new CloudRuntimeException("Number of nics " + nics.size() + " doesn't match number of requested networks " + networks.size());
+ }
+ if (nics.size() != size) {
+ s_logger.warn("Number of nics " + nics.size() + " doesn't match number of requested nics " + size);
+ throw new CloudRuntimeException("Number of nics " + nics.size() + " doesn't match number of requested networks " + size);
}
if (nics.size() == 1) {
@@@ -1552,16 -1548,19 +1562,19 @@@
}
}
+ if (vm.getType() == Type.User
+ && _networkModel.areServicesSupportedInNetwork(network.getId(), Service.Dhcp)
+ && network.getTrafficType() == TrafficType.Guest
+ && network.getGuestType() == GuestType.Shared
+ && isLastNicInSubnet(nic)) {
- // remove the dhcpservice ip if this is the last nic in subnet.
- DhcpServiceProvider dhcpServiceProvider = getDhcpServiceProvider(network);
- if (dhcpServiceProvider != null
+ // remove the dhcpservice ip if this is the last nic in subnet.
+ DhcpServiceProvider dhcpServiceProvider = getDhcpServiceProvider(network);
+ if (dhcpServiceProvider != null
- && vm.getType() == Type.User
- && isDhcpAccrossMultipleSubnetsSupported(dhcpServiceProvider)
- && isLastNicInSubnet(nic)
- && network.getTrafficType() == TrafficType.Guest
- && network.getGuestType() == GuestType.Shared) {
+ && isDhcpAccrossMultipleSubnetsSupported(dhcpServiceProvider)) {
- removeDhcpServiceInSubnet(nic);
- }
+ removeDhcpServiceInSubnet(nic);
+ }
+ }
+
NetworkGuru guru = AdapterBase.getAdapterByName(networkGurus, network.getGuruName());
guru.deallocate(network, profile, vm);
_nicDao.remove(nic.getId());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/engine/schema/src/com/cloud/event/EventVO.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/engine/schema/src/com/cloud/network/as/AutoScaleVmGroupVO.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnVO.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionVO.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayVO.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/engine/schema/src/com/cloud/network/rules/FirewallRuleVO.java
----------------------------------------------------------------------
diff --cc engine/schema/src/com/cloud/network/rules/FirewallRuleVO.java
index 7d0ca79,0acc24a..5e22dd4
--- a/engine/schema/src/com/cloud/network/rules/FirewallRuleVO.java
+++ b/engine/schema/src/com/cloud/network/rules/FirewallRuleVO.java
@@@ -271,6 -274,15 +274,16 @@@ public class FirewallRuleVO implements
return trafficType;
}
++
+ public void setDisplay(boolean display) {
+ this.display = display;
+ }
+
+ @Override
+ public boolean isDisplay() {
+ return display;
+ }
+
@Override
public IAMEntityType getEntityType() {
return IAMEntityType.FirewallRule;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/engine/schema/src/com/cloud/network/vpc/VpcVO.java
----------------------------------------------------------------------
diff --cc engine/schema/src/com/cloud/network/vpc/VpcVO.java
index edd984a,d1cfd7c..39bea77
--- a/engine/schema/src/com/cloud/network/vpc/VpcVO.java
+++ b/engine/schema/src/com/cloud/network/vpc/VpcVO.java
@@@ -185,6 -188,15 +188,16 @@@ public class VpcVO implements Vpc
this.uuid = uuid;
}
++
+ public void setDisplay(boolean display) {
+ this.display = display;
+ }
+
+ @Override
+ public boolean isDisplay() {
+ return display;
+ }
+
@Override
public IAMEntityType getEntityType() {
return IAMEntityType.Vpc;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/engine/schema/src/com/cloud/storage/VMTemplateVO.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/engine/schema/src/com/cloud/storage/VolumeVO.java
----------------------------------------------------------------------
diff --cc engine/schema/src/com/cloud/storage/VolumeVO.java
index af80af8,82f47d4..af99a16
--- a/engine/schema/src/com/cloud/storage/VolumeVO.java
+++ b/engine/schema/src/com/cloud/storage/VolumeVO.java
@@@ -601,6 -597,10 +597,11 @@@ public class VolumeVO implements Volum
@Override
public Integer getHypervisorSnapshotReserve() {
return hypervisorSnapshotReserve;
+
}
+
+ @Override
+ public IAMEntityType getEntityType() {
+ return IAMEntityType.Volume;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/engine/schema/src/com/cloud/vm/VMInstanceVO.java
----------------------------------------------------------------------
diff --cc engine/schema/src/com/cloud/vm/VMInstanceVO.java
index a09c34f,437db54..ddeebfe
--- a/engine/schema/src/com/cloud/vm/VMInstanceVO.java
+++ b/engine/schema/src/com/cloud/vm/VMInstanceVO.java
@@@ -537,5 -536,9 +541,4 @@@ public class VMInstanceVO implements Vi
public void setPowerHostId(Long hostId) {
powerHostId = hostId;
}
--
- @Override
- public IAMEntityType getEntityType() {
- return IAMEntityType.VirtualMachine;
- }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/engine/schema/src/com/cloud/vm/dao/NicIpAliasVO.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/framework/db/src/com/cloud/utils/db/SearchBase.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancerNetworksCmd.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallNetworksCmd.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancerNetworksCmd.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDeviceNetworksCmd.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/plugins/network-elements/palo-alto/src/com/cloud/api/commands/ListPaloAltoFirewallNetworksCmd.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapCreateAccountCmd.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/server/src/com/cloud/api/ApiDispatcher.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/server/src/com/cloud/api/ApiServer.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/api/ApiServer.java
index 158a897,05fe6e8..5ab65f4
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@@ -379,7 -382,13 +386,13 @@@ public class ApiServer extends ManagerB
// This is where the command is either serialized, or directly dispatched
response = queueCommand(cmdObj, paramMap);
+ if (annotation.responseHasSensitiveInfo())
+ {
+ buildAuditTrail(auditTrailSb, command[0],
+ StringUtils.cleanString(response));
+ }
+ else
- buildAuditTrail(auditTrailSb, command[0], response);
+ buildAuditTrail(auditTrailSb, command[0], response);
} else {
if (!command[0].equalsIgnoreCase("login") && !command[0].equalsIgnoreCase("logout")) {
String errorString = "Unknown API command: " + command[0];
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/api/query/QueryManagerImpl.java
index e46e0f4,66794c0..564bf4e
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@@ -514,10 -508,15 +515,15 @@@ public class QueryManagerImpl extends M
sb.and("archived", sb.entity().getArchived(), SearchCriteria.Op.EQ);
SearchCriteria<EventJoinVO> sc = sb.create();
+ SearchCriteria<EventJoinVO> aclSc = _eventJoinDao.createSearchCriteria();
+ // building ACL search criteria
+ _accountMgr.buildACLViewSearchCriteria(sc, aclSc, isRecursive, permittedDomains, permittedAccounts, permittedResources, listProjectResourcesCriteria);
+ // For end users display only enabled events
+ if(!_accountMgr.isRootAdmin(caller.getType())){
+ sc.setParameters("displayEvent", true);
+ }
+
- // building ACL condition
- _accountMgr.buildACLViewSearchCriteria(sc, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
-
if (id != null) {
sc.setParameters("id", id);
}
@@@ -736,54 -719,90 +742,56 @@@
boolean listAll = cmd.listAll();
Long id = cmd.getId();
Map<String, String> tags = cmd.getTags();
+ Boolean display = cmd.getDisplay();
-
- Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject =
- new Ternary<Long, Boolean, ListProjectResourcesCriteria>(cmd.getDomainId(), cmd.isRecursive(), null);
- _accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, listAll, false);
- Long domainId = domainIdRecursiveListProject.first();
+ Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject = new Ternary<Long, Boolean, ListProjectResourcesCriteria>(
+ cmd.getDomainId(), cmd.isRecursive(), null);
+ _accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), cmd.getProjectId(), permittedDomains, permittedAccounts, permittedResources,
+ domainIdRecursiveListProject, listAll, false, "listVirtualMachines");
+ //Long domainId = domainIdRecursiveListProject.first();
Boolean isRecursive = domainIdRecursiveListProject.second();
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.third();
- Criteria c = new Criteria("id", Boolean.TRUE, cmd.getStartIndex(), cmd.getPageSizeVal());
- // Criteria c = new Criteria(null, Boolean.FALSE, cmd.getStartIndex(),
- // cmd.getPageSizeVal()); //version without default sorting
- c.addCriteria(Criteria.KEYWORD, cmd.getKeyword());
- c.addCriteria(Criteria.ID, cmd.getId());
- c.addCriteria(Criteria.NAME, cmd.getName());
- c.addCriteria(Criteria.STATE, cmd.getState());
- c.addCriteria(Criteria.DATACENTERID, cmd.getZoneId());
- c.addCriteria(Criteria.GROUPID, cmd.getGroupId());
- c.addCriteria(Criteria.FOR_VIRTUAL_NETWORK, cmd.getForVirtualNetwork());
- c.addCriteria(Criteria.NETWORKID, cmd.getNetworkId());
- c.addCriteria(Criteria.TEMPLATE_ID, cmd.getTemplateId());
- c.addCriteria(Criteria.ISO_ID, cmd.getIsoId());
- c.addCriteria(Criteria.VPC_ID, cmd.getVpcId());
- c.addCriteria(Criteria.AFFINITY_GROUP_ID, cmd.getAffinityGroupId());
- c.addCriteria(Criteria.SERVICE_OFFERING_ID, cmd.getServiceOfferingId());
- c.addCriteria(Criteria.DISPLAY, cmd.getDisplay());
-
- if (domainId != null) {
- c.addCriteria(Criteria.DOMAINID, domainId);
- }
+ Filter searchFilter = new Filter(UserVmJoinVO.class, "id", true, cmd.getStartIndex(),
+ cmd.getPageSizeVal());
- if (HypervisorType.getType(hypervisor) != HypervisorType.None) {
- c.addCriteria(Criteria.HYPERVISOR, hypervisor);
- } else if (hypervisor != null) {
- throw new InvalidParameterValueException("Invalid HypervisorType " + hypervisor);
- }
+ // first search distinct vm id by using query criteria and pagination
+ SearchBuilder<UserVmJoinVO> sb = _userVmJoinDao.createSearchBuilder();
+ sb.select(null, Func.DISTINCT, sb.entity().getId()); // select distinct ids
- // ignore these search requests if it's not an admin
+ String hypervisor = cmd.getHypervisor();
+ Object name = cmd.getName();
+ Object state = cmd.getState();
+ Object zoneId = cmd.getZoneId();
+ Object keyword = cmd.getKeyword();
+ boolean isAdmin = false;
+ boolean isRootAdmin = false;
if (_accountMgr.isAdmin(caller.getType())) {
- c.addCriteria(Criteria.PODID, cmd.getPodId());
- c.addCriteria(Criteria.HOSTID, cmd.getHostId());
- c.addCriteria(Criteria.STORAGE_ID, cmd.getStorageId());
+ isAdmin = true;
}
-
- if (!permittedAccounts.isEmpty()) {
- c.addCriteria(Criteria.ACCOUNTID, permittedAccounts.toArray());
+ if (_accountMgr.isRootAdmin(caller.getId())) {
+ isRootAdmin = true;
}
- c.addCriteria(Criteria.ISADMIN, _accountMgr.isAdmin(caller.getType()));
- return searchForUserVMsByCriteria(c, caller, domainId, isRecursive, permittedAccounts, listAll, listProjectResourcesCriteria, tags);
- }
-
- private Pair<List<UserVmJoinVO>, Integer> searchForUserVMsByCriteria(Criteria c, Account caller, Long domainId, boolean isRecursive, List<Long> permittedAccounts,
- boolean listAll, ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String> tags) {
- Filter searchFilter = new Filter(UserVmJoinVO.class, c.getOrderBy(), c.getAscending(), c.getOffset(), c.getLimit());
- boolean isRootAdmin = _accountMgr.isRootAdmin(caller.getType());
-
- // first search distinct vm id by using query criteria and pagination
- SearchBuilder<UserVmJoinVO> sb = _userVmJoinDao.createSearchBuilder();
- sb.select(null, Func.DISTINCT, sb.entity().getId()); // select distinct
- // ids
- _accountMgr.buildACLViewSearchBuilder(sb, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
-
- Object id = c.getCriteria(Criteria.ID);
- Object name = c.getCriteria(Criteria.NAME);
- Object state = c.getCriteria(Criteria.STATE);
- Object notState = c.getCriteria(Criteria.NOTSTATE);
- Object zoneId = c.getCriteria(Criteria.DATACENTERID);
- Object pod = c.getCriteria(Criteria.PODID);
- Object hostId = c.getCriteria(Criteria.HOSTID);
- Object hostName = c.getCriteria(Criteria.HOSTNAME);
- Object keyword = c.getCriteria(Criteria.KEYWORD);
- Object isAdmin = c.getCriteria(Criteria.ISADMIN);
- assert c.getCriteria(Criteria.IPADDRESS) == null : "We don't support search by ip address on VM any more. If you see this assert, it means we have to find a different way to search by the nic table.";
- Object groupId = c.getCriteria(Criteria.GROUPID);
- Object networkId = c.getCriteria(Criteria.NETWORKID);
- Object hypervisor = c.getCriteria(Criteria.HYPERVISOR);
- Object storageId = c.getCriteria(Criteria.STORAGE_ID);
- Object templateId = c.getCriteria(Criteria.TEMPLATE_ID);
- Object isoId = c.getCriteria(Criteria.ISO_ID);
- Object vpcId = c.getCriteria(Criteria.VPC_ID);
- Object affinityGroupId = c.getCriteria(Criteria.AFFINITY_GROUP_ID);
- Object serviceOffId = c.getCriteria(Criteria.SERVICE_OFFERING_ID);
- Object display = c.getCriteria(Criteria.DISPLAY);
+ Object groupId = cmd.getGroupId();
+ Object networkId = cmd.getNetworkId();
+ if (HypervisorType.getType(hypervisor) == HypervisorType.None && hypervisor != null) {
+ // invalid hypervisor type input
+ throw new InvalidParameterValueException("Invalid HypervisorType " + hypervisor);
+ }
+ Object templateId = cmd.getTemplateId();
+ Object isoId = cmd.getIsoId();
+ Object vpcId = cmd.getVpcId();
+ Object affinityGroupId = cmd.getAffinityGroupId();
++ Object serviceOffId = cmd.getServiceOfferingId();
+ Object pod = null;
+ Object hostId = null;
+ Object storageId = null;
+ if (cmd instanceof ListVMsCmdByAdmin) {
+ ListVMsCmdByAdmin adCmd = (ListVMsCmdByAdmin)cmd;
+ pod = adCmd.getPodId();
+ hostId = adCmd.getHostId();
+ storageId = adCmd.getStorageId();
+ }
sb.and("displayName", sb.entity().getDisplayName(), SearchCriteria.Op.LIKE);
sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
@@@ -1624,16 -1636,21 +1646,18 @@@
String keyword = cmd.getKeyword();
String type = cmd.getType();
Map<String, String> tags = cmd.getTags();
- boolean isRootAdmin = _accountMgr.isRootAdmin(caller.getType());
Long storageId = cmd.getStorageId();
+ Long diskOffId = cmd.getDiskOfferingId();
+ Boolean display = cmd.getDisplay();
Long zoneId = cmd.getZoneId();
- Long podId = null;
- if (_accountMgr.isAdmin(caller.getType())) {
- podId = cmd.getPodId();
- }
+ Long podId = cmd.getPodId();
- Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject =
- new Ternary<Long, Boolean, ListProjectResourcesCriteria>(cmd.getDomainId(), cmd.isRecursive(), null);
- _accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, cmd.listAll(), false);
- Long domainId = domainIdRecursiveListProject.first();
+ Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject = new Ternary<Long, Boolean, ListProjectResourcesCriteria>(
+ cmd.getDomainId(), cmd.isRecursive(), null);
+ _accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), cmd.getProjectId(), permittedDomains, permittedAccounts, permittedResources,
+ domainIdRecursiveListProject, cmd.listAll(), false, "listVolumes");
+// Long domainId = domainIdRecursiveListProject.first();
Boolean isRecursive = domainIdRecursiveListProject.second();
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.third();
Filter searchFilter = new Filter(VolumeJoinVO.class, "created", false, cmd.getStartIndex(), cmd.getPageSizeVal());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/server/src/com/cloud/api/query/vo/EventJoinVO.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/server/src/com/cloud/api/query/vo/VolumeJoinVO.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/api/query/vo/VolumeJoinVO.java
index 9685d02,ce26c1f..289b0b8
--- a/server/src/com/cloud/api/query/vo/VolumeJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/VolumeJoinVO.java
@@@ -569,6 -572,10 +572,11 @@@ public class VolumeJoinVO extends BaseV
return path;
}
++
+ public String getChainInfo() {
+ return chainInfo;
+ }
+
@Override
public IAMEntityType getEntityType() {
return IAMEntityType.Volume;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/server/src/com/cloud/api/response/ApiResponseSerializer.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/api/response/ApiResponseSerializer.java
index c254520,e9633a7..482834a
--- a/server/src/com/cloud/api/response/ApiResponseSerializer.java
+++ b/server/src/com/cloud/api/response/ApiResponseSerializer.java
@@@ -26,11 -26,7 +26,12 @@@ import java.util.List
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.apache.log4j.Logger;
+
+import com.google.gson.Gson;
+import com.google.gson.annotations.SerializedName;
+
+ import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.ResponseObject;
@@@ -39,6 -35,8 +40,7 @@@ import org.apache.cloudstack.api.respon
import org.apache.cloudstack.api.response.ExceptionResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+ import org.apache.cloudstack.context.CallContext;
-import org.apache.log4j.Logger;
import com.cloud.api.ApiDBUtils;
import com.cloud.api.ApiResponseGsonHelper;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/server/src/com/cloud/network/IpAddressManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/network/IpAddressManagerImpl.java
index dbec06f,8903d1d..5905fd3
--- a/server/src/com/cloud/network/IpAddressManagerImpl.java
+++ b/server/src/com/cloud/network/IpAddressManagerImpl.java
@@@ -638,14 -643,14 +643,14 @@@ public class IpAddressManagerImpl exten
@Override
public PublicIp assignPublicIpAddress(long dcId, Long podId, Account owner, VlanType type, Long networkId, String requestedIp, boolean isSystem)
- throws InsufficientAddressCapacityException {
+ throws InsufficientAddressCapacityException {
- return fetchNewPublicIp(dcId, podId, null, owner, type, networkId, false, true, requestedIp, isSystem, null);
+ return fetchNewPublicIp(dcId, podId, null, owner, type, networkId, false, true, requestedIp, isSystem, null, null);
}
@Override
public PublicIp assignPublicIpAddressFromVlans(long dcId, Long podId, Account owner, VlanType type, List<Long> vlanDbIds, Long networkId, String requestedIp, boolean isSystem)
- throws InsufficientAddressCapacityException {
+ throws InsufficientAddressCapacityException {
- return fetchNewPublicIp(dcId, podId, vlanDbIds, owner, type, networkId, false, true, requestedIp, isSystem, null);
+ return fetchNewPublicIp(dcId, podId, vlanDbIds, owner, type, networkId, false, true, requestedIp, isSystem, null, null);
}
@DB
@@@ -654,129 -660,132 +660,132 @@@
IPAddressVO addr = Transaction.execute(new TransactionCallbackWithException<IPAddressVO, InsufficientAddressCapacityException>() {
@Override
public IPAddressVO doInTransaction(TransactionStatus status) throws InsufficientAddressCapacityException {
- StringBuilder errorMessage = new StringBuilder("Unable to get ip adress in ");
- boolean fetchFromDedicatedRange = false;
- List<Long> dedicatedVlanDbIds = new ArrayList<Long>();
- List<Long> nonDedicatedVlanDbIds = new ArrayList<Long>();
-
- SearchCriteria<IPAddressVO> sc = null;
- if (podId != null) {
- sc = AssignIpAddressFromPodVlanSearch.create();
- sc.setJoinParameters("podVlanMapSB", "podId", podId);
- errorMessage.append(" pod id=" + podId);
- } else {
- sc = AssignIpAddressSearch.create();
- errorMessage.append(" zone id=" + dcId);
- }
+ StringBuilder errorMessage = new StringBuilder("Unable to get ip adress in ");
+ boolean fetchFromDedicatedRange = false;
+ List<Long> dedicatedVlanDbIds = new ArrayList<Long>();
+ List<Long> nonDedicatedVlanDbIds = new ArrayList<Long>();
+
+ SearchCriteria<IPAddressVO> sc = null;
+ if (podId != null) {
+ sc = AssignIpAddressFromPodVlanSearch.create();
+ sc.setJoinParameters("podVlanMapSB", "podId", podId);
+ errorMessage.append(" pod id=" + podId);
+ } else {
+ sc = AssignIpAddressSearch.create();
+ errorMessage.append(" zone id=" + dcId);
+ }
- // If owner has dedicated Public IP ranges, fetch IP from the dedicated range
- // Otherwise fetch IP from the system pool
- List<AccountVlanMapVO> maps = _accountVlanMapDao.listAccountVlanMapsByAccount(owner.getId());
- for (AccountVlanMapVO map : maps) {
- if (vlanDbIds == null || vlanDbIds.contains(map.getVlanDbId()))
- dedicatedVlanDbIds.add(map.getVlanDbId());
- }
- List<VlanVO> nonDedicatedVlans = _vlanDao.listZoneWideNonDedicatedVlans(dcId);
- for (VlanVO nonDedicatedVlan : nonDedicatedVlans) {
- if (vlanDbIds == null || vlanDbIds.contains(nonDedicatedVlan.getId()))
- nonDedicatedVlanDbIds.add(nonDedicatedVlan.getId());
- }
- if (dedicatedVlanDbIds != null && !dedicatedVlanDbIds.isEmpty()) {
- fetchFromDedicatedRange = true;
- sc.setParameters("vlanId", dedicatedVlanDbIds.toArray());
+ // If owner has dedicated Public IP ranges, fetch IP from the dedicated range
+ // Otherwise fetch IP from the system pool
+ List<AccountVlanMapVO> maps = _accountVlanMapDao.listAccountVlanMapsByAccount(owner.getId());
+ for (AccountVlanMapVO map : maps) {
+ if (vlanDbIds == null || vlanDbIds.contains(map.getVlanDbId()))
+ dedicatedVlanDbIds.add(map.getVlanDbId());
+ }
+ List<VlanVO> nonDedicatedVlans = _vlanDao.listZoneWideNonDedicatedVlans(dcId);
+ for (VlanVO nonDedicatedVlan : nonDedicatedVlans) {
+ if (vlanDbIds == null || vlanDbIds.contains(nonDedicatedVlan.getId()))
+ nonDedicatedVlanDbIds.add(nonDedicatedVlan.getId());
+ }
+ if (dedicatedVlanDbIds != null && !dedicatedVlanDbIds.isEmpty()) {
+ fetchFromDedicatedRange = true;
+ sc.setParameters("vlanId", dedicatedVlanDbIds.toArray());
- errorMessage.append(", vlanId id=" + dedicatedVlanDbIds.toArray());
+ errorMessage.append(", vlanId id=" + Arrays.toString(dedicatedVlanDbIds.toArray()));
- } else if (nonDedicatedVlanDbIds != null && !nonDedicatedVlanDbIds.isEmpty()) {
- sc.setParameters("vlanId", nonDedicatedVlanDbIds.toArray());
+ } else if (nonDedicatedVlanDbIds != null && !nonDedicatedVlanDbIds.isEmpty()) {
+ sc.setParameters("vlanId", nonDedicatedVlanDbIds.toArray());
errorMessage.append(", vlanId id=" + nonDedicatedVlanDbIds.toArray());
- } else {
- if (podId != null) {
- InsufficientAddressCapacityException ex = new InsufficientAddressCapacityException("Insufficient address capacity", Pod.class, podId);
- ex.addProxyObject(ApiDBUtils.findPodById(podId).getUuid());
- throw ex;
- }
- s_logger.warn(errorMessage.toString());
- InsufficientAddressCapacityException ex = new InsufficientAddressCapacityException("Insufficient address capacity", DataCenter.class, dcId);
- ex.addProxyObject(ApiDBUtils.findZoneById(dcId).getUuid());
- throw ex;
- }
+ } else {
+ if (podId != null) {
+ InsufficientAddressCapacityException ex = new InsufficientAddressCapacityException("Insufficient address capacity", Pod.class, podId);
+ ex.addProxyObject(ApiDBUtils.findPodById(podId).getUuid());
+ throw ex;
+ }
+ s_logger.warn(errorMessage.toString());
+ InsufficientAddressCapacityException ex = new InsufficientAddressCapacityException("Insufficient address capacity", DataCenter.class, dcId);
+ ex.addProxyObject(ApiDBUtils.findZoneById(dcId).getUuid());
+ throw ex;
+ }
- sc.setParameters("dc", dcId);
+ sc.setParameters("dc", dcId);
- DataCenter zone = _entityMgr.findById(DataCenter.class, dcId);
+ DataCenter zone = _entityMgr.findById(DataCenter.class, dcId);
- // for direct network take ip addresses only from the vlans belonging to the network
- if (vlanUse == VlanType.DirectAttached) {
- sc.setJoinParameters("vlan", "networkId", guestNetworkId);
- errorMessage.append(", network id=" + guestNetworkId);
- }
- sc.setJoinParameters("vlan", "type", vlanUse);
+ // for direct network take ip addresses only from the vlans belonging to the network
+ if (vlanUse == VlanType.DirectAttached) {
+ sc.setJoinParameters("vlan", "networkId", guestNetworkId);
+ errorMessage.append(", network id=" + guestNetworkId);
+ }
+ sc.setJoinParameters("vlan", "type", vlanUse);
- if (requestedIp != null) {
- sc.addAnd("address", SearchCriteria.Op.EQ, requestedIp);
- errorMessage.append(": requested ip " + requestedIp + " is not available");
- }
+ if (requestedIp != null) {
+ sc.addAnd("address", SearchCriteria.Op.EQ, requestedIp);
+ errorMessage.append(": requested ip " + requestedIp + " is not available");
+ }
- Filter filter = new Filter(IPAddressVO.class, "vlanId", true, 0l, 1l);
+ Filter filter = new Filter(IPAddressVO.class, "vlanId", true, 0l, 1l);
- List<IPAddressVO> addrs = _ipAddressDao.lockRows(sc, filter, true);
+ List<IPAddressVO> addrs = _ipAddressDao.lockRows(sc, filter, true);
- // If all the dedicated IPs of the owner are in use fetch an IP from the system pool
- if (addrs.size() == 0 && fetchFromDedicatedRange) {
- // Verify if account is allowed to acquire IPs from the system
- boolean useSystemIps = UseSystemPublicIps.valueIn(owner.getId());
- if (useSystemIps && nonDedicatedVlanDbIds != null && !nonDedicatedVlanDbIds.isEmpty()) {
- fetchFromDedicatedRange = false;
- sc.setParameters("vlanId", nonDedicatedVlanDbIds.toArray());
+ // If all the dedicated IPs of the owner are in use fetch an IP from the system pool
+ if (addrs.size() == 0 && fetchFromDedicatedRange) {
+ // Verify if account is allowed to acquire IPs from the system
+ boolean useSystemIps = UseSystemPublicIps.valueIn(owner.getId());
+ if (useSystemIps && nonDedicatedVlanDbIds != null && !nonDedicatedVlanDbIds.isEmpty()) {
+ fetchFromDedicatedRange = false;
+ sc.setParameters("vlanId", nonDedicatedVlanDbIds.toArray());
errorMessage.append(", vlanId id=" + nonDedicatedVlanDbIds.toArray());
- addrs = _ipAddressDao.lockRows(sc, filter, true);
- }
- }
+ addrs = _ipAddressDao.lockRows(sc, filter, true);
+ }
+ }
- if (addrs.size() == 0) {
- if (podId != null) {
- InsufficientAddressCapacityException ex = new InsufficientAddressCapacityException("Insufficient address capacity", Pod.class, podId);
- // for now, we hardcode the table names, but we should ideally do a lookup for the tablename from the VO object.
- ex.addProxyObject(ApiDBUtils.findPodById(podId).getUuid());
- throw ex;
- }
- s_logger.warn(errorMessage.toString());
- InsufficientAddressCapacityException ex = new InsufficientAddressCapacityException("Insufficient address capacity", DataCenter.class, dcId);
- ex.addProxyObject(ApiDBUtils.findZoneById(dcId).getUuid());
- throw ex;
- }
+ if (addrs.size() == 0) {
+ if (podId != null) {
+ InsufficientAddressCapacityException ex = new InsufficientAddressCapacityException("Insufficient address capacity", Pod.class, podId);
+ // for now, we hardcode the table names, but we should ideally do a lookup for the tablename from the VO object.
+ ex.addProxyObject(ApiDBUtils.findPodById(podId).getUuid());
+ throw ex;
+ }
+ s_logger.warn(errorMessage.toString());
+ InsufficientAddressCapacityException ex = new InsufficientAddressCapacityException("Insufficient address capacity", DataCenter.class, dcId);
+ ex.addProxyObject(ApiDBUtils.findZoneById(dcId).getUuid());
+ throw ex;
+ }
- assert (addrs.size() == 1) : "Return size is incorrect: " + addrs.size();
+ assert (addrs.size() == 1) : "Return size is incorrect: " + addrs.size();
- if (!fetchFromDedicatedRange) {
- // Check that the maximum number of public IPs for the given accountId will not be exceeded
- try {
- _resourceLimitMgr.checkResourceLimit(owner, ResourceType.public_ip);
- } catch (ResourceAllocationException ex) {
- s_logger.warn("Failed to allocate resource of type " + ex.getResourceType() + " for account " + owner);
- throw new AccountLimitException("Maximum number of public IP addresses for account: " + owner.getAccountName() + " has been exceeded.");
- }
- }
+ if (!fetchFromDedicatedRange) {
+ // Check that the maximum number of public IPs for the given accountId will not be exceeded
+ try {
+ _resourceLimitMgr.checkResourceLimit(owner, ResourceType.public_ip);
+ } catch (ResourceAllocationException ex) {
+ s_logger.warn("Failed to allocate resource of type " + ex.getResourceType() + " for account " + owner);
+ throw new AccountLimitException("Maximum number of public IP addresses for account: " + owner.getAccountName() + " has been exceeded.");
+ }
+ }
- IPAddressVO addr = addrs.get(0);
- addr.setSourceNat(sourceNat);
- addr.setAllocatedTime(new Date());
- addr.setAllocatedInDomainId(owner.getDomainId());
- addr.setAllocatedToAccountId(owner.getId());
- addr.setSystem(isSystem);
+ IPAddressVO addr = addrs.get(0);
+ addr.setSourceNat(sourceNat);
+ addr.setAllocatedTime(new Date());
+ addr.setAllocatedInDomainId(owner.getDomainId());
+ addr.setAllocatedToAccountId(owner.getId());
+ addr.setSystem(isSystem);
+ if (displayIp != null) {
+ addr.setDisplay(displayIp);
+ }
- if (assign) {
- markPublicIpAsAllocated(addr);
- } else {
- addr.setState(IpAddress.State.Allocating);
- }
- addr.setState(assign ? IpAddress.State.Allocated : IpAddress.State.Allocating);
+ if (assign) {
+ markPublicIpAsAllocated(addr);
+ } else {
+ addr.setState(IpAddress.State.Allocating);
+ }
+ addr.setState(assign ? IpAddress.State.Allocated : IpAddress.State.Allocating);
- if (vlanUse != VlanType.DirectAttached) {
- addr.setAssociatedWithNetworkId(guestNetworkId);
- addr.setVpcId(vpcId);
- }
+ if (vlanUse != VlanType.DirectAttached) {
+ addr.setAssociatedWithNetworkId(guestNetworkId);
+ addr.setVpcId(vpcId);
+ }
- _ipAddressDao.update(addr.getId(), addr);
+ _ipAddressDao.update(addr.getId(), addr);
return addr;
}
@@@ -861,21 -870,29 +870,29 @@@
public PublicIp doInTransaction(TransactionStatus status) throws InsufficientAddressCapacityException {
Account owner = _accountDao.acquireInLockTable(ownerId);
- if (owner == null) {
- // this ownerId comes from owner or type Account. See the class "AccountVO" and the annotations in that class
- // to get the table name and field name that is queried to fill this ownerid.
- ConcurrentOperationException ex = new ConcurrentOperationException("Unable to lock account");
- throw ex;
- }
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("lock account " + ownerId + " is acquired");
- }
+ if (owner == null) {
+ // this ownerId comes from owner or type Account. See the class "AccountVO" and the annotations in that class
+ // to get the table name and field name that is queried to fill this ownerid.
+ ConcurrentOperationException ex = new ConcurrentOperationException("Unable to lock account");
+ throw ex;
+ }
+ if (s_logger.isDebugEnabled()) {
+ s_logger.debug("lock account " + ownerId + " is acquired");
+ }
+ boolean displayIp = true;
+ if (guestNtwkId != null) {
+ Network ntwk = _networksDao.findById(guestNtwkId);
+ displayIp = ntwk.getDisplayNetwork();
+ } else if (vpcId != null) {
+ VpcVO vpc = _vpcDao.findById(vpcId);
+ displayIp = vpc.isDisplay();
+ }
- PublicIp ip = fetchNewPublicIp(dcId, null, null, owner, VlanType.VirtualNetwork, guestNtwkId, isSourceNat, false, null, false, vpcId);
+ PublicIp ip = fetchNewPublicIp(dcId, null, null, owner, VlanType.VirtualNetwork, guestNtwkId, isSourceNat, false, null, false, vpcId, displayIp);
- IPAddressVO publicIp = ip.ip();
+ IPAddressVO publicIp = ip.ip();
- markPublicIpAsAllocated(publicIp);
- _ipAddressDao.update(publicIp.getId(), publicIp);
+ markPublicIpAsAllocated(publicIp);
+ _ipAddressDao.update(publicIp.getId(), publicIp);
return ip;
}
@@@ -973,8 -990,9 +990,9 @@@
@DB
@Override
- public IpAddress allocateIp(final Account ipOwner, final boolean isSystem, Account caller, long callerUserId, final DataCenter zone) throws ConcurrentOperationException,
+ public IpAddress allocateIp(final Account ipOwner, final boolean isSystem, Account caller, long callerUserId, final DataCenter zone, final Boolean displayIp)
+ throws ConcurrentOperationException,
- ResourceAllocationException, InsufficientAddressCapacityException {
+ ResourceAllocationException, InsufficientAddressCapacityException {
final VlanType vlanType = VlanType.VirtualNetwork;
final boolean assign = false;
@@@ -1006,18 -1024,18 +1024,18 @@@
ip = Transaction.execute(new TransactionCallbackWithException<PublicIp, InsufficientAddressCapacityException>() {
@Override
public PublicIp doInTransaction(TransactionStatus status) throws InsufficientAddressCapacityException {
- PublicIp ip = fetchNewPublicIp(zone.getId(), null, null, ipOwner, vlanType, null, false, assign, null, isSystem, null);
+ PublicIp ip = fetchNewPublicIp(zone.getId(), null, null, ipOwner, vlanType, null, false, assign, null, isSystem, null, displayIp);
- if (ip == null) {
+ if (ip == null) {
InsufficientAddressCapacityException ex = new InsufficientAddressCapacityException("Unable to find available public IP addresses", DataCenter.class, zone
.getId());
- ex.addProxyObject(ApiDBUtils.findZoneById(zone.getId()).getUuid());
- throw ex;
- }
- CallContext.current().setEventDetails("Ip Id: " + ip.getId());
- Ip ipAddress = ip.getAddress();
+ ex.addProxyObject(ApiDBUtils.findZoneById(zone.getId()).getUuid());
+ throw ex;
+ }
+ CallContext.current().setEventDetails("Ip Id: " + ip.getId());
+ Ip ipAddress = ip.getAddress();
- s_logger.debug("Got " + ipAddress + " to assign for account " + ipOwner.getId() + " in zone " + zone.getId());
+ s_logger.debug("Got " + ipAddress + " to assign for account " + ipOwner.getId() + " in zone " + zone.getId());
return ip;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48e08fe6/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/network/NetworkServiceImpl.java
index 41cc2ed,ebeb31a..828e6bb
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@@ -3601,17 -3593,19 +3598,19 @@@ public class NetworkServiceImpl extend
// For public traffic, get isolation method of physical network and update the public network accordingly
// each broadcast type will individually need to be qualified for support of public traffic
+ if (TrafficType.Public.equals(trafficType)){
- List<String> isolationMethods = network.getIsolationMethods();
- if ((isolationMethods.size() == 1 && isolationMethods.get(0).toLowerCase().equals("vxlan"))
- || (isolationMethod != null && isolationMethods.contains(isolationMethod) && isolationMethod.toLowerCase().equals("vxlan"))) {
- // find row in networks table that is defined as 'Public', created when zone was deployed
- NetworkVO publicNetwork = _networksDao.listByZoneAndTrafficType(network.getDataCenterId(),TrafficType.Public).get(0);
- if (publicNetwork != null) {
- s_logger.debug("setting public network " + publicNetwork + " to broadcast type vxlan");
- publicNetwork.setBroadcastDomainType(BroadcastDomainType.Vxlan);
- _networksDao.persist(publicNetwork);
- }
+ List<String> isolationMethods = network.getIsolationMethods();
+ if ((isolationMethods.size() == 1 && isolationMethods.get(0).toLowerCase().equals("vxlan"))
+ || (isolationMethod != null && isolationMethods.contains(isolationMethod) && isolationMethod.toLowerCase().equals("vxlan"))) {
+ // find row in networks table that is defined as 'Public', created when zone was deployed
+ NetworkVO publicNetwork = _networksDao.listByZoneAndTrafficType(network.getDataCenterId(),TrafficType.Public).get(0);
+ if (publicNetwork != null) {
+ s_logger.debug("setting public network " + publicNetwork + " to broadcast type vxlan");
+ publicNetwork.setBroadcastDomainType(BroadcastDomainType.Vxlan);
+ _networksDao.persist(publicNetwork);
}
}
++ }
return pNetworktrafficType;
} catch (Exception ex) {
@@@ -4018,14 -4012,14 +4017,14 @@@
Long nicId = cmd.getNicId();
long vmId = cmd.getVmId();
Long networkId = cmd.getNetworkId();
-
- UserVmVO userVm = _userVmDao.findById(vmId);
+ UserVmVO userVm = _userVmDao.findById(vmId);
- if (userVm == null) {
+ if (userVm == null || (!userVm.isDisplayVm() && caller.getType() == Account.ACCOUNT_TYPE_NORMAL)) {
- InvalidParameterValueException ex = new InvalidParameterValueException("Virtual mahine id does not exist");
+ InvalidParameterValueException ex = new InvalidParameterValueException("Virtual mahine id does not exist");
ex.addProxyObject(Long.valueOf(vmId).toString(), "vmId");
- throw ex;
- }
+ throw ex;
+ }
+
_accountMgr.checkAccess(caller, null, true, userVm);
return _networkMgr.listVmNics(vmId, nicId, networkId);
}