|
40 | 40 | import javax.inject.Inject; |
41 | 41 | import javax.naming.ConfigurationException; |
42 | 42 |
|
43 | | -import com.cloud.storage.TemplateOVFPropertyVO; |
44 | | -import com.cloud.storage.dao.TemplateOVFPropertiesDao; |
45 | 43 | import org.apache.cloudstack.acl.ControlledEntity.ACLType; |
46 | 44 | import org.apache.cloudstack.acl.SecurityChecker.AccessType; |
47 | 45 | import org.apache.cloudstack.affinity.AffinityGroupService; |
|
101 | 99 | import org.apache.commons.lang3.StringUtils; |
102 | 100 | import org.apache.log4j.Logger; |
103 | 101 |
|
104 | | -import com.cloud.hypervisor.kvm.dpdk.DpdkHelper; |
105 | 102 | import com.cloud.agent.AgentManager; |
106 | 103 | import com.cloud.agent.api.Answer; |
107 | 104 | import com.cloud.agent.api.Command; |
|
186 | 183 | import com.cloud.hypervisor.Hypervisor.HypervisorType; |
187 | 184 | import com.cloud.hypervisor.HypervisorCapabilitiesVO; |
188 | 185 | import com.cloud.hypervisor.dao.HypervisorCapabilitiesDao; |
| 186 | +import com.cloud.hypervisor.kvm.dpdk.DpdkHelper; |
189 | 187 | import com.cloud.network.IpAddressManager; |
190 | 188 | import com.cloud.network.Network; |
191 | 189 | import com.cloud.network.Network.IpAddresses; |
|
243 | 241 | import com.cloud.storage.Storage.TemplateType; |
244 | 242 | import com.cloud.storage.StoragePool; |
245 | 243 | import com.cloud.storage.StoragePoolStatus; |
| 244 | +import com.cloud.storage.TemplateOVFPropertyVO; |
246 | 245 | import com.cloud.storage.VMTemplateStorageResourceAssoc; |
247 | 246 | import com.cloud.storage.VMTemplateVO; |
248 | 247 | import com.cloud.storage.VMTemplateZoneVO; |
|
253 | 252 | import com.cloud.storage.dao.GuestOSCategoryDao; |
254 | 253 | import com.cloud.storage.dao.GuestOSDao; |
255 | 254 | import com.cloud.storage.dao.SnapshotDao; |
| 255 | +import com.cloud.storage.dao.TemplateOVFPropertiesDao; |
256 | 256 | import com.cloud.storage.dao.VMTemplateDao; |
257 | 257 | import com.cloud.storage.dao.VMTemplateZoneDao; |
258 | 258 | import com.cloud.storage.dao.VolumeDao; |
@@ -4479,6 +4479,19 @@ public void doInTransactionWithoutResult(TransactionStatus status) { |
4479 | 4479 |
|
4480 | 4480 | @Override |
4481 | 4481 | public void finalizeExpunge(VirtualMachine vm) { |
| 4482 | + final VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm); |
| 4483 | + final List<NicVO> nics = _nicDao.listByVmId(vm.getId()); |
| 4484 | + for (final NicVO nic : nics) { |
| 4485 | + final NetworkVO network = _networkDao.findById(nic.getNetworkId()); |
| 4486 | + if (network != null && network.getTrafficType() == TrafficType.Guest) { |
| 4487 | + final String nicIp = Strings.isNullOrEmpty(nic.getIPv4Address()) ? nic.getIPv6Address() : nic.getIPv4Address(); |
| 4488 | + if (!Strings.isNullOrEmpty(nicIp)) { |
| 4489 | + NicProfile nicProfile = new NicProfile(nic.getIPv4Address(), nic.getIPv6Address(), nic.getMacAddress()); |
| 4490 | + nicProfile.setId(nic.getId()); |
| 4491 | + _networkMgr.cleanupNicDhcpDnsEntry(network, profile, nicProfile); |
| 4492 | + } |
| 4493 | + } |
| 4494 | + } |
4482 | 4495 | } |
4483 | 4496 |
|
4484 | 4497 | @Override |
@@ -4542,12 +4555,6 @@ public void finalizeStop(VirtualMachineProfile profile, Answer answer) { |
4542 | 4555 | for (final NicVO nic : nics) { |
4543 | 4556 | final NetworkVO network = _networkDao.findById(nic.getNetworkId()); |
4544 | 4557 | if (network != null && network.getTrafficType() == TrafficType.Guest) { |
4545 | | - final String nicIp = Strings.isNullOrEmpty(nic.getIPv4Address()) ? nic.getIPv6Address() : nic.getIPv4Address(); |
4546 | | - if (!Strings.isNullOrEmpty(nicIp)) { |
4547 | | - NicProfile nicProfile = new NicProfile(nic.getIPv4Address(), nic.getIPv6Address(), nic.getMacAddress()); |
4548 | | - nicProfile.setId(nic.getId()); |
4549 | | - _networkMgr.cleanupNicDhcpDnsEntry(network, profile, nicProfile); |
4550 | | - } |
4551 | 4558 | if (nic.getBroadcastUri() != null && nic.getBroadcastUri().getScheme().equals("pvlan")) { |
4552 | 4559 | NicProfile nicProfile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), 0, false, "pvlan-nic"); |
4553 | 4560 | setupVmForPvlan(false, vm.getHostId(), nicProfile); |
|
0 commit comments