Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Prohibit policy delete from admin cli if it is in use by any volume #948

Closed
pshahzeb opened this issue Feb 22, 2017 · 0 comments
Closed
Assignees
Labels

Comments

@pshahzeb
Copy link
Contributor

Currently, policy is successfully deleted even if it is being used by a volume.
See the below example where a policy named poltest is created and a volume vol_poltest is created using this policy. The admin ls command indicates that the volume vol_poltest is using poltest policy.
But the admin policy rm command runs successfully.
The volume still indicates it uses poltest policy.

[root@sc-rdops-vm07-dhcp-208-78:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py policy create --name poltest --content '(("proportionalCapacity" i0)("hostFailuresToTolerate" i0))'
Successfully created policy: poltest
[root@sc-rdops-vm07-dhcp-208-78:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py ls
Volume         Datastore      Created By VM  Created                   Attached To VM (name/uuid)  Policy          Capacity  Used  Disk Format  Filesystem Type  Access      Attach As
-------------  -------------  -------------  ------------------------  --------------------------  --------------  --------  ----  -----------  ---------------  ----------  ----------------------
vol_poltest    vsanDatastore  photo.rc       Wed Feb 22 01:49:06 2017  detached                    poltest         100MB     40MB  thin         ext4             read-write  independent_persistent

[root@sc-rdops-vm07-dhcp-208-78:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py policy rm poltest
Successfully removed policy: poltest
[root@sc-rdops-vm07-dhcp-208-78:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py ls
Volume         Datastore      Created By VM  Created                   Attached To VM (name/uuid)  Policy          Capacity  Used  Disk Format  Filesystem Type  Access      Attach As
-------------  -------------  -------------  ------------------------  --------------------------  --------------  --------  ----  -----------  ---------------  ----------  ----------------------
vol_poltest    vsanDatastore  photo.rc       Wed Feb 22 01:49:06 2017  detached                    poltest         100MB     40MB  thin         ext4             read-write  independent_persistent

[root@sc-rdops-vm07-dhcp-208-78:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py policy ls
Policy Name            Policy Content                                              Active
---------------------  ----------------------------------------------------------  ------
bad_policy             (("proportionalCapacity" i0)("hostFailuresToTolerate" i3))  Unused
pol1                   (("proportionalCapacity" i0)("hostFailuresToTolerate" i0)   Unused
wrong_string_policy    (("proportionalCapacity" i0)("hostFailuresToTolerate" i0)   Unused
notSatisfiable_policy  (("proportionalCapacity" i0)("hostFailuresToTolerate" i5))  Unused
@pshahzeb pshahzeb self-assigned this Feb 22, 2017
@tusharnt tusharnt modified the milestone: 0.12 Feb 23, 2017
pshahzeb pushed a commit that referenced this issue Feb 23, 2017
1. Minor change to use list_volumes_and_policies()
   instead of list_vmdks() to find vmdks using a policy
Testing:
1. Manual testing done
2. Adding test cases to cover policy ls and policy rm
   functionality in vmdk_ops_test

Resolves: #948
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants