Skip to content

Commit 25f2f0f

Browse files
committed
Merge branch 'master' into ui-vm-affinity
Conflicts: ui/scripts/instances.js
2 parents 922b51c + 8f5d8d5 commit 25f2f0f

File tree

89 files changed

+3464
-1974
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+3464
-1974
lines changed

api/src/com/cloud/region/ha/GlobalLoadBalancingRulesService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package com.cloud.region.ha;
1919

20+
import com.cloud.network.rules.LoadBalancer;
2021
import org.apache.cloudstack.api.command.user.region.ha.gslb.*;
2122

2223
import java.util.List;
@@ -44,4 +45,6 @@ public interface GlobalLoadBalancingRulesService {
4445

4546
List<GlobalLoadBalancerRule> listGlobalLoadBalancerRule(ListGlobalLoadBalancerRuleCmd listGslbCmd);
4647

48+
List<LoadBalancer> listSiteLoadBalancers(long gslbRuleId);
49+
4750
}

api/src/com/cloud/vm/UserVmService.java

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,22 @@
2121

2222
import javax.naming.InsufficientResourcesException;
2323

24+
import org.apache.cloudstack.api.BaseCmd.HTTPMethod;
2425
import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
2526
import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
26-
import org.apache.cloudstack.api.command.user.vm.*;
27+
import org.apache.cloudstack.api.command.user.vm.AddNicToVMCmd;
28+
import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
29+
import org.apache.cloudstack.api.command.user.vm.DestroyVMCmd;
30+
import org.apache.cloudstack.api.command.user.vm.RebootVMCmd;
31+
import org.apache.cloudstack.api.command.user.vm.RemoveNicFromVMCmd;
32+
import org.apache.cloudstack.api.command.user.vm.ResetVMPasswordCmd;
33+
import org.apache.cloudstack.api.command.user.vm.ResetVMSSHKeyCmd;
34+
import org.apache.cloudstack.api.command.user.vm.RestoreVMCmd;
35+
import org.apache.cloudstack.api.command.user.vm.ScaleVMCmd;
36+
import org.apache.cloudstack.api.command.user.vm.StartVMCmd;
37+
import org.apache.cloudstack.api.command.user.vm.UpdateDefaultNicForVMCmd;
38+
import org.apache.cloudstack.api.command.user.vm.UpdateVMCmd;
39+
import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd;
2740
import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
2841
import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
2942
import com.cloud.dc.DataCenter;
@@ -185,8 +198,8 @@ UserVm startVirtualMachine(StartVMCmd cmd) throws StorageUnavailableException, E
185198
*/
186199
UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> securityGroupIdList, Account owner, String hostName,
187200
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
188-
String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIp,
189-
String keyboard, List<Long> affinityGroupIdList)
201+
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
202+
IpAddresses defaultIp, String keyboard, List<Long> affinityGroupIdList)
190203
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
191204

192205
/**
@@ -257,8 +270,8 @@ UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering s
257270
* @throws InsufficientResourcesException
258271
*/
259272
UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, List<Long> securityGroupIdList,
260-
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
261-
IpAddresses defaultIps, String keyboard, List<Long> affinityGroupIdList)
273+
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, String sshKeyPair,
274+
Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, String keyboard, List<Long> affinityGroupIdList)
262275
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
263276

264277
/**
@@ -327,8 +340,8 @@ UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOfferin
327340
*/
328341
UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, Account owner, String hostName,
329342
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
330-
String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps,
331-
String keyboard, List<Long> affinityGroupIdList)
343+
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
344+
IpAddresses defaultIps, String keyboard, List<Long> affinityGroupIdList)
332345
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
333346

