Mailing List Archive

Re: Need some help with 'suspended' state
Jim,

Please find attached a patch against 14881 to fix this problem.
State should now accurately reflect the real state of a VM. I'm
currently doing tests / regressions on this patch before I commit,
but if all goes okay it should be in unstable today.

Cheers

Tom


On 10 Apr 2007, at 11:23, Ewan Mellor wrote:

>
> From: Jim Fehlig <jfehlig@novell.com>
> Date: 8 March 2007 00:19:53 GMT
> To: Ewan Mellor <ewan@xensource.com>
> Cc: Gareth S Bestor <bestorga@us.ibm.com>, "Subrahmanian, Raj"
> <raj.subrahmanian@unisys.com>
> Subject: Need some help with 'suspended' state
>
>
> Ewan,
>
> I'm having problems resuming a domain after invoking VM.suspend via
> CIM
> providers. Problem is in CIM world you move a vm from suspended to
> active by calling RequestStateChange method on the vm. One also
> moves a
> vm from paused to active and inactive to active using the same method
> with same parameter value. So in the Xen CIM providers I first get vm
> record and then call appropriate VM.resume, VM.unpause, or VM.start
> depending on VM.power_state. But VM.power_state == HALTED for a vm
> just
> suspended - thus provider calls VM.start :-(.
>
> This appears to be the case in xen-unstable as well. In fact,
> domain_resume in XendDomain.py checks that vm is halted:
>
> if dominfo.state != DOM_STATE_HALTED:
> raise XendError("Cannot resume domain that is not
> halted.")
>
> which obviously needs to change once state of suspended is properly
> reflected.
>
> In need to get this working properly in SP1 tools stack but after
> spending some time playing with the code I have not arrived at a
> solution. As you can see in the attached xend.log snippet,
> refreshShutdown in XendDomainInfo is called several times during
> execution of 'xm suspend dom'. On the last call, we set state of
> domain
> to SHUTDOWN and then follow this with setting state to HALTED in
> cleanupDomain. I'm not even sure if the fact that this domain is
> being
> suspended is known and available within this last call to
> cleanupDomain. Any thoughts on how I can get to a VM.power_state of
> suspended from here?
>
> Thanks,
> Jim
> [2007-03-07 17:10:18 xend 6463] DEBUG (XendCheckpoint:80)
> [xc_save]: /usr/lib/xen/bin/xc_save 20 4 0 0 0
> [2007-03-07 17:10:18 xend.XendDomainInfo 6463] DEBUG
> (XendDomainInfo:788) Storing domain details: {'console/ring-ref':
> '276658', 'console/port': '2', 'name': 'migrating-sles10-1',
> 'console/limit': '1048576', 'vm': '/vm/2f5f5e84-
> e695-904c-79b3-2695fe5226d0', 'domid': '4', 'cpu/0/availability':
> 'online', 'memory/target': '524288', 'store/ring-ref': '276659',
> 'store/port': '1'}
> [2007-03-07 17:10:18 xend 6463] DEBUG (XendCheckpoint:218) suspend
> [2007-03-07 17:10:18 xend 6463] DEBUG (XendCheckpoint:83) In
> saveInputHandler suspend
> [2007-03-07 17:10:18 xend 6463] DEBUG (XendCheckpoint:85)
> Suspending 4 ...
> [2007-03-07 17:10:18 xend.XendDomainInfo 6463] DEBUG
> (XendDomainInfo:421) XendDomainInfo.shutdown
> [2007-03-07 17:10:18 xend.XendDomainInfo 6463] DEBUG
> (XendDomainInfo:855) XendDomainInfo.handleShutdownWatch
> [2007-03-07 17:10:18 xend.XendDomainInfo 6463] DEBUG
> (XendDomainInfo:855) XendDomainInfo.handleShutdownWatch
> [2007-03-07 17:10:18 xend.XendDomainInfo 6463] WARNING
> (XendDomainInfo:1059) ##### refreshShutdown: calling _stateSet
> (DOM_STATE_RUNNING)
> [2007-03-07 17:10:18 xend.XendDomainInfo 6463] WARNING
> (XendDomainInfo:1813) ##### _stateSet: state = 2
> [2007-03-07 17:10:18 xend.XendDomainInfo 6463] WARNING
> (XendDomainInfo:1019) ##### refreshShutdown: calling _stateSet
> (DOM_STATE_SHUTDOWN)
> [2007-03-07 17:10:18 xend.XendDomainInfo 6463] WARNING
> (XendDomainInfo:1813) ##### _stateSet: state = 4
> [2007-03-07 17:10:18 xend 6463] INFO (XendCheckpoint:90) Domain 4
> suspended.
> [2007-03-07 17:10:18 xend 6463] DEBUG (XendCheckpoint:95) Written done
> [2007-03-07 17:10:18 xend.XendDomainInfo 6463] INFO (XendDomainInfo:
> 1030) Domain has shutdown: name=migrating-sles10-1 id=4
> reason=suspend.
> [2007-03-07 17:10:18 xend 6463] INFO (XendCheckpoint:247) Had 0
> unexplained entries in p2m table
> [2007-03-07 17:10:18 xend.XendDomainInfo 6463] WARNING
> (XendDomainInfo:1035) ##### refreshShutdown: calling _stateSet
> (DOM_STATE_SUSPENDED)
> [2007-03-07 17:10:18 xend.XendDomainInfo 6463] WARNING
> (XendDomainInfo:1813) ##### _stateSet: state = 3
> 1: sent 131072, skipped 0, delta 5126ms, dom0 6%, target 0%, sent
> 837Mb/s, dirtied 785Mb/s -1208885260 pages
> [2007-03-07 17:10:23 xend 6463] INFO (XendCheckpoint:247) Total
> pages sent= 131072 (0.98x)
> [2007-03-07 17:10:23 xend 6463] INFO (XendCheckpoint:247) (of which
> 0 were fixups)
> [2007-03-07 17:10:23 xend 6463] INFO (XendCheckpoint:247) All
> memory is saved
> [2007-03-07 17:10:23 xend 6463] INFO (XendCheckpoint:247) Save exit
> rc=0
> [2007-03-07 17:10:23 xend.XendDomainInfo 6463] DEBUG
> (XendDomainInfo:1565) XendDomainInfo.destroyDomain(4)
> [2007-03-07 17:10:23 xend.XendDomainInfo 6463] WARNING
> (XendDomainInfo:1059) ##### refreshShutdown: calling _stateSet
> (DOM_STATE_RUNNING)
> [2007-03-07 17:10:23 xend.XendDomainInfo 6463] WARNING
> (XendDomainInfo:1813) ##### _stateSet: state = 2
> [2007-03-07 17:10:25 xend.XendDomainInfo 6463] WARNING
> (XendDomainInfo:1499) ##### cleanupDomain: calling _stateSet HALTED
> [2007-03-07 17:10:25 xend.XendDomainInfo 6463] WARNING
> (XendDomainInfo:1813) ##### _stateSet: state = 0
> [2007-03-07 17:10:25 xend.XendDomainInfo 6463] WARNING
> (XendDomainInfo:1499) ##### cleanupDomain: calling _stateSet HALTED
> [2007-03-07 17:10:25 xend.XendDomainInfo 6463] WARNING
> (XendDomainInfo:1813) ##### _stateSet: state = 0
> [2007-03-07 17:10:25 xend.XendDomainInfo 6463] WARNING
> (XendDomainInfo:998) ##### refreshShutdown: calling _stateSet
> (DOM_STATE_SHUTDOWN)
> [2007-03-07 17:10:25 xend.XendDomainInfo 6463] WARNING
> (XendDomainInfo:1813) ##### _stateSet: state = 4
> [2007-03-07 17:10:25 xend.XendDomainInfo 6463] WARNING
> (XendDomainInfo:1499) ##### cleanupDomain: calling _stateSet HALTED
> [2007-03-07 17:10:25 xend.XendDomainInfo 6463] WARNING
> (XendDomainInfo:1813) ##### _stateSet: state = 0
>
>
>