Repository: cloudstack Updated Branches: refs/heads/master 129437c63 -> b9d834e83
CLOUDSTACK-4200: listSystemVMs API and listRouters API should return hypervisor property since dynamic scaling is not enabled for all the hypervisors and that action can be showed only for the hypervisors that support it. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b9d834e8 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b9d834e8 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b9d834e8 Branch: refs/heads/master Commit: b9d834e83854009483f6d061f9996e5ffaa9b883 Parents: 129437c Author: Nitin Mehta <nitin.me...@citrix.com> Authored: Tue Aug 5 17:29:34 2014 -0700 Committer: Nitin Mehta <nitin.me...@citrix.com> Committed: Tue Aug 5 17:29:34 2014 -0700 ---------------------------------------------------------------------- .../api/response/DomainRouterResponse.java | 12 +++ .../api/response/SystemVmResponse.java | 12 +++ server/src/com/cloud/api/ApiResponseHelper.java | 1 + .../api/query/dao/DomainRouterJoinDaoImpl.java | 1 + .../cloud/api/query/vo/DomainRouterJoinVO.java | 9 ++ setup/db/db/schema-441to450.sql | 104 +++++++++++++++++++ 6 files changed, 139 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9d834e8/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java b/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java index ed16020..9225ba0 100644 --- a/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java +++ b/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java @@ -85,6 +85,10 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView @Param(description = "the hostname for the router") private String hostName; + @SerializedName("hypervisor") + @Param(description = "the hypervisor on which the template runs") + private String hypervisor; + @SerializedName(ApiConstants.LINK_LOCAL_IP) @Param(description = "the link local IP address for the router") private String linkLocalIp; @@ -262,6 +266,14 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView this.hostName = hostName; } + public String getHypervisor() { + return hypervisor; + } + + public void setHypervisor(String hypervisor) { + this.hypervisor = hypervisor; + } + public void setPublicIp(String publicIp) { this.publicIp = publicIp; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9d834e8/api/src/org/apache/cloudstack/api/response/SystemVmResponse.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/response/SystemVmResponse.java b/api/src/org/apache/cloudstack/api/response/SystemVmResponse.java index 8c27c18..9e20b49 100644 --- a/api/src/org/apache/cloudstack/api/response/SystemVmResponse.java +++ b/api/src/org/apache/cloudstack/api/response/SystemVmResponse.java @@ -85,6 +85,10 @@ public class SystemVmResponse extends BaseResponse { @Param(description = "the hostname for the system VM") private String hostName; + @SerializedName("hypervisor") + @Param(description = "the hypervisor on which the template runs") + private String hypervisor; + @SerializedName(ApiConstants.PRIVATE_IP) @Param(description = "the private IP address for the system VM") private String privateIp; @@ -240,6 +244,14 @@ public class SystemVmResponse extends BaseResponse { this.hostName = hostName; } + public String getHypervisor() { + return hypervisor; + } + + public void setHypervisor(String hypervisor) { + this.hypervisor = hypervisor; + } + public String getPrivateIp() { return privateIp; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9d834e8/server/src/com/cloud/api/ApiResponseHelper.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index 70ed47d..221e266 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -1166,6 +1166,7 @@ public class ApiResponseHelper implements ResponseGenerator { if (host != null) { vmResponse.setHostId(host.getUuid()); vmResponse.setHostName(host.getName()); + vmResponse.setHypervisor(host.getHypervisorType().toString()); } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9d834e8/server/src/com/cloud/api/query/dao/DomainRouterJoinDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/dao/DomainRouterJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/DomainRouterJoinDaoImpl.java index 9594c01..b054b0e 100644 --- a/server/src/com/cloud/api/query/dao/DomainRouterJoinDaoImpl.java +++ b/server/src/com/cloud/api/query/dao/DomainRouterJoinDaoImpl.java @@ -94,6 +94,7 @@ public class DomainRouterJoinDaoImpl extends GenericDaoBase<DomainRouterJoinVO, if (router.getHostId() != null) { routerResponse.setHostId(router.getHostUuid()); routerResponse.setHostName(router.getHostName()); + routerResponse.setHypervisor(router.getHypervisorType().toString()); } routerResponse.setPodId(router.getPodUuid()); long nic_id = router.getNicId(); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9d834e8/server/src/com/cloud/api/query/vo/DomainRouterJoinVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/vo/DomainRouterJoinVO.java b/server/src/com/cloud/api/query/vo/DomainRouterJoinVO.java index 79eb3bf..b4124de 100644 --- a/server/src/com/cloud/api/query/vo/DomainRouterJoinVO.java +++ b/server/src/com/cloud/api/query/vo/DomainRouterJoinVO.java @@ -26,6 +26,7 @@ import javax.persistence.Enumerated; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.hypervisor.Hypervisor; import com.cloud.network.Network.GuestType; import com.cloud.network.Networks.TrafficType; import com.cloud.network.router.VirtualRouter; @@ -126,6 +127,10 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti @Column(name = "host_name", nullable = false) private String hostName; + @Column(name="hypervisor_type") + @Enumerated(value=EnumType.STRING) + private Hypervisor.HypervisorType hypervisorType; + @Column(name = "template_id", updatable = true, nullable = true, length = 17) private long templateId; @@ -338,6 +343,10 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti return hostName; } + public Hypervisor.HypervisorType getHypervisorType() { + return hypervisorType; + } + public Long getClusterId() { return clusterId; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9d834e8/setup/db/db/schema-441to450.sql ---------------------------------------------------------------------- diff --git a/setup/db/db/schema-441to450.sql b/setup/db/db/schema-441to450.sql index 8bd4440..5323317 100644 --- a/setup/db/db/schema-441to450.sql +++ b/setup/db/db/schema-441to450.sql @@ -432,3 +432,107 @@ CREATE VIEW `cloud`.`template_view` AS UPDATE configuration SET value='KVM,XenServer,VMware,BareMetal,Ovm,LXC,Hyperv' WHERE name='hypervisor.list'; UPDATE `cloud`.`configuration` SET description="If set to true, will set guest VM's name as it appears on the hypervisor, to its hostname. The flag is supported for VMware hypervisor only" WHERE name='vm.instancename.flag'; +DROP VIEW IF EXISTS `cloud`.`domain_router_view`; +CREATE VIEW `cloud`.`domain_router_view` AS + select + vm_instance.id id, + vm_instance.name name, + account.id account_id, + account.uuid account_uuid, + account.account_name account_name, + account.type account_type, + domain.id domain_id, + domain.uuid domain_uuid, + domain.name domain_name, + domain.path domain_path, + projects.id project_id, + projects.uuid project_uuid, + projects.name project_name, + vm_instance.uuid uuid, + vm_instance.created created, + vm_instance.state state, + vm_instance.removed removed, + vm_instance.pod_id pod_id, + vm_instance.instance_name instance_name, + host_pod_ref.uuid pod_uuid, + 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.dns1 dns1, + data_center.dns2 dns2, + data_center.ip6_dns1 ip6_dns1, + data_center.ip6_dns2 ip6_dns2, + host.id host_id, + host.uuid host_uuid, + host.name host_name, + host.hypervisor_type, + host.cluster_id cluster_id, + vm_template.id template_id, + vm_template.uuid template_uuid, + service_offering.id service_offering_id, + disk_offering.uuid service_offering_uuid, + disk_offering.name service_offering_name, + nics.id nic_id, + nics.uuid nic_uuid, + nics.network_id network_id, + nics.ip4_address ip_address, + nics.ip6_address ip6_address, + nics.ip6_gateway ip6_gateway, + nics.ip6_cidr ip6_cidr, + nics.default_nic is_default_nic, + nics.gateway gateway, + nics.netmask netmask, + nics.mac_address mac_address, + nics.broadcast_uri broadcast_uri, + nics.isolation_uri isolation_uri, + vpc.id vpc_id, + vpc.uuid vpc_uuid, + networks.uuid network_uuid, + networks.name network_name, + networks.network_domain network_domain, + networks.traffic_type traffic_type, + networks.guest_type guest_type, + async_job.id job_id, + async_job.uuid job_uuid, + async_job.job_status job_status, + async_job.account_id job_account_id, + domain_router.template_version template_version, + domain_router.scripts_version scripts_version, + domain_router.is_redundant_router is_redundant_router, + domain_router.redundant_state redundant_state, + domain_router.stop_pending stop_pending, + domain_router.role role + from + `cloud`.`domain_router` + inner join + `cloud`.`vm_instance` ON vm_instance.id = domain_router.id + inner join + `cloud`.`account` ON vm_instance.account_id = account.id + inner join + `cloud`.`domain` ON vm_instance.domain_id = domain.id + left join + `cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id + left join + `cloud`.`projects` ON projects.project_account_id = account.id + left join + `cloud`.`data_center` ON vm_instance.data_center_id = data_center.id + left join + `cloud`.`host` ON vm_instance.host_id = host.id + left join + `cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id + left join + `cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id + left join + `cloud`.`disk_offering` ON vm_instance.service_offering_id = disk_offering.id + left join + `cloud`.`nics` ON vm_instance.id = nics.instance_id and nics.removed is null + left join + `cloud`.`networks` ON nics.network_id = networks.id + left join + `cloud`.`vpc` ON domain_router.vpc_id = vpc.id and vpc.removed is null + left join + `cloud`.`async_job` ON async_job.instance_id = vm_instance.id + and async_job.instance_type = 'DomainRouter' + and async_job.job_status = 0; +