From 963886e1161777d4c95095ee8eeb3700b333f6ff Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Tue, 29 May 2012 21:15:58 -0400 Subject: [PATCH] Use compute rpcapi in nova-manage. Part of bug 1006467. This patch fixes nova-manage to use the compute rpcapi instead of calling rpc.cast() directly. This cast was actually broken, as it sent an instance ID instead of UUID, so this change should make this code functional again. Change-Id: I90a1bf4a03cc6d9e21f24f19165141f894b6ec75 --- bin/nova-manage | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index 1554251a..727b1cc3 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -80,6 +80,7 @@ from nova.api.ec2 import ec2utils from nova.auth import manager from nova.compat import flagfile from nova.compute import instance_types +from nova.compute import rpcapi as compute_rpcapi from nova import context from nova import crypto from nova import db @@ -1169,13 +1170,9 @@ class VolumeCommands(object): print "volume is not attached to an instance" return instance = db.instance_get(ctxt, volume['instance_id']) - host = instance['host'] - rpc.cast(ctxt, - rpc.queue_get_for(ctxt, FLAGS.compute_topic, host), - {"method": "attach_volume", - "args": {"instance_id": instance['id'], - "volume_id": volume['id'], - "mountpoint": volume['mountpoint']}}) + rpcapi = compute_rpcapi.ComputeAPI() + rpcapi.attach_volume(ctxt, instance, volume['id'], + volume['mountpoint']) class InstanceTypeCommands(object):