示例#1
0
def create_volume_from_offering(volume_option):
    action = api_actions.CreateDataVolumeAction()
    action.primaryStorageUuid = volume_option.get_primary_storage_uuid()
    action.diskOfferingUuid = volume_option.get_disk_offering_uuid()
    action.description = volume_option.get_description()
    action.systemTags = volume_option.get_system_tags()
    timeout = volume_option.get_timeout()
    if not timeout:
        action.timeout = 240000
    else:
        action.timeout = timeout

    name = volume_option.get_name()
    if not name:
        action.name = 'test_volume'
    else:
        action.name = name

    test_util.action_logger('Create [Volume:] %s with [disk offering:] %s ' %
                            (action.name, action.diskOfferingUuid))
    evt = account_operations.execute_action_with_session(
        action, volume_option.get_session_uuid())

    test_util.test_logger('[volume:] %s is created.' % evt.inventory.uuid)
    return evt.inventory
def create_volume_from_offering(http_server_ip,
                                volume_option,
                                session_uuid=None):
    action = api_actions.CreateDataVolumeAction()
    action.diskOfferingUuid = volume_option.get_disk_offering_uuid()
    action.description = volume_option.get_description()
    action.systemTags = volume_option.get_system_tags()
    timeout = volume_option.get_timeout()
    if not timeout:
        action.timeout = 240000
    else:
        action.timeout = timeout

    name = volume_option.get_name()
    if not name:
        action.name = 'test_volume'
    else:
        action.name = name

    test_util.action_logger('Create [Volume:] %s with [disk offering:] %s ' %
                            (action.name, action.diskOfferingUuid))
    evt = execute_action_with_session(http_server_ip, action, session_uuid)

    test_util.test_logger('[volume:] %s is created.' % evt.inventory.uuid)
    return evt.inventory