CLOUDSTACK-6633: listVolumes should return template/iso info for root volumes

This commit is contained in:
Nitin Mehta 2014-05-11 20:32:04 -07:00
parent 6c8a0a1f96
commit 7ae784ba3c
4 changed files with 132 additions and 4 deletions

View File

@ -60,6 +60,30 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
@Param(description = "id of the virtual machine")
private String virtualMachineId;
@SerializedName("isoid")
@Param(description = "the ID of the ISO attached to the virtual machine")
private String isoId;
@SerializedName("isoname")
@Param(description = "the name of the ISO attached to the virtual machine")
private String isoName;
@SerializedName("isodisplaytext")
@Param(description = "an alternate display text of the ISO attached to the virtual machine")
private String isoDisplayText;
@SerializedName(ApiConstants.TEMPLATE_ID)
@Param(description = "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.")
private String templateId;
@SerializedName("templatename")
@Param(description = "the name of the template for the virtual machine")
private String templateName;
@SerializedName("templatedisplaytext")
@Param(description = " an alternate display text of the template for the virtual machine")
private String templateDisplayText;
@SerializedName("vmname")
@Param(description = "name of the virtual machine")
private String virtualMachineName;
@ -451,5 +475,51 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
return this.needQuiescevm;
}
public String getIsoId() {
return isoId;
}
public void setIsoId(String isoId) {
this.isoId = isoId;
}
public String getIsoName() {
return isoName;
}
public void setIsoName(String isoName) {
this.isoName = isoName;
}
public String getIsoDisplayText() {
return isoDisplayText;
}
public void setIsoDisplayText(String isoDisplayText) {
this.isoDisplayText = isoDisplayText;
}
public String getTemplateId() {
return templateId;
}
public void setTemplateId(String templateId) {
this.templateId = templateId;
}
public String getTemplateName() {
return templateName;
}
public void setTemplateName(String templateName) {
this.templateName = templateName;
}
public String getTemplateDisplayText() {
return templateDisplayText;
}
public void setTemplateDisplayText(String templateDisplayText) {
this.templateDisplayText = templateDisplayText;
}
}

View File

@ -217,6 +217,14 @@ public class VolumeJoinDaoImpl extends GenericDaoBase<VolumeJoinVO, Long> implem
volResponse.setDisplayVolume(volume.isDisplayVolume());
volResponse.setChainInfo(volume.getChainInfo());
volResponse.setTemplateId(volume.getTemplateUuid());
volResponse.setTemplateName(volume.getTemplateName());
volResponse.setTemplateDisplayText(volume.getTemplateDisplayText());
volResponse.setIsoId(volume.getIsoUuid());
volResponse.setIsoName(volume.getIsoName());
volResponse.setIsoDisplayText(volume.getIsoDisplayText());
// set async job
if (volume.getJobId() != null) {
volResponse.setJobId(volume.getJobUuid());

View File

@ -216,12 +216,30 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity {
@Column(name = "template_uuid")
private String templateUuid;
@Column(name = "template_name")
private String templateName;
@Column(name = "template_display_text", length = 4096)
private String templateDisplayText;
@Column(name = "extractable")
private boolean extractable;
@Column(name = "template_type")
private Storage.TemplateType templateType;
@Column(name = "iso_id", updatable = true, nullable = true, length = 17)
private long isoId;
@Column(name = "iso_uuid")
private String isoUuid;
@Column(name = "iso_name")
private String isoName;
@Column(name = "iso_display_text", length = 4096)
private String isoDisplayText;
@Column(name = "job_id")
private Long jobId;
@ -502,6 +520,30 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity {
return templateType;
}
public String getTemplateName() {
return templateName;
}
public String getTemplateDisplayText() {
return templateDisplayText;
}
public long getIsoId() {
return isoId;
}
public String getIsoUuid() {
return isoUuid;
}
public String getIsoName() {
return isoName;
}
public String getIsoDisplayText() {
return isoDisplayText;
}
public Long getJobId() {
return jobId;
}

View File

@ -128,9 +128,9 @@ CREATE VIEW `cloud`.`volume_view` AS
volumes.attached,
volumes.removed,
volumes.pod_id,
volumes.display_volume,
volumes.display_volume,
volumes.format,
volumes.path,
volumes.path,
volumes.chain_info,
account.id account_id,
account.uuid account_uuid,
@ -146,7 +146,7 @@ CREATE VIEW `cloud`.`volume_view` AS
data_center.id data_center_id,
data_center.uuid data_center_uuid,
data_center.name data_center_name,
data_center.networktype data_center_type,
data_center.networktype data_center_type,
vm_instance.id vm_id,
vm_instance.uuid vm_uuid,
vm_instance.name vm_name,
@ -177,6 +177,12 @@ CREATE VIEW `cloud`.`volume_view` AS
vm_template.uuid template_uuid,
vm_template.extractable,
vm_template.type template_type,
vm_template.name template_name,
vm_template.display_text template_display_text,
iso.id iso_id,
iso.uuid iso_uuid,
iso.name iso_name,
iso.display_text iso_display_text,
resource_tags.id tag_id,
resource_tags.uuid tag_uuid,
resource_tags.key tag_key,
@ -214,7 +220,9 @@ CREATE VIEW `cloud`.`volume_view` AS
left join
`cloud`.`cluster` ON storage_pool.cluster_id = cluster.id
left join
`cloud`.`vm_template` ON volumes.template_id = vm_template.id OR volumes.iso_id = vm_template.id
`cloud`.`vm_template` ON volumes.template_id = vm_template.id
left join
`cloud`.`vm_template` iso ON iso.id = volumes.iso_id
left join
`cloud`.`resource_tags` ON resource_tags.resource_id = volumes.id
and resource_tags.resource_type = 'Volume'