<div>Thanks Matt.</div><div><br></div><div><br></div><div><br></div><div><includetail><div> </div><div> </div><div style="font:Verdana normal 14px;color:#000;"><div style="FONT-SIZE: 12px;FONT-FAMILY: Arial Narrow;padding:2px 0 2px 0;">------------------ Original ------------------</div><div style="FONT-SIZE: 12px;background:#efefef;padding:8px;"><div id="menu_sender"><b>From: </b> "Matt Riedemann"<mriedemos@gmail.com>;</div><div><b>Date: </b> Fri, Apr 7, 2017 00:18 AM</div><div><b>To: </b> "openstack-dev"<openstack-dev@lists.openstack.org>; <wbr></div><div></div><div><b>Subject: </b> Re: [openstack-dev] [nova] nova boot from image created volume</div></div><div> </div>On 4/6/2017 10:05 AM, Jay Pipes wrote:<br>>> jaypipes@serialcoder:~/src/git.openstack.org/openstack/nova/nova$<br>>> ack-grep --ignore-dir tests --ignore-dir locale "volume_api.create"<br>>> compute/api.py<br>>> 2982:                snapshot = self.volume_api.create_snapshot_force(<br>>><br>>> api/openstack/compute/volumes.py<br>>> 185:            new_volume = self.volume_api.create(<br>>> 582:            create_func = self.volume_api.create_snapshot_force<br>>> 584:            create_func = self.volume_api.create_snapshot<br>>><br>>> virt/block_device.py<br>>> 63:    :returns: The availability_zone value to pass to volume_api.create<br>>> 487:            vol = volume_api.create(context, self.volume_size, '',<br>>> '',<br>>> 508:            vol = volume_api.create(context, self.volume_size,<br>>> 530:            vol = volume_api.create(context, self.volume_size,<br>>> vol_name, '',<br>><br>> Best,<br>> -jay<br>><br>> On 04/06/2017 03:29 AM, 李田清 wrote:<br>>> Hello,<br>>>     If we use nova boot from image and created volume, i think the<br>>> nova will<br>>>     use volume/cinder.py:create to create volume. But after insert pdb,<br>>> i do not find<br>>>     the specific code of line to call the create. Can someone help me to<br>>> point out the<br>>>     code of the line? Thanks a lot.<br>>><br>>><br>>> __________________________________________________________________________<br>>><br>>> OpenStack Development Mailing List (not for usage questions)<br>>> Unsubscribe:<br>>> OpenStack-dev-request@lists.openstack.org?subject:unsubscribe<br>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev<br>>><br>><br>> __________________________________________________________________________<br>> OpenStack Development Mailing List (not for usage questions)<br>> Unsubscribe: OpenStack-dev-request@lists.openstack.org?subject:unsubscribe<br>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev<br><br>For the case you're looking for, the volume is created here:<br><br>https://github.com/openstack/nova/blob/8d9bf947a4c8654a30e016a5d95d9bec55447506/nova/virt/block_device.py#L508<br><br>That happens when the compute manager is preparing block devices to <br>attach to the instance while building it on the compute host.<br><br>After the volume is created and nova gets the volume ID back, we wait <br>for it to be available before we can attach it:<br><br>https://github.com/openstack/nova/blob/8d9bf947a4c8654a30e016a5d95d9bec55447506/nova/virt/block_device.py#L512<br><br>Which uses this function passed in from the compute manager (yes, it's <br>gross tight coupling):<br><br>https://github.com/openstack/nova/blob/8d9bf947a4c8654a30e016a5d95d9bec55447506/nova/compute/manager.py#L1221<br><br>And finally it attaches the volume to the instance via a call to the <br>parent class:<br><br>https://github.com/openstack/nova/blob/8d9bf947a4c8654a30e016a5d95d9bec55447506/nova/virt/block_device.py#L516<br><br>I hope this helps. It only took me 4 years to memorize the flow. :)</div><div style="font:Verdana normal 14px;color:#000;"><br></div><div style="font:Verdana normal 14px;color:#000;"><br></div><div style="font:Verdana normal 14px;color:#000;"><br><br>-- <br><br>Thanks,<br><br>Matt<br><br>__________________________________________________________________________<br>OpenStack Development Mailing List (not for usage questions)<br>Unsubscribe: OpenStack-dev-request@lists.openstack.org?subject:unsubscribe<br>http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev<br></div><!--<![endif]--></includetail></div>