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

[DEFAULT tenant] Volume is created on the datastore where vm resides and not on specified default-datastore #1044

Closed
ashahi1 opened this issue Mar 17, 2017 · 3 comments · Fixed by #1095
Milestone

Comments

@ashahi1
Copy link
Contributor

ashahi1 commented Mar 17, 2017

VM resides on vsan datastore.

Steps:

  1. For default tenant, set sharedVmfs as default datatsore.
  2. Created a volume by specifying volume name as short-name - TestVol1
  3. Volume gets created on the datastore where vm resides and not on the default-datastore (shared-vmfs).

For user created tenant, specified --default-datastore is picked up during volume creation if volume name is specified using short name.


Steps and their output is as follows:

  • Verified only _DEFAULT tenant is present with default access rules
[root@sc-rdops-vm18-dhcp-32-67:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access ls --name=_DEFAULT
Datastore  Allow_create  Max_volume_size  Total_size
---------  ------------  ---------------  ----------
           True          Unset            Unset

[root@sc-rdops-vm18-dhcp-32-67:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access ls --name=_DEFAULT
Datastore     Allow_create  Max_volume_size  Total_size
------------  ------------  ---------------  ----------
sharedVmfs-0  True          1.00GB           5.00GB
              True          Unset            Unset

  • Added a datastore rule and set sharedVmfs-0 as a default-datastore
[root@sc-rdops-vm18-dhcp-32-67:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access add --name=_DEFAULT --allow-create --datastore sharedVmfs-0 --volume-ma
xsize=1GB --volume-totalsize=5GB
vm-group access add succeeded

  • Tried creating a volume using short-name - TestVol1. Volume got created on the datastore where vm resides (vsan datastore) and not on the default-datastore.
root@sc-rdops-vm02-dhcp-52-237:~# docker volume ls
DRIVER              VOLUME NAME
root@sc-rdops-vm02-dhcp-52-237:~# docker volume create --driver=vsphere --name=TestVol1 -o size=1gb
TestVol1
root@sc-rdops-vm02-dhcp-52-237:~# docker volume ls
DRIVER              VOLUME NAME
vsphere             TestVol1@vsanDatastore
root@sc-rdops-vm02-dhcp-52-237:~#


[root@sc-rdops-vm18-dhcp-32-67:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py ls
Volume    Datastore      VM-Group  Capacity  Used   Filesystem  Policy          Disk Format  Attached-to  Access      Attach-as               Created By    Created Date
--------  -------------  --------  --------  -----  ----------  --------------  -----------  -----------  ----------  ----------------------  ------------  ------------------------
TestVol1  vsanDatastore  _DEFAULT  1GB       112MB  ext4        [VSAN default]  thin         detached     read-write  independent_persistent  ubuntu-VM0.2  Fri Mar 17 18:44:17 2017

[root@sc-rdops-vm18-dhcp-32-67:~]

Logs:
docker-volume-vsphere.txt
vmdk_ops.txt

@ashahi1 ashahi1 added this to the 0.13 milestone Mar 17, 2017
@ashahi1
Copy link
Contributor Author

ashahi1 commented Mar 17, 2017

//CC
@pshahzeb @lipingxue

@ashahi1 ashahi1 changed the title [DEFAULT tenant] Volume is created on the datastore where vm resides and not on specified default-datatsore [DEFAULT tenant] Volume is created on the datastore where vm resides and not on specified default-datastore Mar 17, 2017
@pshahzeb
Copy link
Contributor

The purpose of _DEFAULT tenant being backward compatibility and allowing admin to use volumes without getting involved in tenancy; we don't expect user to set a default datastore to the default tenant. If VM belongs to default tenant, the current logic will always pick up the datastore where VM resides unless the user specifies fully qualified name of volume while creating a volume.

We should document this behavior.

//CC @lipingxue @shaominchen @msterin

@msterin
Copy link
Contributor

msterin commented Mar 17, 2017

we don't expect user to set a default datastore to the default tenant.

there is no reason to further complicate the experience. "default datastore" can be set on any vm-group aka tenant (including default) an should behave the same on all vm-groups (including default)

Plus, there is a good use case for default DS in default tenant : I want every one in my org to put volumes on slow and cheap storage, unless they explicitly ask for something else

If VM belongs to default tenant, the current logic will always pick up the datastore where VM resides unless the user specifies fully qualified name of volume while creating a volume.

And that's exactly the bug @ashahi1 has found

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