vmware-archive / vsphere-storage-for-docker

vSphere Storage for Docker
https://vmware.github.io/vsphere-storage-for-docker
Apache License 2.0
251 stars 95 forks source link

Support container volume ops with VVOLs #2034

Closed govint closed 6 years ago

govint commented 6 years ago

fixes #1998

The approach here is to use a flat file for the KV store for a VVOL based volume. Natively created sidecars for vvol volumes are vvols themselves, and there is no API to read/write a sidecar natively. Python interfaces to use existing native libraries don't seem to work well and hence unreliable to use for the KV store. For this reason, we don't use natively created sidecars for VVOL based volumes. Instead we create a flat file in the dockvols folder thats named just like a sidecar but created by the ESX service as a flat file.

Remove volume and clone volume workflows are updated with minor changes to handle the KV stores for VVOLs. Changes are minor in vmdk_ops.py and all handling is only in kvESX.py.

govint commented 6 years ago

Testing changes for clone op between combos of vvol and non-vvol volumes.

  1. docker volume create -d vsphere hvol23 hvol23
  2. Clone from non-VVOL to VVOL docker volume create -d vsphere vvol3@Datastore --opt "clone-from=hvol23@sharedVmfs-0" vvol3@Datastore
  3. docker volume inspect hvol23 [ { "CreatedAt": "0001-01-01T00:00:00Z", "Driver": "vsphere", "Labels": {}, "Mountpoint": "/mnt/vmdk/hvol23/", "Name": "hvol23", "Options": {}, "Scope": "global", "Status": { "access": "read-write", "attach-as": "independent_persistent", "capacity": { "allocated": "13MB", "size": "100MB" }, "clone-from": "None", "created": "Tue Dec 12 09:23:49 2017", "created by VM": "worker1-VM1.0", "datastore": "sharedVmfs-0", "diskformat": "thin", "fstype": "ext4", "status": "detached" } } ]
  4. docker volume inspect vvol3@Datastore [ { "CreatedAt": "0001-01-01T00:00:00Z", "Driver": "vsphere", "Labels": {}, "Mountpoint": "/mnt/vmdk/vvol3@Datastore/", "Name": "vvol3@Datastore", "Options": { "clone-from": "hvol23@sharedVmfs-0" }, "Scope": "global", "Status": { "access": "read-write", "attach-as": "independent_persistent", "capacity": { "allocated": "2MB", "size": "100MB" }, "clone-from": "hvol23", "created": "Tue Dec 12 09:26:05 2017", "created by VM": "worker1-VM1.0", "datastore": "Datastore", "diskformat": "thin", "fstype": "ext4", "status": "detached" } } ]
  5. Clone from VVOL -> non-VVOL docker volume create -d vsphere hvol24@sharedVmfs-0 --opt "clone-from=vvol3@Datastore" hvol24@sharedVmfs-0
  6. docker volume inspect hvol24@sharedVmfs-0 [ { "CreatedAt": "0001-01-01T00:00:00Z", "Driver": "vsphere", "Labels": {}, "Mountpoint": "/mnt/vmdk/hvol24@sharedVmfs-0/", "Name": "hvol24@sharedVmfs-0", "Options": { "clone-from": "vvol3@Datastore" }, "Scope": "global", "Status": { "access": "read-write", "attach-as": "independent_persistent", "capacity": { "allocated": "8MB", "size": "100MB" }, "clone-from": "vvol3", "created": "Tue Dec 12 09:29:21 2017", "created by VM": "worker2-VM2.0", "datastore": "sharedVmfs-0", "diskformat": "thin", "fstype": "ext4", "status": "detached" } } ]
  7. Clone from VVOL -> VVOL docker volume create -d vsphere vvol4@Datastore --opt "clone-from=vvol3@Datastore" vvol4@Datastore
  8. docker volume inspect vvol4@Datastore [ { "CreatedAt": "0001-01-01T00:00:00Z", "Driver": "vsphere", "Labels": {}, "Mountpoint": "/mnt/vmdk/vvol4@Datastore/", "Name": "vvol4@Datastore", "Options": { "clone-from": "vvol3@Datastore" }, "Scope": "global", "Status": { "access": "read-write", "attach-as": "independent_persistent", "capacity": { "allocated": "0", "size": "100MB" }, "clone-from": "vvol3", "created": "Tue Dec 12 09:30:28 2017", "created by VM": "worker2-VM2.0", "datastore": "Datastore", "diskformat": "thin", "fstype": "ext4", "status": "detached" } } ]
  9. Clone non-VVOL -> non-VVOL docker volume create -d vsphere hvol25@sharedVmfs-0 --opt "clone-from=hvol23@sharedVmfs-0" hvol25@sharedVmfs-0
  10. docker volume inspect hvol25@sharedVmfs-0 [ { "CreatedAt": "0001-01-01T00:00:00Z", "Driver": "vsphere", "Labels": {}, "Mountpoint": "/mnt/vmdk/hvol25@sharedVmfs-0/", "Name": "hvol25@sharedVmfs-0", "Options": { "clone-from": "hvol23@sharedVmfs-0" }, "Scope": "global", "Status": { "access": "read-write", "attach-as": "independent_persistent", "capacity": { "allocated": "13MB", "size": "100MB" }, "clone-from": "hvol23", "created": "Tue Dec 12 09:34:40 2017", "created by VM": "worker1-VM1.0", "datastore": "sharedVmfs-0", "diskformat": "thin", "fstype": "ext4", "status": "detached" } } ]
govint commented 6 years ago

Fixed.