Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
BUG FIX: Add to docstring about current RP name limitation (basenames…
Browse files Browse the repository at this point in the history
… must be unique) and rename functions from add/delete to attach/detach (#238)
  • Loading branch information
ckolovson committed Sep 1, 2018
1 parent 3f7654f commit 2d23ba2
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions vcd_cli/pvdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,22 @@ def pvdc(ctx):
Parameters --storage-profile and --resource-pool are both
required parameters and each can have multiple entries.
\b
vcd pvdc add_rp pvdc-name rp1 rp2 ... (one or more rp names)
Add one or more resource pools to a Provider vDC.
vcd pvdc attach-rp pvdc-name rp1 rp2 ... (one or more rp names)
Attach one or more resource pools to a Provider vDC.
\b
vcd pvdc del_rp pvdc-name rp1 rp2 ... (one or more rp names)
Delete one or more resource pools from a Provider vDC.
vcd pvdc detach-rp pvdc-name rp1 rp2 ... (one or more rp names)
Detach one or more resource pools from a Provider vDC.
\b
Caveat: The current implementation of the attach-rp and detach-rp
functions take a list of RP "basenames" as input. A basename is the
last element of a full pathname. For example, given a pathname /a/b/c,
the basename of that pathname is "c". Since RP names are only required
to have unique pathnames but not unique basenames, this function may
not work correctly if there are non-unique RP basenames. Therefore, in
order to use these functions, all RP basenames must be unique. It is
up to the user of these functions to be aware of this limitation and
name their RPs appropriately. This limitation will be fixed in a future
version of these functions.
"""
pass

Expand Down Expand Up @@ -172,33 +183,33 @@ def create(ctx, vc_name, resource_pool, storage_profile, pvdc_name,
stderr(e, ctx)


@pvdc.command('add_rp', short_help='add resource pools to a pvdc')
@pvdc.command('attach-rp', short_help='attach resource pools to a pvdc')
@click.pass_context
@click.argument('pvdc-name', metavar='<pvdc-name>', required=True)
@click.argument('respool', nargs=-1, metavar='<respool>', required=True)
def add_rp(ctx, pvdc_name, respool):
def attach_rp(ctx, pvdc_name, respool):
try:
restore_session(ctx)
client = ctx.obj['client']
platform = Platform(client)
task = platform.add_resource_pools_to_provider_vdc(
task = platform.attach_resource_pools_to_provider_vdc(
pvdc_name=pvdc_name,
resource_pool_names=respool)
stdout(task, ctx)
except Exception as e:
stderr(e, ctx)


@pvdc.command('del_rp', short_help='delete resource pools from a pvdc')
@pvdc.command('detach-rp', short_help='detach resource pools from a pvdc')
@click.pass_context
@click.argument('pvdc-name', metavar='<pvdc-name>', required=True)
@click.argument('respool', nargs=-1, metavar='<respool>', required=True)
def del_rp(ctx, pvdc_name, respool):
def detach_rp(ctx, pvdc_name, respool):
try:
restore_session(ctx)
client = ctx.obj['client']
platform = Platform(client)
task = platform.del_resource_pools_from_provider_vdc(
task = platform.detach_resource_pools_from_provider_vdc(
pvdc_name=pvdc_name,
resource_pool_names=respool)
stdout(task, ctx)
Expand Down

0 comments on commit 2d23ba2

Please sign in to comment.