You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Tomasz Zięba <t....@gmail.com> on 2014/07/23 13:15:29 UTC

download template -> delete vhd

Hello,

Could someone confirm that download template deletes the vhd file from
secondary storage.

We are testing on the ACS version 4.2.1 but the code responsible for
removing is the same in version 4.4

https://github.com/apache/cloudstack/blob/8b6dc7ce2f0058b9cf29bd9c72e4e0db9162fe6e/services/secondary-storage/server/src/org/apache/cloudstack/storage/template/UploadManagerImpl.java

funkcja: handleDeleteEntityDownloadURLCommand


-- 
Regards,
Tomasz Zięba
Twitter: @TZieba
LinkedIn: pl.linkedin.com/pub/tomasz-zięba-ph-d/3b/7a8/ab6/
<http://pl.linkedin.com/pub/tomasz-zi%C4%99ba-ph-d/3b/7a8/ab6/>

Re: download template -> delete vhd

Posted by Nitin Mehta <Ni...@citrix.com>.
Tomasz -  This fix works but you should rather make the fix on the MS code
which sends the deletion command rather than on the systemvm side.
Moreover if you stop/start ssvm you would loose this jar. You have to
rebuild systemvm.iso and put it back on the host (depends on hypervisor in
use). My suggestion is to change the following hardcoding in the command
below. It should be Upload.Type.VOLUME when you are deleting the volume
link and should be Upload.Type.TEMPLATE when deleting template link.

DeleteEntityDownloadURLCommand cmd = new
DeleteEntityDownloadURLCommand(installPath, Upload.Type.VOLUME,
downloadUrl, ((ImageStoreEntity) store).getMountPoint());


Thanks,
-Nitin

On 24/07/14 2:16 AM, "Tomasz Zięba" <t....@gmail.com> wrote:

