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

Don't crash admin cli on ls -l if metadata isn't available #416

Merged
merged 1 commit into from May 27, 2016

Conversation

andrewjstone
Copy link
Contributor

@andrewjstone andrewjstone commented May 27, 2016

Fixes #412

Tested via removing the sidecar file for a volume and running ls -l on esx

[root@localhost:/vmfs/volumes/5707ef9a-d9ce2869-9313-000c29e1b7a2/dockvols] ls
ayo-84b25ea7eb0f1fbf.vmfd        ayo.vmdk                         large-vol-flat.vmdk              policies                         vol-flat.vmdk
ayo-flat.vmdk                    large-vol-4aea49a74bbb032b.vmfd  large-vol.vmdk                   vol-6d812701b9f8e2bf.vmfd        vol.vmdk
[root@localhost:/vmfs/volumes/5707ef9a-d9ce2869-9313-000c29e1b7a2/dockvols] rm ayo-
ayo-84b25ea7eb0f1fbf.vmfd  ayo-flat.vmdk
[root@localhost:/vmfs/volumes/5707ef9a-d9ce2869-9313-000c29e1b7a2/dockvols] rm ayo-84b25ea7eb0f1fbf.vmfd
[root@localhost:/vmfs/volumes/5707ef9a-d9ce2869-9313-000c29e1b7a2/dockvols] /usr/
bin/      lib/      lib64/    libexec/  sbin/     share/
[root@localhost:/vmfs/volumes/5707ef9a-d9ce2869-9313-000c29e1b7a2/dockvols] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py ls -l
Volume     Datastore   Created By    Created                   Attached To  Policy  Capacity  ggUsed
---------  ----------  ------------  ------------------------  -----------  ------  --------  -------
large-vol  datastore1  Ubuntu_15.10  Sat Apr 16 13:34:12 2016  detached     N/A     1.00GB    25.00MB
vol        datastore1  Ubuntu_15.10  Sat Apr 16 20:13:18 2016  detached     N/A     100.00MB  14.00MB
ayo        datastore1  N/A           N/A                       detached     N/A     4.00MB    2.00MB

Mounting the file recreates the sidecar and makes it 'attached', but obviously doesn't fix the lost attributes

ajs@ajs-virtual-machine:~/go/src/github.com/vmware/docker-volume-vsphere$ docker run -it -v ayo:/mnt/vol busybox sh
[root@localhost:/vmfs/volumes/5707ef9a-d9ce2869-9313-000c29e1b7a2/dockvols] ls
ayo-84b25ea7eb0f1fbf.vmfd        ayo.vmdk                         large-vol-flat.vmdk              policies                         vol-flat.vmdk
ayo-flat.vmdk                    large-vol-4aea49a74bbb032b.vmfd  large-vol.vmdk                   vol-6d812701b9f8e2bf.vmfd        vol.vmdk
[root@localhost:/vmfs/volumes/5707ef9a-d9ce2869-9313-000c29e1b7a2/dockvols] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py ls -l
Volume     Datastore   Created By    Created                   Attached To   Policy  Capacity  Used
---------  ----------  ------------  ------------------------  ------------  ------  --------  -------
large-vol  datastore1  Ubuntu_15.10  Sat Apr 16 13:34:12 2016  detached      N/A     1.00GB    25.00MB
vol        datastore1  Ubuntu_15.10  Sat Apr 16 20:13:18 2016  detached      N/A     100.00MB  14.00MB
ayo        datastore1  N/A           N/A                       Ubuntu_15.10  N/A     4.00MB    2.00MB

@govint
Copy link
Contributor

govint commented May 27, 2016

Looks good, but why is there no metadata at all

@govint
Copy link
Contributor

govint commented May 27, 2016

Sorry is the side car missing?

@andrewjstone
Copy link
Contributor Author

Mark had an instance where the sidecar was missing. #416

@andrewjstone andrewjstone force-pushed the no-crash-with-missing-metadata.ajs branch from 46a120c to bf8d095 Compare May 27, 2016 18:27
@msterin
Copy link
Contributor

msterin commented May 27, 2016

LGTM - but please , so add info on how it was tested. It would be even better to have automated test

@andrewjstone
Copy link
Contributor Author

Testing info added.

@andrewjstone andrewjstone merged commit 65dc28c into master May 27, 2016
@kerneltime kerneltime deleted the no-crash-with-missing-metadata.ajs branch June 1, 2016 18:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle VMs with no metadata in vmdkops_admin.py ls -l without crashing
4 participants