Esempio n. 1
0
 def test_getallimages(self):
     with namedTemporaryDir() as tmpdir:
         manifest = make_filesd_manifest(tmpdir)
         self.assertEqual(set(), manifest.getAllImages())
         img_uuid = str(uuid.uuid4())
         make_file_volume(manifest.domaindir, VOLSIZE, img_uuid)
         self.assertIn(img_uuid, manifest.getAllImages())
Esempio n. 2
0
 def test_getallimages(self):
     with fake_file_env() as env:
         self.assertEqual(set(), env.sd_manifest.getAllImages())
         img_id = str(uuid.uuid4())
         vol_id = str(uuid.uuid4())
         make_file_volume(env.sd_manifest, VOLSIZE, img_id, vol_id)
         self.assertIn(img_id, env.sd_manifest.getAllImages())
Esempio n. 3
0
 def fake_volume(self, vol_fmt, sd_version=3):
     with fake_file_env(sd_version=sd_version) as env:
         img_id = make_uuid()
         vol_id = make_uuid()
         make_file_volume(env.sd_manifest, self.SIZE, img_id, vol_id,
                          vol_format=vol_fmt)
         yield env.sd_manifest.produceVolume(img_id, vol_id)
Esempio n. 4
0
 def fake_volume(self, vol_fmt):
     with fake_file_env() as env:
         img_id = str(uuid.uuid4())
         vol_id = str(uuid.uuid4())
         make_file_volume(env.sd_manifest, self.SIZE, img_id, vol_id,
                          vol_format=vol_fmt)
         yield env.sd_manifest.produceVolume(img_id, vol_id)
Esempio n. 5
0
 def test_getallimages(self):
     with namedTemporaryDir() as tmpdir:
         manifest = make_filesd_manifest(tmpdir)
         self.assertEqual(set(), manifest.getAllImages())
         img_uuid = str(uuid.uuid4())
         make_file_volume(manifest.domaindir, VOLSIZE, img_uuid)
         self.assertIn(img_uuid, manifest.getAllImages())
Esempio n. 6
0
 def test_volume_type(self, vol_type):
     with fake_file_env() as env:
         img_id = make_uuid()
         vol_id = make_uuid()
         make_file_volume(env.sd_manifest, 0, img_id, vol_id,
                          vol_type=vol_type)
         vol = env.sd_manifest.produceVolume(img_id, vol_id)
         self.assertEqual(vol.getVolType(), sc.type2name(vol_type))
Esempio n. 7
0
 def fake_volume(self, vol_fmt, sd_version=3):
     with fake_file_env(sd_version=sd_version) as env:
         img_id = make_uuid()
         vol_id = make_uuid()
         make_file_volume(env.sd_manifest,
                          self.SIZE,
                          img_id,
                          vol_id,
                          vol_format=vol_fmt)
         yield env.sd_manifest.produceVolume(img_id, vol_id)
Esempio n. 8
0
 def test_volume_structure(self):
     with fake_file_env() as env:
         img_id = make_uuid()
         vol_id = make_uuid()
         make_file_volume(env.sd_manifest, 0, img_id, vol_id)
         image_dir = env.sd_manifest.getImagePath(img_id)
         files = (vol_id, vol_id + sc.LEASE_FILEEXT,
                  vol_id + fileVolume.META_FILEEXT)
         for f in files:
             path = os.path.join(image_dir, f)
             self.assertTrue(os.path.exists(path))
Esempio n. 9
0
 def test_volume_type(self, vol_type):
     with fake_file_env() as env:
         img_id = make_uuid()
         vol_id = make_uuid()
         make_file_volume(env.sd_manifest,
                          0,
                          img_id,
                          vol_id,
                          vol_type=vol_type)
         vol = env.sd_manifest.produceVolume(img_id, vol_id)
         self.assertEqual(vol.getVolType(), sc.type2name(vol_type))
Esempio n. 10
0
 def test_volume_structure(self):
     with fake_file_env() as env:
         img_id = make_uuid()
         vol_id = make_uuid()
         make_file_volume(env.sd_manifest, 0, img_id, vol_id)
         image_dir = env.sd_manifest.getImagePath(img_id)
         files = (vol_id, vol_id + sc.LEASE_FILEEXT,
                  vol_id + fileVolume.META_FILEEXT)
         for f in files:
             path = os.path.join(image_dir, f)
             self.assertTrue(os.path.exists(path))
Esempio n. 11
0
    def test_volume_metadata_io(self):
        with fake_file_env() as env:
            size = 1 * MB
            img_id = make_uuid()
            vol_id = make_uuid()
            make_file_volume(env.sd_manifest, size, img_id, vol_id)
            vol = env.sd_manifest.produceVolume(img_id, vol_id)
            desc = 'foo'
            vol.setDescription(desc)

            # Test that metadata is persisted to our temporary storage area
            vol = env.sd_manifest.produceVolume(img_id, vol_id)
            self.assertEqual(desc, vol.getDescription())
Esempio n. 12
0
    def test_volume_metadata_io(self):
        with fake_file_env() as env:
            size = 1 * MB
            img_id = make_uuid()
            vol_id = make_uuid()
            make_file_volume(env.sd_manifest, size, img_id, vol_id)
            vol = env.sd_manifest.produceVolume(img_id, vol_id)
            desc = 'foo'
            vol.setDescription(desc)

            # Test that metadata is persisted to our temporary storage area
            vol = env.sd_manifest.produceVolume(img_id, vol_id)
            self.assertEqual(desc, vol.getDescription())
Esempio n. 13
0
 def test_getvallocsize(self):
     with namedTemporaryDir() as tmpdir:
         manifest = make_filesd_manifest(tmpdir)
         imguuid, voluuid = make_file_volume(manifest.domaindir, VOLSIZE)
         self.assertEqual(0, manifest.getVAllocSize(imguuid, voluuid))
Esempio n. 14
0
 def test_getvallocsize(self):
     with fake_file_env() as env:
         make_file_volume(env.sd_manifest, VOLSIZE,
                          self.img_id, self.vol_id)
         self.assertEqual(0, env.sd_manifest.getVAllocSize(
             self.img_id, self.vol_id))
Esempio n. 15
0
 def test_getvsize(self):
     with self.env() as env:
         make_file_volume(env.sd_manifest, VOLSIZE, self.img_id,
                          self.vol_id)
         self.assertEqual(
             VOLSIZE, env.sd_manifest.getVSize(self.img_id, self.vol_id))
Esempio n. 16
0
 def test_getvsize(self):
     with self.env() as env:
         make_file_volume(env.sd_manifest, VOLSIZE,
                          self.img_id, self.vol_id)
         self.assertEqual(VOLSIZE, env.sd_manifest.getVSize(
             self.img_id, self.vol_id))
Esempio n. 17
0
 def test_getvallocsize(self):
     with fake_file_env() as env:
         sd_manifest = env.sd_manifest
         imguuid, voluuid = make_file_volume(sd_manifest.domaindir, VOLSIZE)
         self.assertEqual(0, sd_manifest.getVAllocSize(imguuid, voluuid))
Esempio n. 18
0
 def test_getvallocsize(self):
     with namedTemporaryDir() as tmpdir:
         manifest = make_filesd_manifest(tmpdir)
         imguuid, voluuid = make_file_volume(manifest.domaindir, VOLSIZE)
         self.assertEqual(0, manifest.getVAllocSize(imguuid, voluuid))