Revert "bug 11791: adding Hypervisor type to list os API"

This reverts commit 78e01c3061795e5d3d80db8a147b5f1c8a836a3c.
This commit is contained in:
root 2011-11-03 14:53:32 +05:30
parent 8ff78668e9
commit 55b5a5c5cd
8 changed files with 4 additions and 216 deletions

View File

@ -27,7 +27,6 @@ import com.cloud.api.ApiConstants;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.BaseCmd.CommandType;
import com.cloud.api.response.GuestOSResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.storage.GuestOS;
@ -48,8 +47,6 @@ public class ListGuestOsCmd extends BaseListCmd {
@Parameter(name=ApiConstants.OS_CATEGORY_ID, type=CommandType.LONG, description="list by Os Category id")
private Long osCategoryId;
@Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="the hypervisor for which to restrict the search")
private String hypervisor;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -63,9 +60,7 @@ public class ListGuestOsCmd extends BaseListCmd {
return osCategoryId;
}
public String getHypervisor() {
return hypervisor;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -77,14 +72,7 @@ public class ListGuestOsCmd extends BaseListCmd {
@Override
public void execute(){
List<? extends GuestOS> result = null;
if (getHypervisor() == null){
result = _mgr.listGuestOSByCriteria(this);
}
else {
result = _mgr.listGuestOSByHypervisor(this);
}
List<? extends GuestOS> result = _mgr.listGuestOSByCriteria(this);
ListResponse<GuestOSResponse> response = new ListResponse<GuestOSResponse>();
List<GuestOSResponse> osResponses = new ArrayList<GuestOSResponse>();
for (GuestOS guestOS : result) {

View File

@ -221,7 +221,6 @@ public interface ManagementService {
* @return list of GuestOS
*/
List<? extends GuestOS> listGuestOSByCriteria(ListGuestOsCmd cmd);
List<? extends GuestOS> listGuestOSByHypervisor(ListGuestOsCmd listGuestOsCmd);
/**
* Obtains a list of all guest OS categories.
@ -490,5 +489,5 @@ public interface ManagementService {
String[] listEventTypes();
}

View File

@ -1,91 +0,0 @@
/**
* Copyright (C) 2011 Citrix.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.storage;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
@Entity
@Table(name="guest_os_hypervisor")
public class GuestOSHypervisorVO implements GuestOS {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
long id;
@Column(name="hypervisor_type", updatable = true, nullable=false)
@Enumerated(value=EnumType.STRING)
HypervisorType hypervisorType;
@Column(name="guest_os_name")
String guest_os_name;
@Column(name="guest_os_id")
long guest_os_id;
public long getId() {
return id;
}
public HypervisorType getHypervisorType() {
return hypervisorType;
}
public void setHypervisorType(HypervisorType hypervisor_type) {
this.hypervisorType = hypervisor_type;
}
public String getGuestOsName() {
return guest_os_name;
}
public void setGuestOsName(String name) {
this.guest_os_name = name;
}
public long getGuestOsId() {
return guest_os_id;
}
public void setGuestOsId(long guest_os_id) {
this.guest_os_id = guest_os_id;
}
@Override
public long getCategoryId() {
return 0;
}
@Override
public String getDisplayName() {
return guest_os_name;
}
@Override
public String getName() {
return guest_os_name;
}
}

View File

@ -115,7 +115,6 @@ import com.cloud.storage.StorageManagerImpl;
import com.cloud.storage.dao.DiskOfferingDaoImpl;
import com.cloud.storage.dao.GuestOSCategoryDaoImpl;
import com.cloud.storage.dao.GuestOSDaoImpl;
import com.cloud.storage.dao.GuestOSHypervisorDaoImpl;
import com.cloud.storage.dao.LaunchPermissionDaoImpl;
import com.cloud.storage.dao.SnapshotDaoImpl;
import com.cloud.storage.dao.SnapshotPolicyDaoImpl;
@ -235,7 +234,6 @@ public class DefaultComponentLibrary extends ComponentLibraryBase implements Com
addDao("SyncQueueDao", SyncQueueDaoImpl.class);
addDao("SyncQueueItemDao", SyncQueueItemDaoImpl.class);
addDao("GuestOSDao", GuestOSDaoImpl.class);
addDao("GuestOSHypervisorDao", GuestOSHypervisorDaoImpl.class);
addDao("GuestOSCategoryDao", GuestOSCategoryDaoImpl.class);
addDao("StoragePoolDao", StoragePoolDaoImpl.class);
addDao("StoragePoolHostDao", StoragePoolHostDaoImpl.class);

View File

@ -21,7 +21,6 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import com.cloud.api.commands.ListGuestOsCmd;
import com.cloud.async.AsyncJobResult;
import com.cloud.async.AsyncJobVO;
import com.cloud.configuration.ResourceLimitVO;
@ -40,7 +39,6 @@ import com.cloud.network.IPAddressVO;
import com.cloud.network.security.SecurityGroupVO;
import com.cloud.service.ServiceOfferingVO;
import com.cloud.storage.DiskOfferingVO;
import com.cloud.storage.GuestOSHypervisorVO;
import com.cloud.storage.GuestOSVO;
import com.cloud.storage.StoragePoolVO;
import com.cloud.storage.VMTemplateVO;
@ -572,6 +570,4 @@ public interface ManagementServer extends ManagementService {
boolean checkIfMaintenable(long hostId);
String getHashKey();
List<GuestOSHypervisorVO> listGuestOSByHypervisor(ListGuestOsCmd cmd);
}

View File

@ -186,7 +186,6 @@ import com.cloud.service.ServiceOfferingVO;
import com.cloud.service.dao.ServiceOfferingDao;
import com.cloud.storage.DiskOfferingVO;
import com.cloud.storage.GuestOSCategoryVO;
import com.cloud.storage.GuestOSHypervisorVO;
import com.cloud.storage.GuestOSVO;
import com.cloud.storage.LaunchPermissionVO;
import com.cloud.storage.Storage;
@ -205,7 +204,6 @@ import com.cloud.storage.VolumeVO;
import com.cloud.storage.dao.DiskOfferingDao;
import com.cloud.storage.dao.GuestOSCategoryDao;
import com.cloud.storage.dao.GuestOSDao;
import com.cloud.storage.dao.GuestOSHypervisorDao;
import com.cloud.storage.dao.LaunchPermissionDao;
import com.cloud.storage.dao.StoragePoolDao;
import com.cloud.storage.dao.StoragePoolHostDao;
@ -308,7 +306,6 @@ public class ManagementServerImpl implements ManagementServer {
private final AlertDao _alertDao;
private final CapacityDao _capacityDao;
private final GuestOSDao _guestOSDao;
private final GuestOSHypervisorDao _guestOSHypervisorDao;
private final GuestOSCategoryDao _guestOSCategoryDao;
private final StoragePoolDao _poolDao;
private final StoragePoolHostDao _poolHostDao;
@ -386,7 +383,6 @@ public class ManagementServerImpl implements ManagementServer {
_alertDao = locator.getDao(AlertDao.class);
_capacityDao = locator.getDao(CapacityDao.class);
_guestOSDao = locator.getDao(GuestOSDao.class);
_guestOSHypervisorDao = locator.getDao(GuestOSHypervisorDao.class);
_guestOSCategoryDao = locator.getDao(GuestOSCategoryDao.class);
_poolDao = locator.getDao(StoragePoolDao.class);
_poolHostDao = locator.getDao(StoragePoolHostDao.class);
@ -2750,19 +2746,7 @@ public class ManagementServerImpl implements ManagementServer {
return _guestOSDao.search(sc, searchFilter);
}
@Override
public List<GuestOSHypervisorVO> listGuestOSByHypervisor(ListGuestOsCmd cmd) {
String hypervisor = cmd.getHypervisor();
HypervisorType ht = HypervisorType.getType(hypervisor);
if (ht == HypervisorType.None){
throw new InvalidParameterValueException("The Hypervisor type is not recognized " + hypervisor);
}
return _guestOSHypervisorDao.findByHypervisorType(ht);
}
@Override
public List<GuestOSCategoryVO> listGuestOSCategoriesByCriteria(ListGuestOsCategoriesCmd cmd) {
Filter searchFilter = new Filter(GuestOSCategoryVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());

View File

@ -1,33 +0,0 @@
/**
* Copyright (C) 2011 Citrix.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.storage.dao;
import java.util.List;
import com.cloud.host.HostVO;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.storage.GuestOSHypervisorVO;
import com.cloud.utils.db.GenericDao;
public interface GuestOSHypervisorDao extends GenericDao<GuestOSHypervisorVO, Long> {
public List<GuestOSHypervisorVO> findByHypervisorType(HypervisorType hypervisorType);
}

View File

@ -1,53 +0,0 @@
/**
* Copyright (C) 2011 Citrix.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.storage.dao;
import java.util.List;
import javax.ejb.Local;
import com.cloud.host.HostVO;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.storage.GuestOSHypervisorVO;
import com.cloud.storage.VMTemplateHostVO;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
@Local (value={GuestOSHypervisorDao.class})
public class GuestOSHypervisorDaoImpl extends GenericDaoBase<GuestOSHypervisorVO, Long> implements GuestOSHypervisorDao {
protected final SearchBuilder<GuestOSHypervisorVO> hypervisor_search;
protected GuestOSHypervisorDaoImpl() {
hypervisor_search = createSearchBuilder();
hypervisor_search.and("hypervisor_type", hypervisor_search.entity().getHypervisorType(), SearchCriteria.Op.EQ);
hypervisor_search.done();
}
@Override
public List<GuestOSHypervisorVO> findByHypervisorType(HypervisorType hypervisorType) {
SearchCriteria<GuestOSHypervisorVO> sc = hypervisor_search.create();
sc.setParameters("hypervisor_type", hypervisorType);
return listBy(sc);
}
}