Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Łukasz Nowak
slapos
Commits
fec7ed10
Commit
fec7ed10
authored
Mar 17, 2022
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
squash! XXX kvm: Cover external-image-*
Skeletonize simulation of external_storage_list
parent
c57e76b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
software/kvm/test/test.py
software/kvm/test/test.py
+55
-0
No files found.
software/kvm/test/test.py
View file @
fec7ed10
...
...
@@ -1735,3 +1735,58 @@ class TestExternalDisk(InstanceTestCase, KvmMixin):
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
'default'
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'external-disk-amount'
:
2
,
'external-disk-size'
:
1
}
@
classmethod
def
_prepareExternalStorageList
(
cls
):
external_storage_path
=
os
.
path
.
join
(
cls
.
working_directory
,
'STORAGE'
)
os
.
mkdir
(
external_storage_path
)
for
partition
in
os
.
listdir
(
cls
.
slap
.
instance_directory
):
if
not
partition
.
startswith
(
cls
.
__partition_reference__
):
continue
partition_store_list
=
[]
for
number
in
range
(
10
):
storage
=
os
.
path
.
join
(
external_storage_path
,
'data%s'
%
(
number
,))
if
not
os
.
path
.
exists
(
storage
):
os
.
mkdir
(
storage
)
partition_store
=
os
.
path
.
join
(
storage
,
partition
)
os
.
mkdir
(
partition_store
)
partition_store_list
.
append
(
partition_store
)
with
open
(
os
.
path
.
join
(
cls
.
slap
.
instance_directory
,
partition
,
'.slapos-resource'
),
'w'
)
as
fh
:
json
.
dump
(
{
'external_storage_list'
:
partition_store_list
},
fh
,
indent
=
2
)
# above is not enough: the presence of parameter is required in slapos.cfg
with
open
(
cls
.
slap
.
_slapos_config
)
as
fh
:
slapos_config
=
fh
.
read
()
slapos_config
+=
'
\
n
'
+
"""
[slapos]
instance_storage_home = %s
"""
%
(
external_storage_path
,)
with
open
(
cls
.
slap
.
_slapos_config
,
'w'
)
as
fh
:
fh
.
write
(
slapos_config
)
@
classmethod
def
_setUpClass
(
cls
):
super
(
InstanceTestCase
,
cls
).
_setUpClass
()
cls
.
working_directory
=
tempfile
.
mkdtemp
()
# setup the external_storage_list, to mimic part of slapformat
cls
.
_prepareExternalStorageList
()
# re-run the instance, as information has been updated
cls
.
waitForInstance
()
@
classmethod
def
_tearDownClass
(
cls
):
super
(
InstanceTestCase
,
cls
).
_tearDownClass
()
shutil
.
rmtree
(
cls
.
working_directory
)
def
test
(
self
):
self
.
fail
(
'NOTIMPLEMENTED'
)
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