print'Unable to import the libvirt module. Is libvirt-python installed?'
sys.exit(1)
parser=argparse.ArgumentParser(description='Import Xen domain configuration into libvirt')
parser.add_argument('-c','--convert-only',help='Convert Xen domain configuration into libvirt domXML, but do not import into libvirt',action='store_true',dest='convert_only')
parser.add_argument('-r','--recursive',help='Operate recursivelly on all Xen domain configuration rooted at path',action='store_true')
parser.add_argument('-f','--format',help='Format of Xen domain configuration. Supported formats are xm and sexpr',choices=['xm','sexpr'],default=None)
parser.add_argument('-v','--verbose',help='Print information about the import process',action='store_true')
parser.add_argument('path',help='Path to Xen domain configuration')
defprint_verbose(msg):
ifargs.verbose:
printmsg
defcheck_config(path,config):
isbinary=os.system('file -b '+path+' | grep text > /dev/null')
ifisbinary:
print'File %s is not a text file containing Xen xm or sexpr configuration'