Search in sources :

Example 6 with VMNetworkMapVO

use of org.apache.cloudstack.engine.cloud.entity.api.db.VMNetworkMapVO in project cloudstack by apache.

the class VMNetworkMapDaoImpl method persist.

@Override
public void persist(long vmId, List<Long> networks) {
    TransactionLegacy txn = TransactionLegacy.currentTxn();
    txn.start();
    SearchCriteria<VMNetworkMapVO> sc = VmIdSearch.create();
    sc.setParameters("vmId", vmId);
    expunge(sc);
    for (Long networkId : networks) {
        VMNetworkMapVO vo = new VMNetworkMapVO(vmId, networkId);
        persist(vo);
    }
    txn.commit();
}
Also used : TransactionLegacy(com.cloud.utils.db.TransactionLegacy) VMNetworkMapVO(org.apache.cloudstack.engine.cloud.entity.api.db.VMNetworkMapVO)

Aggregations

VMNetworkMapVO (org.apache.cloudstack.engine.cloud.entity.api.db.VMNetworkMapVO)6 NicProfile (com.cloud.vm.NicProfile)3 DeployDestination (com.cloud.deploy.DeployDestination)2 Host (com.cloud.host.Host)2 NetworkVO (com.cloud.network.dao.NetworkVO)2 PhysicalNetworkVO (com.cloud.network.dao.PhysicalNetworkVO)2 NetworkGuru (com.cloud.network.guru.NetworkGuru)2 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)2 NicVO (com.cloud.vm.NicVO)2 VirtualMachine (com.cloud.vm.VirtualMachine)2 DataCenter (com.cloud.dc.DataCenter)1 ConcurrentOperationException (com.cloud.exception.ConcurrentOperationException)1 InsufficientAddressCapacityException (com.cloud.exception.InsufficientAddressCapacityException)1 InsufficientCapacityException (com.cloud.exception.InsufficientCapacityException)1 InsufficientVirtualNetworkCapacityException (com.cloud.exception.InsufficientVirtualNetworkCapacityException)1 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)1 Network (com.cloud.network.Network)1 Provider (com.cloud.network.Network.Provider)1 PhysicalNetwork (com.cloud.network.PhysicalNetwork)1 ConfigDriveNetworkElement (com.cloud.network.element.ConfigDriveNetworkElement)1