Re: [libvirt] [libvirt-python PATCH 0/2] Rename IOThreads* APIs to IOThread
On Fri, Mar 27, 2015 at 05:39:18PM -0400, John Ferlan wrote: > > > On 03/26/2015 08:43 AM, Ján Tomko wrote: > > These depend on the rename being pushed to libvirt.git: > > (first four patches of:) > > https://www.redhat.com/archives/libvir-list/2015-March/msg01325.html > > > > Ján Tomko (2): > > Rename virDomainIOThreadsInfoFree to virDomainIOThreadInfoFree > > Rename virDomainGetIOThreadsInfo to virDomainGetIOThreadInfo > > > > generator.py | 6 +++--- > > libvirt-override-api.xml | 2 +- > > libvirt-override.c | 12 ++-- > > sanitytest.py| 6 +++--- > > 4 files changed, 13 insertions(+), 13 deletions(-) > > > > ACK - although you won't be able to build/test this validate until > Pavel's changes are in for virDomainInterfacesAddresses... > Thanks, I applied the patch locally and the ioThreadInfo API works for me. Now pushed. Jan signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 2/7] internal: introduce macro helpers to check flag requirements
On Fri, Mar 27, 2015 at 11:13:07AM -0500, Jeff Nelson wrote: > On Fri, Mar 27, 2015 at 11:01:23AM +0100, Pavel Hrdina wrote: > > Similar to VIR_EXLUSIVE_FLAGS, it will error out if flag requirement is > > not met. > > > > Signed-off-by: Pavel Hrdina > > --- > > src/internal.h | 43 +++ > > 1 file changed, 43 insertions(+) > > > > diff --git a/src/internal.h b/src/internal.h > > index eb8d231..6363e58 100644 > > --- a/src/internal.h > > +++ b/src/internal.h > > @@ -371,6 +371,49 @@ > > goto LABEL; > > \ > > } > > > > +/* Macros to help dealing with flag requirements. */ > > + > > +/** > > + * VIR_REQUIRE_FLAG_RET: > > + * > > + * @FLAG1: First flag to be checked. > > + * @FLAG2: Second flag that is required by first flag. > > + * @RET: Return value. > > + * > > + * Check whether required flag is set. The checked flags are compared > > + * with flags variable. > > + * > > + * This helper does an early return and therefore it has to be called > > + * before anything that would require cleanup. > > + */ > > +# define VIR_REQUIRE_FLAG_RET(FLAG1, FLAG2, RET) > > \ > > +if ((flags & FLAG1) && !(flags & FLAG2)) { > > \ > > +virReportInvalidArg(ctl, > > \ > > +_("Flag '%s' is required by flag '%s'"), > > \ > > +#FLAG2, #FLAG1); > > \ > > +return RET; > > \ > > +} > > + > > I recommend encapsulating this within a "do { ... } while (1)" Oops. "while(0)", not "while (1)". -Jeff > statement. The problem is that the macro hides/exposes an -if- > statement to which an -else- keyword can be bound: > > if (something) > VIR_REQUIRE_FLAG_RET(f1, f2, foo) > else // matches with -if- inside VIR_REQUIRE_FLAG_RET > // doesn't execute when you think it does > > Note that other macros (see definition of virCheckNonNullArgReturn > below) follow this practice. > > > +/** > > + * VIR_REQUIRE_FLAG_GOTO: > > + * > > + * @FLAG1: First flag to be checked. > > + * @FLAG2: Second flag that is required by first flag. > > + * @LABEL: Label to jump to. > > + * > > + * Check whether required flag is set. The checked flags are compared > > + * with flags variable. > > + * > > + * Returns nothing. Jumps to a label if required flag is not set. > > + */ > > +# define VIR_REQUIRE_FLAG_GOTO(FLAG1, FLAG2, LABEL) > > \ > > +if ((flags & FLAG1) && !(flags & FLAG2)) { > > \ > > +virReportInvalidArg(ctl, > > \ > > +_("Flag '%s' is required by flag '%s'"), > > \ > > +#FLAG2, #FLAG1); > > \ > > +goto LABEL; > > \ > > +} > > + > > Same feedback as above. > > -Jeff > > > # define virCheckNonNullArgReturn(argname, retval) \ > > do {\ > > if (argname == NULL) { \ > > -- > > 2.0.5 > > > > -- > > libvir-list mailing list > > libvir-list@redhat.com > > https://www.redhat.com/mailman/listinfo/libvir-list > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/1] vircgroup: Fix build issue mingw cross compile
On 03/27/2015 10:41 AM, John Ferlan wrote: > Commit id '2dbfa716' exposed virCgroupDetectMountsFromFile, but did not > add the corresponding entry in the "#else /* !VIR_CGROUP_SUPPORTED */" > section of the module. > > Signed-off-by: John Ferlan > --- > src/util/vircgroup.c | 11 +++ > 1 file changed, 11 insertions(+) ACK for helping the issue. These two patches together fixed the build for me. Okay to leave them as separate patches, since they fix problems introduced by different commits (and therefore might be backported at different times). But with this fixed, another build issue surfaces: ../../tools/virsh-domain-monitor.c: In function 'cmdDomIfAddr': ../../tools/virsh-domain-monitor.c:2233:17: error: expected identifier or '(' before 'struct' const char *interface = NULL; ^ 'interface' is one of those black-listed terms that we should never use in our code (because mingw headers pollute the namespace); we use 'iface' elsewhere. We should really add a syntax check to avoid re-introducing it all the time... -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 2/7] internal: introduce macro helpers to check flag requirements
On Fri, Mar 27, 2015 at 11:01:23AM +0100, Pavel Hrdina wrote: > Similar to VIR_EXLUSIVE_FLAGS, it will error out if flag requirement is > not met. > > Signed-off-by: Pavel Hrdina > --- > src/internal.h | 43 +++ > 1 file changed, 43 insertions(+) > > diff --git a/src/internal.h b/src/internal.h > index eb8d231..6363e58 100644 > --- a/src/internal.h > +++ b/src/internal.h > @@ -371,6 +371,49 @@ > goto LABEL; \ > } > > +/* Macros to help dealing with flag requirements. */ > + > +/** > + * VIR_REQUIRE_FLAG_RET: > + * > + * @FLAG1: First flag to be checked. > + * @FLAG2: Second flag that is required by first flag. > + * @RET: Return value. > + * > + * Check whether required flag is set. The checked flags are compared > + * with flags variable. > + * > + * This helper does an early return and therefore it has to be called > + * before anything that would require cleanup. > + */ > +# define VIR_REQUIRE_FLAG_RET(FLAG1, FLAG2, RET)\ > +if ((flags & FLAG1) && !(flags & FLAG2)) { \ > +virReportInvalidArg(ctl,\ > +_("Flag '%s' is required by flag '%s'"),\ > +#FLAG2, #FLAG1);\ > +return RET; \ > +} > + I recommend encapsulating this within a "do { ... } while (1)" statement. The problem is that the macro hides/exposes an -if- statement to which an -else- keyword can be bound: if (something) VIR_REQUIRE_FLAG_RET(f1, f2, foo) else // matches with -if- inside VIR_REQUIRE_FLAG_RET // doesn't execute when you think it does Note that other macros (see definition of virCheckNonNullArgReturn below) follow this practice. > +/** > + * VIR_REQUIRE_FLAG_GOTO: > + * > + * @FLAG1: First flag to be checked. > + * @FLAG2: Second flag that is required by first flag. > + * @LABEL: Label to jump to. > + * > + * Check whether required flag is set. The checked flags are compared > + * with flags variable. > + * > + * Returns nothing. Jumps to a label if required flag is not set. > + */ > +# define VIR_REQUIRE_FLAG_GOTO(FLAG1, FLAG2, LABEL) \ > +if ((flags & FLAG1) && !(flags & FLAG2)) { \ > +virReportInvalidArg(ctl,\ > +_("Flag '%s' is required by flag '%s'"),\ > +#FLAG2, #FLAG1);\ > +goto LABEL; \ > +} > + Same feedback as above. -Jeff > # define virCheckNonNullArgReturn(argname, retval) \ > do {\ > if (argname == NULL) { \ > -- > 2.0.5 > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] Instances
I'm running libvirt with qemu-kvm underneath. My network stack has the eth0 interface which is bridged to a br0 interface. Usually, when a VM starts up, a new "vnet" interface is created as well by libvirt. That vnet interface has a matching HWaddr to the VM that was spun up with it, so I'm assuming they're associated somehow. Sometimes, after using libvirt's "virt-install" to create a VM, I'm unable to "virsh start" it. Virsh will print this out to stderr that it couldn't start that VM, since the connection was "Reset by peer". I've yet to find a repro case for this issue. Eventually, I am able to "virsh start" the instance, but only after several minutes. Are there any known issues with libvirt/qemu-kvm failing to instantiate network devices when it spins up VMs? This is printed to the logs as well: Mar 27 16:21:07 localhost kernel: device vnet42 entered promiscuous mode Mar 27 16:21:07 localhost kernel: br0: port 44(vnet42) entering forwarding state Mar 27 16:21:07 localhost logger: KVM: 43 guests now active Mar 27 16:21:08 localhost kernel: br0: port 44(vnet42) entering disabled state Mar 27 16:21:08 localhost kernel: device vnet42 left promiscuous mode Mar 27 16:21:08 localhost kernel: br0: port 44(vnet42) entering disabled state Mar 27 16:21:08 localhost logger: KVM: 42 guests now active -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 1/7] internal: introduce macro helpers to reject exclusive flags
On Fri, Mar 27, 2015 at 11:01:22AM +0100, Pavel Hrdina wrote: > Inspired by commit 7e437ee7 that introduced similar macros for virsh > commands so we don't have to repeat the same code all over. > > Signed-off-by: Pavel Hrdina > --- > src/internal.h | 44 > 1 file changed, 44 insertions(+) > > diff --git a/src/internal.h b/src/internal.h > index 4d473af..eb8d231 100644 > --- a/src/internal.h > +++ b/src/internal.h > @@ -327,6 +327,50 @@ > } \ > } while (0) > > +/* Macros to help dealing with mutually exclusive flags. */ > + > +/** > + * VIR_EXCLUSIVE_FLAGS_RET: > + * > + * @FLAG1: First flag to be checked. > + * @FLAG2: Second flag to be checked. > + * @RET: Return value. > + * > + * Reject mutually exclusive API flags. The checked flags are compared > + * with flags variable. > + * > + * This helper does an early return and therefore it has to be called > + * before anything that would require cleanup. > + */ > +# define VIR_EXCLUSIVE_FLAGS_RET(FLAG1, FLAG2, RET) \ > +if ((flags & FLAG1) && (flags & FLAG2)) { \ > +virReportInvalidArg(ctl,\ > +_("Flags '%s' and '%s' are mutually exclusive"),\ > +#FLAG1, #FLAG2);\ > +return RET; \ > +} Please encapsulate within a "do { ... } while(0)" statement. You've left an -if- statement hidden within the macro definition; the next -else- to come along will be matched to it: if (fred) VIR_EXCLUSIVE_FLAGS_GOTO(a,b,c) else // matches -if- *inside* macro // doesn't execute when you think it does > + > +/** > + * VIR_EXCLUSIVE_FLAGS_GOTO: > + * > + * @FLAG1: First flag to be checked. > + * @FLAG2: Second flag to be checked. > + * @LABEL: Label to jump to. > + * > + * Reject mutually exclusive API flags. The checked flags are compared > + * with flags variable. > + * > + * Returns nothing. Jumps to a label if unsupported flags were > + * passed to it. > + */ > +# define VIR_EXCLUSIVE_FLAGS_GOTO(FLAG1, FLAG2, LABEL) \ > +if ((flags & FLAG1) && (flags & FLAG2)) { \ > +virReportInvalidArg(ctl,\ > +_("Flags '%s' and '%s' are mutually exclusive"),\ > +#FLAG1, #FLAG2);\ > +goto LABEL; \ > +} > + Same feedback as above. Note the macro definition below does this properly. -Jeff > # define virCheckNonNullArgReturn(argname, retval) \ > do {\ > if (argname == NULL) { \ > -- > 2.0.5 > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 6/7] virsh: introduce new macros to help check flag requirements
On Fri, Mar 27, 2015 at 11:01:27AM +0100, Pavel Hrdina wrote: > Signed-off-by: Pavel Hrdina > --- > tools/virsh.h | 52 > 1 file changed, 52 insertions(+) > > diff --git a/tools/virsh.h b/tools/virsh.h > index df2ea7f..fde20ef 100644 > --- a/tools/virsh.h > +++ b/tools/virsh.h > @@ -474,4 +474,56 @@ char *_vshStrdup(vshControl *ctl, const char *s, const > char *filename, > # define VSH_EXCLUSIVE_OPTIONS_VAR(VARNAME1, VARNAME2) \ > VSH_EXCLUSIVE_OPTIONS_EXPR(#VARNAME1, VARNAME1, #VARNAME2, VARNAME2) > > +/* Macros to help dealing with required options. */ > + > +/* VSH_REQUIRE_OPTION_EXPR: > + * > + * @NAME1: String containing the name of the option. > + * @EXPR1: Expression to validate the variable (boolean variable). > + * @NAME2: String containing the name of required option. > + * @EXPR2: Expression to validate the variable (boolean variable). > + * > + * Check if required command options in virsh was set. Use the > + * provided expression to check the variables. > + * > + * This helper does an early return and therefore it has to be called > + * before anything that would require cleanup. > + */ > +# define VSH_REQUIRE_OPTION_EXPR(NAME1, EXPR1, NAME2, EXPR2)\ > +if ((EXPR1) && !(EXPR2)) { \ > +vshError(ctl, _("Option --%s is required by option --%s"), \ > + NAME2, NAME1); \ > +return false; \ > +} It would be better to protect this within a "do { ... } while (0)" statement. -Jeff > + > +/* VSH_REQUIRE_OPTION: > + * > + * @NAME1: String containing the name of the option. > + * @NAME2: String containing the name of required option. > + * > + * Check if required command options in virsh was set. Use the > + * vshCommandOptBool call to request them. > + * > + * This helper does an early return and therefore it has to be called > + * before anything that would require cleanup. > + */ > +# define VSH_REQUIRE_OPTION(NAME1, NAME2) \ > +VSH_REQUIRE_OPTION_EXPR(NAME1, vshCommandOptBool(cmd, NAME1), \ > +NAME2, vshCommandOptBool(cmd, NAME2)) > + > +/* VSH_REQUIRE_OPTION_VAR: > + * > + * @VARNAME1: Boolean variable containing the value of the option of same > name. > + * @VARNAME2: Boolean variable containing the value of required option of > + *same name. > + * > + * Check if required command options in virsh was set. Check in variables > + * that contain the value and have same name as the option. > + * > + * This helper does an early return and therefore it has to be called > + * before anything that would require cleanup. > + */ > +# define VSH_REQUIRE_OPTION_VAR(VARNAME1, VARNAME2) \ > +VSH_REQUIRE_OPTION_EXPR(#VARNAME1, VARNAME1, #VARNAME2, VARNAME2) > + > #endif /* VIRSH_H */ > -- > 2.0.5 > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-python PATCH 0/2] Rename IOThreads* APIs to IOThread
On 03/26/2015 08:43 AM, Ján Tomko wrote: > These depend on the rename being pushed to libvirt.git: > (first four patches of:) > https://www.redhat.com/archives/libvir-list/2015-March/msg01325.html > > Ján Tomko (2): > Rename virDomainIOThreadsInfoFree to virDomainIOThreadInfoFree > Rename virDomainGetIOThreadsInfo to virDomainGetIOThreadInfo > > generator.py | 6 +++--- > libvirt-override-api.xml | 2 +- > libvirt-override.c | 12 ++-- > sanitytest.py| 6 +++--- > 4 files changed, 13 insertions(+), 13 deletions(-) > ACK - although you won't be able to build/test this validate until Pavel's changes are in for virDomainInterfacesAddresses... John -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-python PATCH v12] Expose virDomainInterfacesAddresses to python binding
On 03/19/2015 09:15 AM, Pavel Hrdina wrote: > From: Nehal J Wani > > examples/Makefile.am: > * Add new file domipaddrs.py > > examples/README: > * Add documentation for the python example > > libvirt-override-api.xml: > * Add new symbol for virDomainInterfacesAddresses > > libvirt-override.c: > * Hand written python api > > Example: > $ python examples/domipaddrs.py qemu:///system f18 > Interface MAC address Protocol Address > vnet0 52:54:00:20:70:3dipv4 192.168.105.240/16 > > In v11: > - Cope with hwaddr being NULL by filling in PY_NONE > > Signed-off-by: Pavel Hrdina > --- > MANIFEST.in | 1 + > examples/README | 1 + > examples/domipaddrs.py | 57 + > generator.py | 2 + > libvirt-override-api.xml | 7 +++ > libvirt-override.c | 128 > +++ > sanitytest.py| 3 ++ > 7 files changed, 199 insertions(+) > create mode 100755 examples/domipaddrs.py > ACK - John -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [perl PATCH 0/2] Rename IOThreads* APIs to IOThread
On 03/26/2015 08:46 AM, Ján Tomko wrote: > These depend on the rename being pushed to libvirt.git: > (first four patches of:) > https://www.redhat.com/archives/libvir-list/2015-March/msg01325.html > > Ján Tomko (2): > Adapt to rename of virDomainIOThreadsInfoFree to > virDomainIOThreadInfoFree > Adapt to rename of virDomainGetIOThreadsInfo to > virDomainGetIOThreadInfo > > Changes | 2 ++ > Virt.xs | 6 +++--- > 2 files changed, 5 insertions(+), 3 deletions(-) > Well unless you feel the need to rename the examples/iothreadsinfo.pl examples/iothreadinfo.pl ... ACK - John -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] bug#20082: new warning from ar on rawhide systems
[redirecting to libvirt; a continuation of https://www.redhat.com/archives/libvir-list/2015-February/msg01227.html] On 03/27/2015 02:43 PM, Pavel Raiskup wrote: > [+cc back libtool bug; as fixing automake does not seem to be enough] > >> >> Hmm. How hard is it to change ARFLAGS to 'cr' instead of the default of >> 'cru', so that projects that want to silence the warning now can do so >> without waiting on automake to catch up? (Remember, the warning is live >> on rawhide systems now, and even if we release a new automake with a >> patch to change the default, there are TONS of packages built with older >> automake that will still warn until such time as autoreconf is run on >> those packages to update them to the newer automake) > > Agreed here, while trying to look at possible patch, I found that libtool > historically does not respect automake's ARFLAGS, it has its own AR_FLAGS: > http://lists.gnu.org/archive/html/libtool/2008-05/msg00050.html > So fixing automake does not help for libtool-enabled projects, and, in some > situations users could need AR_FLAGS=X ARFLAGS=X, but yes - still easy to > define on per-project basis. > > FTR, Libtool uses AR_FLAGS from ~2000 (commit 8300de4c54e6f04f0d), automake > ARFLAGS from ~2003 (commit a71b3490639831ca). > Given the discussion on automake/libtool lists, I'm going to play with a patch that just sets AR[_]FLAGS to 'cr' to shut up the compilation warnings on rawhide. Anyone see a problem with that plan? -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Xen-devel] [PATCH 0/3] libxl: domain destroy fixes
Konrad Rzeszutek Wilk wrote: > On Wed, Mar 25, 2015 at 02:08:33PM -0600, Jim Fehlig wrote: > >> This small series of patches fixes some issues wrt domain destroy in >> the libxl driver. The primary motivation for this work is to >> prevent locking the virDomainObj during long running destroy operations >> on large memory domains. >> >> Patch 1 moves job acquisition from libxlDomainStart to it's callers so >> they have more control over when the job is acquired. Patch 2 fixes a >> few spots where we never acquired a job during domain destroy. Patch 3 >> contains the interesting change, where the virDomainObj is unlocked >> during the long-running destroy operation. >> >> This series wraps up my work to improve parallel OpenStack Tempest runs >> against the libxl driver. With libvirt.git master + this series + a >> patched libxl [1], I've successfully run a reproducer that was hitting >> the same issues encountered by Tempest. >> >> [1] libxl commits from xen.git: 93699882d, f1335f0d, 4783c99a, 1c91d6fba, >> and 188e9c54. I'll contact the stable branch maintainers and ask them >> to include these commits in the next Xen 4.4.x and 4.5.x releases. >> >> Jim Fehlig (3): >> libxl: Move job acquisition in libxlDomainStart to callers >> libxl: acquire a job when destroying a domain >> libxl: drop virDomainObj lock when destroying a domain >> > > I am no expert at this- but I dug through the code to understand how > the job and locking is done and now I am more comfortable with it. > > Since I am new to this I went through all of the the callsites (which used > the job now) from the driver to make sure that there are no chained calls > (one function calling another which also uses a mutex or job locking). > > I only found one culprit (libxlDomainAutoCoreDump being called from > libxlDomainShutdownThread). > > Reviewed-by: Konrad Rzeszutek Wilk > Thanks for taking time to review the series and familiarize yourself with the libvirt libxl code! As mentioned, I squashed in your libxlDomainAutoCoreDump fix in 2/3. Do any other libvirt devs have time for a quick review? I'd like to push this series, and the dom0 ballooning fix, for 1.2.14 if there are no objections. The latter was reviewed by Stefano Stabellini before the freeze https://www.redhat.com/archives/libvir-list/2015-March/msg01248.html Regards, Jim -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Xen-devel] [PATCH 0/3] libxl: domain destroy fixes
On Wed, Mar 25, 2015 at 02:08:33PM -0600, Jim Fehlig wrote: > This small series of patches fixes some issues wrt domain destroy in > the libxl driver. The primary motivation for this work is to > prevent locking the virDomainObj during long running destroy operations > on large memory domains. > > Patch 1 moves job acquisition from libxlDomainStart to it's callers so > they have more control over when the job is acquired. Patch 2 fixes a > few spots where we never acquired a job during domain destroy. Patch 3 > contains the interesting change, where the virDomainObj is unlocked > during the long-running destroy operation. > > This series wraps up my work to improve parallel OpenStack Tempest runs > against the libxl driver. With libvirt.git master + this series + a > patched libxl [1], I've successfully run a reproducer that was hitting > the same issues encountered by Tempest. > > [1] libxl commits from xen.git: 93699882d, f1335f0d, 4783c99a, 1c91d6fba, > and 188e9c54. I'll contact the stable branch maintainers and ask them > to include these commits in the next Xen 4.4.x and 4.5.x releases. > > Jim Fehlig (3): > libxl: Move job acquisition in libxlDomainStart to callers > libxl: acquire a job when destroying a domain > libxl: drop virDomainObj lock when destroying a domain I am no expert at this- but I dug through the code to understand how the job and locking is done and now I am more comfortable with it. Since I am new to this I went through all of the the callsites (which used the job now) from the driver to make sure that there are no chained calls (one function calling another which also uses a mutex or job locking). I only found one culprit (libxlDomainAutoCoreDump being called from libxlDomainShutdownThread). Reviewed-by: Konrad Rzeszutek Wilk > > src/libxl/libxl_domain.c | 77 +++ > src/libxl/libxl_domain.h | 4 --- > src/libxl/libxl_driver.c | 78 > > 3 files changed, 89 insertions(+), 70 deletions(-) > > -- > 1.8.4.5 > > > ___ > Xen-devel mailing list > xen-de...@lists.xen.org > http://lists.xen.org/xen-devel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/1] vircgroup: Fix build issue mingw cross compile
Commit id '2dbfa716' exposed virCgroupDetectMountsFromFile, but did not add the corresponding entry in the "#else /* !VIR_CGROUP_SUPPORTED */" section of the module. Signed-off-by: John Ferlan --- src/util/vircgroup.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 093a146..7c59428 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -4021,6 +4021,17 @@ virCgroupAvailable(void) int +virCgroupDetectMountsFromFile(virCgroupPtr group ATTRIBUTE_UNUSED, + const char *path ATTRIBUTE_UNUSED, + bool checkLinks ATTRIBUTE_UNUSED) +{ +virReportSystemError(ENXIO, "%s", + _("Control groups not supported on this platform")); +return -1; +} + + +int virCgroupNewPartition(const char *path ATTRIBUTE_UNUSED, bool create ATTRIBUTE_UNUSED, int controllers ATTRIBUTE_UNUSED, -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] connect: ssh: Shall we remove the dependency of netcat ?
On Fri, Mar 27, 2015 at 10:54:26 +0800, zhang bo wrote: > 1 When we connect libvirt with URI "qemu+ssh", it uses 'nc' command to > connect to libvirt-sock. > > # virsh -c qemu+ssh://root@9.61.1.74/system list > Password: //ask users to input passwords here. > IdName State > > 11pxerunning > > It in fact uses 'ssh' and 'nc' commands to connect to remote libvirt-sock, > such as: > ssh -l root 9.61.1.74 sh -c ''nc' -U /var/run/libvirt/libvirt-sock' Yep. > > The code path is : > virConnectOpen->doRemoteOpen->virNetClientNewSSH->virNetSocketNewConnectSSH > > 2 However, netcat(nc) is considered as an insecure tool, because it's too > powerful in controlling the network. > It's abandoned by some organizations. Too powerful? That is a ridiculous statement that probably originates from some kind of misunderstanding when creating a security policy or stuff like that. If a policy bans nc as "powerful" then it's missing on a lot of other options how to create listening or outgoing connections on arbitrary sockets. The only insecure part is that it does not use encryption, but that's a widely known fact about nc. > > 3 So, is there any good substitution for netcat to realize qemu+ssh? Currently libvirt doesn't allow this, but I'm planning for a long time to introduce a standalone libvirt client binary (or perhaps add this as a mode to virsh) to replace the use of NC but that's due to other reasons: 1) nc doesn't know where session mode sockets are placed This is due to the fact that it depends on how libvirt is compiled. Currently the client side has to provide the path that is used at the remote side and those may not correspond. 2) errors reported when using the ssh connection transport are not helpful: NC is inherently bad at reporting what happened with the unix socket on the remote side. 3) getting rid of nc as a dependency This won't happen though ... old libvirt clients would not be able to connect to newer servers. In other words. I don't think libvirt will ever get rid of using nc but we can make stuff better by adding the internal remote client. Peter signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 0/2] really fix qemucaps2xmltest
On Fri, Mar 27, 2015 at 04:15:50PM +0100, Michal Privoznik wrote: > On 25.03.2015 16:00, Pavel Hrdina wrote: > > Pavel Hrdina (2): > > Revert "qemucaps2xmltest: fix test to successfully run without kvm > > support" > > tests: introduce qemucaps2xmlmock > > > > tests/Makefile.am| 7 +++ > > tests/qemucaps2xmlmock.c | 33 + > > tests/qemucaps2xmltest.c | 6 +++--- > > 3 files changed, 43 insertions(+), 3 deletions(-) > > create mode 100644 tests/qemucaps2xmlmock.c > > > > ACK > > Michal Thanks, pushed now. Pavel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 0/8] Fix cgroups regresion when default cpuset is specified
On 03/27/2015 11:13 AM, Eric Blake wrote: > On 03/27/2015 07:12 AM, Peter Krempa wrote: >> Since commit a39f69d2b libvirt would fail to start a VM if the default cpu >> set >> was specified and individual vcpus were pinned to cpus outside of that >> cpuset. >> >> Peter Krempa (8): >> qemu: cgroup: Store auto cpuset instead of re-creating it on demand >> qemu: cgroup: Refactor setup for IOThread cgroups >> qemu: cgroup: Properly set up vcpu pinning >> qemu: cgroup: Use priv->autoCpuset instead of using >> qemuPrepareCpumap() >> qemu: cgroup: Rename qemuSetupCgroupEmulatorPin to >> qemuSetupCgroupCpusetCpus >> qemu: cgroup: Kill qemuSetupCgroupIOThreadsPin() >> qemu: cgroup: Kill qemuSetupCgroupVcpuPin() >> qemu: Copy bitmap in a sane way > > Not a review of this series, but related to cgroups so also needs fixing: > > Running ./autobuild.sh currently fails on the mingw-cross-compilation > section, due to: > > CCLD libvirt.la > Cannot export virCgroupDetectMountsFromFile: symbol not defined > Cannot export virCgroupGetCpusetMemoryMigrate: symbol not defined > Cannot export virCgroupSetCpusetMemoryMigrate: symbol not defined > > > I "think" the following will resolve that (but I have no empirical evidence since I don't have a cross-mingw environment to test this on)... http://www.redhat.com/archives/libvir-list/2015-March/msg01480.html John -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] vircgroup: Fix build issue on mingw
Commit id 'ba1dfc5' added virCgroupSetCpusetMemoryMigrate and virCgroupGetCpusetMemoryMigrate, but did not add the corresponding entry points into the "#else /* !VIR_CGROUP_SUPPORTED */" section Signed-off-by: John Ferlan --- Not pushing as a build break since I'm not 100% it fixes the issue eblake mentions in his review of a recent cgroup series. src/util/vircgroup.c | 20 1 file changed, 20 insertions(+) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 0a2e729..093a146 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -4420,6 +4420,26 @@ virCgroupGetCpusetMems(virCgroupPtr group ATTRIBUTE_UNUSED, int +virCgroupSetCpusetMemoryMigrate(virCgroupPtr group ATTRIBUTE_UNUSED, +bool migrate ATTRIBUTE_UNUSED) +{ +virReportSystemError(ENOSYS, "%s", + _("Control groups not supported on this platform")); +return -1; +} + + +int +virCgroupGetCpusetMemoryMigrate(virCgroupPtr group ATTRIBUTE_UNUSED, +bool *migrate ATTRIBUTE_UNUSED) +{ +virReportSystemError(ENOSYS, "%s", + _("Control groups not supported on this platform")); +return -1; +} + + +int virCgroupSetCpusetCpus(virCgroupPtr group ATTRIBUTE_UNUSED, const char *cpus ATTRIBUTE_UNUSED) { -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/3] storage: Need to update freeExtent at delete primary partition
Commit id '471e1c4e' only considered updating the pool if the extended partition was removed. As it turns out removing a primary partition would also need to update the freeExtent list otherwise the following sequence would fail (assuming a "fresh" disk pool for /dev/sde of 500M): $ virsh pool-info disk-pool ... Capacity: 509.88 MiB Allocation: 0.00 B Available: 509.84 MiB $ virsh vol-create-as disk-pool sde1 --capacity 300M $ virsh vol-delete --pool disk-pool sde1 $ virsh vol-create-as disk-pool sde1 --capacity 300M error: Failed to create vol sde1 error: internal error: no large enough free extent $ This patch will refresh the pool, rereading the partitions, and return Signed-off-by: John Ferlan --- src/storage/storage_backend_disk.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c index ba928d8..17c6492 100644 --- a/src/storage/storage_backend_disk.c +++ b/src/storage/storage_backend_disk.c @@ -746,10 +746,13 @@ virStorageBackendDiskDeleteVol(virConnectPtr conn, goto cleanup; } -/* If this was the extended partition, then all the logical partitions - * are then lost. Make it easy on ourselves and just refresh the pool +/* If this is not a logical partition, then either we've removed an + * extended partition or a primary partion - refresh the pool which + * includes resetting the [n]freeExtents data so a subsequent allocation + * might be able to use what was deleted. A logical partition is part + * of an extended partition and handled differently */ -if (vol->source.partType == VIR_STORAGE_VOL_DISK_TYPE_EXTENDED) { +if (vol->source.partType != VIR_STORAGE_VOL_DISK_TYPE_LOGICAL) { virStoragePoolObjClearVols(pool); if (virStorageBackendDiskRefreshPool(conn, pool) < 0) goto cleanup; -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/3] Fix some storage issues
Patch 1 & 3 are bz based, while Patch 2 was determined while working on Patch 3. Details in each commit message John Ferlan (3): storage: Fix issues in storageVolResize storage: Need to update freeExtent at delete primary partition storage: Don't duplicate efforts of backend driver src/storage/storage_backend_disk.c | 9 +++-- src/storage/storage_driver.c | 67 ++ 2 files changed, 59 insertions(+), 17 deletions(-) -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/3] storage: Fix issues in storageVolResize
https://bugzilla.redhat.com/show_bug.cgi?id=1073305 When creating a volume in a pool, the creation allows the 'capacity' value to be larger than the available space in the pool. As long as the 'allocation' value will fit in the space, the volume will be created. However, resizing the volume checks were made with the new absolute capacity value against existing capacity + the available space without regard for whether the new absolute capacity was actually allocating space or not. For example, a pool with 75G of available space creates a volume of 10G using a capacity of 100G and allocation of 10G will succeed; however, if the allocation used a capacity of 10G instead and then tried to resize the allocation to 100G the code would fail to allow the backend to try the resize. Furthermore, when updating the pool "available" and "allocation" values, the resize code would just "blindly" adjust them regardless of whether space was "allocated" or just "capacity" was being adjusted. This left a scenario whereby a resize to 100G would fail; however, a resize to 50G followed by one to 100G would both succeed. Again, neither was adjusting the allocation value, just the "capacity" value. This patch adds more logic to the resize code to understand whether the new capacity value is actually "allocating" space as well and whether it shrinking or expanding. Since unsigned arithmatic is involved, the possibility that we adjust the pool size values incorrectly is probable. This patch also ensures that updates to the pool values only occur if we actually performed the allocation. NB: The storageVolDelete, storageVolCreateXML, and storageVolCreateXMLFrom each only updates the pool allocation/availability values by the target volume allocation value. Signed-off-by: John Ferlan --- src/storage/storage_driver.c | 37 + 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index b95506f..8d91879 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -2139,7 +2139,7 @@ storageVolResize(virStorageVolPtr obj, virStorageBackendPtr backend; virStoragePoolObjPtr pool = NULL; virStorageVolDefPtr vol = NULL; -unsigned long long abs_capacity; +unsigned long long abs_capacity, delta; int ret = -1; virCheckFlags(VIR_STORAGE_VOL_RESIZE_ALLOCATE | @@ -2184,13 +2184,24 @@ storageVolResize(virStorageVolPtr obj, !(flags & VIR_STORAGE_VOL_RESIZE_SHRINK)) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("Can't shrink capacity below current " - "capacity with shrink flag explicitly specified")); + "capacity unless shrink flag explicitly specified")); goto cleanup; } -if (abs_capacity > vol->target.capacity + pool->def->available) { +if (flags & VIR_STORAGE_VOL_RESIZE_SHRINK) +delta = vol->target.allocation - abs_capacity; +else +delta = abs_capacity - vol->target.allocation; + +/* If the operation is going to increase the allocation value and not + * just the capacity value, then let's make sure there's enough space + * in the pool in order to perform that operation + */ +if (flags & VIR_STORAGE_VOL_RESIZE_ALLOCATE && +!(flags & VIR_STORAGE_VOL_RESIZE_SHRINK) && +delta > pool->def->available) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("Not enough space left on storage pool")); + _("Not enough space left in storage pool")); goto cleanup; } @@ -2205,12 +2216,22 @@ storageVolResize(virStorageVolPtr obj, goto cleanup; vol->target.capacity = abs_capacity; -if (flags & VIR_STORAGE_VOL_RESIZE_ALLOCATE) +/* Only update the allocation and pool values if we actually did the + * allocation; otherwise, this is akin to a create operation with a + * capacity value different and potentially much larger than available + */ +if (flags & VIR_STORAGE_VOL_RESIZE_ALLOCATE) { vol->target.allocation = abs_capacity; -/* Update pool metadata */ -pool->def->allocation += (abs_capacity - vol->target.capacity); -pool->def->available -= (abs_capacity - vol->target.capacity); +/* Update pool metadata */ +if (flags & VIR_STORAGE_VOL_RESIZE_SHRINK) { + pool->def->allocation -= delta; + pool->def->available += delta; +} else { + pool->def->allocation += delta; + pool->def->available -= delta; +} +} ret = 0; -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/3] storage: Don't duplicate efforts of backend driver
https://bugzilla.redhat.com/show_bug.cgi?id=1206521 If the backend driver updates the pool available and/or allocation values, then the storage_driver VolCreateXML, VolCreateXMLFrom, and VolDelete APIs should not change the value; otherwise, it will appear as if the values were "doubled" for each change. Additionally since unsigned arithmetic will be used depending on the size and operation, either or both values could be appear to be much larger than they should be (in the EiB range). Currently only the disk pool updates the values, but other pools could. Assume a "fresh" disk pool of 500 MiB using /dev/sde: $ virsh pool-info disk-pool ... Capacity: 509.88 MiB Allocation: 0.00 B Available: 509.84 MiB $ virsh vol-create-as disk-pool sde1 --capacity 300M $ virsh pool-info disk-pool ... Capacity: 509.88 MiB Allocation: 600.47 MiB Available: 16.00 EiB Following assumes disk backend updated to refresh the disk pool at deletion of primary partition as well as extended partition: $ virsh vol-delete --pool disk-pool sde1 Vol sde1 deleted $ virsh pool-info disk-pool ... Capacity: 509.88 MiB Allocation: 9.73 EiB Available: 6.27 EiB This patch will check if the backend updated the pool values and honor that update. Signed-off-by: John Ferlan --- src/storage/storage_driver.c | 30 -- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 8d91879..47486e2 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -1499,6 +1499,7 @@ storageVolDeleteInternal(virStorageVolPtr obj, { size_t i; int ret = -1; +unsigned long long orig_pool_available, orig_pool_allocation; if (!backend->deleteVol) { virReportError(VIR_ERR_NO_SUPPORT, @@ -1507,6 +1508,9 @@ storageVolDeleteInternal(virStorageVolPtr obj, goto cleanup; } +orig_pool_available = pool->def->available; +orig_pool_allocation = pool->def->allocation; + if (backend->deleteVol(obj->conn, pool, vol, flags) < 0) goto cleanup; @@ -1514,8 +1518,10 @@ storageVolDeleteInternal(virStorageVolPtr obj, * in this module since the allocation/available weren't adjusted yet */ if (updateMeta) { -pool->def->allocation -= vol->target.allocation; -pool->def->available += vol->target.allocation; +if (orig_pool_allocation == pool->def->allocation) +pool->def->allocation -= vol->target.allocation; +if (orig_pool_available == pool->def->available) +pool->def->available += vol->target.allocation; } for (i = 0; i < pool->volumes.count; i++) { @@ -1634,6 +1640,7 @@ storageVolCreateXML(virStoragePoolPtr obj, virStorageVolDefPtr voldef = NULL; virStorageVolPtr ret = NULL, volobj = NULL; virStorageVolDefPtr buildvoldef = NULL; +unsigned long long orig_pool_available, orig_pool_allocation; virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, NULL); @@ -1681,6 +1688,9 @@ storageVolCreateXML(virStoragePoolPtr obj, goto cleanup; } +orig_pool_available = pool->def->available; +orig_pool_allocation = pool->def->allocation; + /* Wipe any key the user may have suggested, as volume creation * will generate the canonical key. */ VIR_FREE(voldef->key); @@ -1738,8 +1748,10 @@ storageVolCreateXML(virStoragePoolPtr obj, goto cleanup; /* Update pool metadata */ -pool->def->allocation += buildvoldef->target.allocation; -pool->def->available -= buildvoldef->target.allocation; +if (orig_pool_allocation == pool->def->allocation) +pool->def->allocation += buildvoldef->target.allocation; +if (orig_pool_available == pool->def->available) +pool->def->available -= buildvoldef->target.allocation; VIR_INFO("Creating volume '%s' in storage pool '%s'", volobj->name, pool->def->name); @@ -1767,6 +1779,7 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj, virStorageVolDefPtr origvol = NULL, newvol = NULL; virStorageVolPtr ret = NULL, volobj = NULL; unsigned long long allocation; +unsigned long long orig_pool_available, orig_pool_allocation; int buildret; virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA | @@ -1869,6 +1882,9 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj, pool->volumes.count+1) < 0) goto cleanup; +orig_pool_available = pool->def->available; +orig_pool_allocation = pool->def->allocation; + /* 'Define' the new volume so we get async progress reporting. * Wipe any key the user may have suggested, as volume creation * will generate the canonical key. */ @@ -1922,8 +1938,10 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj, newvol = NULL; /* Updating pool metadata */ -pool->def->allocation += allocation; -pool->def->available -= alloc
Re: [libvirt] [PATCH 0/2] really fix qemucaps2xmltest
On 25.03.2015 16:00, Pavel Hrdina wrote: > Pavel Hrdina (2): > Revert "qemucaps2xmltest: fix test to successfully run without kvm > support" > tests: introduce qemucaps2xmlmock > > tests/Makefile.am| 7 +++ > tests/qemucaps2xmlmock.c | 33 + > tests/qemucaps2xmltest.c | 6 +++--- > 3 files changed, 43 insertions(+), 3 deletions(-) > create mode 100644 tests/qemucaps2xmlmock.c > ACK Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 0/8] Fix cgroups regresion when default cpuset is specified
On 03/27/2015 07:12 AM, Peter Krempa wrote: > Since commit a39f69d2b libvirt would fail to start a VM if the default cpu set > was specified and individual vcpus were pinned to cpus outside of that cpuset. > > Peter Krempa (8): > qemu: cgroup: Store auto cpuset instead of re-creating it on demand > qemu: cgroup: Refactor setup for IOThread cgroups > qemu: cgroup: Properly set up vcpu pinning > qemu: cgroup: Use priv->autoCpuset instead of using > qemuPrepareCpumap() > qemu: cgroup: Rename qemuSetupCgroupEmulatorPin to > qemuSetupCgroupCpusetCpus > qemu: cgroup: Kill qemuSetupCgroupIOThreadsPin() > qemu: cgroup: Kill qemuSetupCgroupVcpuPin() > qemu: Copy bitmap in a sane way Not a review of this series, but related to cgroups so also needs fixing: Running ./autobuild.sh currently fails on the mingw-cross-compilation section, due to: CCLD libvirt.la Cannot export virCgroupDetectMountsFromFile: symbol not defined Cannot export virCgroupGetCpusetMemoryMigrate: symbol not defined Cannot export virCgroupSetCpusetMemoryMigrate: symbol not defined -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 6/6] virLXCControllerSetupResourceLimits: Call virNuma*() iff needed
Like we are doing in qemu driver ($COMMIT_HASH_TO_BE_FILLED_DURING_PUSHING), lets call virNumaSetupMemoryPolicy() only if really needed. Problem is, if we numa_set_membind() child, there's no way to change it from the daemon afterwards. So any later attempts to change the pinning will fail. But in very weird way - CGroups will be set, but due to membind child will not allocate memory from any other node. Signed-off-by: Michal Privoznik --- src/lxc/lxc_controller.c | 31 +-- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 8545f29..6881a37 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -742,14 +742,33 @@ static int virLXCControllerSetupResourceLimits(virLXCControllerPtr ctrl) virBitmapPtr nodeset = NULL; virDomainNumatuneMemMode mode; -VIR_DEBUG("Setting up process resource limits"); - -if (virLXCControllerGetNumadAdvice(ctrl, &auto_nodeset) < 0) -goto cleanup; - -nodeset = virDomainNumatuneGetNodeset(ctrl->def->numa, auto_nodeset, -1); mode = virDomainNumatuneGetMode(ctrl->def->numa, -1); +if (mode == VIR_DOMAIN_NUMATUNE_MEM_STRICT) { +virCgroupPtr cgroup; + +/* Create dummy cgroup ... */ +if (virCgroupNewSelf(&cgroup) < 0) +goto cleanup; + +/* ... just to detect if cpuset cgroup is present */ +if (virCgroupHasController(cgroup, VIR_CGROUP_CONTROLLER_CPUSET)) { +/* Because if it's not, we will pin the child onto + * specified nodes for good. No later cpuset.mems + * change will have any effect. */ +VIR_DEBUG("Postponing setting up resource limits to CGroup set up phase"); +virCgroupFree(&cgroup); +return virLXCControllerSetupCpuAffinity(ctrl); +} +} + +VIR_DEBUG("Setting up process resource limits"); + +if (virLXCControllerGetNumadAdvice(ctrl, &auto_nodeset) < 0) +goto cleanup; + +nodeset = virDomainNumatuneGetNodeset(ctrl->def->numa, auto_nodeset, -1); + if (virNumaSetupMemoryPolicy(mode, nodeset) < 0) goto cleanup; -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/6] virCgroupNewPartition: Fix comment
The function has no argument named @name rather than @path instead. The comment is, however, referring to @name while it should have been referring to @path really. Signed-off-by: Michal Privoznik --- src/util/vircgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 0a2e729..660f840 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -1290,7 +1290,7 @@ virCgroupSetPartitionSuffix(const char *path, char **res) * @controllers: mask of controllers to create * * Creates a new cgroup to represent the resource - * partition path identified by @name. + * partition path identified by @path. * * Returns 0 on success, -1 on failure */ -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/6] virCgroupNew: Enhance debug message
When creating new internal representation of cgroups, all passed arguments are logged. Well, except for two: pid and pointer for return value. Lets log them too. Signed-off-by: Michal Privoznik --- src/util/vircgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 660f840..0ae99c9 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -1050,8 +1050,8 @@ virCgroupNew(pid_t pid, int controllers, virCgroupPtr *group) { -VIR_DEBUG("parent=%p path=%s controllers=%d", - parent, path, controllers); +VIR_DEBUG("pid=%lld path=%s parent=%p controllers=%d group=%p", + (long long) pid, path, parent, controllers, group); *group = NULL; if (VIR_ALLOC((*group)) < 0) -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/6] Few NUMA fixes
The heart of the patchset are the last two patches. Long story short, if a domain is configured to be pinned onto a set of NUMA nodes stricly, we use both CGroups and numa_set_membind(). While we can change the former later on a user's wish, we can't change the latter. Therefore, any subsequent memory enlargement (e.g. via virsh setmem $dom) will result in memory still being allocated from old NUMA nodes and OOM killer interference is likely to occur. Michal Privoznik (6): virCgroupNewPartition: Fix comment virCgroupNew: Enhance debug message virCgroupController: Check the enum fits into 'int' qemuDomainGetNumaParameters: Check for the correct CGroup controller qemuProcessHook: Call virNuma*() iff needed virLXCControllerSetupResourceLimits: Call virNuma*() iff needed src/lxc/lxc_controller.c | 31 +-- src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_process.c | 32 src/util/vircgroup.c | 6 +++--- src/util/vircgroup.h | 5 + 5 files changed, 62 insertions(+), 14 deletions(-) -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 5/6] qemuProcessHook: Call virNuma*() iff needed
Once upon a time, there was a little domain. And the domain was pinned onto a NUMA node and hasn't fully allocated its memory: 2355200 1048576 Oh little me, said the domain, what will I do with so few memory. If I only had a few megabytes more. But the old admin noticed whimpering, barely audible to untrained human ear. And good admin he was, he gave the domain yet more memory. But the old NUMA topology witch forbidden to allocate more memory on the node zero. So he decided to allocate it on a different node: virsh # numatune little_domain --nodeset 0-1 virsh # setmem little_domain 2355200 The little domain was happy. For a while. Until bad, sharp teeth shaped creature came. Every process in the system was afraid of him. The OOM Killer they called him. Oh no, he's after the little domain. There's no escape. Do you kids know why? Because when the little domain was born, her father, Libvirt, called numa_set_membind(). So even if the admin allowed her to allocate memory from other nodes in the cgroups, the membind() forbid it. So what's the lesson? Libvirt should rely on cgroups, whenever possible and use numa_set_membind() as the last ditch effort. Signed-off-by: Michal Privoznik --- src/qemu/qemu_process.c | 32 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 79f763e..cba042d 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3154,6 +3154,7 @@ static int qemuProcessHook(void *data) int fd; virBitmapPtr nodeset = NULL; virDomainNumatuneMemMode mode; +bool doNuma = true; /* This method cannot use any mutexes, which are not * protected across fork() @@ -3185,11 +3186,34 @@ static int qemuProcessHook(void *data) goto cleanup; mode = virDomainNumatuneGetMode(h->vm->def->numa, -1); -nodeset = virDomainNumatuneGetNodeset(h->vm->def->numa, - priv->autoNodeset, -1); -if (virNumaSetupMemoryPolicy(mode, nodeset) < 0) -goto cleanup; +if (mode == VIR_DOMAIN_NUMATUNE_MEM_STRICT) { +virCgroupPtr cgroup = NULL; + +/* Create dummy cgroup ... */ +if (virCgroupNewSelf(&cgroup) < 0) +goto cleanup; + +/* ... just to detect if cpuset cgroup is present */ +if (virCgroupHasController(cgroup, VIR_CGROUP_CONTROLLER_CPUSET)) { +/* Because if it's not, we must use virNuma* APIs to bind + * memory onto desired nodes. CGroup way is preferred, as + * it allows runtime tuning, while virNuma - well, once + * set and child (qemu) is exec()-ed, we can't do + * anything about the settings. virNuma* does not take + * any PID argument after all. */ +doNuma = false; +} +virCgroupFree(&cgroup); +} + +if (doNuma) { +nodeset = virDomainNumatuneGetNodeset(h->vm->def->numa, + priv->autoNodeset, -1); + +if (virNumaSetupMemoryPolicy(mode, nodeset) < 0) +goto cleanup; +} ret = 0; -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/6] virCgroupController: Check the enum fits into 'int'
Throughout our code, the virCgroupController enum is used in two ways. First as an index to an array of cgroup controllers: struct virCgroup { char *path; struct virCgroupController controllers[VIR_CGROUP_CONTROLLER_LAST]; }; Second way is that when calling virCgroupNew() a bitmask of the enum items can be passed to selectively detect only some controllers. For instance: int virCgroupNewVcpu(virCgroupPtr domain, int vcpuid, bool create, virCgroupPtr *group) { ... controllers = ((1 << VIR_CGROUP_CONTROLLER_CPU) | (1 << VIR_CGROUP_CONTROLLER_CPUACCT) | (1 << VIR_CGROUP_CONTROLLER_CPUSET)); if (virCgroupNew(-1, name, domain, controllers, group) < 0) goto cleanup; } Even though it's highly unlikely that so many new controllers will be invented so that we would overflow when constructing the bitmask, it doesn't hurt to check at compile time either. Signed-off-by: Michal Privoznik --- src/util/vircgroup.h | 5 + 1 file changed, 5 insertions(+) diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h index bfb3a9b..eee15ca 100644 --- a/src/util/vircgroup.h +++ b/src/util/vircgroup.h @@ -46,6 +46,11 @@ enum { }; VIR_ENUM_DECL(virCgroupController); +/* Items of this enum are used later in virCgroupNew to create + * bit array stored in int. Like this: + * 1 << VIR_CGROUP_CONTROLLER_CPU + * Make sure we will not overflow */ +verify(VIR_CGROUP_CONTROLLER_LAST < 8 * sizeof(int)); bool virCgroupAvailable(void); -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 4/6] qemuDomainGetNumaParameters: Check for the correct CGroup controller
When getting info on NUMA parameters for domain, virCgroupGetCpusetMems() may be called. However, as of 43b67f2e the call is guarded by check if memory controller is present. Even though it may be not obvious instantly, NUMA parameters are stored under cpuset controller. Therefore the check needs to look like this: if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET) || virCgroupGetCpusetMems(priv->cgroup, &nodeset) < 0) { Signed-off-by: Michal Privoznik --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f07e4fb..4d05221 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10187,7 +10187,7 @@ qemuDomainGetNumaParameters(virDomainPtr dom, goto cleanup; } else { if (!virCgroupHasController(priv->cgroup, -VIR_CGROUP_CONTROLLER_MEMORY) || +VIR_CGROUP_CONTROLLER_CPUSET) || virCgroupGetCpusetMems(priv->cgroup, &nodeset) < 0) { nodeset = virDomainNumatuneFormatNodeset(vm->def->numa, NULL, -1); -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virnetlink: fix build error
On 03/27/2015 06:13 AM, Pavel Hrdina wrote: > Commint 0473b45cc introduced new function virNetlinkDelLink, but in > it's counterpart for non-linux platform there should be ATTRIBUTE_UNUSED > instead of ATTRIBUTE_UNSUPPORTED. Derp. Sorry about that, and thanks for fixing it! -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 8/8] qemu: Copy bitmap in a sane way
Use virBitmapNewCopy instead of a combination of virBitmapNew and virBitmapCopy. --- src/qemu/qemu_driver.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 58fa3c6..71bbf6e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4752,12 +4752,10 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver, if (VIR_ALLOC(vcpupin) < 0) goto cleanup; -if (!(vcpupin->cpumask = - virBitmapNew(VIR_DOMAIN_CPUMASK_LEN))) { +if (!(vcpupin->cpumask = virBitmapNewCopy(vm->def->cpumask))) { VIR_FREE(vcpupin); goto cleanup; } -virBitmapCopy(vcpupin->cpumask, vm->def->cpumask); vcpupin->id = i; if (VIR_APPEND_ELEMENT_COPY(vm->def->cputune.vcpupin, vm->def->cputune.nvcpupin, vcpupin) < 0) { -- 2.2.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 5/8] qemu: cgroup: Rename qemuSetupCgroupEmulatorPin to qemuSetupCgroupCpusetCpus
The function is used to set cpuset.cpus in various other helpers. --- src/qemu/qemu_cgroup.c | 14 +++--- src/qemu/qemu_cgroup.h | 2 +- src/qemu/qemu_driver.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index 7ba3059..fad7003 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -952,7 +952,7 @@ qemuSetupCgroupVcpuPin(virCgroupPtr cgroup, for (i = 0; i < nvcpupin; i++) { if (vcpuid == vcpupin[i]->id) -return qemuSetupCgroupEmulatorPin(cgroup, vcpupin[i]->cpumask); +return qemuSetupCgroupCpusetCpus(cgroup, vcpupin[i]->cpumask); } return -1; @@ -968,15 +968,15 @@ qemuSetupCgroupIOThreadsPin(virCgroupPtr cgroup, for (i = 0; i < niothreadspin; i++) { if (iothreadid == iothreadspin[i]->id) -return qemuSetupCgroupEmulatorPin(cgroup, iothreadspin[i]->cpumask); +return qemuSetupCgroupCpusetCpus(cgroup, iothreadspin[i]->cpumask); } return -1; } int -qemuSetupCgroupEmulatorPin(virCgroupPtr cgroup, - virBitmapPtr cpumask) +qemuSetupCgroupCpusetCpus(virCgroupPtr cgroup, + virBitmapPtr cpumask) { int ret = -1; char *new_cpus = NULL; @@ -1078,7 +1078,7 @@ qemuSetupCgroupForVcpu(virDomainObjPtr vm) if (!cpumap) continue; -if (qemuSetupCgroupEmulatorPin(cgroup_vcpu, cpumap) < 0) +if (qemuSetupCgroupCpusetCpus(cgroup_vcpu, cpumap) < 0) goto cleanup; } @@ -1142,7 +1142,7 @@ qemuSetupCgroupForEmulator(virDomainObjPtr vm) if (cpumask) { if (virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET) && -qemuSetupCgroupEmulatorPin(cgroup_emulator, cpumask) < 0) +qemuSetupCgroupCpusetCpus(cgroup_emulator, cpumask) < 0) goto cleanup; } @@ -1252,7 +1252,7 @@ qemuSetupCgroupForIOThreads(virDomainObjPtr vm) } if (cpumask && -qemuSetupCgroupEmulatorPin(cgroup_iothread, cpumask) < 0) +qemuSetupCgroupCpusetCpus(cgroup_iothread, cpumask) < 0) goto cleanup; } diff --git a/src/qemu/qemu_cgroup.h b/src/qemu/qemu_cgroup.h index 11893ef..0f7be7e 100644 --- a/src/qemu/qemu_cgroup.h +++ b/src/qemu/qemu_cgroup.h @@ -56,7 +56,7 @@ int qemuSetupCgroupVcpuPin(virCgroupPtr cgroup, virDomainPinDefPtr *vcpupin, int nvcpupin, int vcpuid); -int qemuSetupCgroupEmulatorPin(virCgroupPtr cgroup, virBitmapPtr cpumask); +int qemuSetupCgroupCpusetCpus(virCgroupPtr cgroup, virBitmapPtr cpumask); int qemuSetupCgroupIOThreadsPin(virCgroupPtr cgroup, virDomainPinDefPtr *iothreadspin, int niothreadspin, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index db4f0b4..949ba44 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5420,8 +5420,8 @@ qemuDomainPinEmulator(virDomainPtr dom, */ if (virCgroupNewEmulator(priv->cgroup, false, &cgroup_emulator) < 0) goto endjob; -if (qemuSetupCgroupEmulatorPin(cgroup_emulator, - newVcpuPin[0]->cpumask) < 0) { +if (qemuSetupCgroupCpusetCpus(cgroup_emulator, + newVcpuPin[0]->cpumask) < 0) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("failed to set cpuset.cpus in cgroup" " for emulator threads")); -- 2.2.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 6/8] qemu: cgroup: Kill qemuSetupCgroupIOThreadsPin()
The function doesn't make sense. There's a simpler way to achieve the same. --- src/qemu/qemu_cgroup.c | 15 --- src/qemu/qemu_cgroup.h | 4 src/qemu/qemu_driver.c | 5 + 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index fad7003..bd768ef 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -958,21 +958,6 @@ qemuSetupCgroupVcpuPin(virCgroupPtr cgroup, return -1; } -int -qemuSetupCgroupIOThreadsPin(virCgroupPtr cgroup, -virDomainPinDefPtr *iothreadspin, -int niothreadspin, -int iothreadid) -{ -size_t i; - -for (i = 0; i < niothreadspin; i++) { -if (iothreadid == iothreadspin[i]->id) -return qemuSetupCgroupCpusetCpus(cgroup, iothreadspin[i]->cpumask); -} - -return -1; -} int qemuSetupCgroupCpusetCpus(virCgroupPtr cgroup, diff --git a/src/qemu/qemu_cgroup.h b/src/qemu/qemu_cgroup.h index 0f7be7e..cdeb307 100644 --- a/src/qemu/qemu_cgroup.h +++ b/src/qemu/qemu_cgroup.h @@ -57,10 +57,6 @@ int qemuSetupCgroupVcpuPin(virCgroupPtr cgroup, int nvcpupin, int vcpuid); int qemuSetupCgroupCpusetCpus(virCgroupPtr cgroup, virBitmapPtr cpumask); -int qemuSetupCgroupIOThreadsPin(virCgroupPtr cgroup, -virDomainPinDefPtr *iothreadspin, -int niothreadspin, -int iothreadid); int qemuSetupCgroupForVcpu(virDomainObjPtr vm); int qemuSetupCgroupForIOThreads(virDomainObjPtr vm); int qemuSetupCgroupForEmulator(virDomainObjPtr vm); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 949ba44..fc44ef1 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6016,10 +6016,7 @@ qemuDomainPinIOThread(virDomainPtr dom, if (virCgroupNewIOThread(priv->cgroup, iothread_id, false, &cgroup_iothread) < 0) goto endjob; -if (qemuSetupCgroupIOThreadsPin(cgroup_iothread, -newIOThreadsPin, -newIOThreadsPinNum, -iothread_id) < 0) { +if (qemuSetupCgroupCpusetCpus(cgroup_iothread, pcpumap) < 0) { virReportError(VIR_ERR_OPERATION_INVALID, _("failed to set cpuset.cpus in cgroup" " for iothread %d"), iothread_id); -- 2.2.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 4/8] qemu: cgroup: Use priv->autoCpuset instead of using qemuPrepareCpumap()
Two places would call to qemuPrepareCpumap() with priv->autoNodeset to convert it to a cpuset. Remove the function and use the prepared cpuset automatically. --- src/qemu/qemu_cgroup.c | 18 +++ src/qemu/qemu_cgroup.h | 3 +- src/qemu/qemu_process.c | 82 - src/qemu/qemu_process.h | 2 -- 4 files changed, 25 insertions(+), 80 deletions(-) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index 8674ab8..7ba3059 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -1099,11 +1099,9 @@ qemuSetupCgroupForVcpu(virDomainObjPtr vm) } int -qemuSetupCgroupForEmulator(virQEMUDriverPtr driver, - virDomainObjPtr vm) +qemuSetupCgroupForEmulator(virDomainObjPtr vm) { virBitmapPtr cpumask = NULL; -virBitmapPtr cpumap = NULL; virCgroupPtr cgroup_emulator = NULL; virDomainDefPtr def = vm->def; qemuDomainObjPrivatePtr priv = vm->privateData; @@ -1135,15 +1133,12 @@ qemuSetupCgroupForEmulator(virQEMUDriverPtr driver, if (virCgroupMoveTask(priv->cgroup, cgroup_emulator) < 0) goto cleanup; -if (def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) { -if (!(cpumap = qemuPrepareCpumap(driver, priv->autoNodeset))) -goto cleanup; -cpumask = cpumap; -} else if (def->cputune.emulatorpin) { +if (def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) +cpumask = priv->autoCpuset; +else if (def->cputune.emulatorpin) cpumask = def->cputune.emulatorpin->cpumask; -} else if (def->cpumask) { +else if (def->cpumask) cpumask = def->cpumask; -} if (cpumask) { if (virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET) && @@ -1159,12 +1154,9 @@ qemuSetupCgroupForEmulator(virQEMUDriverPtr driver, } virCgroupFree(&cgroup_emulator); -virBitmapFree(cpumap); return 0; cleanup: -virBitmapFree(cpumap); - if (cgroup_emulator) { virCgroupRemove(cgroup_emulator); virCgroupFree(&cgroup_emulator); diff --git a/src/qemu/qemu_cgroup.h b/src/qemu/qemu_cgroup.h index b311af3..11893ef 100644 --- a/src/qemu/qemu_cgroup.h +++ b/src/qemu/qemu_cgroup.h @@ -63,8 +63,7 @@ int qemuSetupCgroupIOThreadsPin(virCgroupPtr cgroup, int iothreadid); int qemuSetupCgroupForVcpu(virDomainObjPtr vm); int qemuSetupCgroupForIOThreads(virDomainObjPtr vm); -int qemuSetupCgroupForEmulator(virQEMUDriverPtr driver, - virDomainObjPtr vm); +int qemuSetupCgroupForEmulator(virDomainObjPtr vm); int qemuRemoveCgroup(virQEMUDriverPtr driver, virDomainObjPtr vm); int qemuAddToCgroup(virDomainObjPtr vm); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 4a786b1..69c44d9 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2273,67 +2273,12 @@ qemuProcessDetectIOThreadPIDs(virQEMUDriverPtr driver, return ret; } -/* Helper to prepare cpumap for affinity setting, convert - * NUMA nodeset into cpuset if @nodemask is not NULL, otherwise - * just return a new allocated bitmap. - */ -virBitmapPtr -qemuPrepareCpumap(virQEMUDriverPtr driver, - virBitmapPtr nodemask) -{ -size_t i; -int hostcpus, maxcpu = QEMUD_CPUMASK_LEN; -virBitmapPtr cpumap = NULL; -virCapsPtr caps = NULL; - -/* setaffinity fails if you set bits for CPUs which - * aren't present, so we have to limit ourselves */ -if ((hostcpus = nodeGetCPUCount()) < 0) -return NULL; - -if (maxcpu > hostcpus) -maxcpu = hostcpus; - -if (!(cpumap = virBitmapNew(maxcpu))) -return NULL; - -if (nodemask) { -if (!(caps = virQEMUDriverGetCapabilities(driver, false))) { -virBitmapFree(cpumap); -cpumap = NULL; -goto cleanup; -} - -for (i = 0; i < caps->host.nnumaCell; i++) { -size_t j; -int cur_ncpus = caps->host.numaCell[i]->ncpus; -bool result; -if (virBitmapGetBit(nodemask, caps->host.numaCell[i]->num, &result) < 0) { -virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Failed to convert nodeset to cpuset")); -virBitmapFree(cpumap); -cpumap = NULL; -goto cleanup; -} -if (result) { -for (j = 0; j < cur_ncpus; j++) -ignore_value(virBitmapSetBit(cpumap, - caps->host.numaCell[i]->cpus[j].id)); -} -} -} - - cleanup: -virObjectUnref(caps); -return cpumap; -} /* * To be run between fork/exec of QEMU only */ static int -qemuProcessInitCpuAffinity(virQEMUDriverPtr driver, - virDomainObjPtr vm) +qemuProcessInitCpuAffinity(virDomainObjPtr vm) { int ret = -1; virBitmapPtr cpumap = NULL;
[libvirt] [PATCH 0/8] Fix cgroups regresion when default cpuset is specified
Since commit a39f69d2b libvirt would fail to start a VM if the default cpu set was specified and individual vcpus were pinned to cpus outside of that cpuset. Peter Krempa (8): qemu: cgroup: Store auto cpuset instead of re-creating it on demand qemu: cgroup: Refactor setup for IOThread cgroups qemu: cgroup: Properly set up vcpu pinning qemu: cgroup: Use priv->autoCpuset instead of using qemuPrepareCpumap() qemu: cgroup: Rename qemuSetupCgroupEmulatorPin to qemuSetupCgroupCpusetCpus qemu: cgroup: Kill qemuSetupCgroupIOThreadsPin() qemu: cgroup: Kill qemuSetupCgroupVcpuPin() qemu: Copy bitmap in a sane way src/qemu/qemu_cgroup.c | 150 +++- src/qemu/qemu_cgroup.h | 13 + src/qemu/qemu_domain.c | 1 + src/qemu/qemu_domain.h | 3 + src/qemu/qemu_driver.c | 21 +++ src/qemu/qemu_process.c | 93 +- src/qemu/qemu_process.h | 2 - 7 files changed, 85 insertions(+), 198 deletions(-) -- 2.2.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/8] qemu: cgroup: Store auto cpuset instead of re-creating it on demand
The automatic cpuset can be stored along with automatic nodeset and it does not have to be recreated when used. --- src/qemu/qemu_cgroup.c | 21 + src/qemu/qemu_domain.c | 1 + src/qemu/qemu_domain.h | 3 +++ src/qemu/qemu_process.c | 11 +++ 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index a422fbc..bc7632f 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -642,8 +642,7 @@ qemuSetupCpusetMems(virDomainObjPtr vm) static int -qemuSetupCpusetCgroup(virDomainObjPtr vm, - virCapsPtr caps) +qemuSetupCpusetCgroup(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; char *cpu_mask = NULL; @@ -658,15 +657,10 @@ qemuSetupCpusetCgroup(virDomainObjPtr vm, if (vm->def->cpumask || (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO)) { -if (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) { -virBitmapPtr cpumap; -if (!(cpumap = virCapabilitiesGetCpusForNodemask(caps, priv->autoNodeset))) -goto cleanup; -cpu_mask = virBitmapFormat(cpumap); -virBitmapFree(cpumap); -} else { +if (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) +cpu_mask = virBitmapFormat(priv->autoCpuset); +else cpu_mask = virBitmapFormat(vm->def->cpumask); -} if (!cpu_mask) goto cleanup; @@ -896,7 +890,6 @@ qemuSetupCgroup(virQEMUDriverPtr driver, int *nicindexes) { qemuDomainObjPrivatePtr priv = vm->privateData; -virCapsPtr caps = NULL; int ret = -1; if (!vm->pid) { @@ -911,9 +904,6 @@ qemuSetupCgroup(virQEMUDriverPtr driver, if (!priv->cgroup) return 0; -if (!(caps = virQEMUDriverGetCapabilities(driver, false))) -goto cleanup; - if (qemuSetupDevicesCgroup(driver, vm) < 0) goto cleanup; @@ -926,12 +916,11 @@ qemuSetupCgroup(virQEMUDriverPtr driver, if (qemuSetupCpuCgroup(driver, vm) < 0) goto cleanup; -if (qemuSetupCpusetCgroup(vm, caps) < 0) +if (qemuSetupCpusetCgroup(vm) < 0) goto cleanup; ret = 0; cleanup: -virObjectUnref(caps); return ret; } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 758fcd9..d1be66e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -458,6 +458,7 @@ qemuDomainObjPrivateFree(void *data) } VIR_FREE(priv->cleanupCallbacks); virBitmapFree(priv->autoNodeset); +virBitmapFree(priv->autoCpuset); VIR_FREE(priv); } diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index b854b54..e4140d8 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -191,7 +191,10 @@ struct _qemuDomainObjPrivate { char **qemuDevices; /* NULL-terminated list of devices aliases known to QEMU */ bool hookRun; /* true if there was a hook run over this domain */ + +/* Bitmaps below hold data from the auto NUMA feature */ virBitmapPtr autoNodeset; +virBitmapPtr autoCpuset; }; typedef enum { diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 79f763e..4a786b1 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4321,7 +4321,6 @@ int qemuProcessStart(virConnectPtr conn, size_t i; bool rawio_set = false; char *nodeset = NULL; -virBitmapPtr nodemask = NULL; unsigned int stop_flags; virQEMUDriverConfigPtr cfg; virCapsPtr caps = NULL; @@ -4582,10 +4581,14 @@ int qemuProcessStart(virConnectPtr conn, VIR_DEBUG("Nodeset returned from numad: %s", nodeset); -if (virBitmapParse(nodeset, 0, &nodemask, VIR_DOMAIN_CPUMASK_LEN) < 0) +if (virBitmapParse(nodeset, 0, &priv->autoNodeset, + VIR_DOMAIN_CPUMASK_LEN) < 0) +goto cleanup; + +if (!(priv->autoCpuset = virCapabilitiesGetCpusForNodemask(caps, + priv->autoNodeset))) goto cleanup; } -priv->autoNodeset = nodemask; /* "volume" type disk's source must be translated before * cgroup and security setting. @@ -4652,7 +4655,7 @@ int qemuProcessStart(virConnectPtr conn, migrateFrom, stdin_fd, snapshot, vmop, &buildCommandLineCallbacks, false, qemuCheckFips(), - nodemask, + priv->autoNodeset, &nnicindexes, &nicindexes))) goto cleanup; -- 2.2.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/8] qemu: cgroup: Refactor setup for IOThread cgroups
Use the default or auto cpuset if they are provided for IOThreads. --- src/qemu/qemu_cgroup.c | 29 + 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index bc7632f..be02ede 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -1255,21 +1255,26 @@ qemuSetupCgroupForIOThreads(virDomainObjPtr vm) /* Set iothreadpin in cgroup if iothreadpin xml is provided */ if (virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET)) { -/* find the right CPU to pin, otherwise - * qemuSetupCgroupIOThreadsPin will fail. */ -for (j = 0; j < def->cputune.niothreadspin; j++) { -/* IOThreads are numbered/named 1..n */ -if (def->cputune.iothreadspin[j]->id != i + 1) -continue; +virBitmapPtr cpumask = NULL; -if (qemuSetupCgroupIOThreadsPin(cgroup_iothread, -def->cputune.iothreadspin, -def->cputune.niothreadspin, -i + 1) < 0) -goto cleanup; +/* default cpu masks */ +if (def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) +cpumask = priv->autoCpuset; +else +cpumask = def->cpumask; -break; +/* specific cpu mask */ +for (j = 0; j < def->cputune.niothreadspin; j++) { +/* IOThreads are numbered/named 1..n */ +if (def->cputune.iothreadspin[j]->id == i + 1) { +cpumask = def->cputune.iothreadspin[j]->cpumask; +break; +} } + +if (cpumask && +qemuSetupCgroupEmulatorPin(cgroup_iothread, cpumask) < 0) +goto cleanup; } virCgroupFree(&cgroup_iothread); -- 2.2.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 7/8] qemu: cgroup: Kill qemuSetupCgroupVcpuPin()
The function doesn't make sense. There's a simpler way to achieve the same. --- src/qemu/qemu_cgroup.c | 16 src/qemu/qemu_cgroup.h | 4 src/qemu/qemu_driver.c | 8 +++- 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index bd768ef..50546a1 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -942,22 +942,6 @@ qemuSetupCgroupVcpuBW(virCgroupPtr cgroup, return -1; } -int -qemuSetupCgroupVcpuPin(virCgroupPtr cgroup, - virDomainPinDefPtr *vcpupin, - int nvcpupin, - int vcpuid) -{ -size_t i; - -for (i = 0; i < nvcpupin; i++) { -if (vcpuid == vcpupin[i]->id) -return qemuSetupCgroupCpusetCpus(cgroup, vcpupin[i]->cpumask); -} - -return -1; -} - int qemuSetupCgroupCpusetCpus(virCgroupPtr cgroup, diff --git a/src/qemu/qemu_cgroup.h b/src/qemu/qemu_cgroup.h index cdeb307..711a6de 100644 --- a/src/qemu/qemu_cgroup.h +++ b/src/qemu/qemu_cgroup.h @@ -52,10 +52,6 @@ int qemuSetupCpusetMems(virDomainObjPtr vm); int qemuSetupCgroupVcpuBW(virCgroupPtr cgroup, unsigned long long period, long long quota); -int qemuSetupCgroupVcpuPin(virCgroupPtr cgroup, - virDomainPinDefPtr *vcpupin, - int nvcpupin, - int vcpuid); int qemuSetupCgroupCpusetCpus(virCgroupPtr cgroup, virBitmapPtr cpumask); int qemuSetupCgroupForVcpu(virDomainObjPtr vm); int qemuSetupCgroupForIOThreads(virDomainObjPtr vm); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index fc44ef1..58fa3c6 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4768,9 +4768,8 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver, } if (cgroup_vcpu) { -if (qemuSetupCgroupVcpuPin(cgroup_vcpu, - vm->def->cputune.vcpupin, - vm->def->cputune.nvcpupin, i) < 0) { +if (qemuSetupCgroupCpusetCpus(cgroup_vcpu, + vcpupin->cpumask) < 0) { virReportError(VIR_ERR_OPERATION_INVALID, _("failed to set cpuset.cpus in cgroup" " for vcpu %zu"), i); @@ -5136,8 +5135,7 @@ qemuDomainPinVcpuFlags(virDomainPtr dom, if (virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET)) { if (virCgroupNewVcpu(priv->cgroup, vcpu, false, &cgroup_vcpu) < 0) goto endjob; -if (qemuSetupCgroupVcpuPin(cgroup_vcpu, newVcpuPin, newVcpuPinNum, - vcpu) < 0) { +if (qemuSetupCgroupCpusetCpus(cgroup_vcpu, pcpumap) < 0) { virReportError(VIR_ERR_OPERATION_INVALID, _("failed to set cpuset.cpus in cgroup" " for vcpu %d"), vcpu); -- 2.2.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/8] qemu: cgroup: Properly set up vcpu pinning
When the default cpuset or automatic numa placement is used libvirt would place the whole parent cgroup in the specified cpuset. This then disallowed to re-pin the vcpus to a different cpu. This patch pins only the vcpu threads to the default cpuset and thus allows to re-pin them later. The following config would fail to start: ... 4 ... This is a regression since a39f69d2b. --- src/qemu/qemu_cgroup.c | 51 +++--- 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index be02ede..8674ab8 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -645,8 +645,6 @@ static int qemuSetupCpusetCgroup(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; -char *cpu_mask = NULL; -int ret = -1; if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET)) return 0; @@ -654,25 +652,7 @@ qemuSetupCpusetCgroup(virDomainObjPtr vm) if (virCgroupSetCpusetMemoryMigrate(priv->cgroup, true) < 0) return -1; -if (vm->def->cpumask || -(vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO)) { - -if (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) -cpu_mask = virBitmapFormat(priv->autoCpuset); -else -cpu_mask = virBitmapFormat(vm->def->cpumask); - -if (!cpu_mask) -goto cleanup; - -if (virCgroupSetCpusetCpus(priv->cgroup, cpu_mask) < 0) -goto cleanup; -} - -ret = 0; - cleanup: -VIR_FREE(cpu_mask); -return ret; +return 0; } @@ -1079,20 +1059,27 @@ qemuSetupCgroupForVcpu(virDomainObjPtr vm) /* Set vcpupin in cgroup if vcpupin xml is provided */ if (virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET)) { -/* find the right CPU to pin, otherwise - * qemuSetupCgroupVcpuPin will fail. */ -for (j = 0; j < def->cputune.nvcpupin; j++) { -if (def->cputune.vcpupin[j]->id != i) -continue; +virBitmapPtr cpumap = NULL; -if (qemuSetupCgroupVcpuPin(cgroup_vcpu, - def->cputune.vcpupin, - def->cputune.nvcpupin, - i) < 0) -goto cleanup; +/* try to use the default cpu maps */ +if (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) +cpumap = priv->autoCpuset; +else +cpumap = vm->def->cpumask; -break; +/* lookup a more specific pinning info */ +for (j = 0; j < def->cputune.nvcpupin; j++) { +if (def->cputune.vcpupin[j]->id == i) { +cpumap = def->cputune.vcpupin[j]->cpumask; +break; +} } + +if (!cpumap) +continue; + +if (qemuSetupCgroupEmulatorPin(cgroup_vcpu, cpumap) < 0) +goto cleanup; } virCgroupFree(&cgroup_vcpu); -- 2.2.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/2] Fix indentation in cmdVcpuPin
On Thu, Mar 26, 2015 at 15:40:36 +0100, Ján Tomko wrote: > --- > tools/virsh-domain.c | 16 > 1 file changed, 8 insertions(+), 8 deletions(-) ACK, Peter signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v4 0/3] Parallels disk device attach
27.03.2015 15:59, Alexander Burluka пишет: This patchset implements disk device attachment and allows OpenStack to attach volumes to Parallels-driven instances. Parallels Cloud Server SDK supports live attachment of disk devices and virtual interfaces cards. Alexander Burluka (3): Parallels: remove disk serial number check Parallels: implement domainAttachDeviceFlags Parallels: implemented domainAttachDevice Now the whole series looks good, ACK. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] iscsi multipath failure with "libvirtError: Failed to open file '/dev/mapper/Mar': No such file or directory"
On Mon, Mar 23, 2015 at 10:14:31PM +0530, mad Engineer wrote: > hello All, > I know the issue is related to libvirt,but i dont know > where to ask. The libvirt mailing list is the place to ask libvirt questions. I have CCed it. > i have centos 6.6 running KVM as compute node in openstack icehouse > > when i try to attach volume to instance it shows > > 2596: error : virStorageFileGetMetadataRecurse:952 : Failed to open > file '/dev/mapper/Mar': No such file or directory > > in libvirt log > > This does not always happen when it happens no one will be able to > attach volume to instance > > > using EMC VNX as storage backend. > > > multipath.conf > > > # Skip the files uner /dev that are definitely not FC/iSCSI devices > # Different system may need different customization > devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*" > devnode "^hd[a-z][0-9]*" > devnode "^cciss!c[0-9]d[0-9]*[p[0-9]*]" > > # Skip LUNZ device from VNX > device { > vendor "DGC" > product "LUNZ" > } > } > > defaults { > user_friendly_names no > flush_on_last_del yes > } > > devices { > # Device attributed for EMC CLARiiON and VNX series ALUA > device { > vendor "DGC" > product ".*" > product_blacklist "LUNZ" > path_grouping_policy group_by_prio > path_selector "round-robin 0" > path_checker emc_clariion > features "1 queue_if_no_path" > hardware_handler "1 alua" > prio alua > failback immediate > } > } > > > Can any one help me with this issue You may need to check dmesg or logs related to the EMC storage. In particular, check for LUNs going offline, coming online, or the multipath device changing state. Stefan pgp5yj6KLBsMf.pgp Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v4 1/3] Parallels: remove disk serial number check
OpenStack needs disk serial number setup because nova boot --block-device-mapping command generates that param in libvirt xml. I took QEMU libvirt driver behavior as a base. QEMU driver skips inability to set serial and continues work. So Parallels driver will ignore this param too and let domain boot. --- src/parallels/parallels_sdk.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index c36b772..fa5c44d 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2358,10 +2358,8 @@ static int prlsdkCheckDiskUnsupportedParams(virDomainDiskDefPtr disk) } if (disk->serial) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Setting disk serial number is not " +VIR_INFO("%s", _("Setting disk serial number is not " "supported by parallels driver.")); -return -1; } if (disk->wwn) { -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v4 2/3] Parallels: implement domainAttachDeviceFlags
Parallels Cloud Server supports block devices and virtual NIC live attachment. I implemented that function for block devices so OpenStack volume attachment is now works. Signed-off-by: Alexander Burluka --- src/parallels/parallels_driver.c | 65 ++ src/parallels/parallels_sdk.c| 27 src/parallels/parallels_sdk.h|4 ++ 3 files changed, 96 insertions(+), 0 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index f5e58a8..8058903 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -1004,6 +1004,70 @@ parallelsDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags) return 0; } +static int parallelsDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, +unsigned int flags) +{ +int ret = -1; +parallelsConnPtr privconn = dom->conn->privateData; +virDomainDeviceDefPtr dev = NULL; +virDomainObjPtr privdom = NULL; +bool domactive = false; + +virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); + +privdom = virDomainObjListFindByUUID(privconn->domains, dom->uuid); +if (privdom == NULL) { +parallelsDomNotFoundError(dom); +goto cleanup; +} + +if (!(flags & VIR_DOMAIN_AFFECT_CONFIG)) { +virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("device attach needs VIR_DOMAIN_AFFECT_CONFIG " + "flag to be set")); +goto cleanup; +} + +domactive = virDomainObjIsActive(privdom); +if (!domactive && (flags & VIR_DOMAIN_AFFECT_LIVE)) { +virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot do live update a device on " + "inactive domain")); +goto cleanup; +} +if (domactive && !(flags & VIR_DOMAIN_AFFECT_LIVE)) { +virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Updates on a running domain need " + "VIR_DOMAIN_AFFECT_LIVE flag")); +} + +dev = virDomainDeviceDefParse(xml, privdom->def, privconn->caps, + privconn->xmlopt, VIR_DOMAIN_XML_INACTIVE); +if (dev == NULL) +goto cleanup; + +switch (dev->type) { +case VIR_DOMAIN_DEVICE_DISK: +ret = prlsdkAttachVolume(dom->conn, privdom, dev->data.disk); +if (ret) { +virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("disk attach failed")); +goto cleanup; +} +break; +default: +virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("device type '%s' cannot be detached"), + virDomainDeviceTypeToString(dev->type)); +break; +} + +ret = 0; + cleanup: +return ret; +} + static virHypervisorDriver parallelsDriver = { .name = "Parallels", .connectOpen = parallelsConnectOpen,/* 0.10.0 */ @@ -1038,6 +1102,7 @@ static virHypervisorDriver parallelsDriver = { .domainDefineXMLFlags = parallelsDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine = parallelsDomainUndefine, /* 1.2.10 */ .domainUndefineFlags = parallelsDomainUndefineFlags, /* 1.2.10 */ +.domainAttachDeviceFlags = parallelsDomainAttachDeviceFlags, /* 1.2.15 */ .domainIsActive = parallelsDomainIsActive, /* 1.2.10 */ .connectDomainEventRegisterAny = parallelsConnectDomainEventRegisterAny, /* 1.2.10 */ .connectDomainEventDeregisterAny = parallelsConnectDomainEventDeregisterAny, /* 1.2.10 */ diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index fa5c44d..05b21d4 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2890,6 +2890,33 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk, bool bootD return ret; } +int +prlsdkAttachVolume(virConnectPtr conn, + virDomainObjPtr dom, + virDomainDiskDefPtr disk) +{ +int ret = -1; +parallelsConnPtr privconn = conn->privateData; +parallelsDomObjPtr privdom = dom->privateData; +PRL_HANDLE job = PRL_INVALID_HANDLE; + +job = PrlVm_BeginEdit(privdom->sdkdom); +if (PRL_FAILED(waitJob(job, privconn->jobTimeout))) +goto cleanup; + +ret = prlsdkAddDisk(privdom->sdkdom, disk, false); +if (ret == 0) { +job = PrlVm_CommitEx(privdom->sdkdom, PVCF_DETACH_HDD_BUNDLE); +if (PRL_FAILED(waitJob(job, privconn->jobTimeout))) { +ret = -1; +goto cleanup; +} +} + + cleanup: +return ret; +} + static int prlsdkAddFS(PRL_HANDLE sdkdom, virDomainFSDefPtr fs) { diff --git a/src/parallels/parallels_sdk.h b/src/parallels/parallels_sdk.h index 694c19b..d68cada 100644 --- a/src/parallels/parallels_sdk.h +++ b/src/parallels/parallels_sdk.h @@ -53,3 +53,7 @@
[libvirt] [PATCH v4 3/3] Parallels: implemented domainAttachDevice
That function uses domainAttachDeviceFlags Signed-off-by: Alexander Burluka --- src/parallels/parallels_driver.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 8058903..d9c173f 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -1068,6 +1068,12 @@ static int parallelsDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, return ret; } +static int parallelsDomainAttachDevice(virDomainPtr dom, const char *xml) +{ +return parallelsDomainAttachDeviceFlags(dom, xml, +VIR_DOMAIN_AFFECT_CONFIG | VIR_DOMAIN_AFFECT_LIVE); +} + static virHypervisorDriver parallelsDriver = { .name = "Parallels", .connectOpen = parallelsConnectOpen,/* 0.10.0 */ @@ -1102,6 +1108,7 @@ static virHypervisorDriver parallelsDriver = { .domainDefineXMLFlags = parallelsDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine = parallelsDomainUndefine, /* 1.2.10 */ .domainUndefineFlags = parallelsDomainUndefineFlags, /* 1.2.10 */ +.domainAttachDevice = parallelsDomainAttachDevice, /* 1.2.15 */ .domainAttachDeviceFlags = parallelsDomainAttachDeviceFlags, /* 1.2.15 */ .domainIsActive = parallelsDomainIsActive, /* 1.2.10 */ .connectDomainEventRegisterAny = parallelsConnectDomainEventRegisterAny, /* 1.2.10 */ -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v4 0/3] Parallels disk device attach
This patchset implements disk device attachment and allows OpenStack to attach volumes to Parallels-driven instances. Parallels Cloud Server SDK supports live attachment of disk devices and virtual interfaces cards. Alexander Burluka (3): Parallels: remove disk serial number check Parallels: implement domainAttachDeviceFlags Parallels: implemented domainAttachDevice -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v3 3/3] Parallels: implemented domainAttachDevice
27.03.2015 15:34, Alexander Burluka пишет: That function uses domainAttachDeviceFlags Signed-off-by: Alexander Burluka --- src/parallels/parallels_driver.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 8058903..632f614 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -1068,6 +1068,12 @@ static int parallelsDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, return ret; } +static int parallelsDomainAttachDevice(virDomainPtr dom, const char *xml) +{ +return parallelsDomainAttachDeviceFlags(dom, xml, +VIR_DOMAIN_AFFECT_LIVE); +} + Since you've started to demand VIR_DOMAIN_AFFECT_CONFIG it is necessary here too. static virHypervisorDriver parallelsDriver = { .name = "Parallels", .connectOpen = parallelsConnectOpen,/* 0.10.0 */ @@ -1102,6 +1108,7 @@ static virHypervisorDriver parallelsDriver = { .domainDefineXMLFlags = parallelsDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine = parallelsDomainUndefine, /* 1.2.10 */ .domainUndefineFlags = parallelsDomainUndefineFlags, /* 1.2.10 */ +.domainAttachDevice = parallelsDomainAttachDevice, /* 1.2.15 */ .domainAttachDeviceFlags = parallelsDomainAttachDeviceFlags, /* 1.2.15 */ .domainIsActive = parallelsDomainIsActive, /* 1.2.10 */ .connectDomainEventRegisterAny = parallelsConnectDomainEventRegisterAny, /* 1.2.10 */ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v3 2/3] Parallels: implement domainAttachDeviceFlags
Parallels Cloud Server supports block devices and virtual NIC live attachment. I implemented that function for block devices so OpenStack volume attachment is now works. Signed-off-by: Alexander Burluka --- src/parallels/parallels_driver.c | 65 ++ src/parallels/parallels_sdk.c| 27 src/parallels/parallels_sdk.h|4 ++ 3 files changed, 96 insertions(+), 0 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index f5e58a8..8058903 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -1004,6 +1004,70 @@ parallelsDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags) return 0; } +static int parallelsDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, +unsigned int flags) +{ +int ret = -1; +parallelsConnPtr privconn = dom->conn->privateData; +virDomainDeviceDefPtr dev = NULL; +virDomainObjPtr privdom = NULL; +bool domactive = false; + +virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); + +privdom = virDomainObjListFindByUUID(privconn->domains, dom->uuid); +if (privdom == NULL) { +parallelsDomNotFoundError(dom); +goto cleanup; +} + +if (!(flags & VIR_DOMAIN_AFFECT_CONFIG)) { +virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("device attach needs VIR_DOMAIN_AFFECT_CONFIG " + "flag to be set")); +goto cleanup; +} + +domactive = virDomainObjIsActive(privdom); +if (!domactive && (flags & VIR_DOMAIN_AFFECT_LIVE)) { +virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot do live update a device on " + "inactive domain")); +goto cleanup; +} +if (domactive && !(flags & VIR_DOMAIN_AFFECT_LIVE)) { +virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Updates on a running domain need " + "VIR_DOMAIN_AFFECT_LIVE flag")); +} + +dev = virDomainDeviceDefParse(xml, privdom->def, privconn->caps, + privconn->xmlopt, VIR_DOMAIN_XML_INACTIVE); +if (dev == NULL) +goto cleanup; + +switch (dev->type) { +case VIR_DOMAIN_DEVICE_DISK: +ret = prlsdkAttachVolume(dom->conn, privdom, dev->data.disk); +if (ret) { +virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("disk attach failed")); +goto cleanup; +} +break; +default: +virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("device type '%s' cannot be detached"), + virDomainDeviceTypeToString(dev->type)); +break; +} + +ret = 0; + cleanup: +return ret; +} + static virHypervisorDriver parallelsDriver = { .name = "Parallels", .connectOpen = parallelsConnectOpen,/* 0.10.0 */ @@ -1038,6 +1102,7 @@ static virHypervisorDriver parallelsDriver = { .domainDefineXMLFlags = parallelsDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine = parallelsDomainUndefine, /* 1.2.10 */ .domainUndefineFlags = parallelsDomainUndefineFlags, /* 1.2.10 */ +.domainAttachDeviceFlags = parallelsDomainAttachDeviceFlags, /* 1.2.15 */ .domainIsActive = parallelsDomainIsActive, /* 1.2.10 */ .connectDomainEventRegisterAny = parallelsConnectDomainEventRegisterAny, /* 1.2.10 */ .connectDomainEventDeregisterAny = parallelsConnectDomainEventDeregisterAny, /* 1.2.10 */ diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index fa5c44d..05b21d4 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2890,6 +2890,33 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk, bool bootD return ret; } +int +prlsdkAttachVolume(virConnectPtr conn, + virDomainObjPtr dom, + virDomainDiskDefPtr disk) +{ +int ret = -1; +parallelsConnPtr privconn = conn->privateData; +parallelsDomObjPtr privdom = dom->privateData; +PRL_HANDLE job = PRL_INVALID_HANDLE; + +job = PrlVm_BeginEdit(privdom->sdkdom); +if (PRL_FAILED(waitJob(job, privconn->jobTimeout))) +goto cleanup; + +ret = prlsdkAddDisk(privdom->sdkdom, disk, false); +if (ret == 0) { +job = PrlVm_CommitEx(privdom->sdkdom, PVCF_DETACH_HDD_BUNDLE); +if (PRL_FAILED(waitJob(job, privconn->jobTimeout))) { +ret = -1; +goto cleanup; +} +} + + cleanup: +return ret; +} + static int prlsdkAddFS(PRL_HANDLE sdkdom, virDomainFSDefPtr fs) { diff --git a/src/parallels/parallels_sdk.h b/src/parallels/parallels_sdk.h index 694c19b..d68cada 100644 --- a/src/parallels/parallels_sdk.h +++ b/src/parallels/parallels_sdk.h @@ -53,3 +53,7 @@
[libvirt] [PATCH v3 1/3] Parallels: remove disk serial number check
OpenStack needs disk serial number setup because nova boot --block-device-mapping command generates that param in libvirt xml. I took QEMU libvirt driver behavior as a base. QEMU driver skips inability to set serial and continues work. So Parallels driver will ignore this param too and let domain boot. --- src/parallels/parallels_sdk.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index c36b772..fa5c44d 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2358,10 +2358,8 @@ static int prlsdkCheckDiskUnsupportedParams(virDomainDiskDefPtr disk) } if (disk->serial) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Setting disk serial number is not " +VIR_INFO("%s", _("Setting disk serial number is not " "supported by parallels driver.")); -return -1; } if (disk->wwn) { -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v3 0/3] Parallels disk device attach
This patchset implements disk device attachment and allows OpenStack to attach volumes to Parallels-driven instances. Parallels Cloud Server SDK supports live attachment of disk devices and virtual interfaces cards. Alexander Burluka (3): Parallels: remove disk serial number check Parallels: implement domainAttachDeviceFlags Parallels: implemented domainAttachDevice -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v3 3/3] Parallels: implemented domainAttachDevice
That function uses domainAttachDeviceFlags Signed-off-by: Alexander Burluka --- src/parallels/parallels_driver.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 8058903..632f614 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -1068,6 +1068,12 @@ static int parallelsDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, return ret; } +static int parallelsDomainAttachDevice(virDomainPtr dom, const char *xml) +{ +return parallelsDomainAttachDeviceFlags(dom, xml, +VIR_DOMAIN_AFFECT_LIVE); +} + static virHypervisorDriver parallelsDriver = { .name = "Parallels", .connectOpen = parallelsConnectOpen,/* 0.10.0 */ @@ -1102,6 +1108,7 @@ static virHypervisorDriver parallelsDriver = { .domainDefineXMLFlags = parallelsDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine = parallelsDomainUndefine, /* 1.2.10 */ .domainUndefineFlags = parallelsDomainUndefineFlags, /* 1.2.10 */ +.domainAttachDevice = parallelsDomainAttachDevice, /* 1.2.15 */ .domainAttachDeviceFlags = parallelsDomainAttachDeviceFlags, /* 1.2.15 */ .domainIsActive = parallelsDomainIsActive, /* 1.2.10 */ .connectDomainEventRegisterAny = parallelsConnectDomainEventRegisterAny, /* 1.2.10 */ -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 2/3] Parallels: implement domainAttachDeviceFlags
27.03.2015 14:25, Alexander Burluka пишет: Parallels Cloud Server supports block devices and virtual NIC live attachment. I implemented that function for block devices so OpenStack volume attachment is now works. Signed-off-by: Alexander Burluka --- src/parallels/parallels_driver.c | 51 ++ src/parallels/parallels_sdk.c| 28 src/parallels/parallels_sdk.h|4 +++ 3 files changed, 83 insertions(+), 0 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index f5e58a8..dd8ed7d 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -1004,6 +1004,56 @@ parallelsDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags) return 0; } +static int parallelsDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, +unsigned int flags) +{ +int ret = -1; +parallelsConnPtr privconn = dom->conn->privateData; +virDomainDeviceDefPtr dev = NULL; +virDomainObjPtr privdom = NULL; + +virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); + +privdom = virDomainObjListFindByUUID(privconn->domains, dom->uuid); +if (privdom == NULL) { +parallelsDomNotFoundError(dom); +goto cleanup; +} + +if (!virDomainObjIsActive(privdom) && (flags & VIR_DOMAIN_AFFECT_LIVE)) { +virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot do live update a device on " + "inactive domain")); +goto cleanup; +} + I think we should demand VIR_DOMAIN_AFFECT_CONFIG flag because we can't attach devices without touching corresponding PCS config. +dev = virDomainDeviceDefParse(xml, privdom->def, privconn->caps, + privconn->xmlopt, VIR_DOMAIN_XML_INACTIVE); +if (dev == NULL) +goto cleanup; + +switch (dev->type) { +case VIR_DOMAIN_DEVICE_DISK: +ret = prlsdkAttachVolume(dom->conn, privdom, dev->data.disk); +if (ret) { +virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("disk attach failed")); +goto cleanup; +} +break; +default: +virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("device type '%s' cannot be detached"), + virDomainDeviceTypeToString(dev->type)); +break; +} + +ret = 0; + cleanup: +return ret; +} + static virHypervisorDriver parallelsDriver = { .name = "Parallels", .connectOpen = parallelsConnectOpen,/* 0.10.0 */ @@ -1038,6 +1088,7 @@ static virHypervisorDriver parallelsDriver = { .domainDefineXMLFlags = parallelsDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine = parallelsDomainUndefine, /* 1.2.10 */ .domainUndefineFlags = parallelsDomainUndefineFlags, /* 1.2.10 */ +.domainAttachDeviceFlags = parallelsDomainAttachDeviceFlags, /* 1.2.15 */ .domainIsActive = parallelsDomainIsActive, /* 1.2.10 */ .connectDomainEventRegisterAny = parallelsConnectDomainEventRegisterAny, /* 1.2.10 */ .connectDomainEventDeregisterAny = parallelsConnectDomainEventDeregisterAny, /* 1.2.10 */ diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index fa5c44d..0b324d9 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2890,6 +2890,34 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk, bool bootD return ret; } +int +prlsdkAttachVolume(virConnectPtr conn, + virDomainObjPtr dom, + virDomainDiskDefPtr disk) +{ +int ret = -1; +parallelsConnPtr privconn = conn->privateData; +parallelsDomObjPtr privdom = dom->privateData; +PRL_HANDLE sdkdom = PRL_INVALID_HANDLE; +PRL_HANDLE job = PRL_INVALID_HANDLE; + +job = PrlVm_BeginEdit(privdom->sdkdom); +if (PRL_FAILED(waitJob(job, privconn->jobTimeout))) +goto cleanup; + +ret = prlsdkAddDisk(privdom->sdkdom, disk, false); +if (ret == 0) { +job = PrlVm_CommitEx(sdkdom, PVCF_DETACH_HDD_BUNDLE); +if (PRL_FAILED(waitJob(job, privconn->jobTimeout))) { +ret = -1; +goto cleanup; +} +} + + cleanup: +return ret; +} + static int prlsdkAddFS(PRL_HANDLE sdkdom, virDomainFSDefPtr fs) { diff --git a/src/parallels/parallels_sdk.h b/src/parallels/parallels_sdk.h index 694c19b..d68cada 100644 --- a/src/parallels/parallels_sdk.h +++ b/src/parallels/parallels_sdk.h @@ -53,3 +53,7 @@ int prlsdkCreateVm(virConnectPtr conn, virDomainDefPtr def); int prlsdkCreateCt(virConnectPtr conn, virDomainDefPtr def); int prlsdkUnregisterDomain(parallelsConnPtr privconn, virDomainObjPtr dom); +int +prlsdkAttachVolume(virConnectPtr conn, + virDomainObjPtr dom, + virD
Re: [libvirt] [PATCH v2 2/3] Parallels: implement domainAttachDeviceFlags
On 03/27/2015 02:25 PM, Alexander Burluka wrote: Parallels Cloud Server supports block devices and virtual NIC live attachment. I implemented that function for block devices so OpenStack volume attachment is now works. Signed-off-by: Alexander Burluka --- src/parallels/parallels_driver.c | 51 ++ src/parallels/parallels_sdk.c| 28 src/parallels/parallels_sdk.h|4 +++ 3 files changed, 83 insertions(+), 0 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index f5e58a8..dd8ed7d 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -1004,6 +1004,56 @@ parallelsDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags) return 0; } +static int parallelsDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, +unsigned int flags) +{ +int ret = -1; +parallelsConnPtr privconn = dom->conn->privateData; +virDomainDeviceDefPtr dev = NULL; +virDomainObjPtr privdom = NULL; + +virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); + +privdom = virDomainObjListFindByUUID(privconn->domains, dom->uuid); +if (privdom == NULL) { +parallelsDomNotFoundError(dom); +goto cleanup; +} + +if (!virDomainObjIsActive(privdom) && (flags & VIR_DOMAIN_AFFECT_LIVE)) { +virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot do live update a device on " + "inactive domain")); +goto cleanup; +} + +dev = virDomainDeviceDefParse(xml, privdom->def, privconn->caps, + privconn->xmlopt, VIR_DOMAIN_XML_INACTIVE); +if (dev == NULL) +goto cleanup; + +switch (dev->type) { +case VIR_DOMAIN_DEVICE_DISK: +ret = prlsdkAttachVolume(dom->conn, privdom, dev->data.disk); +if (ret) { +virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("disk attach failed")); +goto cleanup; +} +break; +default: +virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("device type '%s' cannot be detached"), + virDomainDeviceTypeToString(dev->type)); +break; +} + +ret = 0; + cleanup: +return ret; +} + static virHypervisorDriver parallelsDriver = { .name = "Parallels", .connectOpen = parallelsConnectOpen,/* 0.10.0 */ @@ -1038,6 +1088,7 @@ static virHypervisorDriver parallelsDriver = { .domainDefineXMLFlags = parallelsDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine = parallelsDomainUndefine, /* 1.2.10 */ .domainUndefineFlags = parallelsDomainUndefineFlags, /* 1.2.10 */ +.domainAttachDeviceFlags = parallelsDomainAttachDeviceFlags, /* 1.2.15 */ .domainIsActive = parallelsDomainIsActive, /* 1.2.10 */ .connectDomainEventRegisterAny = parallelsConnectDomainEventRegisterAny, /* 1.2.10 */ .connectDomainEventDeregisterAny = parallelsConnectDomainEventDeregisterAny, /* 1.2.10 */ diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index fa5c44d..0b324d9 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2890,6 +2890,34 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk, bool bootD return ret; } +int +prlsdkAttachVolume(virConnectPtr conn, + virDomainObjPtr dom, + virDomainDiskDefPtr disk) +{ +int ret = -1; +parallelsConnPtr privconn = conn->privateData; +parallelsDomObjPtr privdom = dom->privateData; +PRL_HANDLE sdkdom = PRL_INVALID_HANDLE; You can remove sdkdom +PRL_HANDLE job = PRL_INVALID_HANDLE; + +job = PrlVm_BeginEdit(privdom->sdkdom); +if (PRL_FAILED(waitJob(job, privconn->jobTimeout))) +goto cleanup; + +ret = prlsdkAddDisk(privdom->sdkdom, disk, false); +if (ret == 0) { +job = PrlVm_CommitEx(sdkdom, PVCF_DETACH_HDD_BUNDLE); privdom->sdkdom +if (PRL_FAILED(waitJob(job, privconn->jobTimeout))) { +ret = -1; +goto cleanup; +} +} + + cleanup: +return ret; +} + static int prlsdkAddFS(PRL_HANDLE sdkdom, virDomainFSDefPtr fs) { diff --git a/src/parallels/parallels_sdk.h b/src/parallels/parallels_sdk.h index 694c19b..d68cada 100644 --- a/src/parallels/parallels_sdk.h +++ b/src/parallels/parallels_sdk.h @@ -53,3 +53,7 @@ int prlsdkCreateVm(virConnectPtr conn, virDomainDefPtr def); int prlsdkCreateCt(virConnectPtr conn, virDomainDefPtr def); int prlsdkUnregisterDomain(parallelsConnPtr privconn, virDomainObjPtr dom); +int +prlsdkAttachVolume(virConnectPtr conn, + virDomainObjPtr dom, + virDomainDiskDefPtr disk); -- Dmitry Guryanov -- libvir-list mailing list libvir-l
[libvirt] [PATCH v2 2/3] Parallels: implement domainAttachDeviceFlags
Parallels Cloud Server supports block devices and virtual NIC live attachment. I implemented that function for block devices so OpenStack volume attachment is now works. Signed-off-by: Alexander Burluka --- src/parallels/parallels_driver.c | 51 ++ src/parallels/parallels_sdk.c| 28 src/parallels/parallels_sdk.h|4 +++ 3 files changed, 83 insertions(+), 0 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index f5e58a8..dd8ed7d 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -1004,6 +1004,56 @@ parallelsDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags) return 0; } +static int parallelsDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, +unsigned int flags) +{ +int ret = -1; +parallelsConnPtr privconn = dom->conn->privateData; +virDomainDeviceDefPtr dev = NULL; +virDomainObjPtr privdom = NULL; + +virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); + +privdom = virDomainObjListFindByUUID(privconn->domains, dom->uuid); +if (privdom == NULL) { +parallelsDomNotFoundError(dom); +goto cleanup; +} + +if (!virDomainObjIsActive(privdom) && (flags & VIR_DOMAIN_AFFECT_LIVE)) { +virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot do live update a device on " + "inactive domain")); +goto cleanup; +} + +dev = virDomainDeviceDefParse(xml, privdom->def, privconn->caps, + privconn->xmlopt, VIR_DOMAIN_XML_INACTIVE); +if (dev == NULL) +goto cleanup; + +switch (dev->type) { +case VIR_DOMAIN_DEVICE_DISK: +ret = prlsdkAttachVolume(dom->conn, privdom, dev->data.disk); +if (ret) { +virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("disk attach failed")); +goto cleanup; +} +break; +default: +virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("device type '%s' cannot be detached"), + virDomainDeviceTypeToString(dev->type)); +break; +} + +ret = 0; + cleanup: +return ret; +} + static virHypervisorDriver parallelsDriver = { .name = "Parallels", .connectOpen = parallelsConnectOpen,/* 0.10.0 */ @@ -1038,6 +1088,7 @@ static virHypervisorDriver parallelsDriver = { .domainDefineXMLFlags = parallelsDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine = parallelsDomainUndefine, /* 1.2.10 */ .domainUndefineFlags = parallelsDomainUndefineFlags, /* 1.2.10 */ +.domainAttachDeviceFlags = parallelsDomainAttachDeviceFlags, /* 1.2.15 */ .domainIsActive = parallelsDomainIsActive, /* 1.2.10 */ .connectDomainEventRegisterAny = parallelsConnectDomainEventRegisterAny, /* 1.2.10 */ .connectDomainEventDeregisterAny = parallelsConnectDomainEventDeregisterAny, /* 1.2.10 */ diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index fa5c44d..0b324d9 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2890,6 +2890,34 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk, bool bootD return ret; } +int +prlsdkAttachVolume(virConnectPtr conn, + virDomainObjPtr dom, + virDomainDiskDefPtr disk) +{ +int ret = -1; +parallelsConnPtr privconn = conn->privateData; +parallelsDomObjPtr privdom = dom->privateData; +PRL_HANDLE sdkdom = PRL_INVALID_HANDLE; +PRL_HANDLE job = PRL_INVALID_HANDLE; + +job = PrlVm_BeginEdit(privdom->sdkdom); +if (PRL_FAILED(waitJob(job, privconn->jobTimeout))) +goto cleanup; + +ret = prlsdkAddDisk(privdom->sdkdom, disk, false); +if (ret == 0) { +job = PrlVm_CommitEx(sdkdom, PVCF_DETACH_HDD_BUNDLE); +if (PRL_FAILED(waitJob(job, privconn->jobTimeout))) { +ret = -1; +goto cleanup; +} +} + + cleanup: +return ret; +} + static int prlsdkAddFS(PRL_HANDLE sdkdom, virDomainFSDefPtr fs) { diff --git a/src/parallels/parallels_sdk.h b/src/parallels/parallels_sdk.h index 694c19b..d68cada 100644 --- a/src/parallels/parallels_sdk.h +++ b/src/parallels/parallels_sdk.h @@ -53,3 +53,7 @@ int prlsdkCreateVm(virConnectPtr conn, virDomainDefPtr def); int prlsdkCreateCt(virConnectPtr conn, virDomainDefPtr def); int prlsdkUnregisterDomain(parallelsConnPtr privconn, virDomainObjPtr dom); +int +prlsdkAttachVolume(virConnectPtr conn, + virDomainObjPtr dom, + virDomainDiskDefPtr disk); -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 0/3] Parallels disk device attach
This patchset implements disk device attachment and allows OpenStack to attach volumes to Parallels-driven instances. Parallels Cloud Server SDK supports live attachment of disk devices and virtual interfaces cards. Alexander Burluka (3): Parallels: remove disk serial number check Parallels: implement domainAttachDeviceFlags Parallels: implemented domainAttachDevice -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 3/3] Parallels: implemented domainAttachDevice
That function uses domainAttachDeviceFlags Signed-off-by: Alexander Burluka --- src/parallels/parallels_driver.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index dd8ed7d..0fc9c50 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -1054,6 +1054,12 @@ static int parallelsDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, return ret; } +static int parallelsDomainAttachDevice(virDomainPtr dom, const char *xml) +{ +return parallelsDomainAttachDeviceFlags(dom, xml, +VIR_DOMAIN_AFFECT_LIVE); +} + static virHypervisorDriver parallelsDriver = { .name = "Parallels", .connectOpen = parallelsConnectOpen,/* 0.10.0 */ @@ -1088,6 +1094,7 @@ static virHypervisorDriver parallelsDriver = { .domainDefineXMLFlags = parallelsDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine = parallelsDomainUndefine, /* 1.2.10 */ .domainUndefineFlags = parallelsDomainUndefineFlags, /* 1.2.10 */ +.domainAttachDevice = parallelsDomainAttachDevice, /* 1.2.15 */ .domainAttachDeviceFlags = parallelsDomainAttachDeviceFlags, /* 1.2.15 */ .domainIsActive = parallelsDomainIsActive, /* 1.2.10 */ .connectDomainEventRegisterAny = parallelsConnectDomainEventRegisterAny, /* 1.2.10 */ -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 1/3] Parallels: remove disk serial number check
OpenStack needs disk serial number setup because nova boot --block-device-mapping command generates that param in libvirt xml. I took QEMU libvirt driver behavior as a base. QEMU driver skips inability to set serial and continues work. So Parallels driver will ignore this param too and let domain boot. --- src/parallels/parallels_sdk.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index c36b772..fa5c44d 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2358,10 +2358,8 @@ static int prlsdkCheckDiskUnsupportedParams(virDomainDiskDefPtr disk) } if (disk->serial) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Setting disk serial number is not " +VIR_INFO("%s", _("Setting disk serial number is not " "supported by parallels driver.")); -return -1; } if (disk->wwn) { -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] virnetlink: fix build error
Commint 0473b45cc introduced new function virNetlinkDelLink, but in it's counterpart for non-linux platform there should be ATTRIBUTE_UNUSED instead of ATTRIBUTE_UNSUPPORTED. Signed-off-by: Pavel Hrdina --- Pushed under build-breaker rule. src/util/virnetlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c index 86c9c9c..0052ef9 100644 --- a/src/util/virnetlink.c +++ b/src/util/virnetlink.c @@ -886,7 +886,7 @@ int virNetlinkCommand(struct nl_msg *nl_msg ATTRIBUTE_UNUSED, int -virNetlinkDelLink(const char *ifname ATTRIBUTE_UNSUPPORTED) +virNetlinkDelLink(const char *ifname ATTRIBUTE_UNUSED) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported)); return -1; -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 6/7] virsh: introduce new macros to help check flag requirements
Signed-off-by: Pavel Hrdina --- tools/virsh.h | 52 1 file changed, 52 insertions(+) diff --git a/tools/virsh.h b/tools/virsh.h index df2ea7f..fde20ef 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -474,4 +474,56 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename, # define VSH_EXCLUSIVE_OPTIONS_VAR(VARNAME1, VARNAME2) \ VSH_EXCLUSIVE_OPTIONS_EXPR(#VARNAME1, VARNAME1, #VARNAME2, VARNAME2) +/* Macros to help dealing with required options. */ + +/* VSH_REQUIRE_OPTION_EXPR: + * + * @NAME1: String containing the name of the option. + * @EXPR1: Expression to validate the variable (boolean variable). + * @NAME2: String containing the name of required option. + * @EXPR2: Expression to validate the variable (boolean variable). + * + * Check if required command options in virsh was set. Use the + * provided expression to check the variables. + * + * This helper does an early return and therefore it has to be called + * before anything that would require cleanup. + */ +# define VSH_REQUIRE_OPTION_EXPR(NAME1, EXPR1, NAME2, EXPR2)\ +if ((EXPR1) && !(EXPR2)) { \ +vshError(ctl, _("Option --%s is required by option --%s"), \ + NAME2, NAME1); \ +return false; \ +} + +/* VSH_REQUIRE_OPTION: + * + * @NAME1: String containing the name of the option. + * @NAME2: String containing the name of required option. + * + * Check if required command options in virsh was set. Use the + * vshCommandOptBool call to request them. + * + * This helper does an early return and therefore it has to be called + * before anything that would require cleanup. + */ +# define VSH_REQUIRE_OPTION(NAME1, NAME2) \ +VSH_REQUIRE_OPTION_EXPR(NAME1, vshCommandOptBool(cmd, NAME1), \ +NAME2, vshCommandOptBool(cmd, NAME2)) + +/* VSH_REQUIRE_OPTION_VAR: + * + * @VARNAME1: Boolean variable containing the value of the option of same name. + * @VARNAME2: Boolean variable containing the value of required option of + *same name. + * + * Check if required command options in virsh was set. Check in variables + * that contain the value and have same name as the option. + * + * This helper does an early return and therefore it has to be called + * before anything that would require cleanup. + */ +# define VSH_REQUIRE_OPTION_VAR(VARNAME1, VARNAME2) \ +VSH_REQUIRE_OPTION_EXPR(#VARNAME1, VARNAME1, #VARNAME2, VARNAME2) + #endif /* VIRSH_H */ -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 4/7] use new macro helpers to check flag requirements
Signed-off-by: Pavel Hrdina --- src/libvirt-domain-snapshot.c | 11 +++ src/qemu/qemu_driver.c| 9 +++-- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/libvirt-domain-snapshot.c b/src/libvirt-domain-snapshot.c index 0d5c5e8..9d43f54 100644 --- a/src/libvirt-domain-snapshot.c +++ b/src/libvirt-domain-snapshot.c @@ -220,14 +220,9 @@ virDomainSnapshotCreateXML(virDomainPtr domain, virCheckNonNullArgGoto(xmlDesc, error); virCheckReadOnlyGoto(conn->flags, error); -if ((flags & VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT) && -!(flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE)) { -virReportInvalidArg(flags, -_("use of 'current' flag in %s requires " - "'redefine' flag"), -__FUNCTION__); -goto error; -} +VIR_REQUIRE_FLAG_GOTO(VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT, + VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE, + error); VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE, VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f7d77e7..a5ee99d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14541,12 +14541,9 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC | VIR_DOMAIN_SNAPSHOT_CREATE_LIVE, NULL); -if ((flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE) && -!(flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY)) { -virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("quiesce requires disk-only")); -return NULL; -} +VIR_REQUIRE_FLAG_RET(VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE, + VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY, + NULL); if ((redefine && !(flags & VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT)) || (flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA)) -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 7/7] tools: fix the wrong check when use virsh setvcpus --maximum
From: Luyao Huang We will ignore --maximum option when only use setvcpus with this option, like this (this error is another issue): # virsh setvcpus test3 --maximum 10 error: Failed to create controller cpu for group: No such file or directory this is because we do not set it in flags before we check if there is a flags set. Refactor these code and fix the logic. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1204033 Signed-off-by: Luyao Huang Signed-off-by: Pavel Hrdina --- tools/virsh-domain.c | 30 ++ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index b39f4b6..1938f56 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6736,15 +6736,16 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd) VSH_EXCLUSIVE_OPTIONS_VAR(current, config); VSH_EXCLUSIVE_OPTIONS_VAR(guest, config); +VSH_REQUIRE_OPTION_VAR(maximum, config); + if (config) flags |= VIR_DOMAIN_AFFECT_CONFIG; if (live) flags |= VIR_DOMAIN_AFFECT_LIVE; if (guest) flags |= VIR_DOMAIN_VCPU_GUEST; -/* none of the options were specified */ -if (!current && flags == 0) -flags = -1; +if (maximum) +flags |= VIR_DOMAIN_VCPU_MAXIMUM; if (!(dom = vshCommandOptDomain(ctl, cmd, NULL))) return false; @@ -6754,30 +6755,11 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd) goto cleanup; } -if (flags == -1) { +/* none of the options were specified */ +if (!current && flags == 0) { if (virDomainSetVcpus(dom, count) != 0) goto cleanup; } else { -/* If the --maximum flag was given, we need to ensure only the - --config flag is in effect as well */ -if (maximum) { -vshDebug(ctl, VSH_ERR_DEBUG, "--maximum flag was given\n"); - -flags |= VIR_DOMAIN_VCPU_MAXIMUM; - -/* If neither the --config nor --live flags were given, OR - if just the --live flag was given, we need to error out - warning the user that the --maximum flag can only be used - with the --config flag */ -if (live || !config) { - -/* Warn the user about the invalid flag combination */ -vshError(ctl, _("--maximum must be used with --config only")); -goto cleanup; -} -} - -/* Apply the virtual cpu changes */ if (virDomainSetVcpusFlags(dom, count, flags) < 0) goto cleanup; } -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 2/7] internal: introduce macro helpers to check flag requirements
Similar to VIR_EXLUSIVE_FLAGS, it will error out if flag requirement is not met. Signed-off-by: Pavel Hrdina --- src/internal.h | 43 +++ 1 file changed, 43 insertions(+) diff --git a/src/internal.h b/src/internal.h index eb8d231..6363e58 100644 --- a/src/internal.h +++ b/src/internal.h @@ -371,6 +371,49 @@ goto LABEL; \ } +/* Macros to help dealing with flag requirements. */ + +/** + * VIR_REQUIRE_FLAG_RET: + * + * @FLAG1: First flag to be checked. + * @FLAG2: Second flag that is required by first flag. + * @RET: Return value. + * + * Check whether required flag is set. The checked flags are compared + * with flags variable. + * + * This helper does an early return and therefore it has to be called + * before anything that would require cleanup. + */ +# define VIR_REQUIRE_FLAG_RET(FLAG1, FLAG2, RET)\ +if ((flags & FLAG1) && !(flags & FLAG2)) { \ +virReportInvalidArg(ctl,\ +_("Flag '%s' is required by flag '%s'"),\ +#FLAG2, #FLAG1);\ +return RET; \ +} + +/** + * VIR_REQUIRE_FLAG_GOTO: + * + * @FLAG1: First flag to be checked. + * @FLAG2: Second flag that is required by first flag. + * @LABEL: Label to jump to. + * + * Check whether required flag is set. The checked flags are compared + * with flags variable. + * + * Returns nothing. Jumps to a label if required flag is not set. + */ +# define VIR_REQUIRE_FLAG_GOTO(FLAG1, FLAG2, LABEL) \ +if ((flags & FLAG1) && !(flags & FLAG2)) { \ +virReportInvalidArg(ctl,\ +_("Flag '%s' is required by flag '%s'"),\ +#FLAG2, #FLAG1);\ +goto LABEL; \ +} + # define virCheckNonNullArgReturn(argname, retval) \ do {\ if (argname == NULL) { \ -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 5/7] qemu: use new macros for setvcpus to check flags and cleanup the code
Now that we have macros for exclusive flags and flag requirements we can use them to cleanup the code for setvcpus and error out for all wrong flag combination. Signed-off-by: Pavel Hrdina --- src/libvirt-domain.c | 12 +++- src/qemu/qemu_driver.c | 14 -- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index af69d12..a4ae327 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -7252,8 +7252,18 @@ virDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus, virCheckDomainReturn(domain, -1); virCheckReadOnlyGoto(domain->conn->flags, error); +VIR_REQUIRE_FLAG_GOTO(VIR_DOMAIN_VCPU_MAXIMUM, + VIR_DOMAIN_AFFECT_CONFIG, + error); + +VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_CURRENT, + VIR_DOMAIN_AFFECT_LIVE, + error); +VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_CURRENT, + VIR_DOMAIN_AFFECT_CONFIG, + error); VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_VCPU_GUEST, - VIR_DOMAIN_VCPU_MAXIMUM, + VIR_DOMAIN_AFFECT_CONFIG, error); virCheckNonZeroArgGoto(nvcpus, error); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a5ee99d..aa58aa2 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4902,13 +4902,6 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, goto endjob; } -/* MAXIMUM cannot be mixed with LIVE. */ -if ((flags & VIR_DOMAIN_VCPU_MAXIMUM) && (flags & VIR_DOMAIN_AFFECT_LIVE)) { -virReportError(VIR_ERR_INVALID_ARG, "%s", - _("cannot adjust maximum vcpus on running domain")); -goto endjob; -} - if (flags & VIR_DOMAIN_AFFECT_LIVE) maxvcpus = vm->def->maxvcpus; if (flags & VIR_DOMAIN_AFFECT_CONFIG) { @@ -4924,13 +4917,6 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, } if (flags & VIR_DOMAIN_VCPU_GUEST) { -if (flags & VIR_DOMAIN_AFFECT_CONFIG) { -virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("setting vcpus via guest agent isn't supported " - "on offline domain")); -goto endjob; -} - if (!qemuDomainAgentAvailable(vm, true)) goto endjob; -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 3/7] use new macro helpers to check exclusive flags
Signed-off-by: Pavel Hrdina --- src/libvirt-domain-snapshot.c | 45 ++ src/libvirt-domain.c | 276 ++--- src/qemu/qemu_driver.c | 10 +- src/storage/storage_backend_disk.c | 10 +- src/storage/storage_backend_fs.c | 11 +- 5 files changed, 95 insertions(+), 257 deletions(-) diff --git a/src/libvirt-domain-snapshot.c b/src/libvirt-domain-snapshot.c index 9feb669..0d5c5e8 100644 --- a/src/libvirt-domain-snapshot.c +++ b/src/libvirt-domain-snapshot.c @@ -228,22 +228,13 @@ virDomainSnapshotCreateXML(virDomainPtr domain, __FUNCTION__); goto error; } -if ((flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE) && -(flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA)) { -virReportInvalidArg(flags, -_("'redefine' and 'no metadata' flags in %s are " - "mutually exclusive"), -__FUNCTION__); -goto error; -} -if ((flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE) && -(flags & VIR_DOMAIN_SNAPSHOT_CREATE_HALT)) { -virReportInvalidArg(flags, -_("'redefine' and 'halt' flags in %s are mutually " - "exclusive"), -__FUNCTION__); -goto error; -} + +VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE, + VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA, + error); +VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE, + VIR_DOMAIN_SNAPSHOT_CREATE_HALT, + error); if (conn->driver->domainSnapshotCreateXML) { virDomainSnapshotPtr ret; @@ -1082,14 +1073,9 @@ virDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, virCheckReadOnlyGoto(conn->flags, error); -if ((flags & VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING) && -(flags & VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)) { -virReportInvalidArg(flags, -_("running and paused flags in %s are mutually " - "exclusive"), -__FUNCTION__); -goto error; -} +VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING, + VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED, + error); if (conn->driver->domainRevertToSnapshot) { int ret = conn->driver->domainRevertToSnapshot(snapshot, flags); @@ -1144,14 +1130,9 @@ virDomainSnapshotDelete(virDomainSnapshotPtr snapshot, virCheckReadOnlyGoto(conn->flags, error); -if ((flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN) && -(flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY)) { -virReportInvalidArg(flags, -_("children and children_only flags in %s are " - "mutually exclusive"), -__FUNCTION__); -goto error; -} +VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN, + VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY, + error); if (conn->driver->domainSnapshotDelete) { int ret = conn->driver->domainSnapshotDelete(snapshot, flags); diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index f1608dc..af69d12 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -911,12 +911,9 @@ virDomainSaveFlags(virDomainPtr domain, const char *to, virCheckReadOnlyGoto(conn->flags, error); virCheckNonNullArgGoto(to, error); -if ((flags & VIR_DOMAIN_SAVE_RUNNING) && (flags & VIR_DOMAIN_SAVE_PAUSED)) { -virReportInvalidArg(flags, "%s", -_("running and paused flags are mutually " - "exclusive")); -goto error; -} +VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SAVE_RUNNING, + VIR_DOMAIN_SAVE_PAUSED, + error); if (conn->driver->domainSaveFlags) { int ret; @@ -1038,12 +1035,9 @@ virDomainRestoreFlags(virConnectPtr conn, const char *from, const char *dxml, virCheckReadOnlyGoto(conn->flags, error); virCheckNonNullArgGoto(from, error); -if ((flags & VIR_DOMAIN_SAVE_RUNNING) && (flags & VIR_DOMAIN_SAVE_PAUSED)) { -virReportInvalidArg(flags, "%s", -_("running and paused flags are mutually " - "exclusive")); -goto error; -} +VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SAVE_RUNNING, + VIR_DOMAIN_SAVE_PAUSED, + error); if (conn->driver->domainRestoreFlags) { int ret; @@ -1179,12 +1173,9 @@ virDomainSaveImageDefineXML(virConnectPtr conn, const char *file, virCheckNonNullArgGoto(file, error); virCheckNonNullArgGoto(dxml, error)
[libvirt] [PATCH v2 1/7] internal: introduce macro helpers to reject exclusive flags
Inspired by commit 7e437ee7 that introduced similar macros for virsh commands so we don't have to repeat the same code all over. Signed-off-by: Pavel Hrdina --- src/internal.h | 44 1 file changed, 44 insertions(+) diff --git a/src/internal.h b/src/internal.h index 4d473af..eb8d231 100644 --- a/src/internal.h +++ b/src/internal.h @@ -327,6 +327,50 @@ } \ } while (0) +/* Macros to help dealing with mutually exclusive flags. */ + +/** + * VIR_EXCLUSIVE_FLAGS_RET: + * + * @FLAG1: First flag to be checked. + * @FLAG2: Second flag to be checked. + * @RET: Return value. + * + * Reject mutually exclusive API flags. The checked flags are compared + * with flags variable. + * + * This helper does an early return and therefore it has to be called + * before anything that would require cleanup. + */ +# define VIR_EXCLUSIVE_FLAGS_RET(FLAG1, FLAG2, RET) \ +if ((flags & FLAG1) && (flags & FLAG2)) { \ +virReportInvalidArg(ctl,\ +_("Flags '%s' and '%s' are mutually exclusive"),\ +#FLAG1, #FLAG2);\ +return RET; \ +} + +/** + * VIR_EXCLUSIVE_FLAGS_GOTO: + * + * @FLAG1: First flag to be checked. + * @FLAG2: Second flag to be checked. + * @LABEL: Label to jump to. + * + * Reject mutually exclusive API flags. The checked flags are compared + * with flags variable. + * + * Returns nothing. Jumps to a label if unsupported flags were + * passed to it. + */ +# define VIR_EXCLUSIVE_FLAGS_GOTO(FLAG1, FLAG2, LABEL) \ +if ((flags & FLAG1) && (flags & FLAG2)) { \ +virReportInvalidArg(ctl,\ +_("Flags '%s' and '%s' are mutually exclusive"),\ +#FLAG1, #FLAG2);\ +goto LABEL; \ +} + # define virCheckNonNullArgReturn(argname, retval) \ do {\ if (argname == NULL) { \ -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 0/7] Cleanup flags checking and fix setvcpus
The first four patches only cleanup the flags checking in our APIs by introducing new macros to check exclusive flags and requirements. Patch 5/7 uses the new macros to do better flags checking for virDomainSetvcpusFlags API. Patch 6/7 introduces macro to check virsh options requirements. The last patch uses the requirement macro to cleanup virsh setvcpus code and fixes a bug with --maximum option. Because only the last patch actually fixes a bug issue, I'm not sure whether this patch series should wait for next release cycle. Luyao Huang (1): tools: fix the wrong check when use virsh setvcpus --maximum Pavel Hrdina (6): internal: introduce macro helpers to reject exclusive flags internal: introduce macro helpers to check flag requirements use new macro helpers to check exclusive flags use new macro helpers to check flag requirements qemu: use new macros for setvcpus to check flags and cleanup the code virsh: introduce new macros to help check flag requirements src/internal.h | 87 +++ src/libvirt-domain-snapshot.c | 56 +++- src/libvirt-domain.c | 286 +++-- src/qemu/qemu_driver.c | 33 + src/storage/storage_backend_disk.c | 10 +- src/storage/storage_backend_fs.c | 11 +- tools/virsh-domain.c | 30 +--- tools/virsh.h | 52 +++ 8 files changed, 256 insertions(+), 309 deletions(-) -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] qemu: add a value check for granularity
https://bugzilla.redhat.com/show_bug.cgi?id=1206479 >From our manual of virsh and qemu side code, we know this value must be power of 2, so instead of let qemu output error, we can add a check when we file this value in qemuDomainBlockCopy. Signed-off-by: Luyao Huang --- src/qemu/qemu_driver.c | 5 + 1 file changed, 5 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2c55fb0..6d63317 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16871,6 +16871,11 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *disk, const char *destxml, } bandwidth = param->value.ul; } else if (STREQ(param->field, VIR_DOMAIN_BLOCK_COPY_GRANULARITY)) { +if (param->value.ui != VIR_ROUND_UP_POWER_OF_TWO(param->value.ui)) { +virReportError(VIR_ERR_INVALID_ARG, "%s", + _("granularity must be power of 2")); +goto cleanup; +} granularity = param->value.ui; } else if (STREQ(param->field, VIR_DOMAIN_BLOCK_COPY_BUF_SIZE)) { buf_size = param->value.ul; -- 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] virsh: fix forget jump to clean up when set a big bandwidth
We already have a check for this, just add a jump to cleanup and change to use vshError instead of virReportError. Signed-off-by: Luyao Huang --- tools/virsh-domain.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 1d8225c..33fbf9c 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2253,9 +2253,8 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd) * ullong bytes/s; make sure we don't overflow */ unsigned long long limit = MIN(ULONG_MAX, ULLONG_MAX >> 20); if (bandwidth > limit) { -virReportError(VIR_ERR_OVERFLOW, - _("bandwidth must be less than %llu"), - ULLONG_MAX >> 20); +vshError(ctl, _("bandwidth must be less than %llu"), limit); +goto cleanup; } if (virTypedParameterAssign(¶ms[nparams++], VIR_DOMAIN_BLOCK_COPY_BANDWIDTH, -- 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: end the job when try to blockcopy to non-file destination
On Fri, Mar 27, 2015 at 05:16:41PM +0800, Shanzhi Yu wrote: > Blockcopy to non-file destination is not supported according the code while > a 'goto endjob' is missed after check the destination which lead qemu try > to do drive-mirror. > > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1206406 > Signed-off-by: Shanzhi Yu > --- > src/qemu/qemu_driver.c | 1 + > 1 file changed, 1 insertion(+) ACK and pushed. Jan > > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c > index db4f0b4..f07e4fb 100644 > --- a/src/qemu/qemu_driver.c > +++ b/src/qemu/qemu_driver.c > @@ -16642,6 +16642,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, > if (!virStorageSourceIsLocalStorage(mirror)) { > virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", > _("non-file destination not supported yet")); > +goto endjob; > } > if (stat(mirror->path, &st) < 0) { > if (errno != ENOENT) { > -- > 2.1.0 > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/1] nodeinfo: Increase the num of CPU thread siblings to a larger value
On Thu, Mar 26, 2015 at 11:49:28AM -0400, Don Dutile wrote: > On 03/26/2015 07:03 AM, Ján Tomko wrote: > > On Thu, Mar 26, 2015 at 12:48:13AM -0400, Wei Huang wrote: > >> Current libvirt can only handle up to 1024 thread siblings when it s/1024 thread siblings/1023 bytes/ > >> reads Linux sysfs topology/thread_siblings. This isn't enough for > >> Linux distributions that support a large value. This patch fixes > >> the problem by using VIR_ALLOC()/VIR_FREE(), instead of using a > >> fixed-size (1024) local char array. In the meanwhile > >> SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX is increased to 8192 which > >> should be large enough for a foreseeable future. > >> > >> Signed-off-by: Wei Huang > >> --- > >> src/nodeinfo.c | 10 +++--- > >> 1 file changed, 7 insertions(+), 3 deletions(-) > >> ACK and pushed. Congratulations on your first libvirt patch! > >> diff --git a/src/nodeinfo.c b/src/nodeinfo.c > >> index 34d27a6..66dc7ef 100644 > >> --- a/src/nodeinfo.c > >> +++ b/src/nodeinfo.c > >> @@ -287,7 +287,7 @@ freebsdNodeGetMemoryStats(virNodeMemoryStatsPtr params, > >> # define PROCSTAT_PATH "/proc/stat" > >> # define MEMINFO_PATH "/proc/meminfo" > >> # define SYSFS_MEMORY_SHARED_PATH "/sys/kernel/mm/ksm" > >> -# define SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX 1024 > >> +# define SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX 8192 > > > > There is thread_siblings_list, which contains a range: > > 22-23 > > and thread_siblings file has all the bits set: > > 00c0 > > > > For the second one, the 1024-byte buffer should be enough for 16368 > > possible siblings. > > > a 4096 siblings file will generate a (cpumask_t -based) output of : > ,,,,,,,, > ,,,,,,,, > ,,,,,,,, > ,,,,,,,, > ,,,,,,,, > ,,,,,,,, > ,,,,,,,, > ,,,,,,,, > ,,,,,,,, > ,,,,,,,, > ,,,,,,,, > ,,,,,,,, > ,,,,,,,, > ,,,,,,,, > ,,,,,,,, > ,,,,,,,0080 > 9(characters per 32-bit mask, including the comma)*8(masks/row)*16(rows) > -1(last entry doesn't have a comma) = 1152 > I can't math, apparently. > Other releases/arch's avoid this issue by using cpumask_var_t vs cpumask_t > for siblings > so it's reflective of actual cpu count a system (not operating system) could > provide/support. > cpumask_t objects are NR_CPUS -sized. > In the not so distant future, though, real systems will have 1024 cpus, > so might as well accomodate for a couple years after that. > > > For the first one, the results depend on the topology - if the sibling > > ranges are contiguous, even million CPUs should fit there. > The _list files(core_siblings_list, thread_siblings_list) have ranges; > the non _list (core_siblings, thread_siblings) files have mask like above. > > > For the worst case, when every other cpu is a sibling, the second file > > is more space-efficient. > > > > > > I'm OK with using the same limit for both (8k seems sufficiently large), > > but I would like to know: > > > > Which one is the file that failed to parse in your case? > > > /sys/devices/system/cpu/cpu*/topology/thread_siblings > > > I think both virNodeCountThreadSiblings and virNodeGetSiblingsList could > > be rewritten to share some code and only look at one of the sysfs files. And I'll put 'switch to parsing thread_siblings_list' on my TODO list, that could get us a few decades without bumping the limit :) Jan signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] qemu: end the job when try to blockcopy to non-file destination
Blockcopy to non-file destination is not supported according the code while a 'goto endjob' is missed after check the destination which lead qemu try to do drive-mirror. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1206406 Signed-off-by: Shanzhi Yu --- src/qemu/qemu_driver.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index db4f0b4..f07e4fb 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16642,6 +16642,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, if (!virStorageSourceIsLocalStorage(mirror)) { virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", _("non-file destination not supported yet")); +goto endjob; } if (stat(mirror->path, &st) < 0) { if (errno != ENOENT) { -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-python PATCH 2/2] Rename virDomainGetIOThreadsInfo to virDomainGetIOThreadInfo
On Thu, Mar 26, 2015 at 08:36:34PM +0100, Jiri Denemark wrote: > On Thu, Mar 26, 2015 at 11:37:28 -0400, John Ferlan wrote: > > > > > > On 03/26/2015 08:43 AM, Ján Tomko wrote: > > > --- > > > generator.py | 4 ++-- > > > libvirt-override-api.xml | 2 +- > > > libvirt-override.c | 10 +- > > > sanitytest.py| 4 ++-- > > > 4 files changed, 10 insertions(+), 10 deletions(-) > > > > > > diff --git a/generator.py b/generator.py > > > index 05ccbc8..729daa2 100755 > > > --- a/generator.py > > > +++ b/generator.py > > > @@ -435,7 +435,7 @@ skip_impl = ( > > > 'virDomainGetVcpuPinInfo', > > > 'virDomainGetEmulatorPinInfo', > > > 'virDomainPinEmulator', > > > -'virDomainGetIOThreadsInfo', > > > +'virDomainGetIOThreadInfo', > > > 'virDomainPinIOThread', > > > 'virSecretGetValue', > > > 'virSecretSetValue', > > > @@ -1147,7 +1147,7 @@ def nameFixup(name, classe, type, file): > > > elif name[0:20] == "virDomainGetCPUStats": > > > func = name[9:] > > > func = func[0:1].lower() + func[1:] > > > -elif name[0:25] == "virDomainGetIOThreadsInfo": > > > +elif name[0:24] == "virDomainGetIOThreadInfo": > > > func = name[12:] > > > func = func[0:2].lower() + func[2:] > > > elif name[0:18] == "virDomainGetFSInfo": > > > diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml > > > index 4660c9f..cf46090 100644 > > > --- a/libvirt-override-api.xml > > > +++ b/libvirt-override-api.xml > > > @@ -278,7 +278,7 @@ > > > > > > > > > > > > - > > > + > > >Query the CPU affinity setting of the IOThreads of the > > > domain > > > > > > > > > diff --git a/libvirt-override.c b/libvirt-override.c > > > index 9a72f87..0699ae3 100644 > > > --- a/libvirt-override.c > > > +++ b/libvirt-override.c > > > @@ -1992,8 +1992,8 @@ libvirt_virDomainGetEmulatorPinInfo(PyObject *self > > > ATTRIBUTE_UNUSED, > > > > > > #if LIBVIR_CHECK_VERSION(1, 2, 14) > > > static PyObject * > > > -libvirt_virDomainGetIOThreadsInfo(PyObject *self ATTRIBUTE_UNUSED, > > > - PyObject *args) > > > +libvirt_virDomainGetIOThreadInfo(PyObject *self ATTRIBUTE_UNUSED, > > > + PyObject *args) > > > { > > > virDomainPtr domain; > > > PyObject *pyobj_domain; > > > @@ -2004,7 +2004,7 @@ libvirt_virDomainGetIOThreadsInfo(PyObject *self > > > ATTRIBUTE_UNUSED, > > > size_t pcpu, i; > > > int niothreads, cpunum; > > > > > > -if (!PyArg_ParseTuple(args, (char *)"OI:virDomainGetIOThreadsInfo", > > > +if (!PyArg_ParseTuple(args, (char *)"OI:virDomainGetIOThreadInfo", > > >&pyobj_domain, &flags)) > > > return NULL; > > > domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain); > > > @@ -2013,7 +2013,7 @@ libvirt_virDomainGetIOThreadsInfo(PyObject *self > > > ATTRIBUTE_UNUSED, > > > return VIR_PY_NONE; > > > > > > LIBVIRT_BEGIN_ALLOW_THREADS; > > > -niothreads = virDomainGetIOThreadsInfo(domain, &iothrinfo, flags); > > > +niothreads = virDomainGetIOThreadInfo(domain, &iothrinfo, flags); > > > LIBVIRT_END_ALLOW_THREADS; > > > > > > if (niothreads < 0) { > > > > If you've added the CPU Time it needs to be handled here too > > I haven't pushed the CPU time changes. > > John > > > @@ -8640,7 +8640,7 @@ static PyMethodDef libvirtMethods[] = { > > > {(char *) "virDomainPinEmulator", libvirt_virDomainPinEmulator, > > > METH_VARARGS, NULL}, > > > #endif /* LIBVIR_CHECK_VERSION(0, 10, 0) */ > > > #if LIBVIR_CHECK_VERSION(1, 2, 14) > > > -{(char *) "virDomainGetIOThreadsInfo", > > > libvirt_virDomainGetIOThreadsInfo, METH_VARARGS, NULL}, > > > +{(char *) "virDomainGetIOThreadInfo", > > > libvirt_virDomainGetIOThreadInfo, METH_VARARGS, NULL}, > > > {(char *) "virDomainPinIOThread", libvirt_virDomainPinIOThread, > > > METH_VARARGS, NULL}, > > > #endif /* LIBVIR_CHECK_VERSION(1, 2, 14) */ > > > {(char *) "virConnectListStoragePools", > > > libvirt_virConnectListStoragePools, METH_VARARGS, NULL}, > > > diff --git a/sanitytest.py b/sanitytest.py > > > index cff9811..aafc487 100644 > > > --- a/sanitytest.py > > > +++ b/sanitytest.py > > > @@ -279,8 +279,8 @@ for name in sorted(basicklassmap): > > > func = "nwfilter" + func[8:] > > > if func[0:8] == "fSFreeze" or func[0:6] == "fSThaw" or func[0:6] == > > > "fSInfo": > > > func = "fs" + func[2:] > > > -if func[0:13] == "iOThreadsInfo": > > > -func = "ioThreadsInfo" > > > +if func[0:13] == "iOThreadInfo": > > > > s/13/12 > > Actually, why don't we use something like > func.startswith("iOThreadInfo") everywhere instead of this fragile [0:n] > approach? Are we targeting some old versions of python which did not > support that (I don't know if such versions even exist, though)? That's better left for a separate c
Re: [libvirt] [perl PATCH 2/2] Adapt to rename of virDomainGetIOThreadsInfo to virDomainGetIOThreadInfo
On Thu, Mar 26, 2015 at 11:42:12AM -0400, John Ferlan wrote: > > > On 03/26/2015 08:46 AM, Ján Tomko wrote: > > --- > > Changes | 1 + > > Virt.xs | 4 ++-- > > 2 files changed, 3 insertions(+), 2 deletions(-) > > > > There's also examples/iothreadsinfo.pl that needs to be updated - not > only to have the right API name, but to add the CPU Time if you added > that as well The perl API name has not changed. Jan > > John > > diff --git a/Changes b/Changes > > index 44a42f2..7a2bc51 100644 > > --- a/Changes > > +++ b/Changes > > @@ -10,6 +10,7 @@ Revision history for perl module Sys::Virt > > - Add virDomainInterfaceAddress function & constants > > - Add VIR_DOMAIN_PAUSED_STARTING_UP constant > > - Adapt to rename of virDomainIOThreadsInfoFree to > > virDomainIOThreadInfoFree > > + - Adapt to rename of virDomainGetIOThreadsInfo to virDomainGetIOThreadInfo > > > > 1.2.13 2015-03-05 > > > > diff --git a/Virt.xs b/Virt.xs > > index 5dc977a..2138530 100644 > > --- a/Virt.xs > > +++ b/Virt.xs > > @@ -5023,8 +5023,8 @@ get_iothread_info(dom, flags=0) > >int niothreads; > >int i; > > PPCODE: > > - if ((niothreads = virDomainGetIOThreadsInfo(dom, &iothrinfo, > > - flags)) < 0) > > + if ((niothreads = virDomainGetIOThreadInfo(dom, &iothrinfo, > > + flags)) < 0) > >_croak_error(); > > > >EXTEND(SP, niothreads); > > > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list