<div class="gmail_quote"><div>Hey Tomoe,</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
 -  a launched instance cannot go outside the world and failed<br>
    to get the cirros image with floating ip.<br></blockquote><div><br></div><div></div><div>For this to work, the floating ip range defined by FLOATING_RANGE have to be configured on your network.  An easy solution for this is to set FLOATING_RANGE as some unused ips in your host network (like FLOATING_RANGE=<a href="http://192.168.2.196/30">192.168.2.196/30</a>).</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> - I had to go inside nova-compute session to enter password<br>
  for executing guestmount and fusermount with sudo.<br></blockquote><div><br></div><div>Hmm, this doesn't happen for me.  If it is reproducible, perhaps open a bug describing the repro steps?</div><div><br></div><div>
As for creating a bootable volume through an api.  Is it that you'd want to do something like:</div><div><br></div><div> > nova bootable-volume-create --instance_id=x # That would create a bootable volume based on an image</div>
<div><br></div><div>Or:</div><div><br></div><div>> nova bootable-volume-create --image_id=x # Create a bootable volume from an image</div><div><br></div><div>Those are of course imaginary calls - just trying to get a feel for what you think would be most useful.</div>
<div><br></div><div>A</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
So, I made some changes with the patch below and got it working.<br>
<br>
midokura@midokura-iMac:~/git/devstack.forked/exercises$ diff  -u<br>
boot_from_volume_new-8fe133bebcd90fa94c7a1d12c00b3f2cca18a35c.sh<br>
bfv.sh<br>
--- boot_from_volume_new-8fe133bebcd90fa94c7a1d12c00b3f2cca18a35c.sh    2012-02-11<br>
05:49:08.000000000 +0900<br>
+++ bfv.sh      2012-02-14 14:30:44.233636001 +0900<br>
@@ -99,13 +99,13 @@<br>
 fi<br>
<br>
 # Add floating ip to our server<br>
-nova add-floating-ip $VM_UUID $FLOATING_IP<br>
+#nova add-floating-ip $VM_UUID $FLOATING_IP<br>
<br>
 # Test we can ping our floating ip within ASSOCIATE_TIMEOUT seconds<br>
-if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! ping -c1 -w1<br>
$FLOATING_IP; do sleep 1; done"; then<br>
-    echo "Couldn't ping server with floating ip"<br>
-    exit 1<br>
-fi<br>
+#if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! ping -c1 -w1<br>
$FLOATING_IP; do sleep 1; done"; then<br>
+#    echo "Couldn't ping server with floating ip"<br>
+#    exit 1<br>
+#fi<br>
<br>
 # Create our volume<br>
 nova volume-create --display_name=$VOL_NAME 1<br>
@@ -116,6 +116,9 @@<br>
     exit 1<br>
 fi<br>
<br>
+# get private ip<br>
+IP=$(nova show $VM_UUID |grep priv | awk -F '|' '{print $3}'|sed -e 's/ //')<br>
+<br>
 # FIXME (anthony) - python-novaclient should accept a volume_id for<br>
the attachment param<br>
 DEVICE=/dev/vdb<br>
 VOLUME_ID=`nova volume-list | grep $VOL_NAME  | cut -d '|' -f 2 | tr -d ' '`<br>
@@ -131,7 +134,7 @@<br>
 # To do this, ssh to the builder instance, mount volume, and build a<br>
volume-backed image.<br>
 STAGING_DIR=/tmp/stage<br>
 CIRROS_DIR=/tmp/cirros<br>
-ssh -o StrictHostKeyChecking=no -i $KEY_FILE cirros@$FLOATING_IP << EOF<br>
+ssh -o StrictHostKeyChecking=no -i $KEY_FILE cirros@$IP << EOF<br>
 set -o errexit<br>
 set -o xtrace<br>
 sudo mkdir -p $STAGING_DIR<br>
@@ -177,16 +180,16 @@<br>
 sleep 1<br>
<br>
 # Add floating ip to our server<br>
-nova add-floating-ip $VOL_VM_UUID $FLOATING_IP<br>
+#nova add-floating-ip $VOL_VM_UUID $FLOATING_IP<br>
<br>
 # Test we can ping our floating ip within ASSOCIATE_TIMEOUT seconds<br>
-if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! ping -c1 -w1<br>
$FLOATING_IP; do sleep 1; done"; then<br>
-    echo "Couldn't ping volume-backed server with floating ip"<br>
-    exit 1<br>
-fi<br>
+#if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! ping -c1 -w1<br>
$FLOATING_IP; do sleep 1; done"; then<br>
+#    echo "Couldn't ping volume-backed server with floating ip"<br>
+#    exit 1<br>
+#fi<br>
<br>
 # Make sure our volume-backed instance launched<br>
