Re: [PATCH v2 1/6] test_driver: implement virDomainAttachDeviceFlags

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

 



...

> +
> +    if (operation == TEST_DEVICE_DETACH)
> +        parse_flags |= VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE;

^This should be added by patch 3/5

> +
> +    if (xml) {
> +        if (!(dev = virDomainDeviceDefParse(xml, def,
> +                                            driver->caps, driver->xmlopt,
> +                                            NULL, parse_flags)))
> +            goto cleanup;
> +    } else if (alias) {
> +        if (VIR_ALLOC(dev) < 0 || virDomainDefFindDevice(def, alias, dev, true) < 0)
> +            goto cleanup;
> +    }
> +
> +    switch (operation) {
> +    case TEST_DEVICE_ATTACH:
> +        if (testDomainAttachDeviceLiveAndConfig(def, dev) < 0)
> +            goto cleanup;
> +        break;
> +    case TEST_DEVICE_DETACH:
> +        break;
> +    case TEST_DEVICE_UPDATE:
> +        break;
> +    }
> +
> +    ret = 0;
> + cleanup:
> +    if (xml)
> +        virDomainDeviceDefFree(dev);
> +    else
> +        VIR_FREE(dev);

virDomainDeviceDefFree() can handle both cases.

Reviewed-by: Erik Skultety <eskultet@xxxxxxxxxx>

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

  Powered by Linux