Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import static org.zstack.core.Platform.operr;
import static org.zstack.utils.clouderrorcode.CloudOperationsErrorCode.*;

public class VmInstanceDeviceManagerImpl implements VmInstanceDeviceManager {
public class VmInstanceDeviceManagerImpl implements VmInstanceDeviceManager, VmJustBeforeDeleteFromDbExtensionPoint {
private static final CLogger logger = Utils.getLogger(VmInstanceDeviceManagerImpl.class);
@Autowired
private DatabaseFacade dbf;
Expand Down Expand Up @@ -340,6 +340,11 @@ public List<VmInstanceDeviceAddressArchiveVO> getAddressArchiveInfoFromArchiveFo
.list();
}

@Override
public void vmJustBeforeDeleteFromDb(VmInstanceInventory inv) {
deleteVmDeviceAddress(inv.getUuid());
}

private boolean vmExists(String vmInstanceUuid) {
return dbf.isExist(vmInstanceUuid, VmInstanceVO.class);
}
Expand Down
6 changes: 5 additions & 1 deletion conf/springConfigXml/VmInstanceManager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,11 @@
</zstack:plugin>
</bean>

<bean id="VmInstanceDeviceManager" class="org.zstack.compute.vm.devices.VmInstanceDeviceManagerImpl"/>
<bean id="VmInstanceDeviceManager" class="org.zstack.compute.vm.devices.VmInstanceDeviceManagerImpl">
<zstack:plugin>
<zstack:extension interface="org.zstack.header.vm.VmJustBeforeDeleteFromDbExtensionPoint"/>
</zstack:plugin>
</bean>

<util:list id="SupportNicDriverTypes">
<value>virtio</value>
Expand Down