Re: [libvirt] [PATCH for 1.3.3 0/3] qemu: Regenerate per-domain paths on restart

2016-04-03 Thread Michal Privoznik
On 03.04.2016 22:23, Martin Kletzander wrote:
> We forgot to clean up after the domain is torn down.  And because they
> are kept, we don't regenerate them upn another start and because of
> that they contain old IDs in them.
> 
> Again, the series is structured as with the previous one [1].  The
> smallest part (firs patch only) is enough to fix it for the release,
> others can be pushed before or after release.  That depends on the
> reviewer.
> 
> [1] https://www.redhat.com/archives/libvir-list/2016-April/msg00081.html
> 
> 
> Martin Kletzander (3):
>   qemu: Clear generated private paths
>   qemu: Simplify calls to qemuDomainSetPrivatePaths
>   qemu: Add qemuDomainClearPrivatePaths and use it
> 
>  src/qemu/qemu_domain.c  | 40 
>  src/qemu/qemu_domain.h  | 10 --
>  src/qemu/qemu_process.c |  9 +++--
>  3 files changed, 35 insertions(+), 24 deletions(-)
> 

ACK.

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 3/3] qemu: Add qemuDomainClearPrivatePaths and use it

2016-04-03 Thread Michal Privoznik
On 03.04.2016 22:23, Martin Kletzander wrote:
> It's the counterpart of qemuDomainSetPrivatePaths().
> 
> Signed-off-by: Martin Kletzander 
> ---
>  src/qemu/qemu_domain.c  | 10 ++
>  src/qemu/qemu_domain.h  |  1 +
>  src/qemu/qemu_process.c |  3 +--
>  3 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 6102f7983f58..f38b0f381030 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -562,6 +562,16 @@ qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
>  }
> 
> 
> +void
> +qemuDomainClearPrivatePaths(virDomainObjPtr vm)
> +{
> +qemuDomainObjPrivatePtr priv = vm->privateData;
> +
> +VIR_FREE(priv->libDir);
> +VIR_FREE(priv->channelTargetDir);
> +}
> +
> +
>  static void *
>  qemuDomainObjPrivateAlloc(void)
>  {
> diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
> index 918a77dabd29..54d7bd74f3be 100644
> --- a/src/qemu/qemu_domain.h
> +++ b/src/qemu/qemu_domain.h
> @@ -554,6 +554,7 @@ int qemuDomainNetVLAN(virDomainNetDefPtr def);
>  int qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
>virDomainObjPtr vm);
> 
> +void qemuDomainClearPrivatePaths(virDomainObjPtr vm);
> 
>  virDomainDiskDefPtr qemuDomainDiskByName(virDomainDefPtr def, const char 
> *name);
> 
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 02c13bcfbb38..d9dca7485387 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -5832,8 +5832,7 @@ void qemuProcessStop(virQEMUDriverPtr driver,
>  virFileDeleteTree(priv->libDir);
>  virFileDeleteTree(priv->channelTargetDir);
> 
> -VIR_FREE(priv->libDir);
> -VIR_FREE(priv->channelTargetDir);
> +qemuDomainClearPrivatePaths(vm);
> 
>  ignore_value(virDomainChrDefForeach(vm->def,
>  false,
> 

I think this can be merged with 1/3.

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 2/5] Change virPCIDeviceAddress to virDevicePCIAddress

2016-04-03 Thread Martin Kletzander

On Sun, Apr 03, 2016 at 10:18:16PM -0400, Laine Stump wrote:

On 04/03/2016 03:27 PM, Martin Kletzander wrote:

We had both and the only difference was that the latter also included
information about multifunction setting.  The problem with that was that
we couldn't use functions made for only one of the structs (e.g.
parsing).  To consolidate those two structs, move it to virpci.h and
include that in domain_conf.h.


This has annoyed me for a long time, but as usual I just ignored it. I
haven't looked further in your patches to see why you needed to do this
now, but I think I would have preferred it to be solved by leaving
virPCIDeviceAddress as it is, and including one as a member of
virDevicePCIAddress (or if that was too ugly, then naming the new single
struct as virPCIDeviceAddress instead of virDevicePCIAddress, since it's
defined in virpci.h). (I would prefer to not have "multifunction" in the
struct used by virpci.c etc because they don't use that, so it could
confuse people in those usages who might mistakenly believe they should
set it one way or the other; then eventually we would end up with a
bunch of cargo cult settings of multifunction that nobody understood,
but everybody thought were essential).



I'm totally OK with the name being virPCIDeviceAddress instead.  But
about (not) having a multifunction there... I'd say if that confuses
someone, then the problem lies somewhere else.


In the end it's eliminating a near duplicate struct, which is a net
positive no matter what the name, so I can give it a soft ACK - ie if
someone else objects then I would be inclined to waffle on my ACK :-)
(But again, I really wonder if this is something needed right before a
release...)



As I said in the cover letter, we don't.  The first patch in the series
is enough to fix everything.  And it is the version that would be in if
I didn't want to bother with test.  However because someone else didn't,
then this bit me in the butt :-/



Signed-off-by: Martin Kletzander 
---
  src/conf/device_conf.h| 11 +
  src/conf/node_device_conf.c   |  2 +-
  src/conf/node_device_conf.h   |  6 +--
  src/libvirt_private.syms  | 10 ++--
  src/network/bridge_driver.c   |  4 +-
  src/node_device/node_device_linux_sysfs.c |  6 +--
  src/util/virhostdev.c | 12 ++---
  src/util/virnetdev.c  |  4 +-
  src/util/virnetdev.h  |  2 +-
  src/util/virpci.c | 80 +++
  src/util/virpci.h | 29 +--
  11 files changed, 79 insertions(+), 87 deletions(-)

diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index 85ce40f6831e..3fe259cb8916 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -31,6 +31,7 @@
  # include "virutil.h"
  # include "virthread.h"
  # include "virbuffer.h"
