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

vmdk_ops does not report attached volumes correctly: inspect volume and vmdk_ops list volumes results are different and getting error "vm doesn't belong to any tenant" #738

Closed
shuklanirdesh82 opened this issue Nov 16, 2016 · 2 comments

Comments

@shuklanirdesh82
Copy link
Contributor

Environment Details:
#VMs: 2 photon vms (VM1, VM2)
ESX: VMware ESXi 6.0.0 build-3620759
Datastore: vmfs

Steps to Reproduce:

  1. docker volume create --driver=vmdk --name=vmwDataVol -o size=10gb (on VM1)
root@photon-EHiCjpUvt [ ~ ]# docker volume create --driver=vmdk --name=vmwDataVol -o size=10gb
vmwDataVol
  1. make sure volume is visible to another vm (VM2) and inspecting volume should say 'detached'
root@photon-w3ktCykjv [ ~ ]# docker volume ls
DRIVER              VOLUME NAME
vmdk                vmwDataVol
  1. docker run --rm -it -v vmwDataVol:/mnt/myvol2 busybox
  2. docker volume inspect vmwDataVol (on VM2)
[
    {
        "Name": "vmwDataVol",
        "Driver": "vmdk",
        "Mountpoint": "/mnt/vmdk/vmwDataVol",
        "Status": {
            "access": "read-write",
            "attach-as": "independent_persistent",
            "attached to VM": "photon2",
            "capacity": {
                "allocated": "155MB",
                "size": "10GB"
            },
            "created": "Wed Nov 16 18:57:57 2016",
            "created by VM": "photon2",
            "datastore": "datastore",
            "diskformat": "thin",
            "fstype": "ext4",
            "status": "**attached**"
        },
        "Labels": {},
        "Scope": "global"
    }
]
  1. on ESX: list volumes
[root@promc-2n-dhcp105-97:/vmfs/volumes/4fc608aa-828f03c0-d4a2-d4ae52794a7a] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py ls
Volume           Datastore  Created By VM  Created                   Attached To VM  Policy  Capacity  Used      Filesystem Type  Access      Attach As               
---------------  ---------  -------------  ------------------------  --------------  ------  --------  --------  ---------------  ----------  ----------------------  
vmwDataVol       datastore  photon2        Wed Nov 16 18:57:57 2016  detached        N/A     10.00GB   175.00MB  ext4             read-write  independent_persistent

Expected Result:
while listing down volume, vmdkops command should say vmwDataVol is attached to VM1

Actual Result:

[root@promc-2n-dhcp105-97:/vmfs/volumes/4fc608aa-828f03c0-d4a2-d4ae52794a7a] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py ls
Volume           Datastore  Created By VM  Created                   Attached To VM  Policy  Capacity  Used      Filesystem Type  Access      Attach As               
---------------  ---------  -------------  ------------------------  --------------  ------  --------  --------  ---------------  ----------  ----------------------  
vmwDataVol       datastore  photon2        Wed Nov 16 18:57:57 2016  **detached**        N/A     10.00GB   175.00MB  ext4             read-write  independent_persistent

Triage:

---------------vmdk_ops.log------------------

