There's a cron job which sends virtinfo to RHN every 2 minutes: /etc/cron.d/rhn-virtualization.cron 0-59/2 * * * * root python /usr/share/rhn/virtualization/poller.py But it currently handles libvirt VMs only, it should be modified like support.py was in bug 526371 Alternatively, could cron job be modified to run support.refresh() ? Version: rhn-virtualization-5.3.0-14.el5sat
(In reply to comment #0) > Alternatively, could cron job be modified to run support.refresh() ? proposed patch: --- scripts/rhn-virtualization.cron.orig 2009-06-16 18:28:14.000000000 +0200 +++ scripts/rhn-virtualization.cron 2009-12-21 10:55:37.000000000 +0100 @@ -1 +1 @@ -0-59/2 * * * * root python /usr/share/rhn/virtualization/poller.py +0-59/2 * * * * root python /usr/share/rhn/action/virt.py refresh &> /dev/null After that more issues/edge-cases where found when testing with VM created by VDSM test scripts (using vdsm-cli, *not* via RHEV-M console): * make localvdsm.py work with local VDSM w/o SSL --- virtualization/localvdsm.py.orig 2009-12-18 20:38:14.000000000 +0100 +++ virtualization/localvdsm.py 2009-12-21 11:01:06.000000000 +0100 @@ -40,8 +40,8 @@ def connect(): tsPath = getTrustStorePath() port = config.get('addresses', 'management_port') - addr = getLocalVdsName(tsPath) if tsPath: + addr = getLocalVdsName(tsPath) from M2Crypto.m2xmlrpclib import SSL_Transport from M2Crypto import SSL @@ -58,6 +58,7 @@ server = xmlrpclib.Server('https://%s:%s' % (addr, port), SSL_Transport(ctx)) else: + addr = 'localhost' server = xmlrpclib.Server('http://%s:%s' % (addr, port)) return server * handle exceptions in poller.py: KeyError: 'smp' default is -smp 1 if not specified (RHEV-M probably always specifies vcpu#) OverflowError: long int exceeds XML-RPC limits wrong conversion from strings, int('256'*1024) is large indeed --- virtualization/poller.py.orig 2009-12-18 20:06:38.000000000 +0100 +++ virtualization/poller.py 2009-12-21 11:21:40.000000000 +0100 @@ -161,14 +161,20 @@ virt_type = VirtualizationType.FULLY #Memory - memory = int(domain['memSize'] * 1024); + memory = int(domain['memSize']) * 1024 + + # vcpus + try: + vcpus = domain['smp'] + except: + vcpus = '1' properties = { PropertyType.NAME : domain['vmName'], PropertyType.UUID : uuid, PropertyType.TYPE : virt_type, PropertyType.MEMORY : memory, # current memory - PropertyType.VCPUS : domain['smp'], + PropertyType.VCPUS : vcpus, PropertyType.STATE : status} state[uuid] = properties * handle VDSM w/o VM running, otherwise it fails with libvirt exception: --- virtualization/support.py.orig 2009-12-18 20:06:38.000000000 +0100 +++ virtualization/support.py 2009-12-21 11:37:22.000000000 +0100 @@ -92,12 +92,12 @@ domains = poller.poll_through_vdsm() else: domains = poller.poll_hypervisor() + if not len(domains) and libvirt.open(None).getType() == 'Xen': + # On a KVM/QEMU host, libvirt reports no domain entry for host itself. + # On a Xen host, either there were no domains or xend might not be + # running. Don't proceed further. + return - if not len(domains) and libvirt.open(None).getType() == 'Xen': - # On a KVM/QEMU host, libvirt reports no domain entry for host itself. - # On a Xen host, either there were no domains or xend might not be - # running. Don't proceed further. - return domain_list = domains.values() domain_uuids = domains.keys()
Change title to reflect that more issues were found.
(In reply to comment #1) > (In reply to comment #0) > > Alternatively, could cron job be modified to run support.refresh() ? > > proposed patch: > > --- scripts/rhn-virtualization.cron.orig 2009-06-16 18:28:14.000000000 +0200 > +++ scripts/rhn-virtualization.cron 2009-12-21 10:55:37.000000000 +0100 > @@ -1 +1 @@ > -0-59/2 * * * * root python /usr/share/rhn/virtualization/poller.py > +0-59/2 * * * * root python /usr/share/rhn/action/virt.py refresh &> /dev/null This was NACKed by Milan: "Running virt.py refresh every two minutes would cause frequent spamming of RHN with client updates, soon resulting into 'Abuse of Service' being sent as a reply." So proper patch for poller.py needs to be done.
Created attachment 385362 [details] modification of previous patch with poller.py changes to work correctly with VDSM
spacewalk.git master: 0d6ee69617af7478159ee1b24e901bae8680f67f satellite.git SATELLITE-5.3: 970d19f8fa0e5173304fe22c253c4bfa39e172b7
poller.py will include host record in the virt. info refreshes: spacewalk.git master: 6e63208ef8dee9df453fa97c3813517770de1e02 satellite.git SATELLITE-5.3: 940353be676413e19fa249be535602e2e1aa7330
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2010-0100.html