diff --git a/api/src/main/java/org/apache/cloudstack/api/response/SystemVmResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/SystemVmResponse.java index 69b9b4cad9c..31a8b731491 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/SystemVmResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/SystemVmResponse.java @@ -178,6 +178,14 @@ public class SystemVmResponse extends BaseResponseWithAnnotations { @Param(description = "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.") private Boolean isDynamicallyScalable; + @SerializedName(ApiConstants.SERVICE_OFFERING_ID) + @Param(description = "the ID of the service offering of the system virtual machine.") + private String serviceOfferingId; + + @SerializedName("serviceofferingname") + @Param(description = "the name of the service offering of the system virtual machine.") + private String serviceOfferingName; + @Override public String getObjectId() { return this.getId(); @@ -466,4 +474,20 @@ public class SystemVmResponse extends BaseResponseWithAnnotations { public void setDynamicallyScalable(Boolean dynamicallyScalable) { isDynamicallyScalable = dynamicallyScalable; } + + public String getServiceOfferingId() { + return serviceOfferingId; + } + + public void setServiceOfferingId(String serviceOfferingId) { + this.serviceOfferingId = serviceOfferingId; + } + + public String getServiceOfferingName() { + return serviceOfferingName; + } + + public void setServiceOfferingName(String serviceOfferingName) { + this.serviceOfferingName = serviceOfferingName; + } } diff --git a/server/src/main/java/com/cloud/api/ApiResponseHelper.java b/server/src/main/java/com/cloud/api/ApiResponseHelper.java index cbf23cde8c1..1eb9dd84259 100644 --- a/server/src/main/java/com/cloud/api/ApiResponseHelper.java +++ b/server/src/main/java/com/cloud/api/ApiResponseHelper.java @@ -1639,6 +1639,12 @@ public class ApiResponseHelper implements ResponseGenerator { vmResponse.setCreated(vm.getCreated()); vmResponse.setHypervisor(vm.getHypervisorType().getHypervisorDisplayName()); + ServiceOffering serviceOffering = ApiDBUtils.findServiceOfferingById(vm.getServiceOfferingId()); + if (serviceOffering != null) { + vmResponse.setServiceOfferingId(serviceOffering.getUuid()); + vmResponse.setServiceOfferingName(serviceOffering.getName()); + } + if (vm.getHostId() != null) { Host host = ApiDBUtils.findHostById(vm.getHostId()); if (host != null) { diff --git a/test/integration/smoke/test_ssvm.py b/test/integration/smoke/test_ssvm.py index cdbc7d2f58e..ad03c3d46e1 100644 --- a/test/integration/smoke/test_ssvm.py +++ b/test/integration/smoke/test_ssvm.py @@ -121,7 +121,7 @@ class TestSSVMs(cloudstackTestCase): # should return only ONE SSVM per zone # 2. The returned SSVM should be in Running state # 3. listSystemVM for secondarystoragevm should list publicip, - # privateip and link-localip + # privateip, link-localip and service offering id/name # 4. The gateway programmed on the ssvm by listSystemVm should be # the same as the gateway returned by listVlanIpRanges # 5. DNS entries must match those given for the zone @@ -188,6 +188,18 @@ class TestSSVMs(cloudstackTestCase): "Check whether SSVM has public IP field" ) + self.assertEqual( + hasattr(ssvm, 'serviceofferingid'), + True, + "Check whether SSVM has service offering id field" + ) + + self.assertEqual( + hasattr(ssvm, 'serviceofferingname'), + True, + "Check whether SSVM has service offering name field" + ) + # Fetch corresponding ip ranges information from listVlanIpRanges ipranges_response = list_vlan_ipranges( self.apiclient, @@ -261,8 +273,8 @@ class TestSSVMs(cloudstackTestCase): # 1. listSystemVM (systemvmtype=consoleproxy) should return # at least ONE CPVM per zone # 2. The returned ConsoleProxyVM should be in Running state - # 3. listSystemVM for console proxy should list publicip, privateip - # and link-localip + # 3. listSystemVM for console proxy should list publicip, privateip, + # link-localip and service offering id/name # 4. The gateway programmed on the console proxy should be the same # as the gateway returned by listZones # 5. DNS entries must match those given for the zone @@ -327,6 +339,18 @@ class TestSSVMs(cloudstackTestCase): True, "Check whether CPVM has public IP field" ) + + self.assertEqual( + hasattr(cpvm, 'serviceofferingid'), + True, + "Check whether CPVM has service offering id field" + ) + + self.assertEqual( + hasattr(cpvm, 'serviceofferingname'), + True, + "Check whether CPVM has service offering name field" + ) # Fetch corresponding ip ranges information from listVlanIpRanges ipranges_response = list_vlan_ipranges( self.apiclient, diff --git a/ui/src/components/view/InfoCard.vue b/ui/src/components/view/InfoCard.vue index 550bba74409..90952b0ea42 100644 --- a/ui/src/components/view/InfoCard.vue +++ b/ui/src/components/view/InfoCard.vue @@ -523,7 +523,7 @@
{{ $t('label.serviceofferingname') }}
- {{ resource.serviceofferingname || resource.serviceofferingid }} + {{ resource.serviceofferingname || resource.serviceofferingid }} {{ resource.serviceofferingname || resource.serviceofferingid }} {{ resource.serviceofferingname || resource.serviceofferingid }}