Skip to content

Commit f7c1b71

Browse files
author
Edison Su
committed
merge to master
2 parents 389d7c1 + caf0dd2 commit f7c1b71

130 files changed

Lines changed: 4762 additions & 1568 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.agent.api;
18+
19+
import java.net.URI;
20+
21+
import com.cloud.utils.net.NetUtils;
22+
23+
public class PvlanSetupCommand extends Command {
24+
public enum Type {
25+
DHCP,
26+
VM
27+
}
28+
private String op;
29+
private String primary;
30+
private String isolated;
31+
private String vmMac;
32+
private String dhcpName;
33+
private String dhcpMac;
34+
private String dhcpIp;
35+
private Type type;
36+
private String networkTag;
37+
38+
protected PvlanSetupCommand() {}
39+
40+
protected PvlanSetupCommand(Type type, String op, URI uri, String networkTag)
41+
{
42+
this.type = type;
43+
this.op = op;
44+
this.primary = NetUtils.getPrimaryPvlanFromUri(uri);
45+
this.isolated = NetUtils.getIsolatedPvlanFromUri(uri);
46+
this.networkTag = networkTag;
47+
}
48+
49+
static public PvlanSetupCommand createDhcpSetup(String op, URI uri, String networkTag, String dhcpName, String dhcpMac, String dhcpIp)
50+
{
51+
PvlanSetupCommand cmd = new PvlanSetupCommand(Type.DHCP, op, uri, networkTag);
52+
cmd.setDhcpName(dhcpName);
53+
cmd.setDhcpMac(dhcpMac);
54+
cmd.setDhcpIp(dhcpIp);
55+
return cmd;
56+
}
57+
58+
static public PvlanSetupCommand createVmSetup(String op, URI uri, String networkTag, String vmMac)
59+
{
60+
PvlanSetupCommand cmd = new PvlanSetupCommand(Type.VM, op, uri, networkTag);
61+
cmd.setVmMac(vmMac);
62+
return cmd;
63+
}
64+
65+
@Override
66+
public boolean executeInSequence() {
67+
return true;
68+
}
69+
70+
public String getOp() {
71+
return op;
72+
}
73+
74+
public String getPrimary() {
75+
return primary;
76+
}
77+
78+
public String getIsolated() {
79+
return isolated;
80+
}
81+
82+
public String getVmMac() {
83+
return vmMac;
84+
}
85+
86+
protected void setVmMac(String vmMac) {
87+
this.vmMac = vmMac;
88+
}
89+
90+
public String getDhcpMac() {
91+
return dhcpMac;
92+
}
93+
94+
protected void setDhcpMac(String dhcpMac) {
95+
this.dhcpMac = dhcpMac;
96+
}
97+
98+
public String getDhcpIp() {
99+
return dhcpIp;
100+
}
101+
102+
protected void setDhcpIp(String dhcpIp) {
103+
this.dhcpIp = dhcpIp;
104+
}
105+
106+
public Type getType() {
107+
return type;
108+
}
109+
110+
public String getDhcpName() {
111+
return dhcpName;
112+
}
113+
114+
public void setDhcpName(String dhcpName) {
115+
this.dhcpName = dhcpName;
116+
}
117+
118+
public String getNetworkTag() {
119+
return networkTag;
120+
}
121+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.deploy;
18+
19+
import java.util.List;
20+
21+
import com.cloud.exception.InsufficientServerCapacityException;
22+
import com.cloud.vm.VirtualMachine;
23+
import com.cloud.vm.VirtualMachineProfile;
24+
25+
/**
26+
*/
27+
public interface DeploymentClusterPlanner extends DeploymentPlanner {
28+
/**
29+
* This is called to determine list of possible clusters where a virtual
30+
* machine can be deployed.
31+
*
32+
* @param vm
33+
* virtual machine.
34+
* @param plan
35+
* deployment plan that tells you where it's being deployed to.
36+
* @param avoid
37+
* avoid these data centers, pods, clusters, or hosts.
38+
* @return DeployDestination for that virtual machine.
39+
*/
40+
List<Long> orderClusters(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid)
41+
throws InsufficientServerCapacityException;
42+
43+
PlannerResourceUsage getResourceUsage();
44+
45+
}

api/src/com/cloud/deploy/DeploymentPlanner.java

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
/**
3636
*/
3737
public interface DeploymentPlanner extends Adapter {
38+
3839
/**
3940
* plan is called to determine where a virtual machine should be running.
4041
*
@@ -46,6 +47,7 @@ public interface DeploymentPlanner extends Adapter {
4647
* avoid these data centers, pods, clusters, or hosts.
4748
* @return DeployDestination for that virtual machine.
4849
*/
50+
@Deprecated
4951
DeployDestination plan(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException;
5052

5153
/**
@@ -88,6 +90,10 @@ public enum AllocationAlgorithm {
8890
userconcentratedpod_firstfit;
8991
}
9092

93+
public enum PlannerResourceUsage {
94+
Shared, Dedicated;
95+
}
96+
9197
public static class ExcludeList {
9298
private Set<Long> _dcIds;
9399
private Set<Long> _podIds;
@@ -99,10 +105,22 @@ public ExcludeList() {
99105
}
100106

101107
public ExcludeList(Set<Long> _dcIds, Set<Long> _podIds, Set<Long> _clusterIds, Set<Long> _hostIds, Set<Long> _poolIds) {
102-
this._dcIds = _dcIds;
103-
this._podIds = _podIds;
104-
this._clusterIds = _clusterIds;
105-
this._poolIds = _poolIds;
108+
if (_dcIds != null) {
109+
this._dcIds = new HashSet<Long>(_dcIds);
110+
}
111+
if (_podIds != null) {
112+
this._podIds = new HashSet<Long>(_podIds);
113+
}
114+
if (_clusterIds != null) {
115+
this._clusterIds = new HashSet<Long>(_clusterIds);
116+
}
117+
118+
if (_hostIds != null) {
119+
this._hostIds = new HashSet<Long>(_hostIds);
120+
}
121+
if (_poolIds != null) {
122+
this._poolIds = new HashSet<Long>(_poolIds);
123+
}
106124
}
107125

108126
public boolean add(InsufficientCapacityException e) {

api/src/com/cloud/event/EventTypes.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public class EventTypes {
134134
public static final String EVENT_REMOVE_FROM_GLOBAL_LOAD_BALANCER_RULE = "GLOBAL.LB.REMOVE";
135135
public static final String EVENT_GLOBAL_LOAD_BALANCER_CREATE = "GLOBAL.LB.CREATE";
136136
public static final String EVENT_GLOBAL_LOAD_BALANCER_DELETE = "GLOBAL.LB.DELETE";
137+
public static final String EVENT_GLOBAL_LOAD_BALANCER_UPDATE = "GLOBAL.LB.UPDATE";
137138

138139
// Account events
139140
public static final String EVENT_ACCOUNT_ENABLE = "ACCOUNT.ENABLE";
@@ -422,6 +423,7 @@ public class EventTypes {
422423
public static final String EVENT_INTERNAL_LB_VM_START = "INTERNALLBVM.START";
423424
public static final String EVENT_INTERNAL_LB_VM_STOP = "INTERNALLBVM.STOP";
424425

426+
public static final String EVENT_HOST_RESERVATION_RELEASE = "HOST.RESERVATION.RELEASE";
425427
// Dedicated guest vlan range
426428
public static final String EVENT_GUEST_VLAN_RANGE_DEDICATE = "GUESTVLANRANGE.DEDICATE";
427429
public static final String EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE = "GUESTVLANRANGE.RELEASE";
@@ -727,7 +729,6 @@ public class EventTypes {
727729
entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_UPDATE, AutoScaleVmGroup.class.getName());
728730
entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_ENABLE, AutoScaleVmGroup.class.getName());
729731
entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_DISABLE, AutoScaleVmGroup.class.getName());
730-
731732
entityEventDetails.put(EVENT_GUEST_VLAN_RANGE_DEDICATE, GuestVlan.class.getName());
732733
entityEventDetails.put(EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE, GuestVlan.class.getName());
733734
}

api/src/com/cloud/host/Status.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ public static String[] toStrings(Status... states) {
147147
s_fsm.addTransition(Status.Down, Event.Remove, Status.Removed);
148148
s_fsm.addTransition(Status.Down, Event.ManagementServerDown, Status.Down);
149149
s_fsm.addTransition(Status.Down, Event.AgentDisconnected, Status.Down);
150+
s_fsm.addTransition(Status.Down, Event.PingTimeout, Status.Down);
150151
s_fsm.addTransition(Status.Alert, Event.AgentConnected, Status.Connecting);
151152
s_fsm.addTransition(Status.Alert, Event.Ping, Status.Up);
152153
s_fsm.addTransition(Status.Alert, Event.Remove, Status.Removed);

api/src/com/cloud/network/Networks.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public enum BroadcastDomainType {
6363
Storage("storage", Integer.class),
6464
Lswitch("lswitch", String.class),
6565
Mido("mido", String.class),
66+
Pvlan("pvlan", String.class),
6667
UnDecided(null, null);
6768

6869
private String scheme;

api/src/com/cloud/offering/ServiceOffering.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,6 @@ public enum StorageType {
108108
boolean getDefaultUse();
109109

110110
String getSystemVmType();
111+
112+
String getDeploymentPlanner();
111113
}

api/src/com/cloud/resource/ResourceService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ public interface ResourceService {
101101

102102
S3 discoverS3(AddS3Cmd cmd) throws DiscoveryException;
103103

104-
105-
106104
List<HypervisorType> getSupportedHypervisorTypes(long zoneId, boolean forVirtualRouter, Long podId);
107105

108106
Pair<List<? extends Swift>, Integer> listSwifts(ListSwiftsCmd cmd);
109107

110108
List<? extends S3> listS3s(ListS3sCmd cmd);
111109

110+
boolean releaseHostReservation(Long hostId);
111+
112112
}

api/src/com/cloud/server/ManagementService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,5 +388,7 @@ Ternary<Pair<List<? extends Host>, Integer>, List<? extends Host>, Map<Host, Boo
388388
* @return List of capacities
389389
*/
390390
List<? extends Capacity> listTopConsumedResources(ListCapacityCmd cmd);
391+
392+
List<String> listDeploymentPlanners();
391393

392394
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ public class ApiConstants {
230230
public static final String VLAN_RANGE = "vlanrange";
231231
public static final String REMOVE_VLAN="removevlan";
232232
public static final String VLAN_ID = "vlanid";
233+
public static final String ISOLATED_PVLAN = "isolatedpvlan";
233234
public static final String VM_AVAILABLE = "vmavailable";
234235
public static final String VM_LIMIT = "vmlimit";
235236
public static final String VM_TOTAL = "vmtotal";
@@ -495,6 +496,7 @@ public class ApiConstants {
495496
public static final String AFFINITY_GROUP_NAMES = "affinitygroupnames";
496497
public static final String ASA_INSIDE_PORT_PROFILE = "insideportprofile";
497498
public static final String AFFINITY_GROUP_ID = "affinitygroupid";
499+
public static final String DEPLOYMENT_PLANNER = "deploymentplanner";
498500
public static final String ACL_ID = "aclid";
499501
public static final String NUMBER = "number";
500502

0 commit comments

Comments
 (0)