Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
kamaki
Commits
092671b7
Commit
092671b7
authored
Jun 30, 2014
by
Stavros Sachtouris
Browse files
Move blockstorage commands to cli/cmds directory
Also, adjust to new "kamaki.cli" naming conventions
parent
f94fca55
Changes
1
Hide whitespace changes
Inline
Side-by-side
kamaki/cli/c
omman
ds/blockstorage.py
→
kamaki/cli/c
m
ds/blockstorage.py
View file @
092671b7
...
...
@@ -32,9 +32,9 @@
# or implied, of GRNET S.A.command
from
kamaki.cli
import
command
from
kamaki.cli.c
ommand_
tree
import
CommandTree
from
kamaki.cli.c
omman
ds
import
(
_c
ommand
_i
nit
,
errors
,
addLogSettings
,
_o
ptional
_json
)
from
kamaki.cli.c
md
tree
import
CommandTree
from
kamaki.cli.c
m
ds
import
(
C
ommand
I
nit
,
errors
,
client_log
,
O
ptional
Output
)
from
kamaki.clients.cyclades
import
CycladesBlockStorageClient
from
kamaki.cli
import
argument
...
...
@@ -45,9 +45,9 @@ namespaces = [volume_cmds, snapshot_cmds]
_commands
=
namespaces
class
_BlockStorageInit
(
_c
ommand
_i
nit
):
@
errors
.
g
eneric
.
all
@
addLogSettings
class
_BlockStorageInit
(
C
ommand
I
nit
):
@
errors
.
G
eneric
.
all
@
client_log
def
_run
(
self
):
self
.
client
=
self
.
get_client
(
CycladesBlockStorageClient
,
'volume'
)
...
...
@@ -56,7 +56,7 @@ class _BlockStorageInit(_command_init):
@
command
(
volume_cmds
)
class
volume_list
(
_BlockStorageInit
,
_o
ptional
_json
):
class
volume_list
(
_BlockStorageInit
,
O
ptional
Output
):
"""List volumes"""
arguments
=
dict
(
...
...
@@ -64,7 +64,7 @@ class volume_list(_BlockStorageInit, _optional_json):
'show detailed output'
,
(
'-l'
,
'--details'
)),
)
@
errors
.
g
eneric
.
all
@
errors
.
G
eneric
.
all
def
_run
(
self
):
self
.
_print
(
self
.
client
.
list_volumes
(
detail
=
self
[
'detail'
]))
...
...
@@ -74,10 +74,10 @@ class volume_list(_BlockStorageInit, _optional_json):
@
command
(
volume_cmds
)
class
volume_info
(
_BlockStorageInit
,
_o
ptional
_json
):
class
volume_info
(
_BlockStorageInit
,
O
ptional
Output
):
"""Get details about a volume"""
@
errors
.
g
eneric
.
all
@
errors
.
G
eneric
.
all
def
_run
(
self
,
volume_id
):
self
.
_print
(
self
.
client
.
get_volume_details
(
volume_id
),
self
.
print_dict
)
...
...
@@ -88,7 +88,7 @@ class volume_info(_BlockStorageInit, _optional_json):
@
command
(
volume_cmds
)
class
volume_create
(
_BlockStorageInit
,
_o
ptional
_json
):
class
volume_create
(
_BlockStorageInit
,
O
ptional
Output
):
"""Create a new volume"""
arguments
=
dict
(
...
...
@@ -113,7 +113,7 @@ class volume_create(_BlockStorageInit, _optional_json):
)
required
=
(
'size'
,
'server_id'
,
'name'
)
@
errors
.
g
eneric
.
all
@
errors
.
G
eneric
.
all
def
_run
(
self
,
size
,
server_id
,
name
):
self
.
_print
(
self
.
client
.
create_volume
(
...
...
@@ -134,8 +134,8 @@ class volume_create(_BlockStorageInit, _optional_json):
@
command
(
volume_cmds
)
class
volume_modify
(
_BlockStorageInit
,
_o
ptional
_json
):
"""Modify a volume
s
' properties"""
class
volume_modify
(
_BlockStorageInit
,
O
ptional
Output
):
"""Modify a volume'
s
properties"""
arguments
=
dict
(
name
=
argument
.
ValueArgument
(
'Rename'
,
'--name'
),
...
...
@@ -144,7 +144,7 @@ class volume_modify(_BlockStorageInit, _optional_json):
'Delete on termination'
,
'--delete-on-termination'
))
required
=
[
'name'
,
'description'
,
'delete_on_termination'
]
@
errors
.
g
eneric
.
all
@
errors
.
G
eneric
.
all
def
_run
(
self
,
volume_id
):
self
.
_print
(
self
.
client
.
update_volume
(
...
...
@@ -168,7 +168,7 @@ class volume_reassign(_BlockStorageInit):
)
required
=
(
'project_id'
,
)
@
errors
.
g
eneric
.
all
@
errors
.
G
eneric
.
all
def
_run
(
self
,
volume_id
,
project_id
):
self
.
client
.
reassign_volume
(
volume_id
,
project_id
)
...
...
@@ -181,7 +181,7 @@ class volume_reassign(_BlockStorageInit):
class
volume_delete
(
_BlockStorageInit
):
"""Delete a volume"""
@
errors
.
g
eneric
.
all
@
errors
.
G
eneric
.
all
def
_run
(
self
,
volume_id
):
self
.
client
.
delete_volume
(
volume_id
)
...
...
@@ -191,10 +191,10 @@ class volume_delete(_BlockStorageInit):
@
command
(
volume_cmds
)
class
volume_types
(
_BlockStorageInit
,
_o
ptional
_json
):
class
volume_types
(
_BlockStorageInit
,
O
ptional
Output
):
"""List volume types"""
@
errors
.
g
eneric
.
all
@
errors
.
G
eneric
.
all
def
_run
(
self
):
self
.
_print
(
self
.
client
.
list_volume_types
())
...
...
@@ -204,10 +204,10 @@ class volume_types(_BlockStorageInit, _optional_json):
@
command
(
volume_cmds
)
class
volume_type
(
_BlockStorageInit
,
_o
ptional
_json
):
class
volume_type
(
_BlockStorageInit
,
O
ptional
Output
):
"""Get volume type details"""
@
errors
.
g
eneric
.
all
@
errors
.
G
eneric
.
all
def
_run
(
self
,
volume_type_id
):
self
.
_print
(
self
.
client
.
get_volume_type_details
(
volume_type_id
),
...
...
@@ -219,7 +219,7 @@ class volume_type(_BlockStorageInit, _optional_json):
@
command
(
snapshot_cmds
)
class
snapshot_list
(
_BlockStorageInit
,
_o
ptional
_json
):
class
snapshot_list
(
_BlockStorageInit
,
O
ptional
Output
):
"""List snapshots"""
arguments
=
dict
(
...
...
@@ -227,7 +227,7 @@ class snapshot_list(_BlockStorageInit, _optional_json):
'show detailed output'
,
(
'-l'
,
'--details'
)),
)
@
errors
.
g
eneric
.
all
@
errors
.
G
eneric
.
all
def
_run
(
self
):
self
.
_print
(
self
.
client
.
list_snapshots
(
detail
=
self
[
'detail'
]))
...
...
@@ -237,10 +237,10 @@ class snapshot_list(_BlockStorageInit, _optional_json):
@
command
(
snapshot_cmds
)
class
snapshot_info
(
_BlockStorageInit
,
_o
ptional
_json
):
class
snapshot_info
(
_BlockStorageInit
,
O
ptional
Output
):
"""Get details about a snapshot"""
@
errors
.
g
eneric
.
all
@
errors
.
G
eneric
.
all
def
_run
(
self
,
snapshot_id
):
self
.
_print
(
self
.
client
.
get_snapshot_details
(
snapshot_id
),
self
.
print_dict
)
...
...
@@ -251,7 +251,7 @@ class snapshot_info(_BlockStorageInit, _optional_json):
@
command
(
snapshot_cmds
)
class
snapshot_create
(
_BlockStorageInit
,
_o
ptional
_json
):
class
snapshot_create
(
_BlockStorageInit
,
O
ptional
Output
):
"""Create a new snapshot"""
arguments
=
dict
(
...
...
@@ -263,7 +263,7 @@ class snapshot_create(_BlockStorageInit, _optional_json):
)
required
=
(
'volume_id'
,
'name'
)
@
errors
.
g
eneric
.
all
@
errors
.
G
eneric
.
all
def
_run
(
self
,
volume_id
,
name
):
self
.
_print
(
self
.
client
.
create_snapshot
(
...
...
@@ -277,8 +277,8 @@ class snapshot_create(_BlockStorageInit, _optional_json):
@
command
(
snapshot_cmds
)
class
snapshot_modify
(
_BlockStorageInit
,
_o
ptional
_json
):
"""Modify a snapshot
s
' properties"""
class
snapshot_modify
(
_BlockStorageInit
,
O
ptional
Output
):
"""Modify a snapshot'
s
properties"""
arguments
=
dict
(
name
=
argument
.
ValueArgument
(
'Rename'
,
'--name'
),
...
...
@@ -286,7 +286,7 @@ class snapshot_modify(_BlockStorageInit, _optional_json):
)
required
=
[
'name'
,
'description'
]
@
errors
.
g
eneric
.
all
@
errors
.
G
eneric
.
all
def
_run
(
self
,
snapshot_id
):
self
.
_print
(
self
.
client
.
update_snapshot
(
...
...
@@ -304,7 +304,7 @@ class snapshot_modify(_BlockStorageInit, _optional_json):
class
snapshot_delete
(
_BlockStorageInit
):
"""Delete a snapshot"""
@
errors
.
g
eneric
.
all
@
errors
.
G
eneric
.
all
def
_run
(
self
,
snapshot_id
):
self
.
client
.
delete_snapshot
(
snapshot_id
)
...
...
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