Add volume.API.remove_from_compute instead of compute.API.remove_volume.
This commit is contained in:
@@ -687,13 +687,6 @@ class API(base.Base):
|
||||
"volume_id": volume_id}})
|
||||
return instance
|
||||
|
||||
def remove_volume(self, context, volume_id, host):
|
||||
"""Remove volume on specified compute host."""
|
||||
rpc.call(context,
|
||||
self.db.queue_get_for(context, FLAGS.compute_topic, host),
|
||||
{"method": "remove_volume",
|
||||
"args": {'volume_id': volume_id}})
|
||||
|
||||
def associate_floating_ip(self, context, instance_id, address):
|
||||
instance = self.get(context, instance_id)
|
||||
self.network_api.associate_floating_ip(context,
|
||||
|
||||
@@ -46,13 +46,13 @@ import functools
|
||||
|
||||
from eventlet import greenthread
|
||||
|
||||
from nova import compute
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova import manager
|
||||
from nova import rpc
|
||||
from nova import utils
|
||||
from nova import volume
|
||||
from nova.compute import power_state
|
||||
from nova.virt import driver
|
||||
|
||||
@@ -1037,14 +1037,12 @@ class ComputeManager(manager.SchedulerDependentManager):
|
||||
'host': host})
|
||||
|
||||
if dest:
|
||||
# NOTE(noguchimn): We set image_service here
|
||||
# not to import an image service object.
|
||||
compute_api = compute.API(image_service=1)
|
||||
for volume in instance_ref['volumes']:
|
||||
volume_id = volume['id']
|
||||
volume_api = volume.API()
|
||||
for volume_ref in instance_ref['volumes']:
|
||||
volume_id = volume_ref['id']
|
||||
self.db.volume_update(ctxt, volume_id, {'status': 'in-use'})
|
||||
if dest:
|
||||
compute_api.remove_volume(ctxt, volume_id, dest)
|
||||
volume_api.remove_from_compute(ctxt, volume_id, dest)
|
||||
|
||||
def periodic_tasks(self, context=None):
|
||||
"""Tasks to be run at a periodic interval."""
|
||||
|
||||
@@ -103,3 +103,10 @@ class API(base.Base):
|
||||
# TODO(vish): abstract status checking?
|
||||
if volume['status'] == "available":
|
||||
raise exception.ApiError(_("Volume is already detached"))
|
||||
|
||||
def remove_from_compute(self, context, volume_id, host):
|
||||
"""Remove volume from specified compute host."""
|
||||
rpc.call(context,
|
||||
self.db.queue_get_for(context, FLAGS.compute_topic, host),
|
||||
{"method": "remove_volume",
|
||||
"args": {'volume_id': volume_id}})
|
||||
|
||||
Reference in New Issue
Block a user