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

Made handing of missing metafile less harsh. #627

Merged
merged 1 commit into from
Oct 19, 2016
Merged

Commits on Oct 17, 2016

  1. Made handing of missing metafile less harsh.

    Today if the metadata file is missing (which could happen when some ops fail and disk created OK,
    but metadata file is not created - I had it a few time in test though I am not sure which op exactly failed)
    the whole plugin goes into unstable state due to unhandled exception (below).
    
    This fix makes it a little more predictable. All keeps working for other volumes, but any opertion on a volume with damaged metadata
    will return a JSON parse error from Docker volume driver.
    
    The issue has to has to be properly handled (Issue #626 ), this is a smaller fix
    
    Before the fix:
    ---------------
    1. Docker commands hang
    
    2. Backtrace on the server:
    
    10/15/16 06:12:28 41380 [photon-1] [INFO   ] executeRequest 'list' completed with ret=[{u'Attributes': {}, u'Name': 'myvol'}, {u'Attributes': {}, u'Name': 'refCountTestVol'}]
    10/15/16 06:12:33 41380 [photon-1] [ERROR  ] Failed to access /vmfs/volumes/datastore1/dockvols/refCountTestVol-8bfdeb99e642a231.vmfd
    Traceback (most recent call last):
      File "/usr/lib/vmware/vmdkops/Python/kvESX.py", line 242, in load
        with open(meta_file, "r") as fh:
    IOError: [Errno 2] No such file or directory: '/vmfs/volumes/datastore1/dockvols/refCountTestVol-8bfdeb99e642a231.vmfd'
    10/15/16 06:12:33 41380 [photon-1] [ERROR  ] 'NoneType' object has no attribute '__getitem__'
    Traceback (most recent call last):
      File "/usr/lib/vmware/vmdkops/bin/vmdk_ops.py", line 1186, in main
        handleVmciRequests(port)
      File "/usr/lib/vmware/vmdkops/bin/vmdk_ops.py", line 1143, in handleVmciRequests
        opts=opts)
      File "/usr/lib/vmware/vmdkops/bin/vmdk_ops.py", line 568, in executeRequest
        response = getVMDK(vmdk_path, vol_name, datastore)
      File "/usr/lib/vmware/vmdkops/bin/vmdk_ops.py", line 400, in getVMDK
        return vol_info(kv.getAll(vmdk_path), kv.get_vol_info(vmdk_path), datastore)
      File "/usr/lib/vmware/vmdkops/bin/vmdk_ops.py", line 350, in vol_info
        vinfo = {CREATED_BY_VM : vol_meta[kv.CREATED_BY],
    TypeError: 'NoneType' object has no attribute '__getitem__'
    
    After the fix:
    
    1. Docker command reports error
    
    Error response from daemon: get v3: VolumeDriver.Get: json: cannot unmarshal string into Go value of type map[string]interface {}
    
    2. Server log reports error:
    
    10/15/16 06:33:35 45724 [photon-1] [INFO   ] executeRequest 'get' completed with ret=Failed to get disk details
    10/15/16 06:33:52 45724 [photon-1] [ERROR  ] Failed to access /vmfs/volumes/datastore1/dockvols/refCountTestVol-8bfdeb99e642a231.vmfd
    Traceback (most recent call last):
      File "/usr/lib/vmware/vmdkops/Python/kvESX.py", line 242, in load
        with open(meta_file, "r") as fh:
    IOError: [Errno 2] No such file or directory: '/vmfs/volumes/datastore1/dockvols/refCountTestVol-8bfdeb99e642a231.vmfd'
    Mark Sterin committed Oct 17, 2016
    Configuration menu
    Copy the full SHA
    361a7ab View commit details
    Browse the repository at this point in the history