[libvirt] [PATCHv2 1/7] interface: new public API for networkconfig change transactions

Christian Benvenuti (benve) benve at cisco.com
Thu May 19 22:15:20 UTC 2011


> -----Original Message-----
> From: libvir-list-bounces at redhat.com [mailto:libvir-list-
> bounces at redhat.com] On Behalf Of Laine Stump
> Sent: Thursday, May 19, 2011 1:51 PM
> To: libvir-list at redhat.com
> Subject: [libvirt] [PATCHv2 1/7] interface: new public API for
> networkconfig change transactions
> 
> From: Michal Privoznik <mprivozn at redhat.com>
> 
> This is the API agreed on in:
> 
>   https://www.redhat.com/archives/libvir-list/2011-May/msg00026.html
> 
> (with a slight name change to use "...begin" rather than
> "...start"). This implements transactional changes to the host network
> config. When a transaction is begun with ncf_change_begin(), all other
> netcf APIs will continue to work as they always have, but a snapshot
> of the existing config will be taken, allowing reversion (rollback,
> using ncf_change_rollback()) to the exact state of config at the time
> ncf_change_begin() was called. Alternately, if it's determined that
> the new changes are acceptable, ncf_change_commit() can be called,
> which will eliminate the snapshot and make the changes permanent.
> 
> As a failsafe measure, if neither ncf_change_commit() or
> ncf_change_rollback() is called by the next time the system reboots,
> the netcf-transaction initscript will be automatically called to
> rollback the changes.

Why do you think the default rollback (post reboot, for non-committed
transactions) is a good default?

When/where is that automatic rollback enforced? (I could not find it in
the patches). Does it trigger a log message too?

Do you think it may make sense to have that default behavior controlled
by
a (global, ie, not per-interface) parameter?

I am not suggesting the introduction of such parameter (but I would not
be against it), but I would suggest a 4th virsh command to list at
least the interfaces with a pending (ie, not committed yet) transaction.

/Christian

> ---
>  include/libvirt/libvirt.h.in |    7 +++++++
>  src/libvirt_public.syms      |    3 +++
>  2 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/include/libvirt/libvirt.h.in
> b/include/libvirt/libvirt.h.in
> index 7cd6e13..4a45390 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -1405,6 +1405,13 @@ int                     virInterfaceDestroy
> (virInterfacePtr iface,
>  int                     virInterfaceRef           (virInterfacePtr
> iface);
>  int                     virInterfaceFree          (virInterfacePtr
> iface);
> 
> +int                     virInterfaceChangeBegin   (virConnectPtr
conn,
> +                                                   unsigned int
> flags);
> +int                     virInterfaceChangeCommit  (virConnectPtr
conn,
> +                                                   unsigned int
> flags);
> +int                     virInterfaceChangeRollback(virConnectPtr
conn,
> +                                                   unsigned int
> flags);
> +
>  /**
>   * virStoragePool:
>   *
> diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
> index 0590535..f4f8262 100644
> --- a/src/libvirt_public.syms
> +++ b/src/libvirt_public.syms
> @@ -442,6 +442,9 @@ LIBVIRT_0.9.2 {
>          virDomainInjectNMI;
>          virDomainScreenshot;
>          virDomainSetSchedulerParametersFlags;
> +        virInterfaceChangeBegin;
> +        virInterfaceChangeCommit;
> +        virInterfaceChangeRollback;
>  } LIBVIRT_0.9.0;
> 
>  # .... define new API here using predicted next version number ....
> --
> 1.7.3.4
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list




More information about the libvir-list mailing list