bug 6930: return async job info in listHost/listStoragePools commands

status 6930: resolved fixed
This commit is contained in:
alena 2010-12-15 18:12:03 -08:00
parent 55f2f29271
commit 52e6e4d06e
7 changed files with 57 additions and 8 deletions

View File

@ -70,7 +70,7 @@ public class CancelPrimaryStorageMaintenanceCmd extends BaseAsyncCmd {
}
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.Host;
return AsyncJob.Type.StoragePool;
}
public Long getInstanceId() {

View File

@ -98,7 +98,7 @@ public class ListStoragePoolsCmd extends BaseListCmd {
}
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.Host;
return AsyncJob.Type.StoragePool;
}
@Override

View File

@ -66,7 +66,7 @@ public class PreparePrimaryStorageForMaintenanceCmd extends BaseAsyncCmd {
}
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.Host;
return AsyncJob.Type.StoragePool;
}
public Long getInstanceId() {

View File

@ -132,6 +132,12 @@ public class HostResponse extends BaseResponse {
@SerializedName("events") @Param(description="events available for the host")
private String events;
@SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the host")
private Long jobId;
@SerializedName("jobstatus") @Param(description="shows the current pending asynchronous job status")
private Integer jobStatus;
public Long getObjectId() {
return getId();
}
@ -415,4 +421,20 @@ public class HostResponse extends BaseResponse {
public void setEvents(String events) {
this.events = events;
}
public Long getJobId() {
return jobId;
}
public void setJobId(Long jobId) {
this.jobId = jobId;
}
public Integer getJobStatus() {
return jobStatus;
}
public void setJobStatus(Integer jobStatus) {
this.jobStatus = jobStatus;
}
}

View File

@ -72,6 +72,16 @@ public class StoragePoolResponse extends BaseResponse {
@SerializedName(ApiConstants.STATE) @Param(description="the state of the storage pool")
private Status state;
@SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the storage pool")
private Long jobId;
@SerializedName("jobstatus") @Param(description="shows the current pending asynchronous job status")
private Integer jobStatus;
public Long getObjectId() {
return getId();
}
public Long getId() {
return id;
@ -200,4 +210,20 @@ public class StoragePoolResponse extends BaseResponse {
public void setState(Status state) {
this.state = state;
}
public Integer getJobStatus() {
return jobStatus;
}
public void setJobStatus(Integer jobStatus) {
this.jobStatus = jobStatus;
}
public Long getJobId() {
return jobId;
}
public void setJobId(Long jobId) {
this.jobId = jobId;
}
}

View File

@ -30,7 +30,8 @@ public interface AsyncJob {
Template,
Iso,
SystemVm,
Host
Host,
StoragePool
}
Long getId();

View File

@ -441,10 +441,10 @@ public class ApiServer implements HttpRequestHandler {
for (AsyncJob job : jobs) {
if (job.getInstanceId() == null) continue;
for (ResponseObject response : responses) {
if (job.getInstanceId() == response.getObjectId()) {
response.setJobId(job.getId());
response.setJobStatus(job.getStatus());
}
if (response.getObjectId() != null && job.getInstanceId().longValue() == response.getObjectId().longValue()) {
response.setJobId(job.getId());
response.setJobStatus(job.getStatus());
}
}
}
}