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
ff71ed5b
Commit
ff71ed5b
authored
12 years ago
by
Anael Beutot
Browse files
Options
Downloads
Patches
Plain Diff
Added a set autostart handler for VMs.
parent
4630407b
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/__init__.py
+13
-0
13 additions, 0 deletions
cloudcontrol/node/hypervisor/__init__.py
with
13 additions
and
0 deletions
cloudcontrol/node/hypervisor/__init__.py
+
13
−
0
View file @
ff71ed5b
...
...
@@ -144,6 +144,7 @@ class Handler(HostHandler):
self
.
main
.
reset_handler
(
'
vm_open_console
'
,
self
.
vm_open_console
)
self
.
main
.
reset_handler
(
'
vm_disable_virtio_cache
'
,
self
.
vm_disable_virtio_cache
)
self
.
main
.
reset_handler
(
'
vm_set_autostart
'
,
self
.
vm_set_autostart
)
# if everything went fine, unregister the timer
self
.
timer
.
stop
()
...
...
@@ -208,6 +209,7 @@ class Handler(HostHandler):
self
.
main
.
remove_handler
(
'
drbd_shutdown
'
)
self
.
main
.
remove_handler
(
'
vm_open_console
'
)
self
.
main
.
remove_handler
(
'
vm_disable_virtio_cache
'
)
self
.
main
.
remove_handler
(
'
vm_set_autostart
'
)
# launch connection timer
self
.
timer
.
start
()
...
...
@@ -546,6 +548,17 @@ class Handler(HostHandler):
logger
.
exception
(
'
Cannot update XML file for domain %s
'
,
name
)
raise
def
vm_set_autostart
(
self
,
name
,
autostart
=
True
):
"""
Set autostart on VM.
:param name: VM name
:param bool autostart: autostart value to set
"""
vm
=
self
.
hypervisor
.
domains
[
name
]
vm
.
lv_dom
.
setAutostart
(
int
(
bool
(
autostart
)))
# update autostart value now instead of 10 seconds lag
vm
.
tags
[
'
autostart
'
].
update_value
()
def
vol_create
(
self
,
pool
,
name
,
size
):
logger
.
debug
(
'
Volume create %s, pool %s, size %s
'
,
name
,
pool
,
size
)
try
:
...
...
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