<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 24, 2015 at 11:57 AM, Deepak Shetty <span dir="ltr"><<a href="mailto:dpkshetty@gmail.com" target="_blank">dpkshetty@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Tue, Mar 24, 2015 at 10:58 AM, Deepthi Dharwar <span dir="ltr"><<a href="mailto:deepthi@linux.vnet.ibm.com" target="_blank">deepthi@linux.vnet.ibm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span>On 03/23/2015 09:00 PM, Jay Pipes wrote:<br>
> On Mon, Mar 23, 2015 at 11:18:28AM +0530, Deepthi Dharwar wrote:<br>
>> All the VM information is stored in the instances table.<br>
>> This includes all the time related field like scheduled_at, launched_at etc.<br>
>><br>
>> After upgrading to Juno, I have noticed that my 'scheduled_at' field<br>
>> is not getting reflected at all in the database. I do see my VMs<br>
>> being spawned and running just fine. However, the 'launched_at' time<br>
>> does get reflected rightly.<br>
>><br>
>><br>
>> MariaDB [nova]> select created_at, deleted_at, host,scheduled_at, launched_at from instances;<br>
>> +---------------------+---------------------+-----------------------+--------------+---------------------+<br>
>> | created_at          | deleted_at          | host                  | scheduled_at | launched_at         |<br>
>> +---------------------+---------------------+-----------------------+--------------+---------------------+<br>
>> | 2015-03-09 20:00:41 | 2015-03-10 17:12:11 | localhost             | NULL         | 2015-03-09 20:01:30 |<br>
>> | 2015-03-11 05:53:13 | NULL                | localhost                  | NULL         | 2015-03-18 19:48:12 |<br>
>><br>
>><br>
>> Can anyone let me know if this is a genuine issue or have there been<br>
>> a recent change in regard to updating this field ?<br>
>><br>
>> I am basically trying to find as to how long a particular VM is running on a given host.<br>
>> I was using the current time - scheduled time for the same.<br>
>> Is there a better way to get this value ?<br>
><br>
> Use current_time - launched_at.<br>
<br>
</span>'launched_at' will give me the time a particular VM came into being.<br>
In a scenario where the VM was launched on host H1, later migrated on to<br>
a different host H2, 'launched_at' will not give the time the VM<br>
has been running on host H2, where as 'scheduled_at' would have<br>
addressed this issue or will it ?<br></blockquote><div><br></div></div></div><div>Per the code , patch @ <a href="https://review.openstack.org/#/c/143725/2" target="_blank">https://review.openstack.org/#/c/143725/2</a> removed scheduled_at<br></div><div>since the function was no longer used. Googling i couldn't find more info on the history behind<br>why these 2 fields were there to begin with. <br><br>I am _not_ nova expert, but iiuc, a VM is scheduled<br></div><div>once and changing the host as part of migration isn't scheduling, but i could be wrong too.<br><br></div><div>Since your requirement is to find the time a VM lived on a host, as long as launched_at is updated<br>post migration, it should suffice i feel ?<br></div></div></div></div></blockquote><div><br></div><div>FWIW, In nova/compute/manager.py line 4036 is where migration ends and line 4042 is where<br></div><div>the launched_at is updated, post migration.<br><br></div><div>HTH<br></div></div><br></div><div class="gmail_extra">thanx,<br></div><div class="gmail_extra">deepak<br><br></div></div>