Exemple #1
0
    def __init__(self):
        threading.Thread.__init__(self)
        self.setDaemon(True)
        self.xc = xc()

        self.lock = threading.Lock()
        
        # tracks the last polled statistics
        self._domain_vcpus = {}
        self._domain_vifs = {}
        self._domain_vbds = {}
        self.pifs = {}
        self.ovs = {}

        # instantaneous statistics
        self._domain_vcpus_util = {}
        self._domain_vifs_util = {}
        self._domain_vifs_stat = {}
        self._domain_vbds_util = {}
        self.pifs_util = {}
        self.ovs_util = {}
        
        self.pre_disk_stat = []
        self.cur_disk_stat = []
        self.host_disk_io_rate = []
Exemple #2
0
def getshadowmem(vm):
    "Balloon down domain0 to create free memory for shadow paging."
    maxmem = int(vm.dom['maxmem'])
    shadow = int(vm.dom['shadow_memory'])
    vcpus = int(vm.dom['vcpus'])

    # from XendDomainInfo.checkLiveMigrateMemory:
    # 1MB per vcpu plus 4Kib/Mib of RAM.  This is higher than
    # the minimum that Xen would allocate if no value were given.
    shadowneeded = vcpus * 1024 + maxmem * 4 - shadow * 1024
    physinfo = xc().physinfo()
    freemem = int(physinfo['free_memory'])
    needed = shadowneeded - freemem
    if needed > 0:
        print "Freeing %d kB for shadow mode" % needed
        dom0cur = osdep.lookup_balloon_stat('current')
        # target is in MB, not KB
        target = (dom0cur - needed) / 1024
        server.xend.domain.setMemoryTarget(0, target)
def getshadowmem(vm):
    "Balloon down domain0 to create free memory for shadow paging."
    maxmem = int(vm.dom['maxmem'])
    shadow = int(vm.dom['shadow_memory'])
    vcpus = int(vm.dom['vcpus'])

    # from XendDomainInfo.checkLiveMigrateMemory:
    # 1MB per vcpu plus 4Kib/Mib of RAM.  This is higher than
    # the minimum that Xen would allocate if no value were given.
    shadowneeded = vcpus * 1024 + maxmem * 4 - shadow * 1024
    physinfo = xc().physinfo()
    freemem = int(physinfo['free_memory'])
    needed = shadowneeded - freemem
    if needed > 0:
        print "Freeing %d kB for shadow mode" % needed
        dom0cur = osdep.lookup_balloon_stat('current')
        # target is in MB, not KB
        target = (dom0cur - needed) / 1024
        server.xend.domain.setMemoryTarget(0, target)
Exemple #4
0
    def __init__(self):
        threading.Thread.__init__(self)
        self.setDaemon(True)
        self.xc = xc()

        self.lock = threading.Lock()
        
        # tracks the last polled statistics
        self._domain_vcpus = {}
        self._domain_vifs = {}
        self._domain_vbds = {}
        self.pifs = {}

        # instantaneous statistics
        self._domain_vcpus_util = {}
        self._domain_vifs_util = {}
        self._domain_vifs_stat = {}
        self._domain_vbds_util = {}
        self.pifs_util = {}
Exemple #5
0
###
# XEN CLEAN INSTALLER
# Hardware discovery tools
#
# written by Andrew Peace

import constants
import xelogging
import util
import re
import os.path

import xen.lowlevel.xc as xc

XC = xc.xc()
PHYSINFO = XC.physinfo()
XENINFO = XC.xeninfo()

################################################################################
# Functions to get characteristics of the host.  Can work in a VM too, to aid
# with developer testing.


def VTSupportEnabled():
    """ Checks if VT support is present.  Uses /sys/hypervisor to do so,
    expecting a single line in this file with a space separated list of 
    capabilities. """
    f = open(constants.HYPERVISOR_CAPS_FILE, 'r')
    caps = ""
    try:
Exemple #6
0
print "===domInfo==="
dump(domInfo)

cpus = domInfo.getCpus()
print "===cpus==="
dump(cpus)

vms = xendDomainObj.get_all_vms()
print "==all vms=="
dump(vms)

print "==dom0=="
dom0 = vms[0]
dump(dom0.info['vcpus_params'])

xcobj = xc.xc()
print "===xeninfo==="
dump(xcobj.xeninfo())

print "===domain_getinfo==="
dump(xcobj.domain_getinfo())

print "===vcpu_getinfo==="
dump(xcobj.vcpu_getinfo(0))

exit(0)
print "===physinfo==="
dump(xcobj.physinfo())
print "===topologyinfo==="
dump(xcobj.topologyinfo())
print "===cpupool_getinfo==="