Bug 548812 - rhn-virtualization needs to work with VDSM
Summary: rhn-virtualization needs to work with VDSM
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Virtualization
Version: 530
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Milan Zázrivec
QA Contact: Petr Sklenar
URL:
Whiteboard:
Depends On: 526371
Blocks: sat531-blockers 545222
TreeView+ depends on / blocked
 
Reported: 2009-12-18 17:56 UTC by Alan Pevec
Modified: 2016-04-27 02:31 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 526371
Environment:
Last Closed: 2010-02-11 09:31:45 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
modification of previous patch with poller.py changes to work correctly with VDSM (5.29 KB, patch)
2010-01-19 10:05 UTC, Milan Zázrivec
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2010:0100 0 normal SHIPPED_LIVE rhn-virtualization bug fix update 2010-02-11 09:31:42 UTC

Description Alan Pevec 2009-12-18 17:56:16 UTC
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

Comment 1 Alan Pevec 2009-12-21 10:40:45 UTC
(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()

Comment 2 Alan Pevec 2009-12-21 10:52:46 UTC
Change title to reflect that more issues were found.

Comment 3 Alan Pevec 2009-12-21 11:22:53 UTC
(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.

Comment 5 Milan Zázrivec 2010-01-19 10:05:59 UTC
Created attachment 385362 [details]
modification of previous patch with poller.py changes to work correctly with VDSM

Comment 6 Milan Zázrivec 2010-01-19 10:22:40 UTC
spacewalk.git master: 0d6ee69617af7478159ee1b24e901bae8680f67f
satellite.git SATELLITE-5.3: 970d19f8fa0e5173304fe22c253c4bfa39e172b7

Comment 17 Milan Zázrivec 2010-01-28 21:42:31 UTC
poller.py will include host record in the virt. info refreshes:

spacewalk.git master: 6e63208ef8dee9df453fa97c3813517770de1e02
satellite.git SATELLITE-5.3: 940353be676413e19fa249be535602e2e1aa7330

Comment 24 errata-xmlrpc 2010-02-11 09:31:45 UTC
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


Note You need to log in before you can comment on or make changes to this bug.