[Pacemaker] Announce: Making Resource Utilization Dynamic

Michael Schwartzkopff misch at clusterbau.com
Sat Jun 8 04:49:09 EDT 2013


Am Donnerstag, 6. Juni 2013, 14:08:26 schrieb Andrew Beekhof:
> On 06/06/2013, at 4:44 AM, Michael Schwartzkopff <misch at clusterbau.com> 
wrote:
> > Hi,
> > 
> > I was not satisfied with the situation that the utilization of resources
> > is static. This is not how real world resources behave. Especially
> > virtual guests in a clustered environment show daily load patterns. So I
> > thought it would be a good idea to make the utilization of resources
> > dynamic. I worte a small patch for the VirtualDomain resource agent that
> > updates the CPU utilization every time it monitors the resource.
> > 
> > Please read about the background in the following article:
> > 
> > http://www.sys4.de/de/blog/54/
> > 
> > 
> > Any comments?
> > Where can I send the patch to?
> 
> What patch :)
> I see a code fragment but no context.

Patch:

--- VirtualDomain.orig  2013-06-08 10:24:54.403863313 +0200
+++ VirtualDomain.new   2013-06-08 10:43:16.184253755 +0200
@@ -187,6 +187,15 @@
        dom_mem=$(LANG=C virsh $VIRSH_OPTIONS dominfo ${DOMAIN_NAME} | awk 
'/Max memory/{printf("%d", $3/1024)}')
        test -n "$dom_mem" && set_util_attr hv_memory "$dom_mem"
     fi
+
+    if [ -x /usr/bin/virt-top ]; then
+      CPUS=$(/usr/bin/virsh nodeinfo | awk '/CPU\(s/ {print $2}')
+      CPU_TICKS=$(/usr/bin/virt-top -n 2 -d 5 --stream | grep $DOMAIN_NAME | 
tail -1 | awk '{printf "%.0f",$7}')
+      OLD_TICKS=$(crm_resource -r $OCF_RESOURCE_INSTANCE -z -g ticks)
+      NEW_TICKS=$(((OLD_TICKS + CPU_TICKS * CPUS) / 2))
+      /usr/sbin/crm_resource -r $OCF_RESOURCE_INSTANCE -z -p ticks -v 
${NEW_TICKS}
+    fi
+
 }
 
 # Set options to be passed to virsh:

> Also, what does the resource/constraint config look like?

primitive resMyDomain ocf:heartbeat:VirtualDomain params config="..."

no constraints.

-- 
Dr. Michael Schwartzkopff
Guardinistr. 63
81375 München

Tel: (0163) 172 50 98
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clusterlabs.org/pipermail/pacemaker/attachments/20130608/edf4f749/attachment-0003.html>


More information about the Pacemaker mailing list