/**
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
*/
package com.cloud.vm.dao;
import java.util.Date;
import java.util.List;
import com.cloud.utils.db.GenericDao;
import com.cloud.utils.fsm.StateDao;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.State;
/*
* Data Access Object for vm_instance table
*/
public interface VMInstanceDao extends GenericDao, StateDao {
/**
* What are the vms running on this host?
* @param hostId host.
* @return list of VMInstanceVO running on that host.
*/
List listByHostId(long hostId);
/**
* List VMs by zone ID
* @param zoneId
* @return list of VMInstanceVO in the specified zone
*/
List listByZoneId(long zoneId);
/**
* Lists non-expunged VMs by zone ID and templateId
* @param zoneId
* @return list of VMInstanceVO in the specified zone, deployed from the specified template, that are not expunged
*/
public List listNonExpungedByZoneAndTemplate(long zoneId, long templateId);
/**
* Find vm instance with names like.
*
* @param name name that fits SQL like.
* @return list of VMInstanceVO
*/
List findVMInstancesLike(String name);
List findVMInTransition(Date time, State... states);
List listByTypes(VirtualMachine.Type... types);
VMInstanceVO findByIdTypes(long id, VirtualMachine.Type... types);
void updateProxyId(long id, Long proxyId, Date time);
List listByHostIdTypes(long hostid, VirtualMachine.Type... types);
List listUpByHostIdTypes(long hostid, VirtualMachine.Type... types);
List listByZoneIdAndType(long zoneId, VirtualMachine.Type type);
List listUpByHostId(Long hostId);
List listByLastHostId(Long hostId);
List listByTypeAndState(State state, VirtualMachine.Type type);
List listByAccountId(long accountId);
public Long countAllocatedVirtualRoutersForAccount(long accountId);
List listByClusterId(long clusterId);
}