RE: [PATCH] support for hotplug/hotunplug in test hypervisor

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

 



> -----Original Message-----
> From: Daniel P. Berrangé <berrange@xxxxxxxxxx>
> Sent: Friday, October 27, 2023 6:13 PM
> To: Thanos Makatos <thanos.makatos@xxxxxxxxxxx>
> Cc: devel@xxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH] support for hotplug/hotunplug in test hypervisor
> 
> On Fri, Oct 27, 2023 at 03:44:13PM +0000, Thanos Makatos wrote:
> > Signed-off-by: Thanos Makatos <thanos.makatos@xxxxxxxxxxx>
> > ---
> >  src/test/test_driver.c | 61
> ++++++++++++++++++++++++++++++++++++++++--
> >  1 file changed, 59 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> > index e87d7cfd44..6eda0dcc01 100644
> > --- a/src/test/test_driver.c
> > +++ b/src/test/test_driver.c
> > @@ -26,8 +26,6 @@
> >  #include <unistd.h>
> >  #include <sys/stat.h>
> >  #include <libxml/xmlsave.h>
> > -
> > -
> 
> Unrelated whitespace change.

Ack

> 
> >  #include "virerror.h"
> >  #include "datatypes.h"
> >  #include "test_driver.h"
> > @@ -10035,6 +10033,62 @@
> testConnectGetDomainCapabilities(virConnectPtr conn G_GNUC_UNUSED,
> >      return virDomainCapsFormat(domCaps);
> >  }
> >
> > +static int
> > +testVirDomainAttachDeviceFlags(virDomainPtr domain,
> > +                               const char *xml,
> > +                               unsigned int flags G_GNUC_UNUSED) {
> > +
> > +    int ret = -1;
> > +    virDomainObj *vm;
> > +    testDriver *driver;
> > +    virDomainDeviceDef *devConf;
> > +
> > +    if (!(vm = testDomObjFromDomain(domain)))
> > +        return -1;
> > +
> > +    driver = domain->conn->privateData;
> > +
> > +    if (!(devConf = virDomainDeviceDefParse(xml, vm->def, driver->xmlopt,
> > +                                            NULL, 0)))
> > +        goto out;
> > +
> > +    VIR_APPEND_ELEMENT(vm->def->hostdevs, vm->def->nhostdevs,
> > +            devConf->data.hostdev);
> 
> Aling 'devConf' with the '(' above it

Ack

> 
> > +    virDomainDeviceDefFree(devConf);
> > +    ret = 0;
> > +out:
> > +    virDomainObjEndAPI(&vm);
> > +    return ret;
> > +}
> > +
> > +static int
> > +testVirDomainAttachDevice(virDomainPtr domain, const char *xml)
> > +{
> > +    return testVirDomainAttachDeviceFlags(domain, xml, 0);
> > +}
> > +
> > +static int
> > +testVirDomainDetachDeviceAlias(virDomainPtr domain,
> > +                           const char *alias,
> > +                           unsigned int flags __attribute__((unused)))
> 
> Horizontal alignemtn is off, and also needs to be G_GNUC_UNUSED
> like the earlier method.

Ack

