def _get_qemu_version(self):
        ret = shell.call('%s -version' % kvmagent.get_qemu_path())
        words = ret.split()
        for w in words:
            if w == 'version':
                return words[words.index(w)+1].strip()

        raise kvmagent.KvmError('cannot get qemu version[%s]' % ret)
    def _get_qemu_version(self):
        ret = shell.call('%s -version' % kvmagent.get_qemu_path())
        words = ret.split()
        for w in words:
            if w == 'version':
                return words[words.index(w)+1].strip()

        raise kvmagent.KvmError('cannot get qemu version[%s]' % ret)
    def _get_qemu_version(self):
        # to be compatible with both `2.6.0` and `2.9.0(qemu-kvm-ev-2.9.0-16.el7_4.8.1)`
        ret = shell.call('%s -version' % kvmagent.get_qemu_path())
        words = ret.split()
        for w in words:
            if w == 'version':
                return words[words.index(w) + 1].strip().split('(')[0]

        raise kvmagent.KvmError('cannot get qemu version[%s]' % ret)
    def _get_qemu_version(self):
        # to be compatible with both `2.6.0` and `2.9.0(qemu-kvm-ev-2.9.0-16.el7_4.8.1)`
        ret = shell.call('%s -version' % kvmagent.get_qemu_path())
        words = ret.split()
        for w in words:
            if w == 'version':
                return words[words.index(w)+1].strip().split('(')[0]

        raise kvmagent.KvmError('cannot get qemu version[%s]' % ret)
Beispiel #5
0
 def make_devices():
     root = elements['root']
     devices = e(root, 'devices')
     e(devices, 'emulator', kvmagent.get_qemu_path())
     e(devices, 'input', None, {'type': 'tablet', 'bus': 'usb'})
     elements['devices'] = devices
Beispiel #6
0
from kvmagent import kvmagent
from zstacklib.utils import http
from zstacklib.utils import jsonobject
from zstacklib.utils import lock
from zstacklib.utils import lvm
from zstacklib.utils import misc
from zstacklib.utils import thread
from zstacklib.utils.bash import *
from zstacklib.utils.ip import get_nic_supported_max_speed

logger = log.get_logger(__name__)
collector_dict = {}  # type: Dict[str, threading.Thread]
latest_collect_result = {}
collectResultLock = threading.RLock()
QEMU_CMD = kvmagent.get_qemu_path().split("/")[-1]

def read_number(fname):
    res = linux.read_file(fname)
    return 0 if not res else int(res)

def collect_host_network_statistics():

    all_eths = os.listdir("/sys/class/net/")
    virtual_eths = os.listdir("/sys/devices/virtual/net/")

    interfaces = []
    for eth in all_eths:
        eth = eth.strip(' \t\n\r')
        if eth in virtual_eths: continue
        if eth == 'bonding_masters':
Beispiel #7
0
 def make_devices():
     root = elements['root']
     devices = e(root, 'devices')
     e(devices, 'emulator', kvmagent.get_qemu_path())
     e(devices, 'input', None, {'type':'tablet', 'bus':'usb'})
     elements['devices'] = devices