> On Nov. 27, 2014, 11:30 a.m., Rajani Karuturi wrote: > > Ship It!
Thanks for the detailed explanation and the patch. I will push this to the relevant branches. - Rajani ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/28511/#review63211 ----------------------------------------------------------- On Nov. 27, 2014, 10:38 a.m., Hiroki Ohashi wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/28511/ > ----------------------------------------------------------- > > (Updated Nov. 27, 2014, 10:38 a.m.) > > > Review request for cloudstack. > > > Bugs: CLOUDSTACK-7412 > https://issues.apache.org/jira/browse/CLOUDSTACK-7412 > > > Repository: cloudstack-git > > > Description > ------- > > [Abstract] > > Root cause of this issue is a way to handle cache using S3 as > Secondary Storage. > > When CloudStack uploads a disk image on Primary Storage(PS) to > Secondary Storage(SS), it caches the disk image on Secondary Staging > Store(SSS). This is a bug. > > CloudStack uses disk image cache every time if the cache exists. For > this behavior, the old cache on SSS will be uploaded as a template > though a CloudStack user creates the template from a newer disk image > on PS than the cache. > > So, we fixed this issue in a way that CloudStack deletes the cache on > SSS after CloudStack uploads disk image to SS. > > > [Details] > > Process of handling cache is different between copy from SS to > PS(download) and copy from PS to SS(upload). > > * Downloading a disk image from SS to PS > > This is the case that a CloudStack user creates an instance from a > template. CloudStack caches the image on SSS. > > * Uploading a disk image from PS to SS > > This is the case that a CloudStack user creates a template from a disk > image of an instance. CloudStack shouldn't cache a disk image because > it usually happens that a cache image is older than a volume of an > instance. > > However, there is a bug in branch condition about post process of > uploading a disk image. Then CloudStack doesn't delete the disk image > on SSS. > > CloudStack uses a common method to copy a disk image between PS and SS > for upload and download. The method includes post process of disk > image cache. > > As a part of post process, it is judged whether a disk image on SSS is > used as cache or not in this method: > > a. Delete a disk image as upload procedure > > b. Delete a disk image to handle errors > > c. Cache a disk image as download procedure > > In case of uploading a disk image, branch-a should be selected. But > branch-c is always selected by the condition bug. As a result, a disk > image is left on SSS and used as cache next time a CloudStack user > creates a template from an instance. > > > Diffs > ----- > > > engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java > d6759cb > > Diff: https://reviews.apache.org/r/28511/diff/ > > > Testing > ------- > > Items below are confirmed. > > - A template created from an instance reflects a volume of the instance. > - No cache file exists on NFS secondary staging store. > - No cache entry exists on template_store_ref. > > We use this patch in our environment. > > > Thanks, > > Hiroki Ohashi > >