[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] Support reboots with the QEMU driver



At 06/17/2011 09:26 PM, Daniel P. Berrange Write:
> On Fri, Jun 17, 2011 at 10:52:03AM +0800, Wen Congyang wrote:
>> At 06/16/2011 01:06 AM, Daniel P. Berrange Write:
>>> +
>>> +
>>>  static int
>>>  qemuProcessHandleShutdown(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
>>>                            virDomainObjPtr vm)
>>>  {
>>> +    qemuDomainObjPrivatePtr priv = vm->privateData;
>>
>> I think we should get vm->privateData after we lock vm.
> 
> Yep, good point.
> 
>>
>>> +    VIR_DEBUG("vm=%p", vm);
>>> +
>>>      virDomainObjLock(vm);
>>> -    ((qemuDomainObjPrivatePtr) vm->privateData)->gotShutdown = true;
>>> +    priv->gotShutdown = true;
>>> +    if (priv->fakeReboot) {
>>> +        virDomainObjRef(vm);
>>> +        virThread th;
>>> +        if (virThreadCreate(&th,
>>> +                            false,
>>> +                            qemuProcessFakeReboot,
>>> +                            vm) < 0) {
>>> +            VIR_ERROR("Failed to create reboot thread, killing domain");
>>> +            qemuProcessKill(vm);
>>
>> We should hold an extra reference the vm here. If the vm is not persistent
>> and we destroy the vm before the thread runs, libvirtd may crash(I think, not test
>> it).
> 
> I'm already taking an extra reference just before starting the
> thread. I need to release that actually in virThreadCreate fails
> to run.

Ah, yes, you have already taken an extrareference.

Another question:
I reboot and migrate domain like this:
# virsh reboot vm1; virsh migrate vm1 --p2p qemu+tls://<dest host>/system

When the domain is migrated to the dested, it isnot rebooted, but shut down.

I think we should continue reboot after migration.

> 
>>
>>> +        }
>>> +    } else {
>>> +        qemuProcessKill(vm);
>>> +    }
>>>      virDomainObjUnlock(vm);
>>>  
>>>      return 0;
> 
> Daiel


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]