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

Hi Mohua,
-------- Original Message -------- Subject: [Users] How to approve the host to custom cluster instead the default cluster Date: Tue, 11 Dec 2012 15:22:43 +0800 From: Mohua Li <moli@redhat.com> To: users@ovirt.org
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
If you'll look at host.approve().__doc__, you will see: ''' @type Action: [@param action.cluster.id|name: string] [@param action.async: boolean] [@param action.grace_period.expiry: long] [@param correlation_id: any string] @return Response: ''' i.e you have to specify action.cluster.id|name in .approve() method.
Regards, Mohua Li
-- Michael Pasternak RedHat, ENG-Virtualization R&D

--Pd0ReVV5GZGQvF3a Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 11, 2012 at 11:23:18AM +0200, Michael Pasternak wrote:
Hi Mohua, =20
=20 -------- Original Message -------- Subject: [Users] How to approve the host to custom cluster instead the = default cluster Date: Tue, 11 Dec 2012 15:22:43 +0800 From: Mohua Li <moli@redhat.com> To: users@ovirt.org =20 Hi all, =20 In admin portal, when try to approve a host, need to select the cluster= first, but with rest api, =20 /*code*/ =20 try: api =3D API(url=3D"HOST", username=3D"USER", password=3D"PASS", ca_file=3D"ca.crt") h =3D api.hosts.get(name=3D"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 =20 above code will register to the default cluster, could you give me an e= xample how to register to the custom cluster instead the default? or i misunderstand some workflow, light = me pls, thanks =20 If you'll look at host.approve().__doc__, you will see: =20 ''' @type Action: =20 [@param action.cluster.id|name: string] [@param action.async: boolean] [@param action.grace_period.expiry: long] [@param correlation_id: any string] =20 @return Response: ''' =20 i.e you have to specify action.cluster.id|name in .approve() method.
thanks for the information
=20
=20 =20 =20 Regards, Mohua Li =20 =20 =20 =20 =20 =20 =20 --=20 =20 Michael Pasternak RedHat, ENG-Virtualization R&D
--=20 =E6=88=91=E5=8F=AA=E6=8B=85=E5=BF=83=E4=B8=80=E4=BB=B6=E4=BA=8B=EF=BC=8C=E6= =88=91=E6=80=95=E6=88=91=E9=85=8D=E4=B8=8D=E4=B8=8A=E6=88=91=E6=89=80=E9=81= =AD=E5=8F=97=E7=9A=84=E8=8B=A6=E9=9A=BE --Pd0ReVV5GZGQvF3a Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAEBAgAGBQJQxw1DAAoJEKa5n96c5rR6xWEIAM0IBPZS7csuPvl0Kek/i5PN GZOQfi77JUYrJLXKTLQWDHq9PujC9CJck4jnjCXb7Wvg/3oVbBlUxncQJUezjkNH LMpSbGJ7pcUTg9F/Et5X8IIcLniWnIe4tPkReS7UG/qn93ojZz6KaRMAn/c+nTaf SZoxx/DUhmEkp1XT1r64R5CiKQIwR2uMFMayI++8KJ/6/D9QEFMpU/9lUEoC1ngx vb2n/jaC7+41NV/Uia68nHdWTohbi7ZoUUcr8ms+27N1J7cEZDxWzh8ed4D8enyf Sa1UPqgAOaVcWvFThJkTgSy3sFydPNwSgSEkOmi4CIAeU2zBjXY7RI90BmyBtUg= =CpMd -----END PGP SIGNATURE----- --Pd0ReVV5GZGQvF3a--
participants (2)
-
Michael Pasternak
-
Mohua Li