Created
September 9, 2013 07:14
-
-
Save herveleclerc/6492361 to your computer and use it in GitHub Desktop.
status: 500
reason: Internal Server Error
OVIRT PYTHON SDK 3.3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ovirt33.conf | |
[oVirt] | |
url: https://xxxxx | |
username: admin@internal | |
password: secret | |
insecure: 1 | |
dc_name: local_datacenter | |
cluster_name: local_cluster | |
storage_name: local_storage | |
export_name: exports | |
template_name: tpl-small-vm | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'hleclerc@cloud.alterway.fr' | |
from twisted.internet import task | |
from twisted.internet import reactor | |
from ovirtsdk.api import API | |
from ovirtsdk.infrastructure.errors import RequestError, ConnectionError | |
from ovirtsdk.xml import params | |
import time | |
import ConfigParser | |
import sys | |
VERSION = params.Version(major='3', minor='3') | |
config = ConfigParser.ConfigParser() | |
config.read('ovirt33.conf') | |
url = config.get('oVirt', 'url') | |
username = config.get('oVirt', 'username') | |
password = config.get('oVirt', 'password') | |
insecure = config.getint('oVirt', 'insecure') | |
DC_NAME = config.get('oVirt','dc_name') | |
CLUSTER_NAME = config.get('oVirt','cluster_name') | |
STORAGE_NAME = config.get('oVirt','storage_name') | |
EXPORT_NAME = config.get('oVirt','export_name') | |
TEMPLATE_NAME = config.get('oVirt','template_name') | |
try: | |
api=API(url=url,username=username,password=password,insecure=insecure) | |
except : | |
print "can't connect to oVirt server" | |
sys.exit(2) | |
try: | |
#vms=api.vms.list(cluster=api.clusters.get(CLUSTER_NAME)) | |
vms=api.vms.list(cluster='local_cluster') | |
except Exception as e: | |
print "fails\n %s " % str(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment