Re: [libvirt] PATCH: 6/7: Persist live domain config across restarts

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

 



"Daniel P. Berrange" <berrange@xxxxxxxxxx> wrote:
> Internally the drivers track the current live configuration, and the new
> inactive config for running domains. When the libvirtd process is restarted
> though, this data is lost for any active LXC domains. This patch makes the
> LXC driver persist the live config to /var/run/libvirt/lxc/NAME.xml so it
> can be tracked across restarts
>
> It required a small change to the domain XML APis to make the autostart
> symlink processing optional when deleting a config file
...

Looks fine to me.
ACK

> diff -r cf1cf3a1d4d6 src/lxc_driver.c
> --- a/src/lxc_driver.c	Tue Aug 05 16:50:51 2008 +0100
> +++ b/src/lxc_driver.c	Tue Aug 05 16:50:59 2008 +0100
...
> @@ -960,6 +973,8 @@
>
>      vm = lxc_driver->domains;
>      while (vm) {
> +        char *config = NULL;
> +        virDomainDefPtr tmp;

The initialization of config looks unnecessary.

The only other change I'd make would be to move both declarations "down"
to first use.  Then the context-challenged reader doesn't have to wonder
what, if anything, happens to those variables between declaration and
first use.

>          int rc;
>          if ((vm->monitor = lxcMonitorClient(NULL, lxc_driver, vm)) < 0) {
>              vm = vm->next;
> @@ -972,6 +987,18 @@
>              vm->monitor = -1;
>              vm = vm->next;
>              continue;
> +        }
> +

           char *config;

> +        if (asprintf(&config, "%s/%s.xml",
> +                     lxc_driver->stateDir, vm->def->name) < 0)
> +            continue;
> +
> +        /* Try and load the live config */
> +        tmp = virDomainDefParseFile(NULL, lxc_driver->caps, config);

           virDomainDefPtr tmp = virDomainDefParseFile(NULL, lxc_driver->caps,
                                                       config);

> +        VIR_FREE(config);
> +        if (tmp) {
> +            vm->newDef = vm->def;
> +            vm->def = tmp;
>          }
>
>          if (vm->pid != 0) {

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]