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
55ad9722
authored
Mar 20, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated merge to handle base image saving
parent
7292c3e8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
disk.py
+11
-12
No files found.
disk.py
View file @
55ad9722
...
@@ -3,7 +3,7 @@ import os
...
@@ -3,7 +3,7 @@ import os
import
subprocess
import
subprocess
import
re
import
re
import
logging
import
logging
from
shutil
import
move
,
copyfileobj
from
shutil
import
move
,
copy
,
copy
fileobj
from
zipfile
import
ZipFile
,
is_zipfile
from
zipfile
import
ZipFile
,
is_zipfile
from
zlib
import
decompressobj
,
MAX_WBITS
from
zlib
import
decompressobj
,
MAX_WBITS
from
bz2
import
BZ2Decompressor
from
bz2
import
BZ2Decompressor
...
@@ -226,17 +226,16 @@ class Disk(object):
...
@@ -226,17 +226,16 @@ class Disk(object):
# Check if file already exists
# Check if file already exists
if
os
.
path
.
isfile
(
new_disk
.
get_path
()):
if
os
.
path
.
isfile
(
new_disk
.
get_path
()):
raise
Exception
(
'File already exists:
%
s'
%
self
.
get_path
())
raise
Exception
(
'File already exists:
%
s'
%
self
.
get_path
())
# Check if base file exist
if
self
.
base_name
:
if
not
os
.
path
.
isfile
(
self
.
get_base
()):
cmdline
=
[
'qemu-img'
,
raise
Exception
(
'Original image does not exists:
%
s'
'convert'
,
%
self
.
get_base
())
self
.
get_path
(),
cmdline
=
[
'qemu-img'
,
'-O'
,
new_disk
.
format
,
'convert'
,
new_disk
.
get_path
()]
self
.
get_path
(),
# Call subprocess
'-O'
,
new_disk
.
format
,
subprocess
.
check_output
(
cmdline
)
new_disk
.
get_path
()]
else
:
# Call subprocess
copy
(
self
.
get_path
(),
new_disk
.
get_path
())
subprocess
.
check_output
(
cmdline
)
def
delete
(
self
):
def
delete
(
self
):
''' Delete file
''' Delete file
...
...
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