Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE3
/
storagedriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
af195c9a
authored
Sep 18, 2023
by
Karsa Zoltán István
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cluster size and metadata cache
parent
e52e3c02
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
disk.py
+5
-2
No files found.
disk.py
View file @
af195c9a
...
...
@@ -40,7 +40,7 @@ class Disk(object):
CREATE_FORMATS
=
[
'qcow2'
,
'raw'
]
def
__init__
(
self
,
dir
,
name
,
format
,
type
,
size
,
base_name
,
actual_size
=
0
,
cache_size
=
0
):
base_name
,
base_dir
=
None
,
actual_size
=
0
,
cluster_size
=
64
):
# TODO: tests
self
.
name
=
name
self
.
dir
=
os
.
path
.
realpath
(
dir
)
...
...
@@ -56,6 +56,8 @@ class Disk(object):
self
.
size
=
None
self
.
actual_size
=
actual_size
self
.
base_name
=
base_name
self
.
base_dir
=
base_dir
if
base_dir
is
not
None
else
self
.
dir
self
.
cluster_size
=
cluster_size
@property
def
checksum
(
self
,
blocksize
=
65536
):
...
...
@@ -94,7 +96,7 @@ class Disk(object):
def
get_base
(
self
):
"""Get absolute path for disk's base image."""
return
os
.
path
.
realpath
(
self
.
dir
+
'/'
+
self
.
base_name
)
return
os
.
path
.
realpath
(
self
.
base_
dir
+
'/'
+
self
.
base_name
)
def
__str__
(
self
):
return
'
%
s
%
s
%
s
%
s'
%
(
self
.
get_path
(),
self
.
format
,
...
...
@@ -169,6 +171,7 @@ class Disk(object):
cmdline
=
[
'qemu-img'
,
'create'
,
'-f'
,
self
.
format
,
'-o'
,
f
"cluster_size={int(self.cluster_size)}K"
,
self
.
get_path
(),
str
(
self
.
size
)]
logging
.
info
(
"Create file:
%
s "
%
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