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.

This commit is contained in:
Kris McQueen 2010-09-08 11:59:16 -07:00
parent 5170c215f8
commit 5204349fef
42 changed files with 1077 additions and 351 deletions

View File

@ -15,30 +15,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
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();
}

View File

@ -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 {
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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();
}

View File

@ -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<Pair<Enum, Boolean>> getProperties() {
return s_properties;
public String getResponse() {
}
@Override

View File

@ -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<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
static {
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.CLUSTER_ID, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.IP_ADDRESS, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PATH, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.POD_ID, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.KEYWORD, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PAGE, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PAGESIZE, Boolean.FALSE));
}
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -114,107 +97,54 @@ public class ListStoragePoolsCmd extends BaseCmd{
return s_name;
}
@Override
public List<Pair<Enum, Boolean>> getProperties() {
return s_properties;
}
@Override
public List<Pair<String, Object>> execute(Map<String, Object> 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<? extends StoragePoolVO> 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<Pair<String, Object>> poolTags = new ArrayList<Pair<String, Object>>();
Object[] sTag = new Object[pools.size()];
int i = 0;
for (StoragePoolVO pool : pools) {
StoragePoolVO netfsPool = pool;
List<Pair<String, Object>> poolData = new ArrayList<Pair<String, Object>>();
poolData.add(new Pair<String, Object>(BaseCmd.Properties.ID.getName(), Long.toString(pool.getId())));
poolData.add(new Pair<String, Object>(BaseCmd.Properties.NAME.getName(), pool.getName()));
if (pool.getPoolType() != null) {
poolData.add(new Pair<String, Object>(BaseCmd.Properties.TYPE.getName(), pool.getPoolType().toString()));
}
poolData.add(new Pair<String, Object>(BaseCmd.Properties.IP_ADDRESS.getName(), netfsPool.getHostAddress()));
poolData.add(new Pair<String, Object>(BaseCmd.Properties.ZONE_ID.getName(), Long.valueOf(pool.getDataCenterId()).toString()));
poolData.add(new Pair<String, Object>(BaseCmd.Properties.ZONE_NAME.getName(), getManagementServer().getDataCenterBy(pool.getDataCenterId()).getName()));
if (pool.getPodId() != null) {
poolData.add(new Pair<String, Object>(BaseCmd.Properties.POD_ID.getName(), Long.valueOf(pool.getPodId()).toString()));
poolData.add(new Pair<String, Object>(BaseCmd.Properties.POD_NAME.getName(), getManagementServer().getPodBy(pool.getPodId()).getName()));
}
poolData.add(new Pair<String, Object>(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<String, Object>(BaseCmd.Properties.DISK_SIZE_TOTAL.getName(), Long.valueOf(pool.getCapacityBytes()).toString()));
poolData.add(new Pair<String, Object>(BaseCmd.Properties.DISK_SIZE_ALLOCATED.getName(), Long.valueOf(used).toString()));
if (pool.getCreated() != null) {
poolData.add(new Pair<String, Object>(BaseCmd.Properties.CREATED.getName(), getDateString(pool.getCreated())));
@Override @SuppressWarnings("unchecked")
public String getResponse() {
List<? extends StoragePoolVO> pools = (List<? extends StoragePoolVO>)getResponseObject();
List<StoragePoolResponse> response = new ArrayList<StoragePoolResponse>();
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<String, Object>(BaseCmd.Properties.CLUSTER_ID.getName(), cluster.getId()));
poolData.add(new Pair<String, Object>(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<String, Object>(BaseCmd.Properties.TAGS.getName(), getManagementServer().getStoragePoolTags(pool.getId())));
sTag[i++] = poolData;
volDao.getCountAndTotalByPool(pool.getId());
}
Pair<String, Object> poolTag = new Pair<String, Object>("storagepool", sTag);
poolTags.add(poolTag);
return poolTags;
poolResponse.setTags(getManagementServer().getStoragePoolTags(pool.getId()));
response.add(poolResponse);
}
return SerializerHelper.toSerializedString(response);
}
}

View File

@ -15,43 +15,30 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
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<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
static {
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.HOST_ID, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.POD_ID, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.STATE, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.SYSTEM_VM_TYPE, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ZONE_ID, Boolean.FALSE));
import com.cloud.vm.SystemVm;
import com.cloud.vm.VMInstanceVO;
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.KEYWORD, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.PAGE, Boolean.FALSE));
s_properties.add(new Pair<Enum, Boolean>(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<Pair<Enum, Boolean>> getProperties() {
return s_properties;
}
@Override
public List<Pair<String, Object>> execute(Map<String, Object> 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<ConsoleProxyVO> proxies = null;
List<SecondaryStorageVmVO> 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<Pair<String, Object>> proxiesTags = new ArrayList<Pair<String, Object>>();
int i = 0;
@Override @SuppressWarnings("unchecked")
public String getResponse() {
List<? extends VMInstanceVO> systemVMs = (List<? extends VMInstanceVO>)getResponseObject();
if(proxies != null && proxies.size() > 0)
{
for (ConsoleProxyVO proxy : proxies) {
List<Pair<String, Object>> proxyData = new ArrayList<Pair<String, Object>>();
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.SYSTEM_VM_TYPE.getName(), "consoleproxy"));
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.ID.getName(), Long.toString(proxy.getId())));
AsyncJobVO asyncJob = getManagementServer().findInstancePendingAsyncJob("console_proxy", proxy.getId());
if(asyncJob != null) {
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.JOB_ID.getName(), asyncJob.getId().toString()));
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.JOB_STATUS.getName(), String.valueOf(asyncJob.getStatus())));
}
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.ZONE_ID.getName(), Long.valueOf(proxy.getDataCenterId()).toString()));
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.ZONE_NAME.getName(), getManagementServer().findDataCenterById(proxy.getDataCenterId()).getName()));
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.DNS1.getName(), proxy.getDns1()));
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.DNS2.getName(), proxy.getDns2()));
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.NETWORK_DOMAIN.getName(), proxy.getDomain()));
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.GATEWAY.getName(), proxy.getGateway()));
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.NAME.getName(), proxy.getName()));
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.POD_ID.getName(), Long.valueOf(proxy.getPodId()).toString()));
if (proxy.getHostId() != null) {
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.HOST_ID.getName(), proxy.getHostId().toString()));
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.HOST_NAME.getName(), getManagementServer().getHostBy(proxy.getHostId()).getName()));
}
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.PRIVATE_IP.getName(), proxy.getPrivateIpAddress()));
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.PRIVATE_MAC_ADDRESS.getName(), proxy.getPrivateMacAddress()));
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.PRIVATE_NETMASK.getName(), proxy.getPrivateNetmask()));
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.PUBLIC_IP.getName(), proxy.getPublicIpAddress()));
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.PUBLIC_MAC_ADDRESS.getName(), proxy.getPublicMacAddress()));
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.PUBLIC_NETMASK.getName(), proxy.getPublicNetmask()));
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.TEMPLATE_ID.getName(), Long.valueOf(proxy.getTemplateId()).toString()));
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.CREATED.getName(), getDateString(proxy.getCreated())));
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.ACTIVE_VIEWER_SESSIONS.getName(),
String.valueOf(proxy.getActiveSession())));
if (proxy.getState() != null) {
proxyData.add(new Pair<String, Object>(BaseCmd.Properties.STATE.getName(), proxy.getState().toString()));
}
proxyDataArray[i++] = proxyData;
}
List<SystemVmResponse> response = new ArrayList<SystemVmResponse>();
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<Pair<String, Object>> ssvmData = new ArrayList<Pair<String, Object>>();
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.SYSTEM_VM_TYPE.getName(), "secondarystoragevm"));
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.ID.getName(), ssVm.getId()));
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.ZONE_ID.getName(), Long.valueOf(ssVm.getDataCenterId()).toString()));
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.ZONE_NAME.getName(), getManagementServer().findDataCenterById(ssVm.getDataCenterId()).getName()));
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.DNS1.getName(), ssVm.getDns1()));
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.DNS2.getName(), ssVm.getDns2()));
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.NETWORK_DOMAIN.getName(), ssVm.getDomain()));
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.GATEWAY.getName(), ssVm.getGateway()));
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.NAME.getName(), ssVm.getName()));
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.POD_ID.getName(), Long.valueOf(ssVm.getPodId()).toString()));
if (ssVm.getHostId() != null) {
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.HOST_ID.getName(), ssVm.getHostId().toString()));
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.HOST_NAME.getName(), getManagementServer().getHostBy(ssVm.getHostId()).getName()));
}
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.PRIVATE_IP.getName(), ssVm.getPrivateIpAddress()));
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.PRIVATE_MAC_ADDRESS.getName(), ssVm.getPrivateMacAddress()));
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.PRIVATE_NETMASK.getName(), ssVm.getPrivateNetmask()));
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.PUBLIC_IP.getName(), ssVm.getPublicIpAddress()));
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.PUBLIC_MAC_ADDRESS.getName(), ssVm.getPublicMacAddress()));
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.PUBLIC_NETMASK.getName(), ssVm.getPublicNetmask()));
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.TEMPLATE_ID.getName(), Long.valueOf(ssVm.getTemplateId()).toString()));
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.CREATED.getName(), getDateString(ssVm.getCreated())));
if (ssVm.getState() != null) {
ssvmData.add(new Pair<String, Object>(BaseCmd.Properties.STATE.getName(), ssVm.getState().toString()));
}
proxyDataArray[i++] = ssvmData;
}
}
proxiesTags.add(new Pair<String, Object>("systemvm", proxyDataArray));
return proxiesTags;
return SerializerHelper.toSerializedString(response);
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import java.util.Date;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import java.util.Date;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import com.cloud.api.ResponseObject;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import com.cloud.api.ResponseObject;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import com.cloud.api.ResponseObject;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import java.util.Date;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import com.cloud.api.ResponseObject;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import java.util.Date;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import java.util.Date;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import com.cloud.api.ResponseObject;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import com.cloud.api.ResponseObject;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import com.cloud.api.ResponseObject;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import java.util.Date;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import java.util.Date;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import com.cloud.api.ResponseObject;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import com.cloud.api.ResponseObject;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import java.util.List;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import com.cloud.api.ResponseObject;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import com.cloud.api.ResponseObject;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import java.util.Date;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import com.cloud.api.ResponseObject;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import com.cloud.api.ResponseObject;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import java.util.Date;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import com.cloud.api.ResponseObject;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import java.util.Date;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import java.util.Date;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import java.util.Date;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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;
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import java.util.Date;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import java.util.Date;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import java.util.Date;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import com.cloud.api.ResponseObject;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import com.cloud.api.ResponseObject;

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import com.cloud.api.ResponseObject;

