Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
storagedriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f7949e20
authored
Sep 12, 2016
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disk: fix disk permission problem
parent
73dd2d63
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
disk.py
+6
-9
No files found.
disk.py
View file @
f7949e20
...
...
@@ -290,7 +290,8 @@ class Disk(object):
if
self
.
format
==
'iso'
or
self
.
format
==
'raw'
:
raise
NotImplemented
()
try
:
return
subprocess
.
check_output
(
cmdline
)
return
subprocess
.
check_output
(
[
'/bin/sudo'
,
'/usr/bin/qemu-img'
]
+
cmdline
)
except
subprocess
.
CalledProcessError
as
e
:
logger
.
error
(
e
)
raise
Exception
(
unicode
(
e
))
...
...
@@ -298,8 +299,7 @@ class Disk(object):
def
create_snapshot
(
self
,
snapshot_name
):
''' Creating qcow2 snapshot.
'''
cmdline
=
[
'qemu-img'
,
'snapshot'
,
cmdline
=
[
'snapshot'
,
'-c'
,
snapshot_name
,
self
.
get_path
()]
self
.
common_snapshot_operation
(
cmdline
)
...
...
@@ -307,8 +307,7 @@ class Disk(object):
def
list_snapshots
(
self
):
''' List qcow2 snapshot.
'''
cmdline
=
[
'qemu-img'
,
'info'
,
cmdline
=
[
'info'
,
'--output'
,
'json'
,
self
.
get_path
()]
output
=
self
.
common_snapshot_operation
(
cmdline
)
...
...
@@ -318,8 +317,7 @@ class Disk(object):
def
remove_snapshot
(
self
,
id
):
''' Remove qcow2 snapshot.
'''
cmdline
=
[
'qemu-img'
,
'snapshot'
,
cmdline
=
[
'snapshot'
,
'-d'
,
unicode
(
id
),
self
.
get_path
()]
self
.
common_snapshot_operation
(
cmdline
)
...
...
@@ -327,8 +325,7 @@ class Disk(object):
def
revert_snapshot
(
self
,
id
):
''' Revert qcow2 snapshot.
'''
cmdline
=
[
'qemu-img'
,
'snapshot'
,
cmdline
=
[
'snapshot'
,
'-a'
,
unicode
(
id
),
self
.
get_path
()]
self
.
common_snapshot_operation
(
cmdline
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment