[Openstack] how to re-attach volume after vm and host down unexpectedly

Razique Mahroua razique.mahroua at gmail.com
Wed Dec 28 15:13:46 UTC 2011

Hey dude :)
Remember my doc.
In fact the main issue is not about the database state... it's about the ISCSI session that is lost after the node reboots.
Check out my drp script. It does handle that for you : 

There are much more better way, but that script saved me several times. the part you are looking for is here : 

			use nova;
			update volumes set mountpoint=NULL;
			update volumes set status="available" where status <> "error_deleting";
			update volumes set attach_status="detached";
			update volumes set instance_id=0;	

The other way around would be to cron a script that saves the iscsi sessions, and after a reboot, and BEFORE the openstack services start, recreate the sessions.
I'll try that and see if it's working on a long-term basis.

Nuage & Co - Razique Mahroua 
razique.mahroua at gmail.com

Le 28 déc. 2011 à 08:23, DeadSun a écrit :

> I have write a blog about re-attach
> http://livemoon.dyndns.org/life/2011/12/how-to-re-attach-volume-in-openstack-if-vm-down-since-of-host-down.html
> I think my way is stupid . Better way should exists.
> The case is: 
> The vm using volume, and then host where vm is runnning down because some reason. After host up, we can reboot vm using "nova reboot <server>", but the disk(filesystem mounted) in vm will be lost. In novaclient, using "nova volume-list", it show volume status is still in-used by this vm. 
> At first, I want to detach it and re-attach it again. This way can work if we reboot vm in normal(host not down unexpectedly), but now it will show error like this:
> 2011-12-28 14:30:08,269 AUDIT nova.compute.manager [661dae13-05ec-4365-9f44-15d9072e000a admin 1] Detach volume 6 from mountpoint /dev/vdb on instance 74
> (nova.rpc): TRACE: DiskNotFound: No disk at vdb
> I don't know how to write "vdb" to somewhere. But I think I can clear the database about it.
> So following steps I do:
> update nova database, volumes table, found this vm, set mountpoint to NULL, set status='available' , set attach_status='detach'
> logout iscsi volume in host where vm running, like this:
>              $ sudo iscsiadm -m node -T iqn.2010-10.org.openstack:volume-00000006 -p --logout
> attach volume again using "nova volume-attach <server> <volume> /dev/vdb
> It can work, but I want to know , is this way correct ?
> -- 
> 非淡薄无以明志,非宁静无以致远
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack at lists.launchpad.net
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20111228/f528a829/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NUAGECO-LOGO-Fblan_petit.jpg
Type: image/jpeg
Size: 10122 bytes
Desc: not available
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20111228/f528a829/attachment.jpg>

More information about the Openstack mailing list