[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-7266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14109981#comment-14109981
 ] 

Min Chen commented on CLOUDSTACK-7266:
--------------------------------------

Problem:
-----------
After an account is deleted, the snapshot directory (for each volume) created 
for the account is not deleted on secondary storage.

Root Cause Analysis:
--------------------------
In cleaning up account, MS will send DeleteSnapshotsDirCommand to SSVM, but 
SSVM failed to execute this command due to the following error:
2014-08-06 06:04:52,773 WARN [storage.resource.NfsSecondaryStorageResource] 
(agentRequest-Handler-1:null) Failed to delete file 
/mnt/SecStorage/0e8da06e-0788-3efb-86a6-b0705a2205d3/snapshots/4/19/*, err=rm: 
cannot remove 
`/mnt/SecStorage/0e8da06e-0788-3efb-86a6-b0705a2205d3/snapshots/4/19/9ef00274-3b42-4e4d-81a2-13e055f7f162':
 Is a directoryrm: cannot remove 
`/mnt/SecStorage/0e8da06e-0788-3efb-86a6-b0705a2205d3/snapshots/4/19/b3086b0a-d8fb-453f-9339-7b4ff4b12a02':
 Is a directoryrm: cannot remove 
`/mnt/SecStorage/0e8da06e-0788-3efb-86a6-b0705a2205d3/snapshots/4/19/d73794f8-0ef1-4a06-a800-8ae9ed344742':
 Is a directory
The snapshot directory has nested directory, we should use recursive option for 
rm command.

Proposed Solution:
-----------------------
We need to rm -r option on SSVM to remove the snapshot directory.

QA notes:
-------------
Steps to reproduce:
1. Deployed CS with ESXi5.1
2. Create an account "demo".
3. Created VM with data disk by logging into CS as "demo".
3. Created snapshots on both root and data disks.
4. Now deleted the account "demo".

Expected result:
-------------
On NFS secondary storage, we should see an empty folder under 
snapshots/<account id for demo>.



> Deleting account is not cleaning the snapshot entries in secondary storage
> --------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-7266
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-7266
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: Snapshot
>    Affects Versions: 4.5.0
>            Reporter: manasaveloori
>            Assignee: Min Chen
>            Priority: Critical
>             Fix For: 4.5.0
>
>         Attachments: cloud.log-20140806.gz, management-server.rar, 
> mysqldump45.dmp
>
>
> Steps:
> 1. Deployed CS with ESXi5.1
> 2. Created VM with data disk.
> 3. Created snapshots on both root and data disks.
> 4. Now deleted the account.
>              id: 4
>    account_name: test
>            uuid: c55b8251-7bb0-4531-bd7e-7811d55160e6
>            type: 0
>       domain_id: 1
>           state: enabled
>         removed: 2014-08-06 06:04:50
>  cleanup_needed: 0
>  network_domain: NULL
> default_zone_id: NULL
>         default: 0
> 5. All the snapshots got deleted as apart of account clean up in DB
> mysql> select * from snapshots where account_id=4\G;
> *************************** 1. row ***************************
>               id: 38
>   data_center_id: 1
>       account_id: 4
>        domain_id: 1
>        volume_id: 18
> disk_offering_id: 1
>           status: Destroyed
>             path: NULL
>             name: testvmacct1_ROOT-11_20140806054444
>             uuid: 716f0dd5-056e-4cab-b814-125fc6fe84e6
>    snapshot_type: 0
> type_description: MANUAL
>             size: 2147483648
>          created: 2014-08-06 05:44:44
>          removed: NULL
>   backup_snap_id: NULL
>         swift_id: NULL
>       sechost_id: NULL
>     prev_snap_id: NULL
>  hypervisor_type: VMware
>          version: 2.2
>            s3_id: NULL
> *************************** 2. row ***************************
>               id: 39
>   data_center_id: 1
>       account_id: 4
>        domain_id: 1
>        volume_id: 18
> disk_offering_id: 1
>           status: Destroyed
>             path: NULL
>             name: testvmacct1_ROOT-11_20140806054650
>             uuid: ea949547-5ef7-40b0-99a6-152d346a0ad6
>    snapshot_type: 3
> type_description: HOURLY
>             size: 2147483648
>          created: 2014-08-06 05:46:50
>          removed: NULL
>   backup_snap_id: NULL
>         swift_id: NULL
>       sechost_id: NULL
>     prev_snap_id: NULL
>  hypervisor_type: VMware
>          version: 2.2
>            s3_id: NULL
> *************************** 3. row ***************************
>               id: 40
>   data_center_id: 1
>       account_id: 4
>        domain_id: 1
>        volume_id: 18
> disk_offering_id: 1
>           status: Destroyed
>             path: NULL
>             name: testvmacct1_ROOT-11_20140806055150
>             uuid: b8af0810-b08a-40bd-a114-13a4d75907ca
>    snapshot_type: 4
> type_description: DAILY
>             size: 2147483648
>          created: 2014-08-06 05:51:50
>          removed: NULL
>   backup_snap_id: NULL
>         swift_id: NULL
>       sechost_id: NULL
>     prev_snap_id: NULL
>  hypervisor_type: VMware
>          version: 2.2
>            s3_id: NULL
> *************************** 4. row ***************************
>               id: 41
>   data_center_id: 1
>       account_id: 4
>        domain_id: 1
>        volume_id: 18
> disk_offering_id: 1
>           status: Destroyed
>             path: NULL
>             name: testvmacct1_ROOT-11_20140806055150
>             uuid: dda5cfb7-f5ab-4bd0-bdd3-953932e77f5e
>    snapshot_type: 5
> type_description: WEEKLY
>             size: 2147483648
>          created: 2014-08-06 05:51:50
>          removed: NULL
>   backup_snap_id: NULL
>         swift_id: NULL
>       sechost_id: NULL
>     prev_snap_id: NULL
>  hypervisor_type: VMware
>          version: 2.2
>            s3_id: NULL
> *************************** 5. row ***************************
>               id: 42
>   data_center_id: 1
>       account_id: 4
>        domain_id: 1
>        volume_id: 19
> disk_offering_id: 3
>           status: Destroyed
>             path: NULL
>             name: testvmacct1_DATA-11_20140806055150
>             uuid: 69c8b7d1-baab-42ac-9a7d-dbdb0688654f
>    snapshot_type: 3
> type_description: HOURLY
>             size: 5368709120
>          created: 2014-08-06 05:51:50
>          removed: NULL
>   backup_snap_id: NULL
>         swift_id: NULL
>       sechost_id: NULL
>     prev_snap_id: NULL
>  hypervisor_type: VMware
>          version: 2.2
>            s3_id: NULL
> *************************** 6. row ***************************
>               id: 44
>   data_center_id: 1
>       account_id: 4
>        domain_id: 1
>        volume_id: 19
> disk_offering_id: 3
>           status: Destroyed
>             path: NULL
>             name: testvmacct1_DATA-11_20140806060150
>             uuid: d1a95e1b-7ed8-46a8-9762-3cac8bc7aaf6
>    snapshot_type: 4
> type_description: DAILY
>             size: 5368709120
>          created: 2014-08-06 06:01:50
>          removed: NULL
>   backup_snap_id: NULL
>         swift_id: NULL
>       sechost_id: NULL
>     prev_snap_id: NULL
>  hypervisor_type: VMware
>          version: 2.2
>            s3_id: NULL
> *************************** 7. row ***************************
>               id: 45
>   data_center_id: 1
>       account_id: 4
>        domain_id: 1
>        volume_id: 19
> disk_offering_id: 3
>           status: Destroyed
>             path: NULL
>             name: testvmacct1_DATA-11_20140806060150
>             uuid: 21b5e820-5a77-4713-bd5c-882816806877
>    snapshot_type: 6
> type_description: MONTHLY
>             size: 5368709120
>          created: 2014-08-06 06:01:50
>          removed: NULL
>   backup_snap_id: NULL
>         swift_id: NULL
>       sechost_id: NULL
>     prev_snap_id: NULL
>  hypervisor_type: VMware
>          version: 2.2
>            s3_id: NULL
> 7 rows in set (0.00 sec)
> 6. Observed that the snapshots folder for removed account in secondary 
> storage are not deleted:
> [root@RHEL63testVM snapshots]# ls
> 2  4  5
> [root@RHEL63testVM snapshots]# cd 4
> [root@RHEL63testVM 4]# ls -lrt
> total 8
> drwxrwxrwx+ 5 root root 4096 Aug  6  2014 19
> attching
>  the Mslogs and dumps



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to