Example #1
0
def do_get_connector(client, args):
    """Get the connection properties for all protocols."""
    brickclient = brick_client.Client(client)
    connector = brickclient.get_connector(args.multipath,
                                          args.enforce_multipath,
                                          args.nic)
    utils.print_dict(connector)
Example #2
0
def do_group_create_from_src(cs, args):
    """Creates a group from a group snapshot or a source group."""
    if not args.group_snapshot and not args.source_group:
        msg = ('Cannot create group because neither '
               'group snapshot nor source group is provided.')
        raise exceptions.ClientException(code=1, message=msg)
    if args.group_snapshot and args.source_group:
        msg = ('Cannot create group because both '
               'group snapshot and source group are provided.')
        raise exceptions.ClientException(code=1, message=msg)
    group_snapshot = None
    if args.group_snapshot:
        group_snapshot = shell_utils.find_group_snapshot(cs,
                                                         args.group_snapshot)
    source_group = None
    if args.source_group:
        source_group = shell_utils.find_group(cs, args.source_group)
    info = cs.groups.create_from_src(
        group_snapshot.id if group_snapshot else None,
        source_group.id if source_group else None,
        args.name,
        args.description)

    info.pop('links', None)
    utils.print_dict(info)
Example #3
0
def do_message_show(cs, args):
    """Shows message details."""
    info = dict()
    message = shell_utils.find_message(cs, args.message)
    info.update(message._info)
    info.pop('links', None)
    utils.print_dict(info)
Example #4
0
def print_volume_image(image_resp_tuple):
    # image_resp_tuple = tuple (response, body)
    image = image_resp_tuple[1]
    vt = image['os-volume_upload_image'].get('volume_type')
    if vt is not None:
        image['os-volume_upload_image']['volume_type'] = vt.get('name')
    utils.print_dict(image['os-volume_upload_image'])
Example #5
0
def do_message_show(cs, args):
    """Shows message details."""
    info = dict()
    message = shell_utils.find_message(cs, args.message)
    info.update(message._info)
    info.pop('links', None)
    utils.print_dict(info)
Example #6
0
def do_cluster_disable(cs, args):
    """Disables clustered services."""
    cluster = cs.clusters.update(args.name,
                                 args.binary,
                                 disabled=True,
                                 disabled_reason=args.reason)
    utils.print_dict(cluster.to_dict())
Example #7
0
def _poll_for_status(poll_fn, obj_id, info, action, final_ok_states,
                     timeout_period, global_request_id=None, messages=None,
                     poll_period=2, status_field="status"):
    """Block while an action is being performed."""
    time_elapsed = 0
    while True:
        time.sleep(poll_period)
        time_elapsed += poll_period
        obj = poll_fn(obj_id)
        status = getattr(obj, status_field)
        info[status_field] = status
        if status:
            status = status.lower()

        if status in final_ok_states:
            break
        elif status == "error":
            utils.print_dict(info)
            if global_request_id:
                search_opts = {
                    'request_id': global_request_id
                    }
                message_list = messages.list(search_opts=search_opts)
                try:
                    fault_msg = message_list[0].user_message
                except IndexError:
                    fault_msg = "Unknown error. Operation failed."
                raise exceptions.ResourceInErrorState(obj, fault_msg)
        elif time_elapsed == timeout_period:
            utils.print_dict(info)
            raise exceptions.TimeoutException(obj, action)
Example #8
0
def do_create(cs, args):
    """Add a new volume."""
    # NOTE(thingee): Backwards-compatibility with v1 args
    if args.display_name is not None:
        args.name = args.display_name

    if args.display_description is not None:
        args.description = args.display_description

    volume_metadata = None
    if args.metadata is not None:
        volume_metadata = _extract_metadata(args)

    volume = cs.volumes.create(args.size,
                               args.snapshot_id,
                               args.source_volid,
                               args.name,
                               args.description,
                               args.volume_type,
                               availability_zone=args.availability_zone,
                               imageRef=args.image_id,
                               metadata=volume_metadata)

    info = dict()
    volume = cs.volumes.get(info['id'])
    info.update(volume._info)

    info.pop('links')

    utils.print_dict(info)
