Beispiel #1
0
    def test_is_sudo_enabled_true(self, get_owner, get_pid, _):
        user_id = 0
        process_id = 123
        get_pid.return_value = process_id
        get_owner.return_value = user_id

        subprocess = process.SubProcess(FICTIONAL_CMD)

        self.assertTrue(subprocess.is_sudo_enabled())
        get_owner.assert_called_with(process_id)
Beispiel #2
0
    def test_get_user_id(self, get_owner, get_pid, _):
        user_id = 1
        process_id = 123
        get_pid.return_value = process_id
        get_owner.return_value = user_id

        subprocess = process.SubProcess(FICTIONAL_CMD)

        self.assertEqual(subprocess.get_user_id(), user_id)
        get_owner.assert_called_with(process_id)
Beispiel #3
0
 def test_process_stop_uninterrupted(self):
     """
     :avocado: tags=parallel:1
     """
     proc = process.SubProcess('%s 1 3' % self.fake_vmstat)
     proc.start()
     time.sleep(3)
     proc.stop(4)
     result = proc.result
     self.assertFalse(result.interrupted, "Process was interrupted to early")
Beispiel #4
0
 def test_process_stop_interrupted(self):
     """
     :avocado: tags=parallel:1
     """
     proc = process.SubProcess('%s 1 3' % self.fake_vmstat)
     proc.start()
     time.sleep(3)
     proc.stop(2)
     result = proc.result
     self.assertIn('timeout after', result.interrupted, "Process wasn't interrupted")
Beispiel #5
0
    def pinned_cpu_stress(self):
        """
        Set process affinity and do cpu off on
        @BUG : https://lkml.org/lkml/2017/5/30/122
        """
        nodes = []
        self.log.info("\nCreate %s pids and set proc affinity", totalcpus)
        for proc in range(0, totalcpus):
            pid = process.SubProcess("while :; do :; done &",
                                     shell=True).start()
            pids.append(pid)
            process.run("taskset -pc %s %s" % (proc, pid),
                        ignore_status=True,
                        shell=True)

        self.log.info("\noffline cpus and see the affinity change")
        count = 0
        for pid in pids:
            cpu.offline(count)
            process.run("taskset -pc %s" % pid, ignore_status=True, shell=True)
            count = count + 1

        self.__online_cpus(totalcpus)

        self.log.info("\nShift affinity for the same process and toggle")
        for proc in range(totalcpus):
            process.run("taskset -pc $((%s<<1)) $$" % proc,
                        ignore_status=True,
                        shell=True)
            cpu.offline(proc)

        self.__online_cpus(totalcpus)

        self.log.info("\nSet all process affine to single NUMA node")
        nodes = process.system_output("numactl --hardware | grep cpus:",
                                      shell=True)
        nodes = nodes.split('\n')
        for node in nodes:
            cores = node.split(': ')[-1].replace(" ", ",")
            if cores:
                for pid in pids:
                    process.run("taskset -pc %s %s" % (cores, pid),
                                ignore_status=True,
                                shell=True)

        self.log.info(
            "\ntoggle random cpu, while shifting affinity of same pid")
        for i in range(self.iteration):
            core = randint(0, totalcpus)
            process.run("taskset -pc $((%s<<1)) $$" % core,
                        ignore_status=True,
                        shell=True)
            self.__cpu_toggle(core)

        self.__kill_process(pids)
Beispiel #6
0
    def test_send_signal_sudo_enabled(self, run, get_children, pid, sudo, init):  # pylint: disable=W0613
        signal = 1
        child_pid = 123
        sudo.return_value = True
        get_children.return_value = [child_pid]

        subprocess = process.SubProcess(FICTIONAL_CMD)
        subprocess.send_signal(signal)

        expected_cmd = 'kill -%d %d' % (signal, child_pid)
        run.assert_called_with(expected_cmd, sudo=True)
 def test_process_start(self):
     """
     :avocado: tags=parallel:1
     """
     proc = process.SubProcess(f'{self.fake_vmstat} 1 0')
     proc.start()
     time.sleep(3)
     proc.terminate()
     proc.wait(timeout=1)
     stdout = proc.get_stdout().decode()
     self.assertIn('memory', stdout, f'result: {stdout}')
     self.assertRegex(stdout, '[0-9]+')
