Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
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
fd8ddbfb
authored
Nov 23, 2018
by
Szabolcs Gelencsér
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
openstack_api: fix cinder
parent
8a625fe8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
84 deletions
+83
-84
circle/openstack_api/__init__.py
+1
-1
circle/openstack_api/cinder.py
+81
-82
circle/openstack_api/nova.py
+1
-1
No files found.
circle/openstack_api/__init__.py
View file @
fd8ddbfb
...
@@ -32,7 +32,7 @@ shouldn't need to understand the finer details of APIs for
...
@@ -32,7 +32,7 @@ shouldn't need to understand the finer details of APIs for
Keystone/Nova/Glance/Swift et. al.
Keystone/Nova/Glance/Swift et. al.
"""
"""
from
openstack_api
import
base
from
openstack_api
import
base
#
from openstack_api import cinder
from
openstack_api
import
cinder
from
openstack_api
import
glance
from
openstack_api
import
glance
# from openstack_api import keystone
# from openstack_api import keystone
# from openstack_api import network
# from openstack_api import network
...
...
circle/openstack_api/cinder.py
View file @
fd8ddbfb
...
@@ -31,15 +31,14 @@ from cinderclient import client as cinder_client
...
@@ -31,15 +31,14 @@ from cinderclient import client as cinder_client
from
cinderclient
import
exceptions
as
cinder_exception
from
cinderclient
import
exceptions
as
cinder_exception
from
cinderclient.v2.contrib
import
list_extensions
as
cinder_list_extensions
from
cinderclient.v2.contrib
import
list_extensions
as
cinder_list_extensions
from
horizon
import
exceptions
from
openstack_api
import
exceptions
from
horizon
.utils
import
functions
as
utils
from
openstack_api
.utils
import
functions
as
utils
from
horizon
.utils.memoized
import
memoized
from
openstack_api
.utils.memoized
import
memoized
from
horizon
.utils.memoized
import
memoized_with_request
from
openstack_api
.utils.memoized
import
memoized_with_request
from
openstack_dashboard.api
import
base
from
openstack_api
import
base
from
openstack_dashboard.api
import
microversions
from
openstack_api
import
microversions
from
openstack_dashboard.api
import
nova
from
openstack_api
import
nova
from
openstack_dashboard.contrib.developer.profiler
import
api
as
profiler
LOG
=
logging
.
getLogger
(
__name__
)
LOG
=
logging
.
getLogger
(
__name__
)
...
@@ -286,7 +285,7 @@ def update_pagination(entities, page_size, marker, sort_dir):
...
@@ -286,7 +285,7 @@ def update_pagination(entities, page_size, marker, sort_dir):
return
entities
,
has_more_data
,
has_prev_data
return
entities
,
has_more_data
,
has_prev_data
@profiler.trace
def
volume_list_paged
(
request
,
search_opts
=
None
,
marker
=
None
,
paginate
=
False
,
def
volume_list_paged
(
request
,
search_opts
=
None
,
marker
=
None
,
paginate
=
False
,
sort_dir
=
"desc"
):
sort_dir
=
"desc"
):
"""List volumes with pagination.
"""List volumes with pagination.
...
@@ -328,7 +327,7 @@ def volume_list_paged(request, search_opts=None, marker=None, paginate=False,
...
@@ -328,7 +327,7 @@ def volume_list_paged(request, search_opts=None, marker=None, paginate=False,
return
volumes
,
has_more_data
,
has_prev_data
return
volumes
,
has_more_data
,
has_prev_data
@profiler.trace
def
volume_get
(
request
,
volume_id
):
def
volume_get
(
request
,
volume_id
):
volume_data
=
cinderclient
(
request
)
.
volumes
.
get
(
volume_id
)
volume_data
=
cinderclient
(
request
)
.
volumes
.
get
(
volume_id
)
...
@@ -352,7 +351,7 @@ def volume_get(request, volume_id):
...
@@ -352,7 +351,7 @@ def volume_get(request, volume_id):
return
Volume
(
volume_data
)
return
Volume
(
volume_data
)
@profiler.trace
def
volume_create
(
request
,
size
,
name
,
description
,
volume_type
,
def
volume_create
(
request
,
size
,
name
,
description
,
volume_type
,
snapshot_id
=
None
,
metadata
=
None
,
image_id
=
None
,
snapshot_id
=
None
,
metadata
=
None
,
image_id
=
None
,
availability_zone
=
None
,
source_volid
=
None
):
availability_zone
=
None
,
source_volid
=
None
):
...
@@ -370,30 +369,30 @@ def volume_create(request, size, name, description, volume_type,
...
@@ -370,30 +369,30 @@ def volume_create(request, size, name, description, volume_type,
return
Volume
(
volume
)
return
Volume
(
volume
)
@profiler.trace
def
volume_extend
(
request
,
volume_id
,
new_size
):
def
volume_extend
(
request
,
volume_id
,
new_size
):
return
cinderclient
(
request
)
.
volumes
.
extend
(
volume_id
,
new_size
)
return
cinderclient
(
request
)
.
volumes
.
extend
(
volume_id
,
new_size
)
@profiler.trace
def
volume_delete
(
request
,
volume_id
):
def
volume_delete
(
request
,
volume_id
):
return
cinderclient
(
request
)
.
volumes
.
delete
(
volume_id
)
return
cinderclient
(
request
)
.
volumes
.
delete
(
volume_id
)
@profiler.trace
def
volume_retype
(
request
,
volume_id
,
new_type
,
migration_policy
):
def
volume_retype
(
request
,
volume_id
,
new_type
,
migration_policy
):
return
cinderclient
(
request
)
.
volumes
.
retype
(
volume_id
,
return
cinderclient
(
request
)
.
volumes
.
retype
(
volume_id
,
new_type
,
new_type
,
migration_policy
)
migration_policy
)
@profiler.trace
def
volume_set_bootable
(
request
,
volume_id
,
bootable
):
def
volume_set_bootable
(
request
,
volume_id
,
bootable
):
return
cinderclient
(
request
)
.
volumes
.
set_bootable
(
volume_id
,
return
cinderclient
(
request
)
.
volumes
.
set_bootable
(
volume_id
,
bootable
)
bootable
)
@profiler.trace
def
volume_update
(
request
,
volume_id
,
name
,
description
):
def
volume_update
(
request
,
volume_id
,
name
,
description
):
vol_data
=
{
'name'
:
name
,
vol_data
=
{
'name'
:
name
,
'description'
:
description
}
'description'
:
description
}
...
@@ -402,22 +401,22 @@ def volume_update(request, volume_id, name, description):
...
@@ -402,22 +401,22 @@ def volume_update(request, volume_id, name, description):
**
vol_data
)
**
vol_data
)
@profiler.trace
def
volume_set_metadata
(
request
,
volume_id
,
metadata
):
def
volume_set_metadata
(
request
,
volume_id
,
metadata
):
return
cinderclient
(
request
)
.
volumes
.
set_metadata
(
volume_id
,
metadata
)
return
cinderclient
(
request
)
.
volumes
.
set_metadata
(
volume_id
,
metadata
)
@profiler.trace
def
volume_delete_metadata
(
request
,
volume_id
,
keys
):
def
volume_delete_metadata
(
request
,
volume_id
,
keys
):
return
cinderclient
(
request
)
.
volumes
.
delete_metadata
(
volume_id
,
keys
)
return
cinderclient
(
request
)
.
volumes
.
delete_metadata
(
volume_id
,
keys
)
@profiler.trace
def
volume_reset_state
(
request
,
volume_id
,
state
):
def
volume_reset_state
(
request
,
volume_id
,
state
):
return
cinderclient
(
request
)
.
volumes
.
reset_state
(
volume_id
,
state
)
return
cinderclient
(
request
)
.
volumes
.
reset_state
(
volume_id
,
state
)
@profiler.trace
def
volume_upload_to_image
(
request
,
volume_id
,
force
,
image_name
,
def
volume_upload_to_image
(
request
,
volume_id
,
force
,
image_name
,
container_format
,
disk_format
):
container_format
,
disk_format
):
return
cinderclient
(
request
)
.
volumes
.
upload_to_image
(
volume_id
,
return
cinderclient
(
request
)
.
volumes
.
upload_to_image
(
volume_id
,
...
@@ -427,12 +426,12 @@ def volume_upload_to_image(request, volume_id, force, image_name,
...
@@ -427,12 +426,12 @@ def volume_upload_to_image(request, volume_id, force, image_name,
disk_format
)
disk_format
)
@profiler.trace
def
volume_get_encryption_metadata
(
request
,
volume_id
):
def
volume_get_encryption_metadata
(
request
,
volume_id
):
return
cinderclient
(
request
)
.
volumes
.
get_encryption_metadata
(
volume_id
)
return
cinderclient
(
request
)
.
volumes
.
get_encryption_metadata
(
volume_id
)
@profiler.trace
def
volume_migrate
(
request
,
volume_id
,
host
,
force_host_copy
=
False
,
def
volume_migrate
(
request
,
volume_id
,
host
,
force_host_copy
=
False
,
lock_volume
=
False
):
lock_volume
=
False
):
return
cinderclient
(
request
)
.
volumes
.
migrate_volume
(
volume_id
,
return
cinderclient
(
request
)
.
volumes
.
migrate_volume
(
volume_id
,
...
@@ -441,13 +440,13 @@ def volume_migrate(request, volume_id, host, force_host_copy=False,
...
@@ -441,13 +440,13 @@ def volume_migrate(request, volume_id, host, force_host_copy=False,
lock_volume
)
lock_volume
)
@profiler.trace
def
volume_snapshot_get
(
request
,
snapshot_id
):
def
volume_snapshot_get
(
request
,
snapshot_id
):
snapshot
=
cinderclient
(
request
)
.
volume_snapshots
.
get
(
snapshot_id
)
snapshot
=
cinderclient
(
request
)
.
volume_snapshots
.
get
(
snapshot_id
)
return
VolumeSnapshot
(
snapshot
)
return
VolumeSnapshot
(
snapshot
)
@profiler.trace
def
volume_snapshot_list
(
request
,
search_opts
=
None
):
def
volume_snapshot_list
(
request
,
search_opts
=
None
):
snapshots
,
_
,
__
=
volume_snapshot_list_paged
(
request
,
snapshots
,
_
,
__
=
volume_snapshot_list_paged
(
request
,
search_opts
=
search_opts
,
search_opts
=
search_opts
,
...
@@ -455,7 +454,7 @@ def volume_snapshot_list(request, search_opts=None):
...
@@ -455,7 +454,7 @@ def volume_snapshot_list(request, search_opts=None):
return
snapshots
return
snapshots
@profiler.trace
def
volume_snapshot_list_paged
(
request
,
search_opts
=
None
,
marker
=
None
,
def
volume_snapshot_list_paged
(
request
,
search_opts
=
None
,
marker
=
None
,
paginate
=
False
,
sort_dir
=
"desc"
):
paginate
=
False
,
sort_dir
=
"desc"
):
has_more_data
=
False
has_more_data
=
False
...
@@ -486,7 +485,7 @@ def volume_snapshot_list_paged(request, search_opts=None, marker=None,
...
@@ -486,7 +485,7 @@ def volume_snapshot_list_paged(request, search_opts=None, marker=None,
return
snapshots
,
has_more_data
,
has_prev_data
return
snapshots
,
has_more_data
,
has_prev_data
@profiler.trace
def
volume_snapshot_create
(
request
,
volume_id
,
name
,
def
volume_snapshot_create
(
request
,
volume_id
,
name
,
description
=
None
,
force
=
False
):
description
=
None
,
force
=
False
):
data
=
{
'name'
:
name
,
data
=
{
'name'
:
name
,
...
@@ -498,12 +497,12 @@ def volume_snapshot_create(request, volume_id, name,
...
@@ -498,12 +497,12 @@ def volume_snapshot_create(request, volume_id, name,
volume_id
,
**
data
))
volume_id
,
**
data
))
@profiler.trace
def
volume_snapshot_delete
(
request
,
snapshot_id
):
def
volume_snapshot_delete
(
request
,
snapshot_id
):
return
cinderclient
(
request
)
.
volume_snapshots
.
delete
(
snapshot_id
)
return
cinderclient
(
request
)
.
volume_snapshots
.
delete
(
snapshot_id
)
@profiler.trace
def
volume_snapshot_update
(
request
,
snapshot_id
,
name
,
description
):
def
volume_snapshot_update
(
request
,
snapshot_id
,
name
,
description
):
snapshot_data
=
{
'name'
:
name
,
snapshot_data
=
{
'name'
:
name
,
'description'
:
description
}
'description'
:
description
}
...
@@ -512,31 +511,31 @@ def volume_snapshot_update(request, snapshot_id, name, description):
...
@@ -512,31 +511,31 @@ def volume_snapshot_update(request, snapshot_id, name, description):
**
snapshot_data
)
**
snapshot_data
)
@profiler.trace
def
volume_snapshot_set_metadata
(
request
,
snapshot_id
,
metadata
):
def
volume_snapshot_set_metadata
(
request
,
snapshot_id
,
metadata
):
return
cinderclient
(
request
)
.
volume_snapshots
.
set_metadata
(
return
cinderclient
(
request
)
.
volume_snapshots
.
set_metadata
(
snapshot_id
,
metadata
)
snapshot_id
,
metadata
)
@profiler.trace
def
volume_snapshot_delete_metadata
(
request
,
snapshot_id
,
keys
):
def
volume_snapshot_delete_metadata
(
request
,
snapshot_id
,
keys
):
return
cinderclient
(
request
)
.
volume_snapshots
.
delete_metadata
(
return
cinderclient
(
request
)
.
volume_snapshots
.
delete_metadata
(
snapshot_id
,
keys
)
snapshot_id
,
keys
)
@profiler.trace
def
volume_snapshot_reset_state
(
request
,
snapshot_id
,
state
):
def
volume_snapshot_reset_state
(
request
,
snapshot_id
,
state
):
return
cinderclient
(
request
)
.
volume_snapshots
.
reset_state
(
return
cinderclient
(
request
)
.
volume_snapshots
.
reset_state
(
snapshot_id
,
state
)
snapshot_id
,
state
)
@profiler.trace
def
volume_cgroup_get
(
request
,
cgroup_id
):
def
volume_cgroup_get
(
request
,
cgroup_id
):
cgroup
=
cinderclient
(
request
)
.
consistencygroups
.
get
(
cgroup_id
)
cgroup
=
cinderclient
(
request
)
.
consistencygroups
.
get
(
cgroup_id
)
return
VolumeConsistencyGroup
(
cgroup
)
return
VolumeConsistencyGroup
(
cgroup
)
@profiler.trace
def
volume_cgroup_get_with_vol_type_names
(
request
,
cgroup_id
):
def
volume_cgroup_get_with_vol_type_names
(
request
,
cgroup_id
):
cgroup
=
volume_cgroup_get
(
request
,
cgroup_id
)
cgroup
=
volume_cgroup_get
(
request
,
cgroup_id
)
vol_types
=
volume_type_list
(
request
)
vol_types
=
volume_type_list
(
request
)
...
@@ -549,7 +548,7 @@ def volume_cgroup_get_with_vol_type_names(request, cgroup_id):
...
@@ -549,7 +548,7 @@ def volume_cgroup_get_with_vol_type_names(request, cgroup_id):
return
cgroup
return
cgroup
@profiler.trace
def
volume_cgroup_list
(
request
,
search_opts
=
None
):
def
volume_cgroup_list
(
request
,
search_opts
=
None
):
c_client
=
cinderclient
(
request
)
c_client
=
cinderclient
(
request
)
if
c_client
is
None
:
if
c_client
is
None
:
...
@@ -558,7 +557,7 @@ def volume_cgroup_list(request, search_opts=None):
...
@@ -558,7 +557,7 @@ def volume_cgroup_list(request, search_opts=None):
search_opts
=
search_opts
)]
search_opts
=
search_opts
)]
@profiler.trace
def
volume_cgroup_list_with_vol_type_names
(
request
,
search_opts
=
None
):
def
volume_cgroup_list_with_vol_type_names
(
request
,
search_opts
=
None
):
cgroups
=
volume_cgroup_list
(
request
,
search_opts
)
cgroups
=
volume_cgroup_list
(
request
,
search_opts
)
vol_types
=
volume_type_list
(
request
)
vol_types
=
volume_type_list
(
request
)
...
@@ -573,7 +572,7 @@ def volume_cgroup_list_with_vol_type_names(request, search_opts=None):
...
@@ -573,7 +572,7 @@ def volume_cgroup_list_with_vol_type_names(request, search_opts=None):
return
cgroups
return
cgroups
@profiler.trace
def
volume_cgroup_create
(
request
,
volume_types
,
name
,
def
volume_cgroup_create
(
request
,
volume_types
,
name
,
description
=
None
,
availability_zone
=
None
):
description
=
None
,
availability_zone
=
None
):
data
=
{
'name'
:
name
,
data
=
{
'name'
:
name
,
...
@@ -585,7 +584,7 @@ def volume_cgroup_create(request, volume_types, name,
...
@@ -585,7 +584,7 @@ def volume_cgroup_create(request, volume_types, name,
return
VolumeConsistencyGroup
(
cgroup
)
return
VolumeConsistencyGroup
(
cgroup
)
@profiler.trace
def
volume_cgroup_create_from_source
(
request
,
name
,
cg_snapshot_id
=
None
,
def
volume_cgroup_create_from_source
(
request
,
name
,
cg_snapshot_id
=
None
,
source_cgroup_id
=
None
,
source_cgroup_id
=
None
,
description
=
None
,
description
=
None
,
...
@@ -600,12 +599,12 @@ def volume_cgroup_create_from_source(request, name, cg_snapshot_id=None,
...
@@ -600,12 +599,12 @@ def volume_cgroup_create_from_source(request, name, cg_snapshot_id=None,
project_id
))
project_id
))
@profiler.trace
def
volume_cgroup_delete
(
request
,
cgroup_id
,
force
=
False
):
def
volume_cgroup_delete
(
request
,
cgroup_id
,
force
=
False
):
return
cinderclient
(
request
)
.
consistencygroups
.
delete
(
cgroup_id
,
force
)
return
cinderclient
(
request
)
.
consistencygroups
.
delete
(
cgroup_id
,
force
)
@profiler.trace
def
volume_cgroup_update
(
request
,
cgroup_id
,
name
=
None
,
description
=
None
,
def
volume_cgroup_update
(
request
,
cgroup_id
,
name
=
None
,
description
=
None
,
add_vols
=
None
,
remove_vols
=
None
):
add_vols
=
None
,
remove_vols
=
None
):
cgroup_data
=
{}
cgroup_data
=
{}
...
@@ -658,7 +657,7 @@ def volume_backup_supported(request):
...
@@ -658,7 +657,7 @@ def volume_backup_supported(request):
return
cinder_config
.
get
(
'enable_backup'
,
False
)
return
cinder_config
.
get
(
'enable_backup'
,
False
)
@profiler.trace
def
volume_backup_get
(
request
,
backup_id
):
def
volume_backup_get
(
request
,
backup_id
):
backup
=
cinderclient
(
request
)
.
backups
.
get
(
backup_id
)
backup
=
cinderclient
(
request
)
.
backups
.
get
(
backup_id
)
return
VolumeBackup
(
backup
)
return
VolumeBackup
(
backup
)
...
@@ -669,7 +668,7 @@ def volume_backup_list(request):
...
@@ -669,7 +668,7 @@ def volume_backup_list(request):
return
backups
return
backups
@profiler.trace
def
volume_backup_list_paged
(
request
,
marker
=
None
,
paginate
=
False
,
def
volume_backup_list_paged
(
request
,
marker
=
None
,
paginate
=
False
,
sort_dir
=
"desc"
):
sort_dir
=
"desc"
):
has_more_data
=
False
has_more_data
=
False
...
@@ -700,7 +699,7 @@ def volume_backup_list_paged(request, marker=None, paginate=False,
...
@@ -700,7 +699,7 @@ def volume_backup_list_paged(request, marker=None, paginate=False,
return
backups
,
has_more_data
,
has_prev_data
return
backups
,
has_more_data
,
has_prev_data
@profiler.trace
def
volume_backup_create
(
request
,
def
volume_backup_create
(
request
,
volume_id
,
volume_id
,
container_name
,
container_name
,
...
@@ -719,18 +718,18 @@ def volume_backup_create(request,
...
@@ -719,18 +718,18 @@ def volume_backup_create(request,
return
VolumeBackup
(
backup
)
return
VolumeBackup
(
backup
)
@profiler.trace
def
volume_backup_delete
(
request
,
backup_id
):
def
volume_backup_delete
(
request
,
backup_id
):
return
cinderclient
(
request
)
.
backups
.
delete
(
backup_id
)
return
cinderclient
(
request
)
.
backups
.
delete
(
backup_id
)
@profiler.trace
def
volume_backup_restore
(
request
,
backup_id
,
volume_id
):
def
volume_backup_restore
(
request
,
backup_id
,
volume_id
):
return
cinderclient
(
request
)
.
restores
.
restore
(
backup_id
=
backup_id
,
return
cinderclient
(
request
)
.
restores
.
restore
(
backup_id
=
backup_id
,
volume_id
=
volume_id
)
volume_id
=
volume_id
)
@profiler.trace
def
volume_manage
(
request
,
def
volume_manage
(
request
,
host
,
host
,
identifier
,
identifier
,
...
@@ -753,12 +752,12 @@ def volume_manage(request,
...
@@ -753,12 +752,12 @@ def volume_manage(request,
bootable
=
bootable
)
bootable
=
bootable
)
@profiler.trace
def
volume_unmanage
(
request
,
volume_id
):
def
volume_unmanage
(
request
,
volume_id
):
return
cinderclient
(
request
)
.
volumes
.
unmanage
(
volume
=
volume_id
)
return
cinderclient
(
request
)
.
volumes
.
unmanage
(
volume
=
volume_id
)
@profiler.trace
def
tenant_quota_get
(
request
,
tenant_id
):
def
tenant_quota_get
(
request
,
tenant_id
):
c_client
=
cinderclient
(
request
)
c_client
=
cinderclient
(
request
)
if
c_client
is
None
:
if
c_client
is
None
:
...
@@ -766,12 +765,12 @@ def tenant_quota_get(request, tenant_id):
...
@@ -766,12 +765,12 @@ def tenant_quota_get(request, tenant_id):
return
base
.
QuotaSet
(
c_client
.
quotas
.
get
(
tenant_id
))
return
base
.
QuotaSet
(
c_client
.
quotas
.
get
(
tenant_id
))
@profiler.trace
def
tenant_quota_update
(
request
,
tenant_id
,
**
kwargs
):
def
tenant_quota_update
(
request
,
tenant_id
,
**
kwargs
):
return
cinderclient
(
request
)
.
quotas
.
update
(
tenant_id
,
**
kwargs
)
return
cinderclient
(
request
)
.
quotas
.
update
(
tenant_id
,
**
kwargs
)
@profiler.trace
def
default_quota_get
(
request
,
tenant_id
):
def
default_quota_get
(
request
,
tenant_id
):
return
base
.
QuotaSet
(
cinderclient
(
request
)
.
quotas
.
defaults
(
tenant_id
))
return
base
.
QuotaSet
(
cinderclient
(
request
)
.
quotas
.
defaults
(
tenant_id
))
...
@@ -816,23 +815,23 @@ def volume_type_get_with_qos_association(request, volume_type_id):
...
@@ -816,23 +815,23 @@ def volume_type_get_with_qos_association(request, volume_type_id):
return
vol_type
return
vol_type
@profiler.trace
def
default_quota_update
(
request
,
**
kwargs
):
def
default_quota_update
(
request
,
**
kwargs
):
cinderclient
(
request
)
.
quota_classes
.
update
(
DEFAULT_QUOTA_NAME
,
**
kwargs
)
cinderclient
(
request
)
.
quota_classes
.
update
(
DEFAULT_QUOTA_NAME
,
**
kwargs
)
@profiler.trace
def
volume_type_list
(
request
):
def
volume_type_list
(
request
):
return
cinderclient
(
request
)
.
volume_types
.
list
()
return
cinderclient
(
request
)
.
volume_types
.
list
()
@profiler.trace
def
volume_type_create
(
request
,
name
,
description
=
None
,
is_public
=
True
):
def
volume_type_create
(
request
,
name
,
description
=
None
,
is_public
=
True
):
return
cinderclient
(
request
)
.
volume_types
.
create
(
name
,
description
,
return
cinderclient
(
request
)
.
volume_types
.
create
(
name
,
description
,
is_public
)
is_public
)
@profiler.trace
def
volume_type_update
(
request
,
volume_type_id
,
name
=
None
,
description
=
None
,
def
volume_type_update
(
request
,
volume_type_id
,
name
=
None
,
description
=
None
,
is_public
=
None
):
is_public
=
None
):
return
cinderclient
(
request
)
.
volume_types
.
update
(
volume_type_id
,
return
cinderclient
(
request
)
.
volume_types
.
update
(
volume_type_id
,
...
@@ -841,13 +840,13 @@ def volume_type_update(request, volume_type_id, name=None, description=None,
...
@@ -841,13 +840,13 @@ def volume_type_update(request, volume_type_id, name=None, description=None,
is_public
)
is_public
)
@profiler.trace
@memoized
@memoized
def
volume_type_default
(
request
):
def
volume_type_default
(
request
):
return
cinderclient
(
request
)
.
volume_types
.
default
()
return
cinderclient
(
request
)
.
volume_types
.
default
()
@profiler.trace
def
volume_type_delete
(
request
,
volume_type_id
):
def
volume_type_delete
(
request
,
volume_type_id
):
try
:
try
:
return
cinderclient
(
request
)
.
volume_types
.
delete
(
volume_type_id
)
return
cinderclient
(
request
)
.
volume_types
.
delete
(
volume_type_id
)
...
@@ -856,39 +855,39 @@ def volume_type_delete(request, volume_type_id):
...
@@ -856,39 +855,39 @@ def volume_type_delete(request, volume_type_id):
"This volume type is used by one or more volumes."
))
"This volume type is used by one or more volumes."
))
@profiler.trace
def
volume_type_get
(
request
,
volume_type_id
):
def
volume_type_get
(
request
,
volume_type_id
):
return
cinderclient
(
request
)
.
volume_types
.
get
(
volume_type_id
)
return
cinderclient
(
request
)
.
volume_types
.
get
(
volume_type_id
)
@profiler.trace
def
volume_encryption_type_create
(
request
,
volume_type_id
,
data
):
def
volume_encryption_type_create
(
request
,
volume_type_id
,
data
):
return
cinderclient
(
request
)
.
volume_encryption_types
.
create
(
volume_type_id
,
return
cinderclient
(
request
)
.
volume_encryption_types
.
create
(
volume_type_id
,
specs
=
data
)
specs
=
data
)
@profiler.trace
def
volume_encryption_type_delete
(
request
,
volume_type_id
):
def
volume_encryption_type_delete
(
request
,
volume_type_id
):
return
cinderclient
(
request
)
.
volume_encryption_types
.
delete
(
volume_type_id
)
return
cinderclient
(
request
)
.
volume_encryption_types
.
delete
(
volume_type_id
)
@profiler.trace
def
volume_encryption_type_get
(
request
,
volume_type_id
):
def
volume_encryption_type_get
(
request
,
volume_type_id
):
return
cinderclient
(
request
)
.
volume_encryption_types
.
get
(
volume_type_id
)
return
cinderclient
(
request
)
.
volume_encryption_types
.
get
(
volume_type_id
)
@profiler.trace
def
volume_encryption_type_list
(
request
):
def
volume_encryption_type_list
(
request
):
return
cinderclient
(
request
)
.
volume_encryption_types
.
list
()
return
cinderclient
(
request
)
.
volume_encryption_types
.
list
()
@profiler.trace
def
volume_encryption_type_update
(
request
,
volume_type_id
,
data
):
def
volume_encryption_type_update
(
request
,
volume_type_id
,
data
):
return
cinderclient
(
request
)
.
volume_encryption_types
.
update
(
volume_type_id
,
return
cinderclient
(
request
)
.
volume_encryption_types
.
update
(
volume_type_id
,
specs
=
data
)
specs
=
data
)
@profiler.trace
def
volume_type_extra_get
(
request
,
type_id
,
raw
=
False
):
def
volume_type_extra_get
(
request
,
type_id
,
raw
=
False
):
vol_type
=
volume_type_get
(
request
,
type_id
)
vol_type
=
volume_type_get
(
request
,
type_id
)
extras
=
vol_type
.
get_keys
()
extras
=
vol_type
.
get_keys
()
...
@@ -910,22 +909,22 @@ def volume_type_extra_delete(request, type_id, keys):
...
@@ -910,22 +909,22 @@ def volume_type_extra_delete(request, type_id, keys):
return
vol_type
.
unset_keys
(
keys
)
return
vol_type
.
unset_keys
(
keys
)
@profiler.trace
def
qos_spec_list
(
request
):
def
qos_spec_list
(
request
):
return
cinderclient
(
request
)
.
qos_specs
.
list
()
return
cinderclient
(
request
)
.
qos_specs
.
list
()
@profiler.trace
def
qos_spec_get
(
request
,
qos_spec_id
):
def
qos_spec_get
(
request
,
qos_spec_id
):
return
cinderclient
(
request
)
.
qos_specs
.
get
(
qos_spec_id
)
return
cinderclient
(
request
)
.
qos_specs
.
get
(
qos_spec_id
)
@profiler.trace
def
qos_spec_delete
(
request
,
qos_spec_id
):
def
qos_spec_delete
(
request
,
qos_spec_id
):
return
cinderclient
(
request
)
.
qos_specs
.
delete
(
qos_spec_id
,
force
=
True
)
return
cinderclient
(
request
)
.
qos_specs
.
delete
(
qos_spec_id
,
force
=
True
)
@profiler.trace
def
qos_spec_create
(
request
,
name
,
specs
):
def
qos_spec_create
(
request
,
name
,
specs
):
return
cinderclient
(
request
)
.
qos_specs
.
create
(
name
,
specs
)
return
cinderclient
(
request
)
.
qos_specs
.
create
(
name
,
specs
)
...
@@ -939,27 +938,27 @@ def qos_spec_get_keys(request, qos_spec_id, raw=False):
...
@@ -939,27 +938,27 @@ def qos_spec_get_keys(request, qos_spec_id, raw=False):
key
,
value
in
qos_specs
.
items
()]
key
,
value
in
qos_specs
.
items
()]
@profiler.trace
def
qos_spec_set_keys
(
request
,
qos_spec_id
,
specs
):
def
qos_spec_set_keys
(
request
,
qos_spec_id
,
specs
):
return
cinderclient
(
request
)
.
qos_specs
.
set_keys
(
qos_spec_id
,
specs
)
return
cinderclient
(
request
)
.
qos_specs
.
set_keys
(
qos_spec_id
,
specs
)
@profiler.trace
def
qos_spec_unset_keys
(
request
,
qos_spec_id
,
specs
):
def
qos_spec_unset_keys
(
request
,
qos_spec_id
,
specs
):
return
cinderclient
(
request
)
.
qos_specs
.
unset_keys
(
qos_spec_id
,
specs
)
return
cinderclient
(
request
)
.
qos_specs
.
unset_keys
(
qos_spec_id
,
specs
)
@profiler.trace
def
qos_spec_associate
(
request
,
qos_specs
,
vol_type_id
):
def
qos_spec_associate
(
request
,
qos_specs
,
vol_type_id
):
return
cinderclient
(
request
)
.
qos_specs
.
associate
(
qos_specs
,
vol_type_id
)
return
cinderclient
(
request
)
.
qos_specs
.
associate
(
qos_specs
,
vol_type_id
)
@profiler.trace
def
qos_spec_disassociate
(
request
,
qos_specs
,
vol_type_id
):
def
qos_spec_disassociate
(
request
,
qos_specs
,
vol_type_id
):
return
cinderclient
(
request
)
.
qos_specs
.
disassociate
(
qos_specs
,
vol_type_id
)
return
cinderclient
(
request
)
.
qos_specs
.
disassociate
(
qos_specs
,
vol_type_id
)
@profiler.trace
def
qos_spec_get_associations
(
request
,
qos_spec_id
):
def
qos_spec_get_associations
(
request
,
qos_spec_id
):
return
cinderclient
(
request
)
.
qos_specs
.
get_associations
(
qos_spec_id
)
return
cinderclient
(
request
)
.
qos_specs
.
get_associations
(
qos_spec_id
)
...
@@ -968,7 +967,7 @@ def qos_specs_list(request):
...
@@ -968,7 +967,7 @@ def qos_specs_list(request):
return
[
QosSpecs
(
s
)
for
s
in
qos_spec_list
(
request
)]
return
[
QosSpecs
(
s
)
for
s
in
qos_spec_list
(
request
)]
@profiler.trace
@memoized
@memoized
def
tenant_absolute_limits
(
request
,
tenant_id
=
None
):
def
tenant_absolute_limits
(
request
,
tenant_id
=
None
):
limits
=
cinderclient
(
request
)
.
limits
.
get
(
tenant_id
=
tenant_id
)
.
absolute
limits
=
cinderclient
(
request
)
.
limits
.
get
(
tenant_id
=
tenant_id
)
.
absolute
...
@@ -989,17 +988,17 @@ def tenant_absolute_limits(request, tenant_id=None):
...
@@ -989,17 +988,17 @@ def tenant_absolute_limits(request, tenant_id=None):
return
limits_dict
return
limits_dict
@profiler.trace
def
service_list
(
request
):
def
service_list
(
request
):
return
cinderclient
(
request
)
.
services
.
list
()
return
cinderclient
(
request
)
.
services
.
list
()
@profiler.trace
def
availability_zone_list
(
request
,
detailed
=
False
):
def
availability_zone_list
(
request
,
detailed
=
False
):
return
cinderclient
(
request
)
.
availability_zones
.
list
(
detailed
=
detailed
)
return
cinderclient
(
request
)
.
availability_zones
.
list
(
detailed
=
detailed
)
@profiler.trace
@memoized_with_request
(
cinderclient
)
@memoized_with_request
(
cinderclient
)
def
list_extensions
(
cinder_api
):
def
list_extensions
(
cinder_api
):
return
tuple
(
cinder_list_extensions
.
ListExtManager
(
cinder_api
)
.
show_all
())
return
tuple
(
cinder_list_extensions
.
ListExtManager
(
cinder_api
)
.
show_all
())
...
@@ -1014,7 +1013,7 @@ def extension_supported(extensions, extension_name):
...
@@ -1014,7 +1013,7 @@ def extension_supported(extensions, extension_name):
return
False
return
False
@profiler.trace
def
transfer_list
(
request
,
detailed
=
True
,
search_opts
=
None
):
def
transfer_list
(
request
,
detailed
=
True
,
search_opts
=
None
):
"""List volume transfers.
"""List volume transfers.
...
@@ -1030,29 +1029,29 @@ def transfer_list(request, detailed=True, search_opts=None):
...
@@ -1030,29 +1029,29 @@ def transfer_list(request, detailed=True, search_opts=None):
return
[]
return
[]
@profiler.trace
def
transfer_get
(
request
,
transfer_id
):
def
transfer_get
(
request
,
transfer_id
):
transfer_data
=
cinderclient
(
request
)
.
transfers
.
get
(
transfer_id
)
transfer_data
=
cinderclient
(
request
)
.
transfers
.
get
(
transfer_id
)
return
VolumeTransfer
(
transfer_data
)
return
VolumeTransfer
(
transfer_data
)
@profiler.trace
def
transfer_create
(
request
,
transfer_id
,
name
):
def
transfer_create
(
request
,
transfer_id
,
name
):
volume
=
cinderclient
(
request
)
.
transfers
.
create
(
transfer_id
,
name
)
volume
=
cinderclient
(
request
)
.
transfers
.
create
(
transfer_id
,
name
)
return
VolumeTransfer
(
volume
)
return
VolumeTransfer
(
volume
)
@profiler.trace
def
transfer_accept
(
request
,
transfer_id
,
auth_key
):
def
transfer_accept
(
request
,
transfer_id
,
auth_key
):
return
cinderclient
(
request
)
.
transfers
.
accept
(
transfer_id
,
auth_key
)
return
cinderclient
(
request
)
.
transfers
.
accept
(
transfer_id
,
auth_key
)
@profiler.trace
def
transfer_delete
(
request
,
transfer_id
):
def
transfer_delete
(
request
,
transfer_id
):
return
cinderclient
(
request
)
.
transfers
.
delete
(
transfer_id
)
return
cinderclient
(
request
)
.
transfers
.
delete
(
transfer_id
)
@profiler.trace
def
pool_list
(
request
,
detailed
=
False
):
def
pool_list
(
request
,
detailed
=
False
):
c_client
=
cinderclient
(
request
)
c_client
=
cinderclient
(
request
)
if
c_client
is
None
:
if
c_client
is
None
:
...
@@ -1062,7 +1061,7 @@ def pool_list(request, detailed=False):
...
@@ -1062,7 +1061,7 @@ def pool_list(request, detailed=False):
detailed
=
detailed
)]
detailed
=
detailed
)]
@profiler.trace
def
message_list
(
request
,
search_opts
=
None
):
def
message_list
(
request
,
search_opts
=
None
):
version
=
get_microversion
(
request
,
[
'message_list'
])
version
=
get_microversion
(
request
,
[
'message_list'
])
if
version
is
None
:
if
version
is
None
:
...
...
circle/openstack_api/nova.py
View file @
fd8ddbfb
...
@@ -809,7 +809,7 @@ def instance_volume_detach(request, instance_id, att_id):
...
@@ -809,7 +809,7 @@ def instance_volume_detach(request, instance_id, att_id):
def
instance_volumes_list
(
request
,
instance_id
):
def
instance_volumes_list
(
request
,
instance_id
):
from
openstack_
dashboard.
api
import
cinder
from
openstack_api
import
cinder
volumes
=
novaclient
(
request
)
.
volumes
.
get_server_volumes
(
instance_id
)
volumes
=
novaclient
(
request
)
.
volumes
.
get_server_volumes
(
instance_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