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

Unable to modify access attribute for volume from admin-cli #998

Closed
ashahi1 opened this issue Mar 6, 2017 · 4 comments · Fixed by #1014
Closed

Unable to modify access attribute for volume from admin-cli #998

ashahi1 opened this issue Mar 6, 2017 · 4 comments · Fixed by #1014

Comments

@ashahi1
Copy link
Contributor

ashahi1 commented Mar 6, 2017

Test steps:

  1. Created a volume with access set to read-only
  2. Tried changing access to read-write from admin cli but failed - Failed to update access=read-write for Vol100MB@sharedVmfs-0.

Logs are attached at the end.


Respective commands and their outputs are as follows:

Created a volume with access mode set to "read-only"

root@sc-rdops-vm02-dhcp-52-237:/# docker volume create --driver=vsphere --name=Vol100MB -o size=100mb -o attach-as=persistent -o access=read-only -o diskformat=thin -o fstype=ext4
Vol100MB
root@sc-rdops-vm02-dhcp-52-237:/# docker volume ls
DRIVER              VOLUME NAME
vsphere             Vol100MB@sharedVmfs-0
root@sc-rdops-vm02-dhcp-52-237:/# docker volume inspect Vol100MB@sharedVmfs-0
[
    {
        "Name": "Vol100MB@sharedVmfs-0",
        "Driver": "vsphere",
        "Mountpoint": "/mnt/vmdk/Vol100MB@sharedVmfs-0",
        "Status": {
            "access": "read-only",  <<<<<<<<<<<<<<<<<<<<<<<<<
            "attach-as": "persistent",
            "capacity": {
                "allocated": "13MB",
                "size": "100MB"
            },
            "clone-from": "None",
            "created": "Mon Mar  6 21:51:21 2017",
            "created by VM": "ubuntu-VM1.3",
            "datastore": "sharedVmfs-0",
            "diskformat": "thin",
            "fstype": "ext4",
            "status": "detached"
        },
        "Labels": {},
        "Scope": "global"
    }
]

Admin cli output listing the newly created volume:

[root@sc-rdops-vm01-dhcp-2-37:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py ls
Volume    Datastore     Created By VM  Created                   Attached To VM (name/uuid)  Policy  Capacity  Used  Disk Format  Filesystem Type  Access     Attach As
--------  ------------  -------------  ------------------------  --------------------------  ------  --------  ----  -----------  ---------------  ---------  ----------
Vol100MB  sharedVmfs-0  ubuntu-VM1.3   Mon Mar  6 21:51:21 2017  ubuntu-VM0.3                N/A     100MB     13MB  thin         ext4             read-only  persistent

Tried changing the access attribute for volume to "read-write" but unsuccesful.

[root@sc-rdops-vm01-dhcp-2-37:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py set --volume=Vol100MB@sharedVmfs-0 --options="access=read-write"
Failed to update access=read-write for Vol100MB@sharedVmfs-0.

vmdk_ops.log:

03/06/17 22:03:38 77393 [MainThread] [WARNING] Volume Vol100MB not found.
03/06/17 22:05:46 77424 [MainThread] [INFO   ] Connecting to the local Service Instance as 'dcui'
03/06/17 22:06:11 77431 [MainThread] [WARNING] Volume Vol100MB not found.
03/06/17 22:06:30 77436 [MainThread] [WARNING] Invalid datastore 'None'.

03/06/17 22:10:39 77459 [MainThread] [WARNING] Volume Vol100MB not found.

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

@lipingxue
Copy link
Contributor

The root cause of this bug is "vmdkops_admin set" is not aware of the exist of tenant. With the multi-tenency feature, it is possible that two volumes with the same name created on the same datastore since there two volumes may created by different tenant. So " "vmdkops_admin set" need to have a new flag to specify the tenant name which own the volume.

@lipingxue
Copy link
Contributor

This is the output from vmdk_ops log:

09/10/16 08:36:28 388621 [photon-6-[datastore1] dockvols/11111111-1111-1111-1111-111111111111/Vol100MB.vmdk] [INFO ] *** createVMDK: /vmfs/volumes/datastore1/dockvols/11111111-1111-1111-1111-111111111111/Vol100MB.vmdk opts = {u'access': u'read-only', u'attach-as': u'persistent', u'size': u'100mb', u'diskformat': u'thin', u'fstype': u'ext4'}

......
09/10/16 08:57:10 397448 [MainThread] [DEBUG ] set_vol_opts: name=Vol100MB@datastore1 options=access=read-write vol_name=Vol100MB, datastore=datastore1

09/10/16 08:57:10 397448 [MainThread] [DEBUG ] set_vol_opts: path=/vmfs/volumes/datastore1/dockvols vmdk_path=/vmfs/volumes/datastore1/dockvols/Vol100MB.vmdk ---> The path is incorrect

@pdhamdhere
Copy link
Contributor

How would Admin figure out which tenant volume belongs to? "admin ls" doesnt show tenant name.

We have tests for these in CI right? How come these tests are not failing?

@lipingxue
Copy link
Contributor

With #964, "tenant ls" command will add a new column "tenant". CI test for "set command" was written before multi-tenancy. And it just create VMDK in the "/vmfs/volumes/dockervol" directory.

# for free to subscribe to this conversation on GitHub. Already have an account? #.