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

Incorrect dockvols location for VMs in nested folders in datastore #449

Closed
pdhamdhere opened this issue Jun 9, 2016 · 0 comments · Fixed by #451
Closed

Incorrect dockvols location for VMs in nested folders in datastore #449

pdhamdhere opened this issue Jun 9, 2016 · 0 comments · Fixed by #451

Comments

@pdhamdhere
Copy link
Contributor

VM1: /vmfs/volumes/Storage1/Photon1.vmx
VM2: /vmfs/volumes/Storage1/test/abc/Photon2.vmx

Docker volumes created by VM1 are stored in;

 ls -al /vmfs/volumes/Storage1/dockvols/*flat.vmdk
-rw-------    1 root     root     214748364800 Jun  9 05:06 /vmfs/volumes/Storage1/dockvols/av2-flat.vmdk
-rw-------    1 root     root     104857600 Jun  9 16:22 /vmfs/volumes/Storage1/dockvols/v1-flat.vmdk

Docker volumes created by VM2 are stored in;

ls -al /vmfs/volumes/Storage1/test/abc/dockvols/*flat.vmdk
-rw-------    1 root     root     104857600 Jun  9 16:34 /vmfs/volumes/Storage1/test/abc/dockvols/pv1-flat.vmdk
-rw-------    1 root     root     104857600 Jun  9 16:44 /vmfs/volumes/Storage1/test/abc/dockvols/pv3-flat.vmdk

docker volume ls from VM1 reports volumes in /vmfs/volumes/Storage1/dockvols
docker volume ls from VM2 reports volumes in /vmfs/volumes/Storage1/test/abc/dockvols

We should always be creating dockvols in datastore\dockvols rather than in parent directory.

def getVolPath(vm_config_path);
# The volumes folder is created in the parent of the given VM's folder.
path = os.path.join(
     os.path.dirname(os.path.dirname(vm_config_path)), DOCK_VOLS_DIR) <------------

We can get VM datastore info from VirtualMachineConfigSummary.summary.config.vmPathName and use it to create "dockvols" directory.

This issue also has other side effects for e.g. volume creation and mounting works fine for Photon2.vmx but unmount/detach fails. with following error;

06/09/16 16:44:39 148482 [WARNING] *** Detach failed: disk=/vmfs/volumes/4bad174b-b67f5cfc-2fc6-0026b966a303/test/abc/dockvols/pv3.vmdk not found. VM=564d4469-ea2f-7e86-71ad-d1d43b627a9d
def findDeviceByPath(vmdk_path, vm):
...
        dvol_dir = os.path.dirname(vmdk_path)
        real_vol_dir = os.path.basename(os.path.realpath(dvol_dir)) <------
        virtual_disk = real_vol_dir + "/" + os.path.basename(vmdk_path)
@pdhamdhere pdhamdhere added this to the v1 Beta milestone Jun 9, 2016
@pdhamdhere pdhamdhere added the P0 label Jun 9, 2016
msterin pushed a commit that referenced this issue Jun 9, 2016
msterin pushed a commit that referenced this issue Jun 10, 2016
…by Name

Place dockvols to datastore root - Fixe #449.
Also , if VM as renamed, the whole "find VM" mechanism was confused - so I fixed by by using search by UUID rather than
scan for name. It has a side effect of being faster (on 10 VMs query time dropped from 0.25 sec to 0.05 sec)
msterin pushed a commit that referenced this issue Jun 10, 2016
…by Name

Place dockvols to datastore root - Fixe #449.
Also , if VM as renamed, the whole "find VM" mechanism was confused - so I fixed by by using search by UUID rather than
scan for name. It has a side effect of being faster (on 10 VMs query time dropped from 0.25 sec to 0.05 sec)
msterin pushed a commit that referenced this issue Jun 11, 2016
…by Name

Place dockvols to datastore root - Fixe #449.
Also , if VM as renamed, the whole "find VM" mechanism was confused - so I fixed by by using search by UUID rather than
scan for name. It has a side effect of being faster (on 10 VMs query time dropped from 0.25 sec to 0.05 sec)
msterin pushed a commit that referenced this issue Jun 11, 2016
…by Name

Place dockvols to datastore root - Fixe #449.
Also , if VM as renamed, the whole "find VM" mechanism was confused - so I fixed by by using search by UUID rather than
scan for name. It has a side effect of being faster (on 10 VMs query time dropped from 0.25 sec to 0.05 sec)
msterin pushed a commit that referenced this issue Jun 11, 2016
…by Name

Place dockvols to datastore root - Fixe #449.
Also , if VM as renamed, the whole "find VM" mechanism was confused - so I fixed by by using search by UUID rather than
scan for name. It has a side effect of being faster (on 10 VMs query time dropped from 0.25 sec to 0.05 sec)
msterin pushed a commit that referenced this issue Jun 11, 2016
…by Name

Place dockvols to datastore root - Fixe #449.
Also , if VM as renamed, the whole "find VM" mechanism was confused - so I fixed by by using search by UUID rather than
scan for name. It has a side effect of being faster (on 10 VMs query time dropped from 0.25 sec to 0.05 sec)
msterin pushed a commit that referenced this issue Jun 11, 2016
…by Name (#451)

Place dockvols to datastore root - Fixe #449.
Also , if VM as renamed, the whole "find VM" mechanism was confused - so I fixed by by using search by UUID rather than
scan for name. It has a side effect of being faster (on 10 VMs query time dropped from 0.25 sec to 0.05 sec)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants