#!/usr/bin/python
######################################
## Use to validate whether the
## passed in IP (argv1) is a pool
## slave.
##
## If called against a master,
## wrap a timeout around call.
## A timeout will occur as this
## script never really logs in to
## host - instead it just looks for
## error message indicating that the
## interrogated host is a slave
######################################
import sys
import XenAPI

ip_to_test=str(sys.argv[1])
session = XenAPI.Session('http://'+ip_to_test)

try:
	session.xenapi.login_with_password('root','')
except XenAPI.Failure, error:
	result = error.details

print (result[0])

