[libvirt] [PATCH] lxc: Fix virsh console doesn't work after restarting libvirtd
Daniel P. Berrange
berrange at redhat.com
Mon Jun 28 10:31:31 UTC 2010
On Sun, Jun 27, 2010 at 10:07:00PM +0900, Ryota Ozaki wrote:
> Because tty path is unexpectedly not saved in the live configuration
> file of a domain, libvirtd cannot get the console of the domain back
> after restarting.
>
> The reason why the tty path isn't saved is that, to save the tty path,
> the save function, virDomainSaveConfig, requires that the target domain
> is running (pid != -1), however, lxc driver calls the function before
> starting the domain to pass the configuration to controller.
>
> To ensure to save the tty path, the patch lets lxc driver call the save
> function again after starting the domain.
> ---
> src/lxc/lxc_driver.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
> index 19d4dcb..462bc9c 100644
> --- a/src/lxc/lxc_driver.c
> +++ b/src/lxc/lxc_driver.c
> @@ -1284,7 +1284,7 @@ static int lxcVmStart(virConnectPtr conn,
> if (lxcSetupInterfaces(conn, vm->def, &nveths, &veths) != 0)
> goto cleanup;
>
> - /* Persist the live configuration now we have veth & tty info */
> + /* Save the configuration for the controller */
> if (virDomainSaveConfig(driver->stateDir, vm->def) < 0)
> goto cleanup;
>
> @@ -1328,6 +1328,13 @@ static int lxcVmStart(virConnectPtr conn,
> goto cleanup;
> }
>
> + /*
> + * Again, need to save the live configuration, because the function
> + * requires vm->def->id != -1 to save tty info surely.
> + */
> + if (virDomainSaveConfig(driver->stateDir, vm->def) < 0)
> + goto cleanup;
> +
> rc = 0;
>
ACK
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list
mailing list