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
78659913
Commit
78659913
authored
9 years ago
by
Antoine Millet
Browse files
Options
Downloads
Patches
Plain Diff
Implemented title edition
parent
0b1ba886
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/__init__.py
+0
-28
0 additions, 28 deletions
cloudcontrol/node/hypervisor/__init__.py
cloudcontrol/node/hypervisor/domains/__init__.py
+19
-8
19 additions, 8 deletions
cloudcontrol/node/hypervisor/domains/__init__.py
with
19 additions
and
36 deletions
cloudcontrol/node/hypervisor/__init__.py
+
0
−
28
View file @
78659913
...
...
@@ -342,34 +342,6 @@ class Handler(HostHandler):
logger
.
error
(
msg
)
raise
UndefinedDomain
(
msg
)
@libvirt_handler
def
vm_reset
(
self
,
name
):
logger
.
debug
(
'
VM reset %s
'
,
name
)
try
:
self
.
hypervisor
.
domains
[
name
].
reset
()
except
libvirt
.
libvirtError
:
logger
.
exception
(
'
Error while resetting VM %s
'
,
name
)
raise
except
KeyError
:
msg
=
'
Cannot reset VM %s because it is not defined
'
%
name
logger
.
error
(
msg
)
raise
UndefinedDomain
(
msg
)
@libvirt_handler
def
vm_cycle
(
self
,
name
):
logger
.
debug
(
'
VM cycle %s
'
,
name
)
try
:
self
.
hypervisor
.
domains
[
name
].
destroy
()
time
.
sleep
(
1
)
self
.
hypervisor
.
domains
[
name
].
start
()
except
libvirt
.
libvirtError
:
logger
.
exception
(
'
Error while cycle VM %s
'
,
name
)
raise
except
KeyError
:
msg
=
'
Cannot cycle VM %s because it is not defined
'
%
name
logger
.
error
(
msg
)
raise
UndefinedDomain
(
msg
)
@libvirt_handler
def
vm_change_title
(
self
,
name
,
new_title
):
logger
.
debug
(
'
VM edit title %s
'
,
name
)
...
...
This diff is collapsed.
Click to expand it.
cloudcontrol/node/hypervisor/domains/__init__.py
+
19
−
8
View file @
78659913
...
...
@@ -61,14 +61,6 @@ class VirtualMachine(object):
self
.
uuid
=
dom
.
UUIDString
()
self
.
name
=
dom
.
name
()
# Get title of VM
try
:
self
.
title
=
dom
.
metadata
(
libvirt
.
VIR_DOMAIN_METADATA_TITLE
,
None
)
except
(
libvirt
.
libvirtError
,
AttributeError
):
# libvirtError handle the case where the title is not defined on the
# vm, AttributeError handle the case where the libvirt is too old
# to allow metadata handling
self
.
title
=
None
#: state of VM: started, stoped, paused
self
.
_state
=
STATE
[
dom
.
info
()[
0
]]
#: tags for this VM
...
...
@@ -125,6 +117,25 @@ class VirtualMachine(object):
self
.
tag_db
[
'
__main__
'
][
'
vncport
'
].
update_value
()
self
.
sync_description_tags
()
@property
def
title
(
self
):
try
:
return
self
.
lv_dom
.
metadata
(
libvirt
.
VIR_DOMAIN_METADATA_TITLE
,
None
)
except
(
libvirt
.
libvirtError
,
AttributeError
):
# libvirtError handle the case where the title is not defined on the
# vm, AttributeError handle the case where the libvirt is too old
# to allow metadata handling
return
None
@title.setter
def
title
(
self
,
value
):
try
:
self
.
lv_dom
.
setMetadata
(
libvirt
.
VIR_DOMAIN_METADATA_TITLE
,
value
,
None
,
None
)
except
AttributeError
:
raise
NotImplementedError
(
'
This hv doesn
\'
t handle VM titles
'
)
else
:
self
.
tag_db
[
'
__main__
'
][
'
t
'
].
update_value
()
@property
def
description
(
self
):
xml
=
self
.
lv_dom
.
XMLDesc
(
libvirt
.
VIR_DOMAIN_XML_INACTIVE
)
...
...
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