def do_create(cs, args):
    """Add a new volume."""
    # NOTE(thingee): Backwards-compatibility with v1 args
    if args.display_name is not None:
        args.name = args.display_name

    if args.display_description is not None:
        args.description = args.display_description

    volume_metadata = None
    if args.metadata is not None:
        volume_metadata = _extract_metadata(args)

    volume = cs.volumes.create(args.size,
                               args.snapshot_id,
                               args.source_volid,
                               args.name,
                               args.description,
                               args.volume_type,
                               availability_zone=args.availability_zone,
                               imageRef=args.image_id,
                               metadata=volume_metadata)

    info = dict()
    volume = cs.volumes.get(volume.id)
    info.update(volume._info)

    info.pop('links')

    utils.print_dict(info)
def _poll_for_status(poll_fn, obj_id, info, action, final_ok_states,
                     timeout_period, global_request_id=None, messages=None,
                     poll_period=2, status_field="status"):
    """Block while an action is being performed."""
    time_elapsed = 0
    while True:
        time.sleep(poll_period)
        time_elapsed += poll_period
        obj = poll_fn(obj_id)
        status = getattr(obj, status_field)
        info[status_field] = status
        if status:
            status = status.lower()

        if status in final_ok_states:
            break
        elif status == "error":
            utils.print_dict(info)
            if global_request_id:
                search_opts = {
                    'request_id': global_request_id
                    }
                message_list = messages.list(search_opts=search_opts)
                try:
                    fault_msg = message_list[0].user_message
                except IndexError:
                    fault_msg = "Unknown error. Operation failed."
                raise exceptions.ResourceInErrorState(obj, fault_msg)
        elif time_elapsed == timeout_period:
            utils.print_dict(info)
            raise exceptions.TimeoutException(obj, action)
Example #11
0
def do_group_snapshot_show(cs, args):
    """Shows group snapshot details."""
    info = dict()
    group_snapshot = shell_utils.find_group_snapshot(cs, args.group_snapshot)
    info.update(group_snapshot._info)

    info.pop('links', None)
    utils.print_dict(info)
Example #12
0
def do_group_type_show(cs, args):
    """Show group type details."""
    gtype = shell_utils.find_gtype(cs, args.group_type)
    info = dict()
    info.update(gtype._info)

    info.pop('links', None)
    utils.print_dict(info, formatters=['group_specs'])
Example #13
0
def do_group_snapshot_show(cs, args):
    """Shows group snapshot details."""
    info = dict()
    group_snapshot = shell_utils.find_group_snapshot(cs, args.group_snapshot)
    info.update(group_snapshot._info)

    info.pop('links', None)
    utils.print_dict(info)
Example #14
0
def do_group_type_show(cs, args):
    """Show group type details."""
    gtype = shell_utils.find_gtype(cs, args.group_type)
    info = dict()
    info.update(gtype._info)

    info.pop('links', None)
    utils.print_dict(info, formatters=['group_specs'])
Example #15
0
def do_backup_show(cs, args):
    """Show details about a backup."""
    backup = _find_backup(cs, args.backup)
    info = dict()
    info.update(backup._info)

    info.pop('links', None)
    utils.print_dict(info)
Example #16
0
def do_transfer_show(cs, args):
    """Show details about a transfer."""
    transfer = _find_transfer(cs, args.transfer)
    info = dict()
    info.update(transfer._info)

    info.pop('links', None)
    utils.print_dict(info)
Example #17
0
def do_backup_show(cs, args):
    """Show details about a backup."""
    backup = _find_backup(cs, args.backup)
    info = dict()
    info.update(backup._info)

    info.pop('links', None)
    utils.print_dict(info)
Example #18
0
def do_local_attach(client, args):
    hostname = args.hostname
    volume = args.identifier
    brickclient = brick_client.Client(client)
    device_info = brickclient.attach(volume, hostname, args.mountpoint,
                                     args.mode, args.multipath,
                                     args.enforce_multipath, args.nic)
    utils.print_dict(device_info)
Example #19
0
def do_transfer_show(cs, args):
    """Show details about a transfer."""
    transfer = _find_transfer(cs, args.transfer)
    info = dict()
    info.update(transfer._info)

    info.pop('links', None)
    utils.print_dict(info)
Example #20
0
def do_show(cs, args):
    """Show details about a volume."""
    info = dict()
    volume = utils.find_volume(cs, args.volume)
    info.update(volume._info)

    info.pop('links', None)
    utils.print_dict(info)
