示例#1
0
def do_replication_delete(cs, args):
    """Delete a replication."""
    failure_count = 0
    for item in args.replication:
        try:
            replication = shell_utils.find_replication(cs, item)
            cs.replications.delete(replication.id)
            print("Request to delete replication %s has been accepted." % item)
        except Exception as e:
            failure_count += 1
            print("Delete for replication %s failed: %s" % (item, e))
    if failure_count == len(args.replication):
        raise exceptions.CommandError("Unable to delete any of the specified "
                                      "replications.")
示例#2
0
def do_replication_update(cs, args):
    kwargs = {}
    if args.name is not None:
        kwargs['name'] = args.name
    if args.description is not None:
        kwargs['description'] = args.description

    if not kwargs:
        msg = 'Must supply either name or description.'
        raise exceptions.ClientException(code=1, message=msg)

    replication = shell_utils.find_replication(cs, args.replication)
    replication = cs.replications.update(replication.id, kwargs)
    utils.print_dict(replication.to_dict())
示例#3
0
def do_checkpoint_create(cs, args):
    """Create checkpoint."""
    replication = shell_utils.find_replication(cs, args.replication)
    checkpoint = cs.checkpoints.create(replication.id, args.name,
                                       args.description)
    utils.print_dict(checkpoint.to_dict())
示例#4
0
def do_replication_reverse(cs, args):
    """Reverse a replication."""
    replication = shell_utils.find_replication(cs, args.replication)
    replication = cs.replications.reverse(replication.id)
    utils.print_dict(replication.to_dict())
示例#5
0
def do_replication_failover(cs, args):
    """Failover a replication."""
    replication = shell_utils.find_replication(cs, args.replication)
    replication = cs.replications.failover(replication.id, args.force)
    utils.print_dict(replication.to_dict())
示例#6
0
def do_replication_disable(cs, args):
    """Disable a replication."""
    replication = shell_utils.find_replication(cs, args.replication)
    replication = cs.replications.disable(replication.id)
    utils.print_dict(replication.to_dict())
示例#7
0
def do_replication_show(cs, args):
    """Get a replication."""
    replication = shell_utils.find_replication(cs, args.replication)
    utils.print_dict(replication.to_dict())