[libvirt] [PATCH 4/5] save domain status during vm creation and remove it on shutdown.
David Lutterkort
lutter at redhat.com
Fri Dec 12 19:37:24 UTC 2008
On Fri, 2008-12-12 at 19:27 +0100, Guido Günther wrote:
> diff --git a/src/qemu_driver.c b/src/qemu_driver.c
> index 7804094..d8b87e4 100644
> --- a/src/qemu_driver.c
> +++ b/src/qemu_driver.c
> @@ -182,6 +182,44 @@ qemudAutostartConfigs(struct qemud_driver *driver) {
> virConnectClose(conn);
> }
>
> +
> +/**
> + * qemudRemoveDomainStatus
> + *
> + * remove all state files of a domain from statedir
> + *
> + * Returns 0 on success
> + */
> +static int
> +qemudRemoveDomainStatus(virConnectPtr conn,
> + struct qemud_driver *driver,
> + virDomainObjPtr vm)
> +{
> + int rc = -1;
> + char *file = NULL;
> +
> + if (asprintf(&file, "%s/%s.xml", driver->stateDir, vm->def->name) < 0) {
> + qemudReportError(conn, vm, NULL, VIR_ERR_NO_MEMORY,
> + "%s", _("failed to allocate space for status file"));
> + goto cleanup;
> + }
This needs to set file = NULL on error. (Praise the joy that is
asprintf)
David
More information about the libvir-list
mailing list