Skip to content

Commit 1b2b369

Browse files
committed
Merge latest master into javelin
2 parents 3c75d53 + cae89c6 commit 1b2b369

160 files changed

Lines changed: 18452 additions & 4991 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.

LICENSE

Lines changed: 1 addition & 3568 deletions
Large diffs are not rendered by default.

NOTICE

Lines changed: 1 addition & 617 deletions
Large diffs are not rendered by default.

api/src/com/cloud/agent/api/to/FirewallRuleTO.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class FirewallRuleTO implements InternalIdentity {
5151
FirewallRule.Purpose purpose;
5252
private Integer icmpType;
5353
private Integer icmpCode;
54-
54+
private FirewallRule.TrafficType trafficType;
5555

5656
protected FirewallRuleTO() {
5757
}
@@ -86,6 +86,7 @@ public FirewallRuleTO(long id,String srcVlanTag, String srcIp, String protocol,
8686
this.sourceCidrList = sourceCidr;
8787
this.icmpType = icmpType;
8888
this.icmpCode = icmpCode;
89+
this.trafficType = null;
8990
}
9091
public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp) {
9192
this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, rule.getPurpose(),rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
@@ -95,6 +96,23 @@ public FirewallRuleTO(FirewallRule rule, String srcIp) {
9596
this(rule.getId(),null, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, rule.getPurpose(),rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
9697
}
9798

99+
public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose purpose) {
100+
this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, purpose,rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
101+
}
102+
103+
public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose purpose, FirewallRule.TrafficType trafficType) {
104+
this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, purpose,rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
105+
this.trafficType = trafficType;
106+
}
107+
108+
public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose purpose, boolean revokeState, boolean alreadyAdded) {
109+
this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), revokeState, alreadyAdded, purpose,rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
110+
}
111+
112+
public FirewallRule.TrafficType getTrafficType(){
113+
return trafficType;
114+
}
115+
98116
public long getId() {
99117
return id;
100118
}

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class EventTypes {
2626
public static final String EVENT_VM_UPDATE = "VM.UPDATE";
2727
public static final String EVENT_VM_UPGRADE = "VM.UPGRADE";
2828
public static final String EVENT_VM_RESETPASSWORD = "VM.RESETPASSWORD";
29+
public static final String EVENT_VM_RESETSSHKEY = "VM.RESETSSHKEY";
2930
public static final String EVENT_VM_MIGRATE = "VM.MIGRATE";
3031
public static final String EVENT_VM_MOVE = "VM.MOVE";
3132
public static final String EVENT_VM_RESTORE = "VM.RESTORE";
@@ -63,6 +64,11 @@ public class EventTypes {
6364
public static final String EVENT_FIREWALL_OPEN = "FIREWALL.OPEN";
6465
public static final String EVENT_FIREWALL_CLOSE = "FIREWALL.CLOSE";
6566

67+
//NIC Events
68+
public static final String EVENT_NIC_CREATE = "NIC.CREATE";
69+
public static final String EVENT_NIC_DELETE = "NIC.DELETE";
70+
public static final String EVENT_NIC_UPDATE = "NIC.UPDATE";
71+
6672
// Load Balancers
6773
public static final String EVENT_ASSIGN_TO_LOAD_BALANCER_RULE = "LB.ASSIGN.TO.RULE";
6874
public static final String EVENT_REMOVE_FROM_LOAD_BALANCER_RULE = "LB.REMOVE.FROM.RULE";
@@ -313,4 +319,10 @@ public class EventTypes {
313319
public static final String EVENT_AUTOSCALEVMGROUP_UPDATE = "AUTOSCALEVMGROUP.UPDATE";
314320
public static final String EVENT_AUTOSCALEVMGROUP_ENABLE = "AUTOSCALEVMGROUP.ENABLE";
315321
public static final String EVENT_AUTOSCALEVMGROUP_DISABLE = "AUTOSCALEVMGROUP.DISABLE";
322+
323+
public static final String EVENT_BAREMETAL_DHCP_SERVER_ADD = "PHYSICAL.DHCP.ADD";
324+
public static final String EVENT_BAREMETAL_DHCP_SERVER_DELETE = "PHYSICAL.DHCP.DELETE";
325+
326+
public static final String EVENT_BAREMETAL_PXE_SERVER_ADD = "PHYSICAL.PXE.ADD";
327+
public static final String EVENT_BAREMETAL_PXE_SERVER_DELETE = "PHYSICAL.PXE.DELETE";
316328
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public enum Type {
4040
ExternalLoadBalancer(false),
4141
ExternalVirtualSwitchSupervisor(false),
4242
PxeServer(false),
43+
BaremetalPxe(false),
44+
BaremetalDhcp(false),
4345
TrafficMonitor(false),
4446

4547
ExternalDhcp(false),

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static class Service {
4949
public static final Service Dns = new Service("Dns", Capability.AllowDnsSuffixModification);
5050
public static final Service Gateway = new Service("Gateway");
5151
public static final Service Firewall = new Service("Firewall", Capability.SupportedProtocols,
52-
Capability.MultipleIps, Capability.TrafficStatistics);
52+
Capability.MultipleIps, Capability.TrafficStatistics, Capability.SupportedTrafficDirection, Capability.SupportedEgressProtocols);
5353
public static final Service Lb = new Service("Lb", Capability.SupportedLBAlgorithms, Capability.SupportedLBIsolation,
5454
Capability.SupportedProtocols, Capability.TrafficStatistics, Capability.LoadBalancingSupportedIps,
5555
Capability.SupportedStickinessMethods, Capability.ElasticLb);
@@ -174,6 +174,8 @@ public static class Capability {
174174
public static final Capability ElasticLb = new Capability("ElasticLb");
175175
public static final Capability AutoScaleCounters = new Capability("AutoScaleCounters");
176176
public static final Capability InlineMode = new Capability("InlineMode");
177+
public static final Capability SupportedTrafficDirection = new Capability("SupportedTrafficDirection");
178+
public static final Capability SupportedEgressProtocols = new Capability("SupportedEgressProtocols");
177179

178180
private String name;
179181

@@ -288,6 +290,8 @@ private State(String description) {
288290

289291
void setPhysicalNetworkId(Long physicalNetworkId);
290292

293+
public void setTrafficType(TrafficType type);
294+
291295
ACLType getAclType();
292296

293297
boolean isRestartRequired();

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,4 +225,8 @@ public Long getVpcId() {
225225
return vpcId;
226226
}
227227

228+
@Override
229+
public void setTrafficType(TrafficType type) {
230+
this.trafficType = type;
231+
}
228232
}

api/src/com/cloud/network/element/UserDataServiceProvider.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ public interface UserDataServiceProvider extends NetworkElement {
3030
public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
3131
boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws ResourceUnavailableException;
3232
boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws ResourceUnavailableException;
33+
boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String SSHPublicKey) throws ResourceUnavailableException;
3334
}

api/src/com/cloud/network/firewall/FirewallService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
import com.cloud.utils.Pair;
2929

3030
public interface FirewallService {
31-
FirewallRule createFirewallRule(FirewallRule rule) throws NetworkRuleConflictException;
31+
FirewallRule createIngressFirewallRule(FirewallRule rule) throws NetworkRuleConflictException;
32+
FirewallRule createEgressFirewallRule(FirewallRule rule) throws NetworkRuleConflictException;
3233

3334
Pair<List<? extends FirewallRule>, Integer> listFirewallRules(ListFirewallRulesCmd cmd);
3435

@@ -41,7 +42,8 @@ public interface FirewallService {
4142
*/
4243
boolean revokeFirewallRule(long ruleId, boolean apply);
4344

44-
boolean applyFirewallRules(long ipId, Account caller) throws ResourceUnavailableException;
45+
boolean applyEgressFirewallRules (FirewallRule rule, Account caller) throws ResourceUnavailableException;
46+
boolean applyIngressFirewallRules(long Ipid , Account caller) throws ResourceUnavailableException;
4547

4648
FirewallRule getFirewallRule(long ruleId);
4749

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@
2424
import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
2525
import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
2626
import org.apache.cloudstack.api.command.user.template.CreateTemplateCmd;
27+
import org.apache.cloudstack.api.command.user.vm.AddNicToVMCmd;
2728
import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
2829
import org.apache.cloudstack.api.command.user.vm.DestroyVMCmd;
2930
import org.apache.cloudstack.api.command.user.vm.RebootVMCmd;
31+
import org.apache.cloudstack.api.command.user.vm.RemoveNicFromVMCmd;
3032
import org.apache.cloudstack.api.command.user.vm.ResetVMPasswordCmd;
33+
import org.apache.cloudstack.api.command.user.vm.ResetVMSSHKeyCmd;
3134
import org.apache.cloudstack.api.command.user.vm.RestoreVMCmd;
3235
import org.apache.cloudstack.api.command.user.vm.StartVMCmd;
36+
import org.apache.cloudstack.api.command.user.vm.UpdateDefaultNicForVMCmd;
3337
import org.apache.cloudstack.api.command.user.vm.UpdateVMCmd;
3438
import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd;
3539
import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
@@ -89,6 +93,15 @@ public interface UserVmService {
8993
*/
9094
UserVm resetVMPassword(ResetVMPasswordCmd cmd, String password) throws ResourceUnavailableException, InsufficientCapacityException;
9195

96+
/**
97+
* Resets the SSH Key of a virtual machine.
98+
*
99+
* @param cmd
100+
* - the command specifying vmId, Keypair name
101+
* @return the VM if reset worked successfully, null otherwise
102+
*/
103+
UserVm resetVMSSHKey(ResetVMSSHKeyCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException;
104+
92105
/**
93106
* Attaches the specified volume to the specified VM
94107
*
@@ -114,6 +127,27 @@ UserVm startVirtualMachine(StartVMCmd cmd) throws StorageUnavailableException, E
114127

115128
UserVm updateVirtualMachine(UpdateVMCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException;
116129

130+
/**
131+
* Adds a NIC on the given network to the virtual machine
132+
* @param cmd the command object that defines the vm and the given network
133+
* @return the vm object if successful, null otherwise
134+
*/
135+
UserVm addNicToVirtualMachine(AddNicToVMCmd cmd);
136+
137+
/**
138+
* Removes a NIC on the given network from the virtual machine
139+
* @param cmd the command object that defines the vm and the given network
140+
* @return the vm object if successful, null otherwise
141+
*/
142+
UserVm removeNicFromVirtualMachine(RemoveNicFromVMCmd cmd);
143+
144+
/**
145+
* Updates default Nic to the given network for given virtual machine
146+
* @param cmd the command object that defines the vm and the given network
147+
* @return the vm object if successful, null otherwise
148+
*/
149+
UserVm updateDefaultNicForVirtualMachine(UpdateDefaultNicForVMCmd cmd);
150+
117151
UserVm recoverVirtualMachine(RecoverVMCmd cmd) throws ResourceAllocationException;
118152

119153
/**

0 commit comments

Comments
 (0)