Exemplo n.º 1
0
    def test_mount(self):
        image = '/tmp/fake-image'
        mountdir = '/mnt/fake_rootfs'
        fakemount = FakeMount(image, mountdir, None)

        def fake_instance_for_format(imgfile, mountdir, partition, imgfmt):
            return fakemount

        self.stubs.Set(mount.Mount, 'instance_for_format',
                       staticmethod(fake_instance_for_format))
        diskimage = disk_api._DiskImage(image=image, mount_dir=mountdir)
        dev = diskimage.mount()
        self.assertEqual(diskimage._mounter, fakemount)
        self.assertEqual(dev, '/dev/fake')
Exemplo n.º 2
0
    def test_mount(self, mock_open):
        self.mock_proc_mounts(mock_open)
        image = "/tmp/fake-image"
        mountdir = "/mnt/fake_rootfs"
        fakemount = FakeMount(image, mountdir, None)

        def fake_instance_for_format(imgfile, mountdir, partition, imgfmt):
            return fakemount

        self.stubs.Set(mount.Mount, "instance_for_format", staticmethod(fake_instance_for_format))
        diskimage = disk_api._DiskImage(image=image, mount_dir=mountdir)
        dev = diskimage.mount()
        self.assertEqual(diskimage._mounter, fakemount)
        self.assertEqual(dev, "/dev/fake")
Exemplo n.º 3
0
    def test_mount(self, mock_open):
        self.mock_proc_mounts(mock_open)
        image = '/tmp/fake-image'
        mountdir = '/mnt/fake_rootfs'
        fakemount = FakeMount(image, mountdir, None)

        def fake_instance_for_format(image, mountdir, partition):
            return fakemount

        self.stub_out('nova.virt.disk.mount.api.Mount.instance_for_format',
                      staticmethod(fake_instance_for_format))
        diskimage = disk_api._DiskImage(image=image, mount_dir=mountdir)
        dev = diskimage.mount()
        self.assertEqual(diskimage._mounter, fakemount)
        self.assertEqual(dev, '/dev/fake')
Exemplo n.º 4
0
    def test_mount(self, mock_open):
        self.mock_proc_mounts(mock_open)
        image = '/tmp/fake-image'
        mountdir = '/mnt/fake_rootfs'
        fakemount = FakeMount(image, mountdir, None)

        def fake_instance_for_format(image, mountdir, partition):
            return fakemount

        self.stub_out('nova.virt.disk.mount.api.Mount.instance_for_format',
                      staticmethod(fake_instance_for_format))
        diskimage = disk_api._DiskImage(image=image, mount_dir=mountdir)
        dev = diskimage.mount()
        self.assertEqual(diskimage._mounter, fakemount)
        self.assertEqual(dev, '/dev/fake')
Exemplo n.º 5
0
    def test_teardown(self, mock_open):
        self.mock_proc_mounts(mock_open)

        image = '/tmp/fake-image'
        mountdir = '/mnt/fake_rootfs'
        fakemount = FakeMount(image, mountdir, None)

        def fake_instance_for_format(image, mountdir, partition):
            return fakemount

        self.stubs.Set(mount.Mount, 'instance_for_format',
                       staticmethod(fake_instance_for_format))
        diskimage = disk_api._DiskImage(image=image, mount_dir=mountdir)
        dev = diskimage.mount()
        self.assertEqual(diskimage._mounter, fakemount)
        self.assertEqual(dev, '/dev/fake')
        diskimage.teardown()
        self.assertIsNone(diskimage._mounter)
Exemplo n.º 6
0
    def test_teardown(self, mock_open):
        self.mock_proc_mounts(mock_open)

        image = '/tmp/fake-image'
        mountdir = '/mnt/fake_rootfs'
        fakemount = FakeMount(image, mountdir, None)

        def fake_instance_for_format(imgfile, mountdir, partition, imgfmt):
            return fakemount

        self.stubs.Set(mount.Mount, 'instance_for_format',
                       staticmethod(fake_instance_for_format))
        diskimage = disk_api._DiskImage(image=image, mount_dir=mountdir)
        dev = diskimage.mount()
        self.assertEqual(diskimage._mounter, fakemount)
        self.assertEqual(dev, '/dev/fake')
        diskimage.teardown()
        self.assertIsNone(diskimage._mounter)