mirror of https://github.com/apache/cloudstack.git
server: Do NOT cleanup dhcp and dns when stop a vm (#3627)
* server: Do NOT cleanup dhcp and dns when stop a vm
According comment in PR #3608, dhcp and dns entries are cleaned up only when a VM is expunged.
Revert part of commit 8fb388e931.
* server: cleanup dns/dhcp entries in removeNic instead of finalizeExpunge
This commit is contained in:
parent
b853ebd8f7
commit
cc27095554
|
|
@ -2014,6 +2014,15 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
|
||||
final List<NicVO> nics = _nicDao.listByVmId(vm.getId());
|
||||
for (final NicVO nic : nics) {
|
||||
final NetworkVO network = _networksDao.findById(nic.getNetworkId());
|
||||
if (network != null && network.getTrafficType() == TrafficType.Guest) {
|
||||
final String nicIp = Strings.isNullOrEmpty(nic.getIPv4Address()) ? nic.getIPv6Address() : nic.getIPv4Address();
|
||||
if (!Strings.isNullOrEmpty(nicIp)) {
|
||||
NicProfile nicProfile = new NicProfile(nic.getIPv4Address(), nic.getIPv6Address(), nic.getMacAddress());
|
||||
nicProfile.setId(nic.getId());
|
||||
cleanupNicDhcpDnsEntry(network, vm, nicProfile);
|
||||
}
|
||||
}
|
||||
removeNic(vm, nic);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -896,7 +896,6 @@ NetworkMigrationResponder, AggregatedCommandExecutor, RedundantResource, DnsServ
|
|||
@Override
|
||||
public boolean release(final Network network, final NicProfile nic, final VirtualMachineProfile vm, final ReservationContext context) throws ConcurrentOperationException,
|
||||
ResourceUnavailableException {
|
||||
removeDhcpEntry(network, nic, vm);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -312,7 +312,6 @@ import com.cloud.vm.dao.VMInstanceDao;
|
|||
import com.cloud.vm.snapshot.VMSnapshotManager;
|
||||
import com.cloud.vm.snapshot.VMSnapshotVO;
|
||||
import com.cloud.vm.snapshot.dao.VMSnapshotDao;
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
public class UserVmManagerImpl extends ManagerBase implements UserVmManager, VirtualMachineGuru, UserVmService, Configurable {
|
||||
private static final Logger s_logger = Logger.getLogger(UserVmManagerImpl.class);
|
||||
|
|
@ -4479,19 +4478,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||
|
||||
@Override
|
||||
public void finalizeExpunge(VirtualMachine vm) {
|
||||
final VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
|
||||
final List<NicVO> nics = _nicDao.listByVmId(vm.getId());
|
||||
for (final NicVO nic : nics) {
|
||||
final NetworkVO network = _networkDao.findById(nic.getNetworkId());
|
||||
if (network != null && network.getTrafficType() == TrafficType.Guest) {
|
||||
final String nicIp = Strings.isNullOrEmpty(nic.getIPv4Address()) ? nic.getIPv6Address() : nic.getIPv4Address();
|
||||
if (!Strings.isNullOrEmpty(nicIp)) {
|
||||
NicProfile nicProfile = new NicProfile(nic.getIPv4Address(), nic.getIPv6Address(), nic.getMacAddress());
|
||||
nicProfile.setId(nic.getId());
|
||||
_networkMgr.cleanupNicDhcpDnsEntry(network, profile, nicProfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue