+
+class TestPoolQemu (TestPool):
+
+ def __init__ (self,pool,options):
+ TestPool.__init__(self,pool,options,"free qemu box")
+
+ def free_hostname (self, hostname):
+ return not TestPoolQemu.busy_qemu(hostname)
+
+ # is there a qemu runing on that box already ?
+ @staticmethod
+ def busy_qemu (hostname):
+ command="ssh -o ConnectTimeout=5 root@%s ps -e -o cmd"%hostname
+ (status,output) = commands.getstatusoutput(command)
+ # if we fail to run that, let's assume we don't have ssh access, so
+ # we pretend the box is busy
+ if status!=0:
+ return True
+ elif output.find("qemu") >=0 :
+ return True
+ else:
+ return False