View File

@ -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<? extends StoragePoolVO> 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<? extends StoragePoolVO> searchForStoragePools(ListStoragePoolsCmd cmd);
SnapshotPolicyVO findSnapshotPolicyById(Long policyId);
/**
@ -1826,6 +1835,13 @@ public interface ManagementServer {
List<SecondaryStorageVmVO> 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<? extends VMInstanceVO> searchForSystemVm(ListSystemVMsCmd cmd);
/**
* Returns back a SHA1 signed response
* @param userId -- id for the user
* @return -- ArrayList of <CloudId+Signature>

View File

@ -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<ClusterVO> 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<? extends StoragePoolVO> 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<? extends StoragePoolVO> searchForStoragePools(Criteria c) {
@ -8144,7 +8146,34 @@ public class ManagementServerImpl implements ManagementServer {
return _secStorageVmDao.search(sc, searchFilter);
}
@Override @SuppressWarnings({"unchecked", "rawtypes"})
public List<? extends VMInstanceVO> 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<? extends VMInstanceVO>)systemVMs;
}
@Override
public VMInstanceVO findSystemVMById(long instanceId) {
VMInstanceVO systemVm = _vmInstanceDao.findByIdTypes(instanceId, VirtualMachine.Type.ConsoleProxy, VirtualMachine.Type.SecondaryStorageVm);