Beispiel #8
0
 def test_force_unmount(self):
     """ Test force-unmount feature """
     self.disk.mkfs()
     self.disk.mount()
     self.assertIn(self.mountpoint, open("/proc/mounts").read())
     proc = process.SubProcess("cd %s; while :; do echo a > a; rm a; done" %
                               self.mountpoint,
                               shell=True)
     proc.start()
     self.assertTrue(self.disk.unmount())
     self.assertEqual(proc.poll(), -9)  # Process should be killed -9
     self.assertNotIn(self.mountpoint, open("/proc/mounts").read())
Beispiel #9
0
 def test_force_unmount_no_lsof(self):
     """ Checks that a force-unmount will fail on systems without lsof """
     with open("/proc/mounts") as proc_mounts_file:
         proc_mounts = proc_mounts_file.read()
         self.assertIn(self.mountpoint, proc_mounts)
         proc = process.SubProcess(
             "cd %s; while :; do echo a > a; rm a; done" % self.mountpoint,
             shell=True)
         proc.start()
         self.assertRaises(partition.PartitionError, self.disk.unmount)
         proc.terminate()
         proc.wait()
Beispiel #10
0
 def run_process_to_use_mnt(self):
     proc = process.SubProcess(self.use_mnt_cmd, sudo=True)
     proc.start()
     self.assertTrue(
         wait.wait_for(
             lambda: os.path.exists(self.use_mnt_file),
             timeout=1,
             first=0.1,
             step=0.1,
         ),
         "File was not created within mountpoint",
     )
     return proc
    def test_memapi(self):
        os.chdir(self.teststmpdir)
        proc = process.SubProcess('./memory_api %s %s' %
                                  (self.memsize, self.induce_err),
                                  shell=True,
                                  allow_output_check='both')
        proc.start()
        while proc.poll() is None:
            pass

        if proc.poll() not in [0, 255]:
            self.fail(
                "Unexpected application abort, check for possible issues")
    def test(self):
        os.chdir(self.teststmpdir)
        cmd = './ksm_poison -n %s' % str(self.nr_pages // 2)
        if self.touch:
            cmd = '%s -t' % cmd
        if self.offline:
            cmd = '%s -%s' % (cmd, self.offline)
        ksm = process.SubProcess(cmd, shell=True, sudo=True)
        ksm.start()
        ksm.wait()

        if ksm.result.exit_status:
            self.fail("Please check the logs for debug")
 def setUp(self):
     """
     To check and install dependencies for the test
     """
     smm = SoftwareManager()
     detected_distro = distro.detect()
     pkgs = ["gcc", "autoconf", "perl", "m4", "git-core"]
     if detected_distro.name == "Ubuntu":
         pkgs.extend(["libsctp1", "libsctp-dev", "lksctp-tools"])
     else:
         pkgs.extend(["lksctp-tools", "lksctp-tools-devel"])
     for pkg in pkgs:
         if not smm.check_installed(pkg) and not smm.install(pkg):
             self.cancel("%s package is need to test" % pkg)
     interfaces = netifaces.interfaces()
     self.iface = self.params.get("interface", default="")
     self.peer_ip = self.params.get("peer_ip", default="")
     if self.iface not in interfaces:
         self.cancel("%s interface is not available" % self.iface)
     if self.peer_ip == "":
         self.cancel("%s peer machine is not available" % self.peer_ip)
     self.peer_user = self.params.get("peer_user_name", default="root")
     uperf_download = self.params.get("uperf_download",
                                      default="https:"
                                      "//github.com/uperf/uperf/"
                                      "archive/master.zip")
     tarball = self.fetch_asset(uperf_download, expire='7d')
     archive.extract(tarball, self.teststmpdir)
     self.uperf_dir = os.path.join(self.teststmpdir, "uperf-master")
     cmd = "scp -r %s %s@%s:/tmp" % (self.uperf_dir, self.peer_user,
                                     self.peer_ip)
     if process.system(cmd, shell=True, ignore_status=True) != 0:
         self.cancel("unable to copy the uperf into peer machine")
     cmd = "ssh %s@%s \"cd /tmp/uperf-master;autoreconf -fi;./configure " \
           "ppc64le;make\"" % (self.peer_user, self.peer_ip)
     if process.system(cmd, ignore_status=True, shell=True, sudo=True):
         self.cancel("Unable to compile Uperf into peer machine")
     self.uperf_run = str(self.params.get("UPERF_SERVER_RUN", default=0))
     if self.uperf_run == '1':
         cmd = "ssh %s@%s \"cd /tmp/uperf-master/src;./uperf -s\""\
               % (self.peer_user, self.peer_ip)
         obj = process.SubProcess(cmd, verbose=False, shell=True)
         obj.start()
     os.chdir(self.uperf_dir)
     process.system('autoreconf -fi', shell=True)
     process.system('./configure ppc64le', shell=True)
     build.make(self.uperf_dir)
     self.uperf = os.path.join(self.uperf_dir, 'doc')
     self.expected_tp = self.params.get("EXPECTED_THROUGHPUT", default="85")
     speed = int(read_file("/sys/class/net/%s/speed" % self.iface))
     self.expected_tp = int(self.expected_tp) * speed / 100
Beispiel #14
0
    def test(self):
        self.log.info("Trace file %s", self.trace_file)

        # Run the provided trace file though falco
        cmd = '{}/userspace/falco/falco -r {}/../rules/falco_rules.yaml -c {}/../falco.yaml -e {} -o json_output={}'.format(
            self.falcodir, self.falcodir, self.falcodir, self.trace_file, self.json_output)

        self.falco_proc = process.SubProcess(cmd)

        res = self.falco_proc.run(timeout=60, sig=9)

        if res.exit_status != 0:
            self.error("Falco command \"{}\" exited with non-zero return value {}".format(
                cmd, res.exit_status))

        # Get the number of events detected.
        match = re.search('Events detected: (\d+)', res.stdout)
        if match is None:
            self.fail("Could not find a line 'Events detected: <count>' in falco output")

        events_detected = int(match.group(1))

        if not self.should_detect and events_detected > 0:
            self.fail("Detected {} events when should have detected none".format(events_detected))

        if self.should_detect:
            if events_detected == 0:
                self.fail("Detected {} events when should have detected > 0".format(events_detected))

            level_line = '{}: (\d+)'.format(self.detect_level)
            match = re.search(level_line, res.stdout)

            if match is None:
                self.fail("Could not find a line '{}: <count>' in falco output".format(self.detect_level))

            events_detected = int(match.group(1))

            if not events_detected > 0:
                self.fail("Detected {} events at level {} when should have detected > 0".format(events_detected, self.detect_level))

        if self.json_output:
            # Just verify that any lines starting with '{' are valid json objects.
            # Doesn't do any deep inspection of the contents.
            for line in res.stdout.splitlines():
                if line.startswith('{'):
                    obj = json.loads(line)
                    for attr in ['time', 'rule', 'priority', 'output']:
                        if not attr in obj:
                            self.fail("Falco JSON object {} does not contain property \"{}\"".format(line, attr))
        pass
    def test(self):
        os.chdir(self.teststmpdir)
        proc = process.SubProcess('./memory_api %s ' % self.memsize,
                                  shell=True, allow_output_check='both')
        proc.start()
        while proc.poll() is None:
            pass

        if proc.poll() != 0:
            self.fail("Unexpected application abort, check for possible issues")

        self.log.info("Testing mremap with minimal memory and expand it")
        if process.system('./mremap %s' % str(int(memory.freememtotal())), ignore_status=True):
            self.fail('Mremap expansion failed')
Beispiel #16
0
 def test_bandwidth(self):
     '''
     GPU bandwidth tests
     '''
     self.log.info("test_bandwidth: bandwidth tests with CPU binding")
     os.chdir(self.testdir)
     for numa_node in [0, 8]:
         bandwidth_cmd = "numactl --cpunodebind=%s ./bandwidthTest --csv \
                          --device=all --memory=pinned --mode=range\
                          --start=134217728 --end=134217728\
                          --increment=100" % numa_node
         bandwidth_proc = process.SubProcess(bandwidth_cmd, shell=True,\
                          sudo=True)
         bandwidth_proc.start()
         bandwidth_proc.wait()
 def test_run_with_negative_timeout_ugly_cmd(self):
     with script.TemporaryScript("refuse_to_die", REFUSE_TO_DIE) as exe:
         cmd = "%s '%s'" % (sys.executable, exe.path)
         # Wait 1s to set the traps
         proc = process.SubProcess(cmd)
         proc.start()
         time.sleep(1)
         proc.wait(-1)
         res = proc.result
         self.assertLess(
             res.duration, 100, "Took longer than expected, "
             "process probably not interrupted by Avocado.\n%s" % res)
         self.assertNotEqual(
             res.exit_status, 0, "Command finished without "
             "reporting failure but should be killed.\n%s" % res)
Beispiel #18
0
    def test_send_signal_sudo_enabled(self, run, get_children, get_pid, sudo, _):
        signal = 1
        pid = 122
        child_pid = 123
        sudo.return_value = True
        get_pid.return_value = pid
        get_children.return_value = [child_pid]

        subprocess = process.SubProcess(FICTIONAL_CMD)
        subprocess.send_signal(signal)

        kill_cmd = 'kill -%d %d'
        calls = [unittest.mock.call(kill_cmd % (signal, child_pid), sudo=True),
                 unittest.mock.call(kill_cmd % (signal, pid), sudo=True)]
        run.assert_has_calls(calls)
Beispiel #19
0
 def test_nbody(self):
     '''
     GPU nBody benchmark tests
     '''
     self.log.info("test_nbody: GPU nBody benchmark tests")
     gpu_cmd = "nvidia-smi --list-gpus | awk '{print $2}' | cut -b 1"
     gpu_list = process.system_output(gpu_cmd, shell=True, 
                        ignore_status=True, sudo=True).decode().splitlines()
     self.log.info("test_nbody:Total GPUs=%s, GPU List=%s" % \
                   (len(gpu_list), gpu_list))
     os.chdir(self.testdir)
     nbody_cmd = "./nbody -benchmark -numbodies=50331648 -numdevices=%s\
                  -fp64" % len(gpu_list)
     nbody_proc = process.SubProcess(nbody_cmd, shell=True, sudo=True)
     nbody_proc.start()
     nbody_proc.wait()
Beispiel #20
0
 def setUp(self):
     """
     To check and install dependencies for the test
     """
     smm = SoftwareManager()
     for pkg in ["gcc", "autoconf", "perl", "m4"]:
         if not smm.check_installed(pkg) and not smm.install(pkg):
             self.cancel("%s package is need to test" % pkg)
     interfaces = netifaces.interfaces()
     self.iface = self.params.get("interface", default="")
     self.peer_ip = self.params.get("peer_ip", default="")
     if self.iface not in interfaces:
         self.cancel("%s interface is not available" % self.iface)
     if self.peer_ip == "":
         self.cancel("%s peer machine is not available" % self.peer_ip)
     self.peer_user = self.params.get("peer_user_name", default="root")
     iperf_download = self.params.get("iperf_download",
                                      default="https:"
                                      "//github.com/esnet/"
                                      "iperf/archive/master.zip")
     tarball = self.fetch_asset("iperf.zip",
                                locations=[iperf_download],
                                expire='7d')
     archive.extract(tarball, self.teststmpdir)
     self.iperf_dir = os.path.join(self.teststmpdir, "iperf-master")
     cmd = "scp -r %s %s@%s:/tmp" % (self.iperf_dir, self.peer_user,
                                     self.peer_ip)
     if process.system(cmd, shell=True, ignore_status=True) != 0:
         self.cancel("unable to copy the iperf into peer machine")
     cmd = "ssh %s@%s \"cd /tmp/iperf-master;./bootstrap.sh;./configure;" \
           "make\"" % (self.peer_user, self.peer_ip)
     if process.system(cmd, ignore_status=True, shell=True, sudo=True):
         self.cancel("Unable to compile Iperf into peer machine")
     self.iperf_run = str(self.params.get("IPERF_SERVER_RUN", default=0))
     if self.iperf_run == '1':
         cmd = "ssh %s@%s \"cd /tmp/iperf-master/src/;./iperf3 -s\""\
               % (self.peer_user, self.peer_ip)
         obj = process.SubProcess(cmd, verbose=False, shell=True)
         obj.start()
     os.chdir(self.iperf_dir)
     process.system('./bootstrap.sh', shell=True)
     process.system('./configure', shell=True)
     build.make(self.iperf_dir)
     self.iperf = os.path.join(self.iperf_dir, 'src')
     self.expected_tp = self.params.get("EXPECTED_THROUGHPUT", default="85")
     speed = int(read_file("/sys/class/net/%s/speed" % self.iface))
     self.expected_tp = int(self.expected_tp) * speed / 100
Beispiel #21
0
 def test_early_latest_result(self):
     """
     Tests that the `latest` link to the latest job results is created early
     """
     os.chdir(basedir)
     cmd_line = ('./scripts/avocado run --sysinfo=off --job-results-dir %s '
                 'examples/tests/passtest.py' % self.tmpdir)
     avocado_process = process.SubProcess(cmd_line)
     avocado_process.start()
     link = os.path.join(self.tmpdir, 'latest')
     for trial in xrange(0, 50):
         time.sleep(0.1)
         if os.path.exists(link) and os.path.islink(link):
             avocado_process.wait()
             break
     self.assertTrue(os.path.exists(link))
     self.assertTrue(os.path.islink(link))
Beispiel #22
0
 def test(self):
     """
     Performs the tcpdump test.
     """
     cmd = "ping -I %s %s -c %s" % (self.iface, self.peer_ip, self.count)
     obj = process.SubProcess(cmd, verbose=False, shell=True)
     obj.start()
     output_file = os.path.join(self.outputdir, 'tcpdump')
     cmd = "tcpdump -i %s -n -c %s -w '%s'" % (self.iface, self.count,
                                               output_file)
     for line in process.run(cmd, shell=True,
                             ignore_status=True).stderr.splitlines():
         if "packets dropped by interface" in line:
             if int(line[0]) >= (int(self.drop) * int(self.count) / 100):
                 self.fail("%s, more than %s percent" % (line, self.drop))
             print line
     obj.stop()
Beispiel #23
0
 def test_run_with_negative_timeout_ugly_cmd(self):
     """
     :avocado: tags=parallel:1
     """
     with script.TemporaryScript("refuse_to_die", REFUSE_TO_DIE) as exe:
         cmd = f"{sys.executable} '{exe.path}'"
         # Wait 1s to set the traps
         proc = process.SubProcess(cmd)
         proc.start()
         time.sleep(1)
         proc.wait(-1)
         res = proc.result
         self.assertLess(res.duration, 100,
                         (f"Took longer than expected, process probably "
                          f"not interrupted by Avocado.\n{res}"))
         self.assertNotEqual(res.exit_status, 0,
                             (f"Command finished without reporting "
                              f"failure but should be killed.\n{res}"))
    def test(self):
        os.chdir(self.teststmpdir)
        proc = process.SubProcess('./memory_api %s %s' %
                                  (self.memsize, self.induce_err),
                                  shell=True,
                                  allow_output_check='both')
        proc.start()
        while proc.poll() is None:
            pass

        ret = process.system('./memory_api %s 1' % self.memsize,
                             shell=True,
                             ignore_status=True)
        if ret == 255:
            self.log.info("Error obtained as expected")

        if proc.poll() != 0:
            self.fail(
                "Unexpected application abort, check for possible issues")
Beispiel #25
0
    def test_send_signal_sudo_enabled_with_exception(self, run, get_children,
                                                     get_pid, sudo, init):  # pylint: disable=W0613
        signal = 1
        pid = 122
        child_pid = 123
        sudo.return_value = True
        get_pid.return_value = pid
        get_children.return_value = [child_pid]
        run.side_effect = Exception()

        subprocess = process.SubProcess(FICTIONAL_CMD)
        subprocess.send_signal(signal)

        kill_cmd = 'kill -%d %d'
        calls = [
            unittest.mock.call(kill_cmd % (signal, child_pid), sudo=True),
            unittest.mock.call(kill_cmd % (signal, pid), sudo=True)
        ]
        run.assert_has_calls(calls)
Beispiel #26
0
 def test_force_unmount_get_pids_fail(self):
     """ Checks PartitionError is raised if there's no lsof to get pids """
     with open("/proc/mounts") as proc_mounts_file:
         proc_mounts = proc_mounts_file.read()
         self.assertIn(self.mountpoint, proc_mounts)
         proc = process.SubProcess(
             "cd %s; while :; do echo a > a; rm a; done" % self.mountpoint,
             shell=True)
         proc.start()
         with mock.patch('avocado.utils.partition.process.run',
                         side_effect=process.CmdError):
             with mock.patch(
                     'avocado.utils.partition.process.system_output',
                     side_effect=OSError) as mocked_system_output:
                 self.assertRaises(partition.PartitionError,
                                   self.disk.unmount)
                 mocked_system_output.assert_called_with('lsof ' +
                                                         self.mountpoint)
         proc.terminate()
         proc.wait()
Beispiel #27
0
    def test_early_latest_result(self):
        """
        Tests that the `latest` link to the latest job results is created early

        :avocado: tags=parallel:1
        """
        cmd_line = (f"{AVOCADO} run --disable-sysinfo "
                    f"--job-results-dir {self.tmpdir.name} "
                    f"examples/tests/passtest.py")
        avocado_process = process.SubProcess(cmd_line)
        try:
            avocado_process.start()
            link = os.path.join(self.tmpdir.name, "latest")
            for _ in range(0, 50):
                time.sleep(0.1)
                if os.path.exists(link) and os.path.islink(link):
                    avocado_process.wait()
                    break
            self.assertTrue(os.path.exists(link))
            self.assertTrue(os.path.islink(link))
        finally:
            avocado_process.wait()
Beispiel #28
0
    def test_workload(self):
        """
        This test covers:
        1. Collect cpupower monitor output.
        2. Run ebizzy workload.
        3. Check if cpus have not entered idle states while running ebizzy.
        4. Wait till ebizzy stops.
        5. Check if cpus enters idle states.
        """

        tarball = self.fetch_asset('http://sourceforge.net/projects/ebizzy/'
                                   'files/ebizzy/0.3/ebizzy-0.3.tar.gz')
        archive.extract(tarball, self.workdir)
        self.sourcedir = os.path.join(self.workdir, 'ebizzy-0.3')
        os.chdir(self.sourcedir)
        process.run('./configure', shell=True)
        build.make(self.sourcedir)
        self.run_cmd_out("cpupower monitor")
        self.log.info("============ Starting ebizzy tests ==============")
        obj = process.SubProcess('./ebizzy -t 1000 -S 100 &',
                                 verbose=False,
                                 shell=True)
        obj.start()
        time.sleep(2)
        for i in range(self.states_tot - 1):
            zero_nonzero = self.check_zero_nonzero(i + 1)
            if zero_nonzero:
                self.fail("cpus entered idle states during ebizzy workload")
            self.log.info("no cpus entered idle states while running ebizzy")
        time.sleep(100)
        zero_nonzero = 0
        for i in range(self.states_tot - 1):
            zero_nonzero = zero_nonzero + self.check_zero_nonzero(i + 1)
        if not zero_nonzero:
            self.fail(
                "cpus have not entered idle states after killing ebizzy workload"
            )
        self.log.info("cpus have entered idle states after killing work load")
Beispiel #29
0
    def test(self):

        mgen = os.path.join(self.sourcedir, 'test/mgen/mgen')
        self.numa_pid = process.SubProcess('numatop -d result_file',
                                           shell=True)
        self.numa_pid.start()

        # Run mgen for 5 seconds to generate a single snapshot of numatop
        process.run('%s -a 0 -c %s -t 5' % (mgen, cpu.cpu_online_list()[0]),
                    shell=True,
                    sudo=True)

        # Kill numatop recording after running mgen
        self.numa_pid.terminate()

        # Analyse record file for mgen record
        with open('%s/result_file' % self.sourcedir, 'r') as f_read:
            lines = f_read.readlines()
            if 'PID' in lines[2]:
                if 'mgen' not in lines[3]:
                    self.fail(
                        'Numatop failed to record mgen latency. Please check '
                        'the record file: %s/result_file' % self.sourcedir)
Beispiel #30
0
 def boot_machine(self,
                  nspawn_add_option_list=[],
                  boot_cmd="",
                  wait_finish=False):
     """
     start machine via -b option (full boot, default) or 
     via boot_cmd (usefull with wait_finish=True option)
     
     :param nspawn_add_option_list: list - additional nspawn parameters 
     :param boot_cmd: std - command with aruments for starting
     :param wait_finish: - bool - wait to process finish (by default it just wait for creting systemd unit and boot)
     :return: process.Subprocess object 
     """
     self.logger.debug("starting NSPAWN")
     bootmachine = ""
     bootmachine_cmd = ""
     if boot_cmd:
         self.__alternative_boot = True
         bootmachine_cmd = boot_cmd
         process.run("systemctl reset-failed machine-%s.scope" % self.name,
                     ignore_status=True,
                     verbose=is_debug_low())
     else:
         bootmachine = "-b"
     command = "systemd-nspawn --machine=%s %s %s -D %s %s" % \
               (self.name, " ".join(nspawn_add_option_list), bootmachine, self.location, bootmachine_cmd)
     self.logger.debug("Start command: %s" % command)
     nspawncont = process.SubProcess(command)
     self.logger.info("machine: %s starting" % self.name)
     if wait_finish:
         nspawncont.wait()
     else:
         nspawncont.start()
         self.__is_booted()
     self.logger.info("machine: %s starting finished" % self.name)
     return nspawncont