{"action":"created","issue":{"url":"https://api.github.com/repos/vmware/docker-volume-vsphere/issues/1111","repository_url":"https://api.github.com/repos/vmware/docker-volume-vsphere","labels_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/issues/1111/labels{/name}","comments_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/issues/1111/comments","events_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/issues/1111/events","html_url":"https://github.com/vmware/docker-volume-vsphere/issues/1111","id":217981644,"number":1111,"title":"Volume created from vm1 (ESX1) inside tenant1  but is visible from vm2 (ESX2).","user":{"login":"ashahi1","id":23107823,"avatar_url":"https://avatars2.githubusercontent.com/u/23107823?v=3","gravatar_id":"","url":"https://api.github.com/users/ashahi1","html_url":"https://github.com/ashahi1","followers_url":"https://api.github.com/users/ashahi1/followers","following_url":"https://api.github.com/users/ashahi1/following{/other_user}","gists_url":"https://api.github.com/users/ashahi1/gists{/gist_id}","starred_url":"https://api.github.com/users/ashahi1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashahi1/subscriptions","organizations_url":"https://api.github.com/users/ashahi1/orgs","repos_url":"https://api.github.com/users/ashahi1/repos","events_url":"https://api.github.com/users/ashahi1/events{/privacy}","received_events_url":"https://api.github.com/users/ashahi1/received_events","type":"User","site_admin":false},"labels":[{"id":310972920,"url":"https://api.github.com/repos/vmware/docker-volume-vsphere/labels/kind/bug","name":"kind/bug","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":{"login":"pshahzeb","id":25597778,"avatar_url":"https://avatars3.githubusercontent.com/u/25597778?v=3","gravatar_id":"","url":"https://api.github.com/users/pshahzeb","html_url":"https://github.com/pshahzeb","followers_url":"https://api.github.com/users/pshahzeb/followers","following_url":"https://api.github.com/users/pshahzeb/following{/other_user}","gists_url":"https://api.github.com/users/pshahzeb/gists{/gist_id}","starred_url":"https://api.github.com/users/pshahzeb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pshahzeb/subscriptions","organizations_url":"https://api.github.com/users/pshahzeb/orgs","repos_url":"https://api.github.com/users/pshahzeb/repos","events_url":"https://api.github.com/users/pshahzeb/events{/privacy}","received_events_url":"https://api.github.com/users/pshahzeb/received_events","type":"User","site_admin":false},"assignees":[{"login":"pshahzeb","id":25597778,"avatar_url":"https://avatars3.githubusercontent.com/u/25597778?v=3","gravatar_id":"","url":"https://api.github.com/users/pshahzeb","html_url":"https://github.com/pshahzeb","followers_url":"https://api.github.com/users/pshahzeb/followers","following_url":"https://api.github.com/users/pshahzeb/following{/other_user}","gists_url":"https://api.github.com/users/pshahzeb/gists{/gist_id}","starred_url":"https://api.github.com/users/pshahzeb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pshahzeb/subscriptions","organizations_url":"https://api.github.com/users/pshahzeb/orgs","repos_url":"https://api.github.com/users/pshahzeb/repos","events_url":"https://api.github.com/users/pshahzeb/events{/privacy}","received_events_url":"https://api.github.com/users/pshahzeb/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/vmware/docker-volume-vsphere/milestones/12","html_url":"https://github.com/vmware/docker-volume-vsphere/milestone/12","labels_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/milestones/12/labels","id":2310416,"number":12,"title":"0.13","description":"","creator":{"login":"tusharnt","id":11025951,"avatar_url":"https://avatars2.githubusercontent.com/u/11025951?v=3","gravatar_id":"","url":"https://api.github.com/users/tusharnt","html_url":"https://github.com/tusharnt","followers_url":"https://api.github.com/users/tusharnt/followers","following_url":"https://api.github.com/users/tusharnt/following{/other_user}","gists_url":"https://api.github.com/users/tusharnt/gists{/gist_id}","starred_url":"https://api.github.com/users/tusharnt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tusharnt/subscriptions","organizations_url":"https://api.github.com/users/tusharnt/orgs","repos_url":"https://api.github.com/users/tusharnt/repos","events_url":"https://api.github.com/users/tusharnt/events{/privacy}","received_events_url":"https://api.github.com/users/tusharnt/received_events","type":"User","site_admin":false},"open_issues":14,"closed_issues":77,"state":"open","created_at":"2017-02-08T20:25:54Z","updated_at":"2017-03-30T01:19:44Z","due_on":"2017-03-28T07:00:00Z","closed_at":null},"comments":0,"created_at":"2017-03-29T19:19:55Z","updated_at":"2017-03-30T02:23:32Z","closed_at":null,"body":"Setup:\r\n```\r\nESX-1 has vm1, vm2, vm3\r\nESX-2 has vm4\r\n\r\nvm1 and vm4 are on shared vmfs.\r\n```\r\n\r\nSteps:\r\n```\r\n1. Created a volume from VM1. \r\n2. Volume visible from VM2 and VM3.\r\n3. Created a tenant T-1 and added vm1 to it.\r\n4. Did docker volume ls from VM1. As expected, do not see any volumes.\r\n5. Created volume vol-1 from VM1. Docker volume ls lists the volume vol-1.\r\n5. Did docker volume ls from VM2 and vm3, do not see vol-1.\r\n6. Did docker volume ls from vm4, able to see vol-1.  <<<<<<<<<<<<<<<<<<<< vol-1 was created by vm1 after it moved to T-1\r\n7. Created a tenant t-2 and added vm4 to it.\r\n8  Did docker volume ls from vm4, still see vol-1.    <<<<<<<<<<<<<<<<<<\r\n```\r\nEven though I see vol-1, if I try to do docker inspect vol-1, I get the message - No such volume\r\n\r\nOn ESX-2, admin cli lists vm-group as N/A for vol-1. \r\n\r\nIs this a bug or it is an expected behavior? \r\n\r\nShould we list the volume on a different vm which is on a different ESX even though that volume belongs to user created tenant?\r\n\r\n\r\n================================================================\r\nSteps and their output are as follows:\r\n\r\n- Create a volume from VM-1\r\n```\r\nroot@sc-rdops-vm02-dhcp-52-237:~# docker volume create --driver=vsphere --name=TestVol -o size=500mb\r\nTestVol\r\nroot@sc-rdops-vm02-dhcp-52-237:~# docker volume ls\r\nDRIVER              VOLUME NAME\r\nvsphere             TestVol@sharedVmfs-0\r\nvsphere             testVol1_Post@sharedVmfs-0\r\nroot@sc-rdops-vm02-dhcp-52-237:~#\r\n\r\n\r\n\r\nadmin cli volume ls:\r\n\r\n[root@sc2-rdops-vm01-dhcp-34-157:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py volume ls\r\nVolume         Datastore     VM-Group  Capacity  Used  Filesystem  Policy  Disk Format  Attached-to  Access      Attach-as               Created By           Created Date\r\n-------------  ------------  --------  --------  ----  ----------  ------  -----------  -----------  ----------  ----------------------  -------------------  ------------------------\r\nTestVol        sharedVmfs-0  _DEFAULT  500MB     23MB  ext4        N/A     thin         detached     read-write  independent_persistent  ubuntu-VM1-157-vmfs  Wed Mar 29 18:43:02 2017\r\ntestVol1_Post  sharedVmfs-0  N/A       200MB     14MB  ext4        N/A     thin         detached     read-write  independent_persistent  ubuntu-VM1-157-vmfs  Wed Mar 29 17:23:43 2017\r\n\r\n[root@sc2-rdops-vm01-dhcp-34-157:~]\r\n\r\n\r\nDocker volume ls from VM-2  and VM-3:\r\n\r\nroot@sc-rdops-vm02-dhcp-52-237:~# docker volume ls\r\nDRIVER              VOLUME NAME\r\nvsphere             TestVol@sharedVmfs-0\r\nvsphere             testVol1_Post@sharedVmfs-0\r\nroot@sc-rdops-vm02-dhcp-52-237:~#\r\n\r\nroot@sc-rdops-vm02-dhcp-52-237:~# docker volume ls\r\nDRIVER              VOLUME NAME\r\nvsphere             TestVol@sharedVmfs-0\r\nvsphere             testVol1_Post@sharedVmfs-0\r\nroot@sc-rdops-vm02-dhcp-52-237:~#\r\n\r\nDocker volume ls from VM-4:\r\n\r\nroot@sc-rdops-vm02-dhcp-52-237:~# docker volume ls\r\nDRIVER              VOLUME NAME\r\nvsphere             TestVol@sharedVmfs-0\r\nvsphere             testVol1_Post@sharedVmfs-0\r\nroot@sc-rdops-vm02-dhcp-52-237:~#\r\n\r\n```\r\n\r\n- Created a tenant and added a VM-1 to it:\r\n\r\n```\r\n[root@sc2-rdops-vm01-dhcp-34-157:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group create --name=tenant1 --vm-list=ubuntu-VM1-157-vmfs\r\nvm-group create succeeded\r\n[root@sc2-rdops-vm01-dhcp-34-157:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group ls\r\nUuid                                  Name      Description                 Default_datastore  VM_list\r\n------------------------------------  --------  --------------------------  -----------------  -------------------\r\n11111111-1111-1111-1111-111111111111  _DEFAULT  This is a default vm-group\r\ncd760db8-d9db-462d-b267-a8ef3a69d7a7  tenant1                                                  ubuntu-VM1-157-vmfs\r\n\r\n[root@sc2-rdops-vm01-dhcp-34-157:~]\r\n\r\n```\r\n\r\n- Created a volume - TestVol_T1 from VM-1:\r\n\r\n```\r\nroot@sc-rdops-vm02-dhcp-52-237:~# docker volume create --driver=vsphere --name=TestVol_T1 -o size=500mb\r\nTestVol_T1\r\nroot@sc-rdops-vm02-dhcp-52-237:~# docker volume ls\r\nDRIVER              VOLUME NAME\r\nvsphere             TestVol_T1@sharedVmfs-0\r\nvsphere             testVol1_Post@sharedVmfs-0\r\nroot@sc-rdops-vm02-dhcp-52-237:~#\r\n\r\n\r\n\r\n[root@sc2-rdops-vm01-dhcp-34-157:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py volume ls\r\nVolume         Datastore     VM-Group  Capacity  Used  Filesystem  Policy  Disk Format  Attached-to  Access      Attach-as               Created By           Created Date\r\n-------------  ------------  --------  --------  ----  ----------  ------  -----------  -----------  ----------  ----------------------  -------------------  ------------------------\r\nTestVol        sharedVmfs-0  _DEFAULT  500MB     23MB  ext4        N/A     thin         detached     read-write  independent_persistent  ubuntu-VM1-157-vmfs  Wed Mar 29 18:43:02 2017\r\ntestVol1_Post  sharedVmfs-0  N/A       200MB     14MB  ext4        N/A     thin         detached     read-write  independent_persistent  ubuntu-VM1-157-vmfs  Wed Mar 29 17:23:43 2017\r\nTestVol_T1     sharedVmfs-0  tenant1   500MB     23MB  ext4        N/A     thin         detached     read-write  independent_persistent  ubuntu-VM1-157-vmfs  Wed Mar 29 18:49:29 2017\r\n\r\n[root@sc2-rdops-vm01-dhcp-34-157:~]\r\n\r\n```\r\n\r\nDocker volume ls from VM-2 and VM-3:\r\n\r\n```\r\nroot@sc-rdops-vm02-dhcp-52-237:~# docker volume ls\r\nDRIVER              VOLUME NAME\r\nvsphere             TestVol@sharedVmfs-0\r\nvsphere             testVol1_Post@sharedVmfs-0\r\nroot@sc-rdops-vm02-dhcp-52-237:~#\r\n\r\n\r\nroot@sc-rdops-vm02-dhcp-52-237:~# docker volume ls\r\nDRIVER              VOLUME NAME\r\nvsphere             TestVol@sharedVmfs-0\r\nvsphere             testVol1_Post@sharedVmfs-0\r\nroot@sc-rdops-vm02-dhcp-52-237:~#\r\n\r\n```\r\n\r\nDocker volume ls from VM-4:\r\n```\r\nroot@sc-rdops-vm02-dhcp-52-237:~# docker volume ls\r\nDRIVER              VOLUME NAME\r\nvsphere             TestVol@sharedVmfs-0\r\nvsphere             TestVol_T1@sharedVmfs-0         <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\r\nvsphere             testVol1_Post@sharedVmfs-0\r\nroot@sc-rdops-vm02-dhcp-52-237:~#\r\n\r\n```\r\n\r\n- Created tenant-2 and added VM-4 to it:\r\n```\r\n[root@sc2-rdops-vm01-dhcp-41-181:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group create --name=tenant2 --vm-list=ubuntu-VM1-181-vmfs\r\nvm-group create succeeded\r\n\r\n```\r\n\r\n- Did docker volume ls from VM-4:\r\n```\r\nroot@sc-rdops-vm02-dhcp-52-237:~# docker volume ls\r\nDRIVER              VOLUME NAME\r\nvsphere             TestVol_T1@sharedVmfs-0\r\nvsphere             testVol1_Post@sharedVmfs-0\r\nroot@sc-rdops-vm02-dhcp-52-237:~#\r\n\r\n\r\nAdmin cli volume ls ESX-2:\r\n\r\n[root@sc2-rdops-vm01-dhcp-41-181:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py volume ls\r\nVolume         Datastore     VM-Group  Capacity  Used  Filesystem  Policy  Disk Format  Attached-to  Access      Attach-as               Created By           Created Date\r\n-------------  ------------  --------  --------  ----  ----------  ------  -----------  -----------  ----------  ----------------------  -------------------  ------------------------\r\nTestVol        sharedVmfs-0  _DEFAULT  500MB     23MB  ext4        N/A     thin         detached     read-write  independent_persistent  ubuntu-VM1-157-vmfs  Wed Mar 29 18:43:02 2017\r\ntestVol1_Post  sharedVmfs-0  N/A       200MB     14MB  ext4        N/A     thin         detached     read-write  independent_persistent  ubuntu-VM1-157-vmfs  Wed Mar 29 17:23:43 2017\r\nTestVol_T1     sharedVmfs-0  N/A       500MB     23MB  ext4        N/A     thin         detached     read-write  independent_persistent  ubuntu-VM1-157-vmfs  Wed Mar 29 18:49:29 2017\r\n\r\n[root@sc2-rdops-vm01-dhcp-41-181:~]\r\n\r\n```\r\nTest steps are planned #957\r\n\r\nLogs:\r\n[docker-volume-vsphere_vm1.txt](https://github.com/vmware/docker-volume-vsphere/files/880157/docker-volume-vsphere_vm1.txt)\r\n[docker-volume-vsphere_vm4.txt](https://github.com/vmware/docker-volume-vsphere/files/880155/docker-volume-vsphere_vm4.txt)\r\n[vmdk_ops_ESX1.txt](https://github.com/vmware/docker-volume-vsphere/files/880154/vmdk_ops_ESX1.txt)\r\n[vmdk_ops_ESX2.txt](https://github.com/vmware/docker-volume-vsphere/files/880156/vmdk_ops_ESX2.txt)\r\n"},"comment":{"url":"https://api.github.com/repos/vmware/docker-volume-vsphere/issues/comments/290283215","html_url":"https://github.com/vmware/docker-volume-vsphere/issues/1111#issuecomment-290283215","issue_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/issues/1111","id":290283215,"user":{"login":"pshahzeb","id":25597778,"avatar_url":"https://avatars3.githubusercontent.com/u/25597778?v=3","gravatar_id":"","url":"https://api.github.com/users/pshahzeb","html_url":"https://github.com/pshahzeb","followers_url":"https://api.github.com/users/pshahzeb/followers","following_url":"https://api.github.com/users/pshahzeb/following{/other_user}","gists_url":"https://api.github.com/users/pshahzeb/gists{/gist_id}","starred_url":"https://api.github.com/users/pshahzeb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pshahzeb/subscriptions","organizations_url":"https://api.github.com/users/pshahzeb/orgs","repos_url":"https://api.github.com/users/pshahzeb/repos","events_url":"https://api.github.com/users/pshahzeb/events{/privacy}","received_events_url":"https://api.github.com/users/pshahzeb/received_events","type":"User","site_admin":false},"created_at":"2017-03-30T02:23:32Z","updated_at":"2017-03-30T02:23:32Z","body":"Filtering out the crux.\r\nIssue:\r\nThe issue is you see a volume created a VM part of tenant1 on ESX1; from a VM  (tenant doesn't matter) on ESX2.\r\nAs per the admin cli on ESX2, the volume tenant is N/A because there is no entry of tenant1 in authdb on ESX2.\r\n\r\nReason:\r\nOur get_volumes function in vmdk_utils traverses each tenant uuid subdirectory and then each vmdk,  and returns volume info if the given tenant name reg exp matches the tenant which this volume is part of.\r\n\r\nIn case if we don't find tenant for a vmdk (unable to get tenant name for tenant uuid subdirectory from authdb), we treat the volume as orphan. However, we return such orphan volumes in all cases, even when a specific tenant was specified as input. We need to return such volumes only when volumes from any tenant are asked (tenant reg exp is \"*\").\r\n\r\nbasically we need to add an if check in the end part of get_volumes() in vmdk_utils like this:\r\n```\r\n\r\n                    # return orphan volumes only in case when volumes from any tenants are asked\r\n                    if tenant_re == \"*\":\r\n                        for file_name in list_vmdks(root):\r\n                            volumes.append({'path': root,\r\n                                            'filename': file_name,\r\n                                            'datastore': datastore,\r\n                                            'tenant' : auth_data_const.ORPHAN_TENANT})\r\n```\r\nCC // @lipingxue \r\nAm I correct?\r\n"}}
{"actor":{"display_login":"pshahzeb"}}