Skip to content

Commit fc33ef2

Browse files
author
Alex Huang
committed
Removed several unused fields after the refactoring
1 parent f70413f commit fc33ef2

31 files changed

Lines changed: 222 additions & 354 deletions

api/src/com/cloud/network/router/VirtualRouter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ public enum Role {
3939

4040
public String getPublicNetmask();
4141

42-
public String getPrivateNetmask();
43-
4442
public String getVnet();
4543

4644
public String getVlanId();
@@ -73,11 +71,13 @@ public enum Role {
7371
/**
7472
* @return account id that the domain router belongs to.
7573
*/
74+
@Override
7675
long getAccountId();
7776

7877
/**
7978
* @return domain id that the domain router belongs to.
8079
*/
80+
@Override
8181
long getDomainId();
8282

8383
Role getRole();

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

Lines changed: 0 additions & 123 deletions
This file was deleted.

api/src/com/cloud/storage/Volume.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ enum SourceType {
152152

153153
Date getCreated();
154154
AsyncInstanceCreateStatus getStatus();
155-
boolean getDestroyed();
156155

157156
long getDiskOfferingId();
158157

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

Lines changed: 99 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,112 @@
1818
package com.cloud.vm;
1919

2020
import java.net.URI;
21+
import java.util.Date;
22+
import java.util.List;
23+
import java.util.Set;
2124

2225
import com.cloud.network.Networks.Mode;
23-
import com.cloud.resource.Resource;
26+
import com.cloud.utils.fsm.FiniteState;
27+
import com.cloud.utils.fsm.StateMachine;
2428

2529

2630
/**
2731
* Nic represents one nic on the VM.
2832
*/
29-
public interface Nic extends Resource {
33+
public interface Nic {
34+
enum Event {
35+
ReservationRequested,
36+
ReleaseRequested,
37+
CancelRequested,
38+
OperationCompleted,
39+
OperationFailed,
40+
}
41+
42+
public enum State implements FiniteState<State, Event> {
43+
Allocated("Resource is allocated but not reserved"),
44+
Reserving("Resource is being reserved right now"),
45+
Reserved("Resource has been reserved."),
46+
Releasing("Resource is being released"),
47+
Deallocating("Resource is being deallocated");
48+
49+
String _description;
50+
51+
@Override
52+
public StateMachine<State, Event> getStateMachine() {
53+
return s_fsm;
54+
}
55+
56+
@Override
57+
public State getNextState(Event event) {
58+
return s_fsm.getNextState(this, event);
59+
}
60+
61+
@Override
62+
public List<State> getFromStates(Event event) {
63+
return s_fsm.getFromStates(this, event);
64+
}
65+
66+
@Override
67+
public Set<Event> getPossibleEvents() {
68+
return s_fsm.getPossibleEvents(this);
69+
}
70+
71+
private State(String description) {
72+
_description = description;
73+
}
74+
75+
@Override
76+
public String getDescription() {
77+
return _description;
78+
}
79+
80+
final static private StateMachine<State, Event> s_fsm = new StateMachine<State, Event>();
81+
static {
82+
s_fsm.addTransition(State.Allocated, Event.ReservationRequested, State.Reserving);
83+
s_fsm.addTransition(State.Reserving, Event.CancelRequested, State.Allocated);
84+
s_fsm.addTransition(State.Reserving, Event.OperationCompleted, State.Reserved);
85+
s_fsm.addTransition(State.Reserving, Event.OperationFailed, State.Allocated);
86+
s_fsm.addTransition(State.Reserved, Event.ReleaseRequested, State.Releasing);
87+
s_fsm.addTransition(State.Releasing, Event.OperationCompleted, State.Allocated);
88+
s_fsm.addTransition(State.Releasing, Event.OperationFailed, State.Reserved);
89+
}
90+
}
91+
92+
public enum ReservationStrategy {
93+
PlaceHolder,
94+
Create,
95+
Start;
96+
}
97+
98+
/**
99+
* @return id in the CloudStack database
100+
*/
101+
long getId();
102+
103+
/**
104+
* @return reservation id returned by the allocation source. This can be the
105+
* String version of the database id if the allocation source does not need it's
106+
* own implementation of the reservation id. This is passed back to the
107+
* allocation source to release the resource.
108+
*/
109+
String getReservationId();
110+
111+
/**
112+
* @return unique name for the allocation source.
113+
*/
114+
String getReserver();
115+
116+
/**
117+
* @return the time a reservation request was made to the allocation source.
118+
*/
119+
Date getUpdateTime();
120+
121+
/**
122+
* @return the reservation state of the resource.
123+
*/
124+
State getState();
125+
126+
ReservationStrategy getReservationStrategy();
30127
boolean isDefaultNic();
31128

32129
String getIp4Address();
@@ -54,5 +151,4 @@ public interface Nic extends Resource {
54151
URI getIsolationUri();
55152

56153
URI getBroadcastUri();
57-
58154
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
import com.cloud.network.Networks.BroadcastDomainType;
1111
import com.cloud.network.Networks.Mode;
1212
import com.cloud.network.Networks.TrafficType;
13-
import com.cloud.resource.Resource;
14-
import com.cloud.resource.Resource.ReservationStrategy;
13+
import com.cloud.vm.Nic.ReservationStrategy;
1514

1615
public class NicProfile {
1716
long id;
@@ -220,7 +219,7 @@ public NicProfile(long id, BroadcastDomainType type, Mode mode, long vmId) {
220219
this.vmId = vmId;
221220
}
222221

223-
public NicProfile(Resource.ReservationStrategy strategy, String ip4Address, String macAddress, String gateway, String netmask) {
222+
public NicProfile(ReservationStrategy strategy, String ip4Address, String macAddress, String gateway, String netmask) {
224223
this.format = AddressFormat.Ip4;
225224
this.ip4Address = ip4Address;
226225
this.macAddress = macAddress;

0 commit comments

Comments
 (0)