From 5204349fef2abfe61f7ba7d75c03ff2b24cc34c2 Mon Sep 17 00:00:00 2001 From: Kris McQueen Date: Wed, 8 Sep 2010 11:59:16 -0700 Subject: [PATCH] Refactor listSystemVms to new API framework. Add missing licensing info to several API response files. Combine ConsoleProxy and SecondaryStorageVm interfaces into SystemVm interface to have common functions callable from one interface rather than having to cast overly much just to get the same data from the objects. This also includes a partial refactoring of ListStoragePoolsAndHosts command. --- core/src/com/cloud/vm/ConsoleProxy.java | 19 +- core/src/com/cloud/vm/SecondaryStorageVm.java | 17 +- core/src/com/cloud/vm/SystemVm.java | 36 +++ .../commands/ListStoragePoolsAndHostsCmd.java | 10 +- .../api/commands/ListStoragePoolsCmd.java | 176 ++++------- .../cloud/api/commands/ListSystemVMsCmd.java | 245 +++++---------- .../com/cloud/api/response/AlertResponse.java | 17 ++ .../cloud/api/response/AsyncJobResponse.java | 17 ++ .../cloud/api/response/CapacityResponse.java | 17 ++ .../cloud/api/response/ClusterResponse.java | 17 ++ .../api/response/ConfigurationResponse.java | 17 ++ .../api/response/DiskOfferingResponse.java | 17 ++ .../cloud/api/response/DomainResponse.java | 17 ++ .../api/response/DomainRouterResponse.java | 17 ++ .../com/cloud/api/response/EventResponse.java | 17 ++ .../api/response/FirewallRuleResponse.java | 17 ++ .../api/response/GuestOSCategoryResponse.java | 17 ++ .../cloud/api/response/GuestOSResponse.java | 17 ++ .../com/cloud/api/response/HostResponse.java | 17 ++ .../cloud/api/response/IPAddressResponse.java | 17 ++ .../api/response/IngressRuleResponse.java | 17 ++ .../api/response/LoadBalancerResponse.java | 17 ++ .../api/response/NetworkGroupResponse.java | 17 ++ .../com/cloud/api/response/PodResponse.java | 17 ++ .../PortForwardingServiceRuleResponse.java | 17 ++ .../api/response/PreallocatedLunResponse.java | 17 ++ .../api/response/ResourceLimitResponse.java | 17 ++ .../api/response/SecurityGroupResponse.java | 17 ++ .../api/response/ServiceOfferingResponse.java | 17 ++ .../api/response/SnapshotPolicyResponse.java | 17 ++ .../cloud/api/response/SnapshotResponse.java | 17 ++ .../response/SnapshotScheduleResponse.java | 17 ++ .../api/response/StoragePoolResponse.java | 17 ++ .../cloud/api/response/SystemVmResponse.java | 289 ++++++++++++++++++ .../cloud/api/response/TemplateResponse.java | 17 ++ .../cloud/api/response/UpgradeVmResponse.java | 17 ++ .../com/cloud/api/response/UserResponse.java | 17 ++ .../cloud/api/response/UserVmResponse.java | 17 ++ .../api/response/VlanIpRangeResponse.java | 17 ++ .../com/cloud/api/response/ZoneResponse.java | 17 ++ .../com/cloud/server/ManagementServer.java | 16 + .../cloud/server/ManagementServerImpl.java | 59 +++- 42 files changed, 1077 insertions(+), 351 deletions(-) create mode 100644 core/src/com/cloud/vm/SystemVm.java create mode 100644 server/src/com/cloud/api/response/SystemVmResponse.java diff --git a/core/src/com/cloud/vm/ConsoleProxy.java b/core/src/com/cloud/vm/ConsoleProxy.java index 66d2da16eb2..d3fefb52cdc 100644 --- a/core/src/com/cloud/vm/ConsoleProxy.java +++ b/core/src/com/cloud/vm/ConsoleProxy.java @@ -15,30 +15,13 @@ * along with this program. If not, see . * */ - package com.cloud.vm; -import java.util.Date; - /** * ConsoleProxy is a system VM instance that is used * to proxy VNC traffic */ -public interface ConsoleProxy extends VirtualMachine { - - public String getGateway(); - public String getDns1(); - public String getDns2(); - public String getDomain(); - public String getPublicIpAddress(); - public String getPublicNetmask(); - public String getPublicMacAddress(); - public Long getVlanDbId(); - public String getVlanId(); - public String getPrivateNetmask(); - public int getRamSize(); - public int getActiveSession(); - public Date getLastUpdateTime(); +public interface ConsoleProxy extends SystemVm { public byte[] getSessionDetails(); } diff --git a/core/src/com/cloud/vm/SecondaryStorageVm.java b/core/src/com/cloud/vm/SecondaryStorageVm.java index 139bf23f6db..b43a3160788 100644 --- a/core/src/com/cloud/vm/SecondaryStorageVm.java +++ b/core/src/com/cloud/vm/SecondaryStorageVm.java @@ -17,25 +17,10 @@ */ package com.cloud.vm; -import java.util.Date; - /** * Secondary Storage VM is a system VM instance that is used * to interface the management server to secondary storage */ -public interface SecondaryStorageVm extends VirtualMachine { - - public String getGateway(); - public String getDns1(); - public String getDns2(); - public String getDomain(); - public String getPublicIpAddress(); - public String getPublicNetmask(); - public String getPublicMacAddress(); - public Long getVlanDbId(); - public String getVlanId(); - public String getPrivateNetmask(); - public int getRamSize(); - public Date getLastUpdateTime(); +public interface SecondaryStorageVm extends SystemVm { } diff --git a/core/src/com/cloud/vm/SystemVm.java b/core/src/com/cloud/vm/SystemVm.java new file mode 100644 index 00000000000..d6cad60abf8 --- /dev/null +++ b/core/src/com/cloud/vm/SystemVm.java @@ -0,0 +1,36 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +package com.cloud.vm; + +import java.util.Date; + +public interface SystemVm extends VirtualMachine { + public String getGateway(); + public String getDns1(); + public String getDns2(); + public String getDomain(); + public String getPublicIpAddress(); + public String getPublicNetmask(); + public String getPublicMacAddress(); + public Long getVlanDbId(); + public String getVlanId(); + public String getPrivateNetmask(); + public int getRamSize(); + public int getActiveSession(); + public Date getLastUpdateTime(); +} diff --git a/server/src/com/cloud/api/commands/ListStoragePoolsAndHostsCmd.java b/server/src/com/cloud/api/commands/ListStoragePoolsAndHostsCmd.java index 7f474325f26..e84c843f9cd 100644 --- a/server/src/com/cloud/api/commands/ListStoragePoolsAndHostsCmd.java +++ b/server/src/com/cloud/api/commands/ListStoragePoolsAndHostsCmd.java @@ -25,12 +25,15 @@ import java.util.Map; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.BaseListCmd; +import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.host.Host; import com.cloud.server.ManagementServer; import com.cloud.utils.Pair; - -public class ListStoragePoolsAndHostsCmd extends BaseCmd{ + +@Implementation(method="") +public class ListStoragePoolsAndHostsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListStoragePoolsAndHostsCmd.class.getName()); private static final String s_name = "liststoragepoolsandhostsresponse"; @@ -115,8 +118,7 @@ public class ListStoragePoolsAndHostsCmd extends BaseCmd{ } @Override - public List> getProperties() { - return s_properties; + public String getResponse() { } @Override diff --git a/server/src/com/cloud/api/commands/ListStoragePoolsCmd.java b/server/src/com/cloud/api/commands/ListStoragePoolsCmd.java index abb5848c2f5..5c375d5f554 100644 --- a/server/src/com/cloud/api/commands/ListStoragePoolsCmd.java +++ b/server/src/com/cloud/api/commands/ListStoragePoolsCmd.java @@ -20,40 +20,23 @@ package com.cloud.api.commands; import java.util.ArrayList; import java.util.List; -import java.util.Map; import org.apache.log4j.Logger; -import com.cloud.api.BaseCmd; +import com.cloud.api.BaseListCmd; +import com.cloud.api.Implementation; import com.cloud.api.Parameter; -import com.cloud.api.ServerApiException; +import com.cloud.api.response.StoragePoolResponse; import com.cloud.dc.ClusterVO; -import com.cloud.server.Criteria; -import com.cloud.server.ManagementServer; +import com.cloud.serializer.SerializerHelper; import com.cloud.storage.StoragePoolVO; import com.cloud.storage.StorageStats; -import com.cloud.storage.dao.VolumeDao; -import com.cloud.utils.Pair; -import com.cloud.utils.component.ComponentLocator; - -public class ListStoragePoolsCmd extends BaseCmd{ + +@Implementation(method="searchForStoragePools") +public class ListStoragePoolsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListStoragePoolsCmd.class.getName()); private static final String s_name = "liststoragepoolsresponse"; - private static final List> s_properties = new ArrayList>(); - - static { - s_properties.add(new Pair(BaseCmd.Properties.CLUSTER_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.IP_ADDRESS, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PATH, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); - - s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); - } ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -114,107 +97,54 @@ public class ListStoragePoolsCmd extends BaseCmd{ return s_name; } - @Override - public List> getProperties() { - return s_properties; - } - - @Override - public List> execute(Map params) { - String name = (String)params.get(BaseCmd.Properties.NAME.getName()); - Long zoneId = (Long)params.get(BaseCmd.Properties.ZONE_ID.getName()); - Long podId = (Long)params.get(BaseCmd.Properties.POD_ID.getName()); - Long clusterId = (Long)params.get(BaseCmd.Properties.CLUSTER_ID.getName()); - String ipAddress = (String)params.get(BaseCmd.Properties.IP_ADDRESS.getName()); - String path = (String)params.get(BaseCmd.Properties.PATH.getName()); - String keyword = (String)params.get(BaseCmd.Properties.KEYWORD.getName()); - Integer page = (Integer)params.get(BaseCmd.Properties.PAGE.getName()); - Integer pageSize = (Integer)params.get(BaseCmd.Properties.PAGESIZE.getName()); - - Long startIndex = Long.valueOf(0); - int pageSizeNum = 50; - if (pageSize != null) { - pageSizeNum = pageSize.intValue(); - } - if (page != null) { - int pageNum = page.intValue(); - if (pageNum > 0) { - startIndex = Long.valueOf(pageSizeNum * (pageNum-1)); - } - } - Criteria c = new Criteria("id", Boolean.TRUE, startIndex, Long.valueOf(pageSizeNum)); - if (keyword != null) { - c.addCriteria(Criteria.KEYWORD, keyword); - } else { - c.addCriteria(Criteria.NAME, name); - c.addCriteria(Criteria.DATACENTERID, zoneId); - c.addCriteria(Criteria.PODID, podId); - c.addCriteria(Criteria.CLUSTERID, clusterId); - c.addCriteria(Criteria.ADDRESS, ipAddress); - c.addCriteria(Criteria.PATH, path); - } - - List pools = getManagementServer().searchForStoragePools(c); - - if (pools == null) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "unable to find pools"); - } - - ComponentLocator locator = ComponentLocator.getLocator(ManagementServer.Name); - VolumeDao volDao = locator.getDao(VolumeDao.class); - List> poolTags = new ArrayList>(); - Object[] sTag = new Object[pools.size()]; - int i = 0; - for (StoragePoolVO pool : pools) { - StoragePoolVO netfsPool = pool; - List> poolData = new ArrayList>(); - poolData.add(new Pair(BaseCmd.Properties.ID.getName(), Long.toString(pool.getId()))); - poolData.add(new Pair(BaseCmd.Properties.NAME.getName(), pool.getName())); - - if (pool.getPoolType() != null) { - poolData.add(new Pair(BaseCmd.Properties.TYPE.getName(), pool.getPoolType().toString())); - } - poolData.add(new Pair(BaseCmd.Properties.IP_ADDRESS.getName(), netfsPool.getHostAddress())); - poolData.add(new Pair(BaseCmd.Properties.ZONE_ID.getName(), Long.valueOf(pool.getDataCenterId()).toString())); - poolData.add(new Pair(BaseCmd.Properties.ZONE_NAME.getName(), getManagementServer().getDataCenterBy(pool.getDataCenterId()).getName())); - if (pool.getPodId() != null) { - poolData.add(new Pair(BaseCmd.Properties.POD_ID.getName(), Long.valueOf(pool.getPodId()).toString())); - poolData.add(new Pair(BaseCmd.Properties.POD_NAME.getName(), getManagementServer().getPodBy(pool.getPodId()).getName())); - } - - poolData.add(new Pair(BaseCmd.Properties.PATH.getName(), netfsPool.getPath().toString())); - - StorageStats stats = getManagementServer().getStoragePoolStatistics(pool.getId()); - long capacity = pool.getCapacityBytes(); - long available = pool.getAvailableBytes() ; - long used = capacity - available; - - if (stats != null) { - used = stats.getByteUsed(); - available = capacity - used; - } - - poolData.add(new Pair(BaseCmd.Properties.DISK_SIZE_TOTAL.getName(), Long.valueOf(pool.getCapacityBytes()).toString())); - poolData.add(new Pair(BaseCmd.Properties.DISK_SIZE_ALLOCATED.getName(), Long.valueOf(used).toString())); - - if (pool.getCreated() != null) { - poolData.add(new Pair(BaseCmd.Properties.CREATED.getName(), getDateString(pool.getCreated()))); + @Override @SuppressWarnings("unchecked") + public String getResponse() { + List pools = (List)getResponseObject(); + + List response = new ArrayList(); + for (StoragePoolVO pool : pools) { + StoragePoolResponse poolResponse = new StoragePoolResponse(); + poolResponse.setId(pool.getId()); + poolResponse.setName(pool.getName()); + poolResponse.setPath(pool.getPath()); + poolResponse.setIpAddress(pool.getHostAddress()); + poolResponse.setZoneId(pool.getDataCenterId()); + poolResponse.setZoneName(getManagementServer().getDataCenterBy(pool.getDataCenterId()).getName()); + if (pool.getPoolType() != null) { + poolResponse.setType(pool.getPoolType().toString()); } - + if (pool.getPodId() != null) { + poolResponse.setPodId(pool.getPodId()); + poolResponse.setPodName(getManagementServer().getPodBy(pool.getPodId()).getName()); + } + if (pool.getCreated() != null) { + poolResponse.setCreated(pool.getCreated()); + } + + StorageStats stats = getManagementServer().getStoragePoolStatistics(pool.getId()); + long capacity = pool.getCapacityBytes(); + long available = pool.getAvailableBytes() ; + long used = capacity - available; + + if (stats != null) { + used = stats.getByteUsed(); + available = capacity - used; + } + + poolResponse.setDiskSizeTotal(pool.getCapacityBytes()); + poolResponse.setDiskSizeAllocated(used); + if (pool.getClusterId() != null) { - ClusterVO cluster = getManagementServer().findClusterById(pool.getClusterId()); - poolData.add(new Pair(BaseCmd.Properties.CLUSTER_ID.getName(), cluster.getId())); - poolData.add(new Pair(BaseCmd.Properties.CLUSTER_NAME.getName(), cluster.getName())); + ClusterVO cluster = getManagementServer().findClusterById(pool.getClusterId()); + poolResponse.setClusterId(cluster.getId()); + poolResponse.setClusterName(cluster.getName()); } - - poolData.add(new Pair(BaseCmd.Properties.TAGS.getName(), getManagementServer().getStoragePoolTags(pool.getId()))); - - sTag[i++] = poolData; - volDao.getCountAndTotalByPool(pool.getId()); - } - Pair poolTag = new Pair("storagepool", sTag); - poolTags.add(poolTag); - - return poolTags; + + poolResponse.setTags(getManagementServer().getStoragePoolTags(pool.getId())); + + response.add(poolResponse); + } + + return SerializerHelper.toSerializedString(response); } } diff --git a/server/src/com/cloud/api/commands/ListSystemVMsCmd.java b/server/src/com/cloud/api/commands/ListSystemVMsCmd.java index 4ae4939639c..fd967021489 100644 --- a/server/src/com/cloud/api/commands/ListSystemVMsCmd.java +++ b/server/src/com/cloud/api/commands/ListSystemVMsCmd.java @@ -15,43 +15,30 @@ * along with this program. If not, see . * */ - package com.cloud.api.commands; - + import java.util.ArrayList; import java.util.List; -import java.util.Map; import org.apache.log4j.Logger; -import com.cloud.api.BaseCmd; +import com.cloud.api.BaseListCmd; +import com.cloud.api.Implementation; import com.cloud.api.Parameter; +import com.cloud.api.response.SystemVmResponse; import com.cloud.async.AsyncJobVO; -import com.cloud.server.Criteria; -import com.cloud.utils.Pair; +import com.cloud.serializer.SerializerHelper; import com.cloud.vm.ConsoleProxyVO; import com.cloud.vm.SecondaryStorageVmVO; - -public class ListSystemVMsCmd extends BaseCmd { - public static final Logger s_logger = Logger.getLogger(ListSystemVMsCmd.class.getName()); - - private static final String s_name = "listsystemvmsresponse"; - private static final List> s_properties = new ArrayList>(); - - static { - s_properties.add(new Pair(BaseCmd.Properties.HOST_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.POD_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.STATE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.SYSTEM_VM_TYPE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.FALSE)); +import com.cloud.vm.SystemVm; +import com.cloud.vm.VMInstanceVO; - s_properties.add(new Pair(BaseCmd.Properties.KEYWORD, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PAGE, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.PAGESIZE, Boolean.FALSE)); - } +@Implementation(method="searchForSystemVms") +public class ListSystemVMsCmd extends BaseListCmd { + public static final Logger s_logger = Logger.getLogger(ListSystemVMsCmd.class.getName()); + private static final String s_name = "listsystemvmsresponse"; + ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @@ -118,157 +105,65 @@ public class ListSystemVMsCmd extends BaseCmd { return s_name; } - @Override - public List> getProperties() { - return s_properties; - } - - @Override - public List> execute(Map params) { - Long id = (Long)params.get(BaseCmd.Properties.ID.getName()); - Long zoneId = (Long)params.get(BaseCmd.Properties.ZONE_ID.getName()); - Long podId = (Long)params.get(BaseCmd.Properties.POD_ID.getName()); - Long hostId = (Long)params.get(BaseCmd.Properties.HOST_ID.getName()); - String name = (String)params.get(BaseCmd.Properties.NAME.getName()); - String state = (String)params.get(BaseCmd.Properties.STATE.getName()); - String keyword = (String)params.get(BaseCmd.Properties.KEYWORD.getName()); - String type = (String)params.get(BaseCmd.Properties.SYSTEM_VM_TYPE.getName()); - Integer page = (Integer)params.get(BaseCmd.Properties.PAGE.getName()); - Integer pageSize = (Integer)params.get(BaseCmd.Properties.PAGESIZE.getName()); - - Long startIndex = Long.valueOf(0); - int pageSizeNum = 50; - if (pageSize != null) { - pageSizeNum = pageSize.intValue(); - } - - if (page != null) { - int pageNum = page.intValue(); - if (pageNum > 0) { - startIndex = Long.valueOf(pageSizeNum * (pageNum-1)); - } - } - - Criteria c = new Criteria("id", Boolean.TRUE, startIndex, Long.valueOf(pageSizeNum)); - if (keyword != null) { - c.addCriteria(Criteria.KEYWORD, keyword); - } else { - c.addCriteria(Criteria.ID, id); - c.addCriteria(Criteria.DATACENTERID, zoneId); - c.addCriteria(Criteria.PODID, podId); - c.addCriteria(Criteria.HOSTID, hostId); - c.addCriteria(Criteria.NAME, name); - c.addCriteria(Criteria.STATE, state); - } - - List proxies = null; - List ssVms = null; - Object[] proxyDataArray = null; - - if(type == null) //search for all vm types - { - proxies = getManagementServer().searchForConsoleProxy(c); - ssVms = getManagementServer().searchForSecondaryStorageVm(c); - - proxyDataArray = new Object[proxies.size() + ssVms.size()]; - } - else if((type != null) && (type.equalsIgnoreCase("secondarystoragevm"))) // search for ssvm - { - ssVms = getManagementServer().searchForSecondaryStorageVm(c); - - proxyDataArray = new Object[ssVms.size()]; - } - else if((type != null) && (type.equalsIgnoreCase("consoleproxy"))) // search for consoleproxy - { - proxies = getManagementServer().searchForConsoleProxy(c); - - proxyDataArray = new Object[proxies.size()]; - } - - List> proxiesTags = new ArrayList>(); - int i = 0; + @Override @SuppressWarnings("unchecked") + public String getResponse() { + List systemVMs = (List)getResponseObject(); - if(proxies != null && proxies.size() > 0) - { - for (ConsoleProxyVO proxy : proxies) { - List> proxyData = new ArrayList>(); - proxyData.add(new Pair(BaseCmd.Properties.SYSTEM_VM_TYPE.getName(), "consoleproxy")); - - proxyData.add(new Pair(BaseCmd.Properties.ID.getName(), Long.toString(proxy.getId()))); - - AsyncJobVO asyncJob = getManagementServer().findInstancePendingAsyncJob("console_proxy", proxy.getId()); - if(asyncJob != null) { - proxyData.add(new Pair(BaseCmd.Properties.JOB_ID.getName(), asyncJob.getId().toString())); - proxyData.add(new Pair(BaseCmd.Properties.JOB_STATUS.getName(), String.valueOf(asyncJob.getStatus()))); - } - - proxyData.add(new Pair(BaseCmd.Properties.ZONE_ID.getName(), Long.valueOf(proxy.getDataCenterId()).toString())); - proxyData.add(new Pair(BaseCmd.Properties.ZONE_NAME.getName(), getManagementServer().findDataCenterById(proxy.getDataCenterId()).getName())); - proxyData.add(new Pair(BaseCmd.Properties.DNS1.getName(), proxy.getDns1())); - proxyData.add(new Pair(BaseCmd.Properties.DNS2.getName(), proxy.getDns2())); - proxyData.add(new Pair(BaseCmd.Properties.NETWORK_DOMAIN.getName(), proxy.getDomain())); - proxyData.add(new Pair(BaseCmd.Properties.GATEWAY.getName(), proxy.getGateway())); - proxyData.add(new Pair(BaseCmd.Properties.NAME.getName(), proxy.getName())); - proxyData.add(new Pair(BaseCmd.Properties.POD_ID.getName(), Long.valueOf(proxy.getPodId()).toString())); - if (proxy.getHostId() != null) { - proxyData.add(new Pair(BaseCmd.Properties.HOST_ID.getName(), proxy.getHostId().toString())); - proxyData.add(new Pair(BaseCmd.Properties.HOST_NAME.getName(), getManagementServer().getHostBy(proxy.getHostId()).getName())); - } - proxyData.add(new Pair(BaseCmd.Properties.PRIVATE_IP.getName(), proxy.getPrivateIpAddress())); - proxyData.add(new Pair(BaseCmd.Properties.PRIVATE_MAC_ADDRESS.getName(), proxy.getPrivateMacAddress())); - proxyData.add(new Pair(BaseCmd.Properties.PRIVATE_NETMASK.getName(), proxy.getPrivateNetmask())); - proxyData.add(new Pair(BaseCmd.Properties.PUBLIC_IP.getName(), proxy.getPublicIpAddress())); - proxyData.add(new Pair(BaseCmd.Properties.PUBLIC_MAC_ADDRESS.getName(), proxy.getPublicMacAddress())); - proxyData.add(new Pair(BaseCmd.Properties.PUBLIC_NETMASK.getName(), proxy.getPublicNetmask())); - proxyData.add(new Pair(BaseCmd.Properties.TEMPLATE_ID.getName(), Long.valueOf(proxy.getTemplateId()).toString())); - proxyData.add(new Pair(BaseCmd.Properties.CREATED.getName(), getDateString(proxy.getCreated()))); - proxyData.add(new Pair(BaseCmd.Properties.ACTIVE_VIEWER_SESSIONS.getName(), - String.valueOf(proxy.getActiveSession()))); - - if (proxy.getState() != null) { - proxyData.add(new Pair(BaseCmd.Properties.STATE.getName(), proxy.getState().toString())); - } - - proxyDataArray[i++] = proxyData; - } + List response = new ArrayList(); + for (VMInstanceVO systemVM : systemVMs) { + SystemVmResponse vmResponse = new SystemVmResponse(); + if (systemVM instanceof SystemVm) { + SystemVm vm = (SystemVm)systemVM; + + vmResponse.setId(vm.getId()); + vmResponse.setSystemVmType(vm.getType().toString().toLowerCase()); + + String instanceType = "console_proxy"; + if (systemVM instanceof SecondaryStorageVmVO) { + instanceType = "sec_storage_vm"; // FIXME: this should be a constant so that the async jobs get updated with the correct instance type, they are using + // different instance types at the moment + } + + AsyncJobVO asyncJob = getManagementServer().findInstancePendingAsyncJob(instanceType, vm.getId()); + if (asyncJob != null) { + vmResponse.setJobId(asyncJob.getId()); + vmResponse.setJobStatus(asyncJob.getStatus()); + } + + vmResponse.setZoneId(vm.getDataCenterId()); + vmResponse.setZoneName(getManagementServer().findDataCenterById(vm.getDataCenterId()).getName()); + vmResponse.setDns1(vm.getDns1()); + vmResponse.setDns2(vm.getDns2()); + vmResponse.setNetworkDomain(vm.getDomain()); + vmResponse.setGateway(vm.getGateway()); + vmResponse.setName(vm.getName()); + vmResponse.setPodId(vm.getPodId()); + if (vm.getHostId() != null) { + vmResponse.setHostId(vm.getHostId()); + vmResponse.setHostName(getManagementServer().getHostBy(vm.getHostId()).getName()); + } + vmResponse.setPrivateIp(vm.getPrivateIpAddress()); + vmResponse.setPrivateMacAddress(vm.getPrivateMacAddress()); + vmResponse.setPrivateNetmask(vm.getPrivateNetmask()); + vmResponse.setPublicIp(vm.getPublicIpAddress()); + vmResponse.setPublicMacAddress(vm.getPublicMacAddress()); + vmResponse.setPublicNetmask(vm.getPublicNetmask()); + vmResponse.setTemplateId(vm.getTemplateId()); + vmResponse.setCreated(vm.getCreated()); + if (vm.getState() != null) { + vmResponse.setState(vm.getState().toString()); + } + } + + // for console proxies, add the active sessions + if (systemVM instanceof ConsoleProxyVO) { + ConsoleProxyVO proxy = (ConsoleProxyVO)systemVM; + vmResponse.setActiveViewerSessions(proxy.getActiveSession()); + } + + response.add(vmResponse); } - - if(ssVms != null && ssVms.size() > 0) - { - for (SecondaryStorageVmVO ssVm : ssVms) { - List> ssvmData = new ArrayList>(); - ssvmData.add(new Pair(BaseCmd.Properties.SYSTEM_VM_TYPE.getName(), "secondarystoragevm")); - ssvmData.add(new Pair(BaseCmd.Properties.ID.getName(), ssVm.getId())); - - ssvmData.add(new Pair(BaseCmd.Properties.ZONE_ID.getName(), Long.valueOf(ssVm.getDataCenterId()).toString())); - ssvmData.add(new Pair(BaseCmd.Properties.ZONE_NAME.getName(), getManagementServer().findDataCenterById(ssVm.getDataCenterId()).getName())); - ssvmData.add(new Pair(BaseCmd.Properties.DNS1.getName(), ssVm.getDns1())); - ssvmData.add(new Pair(BaseCmd.Properties.DNS2.getName(), ssVm.getDns2())); - ssvmData.add(new Pair(BaseCmd.Properties.NETWORK_DOMAIN.getName(), ssVm.getDomain())); - ssvmData.add(new Pair(BaseCmd.Properties.GATEWAY.getName(), ssVm.getGateway())); - ssvmData.add(new Pair(BaseCmd.Properties.NAME.getName(), ssVm.getName())); - ssvmData.add(new Pair(BaseCmd.Properties.POD_ID.getName(), Long.valueOf(ssVm.getPodId()).toString())); - if (ssVm.getHostId() != null) { - ssvmData.add(new Pair(BaseCmd.Properties.HOST_ID.getName(), ssVm.getHostId().toString())); - ssvmData.add(new Pair(BaseCmd.Properties.HOST_NAME.getName(), getManagementServer().getHostBy(ssVm.getHostId()).getName())); - } - ssvmData.add(new Pair(BaseCmd.Properties.PRIVATE_IP.getName(), ssVm.getPrivateIpAddress())); - ssvmData.add(new Pair(BaseCmd.Properties.PRIVATE_MAC_ADDRESS.getName(), ssVm.getPrivateMacAddress())); - ssvmData.add(new Pair(BaseCmd.Properties.PRIVATE_NETMASK.getName(), ssVm.getPrivateNetmask())); - ssvmData.add(new Pair(BaseCmd.Properties.PUBLIC_IP.getName(), ssVm.getPublicIpAddress())); - ssvmData.add(new Pair(BaseCmd.Properties.PUBLIC_MAC_ADDRESS.getName(), ssVm.getPublicMacAddress())); - ssvmData.add(new Pair(BaseCmd.Properties.PUBLIC_NETMASK.getName(), ssVm.getPublicNetmask())); - ssvmData.add(new Pair(BaseCmd.Properties.TEMPLATE_ID.getName(), Long.valueOf(ssVm.getTemplateId()).toString())); - ssvmData.add(new Pair(BaseCmd.Properties.CREATED.getName(), getDateString(ssVm.getCreated()))); - - if (ssVm.getState() != null) { - ssvmData.add(new Pair(BaseCmd.Properties.STATE.getName(), ssVm.getState().toString())); - } - - proxyDataArray[i++] = ssvmData; - } - } - proxiesTags.add(new Pair("systemvm", proxyDataArray)); - return proxiesTags; + + return SerializerHelper.toSerializedString(response); } } diff --git a/server/src/com/cloud/api/response/AlertResponse.java b/server/src/com/cloud/api/response/AlertResponse.java index 7f6e6d34fc5..3aff5cec3ce 100644 --- a/server/src/com/cloud/api/response/AlertResponse.java +++ b/server/src/com/cloud/api/response/AlertResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import java.util.Date; diff --git a/server/src/com/cloud/api/response/AsyncJobResponse.java b/server/src/com/cloud/api/response/AsyncJobResponse.java index 5af7fbb5dde..bd9471a5070 100644 --- a/server/src/com/cloud/api/response/AsyncJobResponse.java +++ b/server/src/com/cloud/api/response/AsyncJobResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import java.util.Date; diff --git a/server/src/com/cloud/api/response/CapacityResponse.java b/server/src/com/cloud/api/response/CapacityResponse.java index b29b9548419..6c50b4c0ab8 100644 --- a/server/src/com/cloud/api/response/CapacityResponse.java +++ b/server/src/com/cloud/api/response/CapacityResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import com.cloud.api.ResponseObject; diff --git a/server/src/com/cloud/api/response/ClusterResponse.java b/server/src/com/cloud/api/response/ClusterResponse.java index f51b5bf2c1a..2ae7a9244ed 100644 --- a/server/src/com/cloud/api/response/ClusterResponse.java +++ b/server/src/com/cloud/api/response/ClusterResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import com.cloud.api.ResponseObject; diff --git a/server/src/com/cloud/api/response/ConfigurationResponse.java b/server/src/com/cloud/api/response/ConfigurationResponse.java index 18d9fccada6..0f12e3349a6 100644 --- a/server/src/com/cloud/api/response/ConfigurationResponse.java +++ b/server/src/com/cloud/api/response/ConfigurationResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import com.cloud.api.ResponseObject; diff --git a/server/src/com/cloud/api/response/DiskOfferingResponse.java b/server/src/com/cloud/api/response/DiskOfferingResponse.java index c83ed7ffe61..5945eb47e19 100644 --- a/server/src/com/cloud/api/response/DiskOfferingResponse.java +++ b/server/src/com/cloud/api/response/DiskOfferingResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import java.util.Date; diff --git a/server/src/com/cloud/api/response/DomainResponse.java b/server/src/com/cloud/api/response/DomainResponse.java index dbae9be1473..927b02bfad4 100644 --- a/server/src/com/cloud/api/response/DomainResponse.java +++ b/server/src/com/cloud/api/response/DomainResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import com.cloud.api.ResponseObject; diff --git a/server/src/com/cloud/api/response/DomainRouterResponse.java b/server/src/com/cloud/api/response/DomainRouterResponse.java index 2210c2756cc..23bc79a3458 100644 --- a/server/src/com/cloud/api/response/DomainRouterResponse.java +++ b/server/src/com/cloud/api/response/DomainRouterResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import java.util.Date; diff --git a/server/src/com/cloud/api/response/EventResponse.java b/server/src/com/cloud/api/response/EventResponse.java index 68052858fee..f2030ec8a9e 100644 --- a/server/src/com/cloud/api/response/EventResponse.java +++ b/server/src/com/cloud/api/response/EventResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import java.util.Date; diff --git a/server/src/com/cloud/api/response/FirewallRuleResponse.java b/server/src/com/cloud/api/response/FirewallRuleResponse.java index e906318e108..09afffa6113 100644 --- a/server/src/com/cloud/api/response/FirewallRuleResponse.java +++ b/server/src/com/cloud/api/response/FirewallRuleResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import com.cloud.api.ResponseObject; diff --git a/server/src/com/cloud/api/response/GuestOSCategoryResponse.java b/server/src/com/cloud/api/response/GuestOSCategoryResponse.java index 29f0262ca52..2065ea4c0e8 100644 --- a/server/src/com/cloud/api/response/GuestOSCategoryResponse.java +++ b/server/src/com/cloud/api/response/GuestOSCategoryResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import com.cloud.api.ResponseObject; diff --git a/server/src/com/cloud/api/response/GuestOSResponse.java b/server/src/com/cloud/api/response/GuestOSResponse.java index 7440cec3b20..d8b9603ef44 100644 --- a/server/src/com/cloud/api/response/GuestOSResponse.java +++ b/server/src/com/cloud/api/response/GuestOSResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import com.cloud.api.ResponseObject; diff --git a/server/src/com/cloud/api/response/HostResponse.java b/server/src/com/cloud/api/response/HostResponse.java index 2ee94ad28dc..722f034135c 100644 --- a/server/src/com/cloud/api/response/HostResponse.java +++ b/server/src/com/cloud/api/response/HostResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import java.util.Date; diff --git a/server/src/com/cloud/api/response/IPAddressResponse.java b/server/src/com/cloud/api/response/IPAddressResponse.java index 7d01b004eff..fd447bbbb53 100644 --- a/server/src/com/cloud/api/response/IPAddressResponse.java +++ b/server/src/com/cloud/api/response/IPAddressResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import java.util.Date; diff --git a/server/src/com/cloud/api/response/IngressRuleResponse.java b/server/src/com/cloud/api/response/IngressRuleResponse.java index bbef31651e7..0f74b20e9f4 100644 --- a/server/src/com/cloud/api/response/IngressRuleResponse.java +++ b/server/src/com/cloud/api/response/IngressRuleResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import com.cloud.api.ResponseObject; diff --git a/server/src/com/cloud/api/response/LoadBalancerResponse.java b/server/src/com/cloud/api/response/LoadBalancerResponse.java index f66eb39b897..1db3d39d47c 100644 --- a/server/src/com/cloud/api/response/LoadBalancerResponse.java +++ b/server/src/com/cloud/api/response/LoadBalancerResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import com.cloud.api.ResponseObject; diff --git a/server/src/com/cloud/api/response/NetworkGroupResponse.java b/server/src/com/cloud/api/response/NetworkGroupResponse.java index 10152418c37..fd12715c38c 100644 --- a/server/src/com/cloud/api/response/NetworkGroupResponse.java +++ b/server/src/com/cloud/api/response/NetworkGroupResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import java.util.List; diff --git a/server/src/com/cloud/api/response/PodResponse.java b/server/src/com/cloud/api/response/PodResponse.java index 39ac46c6794..5789b62b554 100644 --- a/server/src/com/cloud/api/response/PodResponse.java +++ b/server/src/com/cloud/api/response/PodResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import com.cloud.api.ResponseObject; diff --git a/server/src/com/cloud/api/response/PortForwardingServiceRuleResponse.java b/server/src/com/cloud/api/response/PortForwardingServiceRuleResponse.java index c9bd7b0e16b..27b383bcbb5 100644 --- a/server/src/com/cloud/api/response/PortForwardingServiceRuleResponse.java +++ b/server/src/com/cloud/api/response/PortForwardingServiceRuleResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import com.cloud.api.ResponseObject; diff --git a/server/src/com/cloud/api/response/PreallocatedLunResponse.java b/server/src/com/cloud/api/response/PreallocatedLunResponse.java index 018c03768cd..7ac641c17be 100644 --- a/server/src/com/cloud/api/response/PreallocatedLunResponse.java +++ b/server/src/com/cloud/api/response/PreallocatedLunResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import java.util.Date; diff --git a/server/src/com/cloud/api/response/ResourceLimitResponse.java b/server/src/com/cloud/api/response/ResourceLimitResponse.java index 07b3b0c97fe..8f5d43bb115 100644 --- a/server/src/com/cloud/api/response/ResourceLimitResponse.java +++ b/server/src/com/cloud/api/response/ResourceLimitResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import com.cloud.api.ResponseObject; diff --git a/server/src/com/cloud/api/response/SecurityGroupResponse.java b/server/src/com/cloud/api/response/SecurityGroupResponse.java index 2b1cfd92cfd..c60e0590943 100644 --- a/server/src/com/cloud/api/response/SecurityGroupResponse.java +++ b/server/src/com/cloud/api/response/SecurityGroupResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import com.cloud.api.ResponseObject; diff --git a/server/src/com/cloud/api/response/ServiceOfferingResponse.java b/server/src/com/cloud/api/response/ServiceOfferingResponse.java index a14cd2fd8cf..465c60dd8ac 100644 --- a/server/src/com/cloud/api/response/ServiceOfferingResponse.java +++ b/server/src/com/cloud/api/response/ServiceOfferingResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import java.util.Date; diff --git a/server/src/com/cloud/api/response/SnapshotPolicyResponse.java b/server/src/com/cloud/api/response/SnapshotPolicyResponse.java index ebb80aa5c63..ddef2b47ec9 100644 --- a/server/src/com/cloud/api/response/SnapshotPolicyResponse.java +++ b/server/src/com/cloud/api/response/SnapshotPolicyResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import com.cloud.api.ResponseObject; diff --git a/server/src/com/cloud/api/response/SnapshotResponse.java b/server/src/com/cloud/api/response/SnapshotResponse.java index d1a9d3daf34..e7ad60525cf 100644 --- a/server/src/com/cloud/api/response/SnapshotResponse.java +++ b/server/src/com/cloud/api/response/SnapshotResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import java.util.Date; diff --git a/server/src/com/cloud/api/response/SnapshotScheduleResponse.java b/server/src/com/cloud/api/response/SnapshotScheduleResponse.java index a1ea9bad927..f1094f27487 100644 --- a/server/src/com/cloud/api/response/SnapshotScheduleResponse.java +++ b/server/src/com/cloud/api/response/SnapshotScheduleResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import java.util.Date; diff --git a/server/src/com/cloud/api/response/StoragePoolResponse.java b/server/src/com/cloud/api/response/StoragePoolResponse.java index d42629ace40..518fdea6ef7 100644 --- a/server/src/com/cloud/api/response/StoragePoolResponse.java +++ b/server/src/com/cloud/api/response/StoragePoolResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import java.util.Date; diff --git a/server/src/com/cloud/api/response/SystemVmResponse.java b/server/src/com/cloud/api/response/SystemVmResponse.java new file mode 100644 index 00000000000..d2bc6befff7 --- /dev/null +++ b/server/src/com/cloud/api/response/SystemVmResponse.java @@ -0,0 +1,289 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +package com.cloud.api.response; + +import java.util.Date; + +import com.cloud.api.ResponseObject; +import com.cloud.serializer.Param; + +public class SystemVmResponse implements ResponseObject { + @Param(name="id") + private Long id; + + @Param(name="systemvmtype") + private String systemVmType; + + @Param(name="jobid") + private Long jobId; + + @Param(name="jobstatus") + private Integer jobStatus; + + @Param(name="zoneid") + private Long zoneId; + + @Param(name="zonename") + private String zoneName; + + @Param(name="dns1") + private String dns1; + + @Param(name="dns2") + private String dns2; + + @Param(name="networkdomain") + private String networkDomain; + + @Param(name="gateway") + private String gateway; + + @Param(name="name") + private String name; + + @Param(name="podid") + private Long podId; + + @Param(name="hostid") + private Long hostId; + + @Param(name="hostname") + private String hostName; + + @Param(name="privateip") + private String privateIp; + + @Param(name="privatemacaddress") + private String privateMacAddress; + + @Param(name="privatenetmask") + private String privateNetmask; + + @Param(name="publicip") + private String publicIp; + + @Param(name="publicmacaddress") + private String publicMacAddress; + + @Param(name="publicnetmask") + private String publicNetmask; + + @Param(name="templateid") + private Long templateId; + + @Param(name="created") + private Date created; + + @Param(name="state") + private String state; + + @Param(name="activeviewersessions") + private Integer activeViewerSessions; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSystemVmType() { + return systemVmType; + } + + public void setSystemVmType(String systemVmType) { + this.systemVmType = systemVmType; + } + + 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; + } + + public Long getZoneId() { + return zoneId; + } + + public void setZoneId(Long zoneId) { + this.zoneId = zoneId; + } + + public String getZoneName() { + return zoneName; + } + + public void setZoneName(String zoneName) { + this.zoneName = zoneName; + } + + public String getDns1() { + return dns1; + } + + public void setDns1(String dns1) { + this.dns1 = dns1; + } + + public String getDns2() { + return dns2; + } + + public void setDns2(String dns2) { + this.dns2 = dns2; + } + + public String getNetworkDomain() { + return networkDomain; + } + + public void setNetworkDomain(String networkDomain) { + this.networkDomain = networkDomain; + } + + public String getGateway() { + return gateway; + } + + public void setGateway(String gateway) { + this.gateway = gateway; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Long getPodId() { + return podId; + } + + public void setPodId(Long podId) { + this.podId = podId; + } + + public Long getHostId() { + return hostId; + } + + public void setHostId(Long hostId) { + this.hostId = hostId; + } + + public String getHostName() { + return hostName; + } + + public void setHostName(String hostName) { + this.hostName = hostName; + } + + public String getPrivateIp() { + return privateIp; + } + + public void setPrivateIp(String privateIp) { + this.privateIp = privateIp; + } + + public String getPrivateMacAddress() { + return privateMacAddress; + } + + public void setPrivateMacAddress(String privateMacAddress) { + this.privateMacAddress = privateMacAddress; + } + + public String getPrivateNetmask() { + return privateNetmask; + } + + public void setPrivateNetmask(String privateNetmask) { + this.privateNetmask = privateNetmask; + } + + public String getPublicIp() { + return publicIp; + } + + public void setPublicIp(String publicIp) { + this.publicIp = publicIp; + } + + public String getPublicMacAddress() { + return publicMacAddress; + } + + public void setPublicMacAddress(String publicMacAddress) { + this.publicMacAddress = publicMacAddress; + } + + public String getPublicNetmask() { + return publicNetmask; + } + + public void setPublicNetmask(String publicNetmask) { + this.publicNetmask = publicNetmask; + } + + public Long getTemplateId() { + return templateId; + } + + public void setTemplateId(Long templateId) { + this.templateId = templateId; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public Integer getActiveViewerSessions() { + return activeViewerSessions; + } + + public void setActiveViewerSessions(Integer activeViewerSessions) { + this.activeViewerSessions = activeViewerSessions; + } +} diff --git a/server/src/com/cloud/api/response/TemplateResponse.java b/server/src/com/cloud/api/response/TemplateResponse.java index f98f6dd4c85..bad36b25a26 100644 --- a/server/src/com/cloud/api/response/TemplateResponse.java +++ b/server/src/com/cloud/api/response/TemplateResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import java.util.Date; diff --git a/server/src/com/cloud/api/response/UpgradeVmResponse.java b/server/src/com/cloud/api/response/UpgradeVmResponse.java index 78ad9c6aa03..196c259ba6c 100644 --- a/server/src/com/cloud/api/response/UpgradeVmResponse.java +++ b/server/src/com/cloud/api/response/UpgradeVmResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import java.util.Date; diff --git a/server/src/com/cloud/api/response/UserResponse.java b/server/src/com/cloud/api/response/UserResponse.java index f359da34e9e..7405c188329 100644 --- a/server/src/com/cloud/api/response/UserResponse.java +++ b/server/src/com/cloud/api/response/UserResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import java.util.Date; diff --git a/server/src/com/cloud/api/response/UserVmResponse.java b/server/src/com/cloud/api/response/UserVmResponse.java index c90cf69f0a5..1d1168f48b8 100644 --- a/server/src/com/cloud/api/response/UserVmResponse.java +++ b/server/src/com/cloud/api/response/UserVmResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import com.cloud.api.ResponseObject; diff --git a/server/src/com/cloud/api/response/VlanIpRangeResponse.java b/server/src/com/cloud/api/response/VlanIpRangeResponse.java index f7f6e5ec3d3..3a87250422b 100644 --- a/server/src/com/cloud/api/response/VlanIpRangeResponse.java +++ b/server/src/com/cloud/api/response/VlanIpRangeResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import com.cloud.api.ResponseObject; diff --git a/server/src/com/cloud/api/response/ZoneResponse.java b/server/src/com/cloud/api/response/ZoneResponse.java index 48d0bb44689..9f6a1a280dd 100644 --- a/server/src/com/cloud/api/response/ZoneResponse.java +++ b/server/src/com/cloud/api/response/ZoneResponse.java @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.response; import com.cloud.api.ResponseObject; diff --git a/server/src/com/cloud/server/ManagementServer.java b/server/src/com/cloud/server/ManagementServer.java index 21f0b177200..bbb38df1792 100644 --- a/server/src/com/cloud/server/ManagementServer.java +++ b/server/src/com/cloud/server/ManagementServer.java @@ -55,6 +55,8 @@ import com.cloud.api.commands.ListPublicIpAddressesCmd; import com.cloud.api.commands.ListRoutersCmd; import com.cloud.api.commands.ListServiceOfferingsCmd; import com.cloud.api.commands.ListSnapshotsCmd; +import com.cloud.api.commands.ListStoragePoolsCmd; +import com.cloud.api.commands.ListSystemVMsCmd; import com.cloud.api.commands.ListTemplatesCmd; import com.cloud.api.commands.LockAccountCmd; import com.cloud.api.commands.LockUserCmd; @@ -1806,6 +1808,13 @@ public interface ManagementServer { StoragePoolVO findPoolById(Long id); List searchForStoragePools(Criteria c); + /** + * List storage pools that match the given criteria + * @param cmd the command that wraps the search criteria (zone, pod, name, IP address, path, and cluster id) + * @return a list of storage pools that match the given criteria + */ + List searchForStoragePools(ListStoragePoolsCmd cmd); + SnapshotPolicyVO findSnapshotPolicyById(Long policyId); /** @@ -1826,6 +1835,13 @@ public interface ManagementServer { List searchForSecondaryStorageVm(Criteria c); /** + * List system VMs by the given search criteria + * @param cmd the command that wraps the search criteria (host, name, state, type, zone, pod, and/or id) + * @return the list of system vms that match the given criteria + */ + List searchForSystemVm(ListSystemVMsCmd cmd); + + /** * Returns back a SHA1 signed response * @param userId -- id for the user * @return -- ArrayList of diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 354695cd4a3..0f0e6c75a28 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -91,6 +91,8 @@ import com.cloud.api.commands.ListPublicIpAddressesCmd; import com.cloud.api.commands.ListRoutersCmd; import com.cloud.api.commands.ListServiceOfferingsCmd; import com.cloud.api.commands.ListSnapshotsCmd; +import com.cloud.api.commands.ListStoragePoolsCmd; +import com.cloud.api.commands.ListSystemVMsCmd; import com.cloud.api.commands.ListTemplatesCmd; import com.cloud.api.commands.LockAccountCmd; import com.cloud.api.commands.LockUserCmd; @@ -7843,20 +7845,20 @@ public class ManagementServerImpl implements ManagementServer { public List listClusterByPodId(long podId) { return _clusterDao.listByPodId(podId); } - -// @Override -// public ClusterVO createCluster(long dcId, long podId, String name) { -// ClusterVO cluster = new ClusterVO(dcId, podId, name); -// try { -// cluster = _clusterDao.persist(cluster); -// } catch (Exception e) { -// cluster = _clusterDao.findBy(name, podId); -// if (cluster == null) { -// throw new CloudRuntimeException("Unable to create cluster " + name + " in pod " + podId + " and data center " + dcId, e); -// } -// } -// return cluster; -// } + + @Override + public List searchForStoragePools(ListStoragePoolsCmd cmd) { + Criteria c = new Criteria("id", Boolean.TRUE, cmd.getStartIndex(), cmd.getPageSizeVal()); + c.addCriteria(Criteria.NAME, cmd.getStoragePoolName()); + c.addCriteria(Criteria.CLUSTERID, cmd.getClusterId()); + c.addCriteria(Criteria.ADDRESS, cmd.getIpAddress()); + c.addCriteria(Criteria.KEYWORD, cmd.getKeyword()); + c.addCriteria(Criteria.PATH, cmd.getPath()); + c.addCriteria(Criteria.PODID, cmd.getPodId()); + c.addCriteria(Criteria.DATACENTERID, cmd.getZoneId()); + + return searchForStoragePools(c); + } @Override public List searchForStoragePools(Criteria c) { @@ -8144,7 +8146,34 @@ public class ManagementServerImpl implements ManagementServer { return _secStorageVmDao.search(sc, searchFilter); } - + + @Override @SuppressWarnings({"unchecked", "rawtypes"}) + public List searchForSystemVm(ListSystemVMsCmd cmd) { + Criteria c = new Criteria("id", Boolean.TRUE, cmd.getStartIndex(), cmd.getPageSizeVal()); + + c.addCriteria(Criteria.KEYWORD, cmd.getKeyword()); + c.addCriteria(Criteria.ID, cmd.getId()); + c.addCriteria(Criteria.DATACENTERID, cmd.getZoneId()); + c.addCriteria(Criteria.PODID, cmd.getPodId()); + c.addCriteria(Criteria.HOSTID, cmd.getHostId()); + c.addCriteria(Criteria.NAME, cmd.getSystemVmName()); + c.addCriteria(Criteria.STATE, cmd.getState()); + + String type = cmd.getSystemVmType(); + List systemVMs = new ArrayList(); + + if (type == null) { //search for all vm types + systemVMs.addAll(searchForConsoleProxy(c)); + systemVMs.addAll(searchForSecondaryStorageVm(c)); + } else if((type != null) && (type.equalsIgnoreCase("secondarystoragevm"))) { // search for ssvm + systemVMs.addAll(searchForSecondaryStorageVm(c)); + } else if((type != null) && (type.equalsIgnoreCase("consoleproxy"))) { // search for consoleproxy + systemVMs.addAll(searchForConsoleProxy(c)); + } + + return (List)systemVMs; + } + @Override public VMInstanceVO findSystemVMById(long instanceId) { VMInstanceVO systemVm = _vmInstanceDao.findByIdTypes(instanceId, VirtualMachine.Type.ConsoleProxy, VirtualMachine.Type.SecondaryStorageVm);