Skip to content

Commit ebbd400

Browse files
committed
zone creation complete once more
1 parent 5e6d2cf commit ebbd400

26 files changed

Lines changed: 117 additions & 104 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ public class NetworkTO {
4242
public NetworkTO() {
4343
}
4444

45-
public String getUuid() {
45+
public String getNicUuid() {
4646
return uuid;
4747
}
4848

49-
public void setUuid(String uuid) {
49+
public void setNicUuid(String uuid) {
5050
this.uuid = uuid;
5151
}
5252

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class NicTO extends NetworkTO {
2323
Integer networkRateMbps;
2424
Integer networkRateMulticastMbps;
2525
boolean defaultNic;
26-
String uuid;
26+
String nicUuid;
2727
List <String> nicSecIps;
2828

2929
public NicTO() {
@@ -59,13 +59,13 @@ public void setDefaultNic(boolean defaultNic) {
5959
}
6060

6161
@Override
62-
public String getUuid() {
63-
return uuid;
62+
public String getNicUuid() {
63+
return nicUuid;
6464
}
6565

6666
@Override
67-
public void setUuid(String uuid) {
68-
this.uuid = uuid;
67+
public void setNicUuid(String uuid) {
68+
this.nicUuid = uuid;
6969
}
7070

7171
@Override

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public DataCenterDeployment(long dataCenterId, Long podId, Long clusterId, Long
5454
_poolId = poolId;
5555
_physicalNetworkId = physicalNetworkId;
5656
_context = context;
57+
_avoids = new ExcludeList();
5758
}
5859

5960
@Override

api/src/org/apache/cloudstack/api/response/AsyncJobResponse.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ public class AsyncJobResponse extends BaseResponse {
4040
@SerializedName("cmd") @Param(description="the async command executed")
4141
private String cmd;
4242

43-
@SerializedName("jobstatus") @Param(description="the current job status-should be 0 for PENDING")
44-
private Integer jobStatus;
45-
4643
@SerializedName("jobprocstatus") @Param(description="the progress information of the PENDING job")
4744
private Integer jobProcStatus;
4845

@@ -76,11 +73,6 @@ public void setCmd(String cmd) {
7673
this.cmd = cmd;
7774
}
7875

79-
@Override
80-
public void setJobStatus(Integer jobStatus) {
81-
this.jobStatus = jobStatus;
82-
}
83-
8476
public void setJobProcStatus(Integer jobProcStatus) {
8577
this.jobProcStatus = jobProcStatus;
8678
}

api/src/org/apache/cloudstack/api/response/SystemVmResponse.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ public class SystemVmResponse extends BaseResponse {
3535
@SerializedName("systemvmtype") @Param(description="the system VM type")
3636
private String systemVmType;
3737

38-
@SerializedName("jobid") @Param(description="the job ID associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.")
39-
private String jobId;
40-
41-
@SerializedName("jobstatus") @Param(description="the job status associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.")
42-
private Integer jobStatus;
43-
4438
@SerializedName("zoneid") @Param(description="the Zone ID for the system VM")
4539
private String zoneId;
4640

@@ -119,7 +113,7 @@ public class SystemVmResponse extends BaseResponse {
119113

120114
@Override
121115
public String getObjectId() {
122-
return this.getId();
116+
return getId();
123117
}
124118

125119

api/src/org/apache/cloudstack/context/CallContext.java

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.util.HashMap;
2020
import java.util.Map;
21+
import java.util.UUID;
2122

2223
import org.apache.log4j.Logger;
2324
import org.apache.log4j.NDC;
@@ -26,6 +27,7 @@
2627
import com.cloud.exception.CloudAuthenticationException;
2728
import com.cloud.user.Account;
2829
import com.cloud.user.User;
30+
import com.cloud.utils.UuidUtils;
2931
import com.cloud.utils.exception.CloudRuntimeException;
3032

3133
/**
@@ -37,7 +39,7 @@ public class CallContext {
3739
private static final Logger s_logger = Logger.getLogger(CallContext.class);
3840
private static ThreadLocal<CallContext> s_currentContext = new ThreadLocal<CallContext>();
3941

40-
private String sessionId;
42+
private String contextId;
4143
private Account account;
4244
private long startEventId = 0;
4345
private String eventDetails;
@@ -53,10 +55,10 @@ public static void init(EntityManager entityMgr) {
5355
public CallContext() {
5456
}
5557

56-
protected CallContext(User user, Account account, String sessionId) {
58+
protected CallContext(User user, Account account, String contextId) {
5759
this.user = user;
5860
this.account = account;
59-
this.sessionId = sessionId;
61+
this.contextId = contextId;
6062
}
6163

6264
public void putContextParameter(String key, Object value) {
@@ -75,8 +77,8 @@ public User getCallingUser() {
7577
return user;
7678
}
7779

78-
public String getSessionId() {
79-
return sessionId;
80+
public String getContextId() {
81+
return contextId;
8082
}
8183

8284
public Account getCallingAccount() {
@@ -87,17 +89,18 @@ public static CallContext current() {
8789
return s_currentContext.get();
8890
}
8991

90-
public static CallContext register(User callingUser, Account callingAccount, String sessionId) {
92+
public static CallContext register(User callingUser, Account callingAccount, String contextId) {
9193
assert s_currentContext.get() == null : "There's a context already so what does this new register context mean? " + s_currentContext.get().toString();
9294
if (s_currentContext.get() != null) { // FIXME: This should be removed soon. I added this check only to surface all the places that have this problem.
9395
throw new CloudRuntimeException("There's a context already so what does this new register context mean? " + s_currentContext.get().toString());
9496
}
95-
CallContext callingContext = new CallContext(callingUser, callingAccount, sessionId);
96-
s_currentContext.set(callingContext);
97-
if (sessionId != null) {
98-
NDC.push("job-" + sessionId);
97+
if (contextId == null) {
98+
contextId = UUID.randomUUID().toString();
9999
}
100-
s_logger.debug("Setting calling context: " + s_currentContext.get());
100+
CallContext callingContext = new CallContext(callingUser, callingAccount, contextId);
101+
s_currentContext.set(callingContext);
102+
NDC.push("ctx-" + UuidUtils.first(contextId));
103+
s_logger.debug("Setting calling context: " + callingContext);
101104
return callingContext;
102105
}
103106

@@ -111,7 +114,7 @@ public static CallContext registerOnceOnly() {
111114
return context;
112115
}
113116

114-
public static CallContext register(String callingUserUuid, String callingAccountUuid, String sessionId) {
117+
public static CallContext register(String callingUserUuid, String callingAccountUuid, String contextId) {
115118
Account account = s_entityMgr.findByUuid(Account.class, callingAccountUuid);
116119
if (account == null) {
117120
throw new CloudAuthenticationException("The account is no longer current.").add(Account.class, callingAccountUuid);
@@ -121,10 +124,10 @@ public static CallContext register(String callingUserUuid, String callingAccount
121124
if (user == null) {
122125
throw new CloudAuthenticationException("The user is no longer current.").add(User.class, callingUserUuid);
123126
}
124-
return register(user, account, sessionId);
127+
return register(user, account, contextId);
125128
}
126129

127-
public static CallContext register(long callingUserId, long callingAccountId, String sessionId) throws CloudAuthenticationException {
130+
public static CallContext register(long callingUserId, long callingAccountId, String contextId) throws CloudAuthenticationException {
128131
Account account = s_entityMgr.findById(Account.class, callingAccountId);
129132
if (account == null) {
130133
throw new CloudAuthenticationException("The account is no longer current.").add(Account.class, Long.toString(callingAccountId));
@@ -133,15 +136,15 @@ public static CallContext register(long callingUserId, long callingAccountId, St
133136
if (user == null) {
134137
throw new CloudAuthenticationException("The user is no longer current.").add(User.class, Long.toString(callingUserId));
135138
}
136-
return register(user, account, sessionId);
139+
return register(user, account, contextId);
137140
}
138141

139-
public static CallContext register(long callingUserId, Account callingAccount, String sessionId, boolean apiServer) {
142+
public static CallContext register(long callingUserId, Account callingAccount, String contextId, boolean apiServer) {
140143
User user = s_entityMgr.findById(User.class, callingUserId);
141144
if (user == null) {
142145
throw new CloudAuthenticationException("The user is no longer current.").add(User.class, Long.toString(callingUserId));
143146
}
144-
return register(user, callingAccount, sessionId);
147+
return register(user, callingAccount, contextId);
145148
}
146149

147150
public static CallContext unregister() {
@@ -152,17 +155,15 @@ public static CallContext unregister() {
152155
}
153156
s_currentContext.remove();
154157
s_logger.debug("Context removed " + context);
155-
String sessionId = context.getSessionId();
156-
if (sessionId != null) {
157-
String sessionIdOnStack = null;
158-
String sessionIdPushedToNDC = "job-" + sessionId;
159-
while ((sessionIdOnStack = NDC.pop()) != null) {
160-
if (sessionIdPushedToNDC.equals(sessionIdOnStack)) {
161-
break;
162-
}
163-
if (s_logger.isTraceEnabled()) {
164-
s_logger.trace("Popping from NDC: " + sessionId);
165-
}
158+
String contextId = context.getContextId();
159+
String sessionIdOnStack = null;
160+
String sessionIdPushedToNDC = "ctx-" + UuidUtils.first(contextId);
161+
while ((sessionIdOnStack = NDC.pop()) != null) {
162+
if (sessionIdPushedToNDC.equals(sessionIdOnStack)) {
163+
break;
164+
}
165+
if (s_logger.isTraceEnabled()) {
166+
s_logger.trace("Popping from NDC: " + contextId);
166167
}
167168
}
168169
return context;
@@ -200,7 +201,7 @@ public String getEventDetails() {
200201
public String toString() {
201202
return new StringBuffer("CallContext[acct=").append(account.getId())
202203
.append("; user=").append(user.getId())
203-
.append("; session=").append(sessionId)
204+
.append("; session=").append(contextId)
204205
.append("]").toString();
205206
}
206207
}

core/src/com/cloud/agent/api/StopAnswer.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
package com.cloud.agent.api;
1818

1919
public class StopAnswer extends RebootAnswer {
20-
Integer vncPort;
21-
2220
protected StopAnswer() {
2321
}
2422

@@ -37,9 +35,4 @@ public StopAnswer(StopCommand cmd, Exception e) {
3735
super(cmd, e);
3836
}
3937

40-
@Override
41-
public Integer getVncPort() {
42-
return vncPort;
43-
}
44-
4538
}

engine/schema/src/org/apache/cloudstack/vm/jobs/VmWorkJobVO.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import org.apache.cloudstack.framework.jobs.impl.AsyncJobVO;
2828

2929
import com.cloud.vm.VirtualMachine;
30-
import com.cloud.vm.VirtualMachine.Type;
3130

3231

3332
@Entity
@@ -56,7 +55,11 @@ public enum Step {
5655
@Column(name="vm_instance_id")
5756
long vmInstanceId;
5857

59-
public VmWorkJobVO() {
58+
protected VmWorkJobVO() {
59+
}
60+
61+
public VmWorkJobVO(String related) {
62+
setRelated(related);
6063
}
6164

6265
public Step getStep() {

framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJob.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,6 @@ public static interface Topics {
101101
SyncQueueItem getSyncSource();
102102

103103
void setSyncSource(SyncQueueItem item);
104+
105+
String getRelated();
104106
}

framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobVO.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ public class AsyncJobVO implements AsyncJob, Job {
7171
@Column(name="job_cmd_ver")
7272
private int cmdVersion;
7373

74+
@Column(name = "related")
75+
private String related;
76+
7477
@Column(name="job_cmd_info", length=65535)
7578
private String cmdInfo;
7679

@@ -123,14 +126,16 @@ public class AsyncJobVO implements AsyncJob, Job {
123126

124127
public AsyncJobVO() {
125128
uuid = UUID.randomUUID().toString();
129+
related = UUID.randomUUID().toString();
126130
}
127131

128-
public AsyncJobVO(String uuid, long userId, long accountId, String cmd, String cmdInfo, Long instanceId, String instanceType) {
132+
public AsyncJobVO(String related, long userId, long accountId, String cmd, String cmdInfo, Long instanceId, String instanceType) {
129133
this.userId = userId;
130134
this.accountId = accountId;
131135
this.cmd = cmd;
132136
this.cmdInfo = cmdInfo;
133-
this.uuid = uuid;
137+
uuid = UUID.randomUUID().toString();
138+
this.related = related;
134139
this.instanceId = instanceId;
135140
this.instanceType = instanceType;
136141
}
@@ -149,6 +154,15 @@ public String getShortUuid() {
149154
return UuidUtils.first(uuid);
150155
}
151156

157+
public void setRelated(String related) {
158+
this.related = related;
159+
}
160+
161+
@Override
162+
public String getRelated() {
163+
return related;
164+
}
165+
152166
@Override
153167
public String getType() {
154168
return type;

0 commit comments

Comments
 (0)