Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running VMWare Server 2.0 on a Debian Lenny box that has two Opteron cores. I am wondering if there is a way to manually set the processor affinity so that Virtual Machines 1 & 2 get fired off of a single processor, and Virtual Machine #3 gets fired off of the other processor?

I understand that this is not a feature out of the box, but there might be a command line hack that could get me where I want to be :).

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You can set the affinities after the fact using taskset. I'd personally use a script that prioritizes or sets the CPU affinities the VMWare vmware-vmx processes. Drop it in cron hourly or have it run once. For instance, a typical VMWare Server 2.0 ps aux output looks like:

[root@xxxx ~]# ps auxwww| grep vmx
root     30372 24.9  1.1 2026132 137092 ? S<sl  2010 25896:06 /usr/lib/vmware/bin/vmware-vmx -# product=2;name=VMware Server;version=2.0.2;buildnumber=203138;licensename=VMware GSX Server for Linux;licenseversion=3.0 build-203138; -@ pipe=/tmp/vmhsdaemon-0/vmxd6074b323529c88a;readyEvent=40 /vmware/xxxx_Web/xxxx_Web.vmx

To set that to CPU core 2, I'd use something like:

#!/bin/bash

# Set CPU affinity for vmware-vmx processes to CPU core 2
for i in `pgrep -f vmware-vmx | xargs`; do taskset -c -p 1 $i; done

Or you can manually run taskset on the relevant PID(s).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.