def create(ctx, size, account_id, name,
           enable512e=True, attributes=None,
           qos=None, count=1):
    """Creates <count> volumes of <size> on the SolidFire Cluster.

        Where size can be specified in bytes GibiBytes or GigaBytes
        (1073741824 | 1Gi | 1G).
    """
    vol_ids = []
    size = utils.string_to_bytes(size)
    if qos:
        qos = utils.kv_string_to_dict(qos)
        for k, v in qos.iteritems():
            qos[k] = int(v)
    if attributes:
        import pdb;pdb.set_trace()
        attributes = utils.kv_string_to_dict(attributes)

    vname = name
    for i in xrange(0, int(count)):
        if i > 0:
            vname = name + ('-%s' % i)
        vol_ids.append(ctx.sfapi.create_volume(vname, account_id,
                                               size, enable512e,
                                               qos, attributes))
    for vid in vol_ids:
        vol = _get_volume(ctx, vid)
        qos = vol['qos']
        qos.pop('curve', None)
        cli_utils.print_dict(vol)
def add(ctx, user_name, initiator_secret=None, target_secret=None, attributes=None):
    """Creates <count> clones of volume specified by volume-id."""
    if attributes:
        attributes = utils.kv_string_to_dict(attributes)
    new_account_id = ctx.sfapi.add_account(user_name, initiator_secret, target_secret, attributes)
    account = ctx.sfapi.get_account_by_id(new_account_id)["account"]
    cli_utils.print_dict(account)
Example #3
0
def clone(ctx,
          volume_id,
          name,
          from_snapshot,
          new_account_id=None,
          new_size=None,
          attributes=None,
          access='rw',
          count=1):
    """Creates <count> clones of volume specified by volume-id."""
    vol_ids = []
    if attributes:
        attributes = utils.kv_string_to_dict(attributes)
    clone_name = name
    for i in xrange(0, int(count)):
        if i > 0:
            clone_name = name + ('-%s' % i)
        vol_ids.append(
            ctx.sfapi.clone_volume(volume_id,
                                   clone_name,
                                   new_account_id=new_account_id,
                                   new_size=new_size,
                                   access=access,
                                   snapshot_id=from_snapshot,
                                   attributes=attributes))
    for vid in vol_ids:
        vol = _get_volume(ctx, vid)
        qos = vol['qos']
        qos.pop('curve', None)
        cli_utils.print_dict(vol)
Example #4
0
def add(ctx,
        user_name,
        initiator_secret=None,
        target_secret=None,
        attributes=None):
    """Creates <count> clones of volume specified by volume-id."""
    if attributes:
        attributes = utils.kv_string_to_dict(attributes)
    new_account_id = ctx.sfapi.add_account(user_name, initiator_secret,
                                           target_secret, attributes)
    account = ctx.sfapi.get_account_by_id(new_account_id)['account']
    cli_utils.print_dict(account)
Example #5
0
def create(ctx,
           size,
           account_id,
           name,
           enable512e=True,
           attributes=None,
           qos=None,
           count=1):
    """Creates <count> volumes of <size> on the SolidFire Cluster.

        Where size can be specified in bytes GibiBytes or GigaBytes
        (1073741824 | 1Gi | 1G).
    """
    vol_ids = []
    size = utils.string_to_bytes(size)
    if qos:
        qos = utils.kv_string_to_dict(qos)
        for k, v in qos.iteritems():
            qos[k] = int(v)
    if attributes:
        import pdb
        pdb.set_trace()
        attributes = utils.kv_string_to_dict(attributes)

    vname = name
    for i in xrange(0, int(count)):
        if i > 0:
            vname = name + ('-%s' % i)
        vol_ids.append(
            ctx.sfapi.create_volume(vname, account_id, size, enable512e, qos,
                                    attributes))
    for vid in vol_ids:
        vol = _get_volume(ctx, vid)
        qos = vol['qos']
        qos.pop('curve', None)
        cli_utils.print_dict(vol)
def clone(ctx, volume_id, name, from_snapshot,
          new_account_id=None, new_size=None,
          attributes=None, access='rw', count=1):
    """Creates <count> clones of volume specified by volume-id."""
    vol_ids = []
    if attributes:
        attributes = utils.kv_string_to_dict(attributes)
    clone_name = name
    for i in xrange(0, int(count)):
        if i > 0:
            clone_name = name + ('-%s' % i)
        vol_ids.append(ctx.sfapi.clone_volume(volume_id, clone_name,
                                              new_account_id=new_account_id,
                                              new_size=new_size,
                                              access=access,
                                              snapshot_id=from_snapshot,
                                              attributes=attributes))
    for vid in vol_ids:
        vol = _get_volume(ctx, vid)
        qos = vol['qos']
        qos.pop('curve', None)
        cli_utils.print_dict(vol)