예제 #1
0
def get_vol_dev(vol):
    """Return OS-specific volume representation as attached device."""
    assert vol.attach_data.instance_id
    inst = get_inst_by_id(vol.region.name, vol.attach_data.instance_id)
    assert inst.public_dns_name, 'Instance is down'
    key_filename = config.get(vol.region.name, 'KEY_FILENAME')
    attached_dev = vol.attach_data.device
    natty_dev = attached_dev.replace('sd', 'xvd')
    with settings(host_string=inst.public_dns_name, key_filename=key_filename):
        logger.debug(env, output)
        for dev in [attached_dev, natty_dev]:
            if wait_for_exists(dev):
                return dev
예제 #2
0
def get_vol_dev(vol):
    """Return OS-specific volume representation as attached device."""
    assert vol.attach_data.instance_id
    inst = get_inst_by_id(vol.region.name, vol.attach_data.instance_id)
    assert inst.public_dns_name, 'Instance is down'
    key_filename = config.get(vol.region.name, 'KEY_FILENAME')
    attached_dev = vol.attach_data.device
    natty_dev = attached_dev.replace('sd', 'xvd')
    representations = [attached_dev, natty_dev]
    with settings(host_string=inst.public_dns_name, key_filename=key_filename):
        logger.debug(env, output)
        for dev in representations:
            if wait_for_exists(dev):
                return dev
        raise NoDevFoundError(
            'Nothing from {variants} was located at {host.state} {host} for '
            '{vol} with {vol.attach_data.__dict__}'.format(
                host=inst, vol=vol, variants=representations))
예제 #3
0
def get_vol_dev(vol):
    """Return OS-specific volume representation as attached device."""
    assert vol.attach_data.instance_id
    inst = get_inst_by_id(vol.region.name, vol.attach_data.instance_id)
    assert inst.public_dns_name, 'Instance is down'
    key_filename = config.get(vol.region.name, 'KEY_FILENAME')
    attached_dev = vol.attach_data.device
    natty_dev = attached_dev.replace('sd', 'xvd')
    representations = [attached_dev, natty_dev]
    with settings(host_string=inst.public_dns_name, key_filename=key_filename):
        logger.debug(env, output)
        for dev in representations:
            if wait_for_exists(dev):
                return dev
        raise NoDevFoundError(
            'Nothing from {variants} was located at {host.state} {host} for '
            '{vol} with {vol.attach_data.__dict__}'.format(
                host=inst, vol=vol, variants=representations))