Exemplo n.º 1
0
    def _fake_cast(self, method_name, **kwargs):
        from reddwarf.tests.fakes.common import get_event_spawer
        from reddwarf.taskmanager.manager import Manager
        method = getattr(Manager(), method_name)

        def func():
            try:
                method(self.context, **kwargs)
            except Exception as ex:
                type_, value, tb = sys.exc_info()
                LOG.error("Error running async task:")
                LOG.error((traceback.format_exception(type_, value, tb)))
                raise type_(*value.args), None, tb

        get_event_spawer()(0, func)
Exemplo n.º 2
0
    def _fake_cast(self, method_name, **kwargs):
        from reddwarf.tests.fakes.common import get_event_spawer
        from reddwarf.taskmanager.manager import Manager
        method = getattr(Manager(), method_name)

        def func():
            try:
                method(self.context, **kwargs)
            except Exception as ex:
                type_, value, tb = sys.exc_info()
                LOG.error("Error running async task:")
                LOG.error((traceback.format_exception(type_, value, tb)))
                raise type_(*value.args), None, tb

        get_event_spawer()(0, func)
Exemplo n.º 3
0
    def __init__(self, parent, owner, id, name, image_id, flavor_ref,
                 block_device_mapping, volumes):
        self.owner = owner  # This is a context.
        self.id = id
        self.parent = parent
        self.name = name
        self.image_id = image_id
        self.flavor_ref = flavor_ref
        self.old_flavor_ref = None
        self.event_spawn = get_event_spawer()
        self._current_status = "BUILD"
        self.volumes = volumes
        # This is used by "RdServers". Its easier to compute the
        # fake value in this class's initializer.
        self._local_id = self.next_local_id
        self.next_local_id += 1
        info_vols = []
        for volume in self.volumes:
            info_vols.append({'id': volume.id})
            volume.set_attachment(id)
        self.host = FAKE_HOSTS[0]
        self.old_host = None
        setattr(self, 'OS-EXT-AZ:availability_zone', 'nova')

        self._info = {'os:volumes': info_vols}
Exemplo n.º 4
0
 def __init__(self, id):
     self.id = id
     self.users = {}
     self.dbs = {}
     self.root_was_enabled = False
     self.version = 1
     self.event_spawn = get_event_spawer()
Exemplo n.º 5
0
    def __init__(self, id):
        self.id = id
        self.users = {}
        self.dbs = {}
        self.root_was_enabled = False
        self.version = 1
        self.event_spawn = get_event_spawer()
        self.grants = {}

        # Our default admin user.
        self._create_user({"_name": "os_admin", "_host": "%", "_password": "******", "_databases": []})
Exemplo n.º 6
0
 def __init__(self, parent, owner, id, size, display_name,
              display_description):
     self.attachments = []
     self.parent = parent
     self.owner = owner  # This is a context.
     self.id = id
     self.size = size
     self.display_name = display_name
     self.display_description = display_description
     self.event_spawn = get_event_spawer()
     self._current_status = "BUILD"
     # For some reason we grab this thing from device then call it mount
     # point.
     self.device = "vdb"
Exemplo n.º 7
0
 def __init__(self, parent, owner, id, size, display_name,
              display_description):
     self.attachments = []
     self.parent = parent
     self.owner = owner  # This is a context.
     self.id = id
     self.size = size
     self.display_name = display_name
     self.display_description = display_description
     self.event_spawn = get_event_spawer()
     self._current_status = "BUILD"
     # For some reason we grab this thing from device then call it mount
     # point.
     self.device = "vdb"
Exemplo n.º 8
0
    def __init__(self, id):
        self.id = id
        self.users = {}
        self.dbs = {}
        self.root_was_enabled = False
        self.version = 1
        self.event_spawn = get_event_spawer()
        self.grants = {}

        # Our default admin user.
        self._create_user({
            "_name": "os_admin",
            "_host": "%",
            "_password": "******",
            "_databases": [],
        })
Exemplo n.º 9
0
    def __init__(self, parent, owner, id, name, image_id, flavor_ref,
                 block_device_mapping, volumes):
        self.owner = owner  # This is a context.
        self.id = id
        self.parent = parent
        self.name = name
        self.image_id = image_id
        self.flavor_ref = flavor_ref
        self.old_flavor_ref = None
        self.event_spawn = get_event_spawer()
        self._current_status = "BUILD"
        self.volumes = volumes
        # This is used by "RdServers". Its easier to compute the
        # fake value in this class's initializer.
        self._local_id = self.next_local_id
        self.next_local_id += 1
        info_vols = []
        for volume in self.volumes:
            info_vols.append({'id': volume.id})
            volume.set_attachment(id)
        self.host = FAKE_HOSTS[0]
        self.old_host = None

        self._info = {'os:volumes': info_vols}
Exemplo n.º 10
0
    def __init__(self, context, servers):

        self.context = context
        self.db = FAKE_SERVERS_DB
        self.servers = servers
        self.event_spawn = get_event_spawer()
Exemplo n.º 11
0
 def __init__(self, context):
     self.context = context
     self.db = FAKE_VOLUMES_DB
     self.event_spawn = get_event_spawer()
Exemplo n.º 12
0
 def __init__(self, context, flavors):
     self.context = context
     self.db = FAKE_SERVERS_DB
     self.flavors = flavors
     self.event_spawn = get_event_spawer()
Exemplo n.º 13
0
    def __init__(self, context, servers):

        self.context = context
        self.db = FAKE_SERVERS_DB
        self.servers = servers
        self.event_spawn = get_event_spawer()
Exemplo n.º 14
0
 def __init__(self, context):
     self.context = context
     self.db = FAKE_VOLUMES_DB
     self.event_spawn = get_event_spawer()
Exemplo n.º 15
0
 def __init__(self, context, flavors):
     self.context = context
     self.db = FAKE_SERVERS_DB
     self.flavors = flavors
     self.event_spawn = get_event_spawer()