Skip to content

Commit 7908dc2

Browse files
committed
Replace ids with objects or uuids
1 parent 65a0e36 commit 7908dc2

File tree

54 files changed

+555
-478
lines changed

Some content is hidden

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

54 files changed

+555
-478
lines changed

core/src/main/java/com/cloud/agent/api/StartupAnswer.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@
2222
public class StartupAnswer extends Answer {
2323
long hostId;
2424
String hostName;
25+
String hostUuid;
2526
int pingInterval;
2627

2728
protected StartupAnswer() {
2829
}
2930

30-
public StartupAnswer(StartupCommand cmd, long hostId, String hostName, int pingInterval) {
31+
public StartupAnswer(StartupCommand cmd, long hostId, String hostUuid, String hostName, int pingInterval) {
3132
super(cmd);
3233
this.hostId = hostId;
34+
this.hostUuid = hostUuid;
3335
this.hostName = hostName;
3436
this.pingInterval = pingInterval;
3537
}
@@ -42,6 +44,10 @@ public long getHostId() {
4244
return hostId;
4345
}
4446

47+
public String getHostUuid() {
48+
return hostUuid;
49+
}
50+
4551
public String getHostName() {
4652
return hostName;
4753
}

engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/EndPoint.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
public interface EndPoint {
2525
long getId();
2626

27+
String getUuid();
28+
2729
String getHostAddr();
2830

2931
String getPublicAddr();

engine/components-api/src/main/java/com/cloud/agent/Listener.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ public interface Listener {
4343
*/
4444
boolean processAnswers(long agentId, long seq, Answer[] answers);
4545

46+
default boolean processAnswers(long agentId, String uuid, String name, long seq, Answer[] answers) {
47+
return processAnswers(agentId, seq, answers);
48+
}
49+
4650
/**
4751
* This method is called by the AgentManager when an agent sent
4852
* a command to the server. In order to process these commands,
@@ -92,6 +96,10 @@ public interface Listener {
9296
*/
9397
boolean processDisconnect(long agentId, Status state);
9498

99+
default boolean processDisconnect(long agentId, String uuid, String name, Status state) {
100+
return processDisconnect(agentId, state);
101+
}
102+
95103
/**
96104
* This method is called by AgentManager when a host is about to be removed from a cluster.
97105
* @param long the ID of the host that's about to be removed

engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public interface CapacityManager {
128128
* @param ram required RAM
129129
* @param cpuOverprovisioningFactor factor to apply to the actual host cpu
130130
*/
131-
boolean checkIfHostHasCapacity(long hostId, Integer cpu, long ram, boolean checkFromReservedCapacity, float cpuOverprovisioningFactor, float memoryOvercommitRatio,
131+
boolean checkIfHostHasCapacity(Host host, Integer cpu, long ram, boolean checkFromReservedCapacity, float cpuOverprovisioningFactor, float memoryOvercommitRatio,
132132
boolean considerReservedCapacity);
133133

134134
void updateCapacityForHost(Host host);

engine/components-api/src/main/java/com/cloud/storage/StorageManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ static Boolean getFullCloneConfiguration(Long storeId) {
360360

361361
String getStoragePoolMountFailureReason(String error);
362362

363-
boolean connectHostToSharedPool(long hostId, long poolId) throws StorageUnavailableException, StorageConflictException;
363+
boolean connectHostToSharedPool(Host host, long poolId) throws StorageUnavailableException, StorageConflictException;
364364

365365
void disconnectHostFromSharedPool(long hostId, long poolId) throws StorageUnavailableException, StorageConflictException;
366366

engine/orchestration/src/main/java/com/cloud/agent/manager/AgentAttache.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public int compare(final Object o1, final Object o2) {
110110
protected static String LOG_SEQ_FORMATTED_STRING;
111111

112112
protected final long _id;
113+
protected String _uuid;
113114
protected String _name = null;
114115
protected final ConcurrentHashMap<Long, Listener> _waitForList;
115116
protected final LinkedList<Request> _requests;
@@ -133,8 +134,9 @@ public int compare(final Object o1, final Object o2) {
133134
Arrays.sort(s_commandsNotAllowedInConnectingMode);
134135
}
135136

136-
protected AgentAttache(final AgentManagerImpl agentMgr, final long id, final String name, final boolean maintenance) {
137+
protected AgentAttache(final AgentManagerImpl agentMgr, final long id, final String uuid, final String name, final boolean maintenance) {
137138
_id = id;
139+
_uuid = uuid;
138140
_name = name;
139141
_waitForList = new ConcurrentHashMap<Long, Listener>();
140142
_currentSequence = null;
@@ -145,6 +147,15 @@ protected AgentAttache(final AgentManagerImpl agentMgr, final long id, final Str
145147
LOG_SEQ_FORMATTED_STRING = String.format("Seq %d-{}: {}", _id);
146148
}
147149

150+
@Override
151+
public String toString() {
152+
return "AgentAttache{" +
153+
"id=" + _id +
154+
", uuid='" + _uuid + '\'' +
155+
", name='" + _name + '\'' +
156+
'}';
157+
}
158+
148159
public synchronized long getNextSequence() {
149160
return ++_nextSequence;
150161
}
@@ -206,7 +217,7 @@ protected synchronized void cancel(final long seq) {
206217
logger.debug(LOG_SEQ_FORMATTED_STRING, seq, "Cancelling.");
207218
final Listener listener = _waitForList.remove(seq);
208219
if (listener != null) {
209-
listener.processDisconnect(_id, Status.Disconnected);
220+
listener.processDisconnect(_id, _uuid, _name, Status.Disconnected);
210221
}
211222
int index = findRequest(seq);
212223
if (index >= 0) {
@@ -243,6 +254,10 @@ public long getId() {
243254
return _id;
244255
}
245256

257+
public String getUuid() {
258+
return _uuid;
259+
}
260+
246261
public String getName() {
247262
return _name;
248263
}
@@ -316,7 +331,7 @@ protected void cancelAllCommands(final Status state, final boolean cancelActive)
316331
it.remove();
317332
final Listener monitor = entry.getValue();
318333
logger.debug(LOG_SEQ_FORMATTED_STRING, entry.getKey(), "Sending disconnect to " + monitor.getClass());
319-
monitor.processDisconnect(_id, state);
334+
monitor.processDisconnect(_id, _uuid, _name, state);
320335
}
321336
}
322337
}

0 commit comments

Comments
 (0)