11/16/16 18:57:56 1463911 [photon2-vmwDataVol] [INFO   ] executeRequest 'get' completed with ret={u'Error': 'Volume vmwDataVol not found (file: /vmfs/volumes/datastore/dockvols/vmwDataVol.vmdk)'}         
11/16/16 18:57:56 1463911 [photon2-vmwDataVol] [INFO   ] *** createVMDK: /vmfs/volumes/datastore/dockvols/vmwDataVol.vmdk opts = {u'size': u'10gb', u'fstype': u'ext4'}                                     
11/16/16 18:57:58 1463911 [photon2-vmwDataVol] [WARNING]  VM photon2 does not belong to any tenant                                                                                                          
11/16/16 18:57:58 1463911 [photon2-vmwDataVol] [INFO   ] executeRequest 'create' completed with ret=None                                                                                                    
11/16/16 18:57:58 1463911 [photon2-vmwDataVol] [INFO   ] *** attachVMDK: /vmfs/volumes/datastore/dockvols/vmwDataVol.vmdk to photon2 VM uuid = 564de5f9-3b8e-bc8c-96a6-eb359f4e9714                         
11/16/16 18:57:58 1463911 [photon2-vmwDataVol] [INFO   ] Attaching /vmfs/volumes/datastore/dockvols/vmwDataVol.vmdk as independent_persistent                                                               
11/16/16 18:57:59 1463911 [photon2-vmwDataVol] [INFO   ] Disk /vmfs/volumes/datastore/dockvols/vmwDataVol.vmdk successfully attached. controller pci_slot_number=192, disk_slot=1                           
11/16/16 18:57:59 1463911 [photon2-vmwDataVol] [INFO   ] executeRequest 'attach' completed with ret={'ControllerPciSlotNumber': '192', 'Unit': '1'}                                                         
11/16/16 18:58:15 1463911 [photon2-vmwDataVol] [INFO   ] *** detachVMDK: /vmfs/volumes/datastore/dockvols/vmwDataVol.vmdk from photon2 VM uuid = 564de5f9-3b8e-bc8c-96a6-eb359f4e9714                       
11/16/16 18:58:16 1463911 [photon2-vmwDataVol] [INFO   ] Disk detached /vmfs/volumes/datastore/dockvols/vmwDataVol.vmdk                                                                                     
11/16/16 18:58:16 1463911 [photon2-vmwDataVol] [INFO   ] executeRequest 'detach' completed with ret=None                                                                                                    
11/16/16 18:58:39 1463911 [photon2-vmwDataVol] [INFO   ] executeRequest 'get' completed with ret={'status': u'detached', 'created by VM': u'photon2', 'capacity': {'allocated': '145MB', 'size': '10GB'}, 'c
11/16/16 18:58:39 1463911 [photon2-vmwDataVol] [INFO   ] *** attachVMDK: /vmfs/volumes/datastore/dockvols/vmwDataVol.vmdk to photon2 VM uuid = 564de5f9-3b8e-bc8c-96a6-eb359f4e9714                         
11/16/16 18:58:39 1463911 [photon2-vmwDataVol] [INFO   ] Attaching /vmfs/volumes/datastore/dockvols/vmwDataVol.vmdk as independent_persistent                                                               
11/16/16 18:58:40 1463911 [photon2-vmwDataVol] [INFO   ] Disk /vmfs/volumes/datastore/dockvols/vmwDataVol.vmdk successfully attached. controller pci_slot_number=192, disk_slot=1                           
11/16/16 18:58:40 1463911 [photon2-vmwDataVol] [INFO   ] executeRequest 'attach' completed with ret={'ControllerPciSlotNumber': '192', 'Unit': '1'}                                                         
11/16/16 18:58:48 1463911 [photon1-socket7] [INFO   ] executeRequest 'list' completed with ret=[{u'Attributes': {}, u'Name': 'refCountTestVol'}, {u'Attributes': {}, u'Name': 'datavol1'}, {u'Attributes': {
11/16/16 18:58:56 1463911 [photon1-vmwDataVol] [INFO   ] executeRequest 'get' completed with ret={'status': u'attached', 'attached to VM': 'photon2', 'created by VM': u'photon2', 'capacity': {'allocated':
~ 

@govint govint self-assigned this Nov 16, 2016
@govint
Copy link
Contributor

govint commented Nov 16, 2016

Needs to get the VM name from the attached VM UUID in the KV. I'll fix this. Admin CLI should call vol_info in vmdk_ops.py and get use that data vs. reading KV and interpreting that.

@govint
Copy link
Contributor

govint commented Nov 18, 2016

Fixed via #745

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

No branches or pull requests

4 participants