diff --git a/api/src/com/cloud/vm/VirtualMachine.java b/api/src/com/cloud/vm/VirtualMachine.java index fee9806e11d..5a2a06603e4 100755 --- a/api/src/com/cloud/vm/VirtualMachine.java +++ b/api/src/com/cloud/vm/VirtualMachine.java @@ -163,6 +163,11 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, StateObject } } + /** + * @return The name of the vm instance used by the cloud stack to uniquely + * reference this VM. You can build names that starts with this name and it + * guarantees uniqueness for things related to the VM. + */ public String getInstanceName(); /** @@ -171,7 +176,9 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, StateObject public long getId(); /** - * @return the name of the virtual machine. + * @return the host name of the virtual machine. If the user did not + * specify the host name when creating the virtual machine then it is + * the name generated by cloud stack. */ public String getName(); @@ -220,6 +227,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, StateObject * @return id of the host it was assigned last time. */ public Long getLastHostId(); + @Override public Long getHostId(); public void setLastHostId(Long lastHostId); diff --git a/server/src/com/cloud/cluster/CheckPointManagerImpl.java b/server/src/com/cloud/cluster/CheckPointManagerImpl.java index 892a4cfaab1..5d74d1ac823 100644 --- a/server/src/com/cloud/cluster/CheckPointManagerImpl.java +++ b/server/src/com/cloud/cluster/CheckPointManagerImpl.java @@ -31,7 +31,6 @@ public class CheckPointManagerImpl implements CheckPointManager, Manager, Cluste private static final Logger s_logger = Logger.getLogger(CheckPointManagerImpl.class); private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION = 3; // 3 seconds - private static final int GC_INTERVAL = 10000; // 10 seconds private int _cleanupRetryInterval; private String _name; @@ -44,8 +43,6 @@ public class CheckPointManagerImpl implements CheckPointManager, Manager, Cluste long _msId; - private final ScheduledExecutorService _heartbeatScheduler = Executors.newScheduledThreadPool(1, new NamedThreadFactory("TaskMgr-Heartbeat")); - private final ScheduledExecutorService _cleanupScheduler = Executors.newScheduledThreadPool(1, new NamedThreadFactory("Task-Cleanup")); protected CheckPointManagerImpl() { @@ -119,14 +116,6 @@ public class CheckPointManagerImpl implements CheckPointManager, Manager, Cluste @Override public boolean start() { -// try { -// List l = _maidDao.listLeftoversByMsid(_clusterMgr.getManagementNodeId()); -// cleanupLeftovers(l); -// } catch (Throwable e) { -// s_logger.error("Unexpected exception " + e.getMessage(), e); -// } -// -// _heartbeatScheduler.scheduleAtFixedRate(getGCTask(), GC_INTERVAL, GC_INTERVAL, TimeUnit.MILLISECONDS); _cleanupScheduler.schedule(new CleanupTask(), _cleanupRetryInterval > 0 ? _cleanupRetryInterval : 600, TimeUnit.SECONDS); return true; } diff --git a/server/src/com/cloud/vm/dao/UserVmDao.java b/server/src/com/cloud/vm/dao/UserVmDao.java index 010f8f5e7ec..c3e6feb8c48 100755 --- a/server/src/com/cloud/vm/dao/UserVmDao.java +++ b/server/src/com/cloud/vm/dao/UserVmDao.java @@ -20,7 +20,6 @@ package com.cloud.vm.dao; import java.util.Date; import java.util.List; -import com.cloud.uservm.UserVm; import com.cloud.utils.db.GenericDao; import com.cloud.vm.UserVmVO; @@ -33,8 +32,6 @@ public interface UserVmDao extends GenericDao { List listByLastHostId(Long hostId); List listUpByHostId(Long hostId); - UserVmVO findByName(String name); - /** * Updates display name and group for vm; enables/disables ha * @param id vm id. @@ -62,7 +59,6 @@ public interface UserVmDao extends GenericDao { List listByNetworkId(long networkId); - UserVm findVmByZoneIdAndName(long zoneId, String name); List listByAccountIdAndHostId(long accountId, long hostId); void loadDetails(UserVmVO vm); diff --git a/server/src/com/cloud/vm/dao/UserVmDaoImpl.java b/server/src/com/cloud/vm/dao/UserVmDaoImpl.java index f0458ab669e..8b41f311259 100755 --- a/server/src/com/cloud/vm/dao/UserVmDaoImpl.java +++ b/server/src/com/cloud/vm/dao/UserVmDaoImpl.java @@ -29,20 +29,15 @@ import javax.ejb.Local; import org.apache.log4j.Logger; -import com.cloud.capacity.CapacityVO; -import com.cloud.host.HostVO; -import com.cloud.uservm.UserVm; import com.cloud.utils.component.ComponentLocator; import com.cloud.utils.db.Attribute; -import com.cloud.utils.db.Filter; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.GenericSearchBuilder; import com.cloud.utils.db.JoinBuilder; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; -import com.cloud.utils.db.Transaction; import com.cloud.utils.db.SearchCriteria.Func; -import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.db.Transaction; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.NicVO; import com.cloud.vm.UserVmVO; @@ -59,9 +54,7 @@ public class UserVmDaoImpl extends GenericDaoBase implements Use protected final SearchBuilder LastHostSearch; protected final SearchBuilder HostUpSearch; protected final SearchBuilder HostRunningSearch; - protected final SearchBuilder NameSearch; protected final SearchBuilder StateChangeSearch; - protected final SearchBuilder ZoneNameSearch; protected final SearchBuilder AccountHostSearch; protected final SearchBuilder DestroySearch; @@ -102,10 +95,6 @@ public class UserVmDaoImpl extends GenericDaoBase implements Use HostRunningSearch.and("state", HostRunningSearch.entity().getState(), SearchCriteria.Op.EQ); HostRunningSearch.done(); - NameSearch = createSearchBuilder(); - NameSearch.and("name", NameSearch.entity().getName(), SearchCriteria.Op.EQ); - NameSearch.done(); - AccountPodSearch = createSearchBuilder(); AccountPodSearch.and("account", AccountPodSearch.entity().getAccountId(), SearchCriteria.Op.EQ); AccountPodSearch.and("pod", AccountPodSearch.entity().getPodId(), SearchCriteria.Op.EQ); @@ -128,11 +117,6 @@ public class UserVmDaoImpl extends GenericDaoBase implements Use DestroySearch.and("updateTime", DestroySearch.entity().getUpdateTime(), SearchCriteria.Op.LT); DestroySearch.done(); - ZoneNameSearch = createSearchBuilder(); - ZoneNameSearch.and("dataCenterId", ZoneNameSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); - ZoneNameSearch.and("name", ZoneNameSearch.entity().getName(), SearchCriteria.Op.EQ); - ZoneNameSearch.done(); - AccountHostSearch = createSearchBuilder(); AccountHostSearch.and("accountId", AccountHostSearch.entity().getAccountId(), SearchCriteria.Op.EQ); AccountHostSearch.and("hostId", AccountHostSearch.entity().getHostId(), SearchCriteria.Op.EQ); @@ -216,13 +200,6 @@ public class UserVmDaoImpl extends GenericDaoBase implements Use return listBy(sc); } - - @Override - public UserVmVO findByName(String name) { - SearchCriteria sc = NameSearch.create(); - sc.setParameters("name", name); - return findOneIncludingRemovedBy(sc); - } @Override public List listVirtualNetworkInstancesByAcctAndZone(long accountId, long dcId, long networkId) { @@ -274,14 +251,6 @@ public class UserVmDaoImpl extends GenericDaoBase implements Use return listBy(sc); } - @Override - public UserVm findVmByZoneIdAndName(long zoneId, String name) { - SearchCriteria sc = ZoneNameSearch.create(); - sc.setParameters("dataCenterId", zoneId); - sc.setParameters("name", name); - return findOneBy(sc); - } - @Override public List listByAccountIdAndHostId(long accountId, long hostId) { SearchCriteria sc = AccountHostSearch.create();