[openstack-dev] [nova] Updating 'scheduled_at' field of nova instances in the database.

Deepthi Dharwar deepthi at linux.vnet.ibm.com
Tue Mar 24 10:44:27 UTC 2015


On 03/24/2015 12:09 PM, Deepak Shetty wrote:
> 
> 
> On Tue, Mar 24, 2015 at 11:57 AM, Deepak Shetty <dpkshetty at gmail.com
> <mailto:dpkshetty at gmail.com>> wrote:
> 
> 
> 
>     On Tue, Mar 24, 2015 at 10:58 AM, Deepthi Dharwar
>     <deepthi at linux.vnet.ibm.com <mailto:deepthi at linux.vnet.ibm.com>> wrote:
> 
>         On 03/23/2015 09:00 PM, Jay Pipes wrote:
>         > On Mon, Mar 23, 2015 at 11:18:28AM +0530, Deepthi Dharwar wrote:
>         >> All the VM information is stored in the instances table.
>         >> This includes all the time related field like scheduled_at, launched_at etc.
>         >>
>         >> After upgrading to Juno, I have noticed that my 'scheduled_at' field
>         >> is not getting reflected at all in the database. I do see my VMs
>         >> being spawned and running just fine. However, the 'launched_at' time
>         >> does get reflected rightly.
>         >>
>         >>
>         >> MariaDB [nova]> select created_at, deleted_at, host,scheduled_at, launched_at from instances;
>         >> +---------------------+---------------------+-----------------------+--------------+---------------------+
>         >> | created_at          | deleted_at          | host                  | scheduled_at | launched_at         |
>         >> +---------------------+---------------------+-----------------------+--------------+---------------------+
>         >> | 2015-03-09 20:00:41 | 2015-03-10 17:12:11 | localhost             | NULL         | 2015-03-09 20:01:30 |
>         >> | 2015-03-11 05:53:13 | NULL                | localhost                  | NULL         | 2015-03-18 19:48:12 |
>         >>
>         >>
>         >> Can anyone let me know if this is a genuine issue or have there been
>         >> a recent change in regard to updating this field ?
>         >>
>         >> I am basically trying to find as to how long a particular VM is running on a given host.
>         >> I was using the current time - scheduled time for the same.
>         >> Is there a better way to get this value ?
>         >
>         > Use current_time - launched_at.
> 
>         'launched_at' will give me the time a particular VM came into being.
>         In a scenario where the VM was launched on host H1, later
>         migrated on to
>         a different host H2, 'launched_at' will not give the time the VM
>         has been running on host H2, where as 'scheduled_at' would have
>         addressed this issue or will it ?
> 
> 
>     Per the code , patch @ https://review.openstack.org/#/c/143725/2
>     removed scheduled_at
>     since the function was no longer used. Googling i couldn't find more
>     info on the history behind
>     why these 2 fields were there to begin with.

IMHO launched_at => When the VM was first instantiated
     scheduled_at => Field updated whenever scheduler was invoked be
                     it launching or migration.

> 
>     I am _not_ nova expert, but iiuc, a VM is scheduled
>     once and changing the host as part of migration isn't scheduling,
>     but i could be wrong too.
> 
>     Since your requirement is to find the time a VM lived on a host, as
>     long as launched_at is updated
>     post migration, it should suffice i feel ?

Yes, that's right.

> 
> 
> FWIW, In nova/compute/manager.py line 4036 is where migration ends and
> line 4042 is where
> the launched_at is updated, post migration.
> 

It is really helpful to know that launched_at is indeed being updated.

> HTH
> 
Thanks for all the digging in and for your time.

Regards,
Deepthi

> thanx,
> deepak
> 
> 
> 
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> 




More information about the OpenStack-dev mailing list