+# include "virpci.h"

  typedef enum {
  VIR_INTERFACE_STATE_UNKNOWN = 1,
@@ -45,16 +46,6 @@ typedef enum {

  VIR_ENUM_DECL(virInterfaceState)

-typedef struct _virDevicePCIAddress virDevicePCIAddress;
-typedef virDevicePCIAddress *virDevicePCIAddressPtr;
-struct _virDevicePCIAddress {
-unsigned int domain;
-unsigned int bus;
-unsigned int slot;
-unsigned int function;
-int  multi;  /* virTristateSwitch */
-};
-
  typedef struct _virInterfaceLink virInterfaceLink;
  typedef virInterfaceLink *virInterfaceLinkPtr;
  struct _virInterfaceLink {
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index a76f785eddc0..3e9c821762eb 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -1142,7 +1142,7 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr 
ctxt,
  char *numberStr = NULL;
  int nAddrNodes, ret = -1;
  size_t i;
-virPCIDeviceAddressPtr pciAddr = NULL;
+virDevicePCIAddressPtr pciAddr = NULL;

  ctxt->node = iommuGroupNode;

diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
index be6dd5eb4ec1..9c9d942dd506 100644
--- a/src/conf/node_device_conf.h
+++ b/src/conf/node_device_conf.h
@@ -109,12 +109,12 @@ typedef struct _virNodeDevCapData {
  unsigned int class;
  char *product_name;
  char *vendor_name;
-virPCIDeviceAddressPtr physical_function;
-virPCIDeviceAddressPtr *virtual_functions;
+virDevicePCIAddressPtr physical_function;
+virDevicePCIAddressPtr *virtual_functions;
  size_t num_virtual_functions;
  unsigned int max_virtual_functions;
  unsigned int flags;
-virPCIDeviceAddressPtr *iommuGroupDevices;
+virDevicePCIAddressPtr *iommuGroupDevices;
  size_t nIommuGroupDevices;
  unsigned int iommuGroupNumber;
  int numa_node;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 

Re: [libvirt] [PATCH 2/5] Change virPCIDeviceAddress to virDevicePCIAddress

2016-04-03 Thread Laine Stump

On 04/03/2016 03:27 PM, Martin Kletzander wrote:

We had both and the only difference was that the latter also included
information about multifunction setting.  The problem with that was that
we couldn't use functions made for only one of the structs (e.g.
parsing).  To consolidate those two structs, move it to virpci.h and
include that in domain_conf.h.


This has annoyed me for a long time, but as usual I just ignored it. I 
haven't looked further in your patches to see why you needed to do this 
now, but I think I would have preferred it to be solved by leaving 
virPCIDeviceAddress as it is, and including one as a member of 
virDevicePCIAddress (or if that was too ugly, then naming the new single 
struct as virPCIDeviceAddress instead of virDevicePCIAddress, since it's 
defined in virpci.h). (I would prefer to not have "multifunction" in the 
struct used by virpci.c etc because they don't use that, so it could 
confuse people in those usages who might mistakenly believe they should 
set it one way or the other; then eventually we would end up with a 
bunch of cargo cult settings of multifunction that nobody understood, 
but everybody thought were essential).


In the end it's eliminating a near duplicate struct, which is a net 
positive no matter what the name, so I can give it a soft ACK - ie if 
someone else objects then I would be inclined to waffle on my ACK :-) 
(But again, I really wonder if this is something needed right before a 
release...)




Signed-off-by: Martin Kletzander 
---
  src/conf/device_conf.h| 11 +
  src/conf/node_device_conf.c   |  2 +-
  src/conf/node_device_conf.h   |  6 +--
  src/libvirt_private.syms  | 10 ++--
  src/network/bridge_driver.c   |  4 +-
  src/node_device/node_device_linux_sysfs.c |  6 +--
  src/util/virhostdev.c | 12 ++---
  src/util/virnetdev.c  |  4 +-
  src/util/virnetdev.h  |  2 +-
  src/util/virpci.c | 80 +++
  src/util/virpci.h | 29 +--
  11 files changed, 79 insertions(+), 87 deletions(-)

diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index 85ce40f6831e..3fe259cb8916 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -31,6 +31,7 @@
  # include "virutil.h"
  # include "virthread.h"
  # include "virbuffer.h"
+# include "virpci.h"

  typedef enum {
  VIR_INTERFACE_STATE_UNKNOWN = 1,
@@ -45,16 +46,6 @@ typedef enum {

  VIR_ENUM_DECL(virInterfaceState)

-typedef struct _virDevicePCIAddress virDevicePCIAddress;
-typedef virDevicePCIAddress *virDevicePCIAddressPtr;
-struct _virDevicePCIAddress {
-unsigned int domain;
-unsigned int bus;
-unsigned int slot;
-unsigned int function;
-int  multi;  /* virTristateSwitch */
-};
-
  typedef struct _virInterfaceLink virInterfaceLink;
  typedef virInterfaceLink *virInterfaceLinkPtr;
  struct _virInterfaceLink {
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index a76f785eddc0..3e9c821762eb 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -1142,7 +1142,7 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr 
ctxt,
  char *numberStr = NULL;
  int nAddrNodes, ret = -1;
  size_t i;
-virPCIDeviceAddressPtr pciAddr = NULL;
+virDevicePCIAddressPtr pciAddr = NULL;

  ctxt->node = iommuGroupNode;

diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
index be6dd5eb4ec1..9c9d942dd506 100644
--- a/src/conf/node_device_conf.h
+++ b/src/conf/node_device_conf.h
@@ -109,12 +109,12 @@ typedef struct _virNodeDevCapData {
  unsigned int class;
  char *product_name;
  char *vendor_name;
-virPCIDeviceAddressPtr physical_function;
-virPCIDeviceAddressPtr *virtual_functions;
+virDevicePCIAddressPtr physical_function;
+virDevicePCIAddressPtr *virtual_functions;
  size_t num_virtual_functions;
  unsigned int max_virtual_functions;
  unsigned int flags;
-virPCIDeviceAddressPtr *iommuGroupDevices;
+virDevicePCIAddressPtr *iommuGroupDevices;
  size_t nIommuGroupDevices;
  unsigned int iommuGroupNumber;
  int numa_node;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 684f06cd4f16..8bb901568079 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1966,11 +1966,11 @@ virObjectUnref;


  # util/virpci.h
-virPCIDeviceAddressGetIOMMUGroupAddresses;
-virPCIDeviceAddressGetIOMMUGroupNum;
-virPCIDeviceAddressGetSysfsFile;
-virPCIDeviceAddressIOMMUGroupIterate;
-virPCIDeviceAddressParse;
+virDevicePCIAddressGetIOMMUGroupAddresses;
+virDevicePCIAddressGetIOMMUGroupNum;
+virDevicePCIAddressGetSysfsFile;
+virDevicePCIAddressIOMMUGroupIterate;

Re: [libvirt] Availability of libvirt-1.3.3-rc2

2016-04-03 Thread Martin Kletzander

On Sun, Apr 03, 2016 at 09:50:11PM +0200, Martin Kletzander wrote:

On Sat, Apr 02, 2016 at 09:35:17PM +0800, Daniel Veillard wrote:

On Fri, Apr 01, 2016 at 05:39:36PM +0200, Martin Kletzander wrote:

On Fri, Apr 01, 2016 at 11:54:30AM +0800, Daniel Veillard wrote:
> I pushed the rc2 tag in git head and signed tarball and rpms to the
>usual place:
>
>  ftp://libvrt.org/libvirt/
>
> I didn't really had time to test it TBH, seems we don't have too much red
>in the CI https://ci.centos.org/view/libvirt-project/ , mostly perl tests,
>and virt manager, better than a few days ago !
>
> Please give it more testing and hopefully I can make a release this w.e.
>or early monday,
>
> thanks !
>

There are two things that worry me and should be fixed before the
release.  It's nothing big and I should have it worked out during the
weekend, so I would just like to ask you to not do the release on
weekend and rather leave it for Monday.  I'll post any updates here.

I don't want to go to the details very much as I still have errands to
do, but one of them Laine encountered when trying to nodedev-detach an
SRIOV card and it's just a matter of nodedev XML parsing.  The other one
was found by Guido and that is that we don't regenerate the per-domain
directory name (which has ID in it) on subsequent domain restarts.
Again, just a matter of resetting it properly, I believe.  I'm just
writing this because I won't get to that till Saturday evening from now,
sorry for that.

Enjoy your weekends everyone,
Martin


 Okay, got it, I will wait for news from you,



I had less time available during weekend then I thought, so now I've
finally finished the nodedev parsing [1].  Laine, if you had a minute
to test that (either after first patch or after all), that would be
great.

I'll now look at those per-domain directories so that they are generated
as they should be on each start.



Patch (series) for that is on the list as well:

https://www.redhat.com/archives/libvir-list/2016-April/msg00088.html


[1] https://www.redhat.com/archives/libvir-list/2016-April/msg00081.html


  thanks

Daniel


>Daniel
>
>--
>Daniel Veillard  | Open Source and Standards, Red Hat
>veill...@redhat.com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
>http://veillard.com/ | virtualization library  http://libvirt.org/
>
>--
>libvir-list mailing list
>libvir-list@redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list




--
Daniel Veillard  | Open Source and Standards, Red Hat
veill...@redhat.com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | virtualization library  http://libvirt.org/





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

[libvirt] [PATCH for 1.3.3 0/3] qemu: Regenerate per-domain paths on restart

2016-04-03 Thread Martin Kletzander
We forgot to clean up after the domain is torn down.  And because they
are kept, we don't regenerate them upn another start and because of
that they contain old IDs in them.

Again, the series is structured as with the previous one [1].  The
smallest part (firs patch only) is enough to fix it for the release,
others can be pushed before or after release.  That depends on the
reviewer.

[1] https://www.redhat.com/archives/libvir-list/2016-April/msg00081.html


Martin Kletzander (3):
  qemu: Clear generated private paths
  qemu: Simplify calls to qemuDomainSetPrivatePaths
  qemu: Add qemuDomainClearPrivatePaths and use it

 src/qemu/qemu_domain.c  | 40 
 src/qemu/qemu_domain.h  | 10 --
 src/qemu/qemu_process.c |  9 +++--
 3 files changed, 35 insertions(+), 24 deletions(-)

--
2.8.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 3/3] qemu: Add qemuDomainClearPrivatePaths and use it

2016-04-03 Thread Martin Kletzander
It's the counterpart of qemuDomainSetPrivatePaths().

Signed-off-by: Martin Kletzander 
---
 src/qemu/qemu_domain.c  | 10 ++
 src/qemu/qemu_domain.h  |  1 +
 src/qemu/qemu_process.c |  3 +--
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 6102f7983f58..f38b0f381030 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -562,6 +562,16 @@ qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
 }


+void
+qemuDomainClearPrivatePaths(virDomainObjPtr vm)
+{
+qemuDomainObjPrivatePtr priv = vm->privateData;
+
+VIR_FREE(priv->libDir);
+VIR_FREE(priv->channelTargetDir);
+}
+
+
 static void *
 qemuDomainObjPrivateAlloc(void)
 {
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 918a77dabd29..54d7bd74f3be 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -554,6 +554,7 @@ int qemuDomainNetVLAN(virDomainNetDefPtr def);
 int qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
   virDomainObjPtr vm);

+void qemuDomainClearPrivatePaths(virDomainObjPtr vm);

 virDomainDiskDefPtr qemuDomainDiskByName(virDomainDefPtr def, const char 
*name);

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 02c13bcfbb38..d9dca7485387 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5832,8 +5832,7 @@ void qemuProcessStop(virQEMUDriverPtr driver,
 virFileDeleteTree(priv->libDir);
 virFileDeleteTree(priv->channelTargetDir);

-VIR_FREE(priv->libDir);
-VIR_FREE(priv->channelTargetDir);
+qemuDomainClearPrivatePaths(vm);

 ignore_value(virDomainChrDefForeach(vm->def,
 false,
-- 
2.8.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 2/3] qemu: Simplify calls to qemuDomainSetPrivatePaths

2016-04-03 Thread Martin Kletzander
Since commit 9dca74ee6f54, the function can take driver and a vm, no
need to overcomplicate.

Signed-off-by: Martin Kletzander 
---
 src/qemu/qemu_domain.c  | 30 ++
 src/qemu/qemu_domain.h  |  9 +++--
 src/qemu/qemu_process.c |  7 +--
 3 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 403f01e75e46..6102f7983f58 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -536,23 +536,29 @@ qemuDomainSetPrivatePathsOld(virQEMUDriverPtr driver,
  * can change it later on whenever we feel like so.
  */
 int
-qemuDomainSetPrivatePaths(char **domainLibDir, char **domainChannelTargetDir,
-  const char *confLibDir, const char *confChannelDir,
-  const char *domainName, int domainId)
+qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
+  virDomainObjPtr vm)
 {
+virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+qemuDomainObjPrivatePtr priv = vm->privateData;
 const int dommaxlen = 20;
+int ret = -1;

-if (!*domainLibDir &&
-virAsprintf(domainLibDir, "%s/domain-%d-%.*s",
-confLibDir, domainId, dommaxlen, domainName) < 0)
-return -1;
+if (!priv->libDir &&
+virAsprintf(>libDir, "%s/domain-%d-%.*s",
+cfg->libDir, vm->def->id, dommaxlen, vm->def->name) < 0)
+goto cleanup;

-if (!*domainChannelTargetDir &&
-virAsprintf(domainChannelTargetDir, "%s/domain-%d-%.*s",
-confChannelDir, domainId, dommaxlen, domainName) < 0)
-return -1;
+if (!priv->channelTargetDir &&
+virAsprintf(>channelTargetDir, "%s/domain-%d-%.*s",
+cfg->channelTargetDir, vm->def->id,
+dommaxlen, vm->def->name) < 0)
+goto cleanup;

-return 0;
+ret = 0;
+ cleanup:
+virObjectUnref(cfg);
+return ret;
 }


diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 02c6012c9c87..918a77dabd29 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -551,12 +551,9 @@ bool qemuDomainSupportsNetdev(virDomainDefPtr def,

 int qemuDomainNetVLAN(virDomainNetDefPtr def);

-int qemuDomainSetPrivatePaths(char **domainLibDir,
-  char **domainChannelTargetDir,
-  const char *confLibDir,
-  const char *confChannelDir,
-  const char *domainName,
-  int domainId);
+int qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
+  virDomainObjPtr vm);
+

 virDomainDiskDefPtr qemuDomainDiskByName(virDomainDefPtr def, const char 
*name);

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ea8b3efe02c4..02c13bcfbb38 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4610,12 +4610,7 @@ qemuProcessInit(virQEMUDriverPtr driver,
 goto stop;
 }

-if (qemuDomainSetPrivatePaths(>libDir,
-  >channelTargetDir,
-  cfg->libDir,
-  cfg->channelTargetDir,
-  vm->def->name,
-  vm->def->id) < 0)
+if (qemuDomainSetPrivatePaths(driver, vm) < 0)
 goto cleanup;

 ret = 0;
-- 
2.8.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 1/3] qemu: Clear generated private paths

2016-04-03 Thread Martin Kletzander
The paths have the domain ID in them.  Without cleaning them, they would
contain the same ID even after multiple restarts.  That could cause
various problems, e.g. with access.

Reported-by: Guido Günther 
Signed-off-by: Martin Kletzander 
---
 src/qemu/qemu_process.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e58bf16eaa78..ea8b3efe02c4 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5837,6 +5837,9 @@ void qemuProcessStop(virQEMUDriverPtr driver,
 virFileDeleteTree(priv->libDir);
 virFileDeleteTree(priv->channelTargetDir);

+VIR_FREE(priv->libDir);
+VIR_FREE(priv->channelTargetDir);
+
 ignore_value(virDomainChrDefForeach(vm->def,
 false,
 qemuProcessCleanupChardevDevice,
-- 
2.8.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] Availability of libvirt-1.3.3-rc2

2016-04-03 Thread Martin Kletzander

On Sat, Apr 02, 2016 at 09:35:17PM +0800, Daniel Veillard wrote:

On Fri, Apr 01, 2016 at 05:39:36PM +0200, Martin Kletzander wrote:

On Fri, Apr 01, 2016 at 11:54:30AM +0800, Daniel Veillard wrote:
> I pushed the rc2 tag in git head and signed tarball and rpms to the
>usual place:
>
>  ftp://libvrt.org/libvirt/
>
> I didn't really had time to test it TBH, seems we don't have too much red
>in the CI https://ci.centos.org/view/libvirt-project/ , mostly perl tests,
>and virt manager, better than a few days ago !
>
> Please give it more testing and hopefully I can make a release this w.e.
>or early monday,
>
> thanks !
>

There are two things that worry me and should be fixed before the
release.  It's nothing big and I should have it worked out during the
weekend, so I would just like to ask you to not do the release on
weekend and rather leave it for Monday.  I'll post any updates here.

I don't want to go to the details very much as I still have errands to
do, but one of them Laine encountered when trying to nodedev-detach an
SRIOV card and it's just a matter of nodedev XML parsing.  The other one
was found by Guido and that is that we don't regenerate the per-domain
directory name (which has ID in it) on subsequent domain restarts.
Again, just a matter of resetting it properly, I believe.  I'm just
writing this because I won't get to that till Saturday evening from now,
sorry for that.

Enjoy your weekends everyone,
Martin


 Okay, got it, I will wait for news from you,



I had less time available during weekend then I thought, so now I've
finally finished the nodedev parsing [1].  Laine, if you had a minute
to test that (either after first patch or after all), that would be
great.

I'll now look at those per-domain directories so that they are generated
as they should be on each start.

[1] https://www.redhat.com/archives/libvir-list/2016-April/msg00081.html


  thanks

Daniel


>Daniel
>
>--
>Daniel Veillard  | Open Source and Standards, Red Hat
>veill...@redhat.com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
>http://veillard.com/ | virtualization library  http://libvirt.org/
>
>--
>libvir-list mailing list
>libvir-list@redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list




--
Daniel Veillard  | Open Source and Standards, Red Hat
veill...@redhat.com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | virtualization library  http://libvirt.org/


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 5/5] conf: Parse more of our nodedev XML

2016-04-03 Thread Martin Kletzander
We were lacking tests that are checking for the completeness of our
nodedev XMLs and also whether we output properly formatted ones.  This
patch adds parsing for the capability elements inside the  element.  Also bunch of tests are added to show everything
works properly.

Signed-off-by: Martin Kletzander 
---
 src/conf/node_device_conf.c | 98 +
 tests/nodedevxml2xmltest.c  |  7 
 2 files changed, 105 insertions(+)

diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index b6e2f82727d0..5a41f7e0d2cc 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -1269,15 +1269,103 @@ virPCIEDeviceInfoParseXML(xmlXPathContextPtr ctxt,


 static int
+virNodeDevPCICapabilityParseXML(xmlXPathContextPtr ctxt,
+xmlNodePtr node,
+virNodeDevCapDataPtr data)
+{
+char *maxFuncsStr = virXMLPropString(node, "maxCount");
+char *type = virXMLPropString(node, "type");
+xmlNodePtr *addresses = NULL;
+xmlNodePtr orignode = ctxt->node;
+int ret = -1;
+size_t i = 0;
+
+ctxt->node = node;
+
+if (!type) {
+virReportError(VIR_ERR_XML_ERROR, "%s", _("Missing capability type"));
+goto out;
+}
+
+if (STREQ(type, "phys_function")) {
+xmlNodePtr address = virXPathNode("./address[1]", ctxt);
+
+if (VIR_ALLOC(data->pci_dev.physical_function) < 0)
+goto out;
+
+data->pci_dev.flags |= VIR_NODE_DEV_CAP_FLAG_PCI_PHYSICAL_FUNCTION;
+
+if (!address) {
+virReportError(VIR_ERR_XML_ERROR, "%s",
+   _("Missing address in 'phys_function' capability"));
+goto out;
+}
+
+if (virDevicePCIAddressParseXML(address,
+data->pci_dev.physical_function) < 0)
+goto out;
+} else if (STREQ(type, "virt_functions")) {
+int naddresses = virXPathNodeSet("./address", ctxt, );
+
+if (maxFuncsStr &&
+virStrToLong_uip(maxFuncsStr, NULL, 10,
+ >pci_dev.max_virtual_functions) < 0) {
+virReportError(VIR_ERR_XML_ERROR, "%s",
+   _("Malformed 'maxCount' parameter"));
+goto out;
+}
+
+if (VIR_ALLOC_N(data->pci_dev.virtual_functions, naddresses) < 0)
+goto out;
+
+for (i = 0; i < naddresses; i++) {
+virDevicePCIAddressPtr addr = NULL;
+
+if (VIR_ALLOC(addr) < 0)
+goto out;
+
+if (virDevicePCIAddressParseXML(addresses[i], addr) < 0) {
+VIR_FREE(addr);
+goto out;
+}
+
+if (VIR_APPEND_ELEMENT(data->pci_dev.virtual_functions,
+   data->pci_dev.num_virtual_functions,
+   addr) < 0)
+goto out;
+}
+
+data->pci_dev.flags |= VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION;
+} else {
+int hdrType = virPCIHeaderTypeFromString(type);
+
+if (hdrType > 0 && !data->pci_dev.hdrType)
+data->pci_dev.hdrType = hdrType;
+}
+
+ret = 0;
+ out:
+VIR_FREE(addresses);
+VIR_FREE(maxFuncsStr);
+VIR_FREE(type);
+ctxt->node = orignode;
+return ret;
+}
+
+
+static int
 virNodeDevCapPCIDevParseXML(xmlXPathContextPtr ctxt,
 virNodeDeviceDefPtr def,
 xmlNodePtr node,
 virNodeDevCapDataPtr data)
 {
 xmlNodePtr orignode, iommuGroupNode, pciExpress;
+xmlNodePtr *nodes = NULL;
+int n = 0;
 int ret = -1;
 virPCIEDeviceInfoPtr pci_express = NULL;
 char *tmp = NULL;
+size_t i = 0;

 orignode = ctxt->node;
 ctxt->node = node;
@@ -1321,6 +1409,15 @@ virNodeDevCapPCIDevParseXML(xmlXPathContextPtr ctxt,
 data->pci_dev.vendor_name  = virXPathString("string(./vendor[1])", ctxt);
 data->pci_dev.product_name = virXPathString("string(./product[1])", ctxt);

+if ((n = virXPathNodeSet("./capability", ctxt, )) < 0)
+goto out;
+
+for (i = 0; i < n; i++) {
+if (virNodeDevPCICapabilityParseXML(ctxt, nodes[i], data) < 0)
+goto out;
+}
+VIR_FREE(nodes);
+
 if ((iommuGroupNode = virXPathNode("./iommuGroup[1]", ctxt))) {
 if (virNodeDevCapPCIDevIommuGroupParseXML(ctxt, iommuGroupNode,
   data) < 0) {
@@ -1349,6 +1446,7 @@ virNodeDevCapPCIDevParseXML(xmlXPathContextPtr ctxt,

 ret = 0;
  out:
+VIR_FREE(nodes);
 VIR_FREE(tmp);
 virPCIEDeviceInfoFree(pci_express);
 ctxt->node = orignode;
diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c
index 96041f50b9cd..0ed06fdff3e2 100644
--- a/tests/nodedevxml2xmltest.c
+++ b/tests/nodedevxml2xmltest.c
@@ -91,7 +91,14 @@ mymain(void)
 

[libvirt] [PATCH 4/5] schemas: Update nodedev schema to match reality

2016-04-03 Thread Martin Kletzander
There were few things done in the nodedev code but we were lacking tests
for it.  And because of that we missed that the schema was not updated
either.  Fix the schema and add various test files to show the schema
is correct.

Signed-off-by: Martin Kletzander 
---
 docs/schemas/nodedev.rng   |  7 -
 tests/nodedevschemadata/pci__02_10_7_sriov.xml | 23 +
 .../pci__02_10_7_sriov_pf_vfs_all.xml  | 29 +
 ...i__02_10_7_sriov_pf_vfs_all_header_type.xml | 30 ++
 .../pci__02_10_7_sriov_vfs.xml | 26 +++
 .../pci__02_10_7_sriov_zero_vfs_max_count.xml  | 21 +++
 6 files changed, 135 insertions(+), 1 deletion(-)
 create mode 100644 tests/nodedevschemadata/pci__02_10_7_sriov.xml
 create mode 100644 
tests/nodedevschemadata/pci__02_10_7_sriov_pf_vfs_all.xml
 create mode 100644 
tests/nodedevschemadata/pci__02_10_7_sriov_pf_vfs_all_header_type.xml
 create mode 100644 tests/nodedevschemadata/pci__02_10_7_sriov_vfs.xml
 create mode 100644 
tests/nodedevschemadata/pci__02_10_7_sriov_zero_vfs_max_count.xml

diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng
index 6b9b54298b21..93a88d883056 100644
--- a/docs/schemas/nodedev.rng
+++ b/docs/schemas/nodedev.rng
@@ -143,8 +143,13 @@
   virt_functions
 
 
-  
+  
+
+  
 
+
+  
+
   
 

diff --git a/tests/nodedevschemadata/pci__02_10_7_sriov.xml 
b/tests/nodedevschemadata/pci__02_10_7_sriov.xml
new file mode 100644
index ..8f243b4d6119
--- /dev/null
+++ b/tests/nodedevschemadata/pci__02_10_7_sriov.xml
@@ -0,0 +1,23 @@
+
+  pci__02_10_7
+  pci__00_04_0
+  
+0
+2
+16
+7
+82576 Virtual Function
+Intel Corporation
+
+  
+
+
+  
+
+
+
+  
+  
+
+  
+
diff --git a/tests/nodedevschemadata/pci__02_10_7_sriov_pf_vfs_all.xml 
b/tests/nodedevschemadata/pci__02_10_7_sriov_pf_vfs_all.xml
new file mode 100644
index ..9e8dace020a1
--- /dev/null
+++ b/tests/nodedevschemadata/pci__02_10_7_sriov_pf_vfs_all.xml
@@ -0,0 +1,29 @@
+
+  pci__02_10_7
+  pci__00_04_0
+  
+0
+2
+16
+7
+82576 Virtual Function
+Intel Corporation
+
+  
+
+
+  
+  
+  
+  
+
+
+  
+
+
+
+  
+  
+
+  
+
diff --git 
a/tests/nodedevschemadata/pci__02_10_7_sriov_pf_vfs_all_header_type.xml 
b/tests/nodedevschemadata/pci__02_10_7_sriov_pf_vfs_all_header_type.xml
new file mode 100644
index ..4e6323a3ecdd
--- /dev/null
+++ b/tests/nodedevschemadata/pci__02_10_7_sriov_pf_vfs_all_header_type.xml
@@ -0,0 +1,30 @@
+
+  pci__02_10_7
+  pci__00_04_0
+  
+0
+2
+16
+7
+82576 Virtual Function
+Intel Corporation
+
+  
+
+
+  
+  
+  
+  
+
+
+
+  
+
+
+
+  
+  
+
+  
+
diff --git a/tests/nodedevschemadata/pci__02_10_7_sriov_vfs.xml 
b/tests/nodedevschemadata/pci__02_10_7_sriov_vfs.xml
new file mode 100644
index ..355eaaad97d4
--- /dev/null
+++ b/tests/nodedevschemadata/pci__02_10_7_sriov_vfs.xml
@@ -0,0 +1,26 @@
+
+  pci__02_10_7
+  pci__00_04_0
+  
+0
+2
+16
+7
+82576 Virtual Function
+Intel Corporation
+
+  
+  
+  
+  
+
+
+  
+
+
+
+  
+  
+
+  
+
diff --git 
a/tests/nodedevschemadata/pci__02_10_7_sriov_zero_vfs_max_count.xml 
b/tests/nodedevschemadata/pci__02_10_7_sriov_zero_vfs_max_count.xml
new file mode 100644
index ..e9eb122bfec9
--- /dev/null
+++ b/tests/nodedevschemadata/pci__02_10_7_sriov_zero_vfs_max_count.xml
@@ -0,0 +1,21 @@
+
+  pci__02_10_7
+  pci__00_04_0
+  
+0
+2
+16
+7
+82576 Virtual Function
+Intel Corporation
+
+
+  
+
+
+
+  
+  
+
+  
+
-- 
2.8.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 2/5] Change virPCIDeviceAddress to virDevicePCIAddress

2016-04-03 Thread Martin Kletzander
We had both and the only difference was that the latter also included
information about multifunction setting.  The problem with that was that
we couldn't use functions made for only one of the structs (e.g.
parsing).  To consolidate those two structs, move it to virpci.h and
include that in domain_conf.h.

Signed-off-by: Martin Kletzander 
---
 src/conf/device_conf.h| 11 +
 src/conf/node_device_conf.c   |  2 +-
 src/conf/node_device_conf.h   |  6 +--
 src/libvirt_private.syms  | 10 ++--
 src/network/bridge_driver.c   |  4 +-
 src/node_device/node_device_linux_sysfs.c |  6 +--
 src/util/virhostdev.c | 12 ++---
 src/util/virnetdev.c  |  4 +-
 src/util/virnetdev.h  |  2 +-
 src/util/virpci.c | 80 +++
 src/util/virpci.h | 29 +--
 11 files changed, 79 insertions(+), 87 deletions(-)

diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index 85ce40f6831e..3fe259cb8916 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -31,6 +31,7 @@
 # include "virutil.h"
 # include "virthread.h"
 # include "virbuffer.h"
+# include "virpci.h"

 typedef enum {
 VIR_INTERFACE_STATE_UNKNOWN = 1,
@@ -45,16 +46,6 @@ typedef enum {

 VIR_ENUM_DECL(virInterfaceState)

-typedef struct _virDevicePCIAddress virDevicePCIAddress;
-typedef virDevicePCIAddress *virDevicePCIAddressPtr;
-struct _virDevicePCIAddress {
-unsigned int domain;
-unsigned int bus;
-unsigned int slot;
-unsigned int function;
-int  multi;  /* virTristateSwitch */
-};
-
 typedef struct _virInterfaceLink virInterfaceLink;
 typedef virInterfaceLink *virInterfaceLinkPtr;
 struct _virInterfaceLink {
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index a76f785eddc0..3e9c821762eb 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -1142,7 +1142,7 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr 
ctxt,
 char *numberStr = NULL;
 int nAddrNodes, ret = -1;
 size_t i;
-virPCIDeviceAddressPtr pciAddr = NULL;
+virDevicePCIAddressPtr pciAddr = NULL;

 ctxt->node = iommuGroupNode;

diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
index be6dd5eb4ec1..9c9d942dd506 100644
--- a/src/conf/node_device_conf.h
+++ b/src/conf/node_device_conf.h
@@ -109,12 +109,12 @@ typedef struct _virNodeDevCapData {
 unsigned int class;
 char *product_name;
 char *vendor_name;
-virPCIDeviceAddressPtr physical_function;
-virPCIDeviceAddressPtr *virtual_functions;
+virDevicePCIAddressPtr physical_function;
+virDevicePCIAddressPtr *virtual_functions;
 size_t num_virtual_functions;
 unsigned int max_virtual_functions;
 unsigned int flags;
-virPCIDeviceAddressPtr *iommuGroupDevices;
+virDevicePCIAddressPtr *iommuGroupDevices;
 size_t nIommuGroupDevices;
 unsigned int iommuGroupNumber;
 int numa_node;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 684f06cd4f16..8bb901568079 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1966,11 +1966,11 @@ virObjectUnref;


 # util/virpci.h
-virPCIDeviceAddressGetIOMMUGroupAddresses;
-virPCIDeviceAddressGetIOMMUGroupNum;
-virPCIDeviceAddressGetSysfsFile;
-virPCIDeviceAddressIOMMUGroupIterate;
-virPCIDeviceAddressParse;
+virDevicePCIAddressGetIOMMUGroupAddresses;
+virDevicePCIAddressGetIOMMUGroupNum;
+virDevicePCIAddressGetSysfsFile;
+virDevicePCIAddressIOMMUGroupIterate;
+virDevicePCIAddressParse;
 virPCIDeviceCopy;
 virPCIDeviceDetach;
 virPCIDeviceFileIterate;
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index c673cc1515e2..65a3e68868b8 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -2336,7 +2336,7 @@ networkCreateInterfacePool(virNetworkDefPtr netdef)
 size_t numVirtFns = 0;
 unsigned int maxVirtFns = 0;
 char **vfNames = NULL;
-virPCIDeviceAddressPtr *virtFns;
+virDevicePCIAddressPtr *virtFns;

 int ret = -1;
 size_t i;
@@ -2356,7 +2356,7 @@ networkCreateInterfacePool(virNetworkDefPtr netdef)
 goto cleanup;

 for (i = 0; i < numVirtFns; i++) {
-virPCIDeviceAddressPtr thisVirtFn = virtFns[i];
+virDevicePCIAddressPtr thisVirtFn = virtFns[i];
 const char *thisName = vfNames[i];
 virNetworkForwardIfDefPtr thisIf
 = >forward.ifs[netdef->forward.nifs];
diff --git a/src/node_device/node_device_linux_sysfs.c 
b/src/node_device/node_device_linux_sysfs.c
index 24a6a2eaa51f..0a858d31f387 100644
--- a/src/node_device/node_device_linux_sysfs.c
+++ b/src/node_device/node_device_linux_sysfs.c
@@ -176,7 +176,7 @@ 

[libvirt] [PATCH for 1.3.3 0/5] Fix parsing our own XMLs

2016-04-03 Thread Martin Kletzander
Laine found out that he can't do 'virsh nodedev-detach pci_dev'
because of some strange error message.  That was caused by my commit,
but also by all the previous ones that skipped adding tests and
parsing of new functions.  In order for this to work in 1.3.3, we need
either a) only the first patch or b) all of them.  I specifically
created the first one so that it has enough in itself to fix the
problem and we don't need to push more and more patches into the
release.  We can push the rest after release.  If someone wants to
have all in for 1.3.3, well, I hope I added enough tests for that ;)


Martin Kletzander (5):
  nodedev: Fix parsing of generated XMLs
  Change virPCIDeviceAddress to virDevicePCIAddress
  Move capability formatting together
  schemas: Update nodedev schema to match reality
  conf: Parse more of our nodedev XML

 docs/schemas/nodedev.rng   |  29 +++--
 src/conf/device_conf.h |  11 +-
 src/conf/node_device_conf.c| 121 ++---
 src/conf/node_device_conf.h|   6 +-
 src/libvirt_private.syms   |  10 +-
 src/network/bridge_driver.c|   4 +-
 src/node_device/node_device_linux_sysfs.c  |   6 +-
 src/util/virhostdev.c  |  12 +-
 src/util/virnetdev.c   |   4 +-
 src/util/virnetdev.h   |   2 +-
 src/util/virpci.c  |  80 +++---
 src/util/virpci.h  |  29 ++---
 .../pci__00_1c_0_header_type.xml   |   2 +-
 tests/nodedevschemadata/pci__02_10_7_sriov.xml |  23 
 .../pci__02_10_7_sriov_pf_vfs_all.xml  |  29 +
 ...i__02_10_7_sriov_pf_vfs_all_header_type.xml |  30 +
 .../pci__02_10_7_sriov_vfs.xml |  26 +
 .../pci__02_10_7_sriov_zero_vfs_max_count.xml  |  21 
 tests/nodedevxml2xmltest.c |   5 +
 19 files changed, 333 insertions(+), 117 deletions(-)
 create mode 100644 tests/nodedevschemadata/pci__02_10_7_sriov.xml
 create mode 100644 
tests/nodedevschemadata/pci__02_10_7_sriov_pf_vfs_all.xml
 create mode 100644 
tests/nodedevschemadata/pci__02_10_7_sriov_pf_vfs_all_header_type.xml
 create mode 100644 tests/nodedevschemadata/pci__02_10_7_sriov_vfs.xml
 create mode 100644 
tests/nodedevschemadata/pci__02_10_7_sriov_zero_vfs_max_count.xml

--
2.8.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 3/5] Move capability formatting together

2016-04-03 Thread Martin Kletzander
All sub-PCI capabilities should be next to each other for clarity.

Signed-off-by: Martin Kletzander 
---
 docs/schemas/nodedev.rng   | 22 +++---
 src/conf/node_device_conf.c|  9 -
 .../pci__00_1c_0_header_type.xml   |  2 +-
 3 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng
index d9375130487c..6b9b54298b21 100644
--- a/docs/schemas/nodedev.rng
+++ b/docs/schemas/nodedev.rng
@@ -149,6 +149,17 @@
 

 
+  
+
+  
+pci-bridge
+cardbus-bridge
+  
+
+  
+
+
+
   
 
   
@@ -170,17 +181,6 @@
 

 
-  
-
-  
-pci-bridge
-cardbus-bridge
-  
-
-  
-
-
-
   
 
   
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 3e9c821762eb..b6e2f82727d0 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -383,6 +383,10 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDef *def)
 virBufferAddLit(, "\n");
 }
 }
+if (data->pci_dev.hdrType) {
+virBufferAsprintf(, "\n",
+  
virPCIHeaderTypeToString(data->pci_dev.hdrType));
+}
 if (data->pci_dev.nIommuGroupDevices) {
 virBufferAsprintf(, "\n",
   data->pci_dev.iommuGroupNumber);
@@ -403,11 +407,6 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDef *def)
 virBufferAsprintf(, "\n",
   data->pci_dev.numa_node);

-if (data->pci_dev.hdrType) {
-virBufferAsprintf(, "\n",
-  
virPCIHeaderTypeToString(data->pci_dev.hdrType));
-}
-
 if (data->pci_dev.flags & VIR_NODE_DEV_CAP_FLAG_PCIE)
 virPCIEDeviceInfoFormat(, data->pci_dev.pci_express);
 break;
diff --git a/tests/nodedevschemadata/pci__00_1c_0_header_type.xml 
b/tests/nodedevschemadata/pci__00_1c_0_header_type.xml
index dea5f05237ff..c1be9f7d9cc0 100644
--- a/tests/nodedevschemadata/pci__00_1c_0_header_type.xml
+++ b/tests/nodedevschemadata/pci__00_1c_0_header_type.xml
@@ -8,10 +8,10 @@
 0
 8 Series/C220 Series Chipset Family PCI Express Root 
Port #1
 Intel Corporation
+
 
   
 
-
 
   
   
-- 
2.8.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 1/5] nodedev: Fix parsing of generated XMLs

2016-04-03 Thread Martin Kletzander
Commit d77ffb6876 added not only reporting of the PCI header type, but
also parsing of that information.  However, because there was no parsing
done for the other sub-PCI capabilities, if there was any other
capability then a valid header type name (like phys_function or
virt_functions) the parsing would fail.  This prevented passing node
device XMLs that we generated into our own functions when dealing with,
e.g. with SRIOV cards.

Instead of reworking the whole parsing, just fix this one occurence and
remove a test for it for the time being.  Future patches will deal with
the rest.

Signed-off-by: Martin Kletzander 
---
 src/conf/node_device_conf.c | 12 
 tests/nodedevxml2xmltest.c  |  2 --
 2 files changed, 14 deletions(-)

diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index f74b34de5cd2..a76f785eddc0 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -1336,18 +1336,6 @@ virNodeDevCapPCIDevParseXML(xmlXPathContextPtr ctxt,
   _("invalid NUMA node ID supplied for 
'%s'")) < 0)
 goto out;

-if ((tmp = virXPathString("string(./capability[1]/@type)", ctxt))) {
-int hdrType = virPCIHeaderTypeFromString(tmp);
-
-if (hdrType <= 0) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Unknown PCI header type '%s'"), tmp);
-goto out;
-}
-
-data->pci_dev.hdrType = hdrType;
-}
-
 if ((pciExpress = virXPathNode("./pci-express[1]", ctxt))) {
 if (VIR_ALLOC(pci_express) < 0)
 goto out;
diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c
index 246cec710178..96041f50b9cd 100644
--- a/tests/nodedevxml2xmltest.c
+++ b/tests/nodedevxml2xmltest.c
@@ -91,8 +91,6 @@ mymain(void)
 DO_TEST("usb_device_1d6b_1__00_1d_0");
 DO_TEST("pci_8086_4238_pcie_wireless");
 DO_TEST("pci_8086_0c0c_snd_hda_intel");
-DO_TEST("pci__00_02_0_header_type");
-DO_TEST("pci__00_1c_0_header_type");
 DO_TEST("scsi_target0_0_0");

 return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
-- 
2.8.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] Host device assignment driver name vfio/ kvm

2016-04-03 Thread Laine Stump
(please configure your email client to properly quote earlier messages, 
and reply inline rather as a top-post; it makes it easier for others to 
determine the context of replies.)


On 04/03/2016 05:00 AM, Moshe Levi wrote:


Hi,

Ok, so here are the errors I get when using vfio/( kvm is working fine)

This is the Error [1] I am getting on resume when using vfio. And [2] 
is the ls output on the /dev/vfio/


Please note that I am trying to attach pci which is VF

My setup is:

Fedora 21

Libvirt 1.3.0

Qemu 2.5

Kernel  3.17.4-301.fc21.x86_64

OpenStack – master.

Let me know if you need more information.

[1] –

root@r-dcs78:/var/log/libvirt/qemu# cat ./instance-000e.log

2016-03-31 15:31:09.895+: starting up libvirt version: 1.3.0, 
package: 1.fc21 (Unknown, 2016-02-25-10:56:09, 
r-ufm231.mtr.labs.mlnx), qemu version: 2.5.0 (qemu-2.5.0-11.fc21)


LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin 
QEMU_AUDIO_DRV=none /usr/bin/qemu-kvm -name instance-000e -S 
-machine pc-i440fx-2.5,accel=kvm,usb=off -m 2048 -realtime mlock=off 
-smp 1,sockets=1,cores=1,threads=1 -uuid 
a809a3b5-ba75-41e6-889f-ffeebecfe54e -smbios 
'type=1,manufacturer=OpenStack Foundation,product=OpenStack 
Nova,version=13.0.0,serial=533a28c3-7519-4e6d-8cdb-4b1f72649e71,uuid=a809a3b5-ba75-41e6-889f-ffeebecfe54e,family=Virtual 
Machine' -no-user-config -nodefaults -chardev 
socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-instance-000e/monitor.sock,server,nowait 
-mon chardev=charmonitor,id=monitor,mode=control -rtc 
base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=discard 
-no-hpet -no-shutdown -boot strict=on -device 
piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive 
file=/opt/stack/data/nova/instances/a809a3b5-ba75-41e6-889f-ffeebecfe54e/disk,if=none,id=drive-virtio-disk0,format=qcow2,cache=none 
-device 
virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 
-drive 
file=/opt/stack/data/nova/instances/a809a3b5-ba75-41e6-889f-ffeebecfe54e/disk.config,if=none,id=drive-ide0-1-1,readonly=on,format=raw,cache=none 
-device ide-cd,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1 
-chardev 
file,id=charserial0,path=/opt/stack/data/nova/instances/a809a3b5-ba75-41e6-889f-ffeebecfe54e/console.log 
-device isa-serial,chardev=charserial0,id=serial0 -chardev 
pty,id=charserial1 -device isa-serial,chardev=charserial1,id=serial1 
-vnc 127.0.0.1:0 -k en-us -device 
cirrus-vga,id=video0,bus=pci.0,addr=0x2 -device 
vfio-pci,host=04:00.7,id=hostdev0,bus=pci.0,addr=0x4 -device 
virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -msg timestamp=on


char device redirected to /dev/pts/29 (label charserial1)

2016-03-31T15:31:46.775166Z qemu-system-x86_64: terminating on signal 
15 from pid 6866


2016-03-31 15:32:07.547+: starting up libvirt version: 1.3.0, 
package: 1.fc21 (Unknown, 2016-02-25-10:56:09, 
r-ufm231.mtr.labs.mlnx), qemu version: 2.5.0 (qemu-2.5.0-11.fc21)


LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin 
QEMU_AUDIO_DRV=none /usr/bin/qemu-kvm -name instance-000e -S 
-machine pc-i440fx-2.5,accel=kvm,usb=off -m 2048 -realtime mlock=off 
-smp 1,sockets=1,cores=1,threads=1 -uuid 
a809a3b5-ba75-41e6-889f-ffeebecfe54e -smbios 
'type=1,manufacturer=OpenStack Foundation,product=OpenStack 
Nova,version=13.0.0,serial=533a28c3-7519-4e6d-8cdb-4b1f72649e71,uuid=a809a3b5-ba75-41e6-889f-ffeebecfe54e,family=Virtual 
Machine' -no-user-config -nodefaults -chardev 
socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-instance-000e/monitor.sock,server,nowait 
-mon chardev=charmonitor,id=monitor,mode=control -rtc 
base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=discard 
-no-hpet -no-shutdown -boot strict=on -device 
piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive 
file=/opt/stack/data/nova/instances/a809a3b5-ba75-41e6-889f-ffeebecfe54e/disk,if=none,id=drive-virtio-disk0,format=qcow2,cache=none 
-device 
virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 
-drive 
file=/opt/stack/data/nova/instances/a809a3b5-ba75-41e6-889f-ffeebecfe54e/disk.config,if=none,id=drive-ide0-1-1,readonly=on,format=raw,cache=none 
-device ide-cd,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1 
-chardev 
file,id=charserial0,path=/opt/stack/data/nova/instances/a809a3b5-ba75-41e6-889f-ffeebecfe54e/console.log 
-device isa-serial,chardev=charserial0,id=serial0 -chardev 
pty,id=charserial1 -device isa-serial,chardev=charserial1,id=serial1 
-vnc 127.0.0.1:0 -k en-us -device 
cirrus-vga,id=video0,bus=pci.0,addr=0x2 -incoming defer -device 
virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -msg timestamp=on


char device redirected to /dev/pts/29 (label charserial1)

vfio: error opening /dev/vfio/57: Permission denied

vfio: failed to get group 57




It's very strange that this error follows a commandline that doesn't 
have any "-device vfio-pci" in it, and the previous commandline (which 
*did* have a "-device 

Re: [libvirt] Host device assignment driver name vfio/ kvm

2016-04-03 Thread Moshe Levi
Hi,

Ok, so here are the errors I get when using vfio/( kvm is working fine)

This is the Error [1] I am getting on resume when using vfio. And [2] is the ls 
output on the /dev/vfio/
Please note that I am trying to attach pci which is VF
My setup is:
Fedora 21
Libvirt 1.3.0
Qemu 2.5
Kernel  3.17.4-301.fc21.x86_64
OpenStack – master.

Let me know if you need more information.
[1] –
root@r-dcs78:/var/log/libvirt/qemu# cat ./instance-000e.log
2016-03-31 15:31:09.895+: starting up libvirt version: 1.3.0, package: 
1.fc21 (Unknown, 2016-02-25-10:56:09, r-ufm231.mtr.labs.mlnx), qemu version: 
2.5.0 (qemu-2.5.0-11.fc21)
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin 
QEMU_AUDIO_DRV=none /usr/bin/qemu-kvm -name instance-000e -S -machine 
pc-i440fx-2.5,accel=kvm,usb=off -m 2048 -realtime mlock=off -smp 
1,sockets=1,cores=1,threads=1 -uuid a809a3b5-ba75-41e6-889f-ffeebecfe54e 
-smbios 'type=1,manufacturer=OpenStack Foundation,product=OpenStack 
Nova,version=13.0.0,serial=533a28c3-7519-4e6d-8cdb-4b1f72649e71,uuid=a809a3b5-ba75-41e6-889f-ffeebecfe54e,family=Virtual
 Machine' -no-user-config -nodefaults -chardev 
socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-instance-000e/monitor.sock,server,nowait
 -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew 
-global kvm-pit.lost_tick_policy=discard -no-hpet -no-shutdown -boot strict=on 
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive 
file=/opt/stack/data/nova/instances/a809a3b5-ba75-41e6-889f-ffeebecfe54e/disk,if=none,id=drive-virtio-disk0,format=qcow2,cache=none
 -device 
virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1
 -drive 
file=/opt/stack/data/nova/instances/a809a3b5-ba75-41e6-889f-ffeebecfe54e/disk.config,if=none,id=drive-ide0-1-1,readonly=on,format=raw,cache=none
 -device ide-cd,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1 -chardev 
file,id=charserial0,path=/opt/stack/data/nova/instances/a809a3b5-ba75-41e6-889f-ffeebecfe54e/console.log
 -device isa-serial,chardev=charserial0,id=serial0 -chardev pty,id=charserial1 
-device isa-serial,chardev=charserial1,id=serial1 -vnc 127.0.0.1:0 -k en-us 
-device cirrus-vga,id=video0,bus=pci.0,addr=0x2 -device 
vfio-pci,host=04:00.7,id=hostdev0,bus=pci.0,addr=0x4 -device 
virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -msg timestamp=on
char device redirected to /dev/pts/29 (label charserial1)
2016-03-31T15:31:46.775166Z qemu-system-x86_64: terminating on signal 15 from 
pid 6866
2016-03-31 15:32:07.547+: starting up libvirt version: 1.3.0, package: 
1.fc21 (Unknown, 2016-02-25-10:56:09, r-ufm231.mtr.labs.mlnx), qemu version: 
2.5.0 (qemu-2.5.0-11.fc21)
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin 
QEMU_AUDIO_DRV=none /usr/bin/qemu-kvm -name instance-000e -S -machine 
pc-i440fx-2.5,accel=kvm,usb=off -m 2048 -realtime mlock=off -smp 
1,sockets=1,cores=1,threads=1 -uuid a809a3b5-ba75-41e6-889f-ffeebecfe54e 
-smbios 'type=1,manufacturer=OpenStack Foundation,product=OpenStack 
Nova,version=13.0.0,serial=533a28c3-7519-4e6d-8cdb-4b1f72649e71,uuid=a809a3b5-ba75-41e6-889f-ffeebecfe54e,family=Virtual
 Machine' -no-user-config -nodefaults -chardev 
socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-instance-000e/monitor.sock,server,nowait
 -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew 
-global kvm-pit.lost_tick_policy=discard -no-hpet -no-shutdown -boot strict=on 
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive 
file=/opt/stack/data/nova/instances/a809a3b5-ba75-41e6-889f-ffeebecfe54e/disk,if=none,id=drive-virtio-disk0,format=qcow2,cache=none
 -device 
virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1
 -drive 
file=/opt/stack/data/nova/instances/a809a3b5-ba75-41e6-889f-ffeebecfe54e/disk.config,if=none,id=drive-ide0-1-1,readonly=on,format=raw,cache=none
 -device ide-cd,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1 -chardev 
file,id=charserial0,path=/opt/stack/data/nova/instances/a809a3b5-ba75-41e6-889f-ffeebecfe54e/console.log
 -device isa-serial,chardev=charserial0,id=serial0 -chardev pty,id=charserial1 
-device isa-serial,chardev=charserial1,id=serial1 -vnc 127.0.0.1:0 -k en-us 
-device cirrus-vga,id=video0,bus=pci.0,addr=0x2 -incoming defer -device 
virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -msg timestamp=on
char device redirected to /dev/pts/29 (label charserial1)
vfio: error opening /dev/vfio/57: Permission denied
vfio: failed to get group 57
2016-03-31T16:05:54.975312Z qemu-system-x86_64: terminating on signal 15 from 
pid 6866

[2] root@r-dcs78:/var/log/libvirt/qemu# ls -l /dev/vfio/
total 0
crw-rw-rw- 1 root root 10, 196 Mar 29 11:11 vfio

From: sendmail [mailto:justsendmailnothinge...@gmail.com] On Behalf Of Laine 
Stump
Sent: Thursday, March 31, 2016 7:07 PM
To: Libvirt 
Cc: Moshe Levi 
Subject: Re: [libvirt] Host device