def test_mkIsoFs(self, label): """ Tests mkimage.mkIsoFs creating an image and checking its content """ checkSudo(["mount", "-o", "loop", "somefile", "target"]) checkSudo(["umount", "target"]) iso_img = mkimage.mkIsoFs("vmId_iso", self.files, label) self.assertTrue(os.path.exists(iso_img)) m = storage.mount.Mount(iso_img, self.workdir) m.mount(mntOpts='loop') try: self._check_content() self._check_label(iso_img, label) self._check_permissions(iso_img, ((stat.S_IRUSR, True), (stat.S_IWUSR, True), (stat.S_IXUSR, False))) self._check_permissions(iso_img, ((stat.S_IRGRP, True), (stat.S_IWGRP, False), (stat.S_IXGRP, False))) self._check_permissions(iso_img, ((stat.S_IROTH, False), (stat.S_IWOTH, False), (stat.S_IXOTH, False))) finally: m.umount(force=True) os.unlink(iso_img)
def test_mkIsoFs(self, label): """ Tests mkimage.mkIsoFs creating an image and checking its content """ checkSudo(["mount", "-o", "loop", "somefile", "target"]) checkSudo(["umount", "target"]) iso_img = mkimage.mkIsoFs("vmId_iso", self.files, label) self.assertTrue(os.path.exists(iso_img)) m = storage.mount.Mount(iso_img, self.workdir) m.mount(mntOpts='loop') try: self._check_content() self._check_label(iso_img, label) self._check_permissions(iso_img, ((stat.S_IRUSR, True), (stat.S_IWUSR, True), (stat.S_IXUSR, False))) self._check_permissions(iso_img, ((stat.S_IRGRP, True), (stat.S_IWGRP, False), (stat.S_IXGRP, False))) self._check_permissions(iso_img, ((stat.S_IROTH, False), (stat.S_IWOTH, False), (stat.S_IXOTH, False))) finally: m.umount(force=True, freeloop=True) # TODO: Use libudev to wait for specific event with stopwatch("Wait for udev events"): udevadm.settle(5)
def test_removeFs(self): """ Tests mkimage.removeFs creating an image and removing it. Check also that removeFs doesn't remove anything outside mkimage._P_PAYLOAD_IMAGES """ checkSudo(["mount", "-o", "loop", "somefile", "target"]) checkSudo(["umount", "target"]) iso_img = mkimage.mkIsoFs("vmId_iso", self.files) self.assertTrue(os.path.exists(iso_img)) mkimage.removeFs(iso_img) self.assertFalse(os.path.exists(iso_img)) self.assertRaises(Exception, mkimage.removeFs, self.workdir)
def test_mkIsoFs(self): """ Tests mkimage.mkIsoFs creating an image and checking its content """ checkSudo(["mount", "-o", "loop", "somefile", "target"]) checkSudo(["umount", "target"]) iso_img = mkimage.mkIsoFs("vmId_iso", self.files) self.assertTrue(os.path.exists(iso_img)) m = storage.mount.Mount(iso_img, self.workdir) m.mount(mntOpts='loop') try: self._check_content() finally: m.umount(force=True) os.unlink(iso_img)
def test_mkIsoFs(self, label): """ Tests mkimage.mkIsoFs creating an image and checking its content """ iso_img = mkimage.mkIsoFs("vmId_iso", self.files, label) self.assertTrue(os.path.exists(iso_img)) m = mount.Mount(iso_img, self.workdir) try: m.mount(mntOpts='loop') except mount.MountError as e: raise SkipTest("Error mounting iso image: %s" % e) try: self._check_content() self._check_label(iso_img, label) finally: m.umount()
def test_mkIsoFs(self, label): """ Tests mkimage.mkIsoFs creating an image and checking its content """ iso_img = mkimage.mkIsoFs("vmId_iso", self.files, label) self.assertTrue(os.path.exists(iso_img)) m = mount.Mount(iso_img, self.workdir) try: m.mount(mntOpts='loop') except mount.MountError as e: raise SkipTest("Error mounting iso image: %s" % e) try: self._check_content() self._check_label(iso_img, label) finally: m.umount(force=True, freeloop=True) # TODO: Use libudev to wait for specific event with stopwatch("Wait for udev events"): udevadm.settle(5)
def test_mkIsoFs(self, label): """ Tests mkimage.mkIsoFs creating an image and checking its content """ iso_img = mkimage.mkIsoFs("vmId_iso", self.files, label) self.assertTrue(os.path.exists(iso_img)) m = mount.Mount(iso_img, self.workdir) try: m.mount(mntOpts="loop") except mount.MountError as e: raise SkipTest("Error mounting iso image: %s" % e) try: self._check_content() self._check_label(iso_img, label) finally: m.umount(force=True, freeloop=True) # TODO: Use libudev to wait for specific event with stopwatch("Wait for udev events"): udevadm.settle(5)
def mkIsoFs(self, vmId, files, volId): return mkimage.mkIsoFs(vmId, files, volId)