>Hello,
>
>https://github.com/apache/cloudstack/blob/master/services/secondary-storag
>e/server/src/org/apache/cloudstack/storage/template/UploadManagerImpl.java
>
>We analyzed that the problem is in this line:
>
>        if (cmd.getType() == Upload.Type.VOLUME) {
>
>This line is always true because cmd.getType() return Type.VOLUME also
>when
>function call concern the snapshot.
>
>We made some small modification:
>
>        String VOLUME_ROOT_DIR = "volumes";
>        if((cmd.getType() == Upload.Type.VOLUME) &&
>(cmd.getPath().toString().toLowerCase().contains(VOLUME_ROOT_DIR.toLowerCa
>se()))){
>
>
>and evertything is OK.
>
>Unfortunately this change cause to rebuild systemvm (replace
>cloud-secondary-storage-4.2.1.jar).
>
>If you saying that in version 4.4 this error is corrected it will have to
>happen somewhere in creating the cmd object and the call cmd.getType ()
>return type is different than the VOLUME.
>
>
>
>
>2014-07-23 19:48 GMT+02:00 Min Chen <mi...@citrix.com>:
>
>> In current ACS master, Template is not deleted from secondary storage
>>when
>> extractTemplate is called, just its symlink is deleted.
>>
>> Thanks
>> -min
>>
>> On 7/23/14 4:15 AM, "Tomasz Zięba" <t....@gmail.com> wrote:
>>
>> >Hello,
>> >
>> >Could someone confirm that download template deletes the vhd file from
>> >secondary storage.
>> >
>> >We are testing on the ACS version 4.2.1 but the code responsible for
>> >removing is the same in version 4.4
>> >
>> >
>> 
>>https://github.com/apache/cloudstack/blob/8b6dc7ce2f0058b9cf29bd9c72e4e0d
>>b
>> 
>>>9162fe6e/services/secondary-storage/server/src/org/apache/cloudstack/sto
>>>ra
>> >ge/template/UploadManagerImpl.java
>> >
>> >funkcja: handleDeleteEntityDownloadURLCommand
>> >
>> >
>> >--
>> >Regards,
>> >Tomasz Zięba
>> >Twitter: @TZieba
>> >LinkedIn: pl.linkedin.com/pub/tomasz-zięba-ph-d/3b/7a8/ab6/
>> <http://pl.linkedin.com/pub/tomasz-zi%C4%99ba-ph-d/3b/7a8/ab6/>
>> ><http://pl.linkedin.com/pub/tomasz-zi%C4%99ba-ph-d/3b/7a8/ab6/>
>>
>>
>
>
>-- 
>Regards,
>Tomasz Zięba
>Twitter: @TZieba
>LinkedIn: pl.linkedin.com/pub/tomasz-zięba-ph-d/3b/7a8/ab6/
><http://pl.linkedin.com/pub/tomasz-zi%C4%99ba-ph-d/3b/7a8/ab6/>


Re: download template -> delete vhd

Posted by Nitin Mehta <Ni...@citrix.com>.
Tomasz -  This fix works but you should rather make the fix on the MS code
which sends the deletion command rather than on the systemvm side.
Moreover if you stop/start ssvm you would loose this jar. You have to
rebuild systemvm.iso and put it back on the host (depends on hypervisor in
use). My suggestion is to change the following hardcoding in the command
below. It should be Upload.Type.VOLUME when you are deleting the volume
link and should be Upload.Type.TEMPLATE when deleting template link.

DeleteEntityDownloadURLCommand cmd = new
DeleteEntityDownloadURLCommand(installPath, Upload.Type.VOLUME,
downloadUrl, ((ImageStoreEntity) store).getMountPoint());


Thanks,
-Nitin

On 24/07/14 2:16 AM, "Tomasz Zięba" <t....@gmail.com> wrote:

>Hello,
>
>https://github.com/apache/cloudstack/blob/master/services/secondary-storag
>e/server/src/org/apache/cloudstack/storage/template/UploadManagerImpl.java
>
>We analyzed that the problem is in this line:
>
>        if (cmd.getType() == Upload.Type.VOLUME) {
>
>This line is always true because cmd.getType() return Type.VOLUME also
>when
>function call concern the snapshot.
>
>We made some small modification:
>
>        String VOLUME_ROOT_DIR = "volumes";
>        if((cmd.getType() == Upload.Type.VOLUME) &&
>(cmd.getPath().toString().toLowerCase().contains(VOLUME_ROOT_DIR.toLowerCa
>se()))){
>
>
>and evertything is OK.
>
>Unfortunately this change cause to rebuild systemvm (replace
>cloud-secondary-storage-4.2.1.jar).
>
>If you saying that in version 4.4 this error is corrected it will have to
>happen somewhere in creating the cmd object and the call cmd.getType ()
>return type is different than the VOLUME.
>
>
>
>
>2014-07-23 19:48 GMT+02:00 Min Chen <mi...@citrix.com>:
>
>> In current ACS master, Template is not deleted from secondary storage
>>when
>> extractTemplate is called, just its symlink is deleted.
>>
>> Thanks
>> -min
>>
>> On 7/23/14 4:15 AM, "Tomasz Zięba" <t....@gmail.com> wrote:
>>
>> >Hello,
>> >
>> >Could someone confirm that download template deletes the vhd file from
>> >secondary storage.
>> >
>> >We are testing on the ACS version 4.2.1 but the code responsible for
>> >removing is the same in version 4.4
>> >
>> >
>> 
>>https://github.com/apache/cloudstack/blob/8b6dc7ce2f0058b9cf29bd9c72e4e0d
>>b
>> 
>>>9162fe6e/services/secondary-storage/server/src/org/apache/cloudstack/sto
>>>ra
>> >ge/template/UploadManagerImpl.java
>> >
>> >funkcja: handleDeleteEntityDownloadURLCommand
>> >
>> >
>> >--
>> >Regards,
>> >Tomasz Zięba
>> >Twitter: @TZieba
>> >LinkedIn: pl.linkedin.com/pub/tomasz-zięba-ph-d/3b/7a8/ab6/
>> <http://pl.linkedin.com/pub/tomasz-zi%C4%99ba-ph-d/3b/7a8/ab6/>
>> ><http://pl.linkedin.com/pub/tomasz-zi%C4%99ba-ph-d/3b/7a8/ab6/>
>>
>>
>
>
>-- 
>Regards,
>Tomasz Zięba
>Twitter: @TZieba
>LinkedIn: pl.linkedin.com/pub/tomasz-zięba-ph-d/3b/7a8/ab6/
><http://pl.linkedin.com/pub/tomasz-zi%C4%99ba-ph-d/3b/7a8/ab6/>


Re: download template -> delete vhd

Posted by Tomasz Zięba <t....@gmail.com>.
Hello,

https://github.com/apache/cloudstack/blob/master/services/secondary-storage/server/src/org/apache/cloudstack/storage/template/UploadManagerImpl.java

We analyzed that the problem is in this line:

        if (cmd.getType() == Upload.Type.VOLUME) {

This line is always true because cmd.getType() return Type.VOLUME also when
function call concern the snapshot.

We made some small modification:

        String VOLUME_ROOT_DIR = "volumes";
        if((cmd.getType() == Upload.Type.VOLUME) &&
(cmd.getPath().toString().toLowerCase().contains(VOLUME_ROOT_DIR.toLowerCase()))){


and evertything is OK.

Unfortunately this change cause to rebuild systemvm (replace
cloud-secondary-storage-4.2.1.jar).

If you saying that in version 4.4 this error is corrected it will have to
happen somewhere in creating the cmd object and the call cmd.getType ()
return type is different than the VOLUME.




2014-07-23 19:48 GMT+02:00 Min Chen <mi...@citrix.com>:

> In current ACS master, Template is not deleted from secondary storage when
> extractTemplate is called, just its symlink is deleted.
>
> Thanks
> -min
>
> On 7/23/14 4:15 AM, "Tomasz Zięba" <t....@gmail.com> wrote:
>
> >Hello,
> >
> >Could someone confirm that download template deletes the vhd file from
> >secondary storage.
> >
> >We are testing on the ACS version 4.2.1 but the code responsible for
> >removing is the same in version 4.4
> >
> >
> https://github.com/apache/cloudstack/blob/8b6dc7ce2f0058b9cf29bd9c72e4e0db
> >9162fe6e/services/secondary-storage/server/src/org/apache/cloudstack/stora
> >ge/template/UploadManagerImpl.java
> >
> >funkcja: handleDeleteEntityDownloadURLCommand
> >
> >
> >--
> >Regards,
> >Tomasz Zięba
> >Twitter: @TZieba
> >LinkedIn: pl.linkedin.com/pub/tomasz-zięba-ph-d/3b/7a8/ab6/
> <http://pl.linkedin.com/pub/tomasz-zi%C4%99ba-ph-d/3b/7a8/ab6/>
> ><http://pl.linkedin.com/pub/tomasz-zi%C4%99ba-ph-d/3b/7a8/ab6/>
>
>


-- 
Regards,
Tomasz Zięba
Twitter: @TZieba
LinkedIn: pl.linkedin.com/pub/tomasz-zięba-ph-d/3b/7a8/ab6/
<http://pl.linkedin.com/pub/tomasz-zi%C4%99ba-ph-d/3b/7a8/ab6/>

Re: download template -> delete vhd

Posted by Tomasz Zięba <t....@gmail.com>.
Hello,

https://github.com/apache/cloudstack/blob/master/services/secondary-storage/server/src/org/apache/cloudstack/storage/template/UploadManagerImpl.java

We analyzed that the problem is in this line:

        if (cmd.getType() == Upload.Type.VOLUME) {

This line is always true because cmd.getType() return Type.VOLUME also when
function call concern the snapshot.

We made some small modification:

        String VOLUME_ROOT_DIR = "volumes";
        if((cmd.getType() == Upload.Type.VOLUME) &&
(cmd.getPath().toString().toLowerCase().contains(VOLUME_ROOT_DIR.toLowerCase()))){


and evertything is OK.

Unfortunately this change cause to rebuild systemvm (replace
cloud-secondary-storage-4.2.1.jar).

If you saying that in version 4.4 this error is corrected it will have to
happen somewhere in creating the cmd object and the call cmd.getType ()
return type is different than the VOLUME.




2014-07-23 19:48 GMT+02:00 Min Chen <mi...@citrix.com>:

> In current ACS master, Template is not deleted from secondary storage when
> extractTemplate is called, just its symlink is deleted.
>
> Thanks
> -min
>
> On 7/23/14 4:15 AM, "Tomasz Zięba" <t....@gmail.com> wrote:
>
> >Hello,
> >
> >Could someone confirm that download template deletes the vhd file from
> >secondary storage.
> >
> >We are testing on the ACS version 4.2.1 but the code responsible for
> >removing is the same in version 4.4
> >
> >
> https://github.com/apache/cloudstack/blob/8b6dc7ce2f0058b9cf29bd9c72e4e0db
> >9162fe6e/services/secondary-storage/server/src/org/apache/cloudstack/stora
> >ge/template/UploadManagerImpl.java
> >
> >funkcja: handleDeleteEntityDownloadURLCommand
> >
> >
> >--
> >Regards,
> >Tomasz Zięba
> >Twitter: @TZieba
> >LinkedIn: pl.linkedin.com/pub/tomasz-zięba-ph-d/3b/7a8/ab6/
> <http://pl.linkedin.com/pub/tomasz-zi%C4%99ba-ph-d/3b/7a8/ab6/>
> ><http://pl.linkedin.com/pub/tomasz-zi%C4%99ba-ph-d/3b/7a8/ab6/>
>
>


-- 
Regards,
Tomasz Zięba
Twitter: @TZieba
LinkedIn: pl.linkedin.com/pub/tomasz-zięba-ph-d/3b/7a8/ab6/
<http://pl.linkedin.com/pub/tomasz-zi%C4%99ba-ph-d/3b/7a8/ab6/>

Re: download template -> delete vhd

Posted by Nitin Mehta <Ni...@citrix.com>.
Tomas - Its not the same, there have been fixes made in ACS master/4.4.
But as Min pointed out in current ACS it works fine and deletes only the
symlink.
To work around the situation in 4.2.1 you can try setting
extract.url.expiration.interval (the value is in seconds ) in global
settings to a large value (say 14400000 -- 4000 hrs ) so that the download
url never expire and do not delete the template.
Hope it helps. 

Thanks,
-Nitin



On 23/07/14 10:48 AM, "Min Chen" <mi...@citrix.com> wrote:

>In current ACS master, Template is not deleted from secondary storage when
>extractTemplate is called, just its symlink is deleted.
>
>Thanks
>-min
>
>On 7/23/14 4:15 AM, "Tomasz Zięba" <t....@gmail.com> wrote:
>
>>Hello,
>>
>>Could someone confirm that download template deletes the vhd file from
>>secondary storage.
>>
>>We are testing on the ACS version 4.2.1 but the code responsible for
>>removing is the same in version 4.4
>>
>>https://github.com/apache/cloudstack/blob/8b6dc7ce2f0058b9cf29bd9c72e4e0d
>>b
>>9162fe6e/services/secondary-storage/server/src/org/apache/cloudstack/stor
>>a
>>ge/template/UploadManagerImpl.java
>>
>>funkcja: handleDeleteEntityDownloadURLCommand
>>
>>
>>-- 
>>Regards,
>>Tomasz Zięba
>>Twitter: @TZieba
>>LinkedIn: pl.linkedin.com/pub/tomasz-zięba-ph-d/3b/7a8/ab6/
>><http://pl.linkedin.com/pub/tomasz-zi%C4%99ba-ph-d/3b/7a8/ab6/>
>


Re: download template -> delete vhd

Posted by Nitin Mehta <Ni...@citrix.com>.
Tomas - Its not the same, there have been fixes made in ACS master/4.4.
But as Min pointed out in current ACS it works fine and deletes only the
symlink.
To work around the situation in 4.2.1 you can try setting
extract.url.expiration.interval (the value is in seconds ) in global
settings to a large value (say 14400000 -- 4000 hrs ) so that the download
url never expire and do not delete the template.
Hope it helps. 

Thanks,
-Nitin



On 23/07/14 10:48 AM, "Min Chen" <mi...@citrix.com> wrote:

>In current ACS master, Template is not deleted from secondary storage when
>extractTemplate is called, just its symlink is deleted.
>
>Thanks
>-min
>
>On 7/23/14 4:15 AM, "Tomasz Zięba" <t....@gmail.com> wrote:
>
>>Hello,
>>
>>Could someone confirm that download template deletes the vhd file from
>>secondary storage.
>>
>>We are testing on the ACS version 4.2.1 but the code responsible for
>>removing is the same in version 4.4
>>
>>https://github.com/apache/cloudstack/blob/8b6dc7ce2f0058b9cf29bd9c72e4e0d
>>b
>>9162fe6e/services/secondary-storage/server/src/org/apache/cloudstack/stor
>>a
>>ge/template/UploadManagerImpl.java
>>
>>funkcja: handleDeleteEntityDownloadURLCommand
>>
>>
>>-- 
>>Regards,
>>Tomasz Zięba
>>Twitter: @TZieba
>>LinkedIn: pl.linkedin.com/pub/tomasz-zięba-ph-d/3b/7a8/ab6/
>><http://pl.linkedin.com/pub/tomasz-zi%C4%99ba-ph-d/3b/7a8/ab6/>
>


Re: download template -> delete vhd

Posted by Min Chen <mi...@citrix.com>.
In current ACS master, Template is not deleted from secondary storage when
extractTemplate is called, just its symlink is deleted.

Thanks
-min

On 7/23/14 4:15 AM, "Tomasz Zięba" <t....@gmail.com> wrote:

>Hello,
>
>Could someone confirm that download template deletes the vhd file from
>secondary storage.
>
>We are testing on the ACS version 4.2.1 but the code responsible for
>removing is the same in version 4.4
>
>https://github.com/apache/cloudstack/blob/8b6dc7ce2f0058b9cf29bd9c72e4e0db
>9162fe6e/services/secondary-storage/server/src/org/apache/cloudstack/stora
>ge/template/UploadManagerImpl.java
>
>funkcja: handleDeleteEntityDownloadURLCommand
>
>
>-- 
>Regards,
>Tomasz Zięba
>Twitter: @TZieba
>LinkedIn: pl.linkedin.com/pub/tomasz-zięba-ph-d/3b/7a8/ab6/
><http://pl.linkedin.com/pub/tomasz-zi%C4%99ba-ph-d/3b/7a8/ab6/>


Re: download template -> delete vhd

Posted by Min Chen <mi...@citrix.com>.
In current ACS master, Template is not deleted from secondary storage when
extractTemplate is called, just its symlink is deleted.

Thanks
-min

On 7/23/14 4:15 AM, "Tomasz Zięba" <t....@gmail.com> wrote:

>Hello,
>
>Could someone confirm that download template deletes the vhd file from
>secondary storage.
>
>We are testing on the ACS version 4.2.1 but the code responsible for
>removing is the same in version 4.4
>
>https://github.com/apache/cloudstack/blob/8b6dc7ce2f0058b9cf29bd9c72e4e0db
>9162fe6e/services/secondary-storage/server/src/org/apache/cloudstack/stora
>ge/template/UploadManagerImpl.java
>
>funkcja: handleDeleteEntityDownloadURLCommand
>
>
>-- 
>Regards,
>Tomasz Zięba
>Twitter: @TZieba
>LinkedIn: pl.linkedin.com/pub/tomasz-zięba-ph-d/3b/7a8/ab6/
><http://pl.linkedin.com/pub/tomasz-zi%C4%99ba-ph-d/3b/7a8/ab6/>