You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by huangchunmei <hu...@internetware.cn> on 2014/07/18 12:30:28 UTC

[Issue]: Wrong status of System VM after destroy them

Hi Alex,

 

For cloudStack 4.3, I found the status of SSVM and CPVM are always in
Destroyed status after destroyed them. This would lead to an issue that zone
could be deleted if there are VMs with Destroyed status.

Would you please help to check why we change the status to "Expunging", then
update it to "Destroyed"? Or I missed something, maybe other thread to
handle system VMs with "Destroyed" status.

Following are the related codes:

/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java,


public boolean destroyProxy(long vmId) {

        ConsoleProxyVO proxy = _consoleProxyDao.findById(vmId);

        try {

            //expunge the vm

            _itMgr.expunge(proxy.getUuid()); // change status to "Expunging"

            proxy.setPublicIpAddress(null);

            proxy.setPublicMacAddress(null);

            proxy.setPublicNetmask(null);

            proxy.setPrivateMacAddress(null);

            proxy.setPrivateIpAddress(null);

            _consoleProxyDao.update(proxy.getId(), proxy);

            _consoleProxyDao.remove(vmId); // change status to "Destroyed"

/engine/schema/src/com/cloud/vm/dao/ConsoleProxyDaoImpl.java


public boolean remove(Long id) {

        TransactionLegacy txn = TransactionLegacy.currentTxn();

        txn.start();

        ConsoleProxyVO proxy = createForUpdate();

        proxy.setPublicIpAddress(null);

        proxy.setPrivateIpAddress(null);

        

        UpdateBuilder ub = getUpdateBuilder(proxy);

        ub.set(proxy, "state", State.Destroyed);

        ub.set(proxy, "privateIpAddress", null);

        update(id, ub, proxy);

        

        boolean result = super.remove(id);

        txn.commit();

        return result;

    }

 

 

Thanks very much

Chunmei Huang