Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cc-node
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
cc-node
Commits
dcc18468
Commit
dcc18468
authored
9 years ago
by
Antoine Millet
Browse files
Options
Downloads
Patches
Plain Diff
Now wrap volumes into a BoundVolumeProxy in guest iter_disks
parent
cb11bdda
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cloudcontrol/node/hypervisor/domains/__init__.py
+12
-4
12 additions, 4 deletions
cloudcontrol/node/hypervisor/domains/__init__.py
cloudcontrol/node/hypervisor/lib.py
+12
-0
12 additions, 0 deletions
cloudcontrol/node/hypervisor/lib.py
with
24 additions
and
4 deletions
cloudcontrol/node/hypervisor/domains/__init__.py
+
12
−
4
View file @
dcc18468
...
...
@@ -23,12 +23,13 @@ from StringIO import StringIO
from
xml.etree
import
cElementTree
as
et
from
collections
import
namedtuple
from
itertools
import
izip
,
count
from
functools
import
partial
import
pyev
import
libvirt
from
cloudcontrol.common.client.tags
import
Tag
,
tag_inspector
,
TagDB
from
cloudcontrol.node.hypervisor.lib
import
DOMAIN_STATES
as
STATE
from
cloudcontrol.node.hypervisor.lib
import
DOMAIN_STATES
as
STATE
,
BoundVolumeProxy
from
cloudcontrol.node.hypervisor.domains
import
vm_tags
from
cloudcontrol.node.utils
import
SocketBuffer
from
cloudcontrol.node.exc
import
ConsoleAlreadyOpened
,
ConsoleError
...
...
@@ -75,8 +76,10 @@ class VirtualMachine(object):
Tag
(
'
disk%s_path
'
%
i
,
v
.
path
,
10
),
Tag
(
'
disk%s_pool
'
%
i
,
v
.
storage
.
name
,
10
),
# FIXME: change
Tag
(
'
disk%s_vol
'
%
i
,
v
.
name
,
10
),
Tag
(
'
disk%s_cache
'
%
i
,
lambda
:
self
.
cache_behaviour
.
get
(
v
.
path
),
10
),
Tag
(
'
disk%s_shared
'
%
i
,
lambda
:
{
True
:
'
yes
'
,
False
:
'
no
'
}[
v
.
storage
.
is_shared
])
Tag
(
'
disk%s_cache
'
%
i
,
partial
(
lambda
x
:
self
.
cache_behaviour
.
get
(
x
.
path
),
v
),
10
),
Tag
(
'
disk%s_shared
'
%
i
,
partial
(
lambda
x
:
{
True
:
'
yes
'
,
False
:
'
no
'
}[
x
.
storage
.
is_shared
],
v
)),
Tag
(
'
disk%s_dev
'
%
i
,
v
.
device
,
10
),
Tag
(
'
disk%s_bus
'
%
i
,
v
.
bus
,
10
)
):
self
.
tag_db
.
add_tag
(
t
)
...
...
@@ -278,13 +281,18 @@ class VirtualMachine(object):
path
=
volume
.
path
# Get target device & bus
target
=
d
.
find
(
'
target
'
)
device
=
target
.
get
(
'
dev
'
)
bus
=
target
.
get
(
'
bus
'
)
# update cache behaviour
driver
=
d
.
find
(
'
driver
'
)
if
driver
is
None
:
driver
=
{}
self
.
cache_behaviour
[
path
]
=
driver
.
get
(
'
cache
'
,
'
default
'
)
yield
volume
yield
BoundVolumeProxy
(
volume
,
device
,
bus
)
@property
def
nics
(
self
):
...
...
This diff is collapsed.
Click to expand it.
cloudcontrol/node/hypervisor/lib.py
+
12
−
0
View file @
dcc18468
...
...
@@ -472,3 +472,15 @@ class Volume(object):
def
update
(
self
):
self
.
capacity
,
self
.
allocation
=
self
.
lv_volume
.
info
()[
1
:]
class
BoundVolumeProxy
(
object
):
"""
Proxy object to an existing Volume when its bound to a VM.
"""
def
__init__
(
self
,
volume
,
device
,
bus
):
self
.
volume
=
volume
self
.
device
=
device
self
.
bus
=
bus
def
__getattr__
(
self
,
name
):
return
self
.
volume
.
__getattribute__
(
name
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment