Remove reattach function in cinder-manage

The reattach function in cinder-manage depends on
db.instance_get, which is not available in cinder db.
db.instance_get is only available in nova db. Hence, the
reattach function should be removed from cinder-manage.

Change-Id: If33bf2f281735bd530641c1e6d15e9645f38b4b4
Closes-Bug: #1167931
This commit is contained in:
Thang Pham 2014-07-25 20:37:06 -04:00
parent 4d56b91628
commit 2581edd8e4

View File

@ -279,25 +279,6 @@ class VolumeCommands(object):
cctxt = self.client.prepare(server=host) cctxt = self.client.prepare(server=host)
cctxt.cast(ctxt, "delete_volume", volume_id=volume['id']) cctxt.cast(ctxt, "delete_volume", volume_id=volume['id'])
@args('volume_id',
help='Volume ID to be reattached')
def reattach(self, volume_id):
"""Re-attach a volume that has previously been attached
to an instance. Typically called after a compute host
has been rebooted.
"""
ctxt = context.get_admin_context()
volume = db.volume_get(ctxt, param2id(volume_id))
if not volume['instance_id']:
print(_("volume is not attached to an instance"))
return
instance = db.instance_get(ctxt, volume['instance_id'])
host = instance['host']
cctxt = self.client.prepare(topic=CONF.compute_topic, server=host)
cctxt.cast(ctxt, "attach_volume", instance_id=instance['id'],
volume_id=volume['id'], mountpoint=volume['mountpoint'])
@args('--currenthost', required=True, help='Existing volume host name') @args('--currenthost', required=True, help='Existing volume host name')
@args('--newhost', required=True, help='New volume host name') @args('--newhost', required=True, help='New volume host name')
def update_host(self, currenthost, newhost): def update_host(self, currenthost, newhost):