-ssh -o StrictHostKeyChecking=no -i $KEY_FILE cirros@$FLOATING_IP << EOF<br>
+ssh -o StrictHostKeyChecking=no -i $KEY_FILE cirros@$IP << EOF<br>
 echo "success!"<br>
 EOF<br>
<br>
@@ -206,7 +209,7 @@<br>
 nova delete $INSTANCE_NAME<br>
<br>
 # De-allocate the floating ip<br>
-nova floating-ip-delete $FLOATING_IP<br>
+#nova floating-ip-delete $FLOATING_IP<br>
<br>
 # Delete secgroup<br>
 nova secgroup-delete $SECGROUP<br>
----------------------------------------------<br>
<br>
Hope this helps.<br>
<br>
Cheers,<br>
Tomoe<br>
<div><div><br>
<br>
On Sat, Feb 11, 2012 at 10:31 PM, Tomoe Sugihara <<a href="mailto:tomoe@midokura.com" target="_blank">tomoe@midokura.com</a>> wrote:<br>
> Hi Anthony,<br>
><br>
> Thanks for following it up.<br>
><br>
> On Sat, Feb 11, 2012 at 2:58 PM, Anthony Young<br>
> <<a href="mailto:sleepsonthefloor@gmail.com" target="_blank">sleepsonthefloor@gmail.com</a>> wrote:<br>
>> On Fri, Feb 10, 2012 at 8:51 PM, Tomoe Sugihara <<a href="mailto:tomoe@midokura.com" target="_blank">tomoe@midokura.com</a>> wrote:<br>
>>><br>
>>> Hi folks,<br>
>>><br>
>>> Could someone tell me what is the right way to do boot-from-volume?<br>
>>> Especially, how to create boot-from-volume capable image and volume?<br>
>>> My understanding is that, since openstack API requires imageRef, we<br>
>>> need to pass in both image and volume ids.<br>
>><br>
>><br>
>> I was actually playing with this today, and just put up a review that adds a<br>
>> devstack exercise to create and launch a bootable volume.  It is true that<br>
>> --image is still required when booting from a volume - I have not<br>
>> investigated yet if that is a bug or a consequence of how boot-from-volume<br>
>> is implemented as an extension (which still may fall into the bug category).<br>
>><br>
>> <a href="https://review.openstack.org/4044" target="_blank">https://review.openstack.org/4044</a><br>
><br>
> Current servers API, which boot-from-volume inherits from, throws an<br>
> exception when imageRef is missing:<br>
> <a href="https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/servers.py#L646" target="_blank">https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/servers.py#L646</a><br>
> <a href="https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/servers.py#L965" target="_blank">https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/servers.py#L965</a><br>
><br>
>><br>
>>><br>
>>> I thought that create_image in EC2 API would be the one and tried, but<br>
>>> it's totally broken now:<br>
>>> <a href="https://bugs.launchpad.net/nova/+bug/923546" target="_blank">https://bugs.launchpad.net/nova/+bug/923546</a><br>
>>> And, I didn't find equivalent code in OpenStack API.<br>
>>><br>
>>><br>
>>> I'd appreciate any help on this and I'd be happy to help debug the issue.<br>
>><br>
>><br>
>> Hopefully the code above will give you some direction to get started.  My<br>
>> experience thus far is that the end-to-end experience of using this feature<br>
>> needs some work, so I'll probably file some bugs and patches while I muck<br>
>> with it.  So it would be great if you took a look and did the same:)<br>
><br>
> That helps me understand the end-to-end workflow a lot :)<br>
> In your script, you log in to a guest and copy a bootable image by cp<br>
> command to a volume, but I'm wondering if there's a way to create<br>
> bootable volume using only APIs. Otherwise it's a bit hard to manage<br>
> from operator's or dashboard's point of view.<br>
><br>
> I'll run your script next week and see how it goes. Thanks a lot!<br>
><br>
> Tomoe<br>
><br>
>><br>
>> Anthony<br>
>><br>
>>><br>
>>> Cheers,<br>
>>> Tomoe<br>
>>><br>
>>> _______________________________________________<br>
>>> Mailing list: <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
>>> Post to     : <a href="mailto:openstack@lists.launchpad.net" target="_blank">openstack@lists.launchpad.net</a><br>
>>> Unsubscribe : <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
>>> More help   : <a href="https://help.launchpad.net/ListHelp" target="_blank">https://help.launchpad.net/ListHelp</a><br>
>><br>
>><br>
</div></div></blockquote></div><br>