[openstack-dev] [nova] formally distinguish server "desired state" from "actual state"?

Jay Pipes jaypipes at gmail.com
Wed Oct 1 23:55:25 UTC 2014


On 10/01/2014 04:31 PM, Chris Friesen wrote:
> On 10/01/2014 01:23 PM, Jay Pipes wrote:
>> On 10/01/2014 03:07 PM, Chris Friesen wrote:
>>> Currently in nova we have the "vm_state", which according to the code
>>> comments is supposed to represent "a VM's current stable (not
>>> transition) state", or "what the customer expect the VM to be".
>>>
>>> However, we then added in an ERROR state.  How does this possibly make
>>> sense given the above definition?
>>
>> Where do you see that vm_state is intended to be "what the customer
>> expects the VM to be"?
>
>  From nova/compute/vm_states.py:
> 'vm_state describes a VM's current stable (not transition) state. That
> is, if there is no ongoing compute API calls (running tasks), vm_state
> should reflect what the customer expect the VM to be.'

Hmm, interesting wording. I wasn't aware of that wiki page and I'm not 
sure about the freshness of it, but I think what the language is saying 
is that if a user isn't actively running an action against the server, 
it should be in the last state a user put it in -- i.e. active, 
terminated, stopped, paused, etc.

> Also, from http://wiki.openstack.org/VMState:
> 'vm_state reflects the stable state based on API calls, matching user
> expectation, revised “top-down” within API implementation.'

Yeah, also awkward wording...

> Now granted, the wiki also says 'If the task fails and is not possible
> to rollback, the vm_state is set to ERROR.'  I don't particularly like
> that behaviour, which is why I'd like to see a separate "actual state".

If we had a task-based system, which is what I am advocating for, you 
would have a *task* (action) set to an ERROR state, not the VM itself. 
Which is what I was getting at... the task's history could tell the user 
what failed about the action, but the state of a VM could continue to 
be, for example, ACTIVE (or STOPPED or whatever). In the oscomputevnext 
proposal, I have an ERROR state for virt_state, but you are correct that 
it doesn't make sense to have one there if you have the history of the 
failure of an action in the task item history and ERROR isn't really a 
state of the virtual machine at all, just an operation against one.

>> I don't think this is all that useful. I think what would be more useful
>> is changing the Nova API to perform actions against an instance using a
>> POST /servers/{server_id}/tasks call, allow a user to see a history of
>> what actions were taken against an instance with a call to GET
>> /servers/{server_id}/tasks and allow a user to see the progress of a
>> particular task (say, a rebuild) by calling GET /tasks/{task_id}/items.
>
> Yep, I like that idea.  But I think it's orthogonal to the issue of
> desired vs actual state.  When you start a task it could change the
> "desired" state, and when the task completes the "actual" state should
> match the "expected state.

Not sure it's necessary to have a desired state on the instance (since 
that could be derived from the task history), but I see your point about 
it being orthogonal.

>> I proposed as much here:
>>
>> http://docs.oscomputevnext.apiary.io/#servertask
>
> Just curious, where is the equivalent of "evacuate"?

Evacuate is an operator API and IMO is not appropriate to live in the 
same API as the one used by regular users of a compute service.

Put another way: you don't see an evacuate host API in the EC2 API, do 
you? I guarantee there *is* such an API, but it's not in the public 
REST-ish EC2 API that you and I use and may not even be an HTTP API at all.

I talk a little bit more about my opinion on having operator API calls 
mixed into the same compute control API in my notes on GitHub here, if 
you're interested:

https://github.com/jaypipes/openstack-compute-api#operator-api-calls

>> http://docs.oscomputevnext.apiary.io/#servertaskitem
>>
>>> This would more easily allow for recovery actions, since if the actual
>>> state changes to ERROR (or similar) we would still have the
>>> expected/desired state available for reference when trying to take
>>> recovery actions.
>
> Where would the expected/desired state be stored?  Or is it implicit in
> the most recent task attempted for the instance in question?

Right, exactly, it would be implicity in the most recent task attempted.

>> I think a task-based API and internal system that uses taskflow to
>> organize related tasks with state machine changes is the best design to
>> work towards.
>
> I think something like this would certainly be an improvement over what
> we have now. That said, I don't see that as mutually exclusive with an
> explicit distinction between desired and actual state.  I think having
> "nova list" or the dashboard equivalent show both states would be useful.

Sure, fair point.
-jay



More information about the OpenStack-dev mailing list