Revision 4246a133 image_creator/util.py

b/image_creator/util.py
41 41
import hashlib
42 42
import time
43 43
import os
44
import re
44 45

  
45 46

  
46 47
class FatalError(Exception):
......
63 64
        return find_sbin_command(command, e)
64 65

  
65 66

  
67
def get_kvm_binary():
68
    """Returns the path to the kvm binary"""
69

  
70
    uname = get_command('uname')
71
    which = get_command('which')
72

  
73
    machine = str(uname('-m'))
74
    if re.match('i[3-6]86', machine):
75
        machine = 'i386'
76

  
77
    binary = which('qemu-system-%s' % machine)
78

  
79
    if binary is None:
80
        return which('kvm')
81

  
82
    return binary
83

  
84

  
66 85
def try_fail_repeat(command, *args):
67 86
    """Execute a command multiple times until it succeeds"""
68 87
    times = (0.1, 0.5, 1, 2)

Also available in: Unified diff