Este contenido no está disponible en el idioma seleccionado.

2.9. Example: Approving a Host using Python


Red Hat Enterprise Virtualization Hypervisor hosts are added to the Red Hat Enterprise Virtualization Manager during their configuration. Once you have added a Hypervisor it requires approval in the Manager before it can actually be used in the environment.

Example 2.8. Approving a host using Python

This Python example calls the approve method for a host named Atlantic.
from ovirtsdk.api import API
from ovirtsdk.xml import params

try:
    api = API(url="https://HOST",
              username="USER@DOMAIN",
              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
Copy to Clipboard Toggle word wrap
If the approve request is successful then the script will output:
Host 'Atlantic' approved (Status: Up).
Copy to Clipboard Toggle word wrap
Note that the status reflects that the host has been approved and is now considered to be up.
Volver arriba
Red Hat logoGithubredditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

Theme

© 2025 Red Hat