334347
/**

api/src/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ public class ApiConstants {
335335
public static final String LOAD_BALANCER_DEVICE_STATE = "lbdevicestate";
336336
public static final String LOAD_BALANCER_DEVICE_CAPACITY = "lbdevicecapacity";
337337
public static final String LOAD_BALANCER_DEVICE_DEDICATED = "lbdevicededicated";
338+
public static final String LOAD_BALANCER_RULE = "loadbalancerrule";
338339
public static final String LOAD_BALANCER_RULE_LIST = "loadbalancerrulelist";
339340
public static final String FIREWALL_DEVICE_ID = "fwdeviceid";
340341
public static final String FIREWALL_DEVICE_NAME = "fwdevicename";

api/src/org/apache/cloudstack/api/BaseCmd.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ public enum CommandType {
9595
private Object _responseObject = null;
9696
private Map<String, String> fullUrlParams;
9797

98+
public enum HTTPMethod {
99+
GET, POST, PUT, DELETE
100+
}
101+
private HTTPMethod httpMethod;
102+
98103
@Parameter(name = "response", type = CommandType.STRING)
99104
private String responseType;
100105

@@ -140,6 +145,25 @@ public enum CommandType {
140145
public void configure() {
141146
}
142147

148+
public HTTPMethod getHttpMethod() {
149+
return httpMethod;
150+
}
151+
152+
public void setHttpMethod(String method) {
153+
if (method != null) {
154+
if (method.equalsIgnoreCase("GET"))
155+
httpMethod = HTTPMethod.GET;
156+
else if (method.equalsIgnoreCase("PUT"))
157+
httpMethod = HTTPMethod.PUT;
158+
else if (method.equalsIgnoreCase("POST"))
159+
httpMethod = HTTPMethod.POST;
160+
else if (method.equalsIgnoreCase("DELETE"))
161+
httpMethod = HTTPMethod.DELETE;
162+
} else {
163+
httpMethod = HTTPMethod.GET;
164+
}
165+
}
166+
143167
public String getResponseType() {
144168
if (responseType == null) {
145169
return RESPONSE_TYPE_XML;

api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
// under the License.
1717
package org.apache.cloudstack.api.command.admin.account;
1818

19-
import java.util.Collection;
20-
import java.util.Map;
21-
19+
import com.cloud.user.Account;
20+
import com.cloud.user.UserAccount;
21+
import com.cloud.user.UserContext;
2222
import org.apache.cloudstack.api.APICommand;
2323
import org.apache.cloudstack.api.ApiConstants;
2424
import org.apache.cloudstack.api.ApiErrorCode;
@@ -27,14 +27,12 @@
2727
import org.apache.cloudstack.api.ServerApiException;
2828
import org.apache.cloudstack.api.response.AccountResponse;
2929
import org.apache.cloudstack.api.response.DomainResponse;
30-
import org.apache.cloudstack.api.response.UserResponse;
3130
import org.apache.log4j.Logger;
3231

33-
import com.cloud.user.Account;
34-
import com.cloud.user.UserAccount;
35-
import com.cloud.user.UserContext;
32+
import java.util.Collection;
33+
import java.util.Map;
3634

37-
@APICommand(name = "createAccount", description="Creates an account", responseObject=UserResponse.class)
35+
@APICommand(name = "createAccount", description="Creates an account", responseObject=AccountResponse.class)
3836
public class CreateAccountCmd extends BaseCmd {
3937
public static final Logger s_logger = Logger.getLogger(CreateAccountCmd.class.getName());
4038

api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class MigrateVMCmd extends BaseAsyncCmd {
5858
required=true, description="the ID of the virtual machine")
5959
private Long virtualMachineId;
6060

61-
@Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.LONG, entityType=StoragePoolResponse.class,
61+
@Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.UUID, entityType=StoragePoolResponse.class,
6262
required=false, description="Destination storage pool ID to migrate VM volumes to. Required for migrating the root disk volume")
6363
private Long storageId;
6464

api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
128128
@Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="the hypervisor on which to deploy the virtual machine")
129129
private String hypervisor;
130130

131-
@Parameter(name=ApiConstants.USER_DATA, type=CommandType.STRING, description="an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding.", length=2048)
131+
@Parameter(name=ApiConstants.USER_DATA, type=CommandType.STRING, description="an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding. Using HTTP POST(via POST body), you can send up to 32K of data after base64 encoding.", length=32768)
132132
private String userData;
133133

134134
@Parameter(name=ApiConstants.SSH_KEYPAIR, type=CommandType.STRING, description="name of the ssh key pair used to login to the virtual machine")
@@ -312,8 +312,8 @@ private Map<Long, IpAddresses> getIpToNetworkMap() {
312312
throw new InvalidParameterValueException("Unable to translate and find entity with networkId: " + ips.get("networkid"));
313313
}
314314
}
315-
String requestedIp = (String) ips.get("ip");
316-
String requestedIpv6 = (String) ips.get("ipv6");
315+
String requestedIp = ips.get("ip");
316+
String requestedIpv6 = ips.get("ipv6");
317317
if (requestedIpv6 != null) {
318318
requestedIpv6 = requestedIpv6.toLowerCase();
319319
}
@@ -481,18 +481,18 @@ public void create() throws ResourceAllocationException{
481481
throw new InvalidParameterValueException("Can't specify network Ids in Basic zone");
482482
} else {
483483
vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, getSecurityGroupIdList(), owner, name,
484-
displayName, diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList());
484+
displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList());
485485
}
486486
} else {
487487
if (zone.isSecurityGroupEnabled()) {
488488
vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(),
489-
owner, name, displayName, diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList());
489+
owner, name, displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList());
490490
} else {
491491
if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty()) {
492492
throw new InvalidParameterValueException("Can't create vm with security groups; security group feature is not enabled per zone");
493493
}
494494
vm = _userVmService.createAdvancedVirtualMachine(zone, serviceOffering, template, getNetworkIds(), owner, name, displayName,
495-
diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList());
495+
diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList());
496496
}
497497
}
498498

api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,12 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
7575
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="state of the virtual machine")
7676
private String state;
7777

78-
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class,
79-
description="the availability zone ID")
78+
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, description="the availability zone ID")
8079
private Long zoneId;
8180

81+
@Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
82+
private String zoneType;
83+
8284
@Parameter(name=ApiConstants.FOR_VIRTUAL_NETWORK, type=CommandType.BOOLEAN,
8385
description="list by network type; true if need to list vms using Virtual Network, false otherwise")
8486
private Boolean forVirtualNetwork;
@@ -147,6 +149,10 @@ public Long getZoneId() {
147149
return zoneId;
148150
}
149151

152+
public String getZoneType() {
153+
return zoneType;
154+
}
155+
150156
public Boolean getForVirtualNetwork() {
151157
return forVirtualNetwork;
152158
}

api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class UpdateVMCmd extends BaseCmd{
6161
description="the ID of the OS type that best represents this VM.")
6262
private Long osTypeId;
6363

64-
@Parameter(name=ApiConstants.USER_DATA, type=CommandType.STRING, description="an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding.", length=2048)
64+
@Parameter(name=ApiConstants.USER_DATA, type=CommandType.STRING, description="an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding. Using HTTP POST(via POST body), you can send up to 32K of data after base64 encoding.", length=32768)
6565
private String userData;
6666

6767

api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ public class ListVolumesCmd extends BaseListTaggedResourcesCmd {
6767
description="the ID of the availability zone")
6868
private Long zoneId;
6969

70+
@Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
71+
private String zoneType;
72+
7073
/////////////////////////////////////////////////////
7174
/////////////////// Accessors ///////////////////////
7275
/////////////////////////////////////////////////////
@@ -100,6 +103,10 @@ public Long getZoneId() {
100103
return zoneId;
101104
}
102105

106+
public String getZoneType() {
107+
return zoneType;
108+
}
109+
103110
/////////////////////////////////////////////////////
104111
/////////////// API Implementation///////////////////
105112
/////////////////////////////////////////////////////

0 commit comments

Comments
 (0)