> 
> > +{
> > +    virDomainObj *vm;
> > +    int i;
> 
> size_t for loop iterators please.

Ack

> 
> > +    bool found = false;
> > +
> > +    if (!(vm = testDomObjFromDomain(domain)))
> > +        return -1;
> > +
> > +    for (i = 0; i < vm->def->nhostdevs && !found; i++) {
> > +        if (!strcmp(vm->def->hostdevs[i]->info->alias, alias)) {
> > +            virDomainHostdevDefFree(vm->def->hostdevs[i]);
> > +            VIR_DELETE_ELEMENT(vm->def->hostdevs, i, vm->def->nhostdevs);
> > +            found = true;
> > +        }
> > +    }
> > +    virDomainObjEndAPI(&vm);
> > +    return found ? 0 : -1;
> > +}
> >
> >  /*
> >   * Test driver
> > @@ -10058,6 +10112,9 @@ static virHypervisorDriver testHypervisorDriver =
> {
> >      .connectListDomains = testConnectListDomains, /* 0.1.1 */
> >      .connectNumOfDomains = testConnectNumOfDomains, /* 0.1.1 */
> >      .connectListAllDomains = testConnectListAllDomains, /* 0.9.13 */
> > +    .domainAttachDevice = testVirDomainAttachDevice, /* 9.9.0 */
> > +    .domainAttachDeviceFlags = testVirDomainAttachDeviceFlags, /* 9.9.0 */
> > +    .domainDetachDeviceAlias = testVirDomainDetachDeviceAlias, /* 9.9.0 */
> >      .domainCreateXML = testDomainCreateXML, /* 0.1.4 */
> >      .domainCreateXMLWithFiles = testDomainCreateXMLWithFiles, /* 5.7.0 */
> >      .domainLookupByID = testDomainLookupByID, /* 0.1.1 */
> > --
> > 2.27.0
> >
> 
> With regards,
> Daniel
> --
> |: https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__berrange.com&d=DwIBaQ&c=s883GpUCOChKOHiocYtGcg&r=XTpYsh5Ps2zJ
> vtw6ogtti46atk736SI4vgsJiUKIyDE&m=7tOGBG0mrTLgztzu23pWZjCQpfdKbv7cV
> ilnYobvnzJSHk-
> m3fVMonE71FEjfJUc&s=MKxz2dbrxpoqVQEKrR1rIHTDNh3TQzk6j9ILpLJO4eI&e
> =       -o-    https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__www.flickr.com_photos_dberrange&d=DwIBaQ&c=s883GpUCOChKOHiocYt
> Gcg&r=XTpYsh5Ps2zJvtw6ogtti46atk736SI4vgsJiUKIyDE&m=7tOGBG0mrTLgztzu
> 23pWZjCQpfdKbv7cVilnYobvnzJSHk-m3fVMonE71FEjfJUc&s=yYyWxbabM-
> x_RY69yLXObz2p8wo1OAy4DioA0YScDYc&e=  :|
> |: https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__libvirt.org&d=DwIBaQ&c=s883GpUCOChKOHiocYtGcg&r=XTpYsh5Ps2zJvtw
> 6ogtti46atk736SI4vgsJiUKIyDE&m=7tOGBG0mrTLgztzu23pWZjCQpfdKbv7cVilnY
> obvnzJSHk-
> m3fVMonE71FEjfJUc&s=YVwYpdMFSWcMfQ2sM9QgKFheo9Dxq8s4_sFI0KfGqu
> o&e=          -o-            https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__fstop138.berrange.com&d=DwIBaQ&c=s883GpUCOChKOHiocYtGcg&r=XTp
> Ysh5Ps2zJvtw6ogtti46atk736SI4vgsJiUKIyDE&m=7tOGBG0mrTLgztzu23pWZjCQ
> pfdKbv7cVilnYobvnzJSHk-m3fVMonE71FEjfJUc&s=-
> C8ZIdR8IJmdjdVJljDjhjVC4UiJcAeuiWQ-B_dV4wM&e=  :|
> |: https://urldefense.proofpoint.com/v2/url?u=https-3A__entangle-
> 2Dphoto.org&d=DwIBaQ&c=s883GpUCOChKOHiocYtGcg&r=XTpYsh5Ps2zJvtw6o
> gtti46atk736SI4vgsJiUKIyDE&m=7tOGBG0mrTLgztzu23pWZjCQpfdKbv7cVilnYob
> vnzJSHk-
> m3fVMonE71FEjfJUc&s=BgvlBMRgX56LJG0ZSE02GviPHpVTcQ_Nx1N3aEWk9d4
> &e=     -o-    https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__www.instagram.com_dberrange&d=DwIBaQ&c=s883GpUCOChKOHiocYtGc
> g&r=XTpYsh5Ps2zJvtw6ogtti46atk736SI4vgsJiUKIyDE&m=7tOGBG0mrTLgztzu23
> pWZjCQpfdKbv7cVilnYobvnzJSHk-m3fVMonE71FEjfJUc&s=g23VsTOOhoOdgm-
> cJyiOixKvywYEQXh-L7sRK8YPm90&e=  :|





[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