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

'policy ls' command does not show the name of the volume using that policy #853

Closed
ashahi1 opened this issue Jan 9, 2017 · 1 comment · Fixed by #953
Closed

'policy ls' command does not show the name of the volume using that policy #853

ashahi1 opened this issue Jan 9, 2017 · 1 comment · Fixed by #953

Comments

@ashahi1
Copy link
Contributor

ashahi1 commented Jan 9, 2017

'policy ls' command does not show the name of the volume using that policy

========================================

Steps are as follows:

  1. Created a vsan storage policy using the following command:
    /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py policy create --name some-policy --content '(("proportionalCapacity" i0)("hostFailuresToTolerate" i0)'

[root@sc2-rdops-vm03-dhcp-97-99:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py policy ls

Policy Name Policy Content Active


some-policy (("hostFailuresToTolerate" i0) ("forceProvisioning" i0)) Unused

Active column shows unused since no volume is using this policy.

  1. Created a volume named some-vol using the above created policy:
    docker volume create --driver=vmdk --name=some-vol -o vsan-policy-name=some-policy

Docker inspect for the created volume shows name of the policy used by the volume

root@photon-TX4FfW2ET [ ~/docker-volume-vsphere ]# docker volume inspect some-vol | grep "Name|vsan-policy-name"
"Name": "some-vol",
"vsan-policy-name": "some-policy"

  1. 'policy ls' command still shows policy as unused:

[root@sc2-rdops-vm03-dhcp-97-99:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py policy ls
Policy Name Policy Content Active


some-policy (("hostFailuresToTolerate" i0) ("forceProvisioning" i0)) Unused

==================================

Ideally we should see the name of the virtual disks using the policy should show up in the Active column.

@pdhamdhere pdhamdhere added this to the v1 GA milestone Feb 1, 2017
@pdhamdhere pdhamdhere modified the milestones: 0.12, v1 GA Feb 9, 2017
@tusharnt tusharnt assigned shaominchen and unassigned lipingxue Feb 9, 2017
@shaominchen shaominchen assigned pshahzeb and unassigned shaominchen Feb 16, 2017
@shaominchen
Copy link
Contributor

I have narrowed down the root cause to be in vmdk_utils.list_vmdks() method. Please focus on this method to fix the issue.

pshahzeb pushed a commit that referenced this issue Feb 22, 2017
1. Using get_volumes() in list_volumes_and_policies() instead of
   list_vmdks() to properly walk in dockvols directory which contain
   tenant-uuid based subdirectories
   This fixes output by admin policy ls command
2. Fixing update_vsan_objects_with_policy to make proper use
   of list_volumes_and_policies()

Testing:
Porting the update_vsan_policy test to tenant based Vmdk ops test suite
Manual testing of admin policy ls command done

Resolves: #853
shuklanirdesh82 pushed a commit that referenced this issue Feb 24, 2017
* Fixing list_volumes_and_policies() to correctly list volumes

1. Using get_volumes() in list_volumes_and_policies() instead of
   list_vmdks() to properly walk in dockvols directory which contain
   tenant-uuid based subdirectories
   This fixes output by admin policy ls command
2. Fixing update_vsan_objects_with_policy to make proper use
   of list_volumes_and_policies()

Testing:
Porting the update_vsan_policy test to tenant based Vmdk ops test suite
Manual testing of admin policy ls command done

Resolves: #853

* Prohibiting policy delete if it is in use by a volume

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

* Removing unused resources in policy usage test case and adding additional checks

* Making use if vsan datastore as default
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
5 participants