Re: [PATCH 2/2] Support virDomainAttachDevice and virDomainDetachDevice for disks in UML

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

 



2010/8/23  <soren@xxxxxxxxxxx>:
> From: Soren Hansen <soren@xxxxxxxxxxx>
>
> UML supports hot plugging and unplugging of various devices. This patch
> exposes this functionality for disks.
>
> Signed-off-by: Soren Hansen <soren@xxxxxxxxxxx>
> ---
>  src/uml/uml_driver.c |  239 +++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 235 insertions(+), 4 deletions(-)
>
> diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
> index 9cad7f1..a5c5d6a 100644
> --- a/src/uml/uml_driver.c
> +++ b/src/uml/uml_driver.c
> @@ -1683,6 +1683,237 @@ cleanup:
>  }
>
>
> +static int umlDomainAttachUmlDisk(struct uml_driver *driver,
> +                                  virDomainObjPtr vm,
> +                                  virDomainDiskDefPtr disk)
> +{
> +    int i, ret;
> +    char *cmd = NULL;
> +    char *reply = NULL;
> +
> +    for (i = 0 ; i < vm->def->ndisks ; i++) {
> +        if (STREQ(vm->def->disks[i]->dst, disk->dst)) {
> +            umlReportError(VIR_ERR_OPERATION_FAILED,
> +                           _("target %s already exists"), disk->dst);
> +            return -1;
> +        }
> +    }
> +
> +    if (!disk->src) {
> +        umlReportError(VIR_ERR_INTERNAL_ERROR,
> +                       "%s", _("disk source path is missing"));
> +        goto error;
> +    }
> +
> +    if (virAsprintf(&cmd, "config %s=%s", disk->dst, disk->src) < 0) {
> +        virReportOOMError();
> +        return -1;
> +    }
> +
> +    if (umlMonitorCommand(driver, vm, cmd, &reply) < 0)
> +        goto error;
> +
> +    if (VIR_REALLOC_N(vm->def->disks, vm->def->ndisks+1) < 0) {
> +        virReportOOMError();
> +        goto error;
> +    }
> +
> +    if (ret < 0)
> +        goto error;

I was about to push this patch, but compile testing gave this error:

uml/uml_driver.c: In function 'umlDomainAttachUmlDisk':
uml/uml_driver.c:1729: error: 'ret' may be used uninitialized in this
function [-Wuninitialized]

I think "if (ret < 0) goto error;" and "int ret;" can just be removed
completely from this function, but I would like have your ACK on this
before doing so.

Matthias

--
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]