ForceDeleteDSTask.java 文件源码

java
阅读 33 收藏 0 点赞 0 评论 0

项目:osc-core 作者:
@Override
public void executeTransaction(EntityManager em) {
    log.info("Force Deleting Deployment Specification: " + this.ds.getName());
    // load deployment spec from database to avoid lazy loading issues
    this.ds = DeploymentSpecEntityMgr.findById(em, this.ds.getId());

    // remove DAI(s) for this ds
    for (DistributedApplianceInstance dai : this.ds.getDistributedApplianceInstances()) {
        dai.getProtectedPorts().clear();
        OSCEntityManager.delete(em, dai, this.txBroadcastUtil);
    }

    // remove the sg reference from database
    if (this.ds.getVirtualSystem().getVirtualizationConnector().getVirtualizationType().isOpenstack()) {
        boolean osSgCanBeDeleted = DeploymentSpecEntityMgr.findDeploymentSpecsByVirtualSystemProjectAndRegion(em,
                this.ds.getVirtualSystem(), this.ds.getProjectId(), this.ds.getRegion()).size() <= 1;

        if (osSgCanBeDeleted && this.ds.getOsSecurityGroupReference() != null) {
            OSCEntityManager.delete(em, this.ds.getOsSecurityGroupReference(), this.txBroadcastUtil);
        }
    }

    // delete DS from the database
    OSCEntityManager.delete(em, this.ds, this.txBroadcastUtil);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号