Beispiel #1
0
def remove_shard_command(parsed_options):
    shard_id = parsed_options.shardId

    # determine if the shard is a replicaset cluster or a server
    shard = repository.lookup_cluster(shard_id)

    if not shard:
        shard = repository.lookup_server(shard_id)

    if not shard:
        raise MongoctlException("Unknown shard '%s'" % shard_id)

    sharded_cluster = repository.lookup_cluster_by_shard(shard)

    if not sharded_cluster:
        raise MongoctlException("'%s' is not a shard" % shard_id)


    dest = getattr(parsed_options, "unshardedDataDestination")
    synchronized = getattr(parsed_options, "synchronized")

    if parsed_options.dryRun:
        dry_run_remove_shard(shard, sharded_cluster)
    else:
        sharded_cluster.remove_shard(shard,
                                      unsharded_data_dest_id=dest,
                                      synchronized=synchronized)
Beispiel #2
0
def remove_shard_command(parsed_options):
    shard_id = parsed_options.shardId

    # determine if the shard is a replicaset cluster or a server
    shard = repository.lookup_cluster(shard_id)

    if not shard:
        shard = repository.lookup_server(shard_id)

    if not shard:
        raise MongoctlException("Unknown shard '%s'" % shard_id)

    sharded_cluster = repository.lookup_cluster_by_shard(shard)

    if not sharded_cluster:
        raise MongoctlException("'%s' is not a shard" % shard_id)

    dest = getattr(parsed_options, "unshardedDataDestination")
    synchronized = getattr(parsed_options, "synchronized")

    if parsed_options.dryRun:
        dry_run_remove_shard(shard, sharded_cluster)
    else:
        sharded_cluster.remove_shard(shard,
                                     unsharded_data_dest_id=dest,
                                     synchronized=synchronized)
Beispiel #3
0
def _do_add_shard_command(shard_id, dry_run=False):
    # determine if the shard is a replicaset cluster or a server
    shard = repository.lookup_cluster(shard_id)

    if not shard:
        shard = repository.lookup_server(shard_id)

    if not shard:
        raise MongoctlException("Unknown shard '%s'" % shard_id)

    # We obtain which cluster this shard belongs to
    sharded_cluster = repository.lookup_cluster_by_shard(shard)

    if not sharded_cluster:
        raise MongoctlException("'%s' is not a shard" % shard_id)

    if dry_run:
        dry_run_add_shard(shard, sharded_cluster)
    else:
        sharded_cluster.add_shard(shard)
Beispiel #4
0
def add_shard_command(parsed_options):
    shard_id = parsed_options.shardId

    # determine if the shard is a replicaset cluster or a server
    shard = repository.lookup_cluster(shard_id)

    if not shard:
        shard = repository.lookup_server(shard_id)

    if not shard:
        raise MongoctlException("Unknown shard '%s'" % shard_id)

    sharded_cluster = repository.lookup_cluster_by_shard(shard)

    if not sharded_cluster:
        raise MongoctlException("'%s' is not a shard" % shard_id)

    if parsed_options.dryRun:
        dry_run_add_shard(shard, sharded_cluster)
    else:
        add_shard(shard, sharded_cluster)
Beispiel #5
0
def add_shard_command(parsed_options):
    shard_id = parsed_options.shardId

    # determine if the shard is a replicaset cluster or a server
    shard = repository.lookup_cluster(shard_id)

    if not shard:
        shard = repository.lookup_server(shard_id)

    if not shard:
        raise MongoctlException("Unknown shard '%s'" % shard_id)

    sharded_cluster = repository.lookup_cluster_by_shard(shard)

    if not sharded_cluster:
        raise MongoctlException("'%s' is not a shard" % shard_id)


    if parsed_options.dryRun:
        dry_run_add_shard(shard, sharded_cluster)
    else:
        add_shard(shard, sharded_cluster)
 def get_sharded_cluster(self):
     return repository.lookup_cluster_by_shard(self)
 def get_sharded_cluster(self):
     return repository.lookup_cluster_by_shard(
         self) or repository.lookup_sharded_cluster_by_config_replica(self)
Beispiel #8
0
 def get_sharded_cluster(self):
     return repository.lookup_cluster_by_shard(self)
 def get_sharded_cluster(self):
     return repository.lookup_cluster_by_shard(self) or repository.lookup_sharded_cluster_by_config_replica(self)