Example #21
0
def do_transfer_accept(cs, args):
    """Accepts a volume transfer."""
    transfer = cs.transfers.accept(args.transfer, args.auth_key)
    info = dict()
    info.update(transfer._info)

    info.pop('links', None)
    utils.print_dict(info)
Example #22
0
def do_transfer_accept(cs, args):
    """Accepts a volume transfer."""
    transfer = cs.transfers.accept(args.transfer, args.auth_key)
    info = dict()
    info.update(transfer._info)

    info.pop('links', None)
    utils.print_dict(info)
Example #23
0
def do_show(cs, args):
    """Show details about a volume."""
    info = dict()
    volume = utils.find_volume(cs, args.volume)
    info.update(volume._info)

    info.pop('links', None)
    utils.print_dict(info)
Example #24
0
def do_endpoints(cs, args):
    """Discovers endpoints registered by authentication service."""
    warnings.warn(
        "``cinder endpoints`` is deprecated, use ``openstack catalog list`` "
        "instead. The ``cinder endpoints`` command may be removed in the P "
        "release or next major release of cinderclient (v2.0.0 or greater).")
    catalog = cs.client.service_catalog.catalog
    for e in catalog:
        utils.print_dict(e['endpoints'][0], e['name'])
Example #25
0
def do_endpoints(cs, args):
    """Discovers endpoints registered by authentication service."""
    warnings.warn(
        "``cinder endpoints`` is deprecated, use ``openstack catalog list`` "
        "instead. The ``cinder endpoints`` command may be removed in the P "
        "release or next major release of cinderclient (v2.0.0 or greater).")
    catalog = cs.client.service_catalog.catalog
    for e in catalog:
        utils.print_dict(e['endpoints'][0], e['name'])
def do_backup_show(cs, args):
    """Show backup details."""
    backup = _find_backup(cs, args.backup)
    info = dict()
    info.update(backup._info)

    if 'links' in info:
        info.pop('links')

    utils.print_dict(info)
Example #27
0
def do_transfer_create(cs, args):
    """Creates a volume transfer."""
    transfer = cs.transfers.create(args.volume, args.display_name)
    info = dict()
    info.update(transfer._info)

    if 'links' in info:
        info.pop('links')

    utils.print_dict(info)
def do_transfer_show(cs, args):
    """Show transfer details."""
    transfer = _find_transfer(cs, args.transfer)
    info = dict()
    info.update(transfer._info)

    if 'links' in info:
        info.pop('links')

    utils.print_dict(info)
Example #29
0
def do_snapshot_metadata(cs, args):
    """Set or Delete metadata of a snapshot."""
    snapshot = _find_volume_snapshot(cs, args.snapshot)
    metadata = _extract_metadata(args)

    if args.action == "set":
        metadata = snapshot.set_metadata(metadata)
        utils.print_dict(metadata._info)
    elif args.action == "unset":
        snapshot.delete_metadata(list(metadata.keys()))
def do_backup_show(cs, args):
    """Show backup details."""
    backup = _find_backup(cs, args.backup)
    info = dict()
    info.update(backup._info)

    if 'links' in info:
        info.pop('links')

    utils.print_dict(info)
def do_transfer_show(cs, args):
    """Show transfer details."""
    transfer = _find_transfer(cs, args.transfer)
    info = dict()
    info.update(transfer._info)

    if 'links' in info:
        info.pop('links')

    utils.print_dict(info)
def do_snapshot_metadata(cs, args):
    """Sets or deletes snapshot metadata."""
    snapshot = _find_volume_snapshot(cs, args.snapshot)
    metadata = _extract_metadata(args)

    if args.action == 'set':
        metadata = snapshot.set_metadata(metadata)
        utils.print_dict(metadata._info)
    elif args.action == 'unset':
        snapshot.delete_metadata(list(metadata.keys()))
Example #33
0
def do_snapshot_metadata(cs, args):
    """Set or Delete metadata of a snapshot."""
    snapshot = _find_volume_snapshot(cs, args.snapshot)
    metadata = _extract_metadata(args)

    if args.action == 'set':
        metadata = snapshot.set_metadata(metadata)
        utils.print_dict(metadata._info)
    elif args.action == 'unset':
        snapshot.delete_metadata(list(metadata.keys()))
