def x_turn_on(vmi): ssn = act.new_admin_ssn(vmi) runner = remote.RemoteRunner(session=ssn) srv_mng = service.Factory.create_service(run=runner.run) srv_mng.set_target("graphical.target") # pylint: disable=no-member cmd1 = utils.Cmd("ss", "-x", "src", "*X11-unix*") cmd2 = utils.Cmd("grep", "-q", "-s", "X11") cmd = utils.combine(cmd1, "|", cmd2) status, _ = act.rstatus(vmi, cmd) assert status == 0, "X is: off. But it should not." # TODO utils.info(vmi, "X is: on.")
def service_vdagent(vmi, action): """Start/Stop/... on the spice-vdagentd service. Parameters ---------- action : str Action on vdagent-service: stop, start, restart, status, ... Info ---- See: avocado-vt/virttest/staging/service.py for COMMANDS """ ssn = act.new_admin_ssn(vmi) runner = remote.RemoteRunner(session=ssn) vdagentd = service.Factory.create_specific_service("spice-vdagentd", run=runner.run) func = getattr(vdagentd, action) utils.info(vmi, "spice-vdagent: %s", action) return func()