mirror of
https://github.com/libvirt/libvirt.git
synced 2026-08-14 07:04:43 -05:00
src: add new APIs for marking a domain to autostart once
When a domain is marked for autostart, it will be started on every subsequent host OS boot. There may be times when it is desirable to mark a domain to be autostarted, on the next boot only. Thus we add virDomainSetAutostartOnce / virDomainGetAutostartOnce. An alternative would have been to overload the existing virDomainSetAutostart method, to accept values '1' or '2' for the autostart flag. This was not done because it is expected that language bindings will have mapped the current autostart flag to a boolean, and thus turning it into an enum would create a compatibility problem. A further alternative would have been to create a new method virDomainSetAutostartFlags, with a VIR_DOMAIN_AUTOSTART_ONCE flag defined. This was not done because it is felt desirable to clearly separate the two flags. Setting the "once" flag should not interfere with existing autostart setting, whether it is enabled or disabled currently. The 'virsh autostart' command, however, is still overloaded by just adding a --once flag, while current state is added to 'virsh dominfo'. No ability to filter by 'autostart once' status is added to the domain list APIs. The most common use of autostart once will be to automatically set it on host shutdown, and it be cleared on host startup. Thus there would rarely be scenarios in which a running app will need to filter on this new flag. Reviewed-by: Peter Krempa <pkrempa@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
@@ -2429,6 +2429,10 @@ int virDomainGetAutostart (virDomainPtr domain,
|
||||
int *autostart);
|
||||
int virDomainSetAutostart (virDomainPtr domain,
|
||||
int autostart);
|
||||
int virDomainGetAutostartOnce(virDomainPtr domain,
|
||||
int *autostart);
|
||||
int virDomainSetAutostartOnce(virDomainPtr domain,
|
||||
int autostart);
|
||||
|
||||
/**
|
||||
* virVcpuState:
|
||||
|
||||
Reference in New Issue
Block a user