Example #34
0
def _quota_show(quotas):
    quota_dict = {}
    for resource in quotas._info:
        good_name = False
        for name in _quota_resources:
            if resource.startswith(name):
                good_name = True
        if not good_name:
            continue
        quota_dict[resource] = getattr(quotas, resource, None)
    utils.print_dict(quota_dict)
Example #35
0
def do_transfer_create(cs, args):
    """Creates a volume transfer."""
    if args.display_name is not None:
        args.name = args.display_name

    transfer = cs.transfers.create(args.volume, args.name)
    info = dict()
    info.update(transfer._info)

    info.pop("links", None)
    utils.print_dict(info)
Example #36
0
def do_transfer_create(cs, args):
    """Creates a volume transfer."""
    transfer = cs.transfers.create(args.volume,
                                   args.display_name)
    info = dict()
    info.update(transfer._info)

    if 'links' in info:
        info.pop('links')

    utils.print_dict(info)
Example #37
0
def do_transfer_create(cs, args):
    """Creates a volume transfer."""
    if args.display_name is not None:
        args.name = args.display_name

    transfer = cs.transfers.create(args.volume, args.name)
    info = dict()
    info.update(transfer._info)

    info.pop('links', None)
    utils.print_dict(info)
def _quota_show(quotas):
    quota_dict = {}
    for resource in quotas._info:
        good_name = False
        for name in _quota_resources:
            if resource.startswith(name):
                good_name = True
        if not good_name:
            continue
        quota_dict[resource] = getattr(quotas, resource, None)
    utils.print_dict(quota_dict)
Example #39
0
def do_transfer_create(cs, args):
    """Creates a volume transfer."""
    volume = utils.find_volume(cs, args.volume)
    transfer = cs.transfers.create(volume.id, args.display_name)
    info = dict()
    info.update(transfer._info)

    if "links" in info:
        info.pop("links")

    utils.print_dict(info)
Example #40
0
def do_backup_create(cs, args):
    """Creates a volume backup."""
    volume = utils.find_volume(cs, args.volume)
    backup = cs.backups.create(volume.id, args.container, args.display_name, args.display_description)

    info = {"volume_id": volume.id}
    info.update(backup._info)

    if "links" in info:
        info.pop("links")

    utils.print_dict(info)
Example #41
0
def do_group_snapshot_create(cs, args):
    """Creates a group snapshot."""
    group = shell_utils.find_group(cs, args.group)
    group_snapshot = cs.group_snapshots.create(group.id, args.name,
                                               args.description)

    info = dict()
    group_snapshot = cs.group_snapshots.get(group_snapshot.id)
    info.update(group_snapshot._info)

    info.pop('links', None)
    utils.print_dict(info)
Example #42
0
def do_backup_create(cs, args):
    """Creates a backup."""
    backup = cs.backups.create(args.volume, args.container, args.display_name,
                               args.display_description)

    info = {"volume_id": args.volume}
    info.update(backup._info)

    if 'links' in info:
        info.pop('links')

    utils.print_dict(info)
def quota_show(quotas):
    quotas_info_dict = utils.unicode_key_value_to_string(quotas._info)
    quota_dict = {}
    for resource in quotas_info_dict.keys():
        good_name = False
        for name in _quota_resources:
            if resource.startswith(name):
                good_name = True
        if not good_name:
            continue
        quota_dict[resource] = getattr(quotas, resource, None)
    utils.print_dict(quota_dict)
def do_local_attach(client, args):
    hostname = args.hostname
    volume = args.identifier
    brickclient = brick_client.Client(client)
    device_info = brickclient.attach(volume,
                                     hostname,
                                     args.mountpoint,
                                     args.mode,
                                     args.multipath,
                                     args.enforce_multipath)

    utils.print_dict(device_info)
def quota_show(quotas):
    quotas_info_dict = utils.unicode_key_value_to_string(quotas._info)
    quota_dict = {}
    for resource in quotas_info_dict.keys():
        good_name = False
        for name in _quota_resources:
            if resource.startswith(name):
                good_name = True
        if not good_name:
            continue
        quota_dict[resource] = getattr(quotas, resource, None)
    utils.print_dict(quota_dict)
