From: Jenkins Date: Thu, 25 Jul 2013 17:51:41 +0000 (+0000) Subject: Merge "fix name 'update_volume_status' to 'update_volume_stats'" X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=b30ff0bd432a8f0fca96e2e2d278b3155aafaeb9;p=openstack-build%2Fcinder-build.git Merge "fix name 'update_volume_status' to 'update_volume_stats'" --- b30ff0bd432a8f0fca96e2e2d278b3155aafaeb9 diff --cc cinder/volume/drivers/lvm.py index 2a9af2981,9b2646894..a94a9dd0f --- a/cinder/volume/drivers/lvm.py +++ b/cinder/volume/drivers/lvm.py @@@ -538,44 -530,8 +538,44 @@@ class LVMISCSIDriver(LVMVolumeDriver, d self.tgtadm.remove_iscsi_target(iscsi_target, 0, volume['id']) + def migrate_volume(self, ctxt, volume, host): + """Optimize the migration if the destination is on the same server. + + If the specified host is another back-end on the same server, and + the volume is not attached, we can do the migration locally without + going through iSCSI. + """ + false_ret = (False, None) + if 'location_info' not in host['capabilities']: + return false_ret + info = host['capabilities']['location_info'] + try: + (dest_type, dest_hostname, dest_vg) = info.split(':') + except ValueError: + return false_ret + if (dest_type != 'LVMVolumeDriver' or dest_hostname != self.hostname): + return false_ret + + self.remove_export(ctxt, volume) + self._create_volume(volume['name'], + self._sizestr(volume['size']), + dest_vg) + volutils.copy_volume(self.local_path(volume), + self.local_path(volume, vg=dest_vg), + volume['size'], + execute=self._execute) + self._delete_volume(volume) + model_update = self._create_export(ctxt, volume, vg=dest_vg) + + return (True, model_update) + + def rename_volume(self, volume, orig_name): + self._execute('lvrename', self.configuration.volume_group, + orig_name, volume['name'], + run_as_root=True) + def get_volume_stats(self, refresh=False): - """Get volume status. + """Get volume stats. If 'refresh' is True, run update the stats first. """