Re: [libvirt] [PATCH v2] qemu: handle multicast overflow on macvtap NIC_RX_FILTER_CHANGED

2018-11-30 Thread Michael S. Tsirkin
On Fri, Nov 30, 2018 at 12:50:26PM -0500, Jason Baron wrote:
> Guest network devices can set 'overflow' when there are a number of multicast
> ips configured. For virtio_net, the limit is only 64. In this case, the list
> of mac addresses is empty and the 'overflow' condition is set. Thus, the guest
> will currently receive no multicast traffic in this state.
> 
> When 'overflow' is set in the guest, let's turn this into ALLMULTI on the 
> host.
> 
> Signed-off-by: Jason Baron 

Acked-by: Michael S. Tsirkin 

> ---
> v1->v2:
>  1. check for < 0 in virNetDevSetRcvAllMulti() (Michal Privoznik)
>  2. restrict overflow check to VIR_NETDEV_RX_FILTER_MODE_NORMAL mode as to
> avoid unnecessarily calling rx filter updates for other modes 
>  3. update virNetDevSetRcvAllMulti() call to use 
> guestFilter->multicast.overflow
> directly (Michal Privoznik)
> 
>  src/qemu/qemu_driver.c | 22 +++---
>  1 file changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 7fb9102..f4bbfea 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -4443,11 +4443,12 @@ static void
>  syncNicRxFilterMultiMode(char *ifname, virNetDevRxFilterPtr guestFilter,
>   virNetDevRxFilterPtr hostFilter)
>  {
> -if (hostFilter->multicast.mode != guestFilter->multicast.mode) {
> +if (hostFilter->multicast.mode != guestFilter->multicast.mode ||
> +(guestFilter->multicast.overflow &&
> +guestFilter->multicast.mode == VIR_NETDEV_RX_FILTER_MODE_NORMAL)) {
>  switch (guestFilter->multicast.mode) {
>  case VIR_NETDEV_RX_FILTER_MODE_ALL:
>  if (virNetDevSetRcvAllMulti(ifname, true)) {
> -
>  VIR_WARN("Couldn't set allmulticast flag to 'on' for "
>   "device %s while responding to "
>   "NIC_RX_FILTER_CHANGED", ifname);
> @@ -4455,17 +4456,24 @@ syncNicRxFilterMultiMode(char *ifname, 
> virNetDevRxFilterPtr guestFilter,
>  break;
>  
>  case VIR_NETDEV_RX_FILTER_MODE_NORMAL:
> -if (virNetDevSetRcvMulti(ifname, true)) {
> +if (guestFilter->multicast.overflow &&
> +(hostFilter->multicast.mode == 
> VIR_NETDEV_RX_FILTER_MODE_ALL)) {
> +break;
> +}
>  
> +if (virNetDevSetRcvMulti(ifname, true)) {
>  VIR_WARN("Couldn't set multicast flag to 'on' for "
>   "device %s while responding to "
>   "NIC_RX_FILTER_CHANGED", ifname);
>  }
>  
> -if (virNetDevSetRcvAllMulti(ifname, false)) {
> -VIR_WARN("Couldn't set allmulticast flag to 'off' for "
> - "device %s while responding to "
> - "NIC_RX_FILTER_CHANGED", ifname);
> +if (virNetDevSetRcvAllMulti(ifname,
> +guestFilter->multicast.overflow) 
> < 0) {
> + VIR_WARN("Couldn't set allmulticast flag to '%s' for "
> +  "device %s while responding to "
> +  "NIC_RX_FILTER_CHANGED",
> +  
> virTristateSwitchTypeToString(virTristateSwitchFromBool(guestFilter->multicast.overflow)),
> +  ifname);
>  }
>  break;
>  
> -- 
> 2.7.4

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


[libvirt] [PATCH v2] qemu: handle multicast overflow on macvtap NIC_RX_FILTER_CHANGED

2018-11-30 Thread Jason Baron
Guest network devices can set 'overflow' when there are a number of multicast
ips configured. For virtio_net, the limit is only 64. In this case, the list
of mac addresses is empty and the 'overflow' condition is set. Thus, the guest
will currently receive no multicast traffic in this state.

When 'overflow' is set in the guest, let's turn this into ALLMULTI on the host.

Signed-off-by: Jason Baron 
---
v1->v2:
 1. check for < 0 in virNetDevSetRcvAllMulti() (Michal Privoznik)
 2. restrict overflow check to VIR_NETDEV_RX_FILTER_MODE_NORMAL mode as to
avoid unnecessarily calling rx filter updates for other modes 
 3. update virNetDevSetRcvAllMulti() call to use guestFilter->multicast.overflow
directly (Michal Privoznik)

 src/qemu/qemu_driver.c | 22 +++---
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7fb9102..f4bbfea 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4443,11 +4443,12 @@ static void
 syncNicRxFilterMultiMode(char *ifname, virNetDevRxFilterPtr guestFilter,
  virNetDevRxFilterPtr hostFilter)
 {
-if (hostFilter->multicast.mode != guestFilter->multicast.mode) {
+if (hostFilter->multicast.mode != guestFilter->multicast.mode ||
+(guestFilter->multicast.overflow &&
+guestFilter->multicast.mode == VIR_NETDEV_RX_FILTER_MODE_NORMAL)) {
 switch (guestFilter->multicast.mode) {
 case VIR_NETDEV_RX_FILTER_MODE_ALL:
 if (virNetDevSetRcvAllMulti(ifname, true)) {
-
 VIR_WARN("Couldn't set allmulticast flag to 'on' for "
  "device %s while responding to "
  "NIC_RX_FILTER_CHANGED", ifname);
@@ -4455,17 +4456,24 @@ syncNicRxFilterMultiMode(char *ifname, 
virNetDevRxFilterPtr guestFilter,
 break;
 
 case VIR_NETDEV_RX_FILTER_MODE_NORMAL:
-if (virNetDevSetRcvMulti(ifname, true)) {
+if (guestFilter->multicast.overflow &&
+(hostFilter->multicast.mode == 
VIR_NETDEV_RX_FILTER_MODE_ALL)) {
+break;
+}
 
+if (virNetDevSetRcvMulti(ifname, true)) {
 VIR_WARN("Couldn't set multicast flag to 'on' for "
  "device %s while responding to "
  "NIC_RX_FILTER_CHANGED", ifname);
 }
 
-if (virNetDevSetRcvAllMulti(ifname, false)) {
-VIR_WARN("Couldn't set allmulticast flag to 'off' for "
- "device %s while responding to "
- "NIC_RX_FILTER_CHANGED", ifname);
+if (virNetDevSetRcvAllMulti(ifname,
+guestFilter->multicast.overflow) < 
0) {
+ VIR_WARN("Couldn't set allmulticast flag to '%s' for "
+  "device %s while responding to "
+  "NIC_RX_FILTER_CHANGED",
+  
virTristateSwitchTypeToString(virTristateSwitchFromBool(guestFilter->multicast.overflow)),
+  ifname);
 }
 break;
 
-- 
2.7.4

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


Re: [libvirt] [PATCH v3 06/11] conf: gfx: Add egl-headless as a member to virDomainGraphicsDef struct

2018-11-30 Thread Ján Tomko

On Thu, Nov 29, 2018 at 03:20:16PM +0100, Erik Skultety wrote:

Since we need to specify the rendernode option onto QEMU cmdline, we
need this union member to retain consistency in how we build the
cmdline.

Signed-off-by: Erik Skultety 
---
src/conf/domain_conf.h | 3 +++
1 file changed, 3 insertions(+)



Reviewed-by: Ján Tomko 

Jano


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

Re: [libvirt] [PATCH v3 05/11] qemu: caps: Introduce QEMU_EGL_HEADLESS_RENDERNODE capability

2018-11-30 Thread Ján Tomko

On Thu, Nov 29, 2018 at 03:20:15PM +0100, Erik Skultety wrote:

Now that we have QAPI introspection of display types in QEMU upstream,
we can check whether the 'rendernode' option is supported with
egl-headless display type.

Signed-off-by: Erik Skultety 
---
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml | 1 +
3 files changed, 4 insertions(+)



Reviewed-by: Ján Tomko 

Jano


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

Re: [libvirt] [PATCH 0/2] Fix a couple get all domain stats issues

2018-11-30 Thread John Ferlan


Thanks for the quick peek on patch1; however, I was hoping to have these
 patches be considered for the current release seeing as patch2 fixes a
condition introduced in the release and because the next release won't
be until mid January or so. The downside of not pushing patch2 is that
running 'virsh domstats' will fail completely on a domain that doesn't
have the IOThread capability. Without patch1, you'd only get the generic
cause is unknown reason.  If it's felt that the patches can wait for the
next release that's fine, but no harm in asking...

Tks,

John

On 11/27/18 11:23 AM, John Ferlan wrote:
> One is longer term (patch1), while the other is sourced in this
> release (4.10.0) when IOThread stats were added.
> 
> John Ferlan (2):
>   qemu: Save qemuDomainGetStats error
>   qemu: Don't fail stats collection due to IOThread capability
> 
>  src/qemu/qemu_driver.c | 28 
>  1 file changed, 20 insertions(+), 8 deletions(-)
> 

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


Re: [libvirt] [PATCH] qemu: Qemu process unexpectedly killed in repeated reboot

2018-11-30 Thread Michal Privoznik
On 11/30/18 9:53 AM, Wang King wrote:
> The issue occurs when I make repeated calls to virDomainReboot with
> VIR_DOMAIN_REBOOT_DEFAULT flag. In the first call to reboot domain,
> the qemu driver chose ACPI path, and set priv->fakeReboot to true.
> Then in a second call, qemu driver chose agent to reboot which set
> fakeReboot to false. But because the guest already responded to ACPI
> shut down, libvirtd daemon will process a SHUTDOWN event in
> qemuProcessShutdownOrReboot and checks priv->fakeReboot. Since the
> fakeReboot flag is now false, qemu process is unexpectedly killed.
> 

This sounds fishy. Looking at the code libvirt decides whether to use
agent or ACPI based on:

a) flags (but since you're passing 0 this is out of the picture),
b) guest agent being available,

This means that agent must have connected between two virDomainReboot()
calls. Otherwise libvirt would make the same choice.

> I have no idea how to fix it.

Well, the qemuDomainSetFakeReboot(false) call was added in b0c144c5792
which points to:

  https://www.redhat.com/archives/libvir-list/2015-April/msg00732.html

I think the patch proposed there is actually right and not the one that
was merged.

Michal

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


Re: [libvirt] [PATCH v3 04/11] qemu: command: Introduce qemuBuildGraphicsEGLHeadlessCommandLine helper

2018-11-30 Thread Ján Tomko

On Thu, Nov 29, 2018 at 03:20:14PM +0100, Erik Skultety wrote:

We're going to need a bit more logic for egl-headless down the road so
prepare a helper just like for the other display types.

Signed-off-by: Erik Skultety 
---
src/qemu/qemu_command.c | 18 --
1 file changed, 16 insertions(+), 2 deletions(-)



Reviewed-by: Ján Tomko 

Jano


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

Re: [libvirt] [PATCH v3 03/11] qemu: process: spice: Pick the first available DRM render node

2018-11-30 Thread Ján Tomko

On Thu, Nov 29, 2018 at 03:20:13PM +0100, Erik Skultety wrote:

Up until now, we formatted 'rendernode=' onto QEMU cmdline only if the
user specified it in the XML, otherwise we let QEMU do it for us. This
causes permission issues because by default the /dev/dri/renderDX
permissions are as follows:

crw-rw. 1 root video

There's literally no reason why it shouldn't be libvirt picking the DRM
render node instead of QEMU, that way (and because we're using
namespaces by default), we can safely relabel the device within the
namespace.

Signed-off-by: Erik Skultety 
---
src/qemu/qemu_process.c   | 22 +++-
src/util/virutil.h|  2 +-
.../graphics-spice-gl-no-rendernode.args  | 25 +++
.../graphics-spice-gl-no-rendernode.xml   | 24 ++
tests/qemuxml2argvmock.c  |  9 +++
5 files changed, 80 insertions(+), 2 deletions(-)
create mode 100644 tests/qemuxml2argvdata/graphics-spice-gl-no-rendernode.args
create mode 100644 tests/qemuxml2argvdata/graphics-spice-gl-no-rendernode.xml

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 12d1fca0d4..feebdc7fdc 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4784,9 +4784,25 @@ qemuProcessGraphicsSetupListen(virQEMUDriverPtr driver,
}


+static int
+qemuProcessGraphicsSetupRenderNode(virDomainGraphicsDefPtr graphics,
+   virQEMUCapsPtr qemuCaps)
+{
+/* Don't bother picking a DRM node if QEMU doesn't support it. */
+if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE_RENDERNODE))
+return 0;
+
+if (!(graphics->data.spice.rendernode = virHostGetDRMRenderNode()))
+return -1;
+
+return 0;
+}
+
+
static int
qemuProcessSetupGraphics(virQEMUDriverPtr driver,
 virDomainObjPtr vm,
+ virQEMUCapsPtr qemuCaps,
 unsigned int flags)
{
virDomainGraphicsDefPtr graphics;
@@ -4797,6 +4813,10 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver,
for (i = 0; i < vm->def->ngraphics; i++) {
graphics = vm->def->graphics[i];

+if (virDomainGraphicsNeedsRenderNode(graphics) &&


Just like the call below is called even for graphics with no listen,
you can call qemuProcessGraphicsSetupRenderNode unconditionally and move
the virDomainGraphicsNeedsRenderNode condition inside.


+qemuProcessGraphicsSetupRenderNode(graphics, qemuCaps) < 0)
+goto cleanup;
+
if (qemuProcessGraphicsSetupListen(driver, graphics, vm) < 0)
goto cleanup;
}
@@ -5953,7 +5973,7 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver,
goto cleanup;

VIR_DEBUG("Setting graphics devices");
-if (qemuProcessSetupGraphics(driver, vm, flags) < 0)
+if (qemuProcessSetupGraphics(driver, vm, priv->qemuCaps, flags) < 0)
goto cleanup;

VIR_DEBUG("Create domain masterKey");
diff --git a/src/util/virutil.h b/src/util/virutil.h
index 89bd21b148..588d779d10 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -222,7 +222,7 @@ unsigned long long virMemoryMaxValue(bool ulong) 
ATTRIBUTE_NOINLINE;

bool virHostHasIOMMU(void);

-char *virHostGetDRMRenderNode(void);
+char *virHostGetDRMRenderNode(void) ATTRIBUTE_NOINLINE;

/**
 * VIR_ASSIGN_IS_OVERFLOW:
diff --git a/tests/qemuxml2argvdata/graphics-spice-gl-no-rendernode.args 
b/tests/qemuxml2argvdata/graphics-spice-gl-no-rendernode.args
new file mode 100644
index 00..1b08811692
--- /dev/null
+++ b/tests/qemuxml2argvdata/graphics-spice-gl-no-rendernode.args


A test called '-no-rendernode'...

[...]


+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-usb \
+-spice port=0,gl=on,rendernode=/dev/dri/foo \


... with a rendernode on the command line.

How about '-auto-rendernode'?


+-vga cirrus \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3


The test cases are not used anywhere. Please use DO_TEST_CAPS_LATEST
when adding them.

Reviewed-by: Ján Tomko 

Jano


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

Re: [libvirt] [PATCH v3 02/11] conf: Introduce virDomainGraphics-related helpers

2018-11-30 Thread Ján Tomko

On Thu, Nov 29, 2018 at 03:20:12PM +0100, Erik Skultety wrote:

A few simple helpers that allow us to determine whether a graphics can
and will need to make use of a DRM render node.

Signed-off-by: Erik Skultety 
---
src/conf/domain_conf.c   | 41 
src/conf/domain_conf.h   |  9 +
src/libvirt_private.syms |  3 +++
3 files changed, 53 insertions(+)

+bool
+virDomainGraphicsNeedsRenderNode(const virDomainGraphicsDef *graphics)


Consider:
NeedsAutoRenderNode

(in a way graphics with a rendernode already specified also needs it)


+{
+if (!virDomainGraphicsSupportsRenderNode(graphics) ||
+virDomainGraphicsGetRenderNode(graphics))
+return false;


Personally I'd decouple these two conditions.


+
+return true;
+}


Regardless:
Reviewed-by: Ján Tomko 

Jano


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

[libvirt] [PATCH v3 2/2] tests: Adding test case to include multiple network definitions.

2018-11-30 Thread Julio Faracco
This commit includes a test case for multiple network definitions. It is
useful right now, but it will be more useful when the index used by LXC
version 3.X is implemented to support this new settings. The version 3.X
is using indexes to specify each network settings.

Signed-off-by: Julio Faracco 
---
 .../lxcconf2xml-miscnetwork-v3.config | 23 ++
 .../lxcconf2xml-miscnetwork.config| 23 ++
 .../lxcconf2xml-miscnetwork.xml   | 45 +++
 tests/lxcconf2xmltest.c   |  2 +
 4 files changed, 93 insertions(+)
 create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-miscnetwork-v3.config
 create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-miscnetwork.config
 create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-miscnetwork.xml

diff --git a/tests/lxcconf2xmldata/lxcconf2xml-miscnetwork-v3.config 
b/tests/lxcconf2xmldata/lxcconf2xml-miscnetwork-v3.config
new file mode 100644
index 00..b46cb3ee7d
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-miscnetwork-v3.config
@@ -0,0 +1,23 @@
+lxc.network.type = phys
+lxc.network.link = eth0
+lxc.network.name = eth1
+lxc.network.ipv4 = 192.168.122.2/24
+lxc.network.ipv4.gateway = 192.168.122.1
+lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596/64
+lxc.network.ipv6.gateway = 2003:db8:1:0:214:1234:fe0b:3595
+
+lxc.network.type = vlan
+lxc.network.flags = up
+lxc.network.link = eth0
+lxc.network.hwaddr = 02:00:15:8f:05:c1
+lxc.network.vlan.id = 2
+
+lxc.network.type = macvlan
+lxc.network.flags = up
+lxc.network.link = eth0
+lxc.network.hwaddr = 02:00:15:8f:05:c1
+lxc.network.macvlan.mode = vepa
+
+lxc.rootfs = /var/lib/lxc/migrate_test/rootfs
+lxc.utsname = migrate_test
+lxc.autodev=1
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-miscnetwork.config 
b/tests/lxcconf2xmldata/lxcconf2xml-miscnetwork.config
new file mode 100644
index 00..b46cb3ee7d
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-miscnetwork.config
@@ -0,0 +1,23 @@
+lxc.network.type = phys
+lxc.network.link = eth0
+lxc.network.name = eth1
+lxc.network.ipv4 = 192.168.122.2/24
+lxc.network.ipv4.gateway = 192.168.122.1
+lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596/64
+lxc.network.ipv6.gateway = 2003:db8:1:0:214:1234:fe0b:3595
+
+lxc.network.type = vlan
+lxc.network.flags = up
+lxc.network.link = eth0
+lxc.network.hwaddr = 02:00:15:8f:05:c1
+lxc.network.vlan.id = 2
+
+lxc.network.type = macvlan
+lxc.network.flags = up
+lxc.network.link = eth0
+lxc.network.hwaddr = 02:00:15:8f:05:c1
+lxc.network.macvlan.mode = vepa
+
+lxc.rootfs = /var/lib/lxc/migrate_test/rootfs
+lxc.utsname = migrate_test
+lxc.autodev=1
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-miscnetwork.xml 
b/tests/lxcconf2xmldata/lxcconf2xml-miscnetwork.xml
new file mode 100644
index 00..63189cfaec
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-miscnetwork.xml
@@ -0,0 +1,45 @@
+
+  migrate_test
+  c7a5fdbd-edaf-9455-926a-d65c16db1809
+  65536
+  65536
+  1
+  
+exe
+/sbin/init
+  
+  
+
+
+  
+  
+  destroy
+  restart
+  destroy
+  
+/usr/libexec/libvirt_lxc
+
+  
+  
+
+
+  
+  
+  
+
+
+  
+eth0
+  
+  
+  
+  
+  
+
+
+  
+eth0.2
+  
+
+  
+
diff --git a/tests/lxcconf2xmltest.c b/tests/lxcconf2xmltest.c
index 0766239ec4..2a277042ce 100644
--- a/tests/lxcconf2xmltest.c
+++ b/tests/lxcconf2xmltest.c
@@ -137,6 +137,7 @@ mymain(void)
 DO_TEST("physnetwork", false);
 DO_TEST("macvlannetwork", false);
 DO_TEST("vlannetwork", false);
+DO_TEST("miscnetwork", false);
 DO_TEST("idmap", false);
 DO_TEST("memtune", false);
 DO_TEST("cputune", false);
@@ -161,6 +162,7 @@ mymain(void)
 DO_TEST3("physnetwork", false);
 DO_TEST3("macvlannetwork", false);
 DO_TEST3("vlannetwork", false);
+DO_TEST3("miscnetwork", false);
 DO_TEST3("idmap", false);
 DO_TEST3("memtune", false);
 DO_TEST3("cputune", false);
-- 
2.19.1

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


[libvirt] [PATCH v3 1/2] lxc: Initializing IPv6 and IPv4 gateway to overwrite old settings.

2018-11-30 Thread Julio Faracco
This commit fixes a bug when you have multiple network settings defined.
Basically, if you set an IPv6 or IPv4 gateway, it carries on next
network settings. It is happening because the data is not being
initialized when a new network type is defined. So, the old data still
persists into the pointer. Another way to initialized the data was
introduced using memset() to avoid missing attributes from the struct.

Signed-off-by: Julio Faracco 
---
 src/lxc/lxc_native.c | 27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index 9f6d4b3de8..0d21d9fb2b 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -561,27 +561,26 @@ lxcNetworkWalkCallback(const char *name, virConfValuePtr 
value, void *data)
 int status;
 
 if (STREQ(name, "lxc.network.type")) {
+virDomainDefPtr def = parseData->def;
+size_t networks = parseData->networks;
+bool privnet = parseData->privnet;
+
 /* Store the previous NIC */
 status = lxcAddNetworkDefinition(parseData);
 
 if (status < 0)
 return -1;
 else if (status > 0)
-parseData->networks++;
+networks++;
 else if (parseData->type != NULL && STREQ(parseData->type, "none"))
-parseData->privnet = false;
-
-/* Start a new network interface config */
-parseData->type = NULL;
-parseData->link = NULL;
-parseData->mac = NULL;
-parseData->flag = NULL;
-parseData->macvlanmode = NULL;
-parseData->vlanid = NULL;
-parseData->name = NULL;
-
-parseData->ips = NULL;
-parseData->nips = 0;
+privnet = false;
+
+/* clean NIC to store a new one */
+memset(parseData, 0, sizeof(*parseData));
+
+parseData->def = def;
+parseData->networks = networks;
+parseData->privnet = privnet;
 
 /* Keep the new value */
 parseData->type = value->str;
-- 
2.19.1

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


[libvirt] [PATCH v3 0/2] lxc: Fix a bug related to IPv{4, 6} gateway persistent setting.

2018-11-30 Thread Julio Faracco
This serie fixes a bug related to IPv{4,6} gateway settings when it is
defined and used with multiple network definitions. Basically, this data
is being carried on to the next network settings because the pointer is
not being cleaned up/initialized properly. The idea behind the fix was
create a new way to initialize the data without knowing the structure
attributes. The old way has a high probability to cause new bugs.

This serie add a new test case to cover this scenario too. It will be so
important to network index implemented on LXC 3.X.

v1-v2: Fixing tabs inside the code.

Julio Faracco (2):
  lxc: Initializing IPv6 and IPv4 gateway to overwrite old settings.
  tests: Adding test case to include multiple network definitions.

 src/lxc/lxc_native.c  | 27 ++-
 .../lxcconf2xml-miscnetwork-v3.config | 23 ++
 .../lxcconf2xml-miscnetwork.config| 23 ++
 .../lxcconf2xml-miscnetwork.xml   | 45 +++
 tests/lxcconf2xmltest.c   |  2 +
 5 files changed, 106 insertions(+), 14 deletions(-)
 create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-miscnetwork-v3.config
 create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-miscnetwork.config
 create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-miscnetwork.xml

-- 
2.19.1

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


[libvirt] [PATCH] qemu: Qemu process unexpectedly killed in repeated reboot

2018-11-30 Thread Wang King
The issue occurs when I make repeated calls to virDomainReboot with
VIR_DOMAIN_REBOOT_DEFAULT flag. In the first call to reboot domain,
the qemu driver chose ACPI path, and set priv->fakeReboot to true.
Then in a second call, qemu driver chose agent to reboot which set
fakeReboot to false. But because the guest already responded to ACPI
shut down, libvirtd daemon will process a SHUTDOWN event in
qemuProcessShutdownOrReboot and checks priv->fakeReboot. Since the
fakeReboot flag is now false, qemu process is unexpectedly killed.

I have no idea how to fix it.

Signed-off-by: Wang King 
-- 
2.8.3


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