[libvirt-users] Reboot, halt, poweroff called inside an lxc domain

Eric Blake eblake at redhat.com
Thu Aug 21 13:06:33 UTC 2014


On 08/21/2014 06:11 AM, Michal Witanowski wrote:
> Hi all,
> 
> Is there any possibility (using libvirt C API or whatever else) to
> "propagate" shutdown events (reboot, halt, power off) to a host? The API
> seems to lack this functionality - there exists function
> virConnectDomainEventRegisterAny, but the virDomainEventStoppedDetailType
> enum does not distinguish between these 3 different situations.

In the host, it's possible to register a domain lifecycle callback with
virConnectDomainEventRegisterAny(), and then if that callback is
triggered because the guest shut down, the host can take action such as
requesting a host shutdown.  You'd have to supply the callback that does
this (it would be a security issue if a guest action could shut down the
host by default, without the use of a callback installed specifically
for this reason).

> 
> Moreover, while rebooting a machine, an additional argument can be passed to
> reboot() syscall, which will be used by bootloader during the startup.
> Ideally, when calling e.g. "reboot recovery" inside an lxc container I'd
> like to be informed (inside host) that "reboot" was called with "recovery"
> as additional argument, so I can take appropriate actions.

Right now, this level of detail is not wired up.  However, the callback
signature does support a reason field, so you are welcome to write a
libvirt patch that adds a new reason field and figures how to wire a
guest recovery reboot into reporting a different reason than the default.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 539 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20140821/5faf39ae/attachment.sig>


More information about the libvirt-users mailing list