Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 635600 Details for
Bug 871481
Host connectivity can be lost when restoring backups
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
network addition python script using the ovirt/rhevm rest api.
create_networks.py (text/x-python), 4.65 KB, created by
Antoni Segura Puimedon
on 2012-10-30 13:59:30 UTC
(
hide
)
Description:
network addition python script using the ovirt/rhevm rest api.
Filename:
MIME Type:
Creator:
Antoni Segura Puimedon
Created:
2012-10-30 13:59:30 UTC
Size:
4.65 KB
patch
obsolete
>#!/usr/bin/env python > ># Set rhevm(engine) address, datacenter, cluster, host and nic ids to your own ># setup parameters and run it like so ./create_networks.py X ># where X is the amount of networks to create. ># To find out the data center, cluster, etc, I recommend using: ># curl -k -X GET -H "Accept: application/xml" -u admin@internal:foobar https://apuimedoengine/api/ ># and browsing through it. > > ># IMPORTANT: it requires requests lib. Install with easy_install or pip. > >import requests >import sys >import uuid >from xml.dom.minidom import parseString > >if len(sys.argv) == 2: > start, end = 0, int(sys.argv[1]) >elif len(sys.argv) == 3: > start, end = int(sys.argv[1]), int(sys.argv[2]) >else: > print 'Call it with one parameter for networks starting with 0.' > print 'Call it with two parameters for networks starting with the first and ending on the second.' > sys.exit(1) > >DATA_CENTER='a5531592-0710-11e2-ac49-525400a467ab' >CLUSTER='99408929-82cf-4dc7-a532-9d998063fa95' >HOST='65f0fa06-0722-11e2-9df0-525400a467ab' >NIC='b2d364c4-41d8-444c-8f93-257216947815' >RHEVM_ADDRESS='apuimedoengine' > >USER='admin@internal' >PASSWD='foobar' > >netConf = \ >"""<network id="%(uuid)s" href="/api/networks/%(uuid)s">"""\ > """<name>VLAN%(index)s</name>"""\ > """<data_center id="%(data_center)s" href="/api/datacenters/%(data_center)s"/>"""\ > """<vlan id="%(index)s"/>"""\ > """<stp>false</stp>"""\ > """<status>NON_OPERATIONAL</status>"""\ > """<display>false</display>"""\ >"""</network>""" > >clusConf = \ >"""<network id="%(uuid)s" href="/api/clusters/%(cluster)s/networks/%(uuid)s">"""\ > """<name>VLAN%(index)s</name>"""\ > """<data_center id="%(data_center)s" href="/api/datacenters/%(data_center)s"/>"""\ > """<cluster id="%(cluster)s" href="/api/clusters/%(cluster)s"/>"""\ > """<vlan id="%(index)s"/>"""\ > """<stp>false</stp>"""\ > """<status>OPERATIONAL</status>"""\ > """<display>false</display>"""\ >"""</network>""" > >attachConf = \ >"""<action>"""\ > """<network>"""\ > """<name>VLAN%s</name>"""\ > """</network>"""\ >"""</action>""" > >for i in range(start, end): > netUuid = uuid.uuid4() > net = netConf % {'uuid': netUuid, 'index': i, 'data_center': DATA_CENTER} > r = requests.post("https://%s/api/networks" % RHEVM_ADDRESS, data=net, > auth=(USER, PASSWD), headers={'content-type': 'application/xml'}, > verify=False) > if r.status_code != 201: # 201 means Created > print >> sys.stderr, "ERROR: Aborting." > print >> sys.stderr, 'Status: %d' % r.status_code > print >> sys.stderr, 'Xml response: %s' % r.text > print > sys.exit(-1) > print 'Status: %d' % r.status_code > print 'Xml response: %s' % r.text > print '' > print '###################################################################' > print '' > createdNet = parseString(r.text).childNodes[0] > createdUuid = createdNet.attributes['id'].value > > > clu = clusConf % {'cluster': CLUSTER, 'uuid': createdUuid, 'index': i, 'data_center': DATA_CENTER} > print '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>' > print clu > print '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<' > r = requests.post('https://%s/api/clusters/%s/networks' % (RHEVM_ADDRESS, CLUSTER), > data=clu, auth=(USER, PASSWD), > headers={'content-type': 'application/xml'}, > verify=False) > if r.status_code != 201: # 201 means Created > print >> sys.stderr, "ERROR: Aborting." > print >> sys.stderr, 'Status: %d' % r.status_code > print >> sys.stderr, 'Xml response: %s' % r.text > print > sys.exit(-1) > print 'Status: %d' % r.status_code > print 'Xml response: %s' % r.text > print '' > print '###################################################################' > print '' > > att = attachConf % i > print '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>' > print att > print '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<' > r = requests.post("https://%s/api/hosts/%s/nics/%s/attach" % (RHEVM_ADDRESS, HOST, NIC), > data=att, auth=(USER, PASSWD), > headers={'content-type': 'application/xml'}, > verify=False) > if r.status_code != 200: # 200 means OK > print >> sys.stderr, "ERROR: Aborting." > print >> sys.stderr, 'Status: %d' % r.status_code > print >> sys.stderr, 'Xml response: %s' % r.text > print > sys.exit(-1) > print 'Status: %d' % r.status_code > print 'Xml response: %s' % r.text > print '' > print '###################################################################' > print ''
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 871481
: 635600