def import_xva(args): xenhost = Server(args.host, args.xsuser, args.xspass) xenhost.disable_known_hosts = True if args.source_xva not in lib.xvas(xenhost): raise SystemExit('No xva found with name [{source_xva}]'.format( source_xva=args.source_xva)) if lib.no_vm_with_name(xenhost, args.target_vm): lib.import_xva(xenhost, args.source_xva, args.target_vm) else: raise SystemExit('VM [{target_vm}] already exists'.format( target_vm=args.target_vm))
def list_xvas(args): xenhost = Server(args.host, args.xsuser, args.xspass) xenhost.disable_known_hosts = True for name in lib.xvas(xenhost): print name