cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ustcweizhou <...@git.apache.org>
Subject [GitHub] cloudstack pull request #1726: CLOUDSTACK-9560 Root volume of deleted VM lef...
Date Wed, 26 Oct 2016 12:16:04 GMT
Github user ustcweizhou commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1726#discussion_r85108024
  
    --- Diff: server/src/com/cloud/storage/StorageManagerImpl.java ---
    @@ -2199,15 +2199,20 @@ public void cleanupDownloadUrls(){
                     if(downloadUrlCurrentAgeInSecs < _downloadUrlExpirationInterval){
 // URL hasnt expired yet
                         continue;
                     }
    -
    -                s_logger.debug("Removing download url " + volumeOnImageStore.getExtractUrl()
+ " for volume id " + volumeOnImageStore.getVolumeId());
    +                long volumeId = volumeOnImageStore.getVolumeId();
    +                s_logger.debug("Removing download url " + volumeOnImageStore.getExtractUrl()
+ " for volume id " + volumeId);
     
                     // Remove it from image store
                     ImageStoreEntity secStore = (ImageStoreEntity) _dataStoreMgr.getDataStore(volumeOnImageStore.getDataStoreId(),
DataStoreRole.Image);
                     secStore.deleteExtractUrl(volumeOnImageStore.getInstallPath(), volumeOnImageStore.getExtractUrl(),
Upload.Type.VOLUME);
     
                     // Now expunge it from DB since this entry was created only for download
purpose
                     _volumeStoreDao.expunge(volumeOnImageStore.getId());
    +                Volume volume = _volumeDao.findById(volumeId);
    +                if (volume != null && volume.getState() == Volume.State.Expunged)
    +                {
    +                    _volumeDao.remove(volumeId);
    +                }
    --- End diff --
    
    There might be multiple volume snapshot on image store.
    We need to make sure that all volume snapshot have been removed from image store.
    
    ```
    +                VolumeDataStoreVO volumesOnImageStore = _volumeStoreDao.findByVolume(volumeId);
    +                if (volumesOnImageStore == null) { // volume is expunged from primary,
as well as on secondary
    +                    VolumeVO vol = _volumeDao.findById(volumeId);
    +                    if (vol != null && (vol.getState() == Volume.State.Expunged))
{
    +                        _volumeDao.remove(volumeId);
    +                    }
    +                }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message