Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import ovirtsdk4 as sdk
logging.basicConfig(level=logging.DEBUG, filename='example.log')
connection = sdk.Connection(
url='https://ovirt-43.virt/ovirt-engine/api',
username='admin@internal',
password='123456',
insecure=True,
debug=True,
log=logging.getLogger(),
)
network_name = 'ovirtmgmt'
# Get the root of the services tree:
system_service = connection.system_service()
# Get the list of external network providers
# that match the name that we want to use:
networks_service = system_service.networks_service()
network = next((
network for network in networks_service.list()
if network.name == network_name),
None)
network_service = networks_service.network_service(network.id)
network.stp = True
network_service.update(network)
# Close the connection to the server:
connection.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment