Example #1
0
    def daemon_hook():
        """
        Check the libvirtd hooks.
        """
        # stop daemon first
        libvirtd.stop()
        prepare_hook_file(hook_script % hook_log)
        try:
            libvirtd.start()
            hook_str = hook_file + " - start - start"
            assert check_hooks(hook_str)
            # Restart libvirtd and test again
            if os.path.exists(hook_log):
                os.remove(hook_log)
            libvirtd.restart()
            hook_str = hook_file + " - shutdown - shutdown"
            assert check_hooks(hook_str)
            hook_str = hook_file + " - start - start"
            assert check_hooks(hook_str)

            # kill the daemon with SIGHUP
            if os.path.exists(hook_log):
                os.remove(hook_log)
            utils_misc.signal_program('libvirtd', 1,
                                      '/var/run')
            hook_str = hook_file + " - reload begin SIGHUP"
            assert check_hooks(hook_str)

        except AssertionError:
            utils_misc.log_last_traceback()
            test.fail("Failed to check"
                      " daemon hooks")
Example #2
0
    def daemon_hook():
        """
        Check the libvirtd hooks.
        """
        # stop daemon first
        libvirtd.stop()
        prepare_hook_file(hook_script % hook_log)
        try:
            libvirtd.start()
            hook_str = hook_file + " - start - start"
            assert check_hooks(hook_str)
            # Restart libvirtd and test again
            if os.path.exists(hook_log):
                os.remove(hook_log)
            libvirtd.restart()
            hook_str = hook_file + " - shutdown - shutdown"
            assert check_hooks(hook_str)
            hook_str = hook_file + " - start - start"
            assert check_hooks(hook_str)

            # kill the daemon with SIGHUP
            if os.path.exists(hook_log):
                os.remove(hook_log)
            utils_misc.signal_program('libvirtd', 1,
                                      '/var/run')
            hook_str = hook_file + " - reload begin SIGHUP"
            assert check_hooks(hook_str)

        except AssertionError:
            utils.log_last_traceback()
            raise error.TestFail("Failed to check"
                                 " daemon hooks")
Example #3
0
 def clean(self, test, params, env):
     if self.ovs:
         try:
             if not self.dns_pidf is None:
                 utils_misc.signal_program(self.dns_pidf[0:-4], pid_files_dir=test.tmpdir)
         except:
             pass
         try:
             self.ovs.del_br(self.br0_name)
         except Exception:
             pass
         if self.ovs.cleanup:
             self.ovs.clean()
Example #4
0
 def clean(self, test, params, env):
     if self.ovs:
         try:
             if not self.dns_pidf is None:
                 utils_misc.signal_program(self.dns_pidf[0:-4],
                                           pid_files_dir=test.tmpdir)
         except:
             pass
         try:
             self.ovs.del_br(self.br0_name)
         except Exception:
             pass
         if self.ovs.cleanup:
             self.ovs.clean()