mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-15 18:12:35 +01:00
renamed dao methods to correctly reflect what they do
This commit is contained in:
parent
dc4c4549d0
commit
76e5cf3321
@ -128,7 +128,7 @@ public class HighAvailabilityDaoImpl extends GenericDaoBase<WorkVO, Long> implem
|
|||||||
final SearchCriteria<WorkVO> sc = CleanupSearch.create();
|
final SearchCriteria<WorkVO> sc = CleanupSearch.create();
|
||||||
sc.setParameters("time", time);
|
sc.setParameters("time", time);
|
||||||
sc.setParameters("step", HighAvailabilityManager.Step.Done, HighAvailabilityManager.Step.Cancelled);
|
sc.setParameters("step", HighAvailabilityManager.Step.Done, HighAvailabilityManager.Step.Cancelled);
|
||||||
delete(sc);
|
expunge(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -161,7 +161,7 @@ public class HighAvailabilityDaoImpl extends GenericDaoBase<WorkVO, Long> implem
|
|||||||
SearchCriteria<WorkVO> sc = PreviousWorkSearch.create();
|
SearchCriteria<WorkVO> sc = PreviousWorkSearch.create();
|
||||||
sc.setParameters("instance", instanceId);
|
sc.setParameters("instance", instanceId);
|
||||||
sc.setParameters("type", type);
|
sc.setParameters("type", type);
|
||||||
return delete(sc) > 0;
|
return expunge(sc) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -73,7 +73,7 @@ public class DetailsDaoImpl extends GenericDaoBase<DetailVO, Long> implements De
|
|||||||
txn.start();
|
txn.start();
|
||||||
SearchCriteria<DetailVO> sc = HostSearch.create();
|
SearchCriteria<DetailVO> sc = HostSearch.create();
|
||||||
sc.setParameters("hostId", hostId);
|
sc.setParameters("hostId", hostId);
|
||||||
delete(sc);
|
expunge(sc);
|
||||||
|
|
||||||
for (Map.Entry<String, String> detail : details.entrySet()) {
|
for (Map.Entry<String, String> detail : details.entrySet()) {
|
||||||
DetailVO vo = new DetailVO(hostId, detail.getKey(), detail.getValue());
|
DetailVO vo = new DetailVO(hostId, detail.getKey(), detail.getValue());
|
||||||
|
|||||||
@ -206,7 +206,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||||||
sc.setParameters("status", (Object[])statuses);
|
sc.setParameters("status", (Object[])statuses);
|
||||||
sc.setParameters("pod", podId);
|
sc.setParameters("pod", podId);
|
||||||
|
|
||||||
List<Long> rs = searchAll(sc, null);
|
List<Long> rs = searchIncludingRemoved(sc, null);
|
||||||
if (rs.size() == 0) {
|
if (rs.size() == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,7 +60,7 @@ public class StackMaidDaoImpl extends GenericDaoBase<StackMaidVO, Long> implemen
|
|||||||
Filter filter = new Filter(StackMaidVO.class, "seq", false, 0L, (long)1);
|
Filter filter = new Filter(StackMaidVO.class, "seq", false, 0L, (long)1);
|
||||||
List<StackMaidVO> l = listBy(sc, filter);
|
List<StackMaidVO> l = listBy(sc, filter);
|
||||||
if(l != null && l.size() > 0) {
|
if(l != null && l.size() > 0) {
|
||||||
delete(l.get(0).getId());
|
expunge(l.get(0).getId());
|
||||||
return l.get(0);
|
return l.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ public class StackMaidDaoImpl extends GenericDaoBase<StackMaidVO, Long> implemen
|
|||||||
SearchCriteria<StackMaidVO> sc = clearSearch.create();
|
SearchCriteria<StackMaidVO> sc = clearSearch.create();
|
||||||
sc.setParameters("msid", msid);
|
sc.setParameters("msid", msid);
|
||||||
|
|
||||||
delete(sc);
|
expunge(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DB
|
@DB
|
||||||
|
|||||||
@ -34,7 +34,7 @@ public class LoadBalancerVMMapDaoImpl extends GenericDaoBase<LoadBalancerVMMapVO
|
|||||||
SearchCriteria<LoadBalancerVMMapVO> sc = createSearchCriteria();
|
SearchCriteria<LoadBalancerVMMapVO> sc = createSearchCriteria();
|
||||||
sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
|
sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
|
||||||
|
|
||||||
delete(sc);
|
expunge(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -46,7 +46,7 @@ public class LoadBalancerVMMapDaoImpl extends GenericDaoBase<LoadBalancerVMMapVO
|
|||||||
sc.addAnd("pending", SearchCriteria.Op.EQ, pending);
|
sc.addAnd("pending", SearchCriteria.Op.EQ, pending);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(sc);
|
expunge(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -46,6 +46,6 @@ public class NetworkRuleConfigDaoImpl extends GenericDaoBase<NetworkRuleConfigVO
|
|||||||
public void deleteBySecurityGroup(long securityGroupId) {
|
public void deleteBySecurityGroup(long securityGroupId) {
|
||||||
SearchCriteria<NetworkRuleConfigVO> sc = SecurityGroupIdSearch.create();
|
SearchCriteria<NetworkRuleConfigVO> sc = SecurityGroupIdSearch.create();
|
||||||
sc.setParameters("securityGroupId", securityGroupId);
|
sc.setParameters("securityGroupId", securityGroupId);
|
||||||
delete(sc);
|
expunge(sc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,7 +79,7 @@ public class IngressRuleDaoImpl extends GenericDaoBase<IngressRuleVO, Long> impl
|
|||||||
public int deleteByNetworkGroup(long networkGroupId) {
|
public int deleteByNetworkGroup(long networkGroupId) {
|
||||||
SearchCriteria<IngressRuleVO> sc = networkGroupIdSearch.create();
|
SearchCriteria<IngressRuleVO> sc = networkGroupIdSearch.create();
|
||||||
sc.setParameters("networkGroupId", networkGroupId);
|
sc.setParameters("networkGroupId", networkGroupId);
|
||||||
return delete(sc);
|
return expunge(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -135,7 +135,7 @@ public class IngressRuleDaoImpl extends GenericDaoBase<IngressRuleVO, Long> impl
|
|||||||
sc.setParameters("endPort", endPort);
|
sc.setParameters("endPort", endPort);
|
||||||
sc.setParameters("allowedNetworkId", allowedGroupId);
|
sc.setParameters("allowedNetworkId", allowedGroupId);
|
||||||
|
|
||||||
return delete(sc);
|
return expunge(sc);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ public class IngressRuleDaoImpl extends GenericDaoBase<IngressRuleVO, Long> impl
|
|||||||
sc.setParameters("endPort", endPort);
|
sc.setParameters("endPort", endPort);
|
||||||
sc.setParameters("cidr", cidr);
|
sc.setParameters("cidr", cidr);
|
||||||
|
|
||||||
return delete(sc);
|
return expunge(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -36,7 +36,7 @@ public class NetworkGroupRulesDaoImpl extends GenericDaoBase<NetworkGroupRulesVO
|
|||||||
@Override
|
@Override
|
||||||
public List<NetworkGroupRulesVO> listNetworkGroupRules() {
|
public List<NetworkGroupRulesVO> listNetworkGroupRules() {
|
||||||
Filter searchFilter = new Filter(NetworkGroupRulesVO.class, "id", true, null, null);
|
Filter searchFilter = new Filter(NetworkGroupRulesVO.class, "id", true, null, null);
|
||||||
return listAllActive(searchFilter);
|
return listAll(searchFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -107,7 +107,7 @@ public class NetworkGroupVMMapDaoImpl extends GenericDaoBase<NetworkGroupVMMapVO
|
|||||||
public int deleteVM(long instanceId) {
|
public int deleteVM(long instanceId) {
|
||||||
SearchCriteria<NetworkGroupVMMapVO> sc = ListByVmId.create();
|
SearchCriteria<NetworkGroupVMMapVO> sc = ListByVmId.create();
|
||||||
sc.setParameters("instanceId", instanceId);
|
sc.setParameters("instanceId", instanceId);
|
||||||
return super.delete(sc);
|
return super.expunge(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -122,7 +122,7 @@ public class NetworkGroupVMMapDaoImpl extends GenericDaoBase<NetworkGroupVMMapVO
|
|||||||
public List<Long> listVmIdsByNetworkGroup(long networkGroupId) {
|
public List<Long> listVmIdsByNetworkGroup(long networkGroupId) {
|
||||||
SearchCriteria<Long> sc = ListVmIdByNetworkGroup.create();
|
SearchCriteria<Long> sc = ListVmIdByNetworkGroup.create();
|
||||||
sc.setParameters("networkGroupId", networkGroupId);
|
sc.setParameters("networkGroupId", networkGroupId);
|
||||||
return searchAll(sc, null);
|
return searchIncludingRemoved(sc, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -187,7 +187,7 @@ public class NetworkGroupWorkDaoImpl extends GenericDaoBase<NetworkGroupWorkVO,
|
|||||||
sc.setParameters("taken", timeBefore);
|
sc.setParameters("taken", timeBefore);
|
||||||
sc.setParameters("step", Step.Done);
|
sc.setParameters("step", Step.Done);
|
||||||
|
|
||||||
return delete(sc);
|
return expunge(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -49,7 +49,7 @@ public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Lo
|
|||||||
public ServiceOfferingVO findByName(String name) {
|
public ServiceOfferingVO findByName(String name) {
|
||||||
SearchCriteria<ServiceOfferingVO> sc = UniqueNameSearch.create();
|
SearchCriteria<ServiceOfferingVO> sc = UniqueNameSearch.create();
|
||||||
sc.setParameters("name", name);
|
sc.setParameters("name", name);
|
||||||
List<ServiceOfferingVO> vos = searchAll(sc, null, null, false);
|
List<ServiceOfferingVO> vos = searchIncludingRemoved(sc, null, null, false);
|
||||||
if (vos.size() == 0) {
|
if (vos.size() == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,15 +69,15 @@ public class DiskOfferingDaoImpl extends GenericDaoBase<DiskOfferingVO, Long> im
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DiskOfferingVO> searchAll(SearchCriteria<DiskOfferingVO> sc, final Filter filter, final Boolean lock, final boolean cache) {
|
public List<DiskOfferingVO> searchIncludingRemoved(SearchCriteria<DiskOfferingVO> sc, final Filter filter, final Boolean lock, final boolean cache) {
|
||||||
sc.addAnd(_typeAttr, Op.EQ, Type.Disk);
|
sc.addAnd(_typeAttr, Op.EQ, Type.Disk);
|
||||||
return super.searchAll(sc, filter, lock, cache);
|
return super.searchIncludingRemoved(sc, filter, lock, cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <K> List<K> searchAll(SearchCriteria<K> sc, final Filter filter) {
|
public <K> List<K> searchIncludingRemoved(SearchCriteria<K> sc, final Filter filter) {
|
||||||
sc.addAnd(_typeAttr, Op.EQ, Type.Disk);
|
sc.addAnd(_typeAttr, Op.EQ, Type.Disk);
|
||||||
return super.searchAll(sc, filter);
|
return super.searchIncludingRemoved(sc, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -92,7 +92,7 @@ public class LaunchPermissionDaoImpl extends GenericDaoBase<LaunchPermissionVO,
|
|||||||
public void removeAllPermissions(long templateId) {
|
public void removeAllPermissions(long templateId) {
|
||||||
SearchCriteria<LaunchPermissionVO> sc = TemplateIdSearch.create();
|
SearchCriteria<LaunchPermissionVO> sc = TemplateIdSearch.create();
|
||||||
sc.setParameters("templateId", templateId);
|
sc.setParameters("templateId", templateId);
|
||||||
delete(sc);
|
expunge(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -76,7 +76,7 @@ public class SnapshotDaoImpl extends GenericDaoBase<SnapshotVO, Long> implements
|
|||||||
SearchCriteria<Long> sc = lastSnapSearch.create();
|
SearchCriteria<Long> sc = lastSnapSearch.create();
|
||||||
sc.setParameters("volumeId", volumeId);
|
sc.setParameters("volumeId", volumeId);
|
||||||
sc.setParameters("snapId", snapId);
|
sc.setParameters("snapId", snapId);
|
||||||
List<Long> prevSnapshots = searchAll(sc, null);
|
List<Long> prevSnapshots = searchIncludingRemoved(sc, null);
|
||||||
if(prevSnapshots != null && prevSnapshots.size() > 0 && prevSnapshots.get(0) != null) {
|
if(prevSnapshots != null && prevSnapshots.size() > 0 && prevSnapshots.get(0) != null) {
|
||||||
return prevSnapshots.get(0);
|
return prevSnapshots.get(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,7 @@ public class SnapshotPolicyRefDaoImpl extends GenericDaoBase<SnapshotPolicyRefVO
|
|||||||
SearchCriteria<SnapshotPolicyRefVO> sc = snapPolicy.create();
|
SearchCriteria<SnapshotPolicyRefVO> sc = snapPolicy.create();
|
||||||
sc.setParameters("snapshotId", snapshotId);
|
sc.setParameters("snapshotId", snapshotId);
|
||||||
sc.setParameters("policyId", policyId);
|
sc.setParameters("policyId", policyId);
|
||||||
return delete(sc);
|
return expunge(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -375,7 +375,7 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
|||||||
sc.setParameters("status", (Object[])statuses);
|
sc.setParameters("status", (Object[])statuses);
|
||||||
sc.setParameters("pool", primaryStorageId);
|
sc.setParameters("pool", primaryStorageId);
|
||||||
|
|
||||||
List<Long> rs = searchAll(sc, null);
|
List<Long> rs = searchIncludingRemoved(sc, null);
|
||||||
if (rs.size() == 0) {
|
if (rs.size() == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,7 +48,7 @@ public class StoragePoolDetailsDaoImpl extends GenericDaoBase<StoragePoolDetailV
|
|||||||
sc.setParameters("pool", poolId);
|
sc.setParameters("pool", poolId);
|
||||||
|
|
||||||
txn.start();
|
txn.start();
|
||||||
delete(sc);
|
expunge(sc);
|
||||||
for (Map.Entry<String, String> entry : details.entrySet()) {
|
for (Map.Entry<String, String> entry : details.entrySet()) {
|
||||||
StoragePoolDetailVO detail = new StoragePoolDetailVO(poolId, entry.getKey(), entry.getValue());
|
StoragePoolDetailVO detail = new StoragePoolDetailVO(poolId, entry.getKey(), entry.getValue());
|
||||||
persist(detail);
|
persist(detail);
|
||||||
|
|||||||
@ -71,7 +71,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
|||||||
SearchCriteria<VolumeVO> sc = RemovedButNotDestroyedSearch.create();
|
SearchCriteria<VolumeVO> sc = RemovedButNotDestroyedSearch.create();
|
||||||
sc.setParameters("destroyed", false);
|
sc.setParameters("destroyed", false);
|
||||||
|
|
||||||
return searchAll(sc, null, null, false);
|
return searchIncludingRemoved(sc, null, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @DB
|
@Override @DB
|
||||||
@ -224,7 +224,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
|||||||
sc.setParameters("template", templateId);
|
sc.setParameters("template", templateId);
|
||||||
sc.setParameters("pool", poolId);
|
sc.setParameters("pool", poolId);
|
||||||
|
|
||||||
List<Long> results = searchAll(sc, null);
|
List<Long> results = searchIncludingRemoved(sc, null);
|
||||||
assert results.size() > 0 : "How can this return a size of " + results.size();
|
assert results.size() > 0 : "How can this return a size of " + results.size();
|
||||||
|
|
||||||
return results.get(0) > 0;
|
return results.get(0) > 0;
|
||||||
@ -234,7 +234,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
|||||||
public void deleteVolumesByInstance(long instanceId) {
|
public void deleteVolumesByInstance(long instanceId) {
|
||||||
SearchCriteria<VolumeVO> sc = InstanceIdSearch.create();
|
SearchCriteria<VolumeVO> sc = InstanceIdSearch.create();
|
||||||
sc.setParameters("instanceId", instanceId);
|
sc.setParameters("instanceId", instanceId);
|
||||||
delete(sc);
|
expunge(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -359,7 +359,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
|||||||
public Pair<Long, Long> getCountAndTotalByPool(long poolId) {
|
public Pair<Long, Long> getCountAndTotalByPool(long poolId) {
|
||||||
SearchCriteria<SumCount> sc = TotalSizeByPoolSearch.create();
|
SearchCriteria<SumCount> sc = TotalSizeByPoolSearch.create();
|
||||||
sc.setParameters("poolId", poolId);
|
sc.setParameters("poolId", poolId);
|
||||||
List<SumCount> results = searchAll(sc, null);
|
List<SumCount> results = searchIncludingRemoved(sc, null);
|
||||||
SumCount sumCount = results.get(0);
|
SumCount sumCount = results.get(0);
|
||||||
return new Pair<Long, Long>(sumCount.count, sumCount.sum);
|
return new Pair<Long, Long>(sumCount.count, sumCount.sum);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,7 +74,7 @@ public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements A
|
|||||||
SearchCriteria<AccountVO> sc = CleanupSearch.create();
|
SearchCriteria<AccountVO> sc = CleanupSearch.create();
|
||||||
sc.setParameters("cleanup", true);
|
sc.setParameters("cleanup", true);
|
||||||
|
|
||||||
return searchAll(sc, null, null, false);
|
return searchIncludingRemoved(sc, null, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair<User, Account> findUserAccountByApiKey(String apiKey) {
|
public Pair<User, Account> findUserAccountByApiKey(String apiKey) {
|
||||||
|
|||||||
@ -1634,7 +1634,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
|
|||||||
String cluster = startup.getCluster();
|
String cluster = startup.getCluster();
|
||||||
|
|
||||||
if (pod != null && dataCenter != null && pod.equalsIgnoreCase("default") && dataCenter.equalsIgnoreCase("default")) {
|
if (pod != null && dataCenter != null && pod.equalsIgnoreCase("default") && dataCenter.equalsIgnoreCase("default")) {
|
||||||
List<HostPodVO> pods = _podDao.listAll();
|
List<HostPodVO> pods = _podDao.listAllIncludingRemoved();
|
||||||
for (HostPodVO hpv : pods) {
|
for (HostPodVO hpv : pods) {
|
||||||
if (checkCIDR(type, hpv, startup.getPrivateIpAddress(), startup.getPrivateNetmask())) {
|
if (checkCIDR(type, hpv, startup.getPrivateIpAddress(), startup.getPrivateNetmask())) {
|
||||||
pod = hpv.getName();
|
pod = hpv.getName();
|
||||||
|
|||||||
@ -338,7 +338,7 @@ public class AlertManagerImpl implements AlertManager {
|
|||||||
List<HostVO> hosts = _hostDao.search(sc, null);
|
List<HostVO> hosts = _hostDao.search(sc, null);
|
||||||
|
|
||||||
// prep the service offerings
|
// prep the service offerings
|
||||||
List<ServiceOfferingVO> offerings = _offeringsDao.listAll();
|
List<ServiceOfferingVO> offerings = _offeringsDao.listAllIncludingRemoved();
|
||||||
Map<Long, ServiceOfferingVO> offeringsMap = new HashMap<Long, ServiceOfferingVO>();
|
Map<Long, ServiceOfferingVO> offeringsMap = new HashMap<Long, ServiceOfferingVO>();
|
||||||
for (ServiceOfferingVO offering : offerings) {
|
for (ServiceOfferingVO offering : offerings) {
|
||||||
offeringsMap.put(offering.getId(), offering);
|
offeringsMap.put(offering.getId(), offering);
|
||||||
@ -394,7 +394,7 @@ public class AlertManagerImpl implements AlertManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate storage pool capacity
|
// Calculate storage pool capacity
|
||||||
List<StoragePoolVO> storagePools = _storagePoolDao.listAllActive();
|
List<StoragePoolVO> storagePools = _storagePoolDao.listAll();
|
||||||
for (StoragePoolVO pool : storagePools) {
|
for (StoragePoolVO pool : storagePools) {
|
||||||
long disk = 0l;
|
long disk = 0l;
|
||||||
Pair<Long, Long> sizes = _volumeDao.getCountAndTotalByPool(pool.getId());
|
Pair<Long, Long> sizes = _volumeDao.getCountAndTotalByPool(pool.getId());
|
||||||
@ -410,7 +410,7 @@ public class AlertManagerImpl implements AlertManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate new Public IP capacity
|
// Calculate new Public IP capacity
|
||||||
List<DataCenterVO> datacenters = _dcDao.listAll();
|
List<DataCenterVO> datacenters = _dcDao.listAllIncludingRemoved();
|
||||||
for (DataCenterVO datacenter : datacenters) {
|
for (DataCenterVO datacenter : datacenters) {
|
||||||
long dcId = datacenter.getId();
|
long dcId = datacenter.getId();
|
||||||
|
|
||||||
@ -422,7 +422,7 @@ public class AlertManagerImpl implements AlertManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate new Private IP capacity
|
// Calculate new Private IP capacity
|
||||||
List<HostPodVO> pods = _podDao.listAll();
|
List<HostPodVO> pods = _podDao.listAllIncludingRemoved();
|
||||||
for (HostPodVO pod : pods) {
|
for (HostPodVO pod : pods) {
|
||||||
long podId = pod.getId();
|
long podId = pod.getId();
|
||||||
long dcId = pod.getDataCenterId();
|
long dcId = pod.getDataCenterId();
|
||||||
@ -465,7 +465,7 @@ public class AlertManagerImpl implements AlertManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<CapacityVO> capacityList = _capacityDao.listAll();
|
List<CapacityVO> capacityList = _capacityDao.listAllIncludingRemoved();
|
||||||
Map<String, List<CapacityVO>> capacityDcTypeMap = new HashMap<String, List<CapacityVO>>();
|
Map<String, List<CapacityVO>> capacityDcTypeMap = new HashMap<String, List<CapacityVO>>();
|
||||||
|
|
||||||
for (CapacityVO capacity : capacityList) {
|
for (CapacityVO capacity : capacityList) {
|
||||||
|
|||||||
@ -476,7 +476,7 @@ public class AsyncJobManagerImpl implements AsyncJobManager {
|
|||||||
List<AsyncJobVO> l = _jobDao.getExpiredJobs(cutTime, 100);
|
List<AsyncJobVO> l = _jobDao.getExpiredJobs(cutTime, 100);
|
||||||
if(l != null && l.size() > 0) {
|
if(l != null && l.size() > 0) {
|
||||||
for(AsyncJobVO job : l) {
|
for(AsyncJobVO job : l) {
|
||||||
_jobDao.delete(job.getId());
|
_jobDao.expunge(job.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -186,7 +186,7 @@ public class SyncQueueManagerImpl implements SyncQueueManager {
|
|||||||
if(itemVO != null) {
|
if(itemVO != null) {
|
||||||
SyncQueueVO queueVO = _syncQueueDao.lock(itemVO.getQueueId(), true);
|
SyncQueueVO queueVO = _syncQueueDao.lock(itemVO.getQueueId(), true);
|
||||||
|
|
||||||
_syncQueueItemDao.delete(itemVO.getId());
|
_syncQueueItemDao.expunge(itemVO.getId());
|
||||||
|
|
||||||
queueVO.setLastProcessTime(null);
|
queueVO.setLastProcessTime(null);
|
||||||
queueVO.setLastUpdated(DateUtil.currentGMTTime());
|
queueVO.setLastUpdated(DateUtil.currentGMTTime());
|
||||||
|
|||||||
@ -358,7 +358,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
|||||||
HostPodVO pod = _podDao.findById(podId);
|
HostPodVO pod = _podDao.findById(podId);
|
||||||
DataCenterVO zone = _zoneDao.findById(pod.getDataCenterId());
|
DataCenterVO zone = _zoneDao.findById(pod.getDataCenterId());
|
||||||
|
|
||||||
_podDao.delete(podId);
|
_podDao.expunge(podId);
|
||||||
|
|
||||||
// Delete private IP addresses in the pod
|
// Delete private IP addresses in the pod
|
||||||
_privateIpAddressDao.deleteIpAddressByPod(podId);
|
_privateIpAddressDao.deleteIpAddressByPod(podId);
|
||||||
@ -660,7 +660,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
|||||||
|
|
||||||
DataCenterVO zone = _zoneDao.findById(zoneId);
|
DataCenterVO zone = _zoneDao.findById(zoneId);
|
||||||
|
|
||||||
_zoneDao.delete(zoneId);
|
_zoneDao.expunge(zoneId);
|
||||||
|
|
||||||
// Delete vNet
|
// Delete vNet
|
||||||
_zoneDao.deleteVnet(zoneId);
|
_zoneDao.deleteVnet(zoneId);
|
||||||
@ -1076,7 +1076,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make sure there aren't any account VLANs in this zone
|
// Make sure there aren't any account VLANs in this zone
|
||||||
List<AccountVlanMapVO> accountVlanMaps = _accountVlanMapDao.listAll();
|
List<AccountVlanMapVO> accountVlanMaps = _accountVlanMapDao.listAllIncludingRemoved();
|
||||||
for (AccountVlanMapVO accountVlanMap : accountVlanMaps) {
|
for (AccountVlanMapVO accountVlanMap : accountVlanMaps) {
|
||||||
VlanVO vlan = _vlanDao.findById(accountVlanMap.getVlanDbId());
|
VlanVO vlan = _vlanDao.findById(accountVlanMap.getVlanDbId());
|
||||||
if (vlan.getDataCenterId() == zone.getId()) {
|
if (vlan.getDataCenterId() == zone.getId()) {
|
||||||
@ -1171,12 +1171,12 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
|||||||
if (accountId != null && vlanType.equals(VlanType.VirtualNetwork)){
|
if (accountId != null && vlanType.equals(VlanType.VirtualNetwork)){
|
||||||
if(!savePublicIPRangeForAccount(startIP, endIP, zoneId, vlan.getId(), accountId, _accountDao.findById(accountId).getDomainId())){
|
if(!savePublicIPRangeForAccount(startIP, endIP, zoneId, vlan.getId(), accountId, _accountDao.findById(accountId).getDomainId())){
|
||||||
deletePublicIPRange(vlan.getId());
|
deletePublicIPRange(vlan.getId());
|
||||||
_vlanDao.delete(vlan.getId());
|
_vlanDao.expunge(vlan.getId());
|
||||||
throw new InternalErrorException("Failed to save IP range. Please contact Cloud Support."); //It can be Direct IP or Public IP.
|
throw new InternalErrorException("Failed to save IP range. Please contact Cloud Support."); //It can be Direct IP or Public IP.
|
||||||
}
|
}
|
||||||
}else if (!savePublicIPRange(startIP, endIP, zoneId, vlan.getId())) {
|
}else if (!savePublicIPRange(startIP, endIP, zoneId, vlan.getId())) {
|
||||||
deletePublicIPRange(vlan.getId());
|
deletePublicIPRange(vlan.getId());
|
||||||
_vlanDao.delete(vlan.getId());
|
_vlanDao.expunge(vlan.getId());
|
||||||
throw new InternalErrorException("Failed to save IP range. Please contact Cloud Support."); //It can be Direct IP or Public IP.
|
throw new InternalErrorException("Failed to save IP range. Please contact Cloud Support."); //It can be Direct IP or Public IP.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1240,7 +1240,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete the VLAN
|
// Delete the VLAN
|
||||||
boolean success = _vlanDao.delete(vlanDbId);
|
boolean success = _vlanDao.expunge(vlanDbId);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
String[] ipRange = vlan.getIpRange().split("\\-");
|
String[] ipRange = vlan.getIpRange().split("\\-");
|
||||||
|
|||||||
@ -48,7 +48,7 @@ AgentBasedConsoleProxyManager {
|
|||||||
if(host != null) {
|
if(host != null) {
|
||||||
HostVO allocatedHost = null;
|
HostVO allocatedHost = null;
|
||||||
/*Is there a consoleproxy agent running on the same machine?*/
|
/*Is there a consoleproxy agent running on the same machine?*/
|
||||||
List<HostVO> hosts = _hostDao.listAll();
|
List<HostVO> hosts = _hostDao.listAllIncludingRemoved();
|
||||||
for (HostVO hv : hosts) {
|
for (HostVO hv : hosts) {
|
||||||
if (hv.getType() == Host.Type.ConsoleProxy && hv.getPublicIpAddress().equalsIgnoreCase(host.getPublicIpAddress())) {
|
if (hv.getType() == Host.Type.ConsoleProxy && hv.getPublicIpAddress().equalsIgnoreCase(host.getPublicIpAddress())) {
|
||||||
allocatedHost = hv;
|
allocatedHost = hv;
|
||||||
|
|||||||
@ -52,7 +52,7 @@ public class StackMaidManagerImpl implements StackMaidManager {
|
|||||||
private void cleanupLeftovers(List<StackMaidVO> l) {
|
private void cleanupLeftovers(List<StackMaidVO> l) {
|
||||||
for(StackMaidVO maid : l) {
|
for(StackMaidVO maid : l) {
|
||||||
StackMaid.doCleanup(maid);
|
StackMaid.doCleanup(maid);
|
||||||
_maidDao.delete(maid.getId());
|
_maidDao.expunge(maid.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -126,7 +126,7 @@ public class Db20to21MigrationUtil {
|
|||||||
sb.done();
|
sb.done();
|
||||||
|
|
||||||
SearchCriteria<DcPod> sc = sb.create();
|
SearchCriteria<DcPod> sc = sb.create();
|
||||||
List<DcPod> results = _dcDao.searchAll(sc, (Filter)null);
|
List<DcPod> results = _dcDao.searchIncludingRemoved(sc, (Filter)null);
|
||||||
if(results.size() > 0) {
|
if(results.size() > 0) {
|
||||||
System.out.println("We've found following zones are deployed in your database");
|
System.out.println("We've found following zones are deployed in your database");
|
||||||
for(DcPod cols : results) {
|
for(DcPod cols : results) {
|
||||||
@ -153,7 +153,7 @@ public class Db20to21MigrationUtil {
|
|||||||
SearchCriteria<HostPodVO> sc = sb.create();
|
SearchCriteria<HostPodVO> sc = sb.create();
|
||||||
sc.setParameters("zoneId", zoneId);
|
sc.setParameters("zoneId", zoneId);
|
||||||
|
|
||||||
List<HostPodVO> pods = _podDao.searchAll(sc, null, false, false);
|
List<HostPodVO> pods = _podDao.searchIncludingRemoved(sc, null, false, false);
|
||||||
if(pods.size() > 0) {
|
if(pods.size() > 0) {
|
||||||
for(HostPodVO pod : pods) {
|
for(HostPodVO pod : pods) {
|
||||||
System.out.println("Migrating pod " + pod.getName() + " in zone " + zoneName + "...");
|
System.out.println("Migrating pod " + pod.getName() + " in zone " + zoneName + "...");
|
||||||
@ -202,7 +202,7 @@ public class Db20to21MigrationUtil {
|
|||||||
sc.setParameters("type", Host.Type.Routing);
|
sc.setParameters("type", Host.Type.Routing);
|
||||||
|
|
||||||
// join cluster for hosts in pod
|
// join cluster for hosts in pod
|
||||||
List<HostVO> hostsInPod = _hostDao.searchAll(sc, null, false, false);
|
List<HostVO> hostsInPod = _hostDao.searchIncludingRemoved(sc, null, false, false);
|
||||||
if(hostsInPod.size() > 0) {
|
if(hostsInPod.size() > 0) {
|
||||||
if(cluster == null) {
|
if(cluster == null) {
|
||||||
cluster = new ClusterVO(zoneId, podId, String.valueOf(podId));
|
cluster = new ClusterVO(zoneId, podId, String.valueOf(podId));
|
||||||
@ -228,7 +228,7 @@ public class Db20to21MigrationUtil {
|
|||||||
scPool.setParameters("pod", podId);
|
scPool.setParameters("pod", podId);
|
||||||
scPool.setParameters("poolType", StoragePoolType.NetworkFilesystem.toString(), StoragePoolType.IscsiLUN.toString());
|
scPool.setParameters("poolType", StoragePoolType.NetworkFilesystem.toString(), StoragePoolType.IscsiLUN.toString());
|
||||||
|
|
||||||
List<StoragePoolVO> sPoolsInPod = _spDao.searchAll(scPool, null, false, false);
|
List<StoragePoolVO> sPoolsInPod = _spDao.searchIncludingRemoved(scPool, null, false, false);
|
||||||
if(sPoolsInPod.size() > 0) {
|
if(sPoolsInPod.size() > 0) {
|
||||||
if(cluster == null) {
|
if(cluster == null) {
|
||||||
cluster = new ClusterVO(zoneId, podId, String.valueOf(podId));
|
cluster = new ClusterVO(zoneId, podId, String.valueOf(podId));
|
||||||
@ -265,7 +265,7 @@ public class Db20to21MigrationUtil {
|
|||||||
System.out.println("Migrating domains...");
|
System.out.println("Migrating domains...");
|
||||||
|
|
||||||
// we shouldn't have too many domains in the system, use a very dumb way to setup domain path
|
// we shouldn't have too many domains in the system, use a very dumb way to setup domain path
|
||||||
List<DomainVO> domains = _domainDao.listAll();
|
List<DomainVO> domains = _domainDao.listAllIncludingRemoved();
|
||||||
for(DomainVO domain : domains) {
|
for(DomainVO domain : domains) {
|
||||||
StringBuilder path = new StringBuilder();
|
StringBuilder path = new StringBuilder();
|
||||||
composeDomainPath(domain, path);
|
composeDomainPath(domain, path);
|
||||||
@ -284,7 +284,7 @@ public class Db20to21MigrationUtil {
|
|||||||
|
|
||||||
long seq = getServiceOfferingStartSequence();
|
long seq = getServiceOfferingStartSequence();
|
||||||
|
|
||||||
List<ServiceOffering20VO> oldServiceOfferings = _serviceOffering20Dao.listAll();
|
List<ServiceOffering20VO> oldServiceOfferings = _serviceOffering20Dao.listAllIncludingRemoved();
|
||||||
for(ServiceOffering20VO so20 : oldServiceOfferings) {
|
for(ServiceOffering20VO so20 : oldServiceOfferings) {
|
||||||
ServiceOffering21VO so21 = new ServiceOffering21VO(so20.getName(), so20.getCpu(), so20.getRamSize(), so20.getSpeed(), so20.getRateMbps(),
|
ServiceOffering21VO so21 = new ServiceOffering21VO(so20.getName(), so20.getCpu(), so20.getRamSize(), so20.getSpeed(), so20.getRateMbps(),
|
||||||
so20.getMulticastRateMbps(), so20.getOfferHA(), so20.getDisplayText(), so20.getGuestIpType(),
|
so20.getMulticastRateMbps(), so20.getOfferHA(), so20.getDisplayText(), so20.getGuestIpType(),
|
||||||
@ -435,7 +435,7 @@ public class Db20to21MigrationUtil {
|
|||||||
private void migrateDiskOfferings() {
|
private void migrateDiskOfferings() {
|
||||||
System.out.println("Migrating disk offering...");
|
System.out.println("Migrating disk offering...");
|
||||||
|
|
||||||
List<DiskOffering20VO> oldDiskOfferings = _diskOffering20Dao.listAll();
|
List<DiskOffering20VO> oldDiskOfferings = _diskOffering20Dao.listAllIncludingRemoved();
|
||||||
long maxDiskOfferingId = _domRServiceOfferingId;
|
long maxDiskOfferingId = _domRServiceOfferingId;
|
||||||
maxDiskOfferingId += 100;
|
maxDiskOfferingId += 100;
|
||||||
|
|
||||||
@ -460,7 +460,7 @@ public class Db20to21MigrationUtil {
|
|||||||
System.out.println("Fixup NULL disk_offering_id references in volumes table ...");
|
System.out.println("Fixup NULL disk_offering_id references in volumes table ...");
|
||||||
|
|
||||||
SearchCriteria<DiskOffering21VO> scDiskOffering = _diskOffering21Dao.createSearchCriteria();
|
SearchCriteria<DiskOffering21VO> scDiskOffering = _diskOffering21Dao.createSearchCriteria();
|
||||||
List<DiskOffering21VO> offeringList = _diskOffering21Dao.searchAll(scDiskOffering,
|
List<DiskOffering21VO> offeringList = _diskOffering21Dao.searchIncludingRemoved(scDiskOffering,
|
||||||
new Filter(DiskOffering21VO.class, "diskSize", true, null, null), false, false);
|
new Filter(DiskOffering21VO.class, "diskSize", true, null, null), false, false);
|
||||||
|
|
||||||
for(DiskOffering21VO offering : offeringList) {
|
for(DiskOffering21VO offering : offeringList) {
|
||||||
@ -472,7 +472,7 @@ public class Db20to21MigrationUtil {
|
|||||||
sb.done();
|
sb.done();
|
||||||
|
|
||||||
SearchCriteria<VolumeVO> sc = sb.create();
|
SearchCriteria<VolumeVO> sc = sb.create();
|
||||||
List<VolumeVO> volumes = _volumeDao.searchAll(sc, null, false, false);
|
List<VolumeVO> volumes = _volumeDao.searchIncludingRemoved(sc, null, false, false);
|
||||||
|
|
||||||
if(volumes.size() > 0) {
|
if(volumes.size() > 0) {
|
||||||
for(VolumeVO vol : volumes) {
|
for(VolumeVO vol : volumes) {
|
||||||
@ -558,7 +558,7 @@ public class Db20to21MigrationUtil {
|
|||||||
SearchCriteria<ConsoleProxyVO> sc = sb.create();
|
SearchCriteria<ConsoleProxyVO> sc = sb.create();
|
||||||
sc.setParameters("zoneId", zoneId);
|
sc.setParameters("zoneId", zoneId);
|
||||||
|
|
||||||
List<ConsoleProxyVO> proxies =_consoleProxyDao.searchAll(sc, null, false, false);
|
List<ConsoleProxyVO> proxies =_consoleProxyDao.searchIncludingRemoved(sc, null, false, false);
|
||||||
for(ConsoleProxyVO proxy : proxies) {
|
for(ConsoleProxyVO proxy : proxies) {
|
||||||
String[] macAddresses = _dcDao.getNextAvailableMacAddressPair(zoneId, (1L << 31));
|
String[] macAddresses = _dcDao.getNextAvailableMacAddressPair(zoneId, (1L << 31));
|
||||||
String guestMacAddress = macAddresses[0];
|
String guestMacAddress = macAddresses[0];
|
||||||
@ -585,7 +585,7 @@ public class Db20to21MigrationUtil {
|
|||||||
SearchCriteria<SecondaryStorageVmVO> sc2 = sb2.create();
|
SearchCriteria<SecondaryStorageVmVO> sc2 = sb2.create();
|
||||||
sc2.setParameters("zoneId", zoneId);
|
sc2.setParameters("zoneId", zoneId);
|
||||||
|
|
||||||
List<SecondaryStorageVmVO> secStorageVms =_secStorageVmDao.searchAll(sc2, null, false, false);
|
List<SecondaryStorageVmVO> secStorageVms =_secStorageVmDao.searchIncludingRemoved(sc2, null, false, false);
|
||||||
for(SecondaryStorageVmVO secStorageVm : secStorageVms) {
|
for(SecondaryStorageVmVO secStorageVm : secStorageVms) {
|
||||||
String[] macAddresses = _dcDao.getNextAvailableMacAddressPair(zoneId, (1L << 31));
|
String[] macAddresses = _dcDao.getNextAvailableMacAddressPair(zoneId, (1L << 31));
|
||||||
String guestMacAddress = macAddresses[0];
|
String guestMacAddress = macAddresses[0];
|
||||||
@ -612,7 +612,7 @@ public class Db20to21MigrationUtil {
|
|||||||
|
|
||||||
SearchCriteria<DomainRouterVO> sc3 = sb3.create();
|
SearchCriteria<DomainRouterVO> sc3 = sb3.create();
|
||||||
sc3.setParameters("zoneId", zoneId);
|
sc3.setParameters("zoneId", zoneId);
|
||||||
List<DomainRouterVO> domRs = _routerDao.searchAll(sc3, null, false, false);
|
List<DomainRouterVO> domRs = _routerDao.searchIncludingRemoved(sc3, null, false, false);
|
||||||
for(DomainRouterVO router : domRs) {
|
for(DomainRouterVO router : domRs) {
|
||||||
if(router.getState() == State.Running || router.getState() == State.Starting) {
|
if(router.getState() == State.Running || router.getState() == State.Starting) {
|
||||||
router.setState(State.Stopping);
|
router.setState(State.Stopping);
|
||||||
@ -633,7 +633,7 @@ public class Db20to21MigrationUtil {
|
|||||||
SearchCriteria<VMInstanceVO> sc = sb.create();
|
SearchCriteria<VMInstanceVO> sc = sb.create();
|
||||||
sc.setParameters("zoneId", zoneId);
|
sc.setParameters("zoneId", zoneId);
|
||||||
sc.setParameters("podId", podId);
|
sc.setParameters("podId", podId);
|
||||||
List<VMInstanceVO> vmInstances = _vmInstanceDao.searchAll(sc, null, false, false);
|
List<VMInstanceVO> vmInstances = _vmInstanceDao.searchIncludingRemoved(sc, null, false, false);
|
||||||
List<HostVO> podHosts = getHostsInPod(zoneId, podId);
|
List<HostVO> podHosts = getHostsInPod(zoneId, podId);
|
||||||
for(VMInstanceVO vm : vmInstances) {
|
for(VMInstanceVO vm : vmInstances) {
|
||||||
if(vm.getHostId() != null) {
|
if(vm.getHostId() != null) {
|
||||||
@ -660,13 +660,13 @@ public class Db20to21MigrationUtil {
|
|||||||
sc.setParameters("podId", podId);
|
sc.setParameters("podId", podId);
|
||||||
sc.setParameters("type", Host.Type.Routing.toString());
|
sc.setParameters("type", Host.Type.Routing.toString());
|
||||||
|
|
||||||
return _hostDao.searchAll(sc, null, false, false);
|
return _hostDao.searchIncludingRemoved(sc, null, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void migrateVolumDeviceIds() {
|
private void migrateVolumDeviceIds() {
|
||||||
System.out.println("Migrating device_id for volumes, this may take a while, please wait...");
|
System.out.println("Migrating device_id for volumes, this may take a while, please wait...");
|
||||||
SearchCriteria<VMInstanceVO> sc = _vmInstanceDao.createSearchCriteria();
|
SearchCriteria<VMInstanceVO> sc = _vmInstanceDao.createSearchCriteria();
|
||||||
List<VMInstanceVO> vmInstances = _vmInstanceDao.searchAll(sc, null, false, false);
|
List<VMInstanceVO> vmInstances = _vmInstanceDao.searchIncludingRemoved(sc, null, false, false);
|
||||||
|
|
||||||
long deviceId = 1;
|
long deviceId = 1;
|
||||||
for(VMInstanceVO vm: vmInstances) {
|
for(VMInstanceVO vm: vmInstances) {
|
||||||
@ -677,7 +677,7 @@ public class Db20to21MigrationUtil {
|
|||||||
SearchCriteria<VolumeVO> sc2 = sb.create();
|
SearchCriteria<VolumeVO> sc2 = sb.create();
|
||||||
sc2.setParameters("instanceId", vm.getId());
|
sc2.setParameters("instanceId", vm.getId());
|
||||||
|
|
||||||
List<VolumeVO> volumes = _volumeDao.searchAll(sc2, null, false, false);
|
List<VolumeVO> volumes = _volumeDao.searchIncludingRemoved(sc2, null, false, false);
|
||||||
deviceId = 1; // reset for each VM iteration
|
deviceId = 1; // reset for each VM iteration
|
||||||
for(VolumeVO vol : volumes) {
|
for(VolumeVO vol : volumes) {
|
||||||
if(vol.getVolumeType() == VolumeType.ROOT) {
|
if(vol.getVolumeType() == VolumeType.ROOT) {
|
||||||
@ -707,7 +707,7 @@ public class Db20to21MigrationUtil {
|
|||||||
System.out.println("Migrating pool type for volumes...");
|
System.out.println("Migrating pool type for volumes...");
|
||||||
|
|
||||||
SearchCriteria<VolumeVO> sc = _volumeDao.createSearchCriteria();
|
SearchCriteria<VolumeVO> sc = _volumeDao.createSearchCriteria();
|
||||||
List<VolumeVO> volumes = _volumeDao.searchAll(sc, null, false, false);
|
List<VolumeVO> volumes = _volumeDao.searchIncludingRemoved(sc, null, false, false);
|
||||||
for(VolumeVO vol : volumes) {
|
for(VolumeVO vol : volumes) {
|
||||||
if(vol.getPoolId() != null) {
|
if(vol.getPoolId() != null) {
|
||||||
StoragePoolVO pool = _poolDao.findById(vol.getPoolId());
|
StoragePoolVO pool = _poolDao.findById(vol.getPoolId());
|
||||||
|
|||||||
@ -459,7 +459,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
|||||||
List<VolumeVO> vols = _storageMgr.create(account, router, rtrTemplate, dc, pod, _offering, null,0);
|
List<VolumeVO> vols = _storageMgr.create(account, router, rtrTemplate, dc, pod, _offering, null,0);
|
||||||
if (vols == null){
|
if (vols == null){
|
||||||
_ipAddressDao.unassignIpAddress(guestIp);
|
_ipAddressDao.unassignIpAddress(guestIp);
|
||||||
_routerDao.delete(router.getId());
|
_routerDao.expunge(router.getId());
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Unable to create dhcp server in storage host or pool in pod " + pod.getName() + " (id:" + pod.getId() + ")");
|
s_logger.debug("Unable to create dhcp server in storage host or pool in pod " + pod.getName() + " (id:" + pod.getId() + ")");
|
||||||
}
|
}
|
||||||
@ -493,7 +493,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
|||||||
txn.rollback();
|
txn.rollback();
|
||||||
|
|
||||||
if (router.getState() == State.Creating) {
|
if (router.getState() == State.Creating) {
|
||||||
_routerDao.delete(router.getId());
|
_routerDao.expunge(router.getId());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
@ -635,7 +635,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_routerDao.delete(router.getId());
|
_routerDao.expunge(router.getId());
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Unable to find storage host or pool in pod " + pod.first().getName() + " (id:" + pod.first().getId() + "), checking other pods");
|
s_logger.debug("Unable to find storage host or pool in pod " + pod.first().getName() + " (id:" + pod.first().getId() + "), checking other pods");
|
||||||
}
|
}
|
||||||
@ -670,7 +670,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
|||||||
txn.rollback();
|
txn.rollback();
|
||||||
|
|
||||||
if (router != null && router.getState() == State.Creating) {
|
if (router != null && router.getState() == State.Creating) {
|
||||||
_routerDao.delete(router.getId());
|
_routerDao.expunge(router.getId());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@ -774,7 +774,7 @@ public class NetworkGroupManagerImpl implements NetworkGroupManager {
|
|||||||
txn.rollback();
|
txn.rollback();
|
||||||
throw new ResourceInUseException("Cannot delete group when there are ingress rules in this group");
|
throw new ResourceInUseException("Cannot delete group when there are ingress rules in this group");
|
||||||
}
|
}
|
||||||
_networkGroupDao.delete(groupId);
|
_networkGroupDao.expunge(groupId);
|
||||||
txn.commit();
|
txn.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -970,7 +970,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
// All vm instances have been destroyed, delete the security group -> instance_id mappings
|
// All vm instances have been destroyed, delete the security group -> instance_id mappings
|
||||||
SearchCriteria<SecurityGroupVMMapVO> sc = _securityGroupVMMapDao.createSearchCriteria();
|
SearchCriteria<SecurityGroupVMMapVO> sc = _securityGroupVMMapDao.createSearchCriteria();
|
||||||
sc.addAnd("securityGroupId", SearchCriteria.Op.EQ, securityGroup.getId());
|
sc.addAnd("securityGroupId", SearchCriteria.Op.EQ, securityGroup.getId());
|
||||||
_securityGroupVMMapDao.delete(sc);
|
_securityGroupVMMapDao.expunge(sc);
|
||||||
|
|
||||||
// now clean the network rules and security groups themselves
|
// now clean the network rules and security groups themselves
|
||||||
_networkRuleConfigDao.deleteBySecurityGroup(securityGroup.getId());
|
_networkRuleConfigDao.deleteBySecurityGroup(securityGroup.getId());
|
||||||
@ -2847,12 +2847,12 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DataCenterVO> listDataCenters() {
|
public List<DataCenterVO> listDataCenters() {
|
||||||
return _dcDao.listAllActive();
|
return _dcDao.listAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DataCenterVO> listDataCentersBy(long accountId) {
|
public List<DataCenterVO> listDataCentersBy(long accountId) {
|
||||||
List<DataCenterVO> dcs = _dcDao.listAllActive();
|
List<DataCenterVO> dcs = _dcDao.listAll();
|
||||||
List<DomainRouterVO> routers = _routerDao.listBy(accountId);
|
List<DomainRouterVO> routers = _routerDao.listBy(accountId);
|
||||||
for (Iterator<DataCenterVO> iter = dcs.iterator(); iter.hasNext();) {
|
for (Iterator<DataCenterVO> iter = dcs.iterator(); iter.hasNext();) {
|
||||||
DataCenterVO dc = iter.next();
|
DataCenterVO dc = iter.next();
|
||||||
@ -3647,7 +3647,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
} else if (fwdings.size() == 1) {
|
} else if (fwdings.size() == 1) {
|
||||||
fwRule = fwdings.get(0);
|
fwRule = fwdings.get(0);
|
||||||
if (fwRule.getPrivateIpAddress().equalsIgnoreCase(privateIp) && fwRule.getPrivatePort().equals(privatePort)) {
|
if (fwRule.getPrivateIpAddress().equalsIgnoreCase(privateIp) && fwRule.getPrivatePort().equals(privatePort)) {
|
||||||
_firewallRulesDao.delete(fwRule.getId());
|
_firewallRulesDao.expunge(fwRule.getId());
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidParameterValueException("No such rule");
|
throw new InvalidParameterValueException("No such rule");
|
||||||
}
|
}
|
||||||
@ -3746,7 +3746,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
if (!success) {
|
if (!success) {
|
||||||
throw new InternalErrorException("Failed to update router");
|
throw new InternalErrorException("Failed to update router");
|
||||||
}
|
}
|
||||||
_firewallRulesDao.delete(fwRule.getId());
|
_firewallRulesDao.expunge(fwRule.getId());
|
||||||
|
|
||||||
txn.commit();
|
txn.commit();
|
||||||
return success;
|
return success;
|
||||||
@ -4483,7 +4483,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
if (limitId == null)
|
if (limitId == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return _resourceLimitDao.delete(limitId);
|
return _resourceLimitDao.expunge(limitId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -4516,7 +4516,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
{
|
{
|
||||||
//account belongs to admin
|
//account belongs to admin
|
||||||
//return all limits
|
//return all limits
|
||||||
limits = _resourceLimitDao.listAll();
|
limits = _resourceLimitDao.listAllIncludingRemoved();
|
||||||
return limits;
|
return limits;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4525,7 +4525,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
//return all the records for resource limits (bug:3778)
|
//return all the records for resource limits (bug:3778)
|
||||||
if(accountId==1 && domainId==1)
|
if(accountId==1 && domainId==1)
|
||||||
{
|
{
|
||||||
limits = _resourceLimitDao.listAll();
|
limits = _resourceLimitDao.listAllIncludingRemoved();
|
||||||
return limits;
|
return limits;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4685,12 +4685,12 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ServiceOfferingVO> listAllServiceOfferings() {
|
public List<ServiceOfferingVO> listAllServiceOfferings() {
|
||||||
return _offeringsDao.listAll();
|
return _offeringsDao.listAllIncludingRemoved();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<HostVO> listAllActiveHosts() {
|
public List<HostVO> listAllActiveHosts() {
|
||||||
return _hostDao.listAllActive();
|
return _hostDao.listAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -5474,7 +5474,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DomainRouterVO> listAllActiveRouters() {
|
public List<DomainRouterVO> listAllActiveRouters() {
|
||||||
return _routerDao.listAllActive();
|
return _routerDao.listAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -5861,7 +5861,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DiskTemplateVO> listAllActiveDiskTemplates() {
|
public List<DiskTemplateVO> listAllActiveDiskTemplates() {
|
||||||
return _diskTemplateDao.listAllActive();
|
return _diskTemplateDao.listAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -6114,7 +6114,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<VMTemplateVO> listAllTemplates() {
|
public List<VMTemplateVO> listAllTemplates() {
|
||||||
return _templateDao.listAll();
|
return _templateDao.listAllIncludingRemoved();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -7924,7 +7924,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
List<EventVO> oldEvents = _eventDao.listOlderEvents(purgeTime);
|
List<EventVO> oldEvents = _eventDao.listOlderEvents(purgeTime);
|
||||||
s_logger.debug("Found "+oldEvents.size()+" events to be purged");
|
s_logger.debug("Found "+oldEvents.size()+" events to be purged");
|
||||||
for (EventVO event : oldEvents){
|
for (EventVO event : oldEvents){
|
||||||
_eventDao.delete(event.getId());
|
_eventDao.expunge(event.getId());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
s_logger.error("Exception ", e);
|
s_logger.error("Exception ", e);
|
||||||
|
|||||||
@ -284,7 +284,7 @@ public class StatsCollector {
|
|||||||
|
|
||||||
ConcurrentHashMap<Long, StorageStats> storagePoolStats = new ConcurrentHashMap<Long, StorageStats>();
|
ConcurrentHashMap<Long, StorageStats> storagePoolStats = new ConcurrentHashMap<Long, StorageStats>();
|
||||||
|
|
||||||
List<StoragePoolVO> storagePools = _storagePoolDao.listAllActive();
|
List<StoragePoolVO> storagePools = _storagePoolDao.listAll();
|
||||||
for (StoragePoolVO pool: storagePools) {
|
for (StoragePoolVO pool: storagePools) {
|
||||||
GetStorageStatsCommand command = new GetStorageStatsCommand(pool.getUuid(), pool.getPoolType(), pool.getPath());
|
GetStorageStatsCommand command = new GetStorageStatsCommand(pool.getUuid(), pool.getPoolType(), pool.getPath());
|
||||||
Answer answer = _storageManager.sendToPool(pool, command);
|
Answer answer = _storageManager.sendToPool(pool, command);
|
||||||
@ -377,7 +377,7 @@ public class StatsCollector {
|
|||||||
class VolumeCollector implements Runnable {
|
class VolumeCollector implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
List<VolumeVO> volumes = _volsDao.listAllActive();
|
List<VolumeVO> volumes = _volsDao.listAll();
|
||||||
Map<Long, List<VolumeCommand>> commandsByPool = new HashMap<Long, List<VolumeCommand>>();
|
Map<Long, List<VolumeCommand>> commandsByPool = new HashMap<Long, List<VolumeCommand>>();
|
||||||
|
|
||||||
for (VolumeVO volume : volumes) {
|
for (VolumeVO volume : volumes) {
|
||||||
|
|||||||
@ -1417,7 +1417,7 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (poolHosts.isEmpty()) {
|
if (poolHosts.isEmpty()) {
|
||||||
_storagePoolDao.delete(pool.getId());
|
_storagePoolDao.expunge(pool.getId());
|
||||||
pool = null;
|
pool = null;
|
||||||
} else {
|
} else {
|
||||||
createCapacityEntry(pool);
|
createCapacityEntry(pool);
|
||||||
@ -1885,7 +1885,7 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
public void cleanupStorage(boolean recurring) {
|
public void cleanupStorage(boolean recurring) {
|
||||||
|
|
||||||
// Cleanup primary storage pools
|
// Cleanup primary storage pools
|
||||||
List<StoragePoolVO> storagePools = _storagePoolDao.listAllActive();
|
List<StoragePoolVO> storagePools = _storagePoolDao.listAll();
|
||||||
for (StoragePoolVO pool : storagePools) {
|
for (StoragePoolVO pool : storagePools) {
|
||||||
try {
|
try {
|
||||||
if (recurring && pool.isLocal()) {
|
if (recurring && pool.isLocal()) {
|
||||||
|
|||||||
@ -120,7 +120,7 @@ public class LocalStoragePoolAllocator extends FirstFitStoragePoolAllocator {
|
|||||||
SearchCriteria<Long> sc = VmsOnPoolSearch.create();
|
SearchCriteria<Long> sc = VmsOnPoolSearch.create();
|
||||||
sc.setJoinParameters("volumeJoin", "poolId", pool.getId());
|
sc.setJoinParameters("volumeJoin", "poolId", pool.getId());
|
||||||
sc.setParameters("state", State.Expunging);
|
sc.setParameters("state", State.Expunging);
|
||||||
List<Long> vmsOnHost = _vmInstanceDao.searchAll(sc, null);
|
List<Long> vmsOnHost = _vmInstanceDao.searchIncludingRemoved(sc, null);
|
||||||
|
|
||||||
if(s_logger.isDebugEnabled()) {
|
if(s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Found " + vmsOnHost.size() + " VM instances are alloacated at host " + spHost.getHostId() + " with local storage pool " + pool.getName());
|
s_logger.debug("Found " + vmsOnHost.size() + " VM instances are alloacated at host " + spHost.getHostId() + " with local storage pool " + pool.getName());
|
||||||
|
|||||||
@ -307,7 +307,7 @@ public class DownloadMonitorImpl implements DownloadMonitor {
|
|||||||
List<DataCenterVO> dcs = new ArrayList<DataCenterVO>();
|
List<DataCenterVO> dcs = new ArrayList<DataCenterVO>();
|
||||||
|
|
||||||
if (zoneId == null) {
|
if (zoneId == null) {
|
||||||
dcs.addAll(_dcDao.listAll());
|
dcs.addAll(_dcDao.listAllIncludingRemoved());
|
||||||
} else {
|
} else {
|
||||||
dcs.add(_dcDao.findById(zoneId));
|
dcs.add(_dcDao.findById(zoneId));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,7 +100,7 @@ public class PreallocatedLunDaoImpl extends GenericDaoBase<PreallocatedLunVO, Lo
|
|||||||
SearchCriteria<PreallocatedLunVO> sc = DeleteSearch.create();
|
SearchCriteria<PreallocatedLunVO> sc = DeleteSearch.create();
|
||||||
sc.setParameters("id", id);
|
sc.setParameters("id", id);
|
||||||
|
|
||||||
return delete(sc) > 0;
|
return expunge(sc) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -184,7 +184,7 @@ public class PreallocatedLunDaoImpl extends GenericDaoBase<PreallocatedLunVO, Lo
|
|||||||
SearchCriteria<Long> sc = TotalSizeSearch.create();
|
SearchCriteria<Long> sc = TotalSizeSearch.create();
|
||||||
sc.setParameters("target", targetIqn);
|
sc.setParameters("target", targetIqn);
|
||||||
|
|
||||||
List<Long> results = searchAll(sc, null);
|
List<Long> results = searchIncludingRemoved(sc, null);
|
||||||
if (results.size() == 0) {
|
if (results.size() == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -197,7 +197,7 @@ public class PreallocatedLunDaoImpl extends GenericDaoBase<PreallocatedLunVO, Lo
|
|||||||
SearchCriteria<Long> sc = UsedSizeSearch.create();
|
SearchCriteria<Long> sc = UsedSizeSearch.create();
|
||||||
sc.setParameters("target", targetIqn);
|
sc.setParameters("target", targetIqn);
|
||||||
|
|
||||||
List<Long> results = searchAll(sc, null);
|
List<Long> results = searchIncludingRemoved(sc, null);
|
||||||
if (results.size() == 0) {
|
if (results.size() == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ public class PreallocatedLunDaoImpl extends GenericDaoBase<PreallocatedLunVO, Lo
|
|||||||
public List<String> findDistinctTagsForTarget(String targetIqn) {
|
public List<String> findDistinctTagsForTarget(String targetIqn) {
|
||||||
SearchCriteria<String> sc = DetailsSearch.create();
|
SearchCriteria<String> sc = DetailsSearch.create();
|
||||||
sc.setJoinParameters("target", "targetiqn", targetIqn);
|
sc.setJoinParameters("target", "targetiqn", targetIqn);
|
||||||
return _detailsDao.searchAll(sc, null);
|
return _detailsDao.searchIncludingRemoved(sc, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @DB
|
@Override @DB
|
||||||
|
|||||||
@ -271,7 +271,7 @@ public class SecondaryStorageDiscoverer extends DiscovererBase implements Discov
|
|||||||
_vmTemplateZoneDao.persist(vmTemplateZone);
|
_vmTemplateZoneDao.persist(vmTemplateZone);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<VMTemplateVO> allTemplates = _vmTemplateDao.listAllActive();
|
List<VMTemplateVO> allTemplates = _vmTemplateDao.listAll();
|
||||||
for (VMTemplateVO vt: allTemplates){
|
for (VMTemplateVO vt: allTemplates){
|
||||||
if (vt.isCrossZones()){
|
if (vt.isCrossZones()){
|
||||||
tmpltZone = _vmTemplateZoneDao.findByZoneTemplate(dcId, vt.getId());
|
tmpltZone = _vmTemplateZoneDao.findByZoneTemplate(dcId, vt.getId());
|
||||||
|
|||||||
@ -527,7 +527,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
List<DataCenterVO> allZones = _dcDao.listAllActive();
|
List<DataCenterVO> allZones = _dcDao.listAll();
|
||||||
for (DataCenterVO zone: allZones){
|
for (DataCenterVO zone: allZones){
|
||||||
success = success && generateFirewallConfigurationForZone( zone.getId());
|
success = success && generateFirewallConfigurationForZone( zone.getId());
|
||||||
}
|
}
|
||||||
@ -953,7 +953,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||||||
try {
|
try {
|
||||||
checkPendingSecStorageVMs();
|
checkPendingSecStorageVMs();
|
||||||
|
|
||||||
List<DataCenterVO> datacenters = _dcDao.listAll();
|
List<DataCenterVO> datacenters = _dcDao.listAllIncludingRemoved();
|
||||||
|
|
||||||
|
|
||||||
for (DataCenterVO dc: datacenters){
|
for (DataCenterVO dc: datacenters){
|
||||||
|
|||||||
@ -368,7 +368,7 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
// The snapshot was not successfully created
|
// The snapshot was not successfully created
|
||||||
createdSnapshot = _snapshotDao.findById(id);
|
createdSnapshot = _snapshotDao.findById(id);
|
||||||
// delete from the snapshots table
|
// delete from the snapshots table
|
||||||
_snapshotDao.delete(id);
|
_snapshotDao.expunge(id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,7 +431,7 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
if (answer.getResult()) {
|
if (answer.getResult()) {
|
||||||
// The expected snapshot details on the primary is the same as it would be if this snapshot was never taken at all
|
// The expected snapshot details on the primary is the same as it would be if this snapshot was never taken at all
|
||||||
// Just delete the entry in the table
|
// Just delete the entry in the table
|
||||||
_snapshotDao.delete(id);
|
_snapshotDao.expunge(id);
|
||||||
// Create an event saying the snapshot failed. ??
|
// Create an event saying the snapshot failed. ??
|
||||||
// An event is not generated when validatePreviousSnapshotBackup fails. So not generating it here too.
|
// An event is not generated when validatePreviousSnapshotBackup fails. So not generating it here too.
|
||||||
}
|
}
|
||||||
@ -566,7 +566,7 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
long pprevSnapshotId = prevSnapshot.getPrevSnapshotId();
|
long pprevSnapshotId = prevSnapshot.getPrevSnapshotId();
|
||||||
snapshot.setPrevSnapshotId(pprevSnapshotId);
|
snapshot.setPrevSnapshotId(pprevSnapshotId);
|
||||||
_snapshotDao.update(snapshot.getId(), snapshot);
|
_snapshotDao.update(snapshot.getId(), snapshot);
|
||||||
_snapshotDao.delete(prevSnapshot.getId());
|
_snapshotDao.expunge(prevSnapshot.getId());
|
||||||
|
|
||||||
EventVO event = new EventVO();
|
EventVO event = new EventVO();
|
||||||
String eventParams = "id=" + prevSnapshot.getId() + "\nssName=" + prevSnapshot.getName();
|
String eventParams = "id=" + prevSnapshot.getId() + "\nssName=" + prevSnapshot.getName();
|
||||||
@ -695,7 +695,7 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
SnapshotScheduleVO snapshotSchedule = _snapshotScheduleDao.getCurrentSchedule(volumeId, policyId, true);
|
SnapshotScheduleVO snapshotSchedule = _snapshotScheduleDao.getCurrentSchedule(volumeId, policyId, true);
|
||||||
if (snapshotSchedule != null) {
|
if (snapshotSchedule != null) {
|
||||||
// We should lock the row before deleting it as it is also being deleted by the scheduler.
|
// We should lock the row before deleting it as it is also being deleted by the scheduler.
|
||||||
_snapshotScheduleDao.delete(snapshotSchedule.getId());
|
_snapshotScheduleDao.expunge(snapshotSchedule.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -947,7 +947,7 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
if(isLastSnap){
|
if(isLastSnap){
|
||||||
_snapshotDao.remove(snapshotId);
|
_snapshotDao.remove(snapshotId);
|
||||||
} else {
|
} else {
|
||||||
_snapshotDao.delete(snapshotId);
|
_snapshotDao.expunge(snapshotId);
|
||||||
// In the snapshots table,
|
// In the snapshots table,
|
||||||
// the last_snapshot_id field of the next snapshot becomes the last_snapshot_id of the deleted snapshot
|
// the last_snapshot_id field of the next snapshot becomes the last_snapshot_id of the deleted snapshot
|
||||||
long prevSnapshotId = snapshot.getPrevSnapshotId();
|
long prevSnapshotId = snapshot.getPrevSnapshotId();
|
||||||
@ -1053,7 +1053,7 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
// Either way delete the snapshots for this volume.
|
// Either way delete the snapshots for this volume.
|
||||||
List<SnapshotVO> snapshots = listSnapsforVolume(volumeId);
|
List<SnapshotVO> snapshots = listSnapsforVolume(volumeId);
|
||||||
for (SnapshotVO snapshot: snapshots) {
|
for (SnapshotVO snapshot: snapshots) {
|
||||||
if(_snapshotDao.delete(snapshot.getId())){
|
if(_snapshotDao.expunge(snapshot.getId())){
|
||||||
_accountMgr.decrementResourceCount(accountId, ResourceType.snapshot);
|
_accountMgr.decrementResourceCount(accountId, ResourceType.snapshot);
|
||||||
|
|
||||||
//Log event after successful deletion
|
//Log event after successful deletion
|
||||||
@ -1197,7 +1197,7 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
// We can only delete the schedules in the future, not the ones which are already executing.
|
// We can only delete the schedules in the future, not the ones which are already executing.
|
||||||
SnapshotScheduleVO snapshotSchedule = _snapshotScheduleDao.getCurrentSchedule(volumeId, Snapshot.MANUAL_POLICY_ID, false);
|
SnapshotScheduleVO snapshotSchedule = _snapshotScheduleDao.getCurrentSchedule(volumeId, Snapshot.MANUAL_POLICY_ID, false);
|
||||||
if (snapshotSchedule != null) {
|
if (snapshotSchedule != null) {
|
||||||
_snapshotScheduleDao.delete(snapshotSchedule.getId());
|
_snapshotScheduleDao.expunge(snapshotSchedule.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1256,7 +1256,7 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(success){
|
if(success){
|
||||||
_snapshotDao.delete(snapshot.getId());
|
_snapshotDao.expunge(snapshot.getId());
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -313,7 +313,7 @@ public class SnapshotSchedulerImpl implements SnapshotScheduler {
|
|||||||
if (_snapshotScheduleDao.findById(expectedId) != null) {
|
if (_snapshotScheduleDao.findById(expectedId) != null) {
|
||||||
// We need to acquire a lock and delete it, then release the lock.
|
// We need to acquire a lock and delete it, then release the lock.
|
||||||
// But I don't know how to.
|
// But I don't know how to.
|
||||||
_snapshotScheduleDao.delete(expectedId);
|
_snapshotScheduleDao.expunge(expectedId);
|
||||||
}
|
}
|
||||||
if (policyId.longValue() == Snapshot.MANUAL_POLICY_ID) {
|
if (policyId.longValue() == Snapshot.MANUAL_POLICY_ID) {
|
||||||
// Don't need to schedule the next job for this.
|
// Don't need to schedule the next job for this.
|
||||||
@ -338,7 +338,7 @@ public class SnapshotSchedulerImpl implements SnapshotScheduler {
|
|||||||
SnapshotScheduleVO schedule = _snapshotScheduleDao.getCurrentSchedule(volumeId, policyId, false);
|
SnapshotScheduleVO schedule = _snapshotScheduleDao.getCurrentSchedule(volumeId, policyId, false);
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
if (schedule != null) {
|
if (schedule != null) {
|
||||||
success = _snapshotScheduleDao.delete(schedule.getId());
|
success = _snapshotScheduleDao.expunge(schedule.getId());
|
||||||
}
|
}
|
||||||
if(!success){
|
if(!success){
|
||||||
s_logger.debug("Error while deleting Snapshot schedule with Id: "+schedule.getId());
|
s_logger.debug("Error while deleting Snapshot schedule with Id: "+schedule.getId());
|
||||||
|
|||||||
@ -127,7 +127,7 @@ public class TemplateManagerImpl implements TemplateManager {
|
|||||||
|
|
||||||
VMTemplateVO template = new VMTemplateVO(id, name, format, isPublic, featured, fs, url.toString(), requiresHvm, bits, accountId, chksum, displayText, enablePassword, guestOSId, bootable);
|
VMTemplateVO template = new VMTemplateVO(id, name, format, isPublic, featured, fs, url.toString(), requiresHvm, bits, accountId, chksum, displayText, enablePassword, guestOSId, bootable);
|
||||||
if (zoneId == null) {
|
if (zoneId == null) {
|
||||||
List<DataCenterVO> dcs = _dcDao.listAll();
|
List<DataCenterVO> dcs = _dcDao.listAllIncludingRemoved();
|
||||||
|
|
||||||
for (DataCenterVO dc: dcs) {
|
for (DataCenterVO dc: dcs) {
|
||||||
_tmpltDao.addTemplateToZone(template, dc.getId());
|
_tmpltDao.addTemplateToZone(template, dc.getId());
|
||||||
|
|||||||
@ -1547,7 +1547,7 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||||||
} catch (Throwable th) {
|
} catch (Throwable th) {
|
||||||
s_logger.error("Unable to create vm", th);
|
s_logger.error("Unable to create vm", th);
|
||||||
if (vm != null) {
|
if (vm != null) {
|
||||||
_vmDao.delete(vmId);
|
_vmDao.expunge(vmId);
|
||||||
}
|
}
|
||||||
_accountMgr.decrementResourceCount(account.getId(), ResourceType.user_vm);
|
_accountMgr.decrementResourceCount(account.getId(), ResourceType.user_vm);
|
||||||
_accountMgr.decrementResourceCount(account.getId(), ResourceType.volume, numVolumes);
|
_accountMgr.decrementResourceCount(account.getId(), ResourceType.volume, numVolumes);
|
||||||
@ -2231,7 +2231,7 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||||||
|
|
||||||
if ((answer != null) && answer.getResult()) {
|
if ((answer != null) && answer.getResult()) {
|
||||||
// delete the snapshot from the database
|
// delete the snapshot from the database
|
||||||
_snapshotDao.delete(snapshotId);
|
_snapshotDao.expunge(snapshotId);
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
if (answer != null) {
|
if (answer != null) {
|
||||||
@ -2287,7 +2287,7 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||||||
Transaction txn = Transaction.currentTxn();
|
Transaction txn = Transaction.currentTxn();
|
||||||
txn.start();
|
txn.start();
|
||||||
createdSnapshot = _snapshotDao.findById(id);
|
createdSnapshot = _snapshotDao.findById(id);
|
||||||
_snapshotDao.delete(id);
|
_snapshotDao.expunge(id);
|
||||||
txn.commit();
|
txn.commit();
|
||||||
|
|
||||||
createdSnapshot = null;
|
createdSnapshot = null;
|
||||||
@ -2709,7 +2709,7 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||||||
boolean addedToGroups = _networkGroupManager.addInstanceToGroups(vmId, networkGroups);
|
boolean addedToGroups = _networkGroupManager.addInstanceToGroups(vmId, networkGroups);
|
||||||
if (!addedToGroups) {
|
if (!addedToGroups) {
|
||||||
s_logger.warn("Not all specified network groups can be found");
|
s_logger.warn("Not all specified network groups can be found");
|
||||||
_vmDao.delete(vm.getId());
|
_vmDao.expunge(vm.getId());
|
||||||
throw new InvalidParameterValueException("Not all specified network groups can be found");
|
throw new InvalidParameterValueException("Not all specified network groups can be found");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2717,7 +2717,7 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||||||
try {
|
try {
|
||||||
poolId = _storageMgr.createUserVM(account, vm, template, dc, pod.first(), offering, diskOffering, a,size);
|
poolId = _storageMgr.createUserVM(account, vm, template, dc, pod.first(), offering, diskOffering, a,size);
|
||||||
} catch (CloudRuntimeException e) {
|
} catch (CloudRuntimeException e) {
|
||||||
_vmDao.delete(vmId);
|
_vmDao.expunge(vmId);
|
||||||
_ipAddressDao.unassignIpAddress(guestIp);
|
_ipAddressDao.unassignIpAddress(guestIp);
|
||||||
s_logger.debug("Released a guest ip address because we could not find storage: ip=" + guestIp);
|
s_logger.debug("Released a guest ip address because we could not find storage: ip=" + guestIp);
|
||||||
guestIp = null;
|
guestIp = null;
|
||||||
@ -2878,7 +2878,7 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||||||
try {
|
try {
|
||||||
poolId = _storageMgr.createUserVM(account, vm, template, dc, pod.first(), offering, diskOffering,a,size);
|
poolId = _storageMgr.createUserVM(account, vm, template, dc, pod.first(), offering, diskOffering,a,size);
|
||||||
} catch (CloudRuntimeException e) {
|
} catch (CloudRuntimeException e) {
|
||||||
_vmDao.delete(vmId);
|
_vmDao.expunge(vmId);
|
||||||
_accountMgr.decrementResourceCount(account.getId(), ResourceType.user_vm);
|
_accountMgr.decrementResourceCount(account.getId(), ResourceType.user_vm);
|
||||||
_accountMgr.decrementResourceCount(account.getId(), ResourceType.volume, numVolumes);
|
_accountMgr.decrementResourceCount(account.getId(), ResourceType.volume, numVolumes);
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
|||||||
@ -125,14 +125,14 @@ public interface GenericDao<T, ID extends Serializable> {
|
|||||||
* Look for all active rows.
|
* Look for all active rows.
|
||||||
* @return list of entity beans.
|
* @return list of entity beans.
|
||||||
*/
|
*/
|
||||||
List<T> listAllActive();
|
List<T> listAll();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Look for all active rows.
|
* Look for all active rows.
|
||||||
* @param filter filter to limit the results
|
* @param filter filter to limit the results
|
||||||
* @return list of entity beans.
|
* @return list of entity beans.
|
||||||
*/
|
*/
|
||||||
List<T> listAllActive(Filter filter);
|
List<T> listAll(Filter filter);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -143,7 +143,7 @@ public interface GenericDao<T, ID extends Serializable> {
|
|||||||
*/
|
*/
|
||||||
List<T> search(SearchCriteria<T> sc, Filter filter);
|
List<T> search(SearchCriteria<T> sc, Filter filter);
|
||||||
|
|
||||||
List<T> searchAll(SearchCriteria<T> sc, final Filter filter, final Boolean lock, final boolean cache);
|
List<T> searchIncludingRemoved(SearchCriteria<T> sc, final Filter filter, final Boolean lock, final boolean cache);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Customized search with SearchCritiria
|
* Customized search with SearchCritiria
|
||||||
@ -151,20 +151,20 @@ public interface GenericDao<T, ID extends Serializable> {
|
|||||||
* @param filter
|
* @param filter
|
||||||
* @return list of entity beans.
|
* @return list of entity beans.
|
||||||
*/
|
*/
|
||||||
public <M> List<M> searchAll(SearchCriteria<M> sc, Filter filter);
|
public <M> List<M> searchIncludingRemoved(SearchCriteria<M> sc, Filter filter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the entire table.
|
* Retrieves the entire table.
|
||||||
* @return collection of entity beans.
|
* @return collection of entity beans.
|
||||||
**/
|
**/
|
||||||
List<T> listAll();
|
List<T> listAllIncludingRemoved();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the entire table.
|
* Retrieves the entire table.
|
||||||
* @param filter filter to limit the returns.
|
* @param filter filter to limit the returns.
|
||||||
* @return collection of entity beans.
|
* @return collection of entity beans.
|
||||||
**/
|
**/
|
||||||
List<T> listAll(Filter filter);
|
List<T> listAllIncludingRemoved(Filter filter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Persist the entity bean. The id field of the entity is updated with
|
* Persist the entity bean. The id field of the entity is updated with
|
||||||
@ -188,14 +188,14 @@ public interface GenericDao<T, ID extends Serializable> {
|
|||||||
* @param id
|
* @param id
|
||||||
* @return true if removed.
|
* @return true if removed.
|
||||||
*/
|
*/
|
||||||
boolean delete(ID id);
|
boolean expunge(ID id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* remove the entity bean specified by the search criteria
|
* remove the entity bean specified by the search criteria
|
||||||
* @param sc
|
* @param sc
|
||||||
* @return number of rows deleted
|
* @return number of rows deleted
|
||||||
*/
|
*/
|
||||||
int delete(final SearchCriteria<T> sc);
|
int expunge(final SearchCriteria<T> sc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* expunge the removed rows.
|
* expunge the removed rows.
|
||||||
|
|||||||
@ -293,11 +293,11 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
|
|||||||
}
|
}
|
||||||
sc.addAnd(_removed.second().field.getName(), SearchCriteria.Op.NULL);
|
sc.addAnd(_removed.second().field.getName(), SearchCriteria.Op.NULL);
|
||||||
}
|
}
|
||||||
return searchAll(sc, filter, lock, cache);
|
return searchIncludingRemoved(sc, filter, lock, cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<T> searchAll(SearchCriteria<T> sc, final Filter filter, final Boolean lock, final boolean cache) {
|
public List<T> searchIncludingRemoved(SearchCriteria<T> sc, final Filter filter, final Boolean lock, final boolean cache) {
|
||||||
String clause = sc != null ? sc.getWhereClause() : null;
|
String clause = sc != null ? sc.getWhereClause() : null;
|
||||||
if (clause != null && clause.length() == 0) {
|
if (clause != null && clause.length() == 0) {
|
||||||
clause = null;
|
clause = null;
|
||||||
@ -363,7 +363,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override @SuppressWarnings("unchecked") @DB
|
@Override @SuppressWarnings("unchecked") @DB
|
||||||
public <M> List<M> searchAll(SearchCriteria<M> sc, final Filter filter) {
|
public <M> List<M> searchIncludingRemoved(SearchCriteria<M> sc, final Filter filter) {
|
||||||
String clause = sc != null ? sc.getWhereClause() : null;
|
String clause = sc != null ? sc.getWhereClause() : null;
|
||||||
if (clause != null && clause.length() == 0) {
|
if (clause != null && clause.length() == 0) {
|
||||||
clause = null;
|
clause = null;
|
||||||
@ -723,7 +723,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
|
|||||||
|
|
||||||
protected T findOneBy(final SearchCriteria<T> sc) {
|
protected T findOneBy(final SearchCriteria<T> sc) {
|
||||||
Filter filter = new Filter(1);
|
Filter filter = new Filter(1);
|
||||||
List<T> results = searchAll(sc, filter, null, false);
|
List<T> results = searchIncludingRemoved(sc, filter, null, false);
|
||||||
assert results.size() <= 1 : "Didn't the limiting worked?";
|
assert results.size() <= 1 : "Didn't the limiting worked?";
|
||||||
return results.size() == 0 ? null : results.get(0);
|
return results.size() == 0 ? null : results.get(0);
|
||||||
}
|
}
|
||||||
@ -751,7 +751,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
|
|||||||
|
|
||||||
@DB(txn=false)
|
@DB(txn=false)
|
||||||
protected List<T> listBy(final SearchCriteria<T> sc, final Filter filter) {
|
protected List<T> listBy(final SearchCriteria<T> sc, final Filter filter) {
|
||||||
return searchAll(sc, filter, null, false);
|
return searchIncludingRemoved(sc, filter, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DB(txn=false)
|
@DB(txn=false)
|
||||||
@ -837,8 +837,8 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override @DB(txn=false)
|
@Override @DB(txn=false)
|
||||||
public List<T> listAll() {
|
public List<T> listAllIncludingRemoved() {
|
||||||
return listAll(null);
|
return listAllIncludingRemoved(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DB(txn=false)
|
@DB(txn=false)
|
||||||
@ -872,7 +872,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override @DB(txn=false)
|
@Override @DB(txn=false)
|
||||||
public List<T> listAll(final Filter filter) {
|
public List<T> listAllIncludingRemoved(final Filter filter) {
|
||||||
final StringBuilder sql = createPartialSelectSql(null, false);
|
final StringBuilder sql = createPartialSelectSql(null, false);
|
||||||
addFilter(sql, filter);
|
addFilter(sql, filter);
|
||||||
|
|
||||||
@ -903,14 +903,14 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override @DB(txn=false)
|
@Override @DB(txn=false)
|
||||||
public List<T> listAllActive() {
|
public List<T> listAll() {
|
||||||
return listAllActive(null);
|
return listAll(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @DB(txn=false)
|
@Override @DB(txn=false)
|
||||||
public List<T> listAllActive(final Filter filter) {
|
public List<T> listAll(final Filter filter) {
|
||||||
if (_removed == null) {
|
if (_removed == null) {
|
||||||
return listAll(filter);
|
return listAllIncludingRemoved(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder sql = createPartialSelectSql(null, true);
|
final StringBuilder sql = createPartialSelectSql(null, true);
|
||||||
@ -921,7 +921,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean delete(final ID id) {
|
public boolean expunge(final ID id) {
|
||||||
final Transaction txn = Transaction.currentTxn();
|
final Transaction txn = Transaction.currentTxn();
|
||||||
PreparedStatement pstmt = s_initStmt;
|
PreparedStatement pstmt = s_initStmt;
|
||||||
String sql = null;
|
String sql = null;
|
||||||
@ -952,7 +952,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
|
|||||||
|
|
||||||
// FIXME: Does not work for joins.
|
// FIXME: Does not work for joins.
|
||||||
@Override
|
@Override
|
||||||
public int delete(final SearchCriteria<T> sc) {
|
public int expunge(final SearchCriteria<T> sc) {
|
||||||
final StringBuilder str = new StringBuilder("DELETE FROM ");
|
final StringBuilder str = new StringBuilder("DELETE FROM ");
|
||||||
str.append(_table);
|
str.append(_table);
|
||||||
str.append(" WHERE ");
|
str.append(" WHERE ");
|
||||||
@ -1269,7 +1269,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
|
|||||||
@Override
|
@Override
|
||||||
public boolean remove(final ID id) {
|
public boolean remove(final ID id) {
|
||||||
if (_removeSql == null) {
|
if (_removeSql == null) {
|
||||||
return delete(id);
|
return expunge(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Transaction txn = Transaction.currentTxn();
|
final Transaction txn = Transaction.currentTxn();
|
||||||
@ -1299,7 +1299,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
|
|||||||
@Override
|
@Override
|
||||||
public int remove(SearchCriteria<T> sc) {
|
public int remove(SearchCriteria<T> sc) {
|
||||||
if (_removeSql == null) {
|
if (_removeSql == null) {
|
||||||
return delete(sc);
|
return expunge(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
T vo = createForUpdate();
|
T vo = createForUpdate();
|
||||||
@ -1337,7 +1337,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
|
|||||||
createCache(params);
|
createCache(params);
|
||||||
final boolean load = Boolean.parseBoolean((String)params.get("cache.preload"));
|
final boolean load = Boolean.parseBoolean((String)params.get("cache.preload"));
|
||||||
if (load) {
|
if (load) {
|
||||||
listAllActive();
|
listAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user