Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
snf-ganeti
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
itminedu
snf-ganeti
Commits
73cd67f4
Commit
73cd67f4
authored
16 years ago
by
Guido Trotter
Browse files
Options
Downloads
Patches
Plain Diff
Xen: use utils.WriteFile for the instance configs
Also raise HypervisorError rather than OpExecError. Reviewed-by: iustinp
parent
78f66a17
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/hypervisor/hv_xen.py
+14
-16
14 additions, 16 deletions
lib/hypervisor/hv_xen.py
with
14 additions
and
16 deletions
lib/hypervisor/hv_xen.py
+
14
−
16
View file @
73cd67f4
...
@@ -458,14 +458,13 @@ class XenPvmHypervisor(XenHypervisor):
...
@@ -458,14 +458,13 @@ class XenPvmHypervisor(XenHypervisor):
# just in case it exists
# just in case it exists
utils
.
RemoveFile
(
"
/etc/xen/auto/%s
"
%
instance
.
name
)
utils
.
RemoveFile
(
"
/etc/xen/auto/%s
"
%
instance
.
name
)
try
:
try
:
f
=
open
(
"
/etc/xen/%s
"
%
instance
.
name
,
"
w
"
)
utils
.
WriteFile
(
"
/etc/xen/%s
"
%
instance
.
name
,
try
:
data
=
config
.
getvalue
())
f
.
write
(
config
.
getvalue
())
except
EnvironmentError
,
err
:
finally
:
raise
errors
.
HypervisorError
(
"
Cannot write Xen instance confile
"
f
.
close
()
"
file /etc/xen/%s: %s
"
%
except
IOError
,
err
:
(
instance
.
name
,
err
))
raise
errors
.
OpExecError
(
"
Cannot write Xen instance confile
"
"
file /etc/xen/%s: %s
"
%
(
instance
.
name
,
err
))
return
True
return
True
...
@@ -637,12 +636,11 @@ class XenHvmHypervisor(XenHypervisor):
...
@@ -637,12 +636,11 @@ class XenHvmHypervisor(XenHypervisor):
# just in case it exists
# just in case it exists
utils
.
RemoveFile
(
"
/etc/xen/auto/%s
"
%
instance
.
name
)
utils
.
RemoveFile
(
"
/etc/xen/auto/%s
"
%
instance
.
name
)
try
:
try
:
f
=
open
(
"
/etc/xen/%s
"
%
instance
.
name
,
"
w
"
)
utils
.
WriteFile
(
"
/etc/xen/%s
"
%
instance
.
name
,
try
:
data
=
config
.
getvalue
())
f
.
write
(
config
.
getvalue
())
except
EnvironmentError
,
err
:
finally
:
raise
errors
.
HypervisorError
(
"
Cannot write Xen instance confile
"
f
.
close
()
"
file /etc/xen/%s: %s
"
%
except
IOError
,
err
:
(
instance
.
name
,
err
))
raise
errors
.
OpExecError
(
"
Cannot write Xen instance confile
"
"
file /etc/xen/%s: %s
"
%
(
instance
.
name
,
err
))
return
True
return
True
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