Example #46
0
def do_transfer_create(cs, args):
    """Creates a volume transfer."""
    if args.display_name is not None:
        args.name = args.display_name

    volume = utils.find_volume(cs, args.volume)
    transfer = cs.transfers.create(volume.id,
                                   args.name)
    info = dict()
    info.update(transfer._info)

    info.pop('links', None)
    utils.print_dict(info)
Example #47
0
def do_group_snapshot_create(cs, args):
    """Creates a group snapshot."""
    group = shell_utils.find_group(cs, args.group)
    group_snapshot = cs.group_snapshots.create(
        group.id,
        args.name,
        args.description)

    info = dict()
    group_snapshot = cs.group_snapshots.get(group_snapshot.id)
    info.update(group_snapshot._info)

    info.pop('links', None)
    utils.print_dict(info)
def do_backup_create(cs, args):
    """Creates a backup."""
    backup = cs.backups.create(args.volume,
                               args.container,
                               args.display_name,
                               args.display_description)

    info = {"volume_id": args.volume}
    info.update(backup._info)

    if 'links' in info:
        info.pop('links')

    utils.print_dict(info)
    def test_print_dict_with_dict_inside(self):
        content = {'a': 'A', 'b': 'B', 'f_key':
                   {'key1': 'value1', 'key2': 'value2'}}
        with CaptureStdout() as cso:
            utils.print_dict(content, formatters='f_key')
        self.assertEqual("""\
+----------+---------------+
| Property | Value         |
+----------+---------------+
| a        | A             |
| b        | B             |
| f_key    | key1 : value1 |
|          | key2 : value2 |
+----------+---------------+
""", cso.read())
Example #50
0
def do_group_create(cs, args):
    """Creates a group."""

    group = cs.groups.create(args.grouptype,
                             args.volumetypes,
                             args.name,
                             args.description,
                             availability_zone=args.availability_zone)

    info = dict()
    group = cs.groups.get(group.id)
    info.update(group._info)

    info.pop('links', None)
    utils.print_dict(info)
    def test_print_dict_with_return(self):
        d = {'a': 'A', 'b': 'B', 'c': 'C', 'd': 'test\rcarriage\n\rreturn'}
        with CaptureStdout() as cso:
            utils.print_dict(d)
        self.assertEqual("""\
+----------+---------------+
| Property | Value         |
+----------+---------------+
| a        | A             |
| b        | B             |
| c        | C             |
| d        | test carriage |
|          |  return       |
+----------+---------------+
""", cso.read())
Example #52
0
    def test_print_dict_with_return(self):
        d = {'a': 'A', 'b': 'B', 'c': 'C', 'd': 'test\rcarriage\n\rreturn'}
        with CaptureStdout() as cso:
            utils.print_dict(d)
        self.assertEqual("""\
+----------+---------------+
| Property | Value         |
+----------+---------------+
| a        | A             |
| b        | B             |
| c        | C             |
| d        | test carriage |
|          |  return       |
+----------+---------------+
""", cso.read())
def do_backup_create(cs, args):
    """Creates a volume backup."""
    volume = utils.find_volume(cs, args.volume)
    # code begin by luobin
    backup = cs.backups.create(volume.id, args.container, args.display_name,
                               args.display_description, args.force)
    # code end by luobin

    info = {"volume_id": volume.id}
    info.update(backup._info)

    if 'links' in info:
        info.pop('links')

    utils.print_dict(info)
Example #54
0
def do_group_create(cs, args):
    """Creates a group."""

    group = cs.groups.create(
        args.grouptype,
        args.volumetypes,
        args.name,
        args.description,
        availability_zone=args.availability_zone)

    info = dict()
    group = cs.groups.get(group.id)
    info.update(group._info)

    info.pop('links', None)
    utils.print_dict(info)
