Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE3
/
vmdriver
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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
fe4837f7
authored
Jan 07, 2022
by
Kohl Krisztofer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First 3.6 version
parent
b6d5c41a
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
34 additions
and
33 deletions
+34
-33
docs/install-node.rst
+4
-6
miscellaneous/netcelery.conf
+3
-3
miscellaneous/netcelery@.service
+2
-1
miscellaneous/vmcelery.conf
+3
-3
miscellaneous/vmcelery@.service
+2
-1
netcelery.py
+2
-2
requirements/base.txt
+6
-6
tests/test.py
+3
-3
vmcelery.py
+3
-2
vmdriver.py
+6
-6
No files found.
docs/install-node.rst
View file @
fe4837f7
...
...
@@ -28,9 +28,8 @@ Configure Open vSwitch bridge that handle vitual connections::
Enable passwordless Open vSwitch commands::
$ sudo tee /etc/sudoers.d/netdriver <<END
cloud ALL = (ALL) NOPASSWD: /usr/bin/ovs-ofctl, /usr/bin/ovs-vsctl, /sbin/ip link set *
END
$ sudo tee /etc/sudoers.d/netdriver <<END cloud ALL = (ALL) NOPASSWD: /usr/bin/ovs-ofctl, /usr/bin/ovs-vsctl, /sbin/ip link set * END
$ sudo chmod 660 /etc/sudoers.d/netdriver
Configuring the libvirt daemon
...
...
@@ -76,7 +75,7 @@ Save configuration to virtualenv and activate environment::
export LIBVIRT_KEEPALIVE=True
export LIBVIRT_URI=test:///default
export AMQP_URI=amqp://cloud:password@$(hostname)/circle
export HYPERVISOR_TYPE=test
export HYPERVISOR_TYPE=test
END
Copy the libvrit bindings to the local virtualenv directory::
...
...
@@ -95,4 +94,4 @@ Copy the upstart scripts for celery services::
Start celery daemons::
$ sudo start vmcelery
$ sudo start netcelery
\ No newline at end of file
$ sudo start netcelery
miscellaneous/netcelery.conf
View file @
fe4837f7
...
...
@@ -8,8 +8,8 @@ setgid libvirtd
instance
$
NAME
script
cd
/
home
/
cloud
/
vmdriver
. /
home
/
cloud
/.
virtualenvs
/
vmdriver
/
local
/
bin
/
activate
. /
home
/
cloud
/.
virtualenvs
/
vmdriver
/
local
/
bin
/
postactivate
cd
/
home
/
kohlkriszto
/
Documents
/
vmdriver
. /
home
/
kohlkriszto
/
Documents
/
vmdriver_venv
/
bin
/
activate
. /
home
/
kohlkriszto
/
Documents
/
vmdriver_venv
/
bin
/
postactivate
exec
celery
-
A
netcelery
worker
--
loglevel
=
info
-
n
${
NAME
}
end
script
miscellaneous/netcelery@.service
View file @
fe4837f7
...
...
@@ -12,4 +12,5 @@ Restart=always
WorkingDirectory=/home/cloud/vmdriver
ExecStart=/bin/bash -c "source /etc/profile; workon vmdriver; exec celery -A netcelery worker --loglevel=info -n $(/bin/hostname -s).%I"
ExecStart=/bin/bash -c "source /home/cloud/.virtualenvs/vmdriver/bin/activate; source /home/cloud/.virtualenvs/vmdriver/bin/activate; exec celery -A netcelery worker --loglevel=info -n $(/bin/hostname -s).%I"
miscellaneous/vmcelery.conf
View file @
fe4837f7
...
...
@@ -8,8 +8,8 @@ setgid libvirtd
instance
$
NAME
script
cd
/
home
/
cloud
/
vmdriver
. /
home
/
cloud
/.
virtualenvs
/
vmdriver
/
local
/
bin
/
activate
. /
home
/
cloud
/.
virtualenvs
/
vmdriver
/
local
/
bin
/
postactivate
cd
/
home
/
kohlkriszto
/
Documents
/
vmdriver
. /
home
/
kohlkriszto
/
Documents
/
vmdriver_venv
/
bin
/
activate
. /
home
/
kohlkriszto
/
Documents
/
vmdriver_venv
/
bin
/
postactivate
exec
celery
-
A
vmcelery
worker
--
loglevel
=
info
-
n
$
NAME
end
script
miscellaneous/vmcelery@.service
View file @
fe4837f7
...
...
@@ -12,4 +12,5 @@ Restart=always
WorkingDirectory=/home/cloud/vmdriver
ExecStart=/bin/bash -c "source /etc/profile; workon vmdriver; exec celery -A vmcelery worker --loglevel=info -n $(/bin/hostname -s).%I"
ExecStart=/bin/bash -c "source /home/cloud/.virtualenvs/vmdriver/bin/activate; source /home/cloud/.virtualenvs/vmdriver/bin/activate; exec celery -A vmcelery worker --loglevel=info -n $(/bin/hostname -s).%I"
netcelery.py
View file @
fe4837f7
...
...
@@ -37,8 +37,8 @@ celery = Celery('netcelery',
include
=
[
'netdriver'
])
celery
.
conf
.
update
(
CELERY_RESULT_BACKEND
=
'amqp'
,
CELERY_TASK_RESULT_EXPIRES
=
300
,
CELERY_RESULT_BACKEND
=
'amqp
://
'
,
CELERY_TASK_RESULT_EXPIRES
=
300
000
,
CELERY_QUEUES
=
(
Queue
(
HOSTNAME
,
Exchange
(
'netdriver'
,
type
=
'direct'
),
routing_key
=
"netdriver"
),
...
...
requirements/base.txt
View file @
fe4837f7
celery
==3.1.17
decorator
==3.4.0
lxml
==3.4.2
psutil
==1.1.3
Pillow
==2.3.0
GitPython
==0.3.6
celery
decorator
lxml
psutil
Pillow
GitPython
tests/test.py
100755 → 100644
View file @
fe4837f7
...
...
@@ -26,12 +26,12 @@ vmdict = {
'graphics'
:
graphics
}
print
vm
.
VMNetwork
.
deserialize
(
netdict
)
.
dump_xml
(
)
print
vm
.
VMDisk
.
deserialize
(
diskdict
)
.
dump_xml
(
)
print
((
vm
.
VMNetwork
.
deserialize
(
netdict
)
.
dump_xml
())
)
print
((
vm
.
VMDisk
.
deserialize
(
diskdict
)
.
dump_xml
())
)
asd
=
vm
.
VMInstance
.
deserialize
(
vmdict
)
print
asd
.
dump_xml
(
)
print
((
asd
.
dump_xml
())
)
# Enable logging
# logging.basicConfig(filename='example.log', level=logging.DEBUG)
...
...
vmcelery.py
View file @
fe4837f7
""" Celery module for libvirt RPC calls. """
from
celery
import
Celery
from
kombu
import
Queue
,
Exchange
from
os
import
getenv
...
...
@@ -42,8 +43,8 @@ celery = Celery('vmcelery',
include
=
[
'vmdriver'
])
celery
.
conf
.
update
(
CELERY_RESULT_BACKEND
=
'amqp'
,
CELERY_TASK_RESULT_EXPIRES
=
300
,
CELERY_RESULT_BACKEND
=
'amqp
://
'
,
CELERY_TASK_RESULT_EXPIRES
=
300
000
,
CELERY_QUEUES
=
(
Queue
(
HOSTNAME
,
Exchange
(
'vmdriver'
,
type
=
'direct'
),
routing_key
=
"vmdriver"
),
...
...
vmdriver.py
View file @
fe4837f7
...
...
@@ -8,7 +8,7 @@ import json
from
decorator
import
decorator
import
lxml.etree
as
ET
from
psutil
import
NUM_CPUS
,
virtual_memory
,
cpu_percent
from
psutil
import
cpu_count
,
virtual_memory
,
cpu_percent
from
celery.contrib.abortable
import
AbortableTask
...
...
@@ -419,7 +419,7 @@ def node_info():
keys
=
[
'model'
,
'memory'
,
'cpus'
,
'mhz'
,
'nodes'
,
'sockets'
,
'cores'
,
'threads'
]
values
=
Connection
.
get
()
.
getInfo
()
return
dict
(
zip
(
keys
,
values
))
return
dict
(
list
(
zip
(
keys
,
values
)
))
def
_parse_info
(
values
):
...
...
@@ -430,7 +430,7 @@ def _parse_info(values):
"""
keys
=
[
'state'
,
'maxmem'
,
'memory'
,
'virtcpunum'
,
'cputime'
]
info
=
dict
(
zip
(
keys
,
values
))
info
=
dict
(
list
(
zip
(
keys
,
values
)
))
# Change state to proper ENUM
info
[
'state'
]
=
state_dict
[
info
[
'state'
]]
return
info
...
...
@@ -474,7 +474,7 @@ def network_info(name, network):
'tx_bytes'
,
'tx_packets'
,
'tx_errs'
,
'tx_drop'
]
dom
=
lookupByName
(
name
)
values
=
dom
.
interfaceStats
(
network
)
info
=
dict
(
zip
(
keys
,
values
))
info
=
dict
(
list
(
zip
(
keys
,
values
)
))
return
info
...
...
@@ -579,7 +579,7 @@ def __check_detach(domain, disk):
root
=
ET
.
fromstring
(
xml
)
devices
=
root
.
find
(
'devices'
)
for
d
in
devices
.
findall
(
"disk"
):
if
disk
in
d
.
find
(
'source'
)
.
attrib
.
values
(
)[
0
]:
if
disk
in
list
(
d
.
find
(
'source'
)
.
attrib
.
values
()
)[
0
]:
raise
Exception
(
"Disk could not been detached. "
"Check if hot plug support is "
"enabled (acpiphp module on Linux)."
)
...
...
@@ -631,7 +631,7 @@ def get_architecture():
@celery.task
def
get_core_num
():
return
NUM_CPUS
return
cpu_count
@celery.task
...
...
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