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
052c6f7f
Commit
052c6f7f
authored
12 years ago
by
Anael Beutot
Browse files
Options
Downloads
Patches
Plain Diff
hypervisor.domains: use itertools instead of manual counters
parent
af6d3c81
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cloudcontrol/node/hypervisor/domains/__init__.py
+3
-7
3 additions, 7 deletions
cloudcontrol/node/hypervisor/domains/__init__.py
with
3 additions
and
7 deletions
cloudcontrol/node/hypervisor/domains/__init__.py
+
3
−
7
View file @
052c6f7f
...
...
@@ -21,6 +21,7 @@ import weakref
from
StringIO
import
StringIO
from
xml.etree
import
cElementTree
as
et
from
collections
import
namedtuple
from
itertools
import
izip
,
count
import
pyev
import
libvirt
...
...
@@ -64,8 +65,7 @@ class VirtualMachine(object):
#: http://libvirt.org/formatdomain.html#elementsDisks
self
.
cache_behaviour
=
dict
()
# define dynamic tags
i
=
0
for
v
in
self
.
iter_disks
():
for
i
,
v
in
izip
(
count
(),
self
.
iter_disks
()):
for
t
in
(
Tag
(
'
disk%s_size
'
%
i
,
v
.
capacity
,
10
),
Tag
(
'
disk%s_path
'
%
i
,
v
.
path
,
10
),
...
...
@@ -76,9 +76,7 @@ class VirtualMachine(object):
):
self
.
tags
[
t
.
name
]
=
t
i
+=
1
i
=
0
for
nic
in
self
.
iter_nics
():
for
i
,
nic
in
izip
(
count
(),
self
.
iter_nics
()):
for
t
in
(
Tag
(
'
nic%s_mac
'
%
i
,
nic
.
mac
),
Tag
(
'
nic%s_source
'
%
i
,
nic
.
source
),
...
...
@@ -86,8 +84,6 @@ class VirtualMachine(object):
):
self
.
tags
[
t
.
name
]
=
t
i
+=
1
#: keep record of CPU stats (libev timestamp, cpu time)
self
.
cpu_stats
=
(
hypervisor
.
handler
.
main
.
evloop
.
now
(),
dom
.
info
()[
4
])
...
...
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