Example #55
0
def do_create(cs, args):
    """Add a new volume."""
    # NOTE(thingee): Backwards-compatibility with v1 args
    if args.display_name is not None:
        args.name = args.display_name

    if args.display_description is not None:
        args.description = args.display_description

    volume_metadata = None
    if args.metadata is not None:
        volume_metadata = _extract_metadata(args)

    # NOTE(N.S.): take this piece from novaclient
    hints = {}
    if args.scheduler_hints:
        for hint in args.scheduler_hints:
            key, _sep, value = hint.partition("=")
            # NOTE(vish): multiple copies of the same hint will
            #             result in a list of values
            if key in hints:
                if isinstance(hints[key], six.string_types):
                    hints[key] = [hints[key]]
                hints[key] += [value]
            else:
                hints[key] = value
    # NOTE(N.S.): end of the taken piece

    volume = cs.volumes.create(
        args.size,
        args.snapshot_id,
        args.source_volid,
        args.name,
        args.description,
        args.volume_type,
        availability_zone=args.availability_zone,
        imageRef=args.image_id,
        metadata=volume_metadata,
        scheduler_hints=hints,
    )

    info = dict()
    volume = cs.volumes.get(volume.id)
    info.update(volume._info)

    info.pop("links", None)
    utils.print_dict(info)
def do_import(cs, args):
    """Import a volume from a file."""

    # Parse the volume ID from the filename which is in this format:
    #   volume-<id>-<timestamp>.tgz
    # For example:
    #   volume-3a2cae29-850d-4445-b9ae-03865080b915-20140821-162819.tgz
    if (args.file_name.find("volume-") != 0
            or args.file_name.rfind(".tgz") == -1 or len(args.file_name) < 28):
        raise exceptions.CommandError(
            "Invalid filename - volume files must have the following format: "
            "volume-<id>-<timestamp>.tgz")

    volume_id = args.file_name[7:-20]
    volume = utils.find_volume(cs, volume_id)
    updated_volume = volume.import_volume(args.file_name)
    utils.print_dict(updated_volume[1]['wrs-volume:os-volume_import'])
Example #57
0
def do_create(cs, args):
    """Add a new volume."""
    # NOTE(thingee): Backwards-compatibility with v1 args
    if args.display_name is not None:
        args.name = args.display_name

    if args.display_description is not None:
        args.description = args.display_description

    volume_metadata = None
    if args.metadata is not None:
        volume_metadata = _extract_metadata(args)

    #NOTE(N.S.): take this piece from novaclient
    hints = {}
    if args.scheduler_hints:
        for hint in args.scheduler_hints:
            key, _sep, value = hint.partition('=')
            # NOTE(vish): multiple copies of the same hint will
            #             result in a list of values
            if key in hints:
                if isinstance(hints[key], six.string_types):
                    hints[key] = [hints[key]]
                hints[key] += [value]
            else:
                hints[key] = value
    #NOTE(N.S.): end of the taken piece

    volume = cs.volumes.create(args.size,
                               args.snapshot_id,
                               args.source_volid,
                               args.name,
                               args.description,
                               args.volume_type,
                               availability_zone=args.availability_zone,
                               imageRef=args.image_id,
                               metadata=volume_metadata,
                               scheduler_hints=hints)

    info = dict()
    volume = cs.volumes.get(volume.id)
    info.update(volume._info)

    info.pop('links', None)
    utils.print_dict(info)
Example #58
0
def do_backup_create(cs, args):
    """Creates a backup."""
    if args.display_name is not None:
        args.name = args.display_name

    if args.display_description is not None:
        args.description = args.display_description

    volume = utils.find_volume(cs, args.volume)
    backup = cs.backups.create(volume.id, args.container, args.name,
                               args.description)

    info = {"volume_id": volume.id}
    info.update(backup._info)

    if 'links' in info:
        info.pop('links')

    utils.print_dict(info)
Example #59
0
def do_backup_create(cs, args):
    """Creates a backup."""
    if args.display_name is not None:
        args.name = args.display_name

    if args.display_description is not None:
        args.description = args.display_description

    volume = utils.find_volume(cs, args.volume)
    backup = cs.backups.create(volume.id,
                               args.container,
                               args.name,
                               args.description)

    info = {"volume_id": volume.id}
    info.update(backup._info)

    if 'links' in info:
        info.pop('links')

    utils.print_dict(info)
Example #60
0
    def test_print_dict_with_dict_inside(self):
        content = {
            'a': 'A',
            'b': 'B',
            'f_key': {
                'key1': 'value1',
                'key2': 'value2'
            }
        }
        with CaptureStdout() as cso:
            utils.print_dict(content, formatters='f_key')
        self.assertEqual(
            """\
+----------+---------------+
| Property | Value         |
+----------+---------------+
| a        | A             |
| b        | B             |
| f_key    | key1 : value1 |
|          | key2 : value2 |
+----------+---------------+
""", cso.read())