Beispiel #1
0
    def test_cache_image(self):
        self.mox.StubOutWithMock(os, "makedirs")
        self.mox.StubOutWithMock(os, "unlink")
        self.mox.StubOutWithMock(os.path, "exists")
        os.makedirs(pxe.get_image_dir_path(self.instance)).AndReturn(True)
        disk_path = os.path.join(pxe.get_image_dir_path(self.instance), "disk")
        os.unlink(disk_path).AndReturn(None)
        os.path.exists(disk_path).AndReturn(True)
        os.path.exists(pxe.get_image_file_path(self.instance)).AndReturn(True)
        self.mox.ReplayAll()

        image_meta = utils.get_test_image_info(self.context, self.instance)
        self.driver._cache_image(self.context, self.instance, image_meta)
        self.mox.VerifyAll()
Beispiel #2
0
    def test_cache_image(self):
        self.mox.StubOutWithMock(os, 'makedirs')
        self.mox.StubOutWithMock(os, 'unlink')
        self.mox.StubOutWithMock(os.path, 'exists')
        os.makedirs(pxe.get_image_dir_path(self.instance)).AndReturn(True)
        disk_path = os.path.join(pxe.get_image_dir_path(self.instance), 'disk')
        os.unlink(disk_path).AndReturn(None)
        os.path.exists(disk_path).AndReturn(True)
        os.path.exists(pxe.get_image_file_path(self.instance)).\
                AndReturn(True)
        self.mox.ReplayAll()

        image_meta = utils.get_test_image_info(self.context, self.instance)
        self.driver._cache_image(self.context, self.instance, image_meta)
        self.mox.VerifyAll()
Beispiel #3
0
    def test_destroy_images(self):
        self._create_node()
        self.mox.StubOutWithMock(os, 'unlink')

        os.unlink(pxe.get_image_file_path(self.instance))
        os.unlink(pxe.get_image_dir_path(self.instance))
        self.mox.ReplayAll()

        self.driver.destroy_images(self.context, self.node, self.instance)
        self.mox.VerifyAll()
Beispiel #4
0
    def test_destroy_images(self):
        self._create_node()
        self.mox.StubOutWithMock(os, 'unlink')

        os.unlink(pxe.get_image_file_path(self.instance))
        os.unlink(pxe.get_image_dir_path(self.instance))
        self.mox.ReplayAll()

        self.driver.destroy_images(self.context, self.node, self.instance)
        self.mox.VerifyAll()
Beispiel #5
0
    def test_destroy_images(self):
        self._create_node()
        self.mox.StubOutWithMock(bm_utils, 'unlink_without_raise')
        self.mox.StubOutWithMock(bm_utils, 'rmtree_without_raise')

        bm_utils.unlink_without_raise(pxe.get_image_file_path(self.instance))
        bm_utils.rmtree_without_raise(pxe.get_image_dir_path(self.instance))
        self.mox.ReplayAll()

        self.driver.destroy_images(self.context, self.node, self.instance)
        self.mox.VerifyAll()
Beispiel #6
0
    def test_destroy_images(self):
        self._create_node()
        self.mox.StubOutWithMock(bm_utils, 'unlink_without_raise')
        self.mox.StubOutWithMock(bm_utils, 'rmtree_without_raise')

        bm_utils.unlink_without_raise(pxe.get_image_file_path(self.instance))
        bm_utils.rmtree_without_raise(pxe.get_image_dir_path(self.instance))
        self.mox.ReplayAll()

        self.driver.destroy_images(self.context, self.node, self.instance)
        self.mox.VerifyAll()
Beispiel #7
0
    def test_cache_image(self):
        self.mox.StubOutWithMock(os, 'makedirs')
        self.mox.StubOutWithMock(os.path, 'exists')
        os.makedirs(pxe.get_image_dir_path(self.instance)).\
                AndReturn(True)
        os.path.exists(pxe.get_image_file_path(self.instance)).\
                AndReturn(True)
        self.mox.ReplayAll()

        image_meta = utils.get_test_image_info(
                self.context, self.instance)
        self.driver._cache_image(
                self.context, self.instance, image_meta)
        self.mox.VerifyAll()
Beispiel #8
0
 def test_image_dir_path(self):
     self.assertEqual(
             pxe.get_image_dir_path(self.instance),
             os.path.join(CONF.instances_path, 'instance-00000001'))
Beispiel #9
0
 def test_image_dir_path(self):
     self.assertEqual(
         os.path.join(CONF.instances_path, 'instance-00000001'),
         pxe.get_image_dir_path(self.instance))
Beispiel #10
0
 def test_image_dir_path(self):
     self.assertEqual(os.path.join(CONF.instances_path, "instance-00000001"), pxe.get_image_dir_path(self.instance))