mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
The location of the virtual machine is provided by DeployDestination, which will be passed in NetworkGuru#reserve and NetworkElement#prepare. During the virtual machine migration, it actually changes DeployDestination and it looks like that it will tell that event to network components as it has NetworkManager#prepareNicForMigration. The problem is that althogh the interface has that method, NetworkManagerImpl does not tell the DeployDestination changes to network components. So IMHO, we need to add calls of NetworkGuru#reserve and NetworkElement#prepare in NetworkManagerImpl#prepareNicForMigration . And then, we also need to add calls NetworkGuru#release and NetworkElement#release after the migration, otherwise the network resources that plugin reserved will be kept even when the vm leaves off. (Sheng Yang: rebase code, add license header) Signed-off-by: Sheng Yang <sheng.yang@citrix.com>
71 lines
2.8 KiB
Java
71 lines
2.8 KiB
Java
// Licensed to the Apache Software Foundation (ASF) under one
|
|
// or more contributor license agreements. See the NOTICE file
|
|
// distributed with this work for additional information
|
|
// regarding copyright ownership. The ASF licenses this file
|
|
// to you under the Apache License, Version 2.0 (the
|
|
// "License"); you may not use this file except in compliance
|
|
// with the License. You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing,
|
|
// software distributed under the License is distributed on an
|
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
// KIND, either express or implied. See the License for the
|
|
// specific language governing permissions and limitations
|
|
// under the License.
|
|
package com.cloud.network;
|
|
|
|
import com.cloud.deploy.DeployDestination;
|
|
import com.cloud.vm.NicProfile;
|
|
import com.cloud.vm.ReservationContext;
|
|
import com.cloud.vm.VirtualMachine;
|
|
import com.cloud.vm.VirtualMachineProfile;
|
|
|
|
/**
|
|
* NetworkGuru and NetworkElements that implement this interface
|
|
* will be called during Virtual Machine migration.
|
|
*/
|
|
public interface NetworkMigrationResponder {
|
|
/**
|
|
* Prepare for migration.
|
|
*
|
|
* This method will be called per nic before the vm migration.
|
|
* @param nic
|
|
* @param network
|
|
* @param vm
|
|
* @param dest
|
|
* @param context
|
|
* @return true when operation was successful.
|
|
*/
|
|
public boolean prepareMigration(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context);
|
|
|
|
/**
|
|
* Cancel for migration preparation.
|
|
*
|
|
* This method will be called per nic when the entire vm migration
|
|
* process failed and need to release the resouces that was
|
|
* allocated at the migration preparation.
|
|
* @param nic destination nic
|
|
* @param network destination network
|
|
* @param vm destination vm profile
|
|
* @param src The context nic migrates from.
|
|
* @param dst The context nic migrates to.
|
|
*/
|
|
public void rollbackMigration(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext src, ReservationContext dst);
|
|
|
|
/**
|
|
* Commit the migration resource.
|
|
*
|
|
* This method will be called per nic when the entire vm migration
|
|
* process was successful. This is useful to release the resource of
|
|
* source deployment where vm has left.
|
|
* @param nic source nic
|
|
* @param network source network
|
|
* @param vm source vm profile
|
|
* @param src the context nic migrates from.
|
|
* @param dst the context nic migrates to.
|
|
*/
|
|
public void commitMigration(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext src, ReservationContext dst);
|
|
}
|