Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
vmdriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
2524baf1
authored
Jul 16, 2013
by
tarokkk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deleting old examples
parent
f338b66f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
74 deletions
+0
-74
test.py
+0
-59
xmltest.py
+0
-15
No files found.
test.py
deleted
100755 → 0
View file @
f338b66f
#!/usr/bin/env python
import
libvirt
import
sys
# Open libvirt connection (local)
connection
=
libvirt
.
open
(
None
)
# XML sample for testing
xml_sample
=
'''
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
<name>one-2273</name>
<vcpu>1</vcpu>
<cputune>
<shares>512</shares>
</cputune>
<memory>1048576</memory>
<os>
<type arch='x86_64'>hvm</type>
<boot dev='hd'/>
</os>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='file' device='disk'>
<source file='/datastore/0/2273/disk.0'/>
<target dev='vda'/>
<driver name='qemu' type='qcow2' cache='default'/>
</disk>
<disk type='file' device='cdrom'>
<source file='/datastore/0/2273/disk.1'/>
<target dev='hda'/>
<readonly/>
<driver name='qemu' type='raw'/>
</disk>
<interface type='bridge'>
<source bridge='cloud'/>
<mac address='02:00:0a:09:01:2d'/>
<model type='virtio'/>
</interface>
<graphics type='vnc' listen='0.0.0.0'
port='8173' passwd='usxdfmnkfk'/>
</devices>
<features>
<acpi/>
</features>
<cpu><topology sockets='1' cores='1' threads='1'/></cpu>
</domain>
'''
if
connection
is
None
:
print
"Fail to connect to libvirt daemon."
sys
.
exit
(
1
)
try
:
names
=
connection
.
listDefinedDomains
()
print
names
connection
.
defineXML
(
xml_sample
)
print
connection
.
listDefinedDomains
()
# conn.undefineXML()
except
:
print
"error"
xmltest.py
deleted
100755 → 0
View file @
f338b66f
import
xml.etree.ElementTree
as
ET
top
=
ET
.
Element
(
'domain'
,
attrib
=
{
'type'
:
'kvm'
,
'xmlns:qemu'
:
'http://libvirt.org/schemas/domain/qemu/1.0'
})
cpu
=
ET
.
SubElement
(
top
,
'cpu'
)
#vcpu =
#cputune =
#devices =
xml_dump
=
ET
.
tostring
(
top
)
print
xml_dump
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment