fresh cinder proxy
Change-Id: I5778a1e1e6edd5534befd1bd31d5b3553e83ec4f
This commit is contained in:
parent
2b123b284c
commit
cf97fb49af
|
@ -207,7 +207,8 @@ class CinderProxy(manager.SchedulerDependentManager):
|
|||
|
||||
def _init_volume_mapping_cache(self):
|
||||
try:
|
||||
volumes = self._query_vol_cascaded_pagination()
|
||||
volumes =\
|
||||
self._query_vol_cascaded_pagination(change_since_time=None)
|
||||
for vol in volumes:
|
||||
ccding_volume_id = self._get_ccding_volume_id(vol)
|
||||
self.volumes_mapping_cache['volumes'][ccding_volume_id] = \
|
||||
|
@ -235,6 +236,16 @@ class CinderProxy(manager.SchedulerDependentManager):
|
|||
except KeyError:
|
||||
return ''
|
||||
|
||||
def _get_ccding_snapsot_id(self, snapshot):
|
||||
csd_name = snapshot._info["name"]
|
||||
uuid_len = self.SNAPSHOT_UUID_LENGTH
|
||||
if len(csd_name) > (uuid_len+1) and csd_name[-(uuid_len+1)] == '@':
|
||||
return csd_name[-uuid_len:]
|
||||
try:
|
||||
return snapshot._info['metadata']['logicalVolumeId']
|
||||
except KeyError:
|
||||
return ''
|
||||
|
||||
def _gen_ccding_volume_name(self, volume_name, volume_id):
|
||||
max_len = self.VOLUME_NAME_LENGTH - self.VOLUME_UUID_LENGTH - 1
|
||||
if (len(volume_name) <= max_len):
|
||||
|
@ -249,16 +260,6 @@ class CinderProxy(manager.SchedulerDependentManager):
|
|||
else:
|
||||
return snapshot_name[0:max_len] + "@" + snapshot_id
|
||||
|
||||
def _get_ccding_snapsot_id(self, snapshot):
|
||||
csd_name = snapshot._info["name"]
|
||||
uuid_len = self.SNAPSHOT_UUID_LENGTH
|
||||
if len(csd_name) > (uuid_len+1) and csd_name[-(uuid_len+1)] == '@':
|
||||
return csd_name[-uuid_len:]
|
||||
try:
|
||||
return snapshot._info['metadata']['logicalVolumeId']
|
||||
except KeyError:
|
||||
return ''
|
||||
|
||||
def _get_cinder_cascaded_admin_client(self):
|
||||
|
||||
try:
|
||||
|
@ -455,7 +456,7 @@ class CinderProxy(manager.SchedulerDependentManager):
|
|||
|
||||
return volume_id
|
||||
|
||||
def _query_vol_cascaded_pagination(self, change_since_time):
|
||||
def _query_vol_cascaded_pagination(self, change_since_time=None):
|
||||
try:
|
||||
page_limit = CONF.pagination_limit
|
||||
marker = None
|
||||
|
@ -550,9 +551,11 @@ class CinderProxy(manager.SchedulerDependentManager):
|
|||
|
||||
def _update_volume_qos(self, context, qosSpecs):
|
||||
qos_specs = self.db.qos_specs_get_all(context, inactive=False)
|
||||
|
||||
qosname_list_cascading = []
|
||||
for qos_cascading in qos_specs:
|
||||
qosname_list_cascading.append(qos_cascading['name'])
|
||||
|
||||
for qos_cascaded in qosSpecs:
|
||||
qos_name_cascaded = qos_cascaded._info['name']
|
||||
|
||||
|
@ -592,7 +595,7 @@ class CinderProxy(manager.SchedulerDependentManager):
|
|||
self.db.qos_specs_associate(context,
|
||||
qos_cascading['id'],
|
||||
voltype['id'],)
|
||||
LOG.debug(_("Cascade info, update qos from cascaded cinder finished"))
|
||||
LOG.debug(_("Cascade info, update qos finished"))
|
||||
|
||||
@periodic_task.periodic_task(spacing=CONF.volume_sync_interval,
|
||||
run_immediately=True)
|
||||
|
@ -769,8 +772,8 @@ class CinderProxy(manager.SchedulerDependentManager):
|
|||
try:
|
||||
cascaded_volume_id = \
|
||||
self.volumes_mapping_cache['volumes'].get(volume_id, '')
|
||||
LOG.debug(_('Cascade info: create snapshot, ccded vol id %s'),
|
||||
cascaded_volume_id)
|
||||
LOG.debug(_('Cascade info: create snapshot, cascaded volume'
|
||||
'id is : %s '), cascaded_volume_id)
|
||||
cinderClient = self._get_cinder_cascaded_user_client(context)
|
||||
bodyResponse = cinderClient.volume_snapshots.create(
|
||||
volume_id=cascaded_volume_id,
|
||||
|
@ -783,6 +786,20 @@ class CinderProxy(manager.SchedulerDependentManager):
|
|||
if bodyResponse._info['status'] == 'creating':
|
||||
self.volumes_mapping_cache['snapshots'][snapshot_id] =\
|
||||
bodyResponse._info['id']
|
||||
|
||||
while True:
|
||||
time.sleep(CONF.volume_sync_interval)
|
||||
queryResponse =\
|
||||
cinderClient.volume_snapshots.get(bodyResponse._info['id'])
|
||||
query_status = queryResponse._info['status']
|
||||
if query_status != 'creating':
|
||||
self.db.snapshot_update(context, snapshot_ref['id'],
|
||||
{'status': query_status,
|
||||
'progress': '100%'
|
||||
})
|
||||
break
|
||||
else:
|
||||
continue
|
||||
# self.db.snapshot_update(
|
||||
# context,
|
||||
# snapshot_ref['id'],
|
||||
|
@ -794,10 +811,6 @@ class CinderProxy(manager.SchedulerDependentManager):
|
|||
snapshot_ref['id'],
|
||||
{'status': 'error'})
|
||||
return
|
||||
|
||||
self.db.snapshot_update(context,
|
||||
snapshot_ref['id'], {'status': 'available',
|
||||
'progress': '100%'})
|
||||
# vol_ref = self.db.volume_get(context, volume_id)
|
||||
|
||||
if vol_ref.bootable:
|
||||
|
@ -1133,15 +1146,17 @@ class CinderProxy(manager.SchedulerDependentManager):
|
|||
|
||||
def initialize_connection(self, context, volume_id, connector):
|
||||
"""Prepare volume for connection from host represented by connector.
|
||||
volume in cascading level is just a logical data, the interface
|
||||
has lots its meaning, so here just return a None value
|
||||
volume in openstack cascading level is just a logical data,
|
||||
initialize connection has losts its meaning, so this interface here
|
||||
just return a None value
|
||||
"""
|
||||
return None
|
||||
|
||||
def terminate_connection(self, context, volume_id, connector, force=False):
|
||||
"""Cleanup connection from host represented by connector.
|
||||
volume in cascading level is just a logical data, the interface
|
||||
has lots its meaning, so here just return a None value
|
||||
volume in openstack cascading level is just a logical data,
|
||||
terminate connection has losts its meaning, so this interface here
|
||||
just return a None value
|
||||
"""
|
||||
return None
|
||||
|
||||
|
|
Loading…
Reference in New Issue