Beispiel #1
0
    def test_copy_image_to_volume_non_xenserver_case(self):
        mock, drv = self._setup_mock_driver('server', 'serverpath',
                                            '/var/run/sr-mount')

        mock.StubOutWithMock(drv, '_use_image_utils_to_pipe_bytes_to_volume')
        mock.StubOutWithMock(driver, 'is_xenserver_image')
        context = MockContext('token')

        driver.is_xenserver_image(context, 'image_service',
                                  'image_id').AndReturn(False)
        drv._use_image_utils_to_pipe_bytes_to_volume(
            context, 'volume', 'image_service', 'image_id').AndReturn(True)
        mock.ReplayAll()
        drv.copy_image_to_volume(context, "volume", "image_service",
                                 "image_id")
        mock.VerifyAll()
Beispiel #2
0
    def test_copy_image_to_volume_non_xenserver_case(self):
        mock, drv = self._setup_mock_driver(
            'server', 'serverpath', '/var/run/sr-mount')

        mock.StubOutWithMock(drv, '_use_image_utils_to_pipe_bytes_to_volume')
        mock.StubOutWithMock(driver, 'is_xenserver_image')
        context = MockContext('token')

        driver.is_xenserver_image(
            context, 'image_service', 'image_id').AndReturn(False)
        drv._use_image_utils_to_pipe_bytes_to_volume(
            context, 'volume', 'image_service', 'image_id').AndReturn(True)
        mock.ReplayAll()
        drv.copy_image_to_volume(
            context, "volume", "image_service", "image_id")
        mock.VerifyAll()
Beispiel #3
0
    def test_copy_image_to_volume_xenserver_case(self):
        mock, drv = self._setup_mock_driver('server', 'serverpath',
                                            '/var/run/sr-mount')

        mock.StubOutWithMock(drv, '_use_glance_plugin_to_copy_image_to_volume')
        mock.StubOutWithMock(driver, 'is_xenserver_image')
        context = MockContext('token')

        driver.is_xenserver_image(context, 'image_service',
                                  'image_id').AndReturn(True)
        drv._use_glance_plugin_to_copy_image_to_volume(
            context, 'volume', 'image_service', 'image_id').AndReturn('result')
        mock.ReplayAll()
        result = drv.copy_image_to_volume(context, "volume", "image_service",
                                          "image_id")
        self.assertEquals('result', result)
        mock.VerifyAll()
Beispiel #4
0
    def test_copy_image_to_volume_xenserver_case(self):
        mock, drv = self._setup_mock_driver(
            'server', 'serverpath', '/var/run/sr-mount')

        mock.StubOutWithMock(drv, '_use_glance_plugin_to_copy_image_to_volume')
        mock.StubOutWithMock(driver, 'is_xenserver_image')
        context = MockContext('token')

        driver.is_xenserver_image(
            context, 'image_service', 'image_id').AndReturn(True)
        drv._use_glance_plugin_to_copy_image_to_volume(
            context, 'volume', 'image_service', 'image_id').AndReturn('result')
        mock.ReplayAll()
        result = drv.copy_image_to_volume(
            context, "volume", "image_service", "image_id")
        self.assertEquals('result', result)
        mock.VerifyAll()