[Users] How to approve the host to custom cluster instead the default cluster

2012-12-11 Thread Mohua Li
Hi all,

In admin portal, when try to approve a host, need to select the cluster first, 
but with rest api,

/*code*/

try:
   api = API(url=HOST,
 username=USER,
 password=PASS,
 ca_file=ca.crt)
   h = api.hosts.get(name=Atlantic)
   if(h.approve()):
print Host '%s' approved (Status: %s). % (h.get_name(),
 h.get_status().get_state())
   else:
print Approval of '%s' failed. % h.get_name()
   api.disconnect()
except Exception as ex:
   print Unexpected error: %s % ex

above code will register to the default cluster, could you give me an example 
how to register to the custom 
cluster instead the default?  or i misunderstand some workflow,  light me pls, 
thanks



Regards,
Mohua Li




signature.asc
Description: Digital signature
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] How to approve the host to custom cluster instead the default cluster

2012-12-11 Thread Eli Mesika


- Original Message -
 From: Mohua Li m...@redhat.com
 To: users@ovirt.org
 Sent: Tuesday, December 11, 2012 9:22:43 AM
 Subject: [Users] How to approve the host to custom cluster instead the
 default cluster
 
 Hi all,
 
 In admin portal, when try to approve a host, need to select the
 cluster first, but with rest api,
 
 /*code*/
 
 try:
api = API(url=HOST,
  username=USER,
  password=PASS,
  ca_file=ca.crt)
h = api.hosts.get(name=Atlantic)
if(h.approve()):
 print Host '%s' approved (Status: %s). % (h.get_name(),
  h.get_status().get_state())
else:
 print Approval of '%s' failed. % h.get_name()
api.disconnect()
 except Exception as ex:
print Unexpected error: %s % ex
 
 above code will register to the default cluster, could you give me an
 example how to register to the custom
 cluster instead the default?  or i misunderstand some workflow,
  light me pls, thanks

CC Michael P

 
 
 
 Regards,
 Mohua Li
 
 
 
 ___
 Users mailing list
 Users@ovirt.org
 http://lists.ovirt.org/mailman/listinfo/users
 
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] How to approve the host to custom cluster instead the default cluster

2012-12-11 Thread Alex Jia
Hi Mohua,
The following link should be helpful for you(see add() of the class 
HostManager):

https://github.com/chuanchang/autotest/commit/1a59defaf1987d197d90b3e21bc518c78bfb4823

-- 
Regards, 
Alex


- Original Message -
From: Mohua Li m...@redhat.com
To: users@ovirt.org
Sent: Tuesday, December 11, 2012 3:22:43 PM
Subject: [Users] How to approve the host to custom cluster instead the  default 
cluster

Hi all,

In admin portal, when try to approve a host, need to select the cluster first, 
but with rest api,

/*code*/

try:
   api = API(url=HOST,
 username=USER,
 password=PASS,
 ca_file=ca.crt)
   h = api.hosts.get(name=Atlantic)
   if(h.approve()):
print Host '%s' approved (Status: %s). % (h.get_name(),
 h.get_status().get_state())
   else:
print Approval of '%s' failed. % h.get_name()
   api.disconnect()
except Exception as ex:
   print Unexpected error: %s % ex

above code will register to the default cluster, could you give me an example 
how to register to the custom 
cluster instead the default?  or i misunderstand some workflow,  light me pls, 
thanks



Regards,
Mohua Li



___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users