diff --git a/docs/blog/2016-10-28.md b/docs/blog/2016-10-28.md index 2baed1771..7d14c6083 100644 --- a/docs/blog/2016-10-28.md +++ b/docs/blog/2016-10-28.md @@ -7,7 +7,7 @@ This release includes - Multi threaded ESX backend service - Numerous bug fixes -## Vm-group +## Vmgroup - [Feature Overview](/features/tenancy) - [Tenancy diff --git a/docs/features/tenancy.md b/docs/features/tenancy.md index 00c2c383b..38dae2d0f 100644 --- a/docs/features/tenancy.md +++ b/docs/features/tenancy.md @@ -4,35 +4,35 @@ Multi-tenancy is an architecture in which a single instance of a software application serves multiple customers or "tenants." Tenants can be used to provide isolation between independent groups in shared environments, where multiple groups are using some common infrastructure i.e. compute, storage, network, etc. With tenancy, you can achieve isolation of resources of one tenant from other tenants. -For the vSphere Docker Volume Service, Multi-tenancy is implemented by assigning a Datastore and VMs to a vm-group. A vm-group can be granted access to create, delete or mount volumes on a specific datastore. VMs assigned to a vm-group can then execute Docker volume APIs on an assigned datastores. Within a datastore multiple vm-groups can store their Docker volumes. A vm-group cannot access volumes created by a different vm-group i.e. vm-groups have their own independent namespace, even if vm-groups share datastores. VMs cannot be shared between vm-groups. +For the vSphere Docker Volume Service, Multi-tenancy is implemented by assigning a Datastore and VMs to a vmgroup. A vmgroup can be granted access to create, delete or mount volumes on a specific datastore. VMs assigned to a vmgroup can then execute Docker volume APIs on an assigned datastores. Within a datastore multiple vmgroups can store their Docker volumes. A vmgroup cannot access volumes created by a different vmgroup i.e. vmgroups have their own independent namespace, even if vmgroups share datastores. VMs cannot be shared between vmgroups. Key attributes of tenancy: - vSphere Administrator can define group of one or more Docker Host (VM) as -vm-group -- Docker Host (VM) can be a member of one and only one vm-group. -- vSphere Administrator can grant vm-group privileges & set resource consumption -- Vm-groups can share the same underlying storage but preserve volume namespace isolation. +vmgroup +- Docker Host (VM) can be a member of one and only one vmgroup. +- vSphere Administrator can grant vmgroup privileges & set resource consumption +- Vmgroups can share the same underlying storage but preserve volume namespace isolation. limits at granularity of datastore. ## Admin CLI -Vm-groups can be created and managed via the [Admin CLI](/user-guide/admin-cli/#Vm-group) +Vmgroups can be created and managed via the [Admin CLI](/user-guide/admin-cli/#Vmgroup) -## Default vm-group -When a VM which does not belong to any vm-group issues a request to vmdk_ops, this VM will be assumed to be in _DEFAULT vm-group, and will get privileges -associated with this vm-group. \_DEFAULT vm-group will be automatically created by system post install, so by default vmdk_ops will support request from -any VM , thus maintaining backward compatibility and simplicity of installation.An admin can remove this vm-group or modify privileges, thus locking +## Default vmgroup +When a VM which does not belong to any vmgroup issues a request to vmdk_ops, this VM will be assumed to be in _DEFAULT vmgroup, and will get privileges +associated with this vmgroup. \_DEFAULT vmgroup will be automatically created by system post install, so by default vmdk_ops will support request from +any VM , thus maintaining backward compatibility and simplicity of installation.An admin can remove this vmgroup or modify privileges, thus locking down vmdk_ops to serve only explicitly configured VMs. ## Default privileges -When a VM tries to manipulate volumes on a datastore which is not configured, the system will use _DEFAULT privilege, which is created automatically -by system post install. This _DEFAULT privilege allows access to ANY datastore by default. An admin can edit or remove this record, thus locking down -the functionality to allow access only to explicitly configured datastores. +When a VM tries to manipulate volumes on a datastore which is not configured, the system will use _DEFAULT privilege, which is created automatically +by system post install. This _DEFAULT privilege allows access to ANY datastore by default. An admin can edit or remove this record, thus locking down +the functionality to allow access only to explicitly configured datastores. ## Default datastore -When a VM addresses the volume using short notation (volume_name, without @datastore), all VMs in this vm-group will use default datastore to resolve short volume reference (volume_name will actually mean volume_name@default_datastore). -If "default_datastore" is not set for a vm-group, then datastore where the VM resides will be used as "default_datastore". +When a VM addresses the volume using short notation (volume_name, without @datastore), all VMs in this vmgroup will use default datastore to resolve short volume reference (volume_name will actually mean volume_name@default_datastore). +If "default_datastore" is not set for a vmgroup, then datastore where the VM resides will be used as "default_datastore". ## References diff --git a/docs/misc/vmdkops-admin-cli-spec.md b/docs/misc/vmdkops-admin-cli-spec.md index d7781d294..42d95d380 100644 --- a/docs/misc/vmdkops-admin-cli-spec.md +++ b/docs/misc/vmdkops-admin-cli-spec.md @@ -11,7 +11,7 @@ All output from the admin cli defaults to human readable formats. It will be mad The majority of testing will be automated. We can ensure that parsing calls the right callbacks with the right information by generating representative input and mocking the callbacks to assert that the right information is parsed and delivered correctly. Additionally, and specifically for testing -access control, we can create access control definition (vm-groups and privileges) +access control, we can create access control definition (vmgroups and privileges) and then test that they act as expected by invoking vmdk_ops commmands on behalf of a fake VM. Unit tests for stateless logic can be fed mock input representing data from sidecar and the filesystem. @@ -69,9 +69,9 @@ Examples: Note that on volume creation from docker, a policy name will be passed with a `-o` option. -# vm-group -Create, delete, configure and show access control settings for a vm-group. -A vm-group is defined as a collection of VMs, so access control settings are assigned via a +# vmgroup +Create, delete, configure and show access control settings for a vmgroup. +A vmgroup is defined as a collection of VMs, so access control settings are assigned via a VM naming convention. *** The rest of section below needs rework as it represents obsolete "role" design *** An example will help clarify diff --git a/docs/user-guide/admin-cli.md b/docs/user-guide/admin-cli.md index 8241f975b..a35a2995f 100644 --- a/docs/user-guide/admin-cli.md +++ b/docs/user-guide/admin-cli.md @@ -16,182 +16,182 @@ The admin cli also enables ESX admins to implement tenancy. The remainder of this document will describe each admin CLI command and provide examples of their usage. -## Vm-group +## Vmgroup ### Help ```bash -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group -h -usage: vmdkops_admin.py vm-group [-h] {create,vm,update,access,ls,rm} ... +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup -h +usage: vmdkops_admin.py vmgroup [-h] {create,vm,update,access,ls,rm} ... positional arguments: {create,vm,update,access,ls,rm} - create Create a new vm-group - vm Add, removes and lists VMs in a vm-group - update Update an existing vm-group + create Create a new vmgroup + vm Add, removes and lists VMs in a vmgroup + update Update an existing vmgroup access Add or remove Datastore access and quotas for a vm- group - ls List vm-groups and the VMs they are applied to - rm Delete a vm-group + ls List vmgroups and the VMs they are applied to + rm Delete a vmgroup optional arguments: -h, --help show this help message and exit ``` ### Create -A vm-group named "_DEFAULT" will be created automatically post install. +A vmgroup named "_DEFAULT" will be created automatically post install. -Creates a new named vm-group and optionally assigns VMs. Valid vm-group name is only allowed to be "[a-zA-Z0-9_][a-zA-Z0-9_.-]*" +Creates a new named vmgroup and optionally assigns VMs. Valid vmgroup name is only allowed to be "[a-zA-Z0-9_][a-zA-Z0-9_.-]*" Sample: ``` -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group create --name=vm-group1 -vm-group create succeeded -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group ls +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup create --name=vmgroup1 +vmgroup 'vmgroup1' is created. Do not forget to run 'vmgroup vm add' and 'vmgroup access add' commands to enable access control. +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup ls Uuid Name Description Default_datastore VM_list ------------------------------------ --------- -------------------------- ----------------- ------- -11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vm-group -1ddb5b46-6a9f-4649-8e48-c47039905752 vm-group1 +11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vmgroup +1ddb5b46-6a9f-4649-8e48-c47039905752 vmgroup1 ``` -The vm-group to VM association can be done at create time. +The vmgroup to VM association can be done at create time. Sample: ``` -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group create --name=vm-group1 --vm-list=photon6 -vm-group create succeeded -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group ls +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup create --name=vmgroup1 --vm-list=photon6 +vmgroup 'vmgroup1' is created. Do not forget to run 'vmgroup vm add' and 'vmgroup access add' commands to enable access control. +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup ls Uuid Name Description Default_datastore VM_list ------------------------------------ --------- -------------------------- ----------------- -------- -11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vm-group -035ddfb7-349b-4ba1-8abf-e77a430d5098 vm-group1 photon6 +11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vmgroup +035ddfb7-349b-4ba1-8abf-e77a430d5098 vmgroup1 photon6 ``` #### Help ``` -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group create -h -usage: vmdkops_admin.py vm-group create [-h] --name NAME +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup create -h +usage: vmdkops_admin.py vmgroup create [-h] --name NAME [--description DESCRIPTION] [--vm-list vm1, vm2, ...] optional arguments: -h, --help show this help message and exit - --name NAME The name of the vm-group + --name NAME The name of the vmgroup --description DESCRIPTION - The description of the vm-group + The description of the vmgroup --vm-list vm1, vm2, ... - A list of VM names to place in this vm-group + A list of VM names to place in this vmgroup ``` ### List -List existing vm-groups, the datastores vm-groups have access to and the VMs assigned. +List existing vmgroups, the datastores vmgroups have access to and the VMs assigned. ``` -[root@localhost:~] usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group ls +[root@localhost:~] usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup ls Uuid Name Description Default_datastore VM_list ------------------------------------ --------- -------------------------- ----------------- -------- -11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vm-group -035ddfb7-349b-4ba1-8abf-e77a430d5098 vm-group1 photon6 +11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vmgroup +035ddfb7-349b-4ba1-8abf-e77a430d5098 vmgroup1 photon6 ``` #### Help ``` -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group ls -h -usage: vmdkops_admin.py vm-group ls [-h] +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup ls -h +usage: vmdkops_admin.py vmgroup ls [-h] optional arguments: -h, --help show this help message and exit ``` ### Update -Update existing vm-group. This command allows to update "Description" and "Default_datastore" fields, or rename an existing vm-group. +Update existing vmgroup. This command allows to update "Description" and "Default_datastore" fields, or rename an existing vmgroup. Sample: ``` -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group ls +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup ls Uuid Name Description Default_datastore VM_list ------------------------------------ --------- -------------------------- ----------------- -------- -11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vm-group -035ddfb7-349b-4ba1-8abf-e77a430d5098 vm-group1 photon6 +11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vmgroup +035ddfb7-349b-4ba1-8abf-e77a430d5098 vmgroup1 photon6 -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group update --name=vm-group1 --description="New description of vm-group1" --new-name=new-vm-group1 --default-datastore=datastore1 -vm-group modify succeeded -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group ls +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup update --name=vmgroup1 --description="New description of vmgroup1" --new-name=new-vmgroup1 --default-datastore=datastore1 +vmgroup modify succeeded +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup ls Uuid Name Description Default_datastore VM_list ------------------------------------ ------------- ---------------------------- ----------------- -------- -11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vm-group -035ddfb7-349b-4ba1-8abf-e77a430d5098 new-vm-group1 New description of vm-group1 datastore1 photon6 +11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vmgroup +035ddfb7-349b-4ba1-8abf-e77a430d5098 new-vmgroup1 New description of vmgroup1 datastore1 photon6 ``` #### Help ``` -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group update -h -usage: vmdkops_admin.py vm-group update [-h] --name NAME +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup update -h +usage: vmdkops_admin.py vmgroup update [-h] --name NAME [--default-datastore DEFAULT_DATASTORE] [--description DESCRIPTION] [--new-name NEW_NAME] optional arguments: -h, --help show this help message and exit - --name NAME The name of the vm-group + --name NAME The name of the vmgroup --default-datastore DEFAULT_DATASTORE The name of the datastore to be used by default for volumes placement --description DESCRIPTION - The new description of the vm-group - --new-name NEW_NAME The new name of the vm-group + The new description of the vmgroup + --new-name NEW_NAME The new name of the vmgroup ``` ### Remove -Remove a vm-group, optionally all volumes for a vm-group can be removed as well. +Remove a vmgroup, optionally all volumes for a vmgroup can be removed as well. Sample: ``` -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group rm --name=vm-group1 --remove-volumes +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup rm --name=vmgroup1 --remove-volumes All Volumes will be removed -vm-group rm succeeded +vmgroup rm succeeded -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group ls +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup ls Uuid Name Description Default_datastore VM_list ------------------------------------ -------- -------------------------- ----------------- ------- -11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vm-group +11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vmgroup ``` #### Help ``` -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group rm -h -usage: vmdkops_admin.py vm-group rm [-h] --name NAME [--remove-volumes] +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup rm -h +usage: vmdkops_admin.py vmgroup rm [-h] --name NAME [--remove-volumes] optional arguments: -h, --help show this help message and exit - --name NAME The name of the vm-group - --remove-volumes BE CAREFUL: Removes this vm-group volumes when removing a - vm-group + --name NAME The name of the vmgroup + --remove-volumes BE CAREFUL: Removes this vmgroup volumes when removing a + vmgroup ``` ### Virtual Machine #### Add -Add a VM to a vm-group. A VM can only access the datastores for the vm-group it is assigned to. -VMs can be assigned to only one vm-group at a time. +Add a VM to a vmgroup. A VM can only access the datastores for the vmgroup it is assigned to. +VMs can be assigned to only one vmgroup at a time. ``` -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group ls +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup ls Uuid Name Description Default_datastore VM_list ------------------------------------ --------- -------------------------- ----------------- -------- -11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vm-group -6d810c66-ffc7-47c8-8870-72114f86c2cf vm-group1 photon6 +11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vmgroup +6d810c66-ffc7-47c8-8870-72114f86c2cf vmgroup1 photon6 -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group vm add --name=vm-group1 --vm-list=photon7 -vm-group vm add succeeded +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup vm add --name=vmgroup1 --vm-list=photon7 +vmgroup vm add succeeded ``` #### List ``` -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group vm ls --name=vm-group1 +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup vm ls --name=vmgroup1 Uuid Name ------------------------------------ -------- 564d5849-b135-1259-cc73-d2d3aa1d9b8c photon6 @@ -199,11 +199,11 @@ Uuid Name ``` #### Remove -Remove a VM from a vm-group's list of VMs. VM will no longer be able to access the volumes created for the vm-group. +Remove a VM from a vmgroup's list of VMs. VM will no longer be able to access the volumes created for the vmgroup. ``` -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group vm rm --name=vm-group1 --vm-list=photon7 -vm-group vm rm succeeded -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group vm ls --name=vm-group1 +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup vm rm --name=vmgroup1 --vm-list=photon7 +vmgroup vm rm succeeded +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup vm ls --name=vmgroup1 Uuid Name ------------------------------------ -------- 564d5849-b135-1259-cc73-d2d3aa1d9b8c photon6 @@ -211,17 +211,17 @@ Uuid Name ``` ### Replace -Replace VMs from a vm-group's list of VMs. VMs which are replaced will no longer be able to access the volumes created for the vm-group. +Replace VMs from a vmgroup's list of VMs. VMs which are replaced will no longer be able to access the volumes created for the vmgroup. ``` -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group vm ls --name=vm-group1 +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup vm ls --name=vmgroup1 Uuid Name ------------------------------------ -------- 564d5849-b135-1259-cc73-d2d3aa1d9b8c photon6 -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group vm replace --name=vm-group1 --vm-list=photon7 -vm-group vm replace succeeded +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup vm replace --name=vmgroup1 --vm-list=photon7 +vmgroup vm replace succeeded -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group vm ls --name=vm-group1 +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup vm ls --name=vmgroup1 Uuid Name ------------------------------------ -------- 564d99a2-4097-9966-579f-3dc4082b10c9 photon7 @@ -229,15 +229,15 @@ Uuid Name #### Help ``` -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group vm -h -usage: vmdkops_admin.py vm-group vm [-h] {rm,add,ls,replace} ... +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup vm -h +usage: vmdkops_admin.py vmgroup vm [-h] {rm,add,ls,replace} ... positional arguments: {rm,add,ls,replace} - rm Remove VM(s) from a vm-group - add Add a VM(s) to a vm-group - ls list VMs in a vm-group - replace Replace VM(s) for a vm-group + rm Remove VM(s) from a vmgroup + add Add a VM(s) to a vmgroup + ls list VMs in a vmgroup + replace Replace VM(s) for a vmgroup optional arguments: -h, --help show this help message and exit @@ -245,20 +245,20 @@ optional arguments: ``` ### Access -Change the access control for a vm-group. +Change the access control for a vmgroup. This includes ability to grant privileges & set resource consumption limits for a datastore. #### Help ```bash -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access -h -usage: vmdkops_admin.py vm-group access [-h] {rm,add,set,ls} ... +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access -h +usage: vmdkops_admin.py vmgroup access [-h] {rm,add,set,ls} ... positional arguments: {rm,add,set,ls} - rm Remove all access to a datastore for a vm-group - add Add a datastore access for a vm-group - set Modify datastore access for a vm-group - ls List all access info for a vm-group + rm Remove all access to a datastore for a vmgroup + add Add a datastore access for a vmgroup + set Modify datastore access for a vmgroup + ls List all access info for a vmgroup optional arguments: -h, --help show this help message and exit @@ -266,53 +266,53 @@ optional arguments: ``` #### Add -Grants datastore access to a vm-group. +Grants datastore access to a vmgroup. -The datastore will be automatically set as "default_datastore" for the vm-group -when you grant first datastore access for a vm-group. +The datastore will be automatically set as "default_datastore" for the vmgroup +when you grant first datastore access for a vmgroup. Sample: ```bash -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access add --name=vm-group1 --datastore=datastore1 --volume-maxsize=500MB --volume-totalsize=1GB -vm-group access add succeeded +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access add --name=vmgroup1 --datastore=datastore1 --volume-maxsize=500MB --volume-totalsize=1GB +vmgroup access add succeeded -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group ls +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup ls Uuid Name Description Default_datastore VM_list ------------------------------------ --------- -------------------------- ----------------- ------- -11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vm-group -6d810c66-ffc7-47c8-8870-72114f86c2cf vm-group1 datastore1 photon7 +11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vmgroup +6d810c66-ffc7-47c8-8870-72114f86c2cf vmgroup1 datastore1 photon7 ``` -The datastore will be set as "default_datastore" for the vm-group when you grant datastore access for a vm-group with "--default-datastore" flag. +The datastore will be set as "default_datastore" for the vmgroup when you grant datastore access for a vmgroup with "--default-datastore" flag. Sample: ```bash -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access add --name=vm-group1 --datastore=datastore2 --allow-create --default-datastore --volume-maxsize=500MB --volume-totalsize=1GB -vm-group access add succeeded +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access add --name=vmgroup1 --datastore=datastore2 --allow-create --default-datastore --volume-maxsize=500MB --volume-totalsize=1GB +vmgroup access add succeeded -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access ls --name=vm-group1 +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access ls --name=vmgroup1 Datastore Allow_create Max_volume_size Total_size ---------- ------------ --------------- ---------- datastore1 False 500.00MB 1.00GB datastore2 True 500.00MB 1.00GB -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group ls +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup ls Uuid Name Description Default_datastore VM_list ------------------------------------ --------- -------------------------- ----------------- ------- -11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vm-group -6d810c66-ffc7-47c8-8870-72114f86c2cf vm-group1 datastore2 photon7 +11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vmgroup +6d810c66-ffc7-47c8-8870-72114f86c2cf vmgroup1 datastore2 photon7 ``` By default no "allow_create" right is given ```bash -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access add --name=vm-group1 --datastore=datastore1 --volume-maxsize=500MB --volume-totalsize=1GB -vm-group access add succeeded +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access add --name=vmgroup1 --datastore=datastore1 --volume-maxsize=500MB --volume-totalsize=1GB +vmgroup access add succeeded -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access ls --name=vm-group1 +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access ls --name=vmgroup1 Datastore Allow_create Max_volume_size Total_size ---------- ------------ --------------- ---------- datastore1 False 500.00MB 1.00GB @@ -320,10 +320,10 @@ datastore1 False 500.00MB 1.00GB "allow_create" right is given when you run the command with "--allow-create" flag. ```bash -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access add --name=vm-group1 --datastore=datastore2 --allow-create --default-datastore --volume-maxsize=500MB --volume-totalsize=1GB -vm-group access add succeeded +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access add --name=vmgroup1 --datastore=datastore2 --allow-create --default-datastore --volume-maxsize=500MB --volume-totalsize=1GB +vmgroup access add succeeded -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access ls --name=vm-group1 +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access ls --name=vmgroup1 Datastore Allow_create Max_volume_size Total_size ---------- ------------ --------------- ---------- datastore1 False 500.00MB 1.00GB @@ -332,8 +332,8 @@ datastore2 True 500.00MB 1.00GB ##### Help ```bash -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access add -h -usage: vmdkops_admin.py vm-group access add [-h] +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access add -h +usage: vmdkops_admin.py vmgroup access add [-h] [--volume-totalsize Num{MB,GB,TB} - e.g. 2TB] [--volume-maxsize Num{MB,GB,TB} - e.g. 2TB] [--allow-create] --name NAME @@ -344,11 +344,11 @@ optional arguments: -h, --help show this help message and exit --volume-totalsize Num{MB,GB,TB} - e.g. 2TB Maximum total size of all volume that can be created - on the datastore for this vm-group + on the datastore for this vmgroup --volume-maxsize Num{MB,GB,TB} - e.g. 2TB Maximum size of the volume that can be created --allow-create Allow create and delete on datastore if set - --name NAME The name of the vm-group + --name NAME The name of the vmgroup --default-datastore Mark datastore as a default datastore for this vm- group --datastore DATASTORE @@ -358,14 +358,14 @@ optional arguments: ``` #### List -List the current access control granted to a vm-group. +List the current access control granted to a vmgroup. When displaying the result keep in mind: - For capacity Unset indicates no limits ```bash -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access ls --name=vm-group1 +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access ls --name=vmgroup1 Datastore Allow_create Max_volume_size Total_size ---------- ------------ --------------- ---------- datastore1 False 500.00MB 1.00GB @@ -374,28 +374,28 @@ datastore2 True 500.00MB 1.00GB ##### Help ```bash -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access ls -h -usage: vmdkops_admin.py vm-group access ls [-h] --name NAME +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access ls -h +usage: vmdkops_admin.py vmgroup access ls [-h] --name NAME optional arguments: -h, --help show this help message and exit - --name NAME The name of the vm-group + --name NAME The name of the vmgroup ``` #### Remove -Remove access to a datastore for a vm-group. +Remove access to a datastore for a vmgroup. ```bash -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access ls --name=vm-group1 +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access ls --name=vmgroup1 Datastore Allow_create Max_volume_size Total_size ---------- ------------ --------------- ---------- datastore1 False 500.00MB 1.00GB datastore2 True 500.00MB 1.00GB -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access rm --name=vm-group1 --datastore=datastore1 -vm-group access rm succeeded +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access rm --name=vmgroup1 --datastore=datastore1 +vmgroup access rm succeeded -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access ls --name=vm-group1 +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access ls --name=vmgroup1 Datastore Allow_create Max_volume_size Total_size ---------- ------------ --------------- ---------- datastore2 True 500.00MB 1.00GB @@ -403,36 +403,36 @@ datastore2 True 500.00MB 1.00GB ##### Help ```bash -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access rm -h -usage: vmdkops_admin.py vm-group access rm [-h] --name NAME --datastore +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access rm -h +usage: vmdkops_admin.py vmgroup access rm [-h] --name NAME --datastore DATASTORE optional arguments: -h, --help show this help message and exit - --name NAME The name of the vm-group + --name NAME The name of the vmgroup --datastore DATASTORE Datstore which access is controlled ``` #### Set -Set command allows to change the existing access control in place for a vm-group. +Set command allows to change the existing access control in place for a vmgroup. Sample: ```shell -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access ls --name=vm-group1 +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access ls --name=vmgroup1 Datastore Allow_create Max_volume_size Total_size ---------- ------------ --------------- ---------- datastore1 False 500.00MB 1.00GB -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access set --name=vm-group1 --datastore=datastore1 --allow-create=True --volume-maxsize=1000MB --volume-totalsize=2GB -vm-group access set succeeded +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access set --name=vmgroup1 --datastore=datastore1 --allow-create=True --volume-maxsize=1000MB --volume-totalsize=2GB +vmgroup access set succeeded -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access ls -usage: vmdkops_admin.py vm-group access ls [-h] --name NAME -vmdkops_admin.py vm-group access ls: error: argument --name is required -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access ls --name=vm-group1 +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access ls +usage: vmdkops_admin.py vmgroup access ls [-h] --name NAME +vmdkops_admin.py vmgroup access ls: error: argument --name is required +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access ls --name=vmgroup1 Datastore Allow_create Max_volume_size Total_size ---------- ------------ --------------- ---------- datastore1 True 1000.00MB 2.00GB @@ -443,8 +443,8 @@ datastore1 True 1000.00MB 2.00GB ##### Help ``` -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access set -h -usage: vmdkops_admin.py vm-group access set [-h] +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access set -h +usage: vmdkops_admin.py vmgroup access set [-h] [--volume-totalsize Num{MB,GB,TB} - e.g. 2TB] --name NAME [--volume-maxsize Num{MB,GB,TB} - e.g. 2TB] @@ -455,8 +455,8 @@ optional arguments: -h, --help show this help message and exit --volume-totalsize Num{MB,GB,TB} - e.g. 2TB Maximum total size of all volume that can be created - on the datastore for this vm-group - --name NAME The name of the vm-group + on the datastore for this vmgroup + --name NAME The name of the vmgroup --volume-maxsize Num{MB,GB,TB} - e.g. 2TB Maximum size of the volume that can be created --allow-create Value{True|False} - e.g. True @@ -487,23 +487,23 @@ List all properties for all Docker volumes that exist on datastores accessible t ```bash [root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py volume ls -Volume Datastore VM-Group Capacity Used Filesystem Policy Disk Format Attached-to Access Attach-as Created By Created Date +Volume Datastore VMGroup Capacity Used Filesystem Policy Disk Format Attached-to Access Attach-as Created By Created Date ------ ---------- --------- -------- ---- ---------- ------ ----------- ----------- ---------- ---------------------- ---------- ------------------------ vol1 datastore1 _DEFAULT 100MB 13MB ext4 N/A thin detached read-write independent_persistent photon-6 Sun Sep 11 21:36:13 2016 vol12 datastore1 _DEFAULT 100MB 13MB ext4 N/A thin detached read-write independent_persistent photon-6 Sun Sep 11 22:29:39 2016 -vol1 datastore1 vm-group1 100MB 13MB ext4 N/A thin detached read-write independent_persistent photon-6 Sun Sep 11 22:48:13 2016 -vol2 datastore1 vm-group1 100MB 13MB ext4 N/A thin detached read-write independent_persistent photon-6 Sun Sep 11 22:48:23 2016 +vol1 datastore1 vmgroup1 100MB 13MB ext4 N/A thin detached read-write independent_persistent photon-6 Sun Sep 11 22:48:13 2016 +vol2 datastore1 vmgroup1 100MB 13MB ext4 N/A thin detached read-write independent_persistent photon-6 Sun Sep 11 22:48:23 2016 ``` Note that the `Policy` column shows the named VSAN storage policy created with the same tool (vmdkops_admin.py). Since these example virtual disks live on a VMFS datastore they do not have a storage policy and show up as `N/A'. -Note that the `VM-Group` column shows the vm-group by which the volume was created. If the vm-group which created the volume has been removed, the `VM-Group` column shows up as 'N/A'. See the following example: +Note that the `VMGroup` column shows the vmgroup by which the volume was created. If the vmgroup which created the volume has been removed, the `VMGroup` column shows up as 'N/A'. See the following example: ```bash [root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py volume ls -Volume Datastore VM-Group Capacity Used Filesystem Policy Disk Format Attached-to Access Attach-as Created By Created Date +Volume Datastore VMGroup Capacity Used Filesystem Policy Disk Format Attached-to Access Attach-as Created By Created Date ------ ---------- -------- -------- ---- ---------- ------ ----------- ----------- ---------- ---------------------- ---------- ------------------------ vol1 datastore1 _DEFAULT 100MB 13MB ext4 N/A thin detached read-write independent_persistent photon-6 Sun Sep 11 21:36:13 2016 vol12 datastore1 _DEFAULT 100MB 13MB ext4 N/A thin detached read-write independent_persistent photon-6 Sun Sep 11 22:29:39 2016 @@ -527,13 +527,13 @@ Note that the that the choices are given in a comma separated list with no space the help given above with `vmdkops_admin ls -h`. ### Set -Modify attribute settings on a given volume. The volume is identified by its name, vm-group_name which the volume belongs to and datastore, +Modify attribute settings on a given volume. The volume is identified by its name, vmgroup_name which the volume belongs to and datastore, for example if the volume name is `container-vol` then the volume is specified as "container-vol@datastore-name". The attributes to set/modify are specified as a comma separated list as "=, =....". For example, a command line would look like this. ```bash -$ vmdkops-admin set --volume= --vm-group= --options="=, =, ..." +$ vmdkops-admin set --volume= --vmgroup= --options="=, =, ..." ``` The volume attributes are set and take effect only the next time the volume attached to a VM. The changes do not impact any VM @@ -555,18 +555,18 @@ The container images themselves can be smaller as they share the libs and possib Example: ```bash [root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py volume ls -Volume Datastore VM-Group Capacity Used Filesystem Policy Disk Format Attached-to Access Attach-as Created By Created Date +Volume Datastore VMGroup Capacity Used Filesystem Policy Disk Format Attached-to Access Attach-as Created By Created Date ------ ---------- -------- -------- ---- ---------- ------ ----------- ----------- ---------- ---------------------- ---------- ------------------------ vol1 datastore1 _DEFAULT 100MB 13MB ext4 N/A thin detached read-write independent_persistent photon-6 Sun Sep 11 21:36:13 2016 vol12 datastore1 _DEFAULT 100MB 13MB ext4 N/A thin detached read-write independent_persistent photon-6 Sun Sep 11 22:29:39 2016 vol1 datastore1 N/A 100MB 13MB ext4 N/A thin detached read-write independent_persistent photon-6 Sun Sep 11 22:48:13 2016 vol2 datastore1 N/A 100MB 13MB ext4 N/A thin detached read-write independent_persistent photon-6 Sun Sep 11 22:48:23 2016 -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py volume set --volume=vol1@datastore1 --vm-group=_DEFAULT --options="access=read-only" +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py volume set --volume=vol1@datastore1 --vmgroup=_DEFAULT --options="access=read-only" Successfully updated settings for : vol1@datastore1 [root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py volume ls -Volume Datastore VM-Group Capacity Used Filesystem Policy Disk Format Attached-to Access Attach-as Created By Created Date +Volume Datastore VMGroup Capacity Used Filesystem Policy Disk Format Attached-to Access Attach-as Created By Created Date ------ ---------- -------- -------- ---- ---------- ------ ----------- ----------- ---------- ---------------------- ---------- ------------------------ vol1 datastore1 _DEFAULT 100MB 13MB ext4 N/A thin detached read-only independent_persistent photon-6 Sun Sep 11 21:36:13 2016 vol12 datastore1 _DEFAULT 100MB 13MB ext4 N/A thin detached read-write independent_persistent photon-6 Sun Sep 11 22:29:39 2016 diff --git a/docs/user-guide/faq.md b/docs/user-guide/faq.md index ca0eae54c..16c125296 100644 --- a/docs/user-guide/faq.md +++ b/docs/user-guide/faq.md @@ -44,11 +44,11 @@ Tenancy changes in release 0.10 need a manual upgrade process enumerated below. ### How to know if auth-db upgrade is needed post install? -After installing the new build, type command “vm-group ls” +After installing the new build, type command “vmgroup ls” Check for failure to connect to auth DB. ``` -/usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group ls +/usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup ls Failed to connect auth DB(DB connection error /etc/vmware/vmdkops/auth-db) ``` @@ -63,9 +63,9 @@ The corresponding errors in the vmdk_ops.log file. ### How to handle the upgrade manually? -#### Case 1: No vm-group configured before +#### Case 1: No vmgroup configured before -If no vm-group has been configured, user just needs to delete the auth-db file +If no vmgroup has been configured, user just needs to delete the auth-db file Step 1: Remove auth-db file at /etc/vmware/vmdkops/auth-db @@ -73,21 +73,21 @@ Step 1: Remove auth-db file at /etc/vmware/vmdkops/auth-db [root@localhost:/etc/vmware/vmdkops]rm /etc/vmware/vmdkops/auth-db ``` -Step 2: Verify “vm-group ls” command +Step 2: Verify “vmgroup ls” command ``` -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group ls +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup ls Uuid Name Description Default_datastore VM_list ------------------------------------ --------- -------------------------- ----------------- ------- -11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vm-group +11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vmgroup ``` After this point, the manually upgrade is done, and tenancy operations will succeed. -#### Case2: Has vm-group configured before +#### Case2: Has vmgroup configured before Step 1: Backup data manually. -Example below has a vm-group ```vm-group1``` with VM ```photon-6``` assigned to this vm-group1 and one volumes: vol1@datastore1 created. +Example below has a vmgroup ```vmgroup1``` with VM ```photon-6``` assigned to this vmgroup1 and one volumes: vol1@datastore1 created. ``` root@photon-JQQBWNwG6 [ ~ ]# docker volume ls @@ -103,40 +103,38 @@ Step 2: Move the auth-db file at /etc/vmware/vmdkops/auth-db [root@localhost:/etc/vmware/vmdkops]mv /etc/vmware/vmdkops/auth-db /etc/vmware/vmdkops/auth-db.backup.v10.upgrade ``` -Step 3: Verify “vm-group ls” command, now only ```_DEFAULT``` should be listed. +Step 3: Verify “vmgroup ls” command, now only ```_DEFAULT``` should be listed. ``` -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group ls +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup ls Uuid Name Description Default_datastore VM_list ------------------------------------ -------- -------------------------- ----------------- ------- -11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vm-group +11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vmgroup ``` -Step 4: Recreate the vm-group configuration with new name “new-vm-group1” (associate the same VM photon-6 to this new-vm-group1), see the following example: +Step 4: Recreate the vmgroup configuration with new name “new-vmgroup1” (associate the same VM photon-6 to this new-vmgroup1), see the following example: -***Note: Please DO NOT create the vm-group with the old name “vm-group1”!!!*** +***Note: Please DO NOT create the vmgroup with the old name “vmgroup1”!!!*** ``` -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group create --name=new-vm-group1 --vm-list=photon-6 -vm-group create succeeded -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group access add --name=new-vm-group1 --datastore=datastore1 --volume-maxsize=500MB --volume-totalsize=1GB --allow-create -vm-group access add succeeded +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup create --name=new-vmgroup1 --vm-list=photon-6 +vmgroup 'new-vmgroup1' is created. Do not forget to run 'vmgroup vm add' and 'vmgroup access add' commands to enable access control. +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup access add --name=new-vmgroup1 --datastore=datastore1 --volume-maxsize=500MB --volume-totalsize=1GB --allow-create +vmgroup access add succeeded -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group vm rm --name=new-vm-group1 --vm-list=photon7 -vm-group vm rm succeeded -[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vm-group ls +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py vmgroup ls Uuid Name Description Default_datastore VM_list ------------------------------------ ------------- -------------------------- ----------------- -------- -11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vm-group -5c0927fb-86b5-4034-87db-8bdfa24018d4 new-vm-group1 datastore1 photon-6 +11111111-1111-1111-1111-111111111111 _DEFAULT This is a default vmgroup +5c0927fb-86b5-4034-87db-8bdfa24018d4 new-vmgroup1 datastore1 photon-6 ``` -Step 4: Run “docker volume ls” from VM “photon-6”, volume which belongs to “vm-group1” which was created before will not be visible +Step 4: Run “docker volume ls” from VM “photon-6”, volume which belongs to “vmgroup1” which was created before will not be visible ``` root@photon-JQQBWNwG6 [ ~ ]# docker volume ls DRIVER VOLUME NAME @@ -155,12 +153,14 @@ Volume “vol1” which was created before still exists, and can be seen from th ``` [root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py volume ls -Volume Datastore Created By VM Created Attached To VM (name/uuid) Policy Capacity Used Disk Format Filesystem Type Access Attach As --------- ---------- ------------- ------------------------ -------------------------- ------ -------- ---- ----------- --------------- ---------- ---------------------- -vol1 datastore1 photon-6 Sun Sep 11 07:30:47 2016 detached N/A 100MB 13MB thin ext4 read-write independent_persistent -new-vol1 datastore1 photon-6 Sun Sep 11 08:03:56 2016 detached N/A 100MB 13MB thin ext4 read-write independent_persistent +[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py volume ls +Volume Datastore VMGroup Capacity Used Filesystem Policy Disk Format Attached-to Access Attach-as Created By Created Date +-------- ---------- ------------ -------- ---- ---------- ------ ----------- ----------- ---------- ---------------------- ---------- ------------------------ +vol1 datastore1 N/A 100MB 13MB ext4 N/A thin detached read-write independent_persistent photon-6 Wed Sep 14 16:20:30 2016 +new-vol1 datastore1 new-vmgroup1 100MB 13MB ext4 N/A thin detached read-write independent_persistent photon-6 Wed Sep 14 16:22:58 2016 + ``` Step6: Manually copy the data from backup to the new volume "new-vol1@datastore1". -The path which stores this new volume is "/vmfs/volumes/datastore1/dockvols/new-vm-group1". +The path which stores this new volume is "/vmfs/volumes/datastore1/dockvols/new-vmgroup1". diff --git a/esx_service/cli/vmdkops_admin.py b/esx_service/cli/vmdkops_admin.py index e96d632e1..94520a652 100644 --- a/esx_service/cli/vmdkops_admin.py +++ b/esx_service/cli/vmdkops_admin.py @@ -134,13 +134,13 @@ def commands(): 'args': { '-c': { 'help': 'Display selected columns', - 'choices': ['volume', 'datastore', 'vm-group', 'capacity', 'used', + 'choices': ['volume', 'datastore', 'vmgroup', 'capacity', 'used', 'fstype', 'policy', 'disk-format', 'attached-to', 'access', 'attach-as', 'created-by', 'created'], 'metavar': 'Col1,Col2,...' }, - '--vm-group' : { - 'help': 'Displays volumes for a given vm-group' + '--vmgroup' : { + 'help': 'Displays volumes for a given vmgroup' } } }, @@ -152,8 +152,8 @@ def commands(): 'help': 'Volume to set options for, specified as "volume@datastore".', 'required': True }, - '--vm-group': { - 'help': 'Name of the vm-group the volume belongs to.', + '--vmgroup': { + 'help': 'Name of the vmgroup the volume belongs to.', 'required': True }, '--options': { @@ -214,29 +214,29 @@ def commands(): } }, # - # vm-group {create, update, rm , ls} - manipulates vm-group - # vm-group vm {add, rm, ls} - manipulates VMs for a vm-group - # vm-group access {add, set, rm, ls} - manipulates datastore access right for a vm-group + # vmgroup {create, update, rm , ls} - manipulates vmgroup + # vmgroup vm {add, rm, ls} - manipulates VMs for a vmgroup + # vmgroup access {add, set, rm, ls} - manipulates datastore access right for a vmgroup # - # Internally, "vm-group" is called "tenant", and we decide to keep the name of functions as "tenant_*" + # Internally, "vmgroup" is called "tenant", and we decide to keep the name of functions as "tenant_*" - 'vm-group': { + 'vmgroup': { 'help': 'Administer and monitor volume access control', 'cmds': { 'create': { 'func': tenant_create, - 'help': 'Create a new vm-group', + 'help': 'Create a new vmgroup', 'args': { '--name': { - 'help': 'The name of the vm-group', + 'help': 'The name of the vmgroup', 'required': True }, '--description': { - 'help': 'The description of the vm-group', + 'help': 'The description of the vmgroup', }, - # a shortcut allowing to add VMs on vm-group Create + # a shortcut allowing to add VMs on vmgroup Create '--vm-list': { - 'help': 'A list of VM names to place in this vm-group', + 'help': 'A list of VM names to place in this vmgroup', 'metavar': 'vm1, vm2, ...', 'type': comma_separated_string } @@ -244,17 +244,17 @@ def commands(): }, 'update': { 'func': tenant_update, - 'help': 'Update an existing vm-group', + 'help': 'Update an existing vmgroup', 'args': { '--name': { - 'help': 'The name of the vm-group', + 'help': 'The name of the vmgroup', 'required': True }, '--new-name': { - 'help': 'The new name of the vm-group', + 'help': 'The new name of the vmgroup', }, '--description': { - 'help': 'The new description of the vm-group', + 'help': 'The new description of the vmgroup', }, '--default-datastore': { 'help': 'Datastore to be used by default for volumes placement', @@ -263,35 +263,35 @@ def commands(): }, 'rm': { 'func': tenant_rm, - 'help': 'Delete a vm-group', + 'help': 'Delete a vmgroup', 'args': { '--name': { - 'help': 'The name of the vm-group', + 'help': 'The name of the vmgroup', 'required': True }, '--remove-volumes': { - 'help': 'BE CAREFUL: Removes this vm-group volumes when removing a vm-group', + 'help': 'BE CAREFUL: Removes this vmgroup volumes when removing a vmgroup', 'action': 'store_true' } } }, 'ls': { 'func': tenant_ls, - 'help': 'List vm-groups and the VMs they are applied to' + 'help': 'List vmgroups and the VMs they are applied to' }, 'vm': { - 'help': 'Add, removes and lists VMs in a vm-group', + 'help': 'Add, removes and lists VMs in a vmgroup', 'cmds': { 'add': { - 'help': 'Add a VM(s) to a vm-group', + 'help': 'Add a VM(s) to a vmgroup', 'func': tenant_vm_add, 'args': { '--name': { - 'help': "Vm-group to add the VM to", + 'help': "Vmgroup to add the VM to", 'required': True }, '--vm-list': { - 'help': "A list of VM names to add to this vm-group", + 'help': "A list of VM names to add to this vmgroup", 'type': comma_separated_string, 'required': True } @@ -299,15 +299,15 @@ def commands(): }, 'rm': { - 'help': 'Remove VM(s) from a vm-group', + 'help': 'Remove VM(s) from a vmgroup', 'func': tenant_vm_rm, 'args': { '--name': { - 'help': "Vm-group to remove the VM from", + 'help': "Vmgroup to remove the VM from", 'required': True }, '--vm-list': { - 'help': "A list of VM names to rm from this vm-group", + 'help': "A list of VM names to rm from this vmgroup", 'type': comma_separated_string, 'required': True } @@ -315,15 +315,15 @@ def commands(): }, 'replace': { - 'help': 'Replace VM(s) for a vm-group', + 'help': 'Replace VM(s) for a vmgroup', 'func': tenant_vm_replace, 'args': { '--name': { - 'help': "Vm-group to replace the VM for", + 'help': "Vmgroup to replace the VM for", 'required': True }, '--vm-list': { - 'help': "A list of VM names to replace for this vm-group", + 'help': "A list of VM names to replace for this vmgroup", 'type': comma_separated_string, 'required': True } @@ -331,11 +331,11 @@ def commands(): }, 'ls': { - 'help': "list VMs in a vm-group", + 'help': "list VMs in a vmgroup", 'func': tenant_vm_ls, 'args': { '--name': { - 'help': "Vm-group to list the VMs for", + 'help': "Vmgroup to list the VMs for", 'required': True } } @@ -343,14 +343,14 @@ def commands(): } }, 'access': { - 'help': 'Add or remove Datastore access and quotas for a vm-group', + 'help': 'Add or remove Datastore access and quotas for a vmgroup', 'cmds': { 'add': { 'func': tenant_access_add, - 'help': 'Add a datastore access for a vm-group', + 'help': 'Add a datastore access for a vmgroup', 'args': { '--name': { - 'help': 'The name of the vm-group', + 'help': 'The name of the vmgroup', 'required': True }, '--datastore': { @@ -358,7 +358,7 @@ def commands(): 'required': True }, '--default-datastore': { - 'help': "Mark datastore as a default datastore for this vm-group", + 'help': "Mark datastore as a default datastore for this vmgroup", 'action': 'store_true' }, '--allow-create': { @@ -371,17 +371,17 @@ def commands(): }, '--volume-totalsize': { 'help': - 'Maximum total size of all volume that can be created on the datastore for this vm-group', + 'Maximum total size of all volume that can be created on the datastore for this vmgroup', 'metavar': 'Num{MB,GB,TB} - e.g. 2TB' } } }, 'set': { 'func': tenant_access_set, - 'help': 'Modify datastore access for a vm-group', + 'help': 'Modify datastore access for a vmgroup', 'args': { '--name': { - 'help': 'The name of the vm-group', + 'help': 'The name of the vmgroup', 'required': True }, '--datastore': { @@ -399,17 +399,17 @@ def commands(): }, '--volume-totalsize': { 'help': - 'Maximum total size of all volume that can be created on the datastore for this vm-group', + 'Maximum total size of all volume that can be created on the datastore for this vmgroup', 'metavar': 'Num{MB,GB,TB} - e.g. 2TB' } } }, 'rm': { 'func': tenant_access_rm, - 'help': "Remove all access to a datastore for a vm-group", + 'help': "Remove all access to a datastore for a vmgroup", 'args': { '--name': { - 'help': 'The name of the vm-group', + 'help': 'The name of the vmgroup', 'required': True }, '--datastore': { @@ -420,10 +420,10 @@ def commands(): }, 'ls': { 'func': tenant_access_ls, - 'help': 'List all access info for a vm-group', + 'help': 'List all access info for a vmgroup', 'args': { '--name': { - 'help': 'The name of the vm-group', + 'help': 'The name of the vmgroup', 'required': True } } @@ -512,8 +512,8 @@ def ls(args): If args.c is not empty only display columns given in args.c (implies -l). """ tenant_reg = '*' - if args.vm_group: - tenant_reg = args.vm_group + if args.vmgroup: + tenant_reg = args.vmgroup if args.c: (header, rows) = ls_dash_c(args.c, tenant_reg) @@ -542,7 +542,7 @@ def ls_dash_c(columns, tenant_reg): def all_ls_headers(): """ Return a list of all header for ls -l """ - return ['Volume', 'Datastore', 'VM-Group', 'Capacity', 'Used', 'Filesystem', 'Policy', + return ['Volume', 'Datastore', 'VMGroup', 'Capacity', 'Used', 'Filesystem', 'Policy', 'Disk Format', 'Attached-to', 'Access', 'Attach-as', 'Created By', 'Created Date'] def generate_ls_rows(tenant_reg): @@ -745,7 +745,7 @@ def status(args): def set_vol_opts(args): try: - set_ok = vmdk_ops.set_vol_opts(args.volume, args.vm_group, args.options) + set_ok = vmdk_ops.set_vol_opts(args.volume, args.vmgroup, args.options) if set_ok: print('Successfully updated settings for : {0}'.format(args.volume)) else: @@ -854,8 +854,8 @@ def tenant_create(args): if error_info: return operation_fail(error_info.msg) else: - print("vm-group '{}' is created. Do not forget to run " - "'vm-group vm add' and 'vm-group access add' commands to enable access control.".format(args.name)) + print("vmgroup '{}' is created. Do not forget to run " + "'vmgroup vm add' and 'vmgroup access add' commands to enable access control.".format(args.name)) def tenant_update(args): """ Handle tenant update command """ @@ -867,7 +867,7 @@ def tenant_update(args): if error_info: return operation_fail(error_info.msg) else: - print("vm-group modify succeeded") + print("vmgroup modify succeeded") def tenant_rm(args): """ Handle tenant rm command """ @@ -883,7 +883,7 @@ def tenant_rm(args): if error_info: return operation_fail(error_info.msg) else: - print("vm-group rm succeeded") + print("vmgroup rm succeeded") def tenant_ls(args): """ Handle tenant ls command """ @@ -902,7 +902,7 @@ def tenant_vm_add(args): if error_info: return operation_fail(error_info.msg) else: - print("vm-group vm add succeeded") + print("vmgroup vm add succeeded") def tenant_vm_rm(args): """ Handle tenant vm rm command """ @@ -911,7 +911,7 @@ def tenant_vm_rm(args): if error_info: return operation_fail(error_info.msg) else: - print("vm-group vm rm succeeded") + print("vmgroup vm rm succeeded") def tenant_vm_replace(args): """ Handle tenant vm replace command """ @@ -920,7 +920,7 @@ def tenant_vm_replace(args): if error_info: return operation_fail(error_info.msg) else: - print("vm-group vm replace succeeded") + print("vmgroup vm replace succeeded") def tenant_vm_ls_headers(): """ Return column names for tenant vm ls command """ @@ -976,7 +976,7 @@ def tenant_access_add(args): if error_info: return operation_fail(error_info.msg) else: - print("vm-group access add succeeded") + print("vmgroup access add succeeded") def tenant_access_set(args): """ Handle tenant access set command """ @@ -996,7 +996,7 @@ def tenant_access_set(args): if error_info: return operation_fail(error_info.msg) else: - print("vm-group access set succeeded") + print("vmgroup access set succeeded") def tenant_access_rm(args): """ Handle tenant access rm command """ @@ -1004,7 +1004,7 @@ def tenant_access_rm(args): if error_info: return operation_fail(error_info.msg) else: - print("vm-group access rm succeeded") + print("vmgroup access rm succeeded") def tenant_access_ls_headers(): """ Return column names for tenant access ls command """ diff --git a/esx_service/cli/vmdkops_admin_test.py b/esx_service/cli/vmdkops_admin_test.py index e5a8449f5..ec09b926d 100644 --- a/esx_service/cli/vmdkops_admin_test.py +++ b/esx_service/cli/vmdkops_admin_test.py @@ -42,7 +42,7 @@ # Number of expected columns in "tenant vm ls" TENANT_ACCESS_LS_EXPECTED_COLUMN_COUNT = 4 -VMGROUP = 'vm-group' +VMGROUP = 'vmgroup' def convert_to_str(unicode_or_str): python_version = sys.version_info.major @@ -120,28 +120,28 @@ def test_policy_ls(self): def test_policy_ls_badargs(self): self.assert_parse_error('policy ls --name=yo') - # NOTE: "tenant" is renamed to "vm-group", but we only change it in command line + # NOTE: "tenant" is renamed to "vmgroup", but we only change it in command line # all the function name remain unchanged def test_tenant_create(self): - args = self.parser.parse_args((VMGROUP + ' create --name=vm-group1 --vm-list vm1,vm2').split()) + args = self.parser.parse_args((VMGROUP + ' create --name=vmgroup1 --vm-list vm1,vm2').split()) self.assertEqual(args.func, vmdkops_admin.tenant_create) - self.assertEqual(args.name, 'vm-group1') + self.assertEqual(args.name, 'vmgroup1') self.assertEqual(args.vm_list, ['vm1', 'vm2']) def test_tenant_create_missing_option_fails(self): self.assert_parse_error(VMGROUP + ' create') def test_tenant_rm(self): - args = self.parser.parse_args((VMGROUP + ' rm --name=vm-group1 --remove-volumes').split()) + args = self.parser.parse_args((VMGROUP + ' rm --name=vmgroup1 --remove-volumes').split()) self.assertEqual(args.func, vmdkops_admin.tenant_rm) - self.assertEqual(args.name, 'vm-group1') + self.assertEqual(args.name, 'vmgroup1') self.assertEqual(args.remove_volumes, True) def test_tenant_rm_without_arg_remove_volumes(self): - args = self.parser.parse_args((VMGROUP + ' rm --name=vm-group1').split()) + args = self.parser.parse_args((VMGROUP + ' rm --name=vmgroup1').split()) self.assertEqual(args.func, vmdkops_admin.tenant_rm) - self.assertEqual(args.name, 'vm-group1') + self.assertEqual(args.name, 'vmgroup1') # If arg "remove_volumes" is not specified in the CLI, then args.remove_volumes # will be None self.assertEqual(args.remove_volumes, False) @@ -155,37 +155,37 @@ def test_tenant_ls(self): self.assertEqual(args.func, vmdkops_admin.tenant_ls) def test_tenant_vm_add(self): - args = self.parser.parse_args((VMGROUP + ' vm add --name=vm-group1 --vm-list vm1,vm2').split()) + args = self.parser.parse_args((VMGROUP + ' vm add --name=vmgroup1 --vm-list vm1,vm2').split()) self.assertEqual(args.func, vmdkops_admin.tenant_vm_add) - self.assertEqual(args.name, 'vm-group1') + self.assertEqual(args.name, 'vmgroup1') self.assertEqual(args.vm_list, ['vm1', 'vm2']) def test_tenant_vm_add_missing_option_fails(self): self.assert_parse_error(VMGROUP + ' vm add') - self.assert_parse_error(VMGROUP + ' vm add --name=vm-group1') + self.assert_parse_error(VMGROUP + ' vm add --name=vmgroup1') def test_tenant_vm_rm(self): - args = self.parser.parse_args((VMGROUP + ' vm rm --name=vm-group1 --vm-list vm1,vm2').split()) + args = self.parser.parse_args((VMGROUP + ' vm rm --name=vmgroup1 --vm-list vm1,vm2').split()) self.assertEqual(args.func, vmdkops_admin.tenant_vm_rm) - self.assertEqual(args.name, 'vm-group1') + self.assertEqual(args.name, 'vmgroup1') self.assertEqual(args.vm_list, ['vm1', 'vm2']) def test_tenant_vm_rm_missing_option_fails(self): self.assert_parse_error(VMGROUP + ' vm add') - self.assert_parse_error(VMGROUP + ' vm add --name=vm-group1') + self.assert_parse_error(VMGROUP + ' vm add --name=vmgroup1') def test_tenant_vm_ls(self): - args = self.parser.parse_args((VMGROUP + ' vm ls --name=vm-group1').split()) + args = self.parser.parse_args((VMGROUP + ' vm ls --name=vmgroup1').split()) self.assertEqual(args.func, vmdkops_admin.tenant_vm_ls) - self.assertEqual(args.name, 'vm-group1') + self.assertEqual(args.name, 'vmgroup1') def test_tenant_vm_ls_missing_option_fails(self): self.assert_parse_error(VMGROUP + ' vm ls') def test_tenant_access_add(self): - args = self.parser.parse_args((VMGROUP + ' access add --name=vm-group1 --datastore=datastore1 --default-datastore --allow-create --volume-maxsize=500MB --volume-totalsize=1GB').split()) + args = self.parser.parse_args((VMGROUP + ' access add --name=vmgroup1 --datastore=datastore1 --default-datastore --allow-create --volume-maxsize=500MB --volume-totalsize=1GB').split()) self.assertEqual(args.func, vmdkops_admin.tenant_access_add) - self.assertEqual(args.name, 'vm-group1') + self.assertEqual(args.name, 'vmgroup1') self.assertEqual(args.datastore, 'datastore1') self.assertEqual(args.allow_create, True) self.assertEqual(args.default_datastore, True) @@ -194,24 +194,24 @@ def test_tenant_access_add(self): def test_tenant_access_add_missing_option_fails(self): self.assert_parse_error(VMGROUP + ' access add') - self.assert_parse_error(VMGROUP + ' access add --name=vm-group1') + self.assert_parse_error(VMGROUP + ' access add --name=vmgroup1') def test_tenant_access_add_invalid_option_fails(self): - self.assert_parse_error(VMGROUP + ' access add --name=vm-group1 --datastore=datastore1 --rights=create mount') + self.assert_parse_error(VMGROUP + ' access add --name=vmgroup1 --datastore=datastore1 --rights=create mount') def test_tenant_access_set(self): - args = self.parser.parse_args((VMGROUP + ' access set --name=vm-group1 --datastore=datastore1 --allow-create=True --volume-maxsize=500MB --volume-totalsize=1GB').split()) + args = self.parser.parse_args((VMGROUP + ' access set --name=vmgroup1 --datastore=datastore1 --allow-create=True --volume-maxsize=500MB --volume-totalsize=1GB').split()) self.assertEqual(args.func, vmdkops_admin.tenant_access_set) - self.assertEqual(args.name, 'vm-group1') + self.assertEqual(args.name, 'vmgroup1') self.assertEqual(args.datastore, 'datastore1') self.assertEqual(args.allow_create, "True") self.assertEqual(args.volume_maxsize, '500MB') self.assertEqual(args.volume_totalsize, '1GB') def test_tenant_accss_set_not_set_allow_create(self): - args = self.parser.parse_args((VMGROUP + ' access set --name=vm-group1 --datastore=datastore1 --volume-maxsize=500MB --volume-totalsize=1GB').split()) + args = self.parser.parse_args((VMGROUP + ' access set --name=vmgroup1 --datastore=datastore1 --volume-maxsize=500MB --volume-totalsize=1GB').split()) self.assertEqual(args.func, vmdkops_admin.tenant_access_set) - self.assertEqual(args.name, 'vm-group1') + self.assertEqual(args.name, 'vmgroup1') self.assertEqual(args.datastore, 'datastore1') self.assertEqual(args.allow_create, None) self.assertEqual(args.volume_maxsize, '500MB') @@ -219,25 +219,25 @@ def test_tenant_accss_set_not_set_allow_create(self): def test_tenant_access_set_missing_option_fails(self): self.assert_parse_error(VMGROUP + ' access set') - self.assert_parse_error(VMGROUP + ' access set --name=vm-group1') + self.assert_parse_error(VMGROUP + ' access set --name=vmgroup1') def test_tenant_access_set_invalid_option_fails(self): - self.assert_parse_error(VMGROUP + ' access set --name=vm-group1 --datastore=datastore1 --rights=crete,mount') + self.assert_parse_error(VMGROUP + ' access set --name=vmgroup1 --datastore=datastore1 --rights=crete,mount') def test_tenant_access_rm(self): - args = self.parser.parse_args((VMGROUP + ' access rm --name=vm-group1 --datastore=datastore1').split()) + args = self.parser.parse_args((VMGROUP + ' access rm --name=vmgroup1 --datastore=datastore1').split()) self.assertEqual(args.func, vmdkops_admin.tenant_access_rm) - self.assertEqual(args.name, 'vm-group1') + self.assertEqual(args.name, 'vmgroup1') self.assertEqual(args.datastore, 'datastore1') def test_tenant_access_rm_missing_option_fails(self): self.assert_parse_error(VMGROUP + ' access rm') - self.assert_parse_error(VMGROUP + ' access rm --name=vm-group1') + self.assert_parse_error(VMGROUP + ' access rm --name=vmgroup1') def test_tenant_access_ls(self): - args = self.parser.parse_args((VMGROUP + ' access ls --name=vm-group1').split()) + args = self.parser.parse_args((VMGROUP + ' access ls --name=vmgroup1').split()) self.assertEqual(args.func, vmdkops_admin.tenant_access_ls) - self.assertEqual(args.name, 'vm-group1') + self.assertEqual(args.name, 'vmgroup1') def test_tenant_access_ls_missing_option_fails(self): self.assert_parse_error(VMGROUP + ' access ls') @@ -261,22 +261,22 @@ def test_set_no_options(self): self.assert_parse_error('set --volume=volume_name') def test_set(self): - args = self.parser.parse_args('volume set --volume=vol_name@datastore --vm-group=vm-group1 --options="access=read-only"'.split()) + args = self.parser.parse_args('volume set --volume=vol_name@datastore --vmgroup=vmgroup1 --options="access=read-only"'.split()) self.assertEqual(args.func, vmdkops_admin.set_vol_opts) self.assertEqual(args.volume, 'vol_name@datastore') - self.assertEqual(args.vm_group, 'vm-group1') + self.assertEqual(args.vmgroup, 'vmgroup1') self.assertEqual(args.options, '"access=read-only"') - args = self.parser.parse_args('volume set --volume=vol_name@datastore --vm-group=vm-group1 --options="attach-as=persistent"'.split()) + args = self.parser.parse_args('volume set --volume=vol_name@datastore --vmgroup=vmgroup1 --options="attach-as=persistent"'.split()) self.assertEqual(args.func, vmdkops_admin.set_vol_opts) self.assertEqual(args.volume, 'vol_name@datastore') - self.assertEqual(args.vm_group, 'vm-group1') + self.assertEqual(args.vmgroup, 'vmgroup1') self.assertEqual(args.options, '"attach-as=persistent"') - args = self.parser.parse_args('volume set --volume=vol_name@datastore --vm-group=vm-group1 --options="attach-as=independent_persistent"'.split()) + args = self.parser.parse_args('volume set --volume=vol_name@datastore --vmgroup=vmgroup1 --options="attach-as=independent_persistent"'.split()) self.assertEqual(args.func, vmdkops_admin.set_vol_opts) self.assertEqual(args.volume, 'vol_name@datastore') - self.assertEqual(args.vm_group, 'vm-group1') + self.assertEqual(args.vmgroup, 'vmgroup1') self.assertEqual(args.options, '"attach-as=independent_persistent"') # Usage is always printed on a parse error. It's swallowed to prevent clutter. @@ -444,9 +444,9 @@ class TestTenant(unittest.TestCase): Test tenant functionality """ - # NOTE:We rename "tenant" to "vm-group", but we do not plan to + # NOTE:We rename "tenant" to "vmgroup", but we do not plan to # change the name used in the following test - # only the command itself will be changed from "tenantxxx" to "vm-group xxx" + # only the command itself will be changed from "tenantxxx" to "vmgroup xxx" # The following tests are covered: # 1. tenant command @@ -807,7 +807,7 @@ def test_tenant_access(self): ] for val in privilege_test_info: - command = ("vm-group access set --name={0} ".format(self.tenant1_name)) + command = ("vmgroup access set --name={0} ".format(self.tenant1_name)) command += ("--datastore={0} ".format(self.datastore_name)) command += ("--allow-create={0} ".format(val[0])) command += ("--volume-maxsize=500MB --volume-totalsize=1GB") @@ -833,7 +833,7 @@ def test_tenant_access(self): self.assertEqual(expected_output, actual_output) for val in ["INVALID", ""]: - command = ("vm-group access set --name={0} ".format(self.tenant1_name)) + command = ("vmgroup access set --name={0} ".format(self.tenant1_name)) command += ("--datastore={0} ".format(self.datastore_name)) command += ("--allow-create={0} ".format(val)) command += ("--volume-maxsize=500MB --volume-totalsize=1GB") diff --git a/esx_service/utils/auth_api.py b/esx_service/utils/auth_api.py index 0d3b976e3..1cebd91dc 100644 --- a/esx_service/utils/auth_api.py +++ b/esx_service/utils/auth_api.py @@ -28,7 +28,7 @@ # regex for valid tenant name VALID_TENANT_NAME_REGEXP = "[a-zA-Z0-9_][a-zA-Z0-9_.-]*" -VALID_TENANT_NAMES = 'rename of vm-groups other than _DEFAULT' +VALID_TENANT_NAMES = 'rename of vmgroups other than _DEFAULT' global valid_tenant_name_reg valid_tenant_name_reg = re.compile("^" + VALID_TENANT_NAME_REGEXP + "$") diff --git a/esx_service/utils/auth_data.py b/esx_service/utils/auth_data.py index 2e19aa634..93f41d250 100644 --- a/esx_service/utils/auth_data.py +++ b/esx_service/utils/auth_data.py @@ -15,8 +15,8 @@ """ VM based authorization for docker volumes and tenant management. -Note that for external consumption we refer to a 'tenant' as a 'vm-group'. -This way the code operates 'tenants' but user/admin operates 'vm-groups' +Note that for external consumption we refer to a 'tenant' as a 'vmgroup'. +This way the code operates 'tenants' but user/admin operates 'vmgroups' """ import sqlite3 @@ -436,7 +436,7 @@ def create_default_tenant(self): """ Create DEFAULT tenant """ error_msg, tenant = self.create_tenant( name=auth_data_const.DEFAULT_TENANT, - description="This is a default vm-group", + description="This is a default vmgroup", vms=[], privileges=[]) if error_msg: diff --git a/esx_service/utils/error_code.py b/esx_service/utils/error_code.py index ee017ab60..5ae521363 100644 --- a/esx_service/utils/error_code.py +++ b/esx_service/utils/error_code.py @@ -59,14 +59,14 @@ class ErrorCode: error_code_to_message = { - ErrorCode.VM_NOT_BELONG_TO_TENANT : "VM {0} does not belong to any vm-group", - ErrorCode.TENANT_NOT_EXIST : "Vm-group {0} does not exist", - ErrorCode.TENANT_ALREADY_EXIST : "Vm-group {0} already exists", - ErrorCode.TENANT_NAME_NOT_FOUND : "Cannot find vm-group name for vm-group with {0}", - ErrorCode.TENANT_CREATE_FAILED : "Vm-group {0} create failed with err: {1}", - ErrorCode.TENANT_SET_ACCESS_PRIVILEGES_FAILED : "Vm-group {0} set access privileges on datastore {1} failed with err: {2}", - ErrorCode.TENANT_GET_FAILED : "Get vm-group {0} failed", - ErrorCode.TENANT_NAME_INVALID : "Vm-group name {0} is invalid, only {1} is allowed", + ErrorCode.VM_NOT_BELONG_TO_TENANT : "VM {0} does not belong to any vmgroup", + ErrorCode.TENANT_NOT_EXIST : "Vmgroup {0} does not exist", + ErrorCode.TENANT_ALREADY_EXIST : "Vmgroup {0} already exists", + ErrorCode.TENANT_NAME_NOT_FOUND : "Cannot find vmgroup name for vmgroup with {0}", + ErrorCode.TENANT_CREATE_FAILED : "Vmgroup {0} create failed with err: {1}", + ErrorCode.TENANT_SET_ACCESS_PRIVILEGES_FAILED : "Vmgroup {0} set access privileges on datastore {1} failed with err: {2}", + ErrorCode.TENANT_GET_FAILED : "Get vmgroup {0} failed", + ErrorCode.TENANT_NAME_INVALID : "Vmgroup name {0} is invalid, only {1} is allowed", ErrorCode.VM_NOT_FOUND : "Cannot find vm {0}", ErrorCode.REPLACE_VM_EMPTY : "Replace VM cannot be empty", @@ -84,9 +84,9 @@ class ErrorCode: ErrorCode.DEFAULT_DS_NOT_SET : "Default datastore is not set", ErrorCode.DS_NOT_EXIST : "Datastore {0} does not exist", - ErrorCode.VMODL_TENANT_NAME_EMPTY : "Vm-group name is empty", - ErrorCode.VMODL_TENANT_NAME_TOO_LONG : "Vm-group name exceeds 64 characters: {0}", - ErrorCode.VMODL_TENANT_DESC_TOO_LONG : "Vm-group description exceeds 256 characters: {0}", + ErrorCode.VMODL_TENANT_NAME_EMPTY : "Vmgroup name is empty", + ErrorCode.VMODL_TENANT_NAME_TOO_LONG : "Vmgroup name exceeds 64 characters: {0}", + ErrorCode.VMODL_TENANT_DESC_TOO_LONG : "Vmgroup description exceeds 256 characters: {0}", ErrorCode.INTERNAL_ERROR : "Internal Error({0})", ErrorCode.INVALID_ARGUMENT : "Invalid Argument({0})", diff --git a/esx_service/vmdk_ops_test.py b/esx_service/vmdk_ops_test.py index dc4af4ee3..c62020f43 100644 --- a/esx_service/vmdk_ops_test.py +++ b/esx_service/vmdk_ops_test.py @@ -722,7 +722,7 @@ def create_default_tenant_and_privileges(self): error_msg, tenant = auth_mgr.create_tenant( name=auth_data_const.DEFAULT_TENANT, - description="This is a default tenant", + description="This is a default vmgroup", vms=[], privileges=[]) @@ -1277,7 +1277,7 @@ def create_default_tenant_and_privileges(self): logging.debug("create_default_tenant_and_privileges: create DEFAULT tenant") error_info, tenant = auth_api._tenant_create( name=auth_data_const.DEFAULT_TENANT, - description="This is a default tenant", + description="This is a default vmgroup", vm_list=[], privileges=[]) if error_info: