def check_images_coredump(image, mntpnt, check_files, debugdir): """ Mount the images and check the coredump files :return: Format as Bool, List If the checked file exists return True, ["checked file name"] If not, return False [] """ found_coredump = False msgs_return = [] try: error.context("Mount the guest image %s to host mount point" % image, logging.info) status = lgf.guestmount(image, mntpnt, True, True, debug=True, is_disk=True) if status.exit_status: msgs_return.append("Could not mount guest image %s." % image) error.context(msgs_return[0], logging.error) else: found_coredump, msgs_return = coredump_exists( mntpnt, check_files, debugdir) finally: if os.path.ismount(mntpnt): error.context("guestunmount host mount point") lgf.lgf_command("guestunmount %s" % mntpnt) return found_coredump, msgs_return
def check_images_coredump(image, mntpnt, check_files, debugdir): """ Mount the images and check the coredump files :return: Format as Bool, List If the checked file exists return True, ["checked file name"] If not, return False [] """ found_coredump = False msgs_return = [] try: error.context("Mount the guest image %s to host mount point" % image, logging.info) status = lgf.guestmount(image, mntpnt, True, True, debug=True, is_disk=True) if status.exit_status: msgs_return.append("Could not mount guest image %s." % image) error.context(msgs_return[0], logging.error) else: found_coredump, msgs_return = coredump_exists(mntpnt, check_files, debugdir) finally: if os.path.ismount(mntpnt): error.context("guestunmount host mount point") lgf.lgf_command("guestunmount %s" % mntpnt) return found_coredump, msgs_return
def test_lgf_cmd(self): cmd = "libguestfs-test-tool" try: path.find_command(cmd) self.assertEqual(lgf.lgf_command(cmd).exit_status, 0) except path.CmdNotFoundError: logging.warning("Command %s not installed, skipping unittest...", cmd)