Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8940acd9
authored
Sep 02, 2013
by
tarokkk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deleting old vm.py
parent
43e810d2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
56 deletions
+0
-56
miscellaneous/vmdriver/vm.py
+0
-56
No files found.
miscellaneous/vmdriver/vm.py
deleted
100755 → 0
View file @
43e810d2
#!/usr/bin/env python
import
lxml.etree
as
ET
# VM Instance class
class
VMInstance
:
name
=
None
vcpu
=
None
cpu_share
=
None
memory_max
=
None
network_list
=
list
()
disk_list
=
list
()
context
=
dict
()
class
VMNetwork
:
''' Virtual Machine network representing class
name -- network device name
mac -- the MAC address of the quest interface
network_type -- need to be "ethernet" by default
model -- available models in libvirt
QoS -- CIRCLE QoS class?
script -- Executable network script /bin/true by default
'''
# Class attributes
name
=
None
network_type
=
None
mac
=
None
model
=
None
QoS
=
None
script_exec
=
'/bin/true'
def
__init__
(
self
,
name
,
mac
,
network_type
=
'ethernet'
,
model
=
'virtio'
,
QoS
=
None
):
self
.
name
=
name
self
.
network_type
=
network_type
self
.
mac
=
mac
self
.
model
=
model
self
.
QoS
=
QoS
# XML dump
def
dump_xml
(
self
):
xml_top
=
ET
.
Element
(
'interface'
,
attrib
=
{
'type'
:
self
.
network_type
})
ET
.
SubElement
(
xml_top
,
'target'
,
attrib
=
{
'dev'
:
self
.
name
})
ET
.
SubElement
(
xml_top
,
'mac'
,
attrib
=
{
'address'
:
self
.
mac
})
ET
.
SubElement
(
xml_top
,
'model'
,
attrib
=
{
'type'
:
self
.
model
})
ET
.
SubElement
(
xml_top
,
'script'
,
attrib
=
{
'path'
:
self
.
script_exec
})
return
ET
.
tostring
(
xml_top
,
encoding
=
'utf8'
,
method
=
'xml'
,
pretty_print
=
True
)
class
VMDisk
:
disk_type
=
None
disk_driver
=
None
source
=
None
target
=
None
a
=
VMNetwork
(
name
=
"vm-77"
,
mac
=
"010101"
)
print
a
.
dump_xml
()
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