Esempio n. 1
0
    def test_cast_to_host_volume_topic(self):
        host = "fake_host1"
        method = "fake_method"
        fake_kwargs = {"extra_arg": "meow"}

        self.mox.StubOutWithMock(driver, "cast_to_volume_host")
        driver.cast_to_volume_host(self.context, host, method, update_db=False, **fake_kwargs)

        self.mox.ReplayAll()
        driver.cast_to_host(self.context, "volume", host, method, update_db=False, **fake_kwargs)
Esempio n. 2
0
    def test_cast_to_host_volume_topic(self):
        host = 'fake_host1'
        method = 'fake_method'
        fake_kwargs = {'extra_arg': 'meow'}

        self.mox.StubOutWithMock(driver, 'cast_to_volume_host')
        driver.cast_to_volume_host(self.context, host, method,
                update_db=False, **fake_kwargs)

        self.mox.ReplayAll()
        driver.cast_to_host(self.context, 'volume', host, method,
                update_db=False, **fake_kwargs)
Esempio n. 3
0
    def schedule_create_volume(self, context, request_spec, filter_properties):
        """Picks a host that is up at random."""
        topic = FLAGS.volume_topic
        host = self._schedule(context, topic, request_spec,
                              filter_properties=filter_properties)
        volume_id = request_spec['volume_id']
        snapshot_id = request_spec['snapshot_id']
        image_id = request_spec['image_id']

        driver.cast_to_host(context, topic, host, 'create_volume',
                            volume_id=volume_id,
                            snapshot_id=snapshot_id,
                            image_id=image_id)
Esempio n. 4
0
    def test_cast_to_host_unknown_topic(self):
        host = "fake_host1"
        method = "fake_method"
        fake_kwargs = {"extra_arg": "meow"}
        topic = "unknown"
        queue = "fake_queue"

        self.mox.StubOutWithMock(rpc, "queue_get_for")
        self.mox.StubOutWithMock(rpc, "cast")

        rpc.queue_get_for(self.context, topic, host).AndReturn(queue)
        rpc.cast(self.context, queue, {"method": method, "args": fake_kwargs})

        self.mox.ReplayAll()
        driver.cast_to_host(self.context, topic, host, method, update_db=False, **fake_kwargs)
Esempio n. 5
0
    def test_cast_to_host_unknown_topic(self):
        host = 'fake_host1'
        method = 'fake_method'
        fake_kwargs = {'extra_arg': 'meow'}
        topic = 'unknown'
        queue = 'fake_queue'

        self.mox.StubOutWithMock(rpc, 'queue_get_for')
        self.mox.StubOutWithMock(rpc, 'cast')

        rpc.queue_get_for(self.context, topic, host).AndReturn(queue)
        rpc.cast(self.context, queue,
                {'method': method,
                 'args': fake_kwargs})

        self.mox.ReplayAll()
        driver.cast_to_host(self.context, topic, host, method,
                update_db=False, **fake_kwargs)
Esempio n. 6
0
    def schedule(self, context, topic, method, *_args, **kwargs):
        """Picks a host that is up at random."""

        host = self._schedule(context, topic, None, **kwargs)
        driver.cast_to_host(context, topic, host, method, **kwargs)