Re: [libvirt] [PATCH 11/12] qemu: Implement RNG device hotplug on live level

2015-01-05 Thread lhuang


On 01/05/2015 11:48 PM, Peter Krempa wrote:

On 01/03/15 06:06, Luyao Huang wrote:

We have enough patches for hotplug RNG device, maybe we can
implement live hotplug of a RNG device.

Signed-off-by: Luyao Huang lhu...@redhat.com
---
  src/qemu/qemu_driver.c  |  8 -
  src/qemu/qemu_hotplug.c | 92 +
  src/qemu/qemu_hotplug.h |  3 ++
  3 files changed, 102 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index f9327b4..7f1e612 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1523,6 +1523,98 @@ qemuDomainRNGRemove(virDomainDefPtr vmdef,
  return ret;
  }
  
+int qemuDomainAttachRNGDevice(virQEMUDriverPtr driver,

+  virDomainObjPtr vm,
+  virDomainRNGDefPtr rng)
+{
+int ret = -1;
+qemuDomainObjPrivatePtr priv = vm-privateData;
+virDomainDefPtr vmdef = vm-def;
+char *devstr = NULL;
+char *charAlias = NULL;
+char *objAlias = NULL;
+bool need_remove = false;
+bool releaseaddr = false;
+
+if (!virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_DEVICE)) {
+virReportError(VIR_ERR_OPERATION_INVALID, %s,
+   _(qemu does not support -device));
+return ret;
+}

Additionally to the -device support, qemu also needs to support chardev
hotplug and the rng device with the appropriate backends, we already
have capability bits for them so you need to check them here.

Thanks for your review.

Yes, i forgot these check in this place and i found 
QEMU_CAPS_OBJECT_RNG_RANDOM

and QEMU_CAPS_OBJECT_RNG_EGD for random and egd backend RNG device.
But i cannot found a capability bit for support chardev hotplug, maybe 
this one? QEMU_CAPS_CHARDEV



+
+if (qemuAssignDeviceRNGAlias(vmdef, rng, -1)  0)
+return ret;
+
+if (rng-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
+if (STRPREFIX(vm-def-os.machine, s390-ccw) 
+virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
+rng-info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
+} else if (virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_VIRTIO_S390)) {
+rng-info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390;
+}
+}
+
+if (rng-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE ||
+rng-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
+if (virDomainPCIAddressEnsureAddr(priv-pciaddrs, rng-info)  0)
+return ret;
+} else if (rng-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
+if (virDomainCCWAddressAssign(rng-info, priv-ccwaddrs,
+  !rng-info.addr.ccw.assigned)  0)

Line above is misaligned.

Thanks



+return ret;
+}
+releaseaddr = true;
+if (!(devstr = qemuBuildRNGDevStr(vmdef, rng, priv-qemuCaps)))
+return ret;

After you set releaseaddr to true you need to jump to cleanup in case of
error so that the address gets cleared.

Yes, i have made a mistake here. I will fix it in next version.

+
+if (virAsprintf(objAlias, obj%s, rng-info.alias)  0)
+goto cleanup;
+
+if (rng-backend == VIR_DOMAIN_RNG_BACKEND_EGD) {
+if (virAsprintf(charAlias, char%s, rng-info.alias)  0)
+goto cleanup;
+
+qemuDomainObjEnterMonitor(driver, vm);
+if (qemuMonitorAttachCharDev(priv-mon, charAlias, rng-source.chardev) 
 0) {
+qemuDomainObjExitMonitor(driver, vm);
+goto audit;
+}
+need_remove = true;

This variable should be named remove_chardev so that it's clear what
it's used to.


Okay, thanks

+} else {
+qemuDomainObjEnterMonitor(driver, vm);
+}
+
+if (qemuMonitorAttachRNGDev(priv-mon, charAlias, objAlias, rng)  0) {
+if (need_remove)
+qemuMonitorDetachCharDev(priv-mon, charAlias);
+qemuDomainObjExitMonitor(driver, vm);
+goto audit;
+}
+
+if (devstr  qemuMonitorAddDevice(priv-mon, devstr)  0) {
+qemuMonitorDetachRNGDev(priv-mon, objAlias);
+if (need_remove)
+qemuMonitorDetachCharDev(priv-mon, charAlias);
+qemuDomainObjExitMonitor(driver, vm);
+goto audit;
+}
+qemuDomainObjExitMonitor(driver, vm);
+
+if (qemuDomainRNGInsert(vmdef, rng)  0)
+goto cleanup;
+
+ret = 0;
+ audit:
+virDomainAuditRNG(vm, NULL, rng, attach, ret == 0);
+ cleanup:
+if (releaseaddr)
+qemuDomainReleaseDeviceAddress(vm, rng-info, NULL);
+VIR_FREE(charAlias);
+VIR_FREE(objAlias);
+VIR_FREE(devstr);
+return ret;
+}
+
  
  static int

  qemuDomainAttachHostUSBDevice(virQEMUDriverPtr driver,


The rest looks good.

Peter




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


Re: [libvirt] [PATCH 09/12] qemu_monitor: add 2 functions qemuMonitorDetachRNGDev and qemuMonitorAttachRNGDev

2015-01-05 Thread lhuang


On 01/05/2015 11:31 PM, Peter Krempa wrote:

On 01/03/15 06:06, Luyao Huang wrote:

These 2 functions just do some basic check and then call
qemuMonitorJSONAttachRNGDev and qemuMonitorDelObject to
help us.

Signed-off-by: Luyao Huang lhu...@redhat.com
---
  src/qemu/qemu_monitor.c | 43 +++
  src/qemu/qemu_monitor.h |  7 +++
  2 files changed, 50 insertions(+)


This patch can be folded into the previous one. And again the commit
message could be improved.

Thanks for your review.
Okay, i will merge them into patch qemu: add a functions for attach a 
rng object in json monitor

Peter



Luyao

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


[libvirt] [libvirt-test-API][PATCH 0/2] Add API openGraphicsFD test case

2015-01-05 Thread Jincheng Miao
Add API openGraphicsFD test case to linux_domain.conf

Jincheng Miao (2):
  domain: add open_graphicsfd
  Add open_graphicsFD to linux_domain.conf

 cases/linux_domain.conf |   14 ++
 repos/domain/open_graphicsfd.py |   89 +++
 2 files changed, 103 insertions(+), 0 deletions(-)
 create mode 100644 repos/domain/open_graphicsfd.py

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


Re: [libvirt] [PATCH 07/12] qemu: introduce 2 func qemuDomainRNGInsert and qemuDomainRNGRemove

2015-01-05 Thread lhuang


On 01/05/2015 11:22 PM, Peter Krempa wrote:

On 01/03/15 06:06, Luyao Huang wrote:

qemu side functions, call virDomainRNGInsert and virDomainRNGRemove
to help us.

Signed-off-by: Luyao Huang lhu...@redhat.com
---
  src/qemu/qemu_hotplug.c | 23 +++
  src/qemu/qemu_hotplug.h |  7 +++
  2 files changed, 30 insertions(+)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 7f93b9b..f9327b4 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1501,6 +1501,29 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr driver,
  return ret;
  }
  
+int

+qemuDomainRNGInsert(virDomainDefPtr vmdef,
+virDomainRNGDefPtr rng)
+{
+return virDomainRNGInsert(vmdef, rng);
+}

This wrapper doesn't seem useful.

Yes, i will remove this function in next version.



+
+virDomainRNGDefPtr
+qemuDomainRNGRemove(virDomainDefPtr vmdef,
+virDomainRNGDefPtr rng)
+{
+virDomainRNGDefPtr ret;
+
+if (!(ret = virDomainRNGRemove(vmdef, rng))) {
+virReportError(VIR_ERR_INVALID_ARG, %s,
+   _(device not present in domain configuration));
+return NULL;
+}

Given that this function is used exactly once in the series you've
posted it doesn't make much sense to have the code separate.


Okay, ...

+
+return ret;
+}
+
+
  static int
  qemuDomainAttachHostUSBDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm,
diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h
index d13c532..7b838ee 100644
--- a/src/qemu/qemu_hotplug.h
+++ b/src/qemu/qemu_hotplug.h
@@ -107,6 +107,13 @@ virDomainChrDefPtr
  qemuDomainChrRemove(virDomainDefPtr vmdef,
  virDomainChrDefPtr chr);
  
+int

+qemuDomainRNGInsert(virDomainDefPtr vmdef,
+virDomainRNGDefPtr rng);
+virDomainRNGDefPtr
+qemuDomainRNGRemove(virDomainDefPtr vmdef,
+virDomainRNGDefPtr rng);
+

Both of the functions above are used only in qemu_hotplug.c. It doesn't
make sense to export them.

... i will remove them and won't export qemuDomainRNGRemove.

Thanks for your review and pointing out.

  void qemuDomainRemoveDevice(virQEMUDriverPtr driver,
  virDomainObjPtr vm,
  virDomainDeviceDefPtr dev);


Peter




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


Re: [libvirt] [PATCH 03/12] conf: introduce a new func virDomainRNGEquals

2015-01-05 Thread lhuang


On 01/05/2015 11:00 PM, Peter Krempa wrote:

Subject: ... How about

conf: Introduce function to compare RNG devices.


On 01/03/15 06:06, Luyao Huang wrote:

virDomainRNGEquals is a func which check if two rng device
are the same.

Signed-off-by: Luyao Huang lhu...@redhat.com
---
  src/conf/domain_conf.c | 34 ++
  src/conf/domain_conf.h |  3 +++
  2 files changed, 37 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index aafc05e..91c114e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11922,6 +11922,40 @@ virDomainChrRemove(virDomainDefPtr vmdef,
  return ret;
  }
  
+bool

+virDomainRNGEquals(virDomainRNGDefPtr src,
+   virDomainRNGDefPtr tgt)
+{
+if (!src || !tgt)
+return src == tgt;
+
+if (src-model != tgt-model)
+return false;
+
+if (src-rate != tgt-rate || src-period != tgt-period)
+return false;
+
+switch ((virDomainRNGModel) src-model) {
+case VIR_DOMAIN_RNG_MODEL_VIRTIO:
+switch ((virDomainRNGBackend) src-backend) {
+case VIR_DOMAIN_RNG_BACKEND_RANDOM:
+return STREQ_NULLABLE(src-source.file, tgt-source.file);
+break;
+case VIR_DOMAIN_RNG_BACKEND_EGD:
+return virDomainChrSourceDefIsEqual((virDomainChrSourceDef *) 
src-source.chardev,
+(virDomainChrSourceDef *) 
tgt-source.chardev);

No need for typecast here; both src-source.chardev and tgt ... are
already in the required type.


Got it, i will remove the typecast in next version.

+break;
+case VIR_DOMAIN_RNG_BACKEND_LAST:
+break;
+}
+break;
+
+case VIR_DOMAIN_RNG_MODEL_LAST:
+break;
+}
+return false;
+}
+
  char *
  virDomainDefGetDefaultEmulator(virDomainDefPtr def,
 virCapsPtr caps)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 57297cd..c197095 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2597,6 +2597,9 @@ virDomainChrInsert(virDomainDefPtr vmdef,
  virDomainChrDefPtr
  virDomainChrRemove(virDomainDefPtr vmdef,
 virDomainChrDefPtr chr);
+bool
+virDomainRNGEquals(virDomainRNGDefPtr src,
+   virDomainRNGDefPtr tgt);

As in the case below, please add the type to the same line as the
declaration.

OKay

Thanks for your review
  
  int virDomainSaveXML(const char *configDir,

   virDomainDefPtr def,


Peter



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


Re: [libvirt] [PATCH 06/12] qemu: add id when build RNG device and rename object id

2015-01-05 Thread lhuang


On 01/05/2015 11:45 PM, Peter Krempa wrote:

On 01/05/15 15:51, Peter Krempa wrote:

On 01/03/15 06:06, Luyao Huang wrote:

We didn't set a id when we build RNG device cmdline before.
Give a id to every RNG device and we can hotunplug it via
QMP cmd device_del.

Signed-off-by: Luyao Huang lhu...@redhat.com
---
  src/qemu/qemu_command.c | 12 ++--
  1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 46e289d..a4073ee 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5761,7 +5761,7 @@ qemuBuildRNGBackendArgs(virCommandPtr cmd,
  goto cleanup;
  }
  
-virBufferAsprintf(buf, rng-random,id=%s,filename=%s,

+virBufferAsprintf(buf, rng-random,id=obj%s,filename=%s,
dev-info.alias, dev-source.file);
  
  virCommandAddArg(cmd, -object);

@@ -5784,7 +5784,7 @@ qemuBuildRNGBackendArgs(virCommandPtr cmd,
  virCommandAddArgList(cmd, -chardev, backend, NULL);
  
  virCommandAddArg(cmd, -object);

-virCommandAddArgFormat(cmd, rng-egd,chardev=char%s,id=%s,
+virCommandAddArgFormat(cmd, rng-egd,chardev=char%s,id=obj%s,
 dev-info.alias, dev-info.alias);
  break;
  
@@ -5816,13 +5816,13 @@ qemuBuildRNGDevStr(virDomainDefPtr def,

  }
  
  if (dev-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)

-virBufferAsprintf(buf, virtio-rng-ccw,rng=%s, dev-info.alias);
+virBufferAsprintf(buf, virtio-rng-ccw,rng=obj%s,id=%s, 
dev-info.alias, dev-info.alias);
  else if (dev-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390)
-virBufferAsprintf(buf, virtio-rng-s390,rng=%s, dev-info.alias);
+virBufferAsprintf(buf, virtio-rng-s390,rng=obj%s,id=%s, 
dev-info.alias, dev-info.alias);
  else if (dev-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO)
-virBufferAsprintf(buf, virtio-rng-device,rng=%s, dev-info.alias);
+virBufferAsprintf(buf, virtio-rng-device,rng=obj%s,id=%s, 
dev-info.alias, dev-info.alias);
  else
-virBufferAsprintf(buf, virtio-rng-pci,rng=%s, dev-info.alias);
+virBufferAsprintf(buf, virtio-rng-pci,rng=obj%s,id=%s, 
dev-info.alias, dev-info.alias);
  
  if (dev-rate  0) {

  virBufferAsprintf(buf, ,max-bytes=%u, dev-rate);



This breaks the testsuite as you didn't fix the expected outputs after
such a change. Please always run make check before posting patches.

Additional question. Is this change even necessary? The RNG device does
have it's alias already whithout the obj prefix ... thus it's just
rng0 for example.

I misread the code. This is actually necessary as otherwise the -device
would have the same ID as the backend object. That makes sense to
change, although we need to make sure then that the code will work in
case of a long running VM (with the incorrect name) and a new libvirt
instance.

At any rate ... you need to fix the tests after this commit

Thanks for your review.
Yes, I will give another commit for the tests fix in next version.

I have test with a long running VM (start in old libvirt which RNG 
device no
device name), and update to a libvirt which have these code, if we try 
to hot-unplug the

rng device, qemu will return a error like this :
internal error: unable to execute QEMU command 'device_del': Device 
'rng0' not found


maybe my qemu is too old ? vm qemu cmdline -device do not have a id 
(because i start it in the
old libvirt), so this error is correct in this place. But i don't know 
how can i hot-unplug a device without

a id.

Peter



Luyao

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


Re: [libvirt] [PATCH 01/12] qemu: introduce a new func qemuAssignDeviceRNGAlias for rng device

2015-01-05 Thread lhuang


On 01/05/2015 11:10 PM, Peter Krempa wrote:

Subject: perhaps..

qemu: Add helper to assign RNG device aliases

Thanks, good Subject

On 01/03/15 06:06, Luyao Huang wrote:

This function used to set a alias name for RNG device, usage just

This function is used to assign an alias for a RNG device. It will be
later reused when hotplugging RNGs.

Thanks a lot

like other named qemuAssignDevice***Alias functions.

Signed-off-by: Luyao Huang lhu...@redhat.com
---
  src/qemu/qemu_command.c | 25 -
  src/qemu/qemu_command.h |  1 +
  2 files changed, 25 insertions(+), 1 deletion(-)


ACK with the commit message changes. (Please include the change in the
next posting, as I'm already requiring a new version).

Peter




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


Re: [libvirt] [PATCH 02/12] qemu: rename qemuBuildRNGDeviceArgs to qemuBuildRNGDevStr and change something

2015-01-05 Thread lhuang


On 01/05/2015 11:18 PM, Peter Krempa wrote:

Subject: change something? That's a really vague statement.

How about:

qemu: refactor qemuBuildRNGDeviceArgs to allow reuse in RNG hotplug

Good subject :)
Thanks

On 01/03/15 06:06, Luyao Huang wrote:

rename qemuBuildRNGDeviceArgs to qemuBuildRNGDevStr, we need this function
to build a cmdline.

Rename qemuBuildRNGDeviceArgs to qemuBuildRNGDevStr and change the
return type so that it can be reused in the device hotplug code later.


Thanks

Signed-off-by: Luyao Huang lhu...@redhat.com
---
  src/qemu/qemu_command.c | 33 -
  src/qemu/qemu_command.h |  4 
  2 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c1e9bca..46e289d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5800,22 +5800,19 @@ qemuBuildRNGBackendArgs(virCommandPtr cmd,
  return ret;
  }
  
-

Don't delete the line. Functions are usually separated by two newlines.

Okay

-static int
-qemuBuildRNGDeviceArgs(virCommandPtr cmd,
-   virDomainDefPtr def,
-   virDomainRNGDefPtr dev,
-   virQEMUCapsPtr qemuCaps)
+char *
+qemuBuildRNGDevStr(virDomainDefPtr def,
+   virDomainRNGDefPtr dev,
+   virQEMUCapsPtr qemuCaps)
  {
  virBuffer buf = VIR_BUFFER_INITIALIZER;
-int ret = -1;
  
  if (dev-model != VIR_DOMAIN_RNG_MODEL_VIRTIO ||

  !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG)) {
  virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
 _(this qemu doesn't support RNG device type '%s'),
 virDomainRNGModelTypeToString(dev-model));
-goto cleanup;
+goto error;
  }
  
  if (dev-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)

ACK, looks good except for the commit message and the spurious line
deletion.

Peter




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


Re: [libvirt] [PATCH 10/12] audit: make function virDomainAuditRNG global

2015-01-05 Thread lhuang


On 01/05/2015 11:32 PM, Peter Krempa wrote:

In subject:

audit: export virDomainAuditRNG

On 01/03/15 06:06, Luyao Huang wrote:

Signed-off-by: Luyao Huang lhu...@redhat.com
---
  src/conf/domain_audit.c  | 2 +-
  src/conf/domain_audit.h  | 7 +++
  src/libvirt_private.syms | 1 +
  3 files changed, 9 insertions(+), 1 deletion(-)


ACK,

Thanks, i will update the subject in next version.

Peter



Luyao

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


[libvirt] [libvirt-test-API][PATCH 1/2] domain: add open_graphicsfd

2015-01-05 Thread Jincheng Miao
Add test case for API domain.openGraphicsFD.

Signed-off-by: Jincheng Miao jm...@redhat.com
---
 repos/domain/open_graphicsfd.py |   89 +++
 1 files changed, 89 insertions(+), 0 deletions(-)
 create mode 100644 repos/domain/open_graphicsfd.py

diff --git a/repos/domain/open_graphicsfd.py b/repos/domain/open_graphicsfd.py
new file mode 100644
index 000..ab5b681
--- /dev/null
+++ b/repos/domain/open_graphicsfd.py
@@ -0,0 +1,89 @@
+#!/usr/bin/env python
+# To test domain's openGraphicsFD API
+
+import time
+import os
+
+import libvirt
+from libvirt import libvirtError
+
+from src import sharedmod
+
+required_params = ('guestname', 'idx')
+optional_params = {'flags': ''}
+
+
+def parse_flags(flags):
+ parse flags
+
+if flags == 'skipauth':
+return libvirt.VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH
+elif flags == None:
+return 0
+else:
+return -1
+
+def check_guest_status(domobj):
+ check guest current status
+
+state = domobj.info()[0]
+if state == libvirt.VIR_DOMAIN_SHUTOFF or \
+state == libvirt.VIR_DOMAIN_SHUTDOWN:
+return False
+else:
+return True
+
+
+def check_graphicsfd(fd):
+ check graphicsfd
+
+try:
+f = os.fdopen(fd)
+f.close()
+except:
+return False
+return True
+
+
+def open_graphicsfd(params):
+ test openGraphicsFD API
+
+logger = params['logger']
+guestname = params['guestname']
+idx = int(params['idx'])
+flags = parse_flags(params.get('flags'))
+
+if flags == -1:
+logger.error(invalid flags for openGraphicsFD: %s % flags)
+return 1
+
+logger.info(the guestname is %s % guestname)
+logger.info(the idx is %s % idx)
+logger.info(the flags is %s % flags)
+
+conn = sharedmod.libvirtobj['conn']
+
+domobj = conn.lookupByName(guestname)
+
+# Check domain status
+if check_guest_status(domobj):
+pass
+else:
+domobj.create()
+time.sleep(90)
+
+try:
+fd = domobj.openGraphicsFD(idx)
+
+if check_graphicsfd(fd):
+logger.info(check graphicsfd: success.)
+else:
+logger.error(check graphicsfd: failed.)
+return 1
+
+except libvirtError, e:
+logger.error(API error message: %s, error code is %s
+ % (e.message, e.get_error_code()))
+return 1
+
+return 0
-- 
1.7.1

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


[libvirt] [libvirt-test-API][PATCH 2/2] Add open_graphicsFD to linux_domain.conf

2015-01-05 Thread Jincheng Miao
Signed-off-by: Jincheng Miao jm...@redhat.com
---
 cases/linux_domain.conf |   14 ++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/cases/linux_domain.conf b/cases/linux_domain.conf
index e7d6bac..b617ace 100644
--- a/cases/linux_domain.conf
+++ b/cases/linux_domain.conf
@@ -139,6 +139,20 @@ domain:balloon_memory
 memorypair
 1024,2048
 
+domain:open_graphicsfd
+guestname
+$defaultname
+idx
+0
+
+domain:open_graphicsfd
+guestname
+$defaultname
+idx
+0
+flags
+   skipauth
+
 domain:destroy
 guestname
 $defaultname
-- 
1.7.1

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


Re: [libvirt] [PATCH 08/12] qemu: introduce 2 functions for attach a rng object in json monitor

2015-01-05 Thread lhuang


On 01/05/2015 11:29 PM, Peter Krempa wrote:

On 01/03/15 06:06, Luyao Huang wrote:

We need a new function to build a RNG device object, and need a
function to build a props which will be used in qemuMonitorJSONAddObject.

Signed-off-by: Luyao Huang lhu...@redhat.com
---
  src/qemu/qemu_monitor_json.c | 58 
  src/qemu/qemu_monitor_json.h |  5 
  2 files changed, 63 insertions(+)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index e567aa7..4430819 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -6166,6 +6166,64 @@ qemuMonitorJSONDetachCharDev(qemuMonitorPtr mon,
  return ret;
  }
  
+static virJSONValuePtr

+qemuMonitorJSONRNGPropsCommand(const char *name,
+   const char *data)
+{
+virJSONValuePtr ret;
+
+if (!(ret = virJSONValueNewObject()))
+goto error;
+
+if (virJSONValueObjectAppendString(ret, name, data)  0)
+goto error;
+
+return ret;
+
+ error:
+virJSONValueFree(ret);
+return NULL;
+}

To allow adding generic properties to objects I've added the
virJSONValueObjectCreate function that allows to create generic json
value objects. Please use that func instead of the above.

Thanks for pointing out, i forgot double check the exist functions.



+
+int
+qemuMonitorJSONAttachRNGDev(qemuMonitorPtr mon,
+const char *chrID,
+const char *objID,
+virDomainRNGDefPtr rng)
+{
+const char *type = NULL;
+virJSONValuePtr props = NULL;
+
+switch ((virDomainRNGBackend) rng-backend) {
+case VIR_DOMAIN_RNG_BACKEND_RANDOM:
+type = rng-random;
+if (!(props = qemuMonitorJSONRNGPropsCommand(filename, 
rng-source.file)))

With usage of virJSONValueObjectCreate the code will look like:

if (!(props = virJSONValueObjectCreate(s:filename, rng-source.file,
NULL)))

Thanks the example, i will use them in next version.



+goto cleanup;
+break;
+
+case VIR_DOMAIN_RNG_BACKEND_EGD:
+if (!chrID) {
+virReportError(VIR_ERR_INTERNAL_ERROR,%s,
+   _(miss chardev id));
+goto cleanup;
+}

The chardev and backend object ID can (and should) be inferred from the
rng device ID as they should be the same (except for the char/obj
prefix).

Eww, i think your mean is add a check for charname and objname, if they
are different then output a error?


+type = rng-egd;
+if (!(props = qemuMonitorJSONRNGPropsCommand(chardev, chrID)))
+goto cleanup;
+break;
+
+case VIR_DOMAIN_RNG_BACKEND_LAST:
+/*shouldn't happen*/
+goto cleanup;
+}
+
+return qemuMonitorJSONAddObject(mon, type, objID, props);
+
+ cleanup:
+virJSONValueFree(props);
+return -1;
+}
+
  
  int

Peter



Luyao

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


Re: [libvirt] [PATCH 0/2] Misc fixes

2015-01-05 Thread Ján Tomko
On 12/30/2014 11:33 AM, Cédric Bosdonnat wrote:
 Hi there,
 
 Here are 2 patches fixing tiny annoying problems. One of them, makes
 apparmor profiles handle /usr/lib64 folder and the other one fixes an
 uncleaned piece of domain config.
 
 Cédric Bosdonnat (2):
   Teach AppArmor, that /usr/lib64 may exist.
   Fix error when starting a container after an error
 
  examples/apparmor/libvirt-qemu   | 2 +-
  examples/apparmor/usr.lib.libvirt.virt-aa-helper | 4 ++--
  examples/apparmor/usr.sbin.libvirtd  | 4 ++--
  src/lxc/lxc_process.c| 1 +
  4 files changed, 6 insertions(+), 5 deletions(-)
 

ACK series

Jan



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 1/2] Teach AppArmor, that /usr/lib64 may exist.

2015-01-05 Thread Cedric Bosdonnat
On Sun, 2015-01-04 at 10:00 -0600, Jamie Strandboge wrote:
 On 12/30/2014 04:33 AM, Cédric Bosdonnat wrote:
  The apparmor profiles forgot about /usr/lib64 folders, just add lib64
  as a possible alternative to lib in the paths
 
 These changes all look good to me. +1

Pushed, then.
Thanks for the review.

  ---
   examples/apparmor/libvirt-qemu   | 2 +-
   examples/apparmor/usr.lib.libvirt.virt-aa-helper | 4 ++--
   examples/apparmor/usr.sbin.libvirtd  | 4 ++--
   3 files changed, 5 insertions(+), 5 deletions(-)
  
  diff --git a/examples/apparmor/libvirt-qemu b/examples/apparmor/libvirt-qemu
  index c6de6dd..7aad391 100644
  --- a/examples/apparmor/libvirt-qemu
  +++ b/examples/apparmor/libvirt-qemu
  @@ -111,7 +111,7 @@
 /usr/bin/qemu-sparc32plus rmix,
 /usr/bin/qemu-sparc64 rmix,
 /usr/bin/qemu-x86_64 rmix,
  -  /usr/lib/qemu/block-curl.so mr,
  +  /usr/{lib,lib64}/qemu/block-curl.so mr,
   
 # for save and resume
 /bin/dash rmix,
  diff --git a/examples/apparmor/usr.lib.libvirt.virt-aa-helper 
  b/examples/apparmor/usr.lib.libvirt.virt-aa-helper
  index bceaaff..b34fb35 100644
  --- a/examples/apparmor/usr.lib.libvirt.virt-aa-helper
  +++ b/examples/apparmor/usr.lib.libvirt.virt-aa-helper
  @@ -1,7 +1,7 @@
   # Last Modified: Mon Apr  5 15:10:27 2010
   #include tunables/global
   
  -/usr/lib/libvirt/virt-aa-helper {
  +profile virt-aa-helper /usr/{lib,lib64}/libvirt/virt-aa-helper {
 #include abstractions/base
   
 # needed for searching directories
  @@ -20,7 +20,7 @@
 /sys/devices/ r,
 /sys/devices/** r,
   
  -  /usr/lib/libvirt/virt-aa-helper mr,
  +  /usr/{lib,lib64}/libvirt/virt-aa-helper mr,
 /sbin/apparmor_parser Ux,
   
 /etc/apparmor.d/libvirt/* r,
  diff --git a/examples/apparmor/usr.sbin.libvirtd 
  b/examples/apparmor/usr.sbin.libvirtd
  index 3011eff..7151052 100644
  --- a/examples/apparmor/usr.sbin.libvirtd
  +++ b/examples/apparmor/usr.sbin.libvirtd
  @@ -44,7 +44,7 @@
 /usr/bin/* PUx,
 /usr/sbin/* PUx,
 /lib/udev/scsi_id PUx,
  -  /usr/lib/xen-common/bin/xen-toolstack PUx,
  +  /usr/{lib,lib64}/xen-common/bin/xen-toolstack PUx,
   
 # force the use of virt-aa-helper
 audit deny /sbin/apparmor_parser rwxl,
  @@ -53,7 +53,7 @@
 audit deny /sys/kernel/security/apparmor/matching rwxl,
 audit deny /sys/kernel/security/apparmor/.* rwxl,
 /sys/kernel/security/apparmor/profiles r,
  -  /usr/lib/libvirt/* PUxr,
  +  /usr/{lib,lib64}/libvirt/* PUxr,
 /etc/libvirt/hooks/** rmix,
 /etc/xen/scripts/** rmix,
   
  
 
 
 --
 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] [PATCH] qemu: use a wrong name for guest panic status

2015-01-05 Thread Luyao Huang
https://bugzilla.redhat.com/show_bug.cgi?id=1178652

We will get a warning when we have a guest in paused
status(casue by kernel panic) and restart libvirtd,
warning message like this:

Qemu reported unknown VM status: 'guest-panicked'

and this seems because we set a wrong status name in
qemu_monitor.c, and from qemu qapi-schema.json file
we know this status should named 'guest-panicked'.

Signed-off-by: Luyao Huang lhu...@redhat.com
---
 src/qemu/qemu_monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 100bbd0..57a13ab 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -127,7 +127,7 @@ VIR_ENUM_IMPL(qemuMonitorVMStatus,
   QEMU_MONITOR_VM_STATUS_LAST,
   debug, inmigrate, internal-error, io-error, paused,
   postmigrate, prelaunch, finish-migrate, restore-vm,
-  running, save-vm, shutdown, watchdog, guest-panic)
+  running, save-vm, shutdown, watchdog, guest-panicked)
 
 typedef enum {
 QEMU_MONITOR_BLOCK_IO_STATUS_OK,
-- 
1.8.3.1

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


[libvirt] [PATCH] Makefile: Fix parallel build after Xen-xl parser introduction

2015-01-05 Thread Michal Privoznik
Well, the parallel build doesn't work as there are not dependencies
set correctly. When running 'make -j' I see this error:

make[2]: Entering directory '/home/zippy/work/libvirt/libvirt.git/src'
  GEN  util/virkeymaps.h
  GEN  locking/lock_protocol.h
make[2]: *** No rule to make target 'xenconfig/xen_xl_disk.h', needed by 'all'. 
 Stop.
make[2]: *** Waiting for unfinished jobs
  GEN  lxc/lxc_controller_dispatch.h

The fix is to correctly set dependencies by letting make know that .c
and .h are to be generated from .l. Moreover, the section is moved
closer to the other section which uses it.

Signed-off-by: Michal Privoznik mpriv...@redhat.com
---

I'm not fully satisfied with this patch yet. I mean, for some
reason it creates 'src/.h' file, but hey - it makes parallel
build work again. Any brighter idea appreciated.

 src/Makefile.am | 36 +++-
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index c6d736e..7619cf0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1000,23 +1000,6 @@ CPU_SOURCES =
\
 VMX_SOURCES =  \
vmx/vmx.c vmx/vmx.h
 
-AM_LFLAGS = -Pxl_disk_ --header-file=../$*.h
-LEX_OUTPUT_ROOT = lex.xl_disk_
-BUILT_SOURCES += xenconfig/xen_xl_disk.c xenconfig/xen_xl_disk.h
-# Generated header file is not implicitly added to dist
-EXTRA_DIST += xenconfig/xen_xl_disk.h
-CLEANFILES += xenconfig/xen_xl_disk.h xenconfig/xen_xl_disk.c
-
-XENXLDISKPARSER_SOURCES = xenconfig/xen_xl_disk.l
-
-XENCONFIG_SOURCES =\
-   xenconfig/xenxs_private.h   \
-   xenconfig/xen_common.c xenconfig/xen_common.h   \
-   xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h   \
-   xenconfig/xen_xm.c xenconfig/xen_xm.h   \
-   xenconfig/xen_xl.c xenconfig/xen_xl.h   \
-   xenconfig/xen_xl_disk.h
-
 pkgdata_DATA = cpu/cpu_map.xml
 
 EXTRA_DIST +=  $(pkgdata_DATA)
@@ -1078,6 +1061,25 @@ libvirt_xenxldiskparser_la_CFLAGS = \
 libvirt_xenxldiskparser_la_SOURCES = \
$(XENXLDISKPARSER_SOURCES)
 
+AM_LFLAGS = -Pxl_disk_ --header-file=../$*.h
+XENXLDISKPARSER_GENERATED = xenconfig/xen_xl_disk.c xenconfig/xen_xl_disk.h
+BUILT_SOURCES += $(XENXLDISKPARSER_GENERATED)
+EXTRA_DIST += $(XENXLDISKPARSER_GENERATED)
+MAINTAINERCLEANFILES += $(XENXLDISKPARSER_GENERATED)
+
+XENXLDISKPARSER_SOURCES = xenconfig/xen_xl_disk.l
+
+$(XENXLDISKPARSER_GENERATED): $(XENXLDISKPARSER_SOURCES)
+   $(SHELL) $(YLWRAP) $ lex.xl_disk_.c $@ -- $(LEXCOMPILE)
+
+XENCONFIG_SOURCES =\
+   xenconfig/xenxs_private.h   \
+   xenconfig/xen_common.c xenconfig/xen_common.h   \
+   xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h   \
+   xenconfig/xen_xm.c xenconfig/xen_xm.h   \
+   xenconfig/xen_xl.c xenconfig/xen_xl.h   \
+   xenconfig/xen_xl_disk_i.h
+
 noinst_LTLIBRARIES += libvirt_xenconfig.la
 libvirt_la_BUILT_LIBADD += libvirt_xenconfig.la
 libvirt_xenconfig_la_CFLAGS = \
-- 
2.0.5

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


Re: [libvirt] [PATCH 0/9] qemu: Add quorum support to libvirt

2015-01-05 Thread Matthias Gatto
On Wed, Dec 17, 2014 at 10:53 AM, Matthias Gatto
matthias.ga...@outscale.com wrote:
 On Mon, Dec 8, 2014 at 7:31 PM, Matthias Gatto
 matthias.ga...@outscale.com wrote:
 The purpose of these patches is to introduce quorum for libvirt
 I've try to follow this proposal:
 http://www.redhat.com/archives/libvir-list/2014-May/msg00533.html

 This feature ask for 6 task:

 1) Allow a _virStorageSource
 to contain more than one backing store.

 Therefore we have to treat the field virStorageSourcePtr backingStores
 as an array instead of a pointer.
 But doing that, most of the backingStore field would be an array contening
 only one element.
 So I've decide to allocate the array only if there is more than 1
 backing store in a _virStorageSource.
 Because all the actual libvirt code use the backingStore field
 as a pointer and we needs want to change that, I've decide to encapsulate
 the backingStore field to simplifie the array manipulation.

 2) Add the missing field a quorum need in _virStorageSource and
 the VIR_STORAGE_TYPE_QUORUM and VIR_STORAGE_FILE_QUORUM in
 their respectives enums.

 3) Parse and format the xml
 Because a quorum allows to have more than one backing store at the same level
 we need to change virDomainDiskDefFormat and virDomainDiskDefParseXML
 to call virDomainDiskBackingStoreFormat and virDomainDiskBackingStoreParse
 in a loop.
 virDomainDiskBackingStoreFormat and virDomainDiskBackingStoreParse can
 call themself recursively in a loop because a quorum can contain another
 quorum

 4) Add nodename
 We need to add nodename support in _virStorageSource because qemu
 use them for their child.

 5) Build qemu string
 As for the xml, we have to call the function which create quorum recursively.
 But this task have the problem explained here:
 http://www.redhat.com/archives/libvir-list/2014-October/msg00529.html
 The _virStorageSource missing some informations that can be passed to
 a child, and therefore this version of quorum is incomplet.

 6) Allow to hotplug/change a disk in a quorum
 This part is not present in these patches because for this task
 we have to use blockdev-add, and currently libvirt use
 device_add for hotpluging that doesn't allow to hotplug quorum childs.

 There is 3 way to handle this problem:
   1) create a virDomainBlockDevAdd function in libvirt witch call
   blockdev-add.

   2) use blockdev-add instead of device_add in qemuMonitorJSONAddDevice

   3) write a hack which uses blockdev-add when only attaching quorum
   (but i'm pretty sure this solution is not the good one)

 Matthias Gatto (9):
   virstoragefile: Add virStorageSourceGetBackingStore
   virstoragefile: Always use virStorageSourceGetBackingStore to get
 backing store
   virstoragefile: Add virStorageSourceSetBackingStore
   virstoragefile: Always use virStorageSourceSetBackingStore to set
 backing store
   virstoragefile: Treat backingStore as a pointer or an array
   virstoragefile: Add quorum in virstoragefile
   domain_conf: Read and Write quorum config
   qemu: Add quorum support in qemuBuildDriveDevStr
   virstoragefile: Add node-name

  src/conf/domain_conf.c| 193 
 ++
  src/conf/storage_conf.c   |   7 +-
  src/libvirt_private.syms  |   3 +
  src/qemu/qemu_cgroup.c|   4 +-
  src/qemu/qemu_command.c   | 114 
  src/qemu/qemu_domain.c|   3 +-
  src/qemu/qemu_driver.c|  20 ++--
  src/security/security_dac.c   |   2 +-
  src/security/security_selinux.c   |   4 +-
  src/security/virt-aa-helper.c |   2 +-
  src/storage/storage_backend.c |  12 +--
  src/storage/storage_backend_fs.c  |  12 +--
  src/storage/storage_backend_logical.c |   4 +-
  src/storage/storage_driver.c  |   2 +-
  src/util/virstoragefile.c | 136 +---
  src/util/virstoragefile.h |  12 +++
  tests/virstoragetest.c|  18 ++--
  17 files changed, 445 insertions(+), 103 deletions(-)

 --
 1.8.3.1


 ping
ping

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


Re: [libvirt] libvirt memory usage statistics

2015-01-05 Thread Michal Privoznik

On 30.12.2014 16:46, Narayanan, Krishnaprasad wrote:

Hello all,

I am using libvirt version 1.1.1 on one of the nodes which has several
VMs. When I used virsh dommemstat domain UUID, I am getting the
following flags: actual, swap_in and rss. I am not able to get the
unused memory that is associated with the virtual machine.


That's something you need to compute. Given how much memory have you 
assigned to a domain under memory/ minus 'actual' is the memory that 
domain can qemu allocate eventually.


Michal

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


Re: [libvirt] [PATCH 05/12] libvirt_private: add 4 new func in libvirt_private.syms

2015-01-05 Thread Peter Krempa
On 01/03/15 06:06, Luyao Huang wrote:
 Signed-off-by: Luyao Huang lhu...@redhat.com
 ---
  src/libvirt_private.syms | 5 +
  1 file changed, 5 insertions(+)
 
 diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
 index aa776b4..deab4cf 100644
 --- a/src/libvirt_private.syms
 +++ b/src/libvirt_private.syms
 @@ -375,7 +375,12 @@ virDomainPMSuspendedReasonTypeToString;
  virDomainRedirdevBusTypeFromString;
  virDomainRedirdevBusTypeToString;
  virDomainRNGBackendTypeToString;
 +virDomainRNGDefFree;
 +virDomainRNGEquals;
 +virDomainRNGFind;
 +virDomainRNGInsert;
  virDomainRNGModelTypeToString;
 +virDomainRNGRemove;
  virDomainRunningReasonTypeFromString;
  virDomainRunningReasonTypeToString;
  virDomainSaveConfig;
 

These should be in the patches that add the individual functions.

Peter



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 06/12] qemu: add id when build RNG device and rename object id

2015-01-05 Thread Peter Krempa
On 01/03/15 06:06, Luyao Huang wrote:
 We didn't set a id when we build RNG device cmdline before.
 Give a id to every RNG device and we can hotunplug it via
 QMP cmd device_del.
 
 Signed-off-by: Luyao Huang lhu...@redhat.com
 ---
  src/qemu/qemu_command.c | 12 ++--
  1 file changed, 6 insertions(+), 6 deletions(-)
 
 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
 index 46e289d..a4073ee 100644
 --- a/src/qemu/qemu_command.c
 +++ b/src/qemu/qemu_command.c
 @@ -5761,7 +5761,7 @@ qemuBuildRNGBackendArgs(virCommandPtr cmd,
  goto cleanup;
  }
  
 -virBufferAsprintf(buf, rng-random,id=%s,filename=%s,
 +virBufferAsprintf(buf, rng-random,id=obj%s,filename=%s,
dev-info.alias, dev-source.file);
  
  virCommandAddArg(cmd, -object);
 @@ -5784,7 +5784,7 @@ qemuBuildRNGBackendArgs(virCommandPtr cmd,
  virCommandAddArgList(cmd, -chardev, backend, NULL);
  
  virCommandAddArg(cmd, -object);
 -virCommandAddArgFormat(cmd, rng-egd,chardev=char%s,id=%s,
 +virCommandAddArgFormat(cmd, rng-egd,chardev=char%s,id=obj%s,
 dev-info.alias, dev-info.alias);
  break;
  
 @@ -5816,13 +5816,13 @@ qemuBuildRNGDevStr(virDomainDefPtr def,
  }
  
  if (dev-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)
 -virBufferAsprintf(buf, virtio-rng-ccw,rng=%s, dev-info.alias);
 +virBufferAsprintf(buf, virtio-rng-ccw,rng=obj%s,id=%s, 
 dev-info.alias, dev-info.alias);
  else if (dev-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390)
 -virBufferAsprintf(buf, virtio-rng-s390,rng=%s, dev-info.alias);
 +virBufferAsprintf(buf, virtio-rng-s390,rng=obj%s,id=%s, 
 dev-info.alias, dev-info.alias);
  else if (dev-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO)
 -virBufferAsprintf(buf, virtio-rng-device,rng=%s, dev-info.alias);
 +virBufferAsprintf(buf, virtio-rng-device,rng=obj%s,id=%s, 
 dev-info.alias, dev-info.alias);
  else
 -virBufferAsprintf(buf, virtio-rng-pci,rng=%s, dev-info.alias);
 +virBufferAsprintf(buf, virtio-rng-pci,rng=obj%s,id=%s, 
 dev-info.alias, dev-info.alias);
  
  if (dev-rate  0) {
  virBufferAsprintf(buf, ,max-bytes=%u, dev-rate);
 


This breaks the testsuite as you didn't fix the expected outputs after
such a change. Please always run make check before posting patches.

Additional question. Is this change even necessary? The RNG device does
have it's alias already whithout the obj prefix ... thus it's just
rng0 for example.

NACK unless you have a good reason for the change.

Peter



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 04/12] conf: introduce 3 functions for RNG device

2015-01-05 Thread Peter Krempa
The subject is vague. Please try to condense what the patch is adding in
a way that describes the functions instead of an opaque add 3 functions


On 01/03/15 06:06, Luyao Huang wrote:
 the 3 functions are:
 virDomainRNGInsert: Insert a RNG device to vm-def.
 virDomainRNGRemove: remove a RNG device in vm-def.
 virDomainRNGFind: find a RNG device in vm-def.
 
 Signed-off-by: Luyao Huang lhu...@redhat.com
 ---
  src/conf/domain_conf.c | 44 
  src/conf/domain_conf.h |  9 +
  2 files changed, 53 insertions(+)
 
 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
 index 91c114e..37c4569 100644
 --- a/src/conf/domain_conf.c
 +++ b/src/conf/domain_conf.c
 @@ -11956,6 +11956,50 @@ virDomainRNGEquals(virDomainRNGDefPtr src,
  return false;
  }
  
 +int
 +virDomainRNGInsert(virDomainDefPtr vmdef,
 +   virDomainRNGDefPtr rng)
 +{
 +return VIR_APPEND_ELEMENT(vmdef-rngs, vmdef-nrngs, rng);
 +}
 +
 +virDomainRNGDefPtr
 +virDomainRNGRemove(virDomainDefPtr vmdef,
 +   virDomainRNGDefPtr rng)
 +{
 +virDomainRNGDefPtr ret;
 +size_t i;
 +
 +for (i = 0; i  vmdef-nrngs; i++) {
 +ret = vmdef-rngs[i];
 +
 +if (virDomainRNGEquals(ret, rng))

If you add a block here and move the VIR_DELETE_ELEMENT line here.

 +break;

And return ret instead of breaking here.

 +}

Then you can return NULL here and get rid of the rest.

The resulting code will be more readable.

 +
 +if (i == vmdef-nrngs)
 +return NULL;
 +
 +VIR_DELETE_ELEMENT(vmdef-rngs, i, vmdef-nrngs);
 +return ret;
 +}
 +
 +virDomainRNGDefPtr
 +virDomainRNGFind(virDomainDefPtr vmdef,
 + virDomainRNGDefPtr rng)
 +{
 +virDomainRNGDefPtr ret;
 +size_t i;
 +
 +for (i = 0; i  vmdef-nrngs; i++) {
 +ret = vmdef-rngs[i];
 +
 +if (virDomainRNGEquals(ret, rng))
 +return ret;
 +}
 +return NULL;
 +}
 +
  char *
  virDomainDefGetDefaultEmulator(virDomainDefPtr def,
 virCapsPtr caps)
 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
 index c197095..cb87fad 100644
 --- a/src/conf/domain_conf.h
 +++ b/src/conf/domain_conf.h
 @@ -2600,6 +2600,15 @@ virDomainChrRemove(virDomainDefPtr vmdef,
  bool
  virDomainRNGEquals(virDomainRNGDefPtr src,
 virDomainRNGDefPtr tgt);
 +int
 +virDomainRNGInsert(virDomainDefPtr vmdef,
 +   virDomainRNGDefPtr rng);

In header files we usually put the return type on the same line as the
declaration.

 +virDomainRNGDefPtr
 +virDomainRNGRemove(virDomainDefPtr vmdef,
 +   virDomainRNGDefPtr rng);
 +virDomainRNGDefPtr
 +virDomainRNGFind(virDomainDefPtr vmdef,
 + virDomainRNGDefPtr rng);
  
  int virDomainSaveXML(const char *configDir,
   virDomainDefPtr def,

Like here.

 

Peter



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 03/12] conf: introduce a new func virDomainRNGEquals

2015-01-05 Thread Peter Krempa
Subject: ... How about

conf: Introduce function to compare RNG devices.


On 01/03/15 06:06, Luyao Huang wrote:
 virDomainRNGEquals is a func which check if two rng device
 are the same.
 
 Signed-off-by: Luyao Huang lhu...@redhat.com
 ---
  src/conf/domain_conf.c | 34 ++
  src/conf/domain_conf.h |  3 +++
  2 files changed, 37 insertions(+)
 
 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
 index aafc05e..91c114e 100644
 --- a/src/conf/domain_conf.c
 +++ b/src/conf/domain_conf.c
 @@ -11922,6 +11922,40 @@ virDomainChrRemove(virDomainDefPtr vmdef,
  return ret;
  }
  
 +bool
 +virDomainRNGEquals(virDomainRNGDefPtr src,
 +   virDomainRNGDefPtr tgt)
 +{
 +if (!src || !tgt)
 +return src == tgt;
 +
 +if (src-model != tgt-model)
 +return false;
 +
 +if (src-rate != tgt-rate || src-period != tgt-period)
 +return false;
 +
 +switch ((virDomainRNGModel) src-model) {
 +case VIR_DOMAIN_RNG_MODEL_VIRTIO:
 +switch ((virDomainRNGBackend) src-backend) {
 +case VIR_DOMAIN_RNG_BACKEND_RANDOM:
 +return STREQ_NULLABLE(src-source.file, tgt-source.file);
 +break;
 +case VIR_DOMAIN_RNG_BACKEND_EGD:
 +return virDomainChrSourceDefIsEqual((virDomainChrSourceDef *) 
 src-source.chardev,
 +(virDomainChrSourceDef *) 
 tgt-source.chardev);

No need for typecast here; both src-source.chardev and tgt ... are
already in the required type.

 +break;
 +case VIR_DOMAIN_RNG_BACKEND_LAST:
 +break;
 +}
 +break;
 +
 +case VIR_DOMAIN_RNG_MODEL_LAST:
 +break;
 +}
 +return false;
 +}
 +
  char *
  virDomainDefGetDefaultEmulator(virDomainDefPtr def,
 virCapsPtr caps)
 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
 index 57297cd..c197095 100644
 --- a/src/conf/domain_conf.h
 +++ b/src/conf/domain_conf.h
 @@ -2597,6 +2597,9 @@ virDomainChrInsert(virDomainDefPtr vmdef,
  virDomainChrDefPtr
  virDomainChrRemove(virDomainDefPtr vmdef,
 virDomainChrDefPtr chr);
 +bool
 +virDomainRNGEquals(virDomainRNGDefPtr src,
 +   virDomainRNGDefPtr tgt);

As in the case below, please add the type to the same line as the
declaration.

  
  int virDomainSaveXML(const char *configDir,
   virDomainDefPtr def,
 

Peter



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

[libvirt] [PATCH] maint: fix date in local gnulib patch

2015-01-05 Thread Daniel P. Berrange
The local gnulib ssize_t.m4.diff patch no longer applied due to
changed context from the date change.
---
 gnulib/local/m4/ssize_t.m4.diff | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Pushed as another build breaker fix

diff --git a/gnulib/local/m4/ssize_t.m4.diff b/gnulib/local/m4/ssize_t.m4.diff
index 08c2b9c..12cff12 100644
--- a/gnulib/local/m4/ssize_t.m4.diff
+++ b/gnulib/local/m4/ssize_t.m4.diff
@@ -5,7 +5,7 @@ index 209d64c..5ea72a1 100644
 @@ -1,4 +1,4 @@
 -# ssize_t.m4 serial 5 (gettext-0.18.2)
 +# ssize_t.m4 serial 6 (gettext-0.18.2)
- dnl Copyright (C) 2001-2003, 2006, 2010-2014 Free Software Foundation, Inc.
+ dnl Copyright (C) 2001-2003, 2006, 2010-2015 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
 @@ -17,7 +17,21 @@ AC_DEFUN([gt_TYPE_SSIZE_T],
-- 
2.1.0

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


Re: [libvirt] [PATCH] maint: update to latest gnulib

2015-01-05 Thread Eric Blake
On 01/05/2015 09:06 AM, Daniel P. Berrange wrote:
 Sync to latest gnulib to get files updated with 2015 copyright
 date to fix syntax-check
 
 * .gnulib: update to latest
 * bootstrap: Regenerate from upstream
 
 Signed-off-by: Daniel P. Berrange berra...@redhat.com
 ---
  .gnulib   | 2 +-
  bootstrap | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
 
 Pushed as build-breaker fix for 'make syntax-check' year check

Except that gnulib still has a broken issue that prevents mingw builds
from working due to an incorrect PRIdMAX definition.  I'll be working on
that, then push yet another gnulib update to libvirt once gnulib is fixed.

We probably also ought to patch all our standalone executables (such as
virsh) to output 2015 in their --version output.

-- 
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] Query: Implementation of virNetworkGetDHCPLeases

2015-01-05 Thread Nehal J Wani
In the method networkGetDHCPLeases inside
./src/network/bridge_driver.c  , we have:

if (need_results  mac  !leases_ret) {
virReportError(VIR_ERR_INTERNAL_ERROR,
   _(no lease with matching MAC address: %s), mac);
goto error;
}

Is this really required? In my opinion, since we are already filling
rv with nleases (which will be 0, in case no lease corresponding to
given mac is found), user will know that there is no result for his
query. Why to report error?

This results in:

virsh # net-dhcp-leases --mac 00:50:56:c0:00:01  default
error: Failed to get leases info for default
error: internal error: no lease with matching MAC address: 00:50:56:c0:00:01


-- 
Nehal J Wani

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


Re: [libvirt] Query: Implementation of virNetworkGetDHCPLeases

2015-01-05 Thread Daniel P. Berrange
On Mon, Jan 05, 2015 at 10:42:01PM +0530, Nehal J Wani wrote:
 In the method networkGetDHCPLeases inside
 ./src/network/bridge_driver.c  , we have:
 
 if (need_results  mac  !leases_ret) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
_(no lease with matching MAC address: %s), mac);
 goto error;
 }
 
 Is this really required? In my opinion, since we are already filling
 rv with nleases (which will be 0, in case no lease corresponding to
 given mac is found), user will know that there is no result for his
 query. Why to report error?
 
 This results in:
 
 virsh # net-dhcp-leases --mac 00:50:56:c0:00:01  default
 error: Failed to get leases info for default
 error: internal error: no lease with matching MAC address: 00:50:56:c0:00:01

Yeah, that error raising seems sub-optional to me. The lack of a lease
for a MAC address is not an error - it is an normal expected scenario.

Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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


Re: [libvirt] [PATCHv5 02/18] virNetDevSetIPv4Address: libnl implementation

2015-01-05 Thread Daniel P. Berrange
On Tue, Dec 30, 2014 at 11:27:11AM +0100, Cédric Bosdonnat wrote:
 Add a default implementation of virNetDevSetIPv4Address using netlink
 and libnl. This avoids requiring /usr/sbin/ip or /usr/sbin/ifconfig
 external binaries.
 ---
  src/libvirt_private.syms |   1 +
  src/util/virnetdev.c | 136 
 +--
  src/util/virnetlink.c|  38 +
  src/util/virnetlink.h|   2 +
  4 files changed, 174 insertions(+), 3 deletions(-)

ACK


Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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

[libvirt] [PATCHv7 3/4] domifaddr: Implement the API for qemu

2015-01-05 Thread Nehal J Wani
By querying the qemu guest agent with the QMP command
guest-network-get-interfaces and converting the received JSON
output to structured objects.

Although ifconfig is deprecated, IP aliases created by ifconfig
are supported by this API. The legacy syntax of an IP alias is:
ifname:alias-name. Since we want all aliases to be clubbed
under parent interface, simply stripping :alias-name suffices.
Note that IP aliases formed by ip aren't visible to ifconfig,
and aliases created by ip do not have any specific name. But
we are lucky, as qemu guest agent detects aliases created by both.

src/qemu/qemu_agent.h:
  * Define qemuAgentGetInterfaces

src/qemu/qemu_agent.c:
  * Implement qemuAgentGetInterface

src/qemu/qemu_driver.c:
  * New function qemuGetDHCPInterfaces
  * New function qemuDomainInterfaceAddresses

src/remote_protocol-sructs:
  * Define new structs

tests/qemuagenttest.c:
  * Add new test: testQemuAgentGetInterfaces
Test cases for IP aliases, 0 or multiple ipv4/ipv6 address(es)

Signed-off-by: Nehal J Wani nehaljw.k...@gmail.com
---
 These are very minor changes, and rest of the patches in the series haven't
 been reviewed yet. Hence sending fix in the same version. :)
 src/qemu/qemu_agent.c  | 202 +
 src/qemu/qemu_agent.h  |   4 +
 src/qemu/qemu_driver.c | 159 ++
 tests/qemuagenttest.c  | 188 +
 4 files changed, 553 insertions(+)

diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 5fcc40f..e881cdc 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -1953,3 +1953,205 @@ qemuAgentGetFSInfo(qemuAgentPtr mon, virDomainFSInfoPtr 
**info,
 virJSONValueFree(reply);
 return ret;
 }
+
+/*
+ * qemuAgentGetInterfaces:
+ * @mon: Agent monitor
+ * @ifaces: pointer to an array of pointers pointing to interface objects
+ *
+ * Issue guest-network-get-interfaces to guest agent, which returns a
+ * list of interfaces of a running domain along with their IP and MAC
+ * addresses.
+ *
+ * Returns: number of interfaces on success, -1 on error.
+ */
+int
+qemuAgentGetInterfaces(qemuAgentPtr mon,
+   virDomainInterfacePtr **ifaces)
+{
+int ret = -1;
+size_t i, j;
+int size = -1;
+virJSONValuePtr cmd = NULL;
+virJSONValuePtr reply = NULL;
+virJSONValuePtr ret_array = NULL;
+size_t ifaces_count = 0;
+size_t addrs_count = 0;
+virDomainInterfacePtr *ifaces_ret = NULL;
+virHashTablePtr ifaces_store = NULL;
+char **ifname = NULL;
+
+/* Hash table to handle the interface alias */
+if (!(ifaces_store = virHashCreate(ifaces_count, NULL))) {
+virHashFree(ifaces_store);
+return -1;
+}
+
+if (!(cmd = qemuAgentMakeCommand(guest-network-get-interfaces, NULL)))
+goto cleanup;
+
+if (qemuAgentCommand(mon, cmd, reply, false, 
VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK)  0 ||
+qemuAgentCheckError(cmd, reply)  0) {
+goto cleanup;
+}
+
+if (!(ret_array = virJSONValueObjectGet(reply, return))) {
+virReportError(VIR_ERR_INTERNAL_ERROR, %s,
+   _(qemu agent didn't provide 'return' field));
+goto cleanup;
+}
+
+if ((size = virJSONValueArraySize(ret_array))  0) {
+virReportError(VIR_ERR_INTERNAL_ERROR, %s,
+   _(qemu agent didn't return an array of interfaces));
+goto cleanup;
+}
+
+for (i = 0; i  size; i++) {
+virJSONValuePtr tmp_iface = virJSONValueArrayGet(ret_array, i);
+virJSONValuePtr ip_addr_arr = NULL;
+const char *hwaddr, *ifname_s, *name = NULL;
+int ip_addr_arr_size;
+virDomainInterfacePtr iface = NULL;
+
+/* Shouldn't happen but doesn't hurt to check neither */
+if (!tmp_iface) {
+virReportError(VIR_ERR_INTERNAL_ERROR, %s,
+   _(something has went really wrong));
+goto error;
+}
+
+/* interface name is required to be presented */
+name = virJSONValueObjectGetString(tmp_iface, name);
+if (!name) {
+virReportError(VIR_ERR_INTERNAL_ERROR, %s,
+   _(qemu agent didn't provide 'name' field));
+goto error;
+}
+
+/* Handle interface alias (ifname:alias) */
+ifname = virStringSplit(name, :, 2);
+ifname_s = ifname[0];
+
+iface = virHashLookup(ifaces_store, ifname_s);
+
+/* If the hash table doesn't contain this iface, add it */
+if (!iface) {
+if (VIR_EXPAND_N(ifaces_ret, ifaces_count, 1)  0)
+goto error;
+
+if (VIR_ALLOC(ifaces_ret[ifaces_count - 1])  0)
+goto error;
+
+if (virHashAddEntry(ifaces_store, ifname_s,
+ifaces_ret[ifaces_count - 1])  0)
+goto error;
+
+iface = ifaces_ret[ifaces_count - 1];
+  

Re: [libvirt] [PATCHv5 04/18] virNetDevAddRoute: implementation using netlink

2015-01-05 Thread Daniel P. Berrange
On Tue, Dec 30, 2014 at 11:27:13AM +0100, Cédric Bosdonnat wrote:
 ---
  src/util/virnetdev.c | 105 
 +++
  1 file changed, 90 insertions(+), 15 deletions(-)

ACK

Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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

Re: [libvirt] [PATCHv5 03/18] Renamed virNetDevSetIPv4Address to virNetDevSetIPAddress

2015-01-05 Thread Daniel P. Berrange
On Tue, Dec 30, 2014 at 11:27:12AM +0100, Cédric Bosdonnat wrote:
 Renamed virNetDevSetIPv4Address as it also handles IPv6 addresses.
 ---
  src/libvirt_private.syms|  2 +-
  src/network/bridge_driver.c |  4 ++--
  src/util/virnetdev.c| 14 +++---
  src/util/virnetdev.h|  6 +++---
  4 files changed, 13 insertions(+), 13 deletions(-)

ACK


Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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

Re: [libvirt] [PATCH] Makefile: Fix parallel build after Xen-xl parser introduction

2015-01-05 Thread Daniel P. Berrange
On Mon, Jan 05, 2015 at 03:03:51PM +0100, Michal Privoznik wrote:
 Well, the parallel build doesn't work as there are not dependencies
 set correctly. When running 'make -j' I see this error:
 
 make[2]: Entering directory '/home/zippy/work/libvirt/libvirt.git/src'
   GEN  util/virkeymaps.h
   GEN  locking/lock_protocol.h
 make[2]: *** No rule to make target 'xenconfig/xen_xl_disk.h', needed by 
 'all'.  Stop.
 make[2]: *** Waiting for unfinished jobs
   GEN  lxc/lxc_controller_dispatch.h
 
 The fix is to correctly set dependencies by letting make know that .c
 and .h are to be generated from .l. Moreover, the section is moved
 closer to the other section which uses it.
 
 Signed-off-by: Michal Privoznik mpriv...@redhat.com
 ---
 
 I'm not fully satisfied with this patch yet. I mean, for some
 reason it creates 'src/.h' file, but hey - it makes parallel
 build work again. Any brighter idea appreciated.

[snip]

 +AM_LFLAGS = -Pxl_disk_ --header-file=../$*.h

I'm not convinced that '$*' is valid here - it probably expands to
the empty string which could explain your mysterious 'src/.h' file


Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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


Re: [libvirt] [PATCHv5 05/18] virNetDevClearIPv4Address: netlink implementation

2015-01-05 Thread Daniel P. Berrange
On Tue, Dec 30, 2014 at 11:27:14AM +0100, Cédric Bosdonnat wrote:
 ---
  src/util/virnetdev.c | 60 
 +++-
  1 file changed, 45 insertions(+), 15 deletions(-)

ACK


Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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

Re: [libvirt] [PATCHv5 06/18] Renamed virNetDevClearIPv4Address to virNetDevClearIPAddress

2015-01-05 Thread Daniel P. Berrange
On Tue, Dec 30, 2014 at 11:27:15AM +0100, Cédric Bosdonnat wrote:
 Make clear that virNetDevClearIPv4Address can also handle IPv6
 addresses by changing the name
 ---
  src/libvirt_private.syms |  2 +-
  src/util/virnetdev.c | 14 +++---
  src/util/virnetdev.h |  6 +++---
  3 files changed, 11 insertions(+), 11 deletions(-)

ACK


Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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

Re: [libvirt] [PATCHv5 01/18] Forgot to cleanup ifname_guest* in domain network def parsing

2015-01-05 Thread Daniel P. Berrange
On Tue, Dec 30, 2014 at 11:27:10AM +0100, Cédric Bosdonnat wrote:
 ---
  src/conf/domain_conf.c | 2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
 index aafc05e..914faf9 100644
 --- a/src/conf/domain_conf.c
 +++ b/src/conf/domain_conf.c
 @@ -7903,6 +7903,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
  VIR_FREE(vhostuser_path);
  VIR_FREE(vhostuser_mode);
  VIR_FREE(ifname);
 +VIR_FREE(ifname_guest);
 +VIR_FREE(ifname_guest_actual);
  VIR_FREE(dev);
  virDomainActualNetDefFree(actual);
  VIR_FREE(script);

ACK

Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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

Re: [libvirt] [PATCHv5 08/18] IP doc

2015-01-05 Thread Daniel P. Berrange
On Tue, Dec 30, 2014 at 11:27:17AM +0100, Cédric Bosdonnat wrote:
 ---
  docs/formatdomain.html.in | 11 ++-
  1 file changed, 6 insertions(+), 5 deletions(-)
 
 diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
 index 9261f24..a17cd8b 100644
 --- a/docs/formatdomain.html.in
 +++ b/docs/formatdomain.html.in
 @@ -4328,18 +4328,19 @@ qemu-kvm -net nic,model=? /dev/null
  lt;interface type='network'gt;
lt;source network='default'/gt;
lt;target dev='vnet0'/gt;
 -  blt;ip address='192.168.122.5' prefix='24'/gt;/b
 +  blt;ip family='ipv4' address='192.168.122.5' prefix='24'/gt;/b
  lt;/interfacegt;
lt;/devicesgt;
...
  /pre
  
  p
 -span class=sinceSince 1.2.10/span the network devices can be 
 provided
 -zero or more IP addresses to set
 +span class=sinceSince 1.2.12/span the network devices and host 
 devices
 +with network capabilities can be provided zero or more IP addresses to 
 set
  on the target device. Note that some hypervisors or network device types
 -will simply ignore them or only use the first one. The 
 codeaddress/code
 -attribute can hold either an IPv4 or IPv6 address. The 
 codeprefix/code
 +will simply ignore them or only use the first one. The 
 codefamily/code
 +attribute can be set to either codeipv4/code or codeipv6/code, 
 the
 +codeaddress/code attribute holds the IP address. The 
 codeprefix/code
  is not mandatory since some hypervisors do not handle it.
  /p

ACK, but this should be squashed into the previous patch before pushing
to GIT

Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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

Re: [libvirt] [PATCHv5 07/18] Domain conf: allow more than one IP address for net devices

2015-01-05 Thread Daniel P. Berrange
On Tue, Dec 30, 2014 at 11:27:16AM +0100, Cédric Bosdonnat wrote:
 Add the possibility to have more than one IP address configured for a
 domain network interface. IP addresses can also have a prefix to define
 the corresponding netmask.
 ---
  docs/formatdomain.html.in   |  22 
  docs/schemas/domaincommon.rng   |  16 ++-
  src/conf/domain_conf.c  | 149 
 
  src/conf/domain_conf.h  |  15 ++-
  src/libvirt_private.syms|   1 +
  src/openvz/openvz_conf.c|   2 +-
  src/openvz/openvz_driver.c  |   7 +-
  src/qemu/qemu_driver.c  |  26 -
  src/qemu/qemu_hotplug.c |   5 +-
  src/uml/uml_conf.c  |   2 +-
  src/vbox/vbox_common.c  |   6 +-
  src/xenconfig/xen_common.c  |  21 ++--
  src/xenconfig/xen_sxpr.c|  18 ++-
  tests/lxcxml2xmldata/lxc-idmap.xml  |   2 +
  tests/openvzutilstest.c |   2 +-
  tests/sexpr2xmldata/sexpr2xml-bridge-ipaddr.xml |   2 +-
  tests/sexpr2xmldata/sexpr2xml-net-routed.xml|   2 +-
  17 files changed, 239 insertions(+), 59 deletions(-)

ACK


Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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

Re: [libvirt] [PATCHv5 10/18] lxc conf2xml: convert IP addresses

2015-01-05 Thread Daniel P. Berrange
On Tue, Dec 30, 2014 at 11:27:19AM +0100, Cédric Bosdonnat wrote:
 ---
  src/lxc/lxc_native.c| 144 
 +++-
  tests/lxcconf2xmldata/lxcconf2xml-simple.config |   2 +
  tests/lxcconf2xmldata/lxcconf2xml-simple.xml|   2 +
  3 files changed, 97 insertions(+), 51 deletions(-)

ACK


Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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

Re: [libvirt] [PATCHv5 09/18] LXC: set IP addresses to veth devices in the container

2015-01-05 Thread Daniel P. Berrange
On Tue, Dec 30, 2014 at 11:27:18AM +0100, Cédric Bosdonnat wrote:
 Uses the new virDomainNetDef ips to set the IP addresses on the network
 interfaces in the container.
 ---
  src/lxc/lxc_container.c  | 20 +++-
  src/util/virsocketaddr.h |  2 ++
  2 files changed, 21 insertions(+), 1 deletion(-)

ACK

Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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

Re: [libvirt] [PATCHv5 12/18] lxc conf2xml: convert ip addresses for hostdev NICs

2015-01-05 Thread Daniel P. Berrange
On Tue, Dec 30, 2014 at 11:27:21AM +0100, Cédric Bosdonnat wrote:
 ---
  src/lxc/lxc_native.c | 3 +++
  tests/lxcconf2xmldata/lxcconf2xml-physnetwork.config | 2 ++
  tests/lxcconf2xmldata/lxcconf2xml-physnetwork.xml| 2 ++
  3 files changed, 7 insertions(+)

ACK


Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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

Re: [libvirt] [PATCHv5 11/18] Allow network capabilities hostdev to configure IP addresses

2015-01-05 Thread Daniel P. Berrange
On Tue, Dec 30, 2014 at 11:27:20AM +0100, Cédric Bosdonnat wrote:
 ---
  docs/formatdomain.html.in|  8 
  docs/schemas/domaincommon.rng| 28 
  src/conf/domain_conf.c   | 34 ++
  src/conf/domain_conf.h   |  2 ++
  tests/lxcxml2xmldata/lxc-hostdev.xml |  2 ++
  5 files changed, 70 insertions(+), 4 deletions(-)

ACK


Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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

Re: [libvirt] [PATCHv5 13/18] Domain network devices can now have a route element

2015-01-05 Thread Daniel P. Berrange
On Tue, Dec 30, 2014 at 11:27:22AM +0100, Cédric Bosdonnat wrote:
 Network interfaces devices and host devices with net capabilities can
 now have IPv4 and/or an IPv6 routes configured.
 ---
  docs/formatdomain.html.in|  19 -
  docs/schemas/domaincommon.rng|  31 
  src/conf/domain_conf.c   | 135 
 ++-
  src/conf/domain_conf.h   |  12 
  src/util/virnetdev.c |  31 +++-
  src/util/virnetdev.h |   2 +-
  src/util/virsocketaddr.h |   2 +
  tests/lxcxml2xmldata/lxc-hostdev.xml |   2 +
  tests/lxcxml2xmldata/lxc-idmap.xml   |   2 +
  9 files changed, 230 insertions(+), 6 deletions(-)

ACK


Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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

Re: [libvirt] [PATCHv5 14/18] lxc conf2xml: convert lxc.network.ipv[46].gateway

2015-01-05 Thread Daniel P. Berrange
On Tue, Dec 30, 2014 at 11:27:23AM +0100, Cédric Bosdonnat wrote:
 ---
  src/lxc/lxc_native.c   | 57 
 +-
  .../lxcconf2xmldata/lxcconf2xml-physnetwork.config |  2 +
  tests/lxcconf2xmldata/lxcconf2xml-physnetwork.xml  |  2 +
  tests/lxcconf2xmldata/lxcconf2xml-simple.config|  2 +
  tests/lxcconf2xmldata/lxcconf2xml-simple.xml   |  2 +
  5 files changed, 64 insertions(+), 1 deletion(-)

ACK


Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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

Re: [libvirt] [PATCHv5 17/18] Openvz --ipadd can be provided multiple times

2015-01-05 Thread Daniel P. Berrange
On Tue, Dec 30, 2014 at 11:27:26AM +0100, Cédric Bosdonnat wrote:
 Vzctl man page says that --ipadd can be provided multiple times to add
 several IP addresses. Looping over the configured ip addresses to add
 one --ipadd for each. This would even handle the multiple IPs handled
 by openvz_conf.c
 ---
  src/openvz/openvz_driver.c | 8 ++--
  1 file changed, 6 insertions(+), 2 deletions(-)

ACK


Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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

Re: [libvirt] [PATCHv5 16/18] LXC: honour network devices link state

2015-01-05 Thread Daniel P. Berrange
On Tue, Dec 30, 2014 at 11:27:25AM +0100, Cédric Bosdonnat wrote:
 Don't activate LXC network device if link state='down'/ has been set
 in its configuration.
 ---
  src/lxc/lxc_container.c | 46 --
  1 file changed, 24 insertions(+), 22 deletions(-)

ACK


Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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

Re: [libvirt] [PATCH] Makefile: Fix parallel build after Xen-xl parser introduction

2015-01-05 Thread Jim Fehlig
Michal Privoznik wrote:
 Well, the parallel build doesn't work as there are not dependencies
 set correctly. When running 'make -j' I see this error:

 make[2]: Entering directory '/home/zippy/work/libvirt/libvirt.git/src'
   GEN  util/virkeymaps.h
   GEN  locking/lock_protocol.h
 make[2]: *** No rule to make target 'xenconfig/xen_xl_disk.h', needed by 
 'all'.  Stop.
 make[2]: *** Waiting for unfinished jobs
   GEN  lxc/lxc_controller_dispatch.h

 The fix is to correctly set dependencies by letting make know that .c
 and .h are to be generated from .l. Moreover, the section is moved
 closer to the other section which uses it.

 Signed-off-by: Michal Privoznik mpriv...@redhat.com
 ---

 I'm not fully satisfied with this patch yet. I mean, for some
 reason it creates 'src/.h' file, but hey - it makes parallel
 build work again. Any brighter idea appreciated.
   

Interesting. I don't see the file using your patch. What version of
automake? I'm using the rather old 1.13.

  src/Makefile.am | 36 +++-
  1 file changed, 19 insertions(+), 17 deletions(-)

 diff --git a/src/Makefile.am b/src/Makefile.am
 index c6d736e..7619cf0 100644
 --- a/src/Makefile.am
 +++ b/src/Makefile.am
 @@ -1000,23 +1000,6 @@ CPU_SOURCES =  
 \
  VMX_SOURCES =\
   vmx/vmx.c vmx/vmx.h
  
 -AM_LFLAGS = -Pxl_disk_ --header-file=../$*.h
 -LEX_OUTPUT_ROOT = lex.xl_disk_
 -BUILT_SOURCES += xenconfig/xen_xl_disk.c xenconfig/xen_xl_disk.h
 -# Generated header file is not implicitly added to dist
 -EXTRA_DIST += xenconfig/xen_xl_disk.h
 -CLEANFILES += xenconfig/xen_xl_disk.h xenconfig/xen_xl_disk.c
 -
 -XENXLDISKPARSER_SOURCES = xenconfig/xen_xl_disk.l
 -
 -XENCONFIG_SOURCES =  \
 - xenconfig/xenxs_private.h   \
 - xenconfig/xen_common.c xenconfig/xen_common.h   \
 - xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h   \
 - xenconfig/xen_xm.c xenconfig/xen_xm.h   \
 - xenconfig/xen_xl.c xenconfig/xen_xl.h   \
 - xenconfig/xen_xl_disk.h
 -
  pkgdata_DATA =   cpu/cpu_map.xml
  
  EXTRA_DIST +=$(pkgdata_DATA)
 @@ -1078,6 +1061,25 @@ libvirt_xenxldiskparser_la_CFLAGS = \
  libvirt_xenxldiskparser_la_SOURCES = \
   $(XENXLDISKPARSER_SOURCES)
  
 +AM_LFLAGS = -Pxl_disk_ --header-file=../$*.h
 +XENXLDISKPARSER_GENERATED = xenconfig/xen_xl_disk.c xenconfig/xen_xl_disk.h
 +BUILT_SOURCES += $(XENXLDISKPARSER_GENERATED)
 +EXTRA_DIST += $(XENXLDISKPARSER_GENERATED)
 +MAINTAINERCLEANFILES += $(XENXLDISKPARSER_GENERATED)
 +
 +XENXLDISKPARSER_SOURCES = xenconfig/xen_xl_disk.l
 +
 +$(XENXLDISKPARSER_GENERATED): $(XENXLDISKPARSER_SOURCES)
 + $(SHELL) $(YLWRAP) $ lex.xl_disk_.c $@ -- $(LEXCOMPILE)
   

Answering Daniel's question about the expansion of AM_LFLAGS, on my
system the whole ylwrap invocation expands to

/bin/sh ../build-aux/ylwrap xenconfig/xen_xl_disk.l lex.xl_disk_.c
xenconfig/xen_xl_disk.c -- flex -Pxl_disk_
--header-file=../xenconfig/xen_xl_disk.h

Regards,
Jim

 +
 +XENCONFIG_SOURCES =  \
 + xenconfig/xenxs_private.h   \
 + xenconfig/xen_common.c xenconfig/xen_common.h   \
 + xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h   \
 + xenconfig/xen_xm.c xenconfig/xen_xm.h   \
 + xenconfig/xen_xl.c xenconfig/xen_xl.h   \
 + xenconfig/xen_xl_disk_i.h
 +
  noinst_LTLIBRARIES += libvirt_xenconfig.la
  libvirt_la_BUILT_LIBADD += libvirt_xenconfig.la
  libvirt_xenconfig_la_CFLAGS = \
   

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


Re: [libvirt] [PATCHv5 02/18] virNetDevSetIPv4Address: libnl implementation

2015-01-05 Thread Eric Blake
On 12/30/2014 03:27 AM, Cédric Bosdonnat wrote:
 Add a default implementation of virNetDevSetIPv4Address using netlink
 and libnl. This avoids requiring /usr/sbin/ip or /usr/sbin/ifconfig
 external binaries.
 ---
  src/libvirt_private.syms |   1 +
  src/util/virnetdev.c | 136 
 +--
  src/util/virnetlink.c|  38 +
  src/util/virnetlink.h|   2 +
  4 files changed, 174 insertions(+), 3 deletions(-)
 
 diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
 index aa776b4..65862ec 100644
 --- a/src/libvirt_private.syms
 +++ b/src/libvirt_private.syms
 @@ -1740,6 +1740,7 @@ virNetlinkEventServiceLocalPid;
  virNetlinkEventServiceStart;
  virNetlinkEventServiceStop;
  virNetlinkEventServiceStopAll;
 +virNetlinkGetErrorCode;
  virNetlinkShutdown;
  virNetlinkStartup;

This patch fails to build on mingw:

  CCLD libvirt.la
Cannot export virNetlinkGetErrorCode: symbol not defined
collect2: error: ld returned 1 exit status

-- 
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] virnetlink: fix build on non-Linux

2015-01-05 Thread Eric Blake
Commit 4dc04d3a added virNetlinkGetErrorCode, but forgot to provide
a fallback, which kills the build on mingw (among others):

  CCLD libvirt.la
  Cannot export virNetlinkGetErrorCode: symbol not defined
  collect2: error: ld returned 1 exit status

* src/util/virnetlink.c (virNetlinkGetErrorCode): Provide fallback.

Signed-off-by: Eric Blake ebl...@redhat.com
---

Pushing under the build-breaker rule.

 src/util/virnetlink.c | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
index 1a2b7a1..d52f66a 100644
--- a/src/util/virnetlink.c
+++ b/src/util/virnetlink.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2014 Red Hat, Inc.
+ * Copyright (C) 2010-2015 Red Hat, Inc.
  * Copyright (C) 2010-2012 IBM Corporation
  *
  * This library is free software; you can redistribute it and/or
@@ -276,7 +276,9 @@ int virNetlinkCommand(struct nl_msg *nl_msg,
 return ret;
 }

-int virNetlinkGetErrorCode(struct nlmsghdr *resp, unsigned int recvbuflen)
+
+int
+virNetlinkGetErrorCode(struct nlmsghdr *resp, unsigned int recvbuflen)
 {
 struct nlmsgerr *err;
 int result = 0;
@@ -314,6 +316,7 @@ int virNetlinkGetErrorCode(struct nlmsghdr *resp, unsigned 
int recvbuflen)
 return -EINVAL;
 }

+
 static void
 virNetlinkEventServerLock(virNetlinkEventSrvPrivatePtr driver)
 {
@@ -872,4 +875,13 @@ int virNetlinkEventRemoveClient(int watch ATTRIBUTE_UNUSED,
 return -1;
 }

+
+int
+virNetlinkGetErrorCode(struct nlmsghdr *resp ATTRIBUTE_UNUSED,
+   unsigned int recvbuflen ATTRIBUTE_UNUSED)
+{
+virReportError(VIR_ERR_INTERNAL_ERROR, %s, _(unsupported));
+return -EINVAL;
+}
+
 #endif /* __linux__ */
-- 
2.1.0

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


Re: [libvirt] [PATCH] Makefile: Fix parallel build after Xen-xl parser introduction

2015-01-05 Thread Eric Blake
On 01/05/2015 07:03 AM, Michal Privoznik wrote:
 Well, the parallel build doesn't work as there are not dependencies
 set correctly. When running 'make -j' I see this error:
 
 make[2]: Entering directory '/home/zippy/work/libvirt/libvirt.git/src'
   GEN  util/virkeymaps.h
   GEN  locking/lock_protocol.h
 make[2]: *** No rule to make target 'xenconfig/xen_xl_disk.h', needed by 
 'all'.  Stop.
 make[2]: *** Waiting for unfinished jobs
   GEN  lxc/lxc_controller_dispatch.h
 
 The fix is to correctly set dependencies by letting make know that .c
 and .h are to be generated from .l. Moreover, the section is moved
 closer to the other section which uses it.

Have you also tested VPATH builds?  With an in-tree build, I reproduced
your failure with 'make -j3', then the failure went away with plain
'make'; but in a VPATH build, even plain 'make' is still failing without
your patch:

make[5]: Entering directory '/home/eblake/libvirt-tmp/build4/src'
  CC   xenconfig/libvirt_xenconfig_la-xen_xl.lo
../../src/xenconfig/xen_xl.c:29:25: fatal error: xen_xl_disk.h: No such
file or directory
 #include xen_xl_disk.h
 ^
compilation terminated.
Makefile:9450: recipe for target
'xenconfig/libvirt_xenconfig_la-xen_xl.lo' failed

which means I'm not even sure if we are being careful about the
distinction between srcdir and builddir.

I haven't looked closely at your proposed patch yet, but it's on my list
now.

-- 
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] qemu: use a wrong name for guest panic status

2015-01-05 Thread Eric Blake
On 01/05/2015 02:09 AM, Luyao Huang wrote:
 https://bugzilla.redhat.com/show_bug.cgi?id=1178652
 
 We will get a warning when we have a guest in paused
 status(casue by kernel panic) and restart libvirtd,

s/status(casue/status (caused/

 warning message like this:
 
 Qemu reported unknown VM status: 'guest-panicked'
 
 and this seems because we set a wrong status name in
 qemu_monitor.c, and from qemu qapi-schema.json file
 we know this status should named 'guest-panicked'.
 
 Signed-off-by: Luyao Huang lhu...@redhat.com
 ---
  src/qemu/qemu_monitor.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

ACK and pushed.

-- 
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 RFC] LXC: don't RO mount /proc, /sys when user namespce enabled

2015-01-05 Thread Chen, Hanxiao


 -Original Message-
 From: libvir-list-boun...@redhat.com [mailto:libvir-list-boun...@redhat.com] 
 On
 Behalf Of Chen Hanxiao
 Sent: Monday, December 22, 2014 11:57 AM
 To: libvir-list@redhat.com
 Subject: [libvirt] [PATCH RFC] LXC: don't RO mount /proc, /sys when user 
 namespce
 enabled
 
 If we enabled user ns and provided a uid/gid map,
 we do not need to mount /proc, /sys as readonly.
 Leave it to kernel for protection.
 
 Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com
 ---

ping

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


[libvirt] [PATCH] maint: update to latest gnulib

2015-01-05 Thread Eric Blake
Another update is required to pick up today's gnulib fix for mingw
builds (now that gnulib turns on mingw's replacement printf that
understands %lld, it must also tell the compiler to respect the
improved definition of PRIdMAX and friends).

* .gnulib: Update to latest.

Signed-off-by: Eric Blake ebl...@redhat.com
---

Pushing under the build-breaker rule.

* .gnulib 498a1b6...c27f1a3 (3):
   doc: update INSTALL from autoconf
   stdio: fix use of PRIdMAX on modern mingw
   Fix check for pthreads.h pollution on Mingw64

 .gnulib | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gnulib b/.gnulib
index 498a1b6..c27f1a3 16
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 498a1b6bc7d70f944ca0f939e1bc470889fdce76
+Subproject commit c27f1a356f2f321daa7f971ef276a1dbfa873bf8
-- 
2.1.0

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


Re: [libvirt] [PATCH] networkGetDHCPLeases: Remove unnecessary error reporting

2015-01-05 Thread Eric Blake
On 01/05/2015 12:16 PM, John Ferlan wrote:
 
 
 On 01/05/2015 12:49 PM, Nehal J Wani wrote:
 Lack of a lease (whether mac is given or not) is a normal expected scenario.
 There is no need to raise an error.

 Signed-off-by: Nehal J Wani nehaljw.k...@gmail.com
 ---
  src/network/bridge_driver.c | 6 --
  1 file changed, 6 deletions(-)

 
 
 Since it was introduced by your own commit id 'ba5139821' and a recent
 query here had Dan's blessing:
 
 http://www.redhat.com/archives/libvir-list/2015-January/msg00055.html
 
 
 ACK - although perhaps it would be nice to put the information from the
 above linked query in the commit message in order to at least provide a
 bit more context as to why it's being removed.  I'd say cut-n-paste the
 text after In my opinion

I tweaked the commit message and pushed.

-- 
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 12/12] qemu: Implement RNG device hotunplug on live level

2015-01-05 Thread lhuang


On 01/05/2015 11:54 PM, Peter Krempa wrote:

On 01/03/15 06:06, Luyao Huang wrote:

We have enough patches for hotunplug RNG device, maybe we can
implement live hotunplug of a RNG device.

Signed-off-by: Luyao Huang lhu...@redhat.com
---
  src/qemu/qemu_driver.c  |  4 +-
  src/qemu/qemu_hotplug.c | 97 -
  src/qemu/qemu_hotplug.h |  4 +-
  3 files changed, 102 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2ad6e01..f7600f3 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7017,6 +7017,9 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm,
  case VIR_DOMAIN_DEVICE_CHR:
  ret = qemuDomainDetachChrDevice(driver, vm, dev-data.chr);
  break;
+case VIR_DOMAIN_DEVICE_RNG:
+ret = qemuDomainDetachRNGDevice(driver, vm, dev-data.rng);
+break;
  case VIR_DOMAIN_DEVICE_FS:
  case VIR_DOMAIN_DEVICE_INPUT:
  case VIR_DOMAIN_DEVICE_SOUND:
@@ -7027,7 +7030,6 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm,
  case VIR_DOMAIN_DEVICE_SMARTCARD:
  case VIR_DOMAIN_DEVICE_MEMBALLOON:
  case VIR_DOMAIN_DEVICE_NVRAM:
-case VIR_DOMAIN_DEVICE_RNG:
  case VIR_DOMAIN_DEVICE_SHMEM:
  case VIR_DOMAIN_DEVICE_REDIRDEV:
  case VIR_DOMAIN_DEVICE_NONE:
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 7f1e612..d61e2a1 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2921,6 +2921,52 @@ qemuDomainRemoveChrDevice(virQEMUDriverPtr driver,
  return ret;
  }
  
+static int

+qemuDomainRemoveRNGDevice(virQEMUDriverPtr driver,
+  virDomainObjPtr vm,
+  virDomainRNGDefPtr rng)
+{
+virObjectEventPtr event;
+char *charAlias = NULL;
+char *objAlias = NULL;
+qemuDomainObjPrivatePtr priv = vm-privateData;
+int ret = -1;
+int rc;
+
+VIR_DEBUG(Removing RNG device %s from domain %p %s,
+  rng-info.alias, vm, vm-def-name);
+
+if (virAsprintf(objAlias, obj%s, rng-info.alias)  0)
+goto cleanup;
+
+if (virAsprintf(charAlias, char%s, rng-info.alias)  0)
+goto cleanup;
+
+qemuDomainObjEnterMonitor(driver, vm);
+rc = qemuMonitorDetachRNGDev(priv-mon, objAlias);
+if (rc == 0  rng-backend == VIR_DOMAIN_RNG_BACKEND_EGD)
+ignore_value(qemuMonitorDetachCharDev(priv-mon, charAlias));
+qemuDomainObjExitMonitor(driver, vm);
+
+virDomainAuditRNG(vm, rng, NULL, detach, rc == 0);
+
+if (rc  0)
+goto cleanup;
+
+event = virDomainEventDeviceRemovedNewFromObj(vm, rng-info.alias);
+if (event)
+qemuDomainEventQueue(driver, event);
+
+qemuDomainRNGRemove(vm-def, rng);
+qemuDomainReleaseDeviceAddress(vm, rng-info, NULL);
+virDomainRNGDefFree(rng);
+ret = 0;
+
+ cleanup:
+VIR_FREE(charAlias);
+VIR_FREE(objAlias);
+return ret;
+}
  
  void

  qemuDomainRemoveDevice(virQEMUDriverPtr driver,
@@ -2944,6 +2990,9 @@ qemuDomainRemoveDevice(virQEMUDriverPtr driver,
  case VIR_DOMAIN_DEVICE_CHR:
  qemuDomainRemoveChrDevice(driver, vm, dev-data.chr);
  break;
+case VIR_DOMAIN_DEVICE_RNG:
+qemuDomainRemoveRNGDevice(driver, vm, dev-data.rng);
+break;
  
  case VIR_DOMAIN_DEVICE_NONE:

  case VIR_DOMAIN_DEVICE_LEASE:
@@ -2958,7 +3007,6 @@ qemuDomainRemoveDevice(virQEMUDriverPtr driver,
  case VIR_DOMAIN_DEVICE_SMARTCARD:
  case VIR_DOMAIN_DEVICE_MEMBALLOON:
  case VIR_DOMAIN_DEVICE_NVRAM:
-case VIR_DOMAIN_DEVICE_RNG:
  case VIR_DOMAIN_DEVICE_SHMEM:
  case VIR_DOMAIN_DEVICE_TPM:
  case VIR_DOMAIN_DEVICE_PANIC:
@@ -3830,3 +3878,50 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver,
  VIR_FREE(devstr);
  return ret;
  }
+
+int qemuDomainDetachRNGDevice(virQEMUDriverPtr driver,
+  virDomainObjPtr vm,
+  virDomainRNGDefPtr rng)
+{
+int ret = -1;
+qemuDomainObjPrivatePtr priv = vm-privateData;
+virDomainDefPtr vmdef = vm-def;
+virDomainRNGDefPtr tmpRNG;
+int rc;
+
+if (!(tmpRNG = virDomainRNGFind(vmdef, rng))) {
+virReportError(VIR_ERR_OPERATION_INVALID, %s,
+   _(device not present in domain configuration));
+return ret;
+}
+
+if (!virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_DEVICE)) {
+virReportError(VIR_ERR_OPERATION_INVALID, %s,
+   _(qemu does not support -device));
+return ret;
+}
+
+if (!tmpRNG-info.alias  qemuAssignDeviceRNGAlias(vmdef, tmpRNG, -1)  0)
+return ret;
+
+sa_assert(tmpRNG-info.alias);

Did coverity complain here?

I guess it will, this place just like the scene in commit e7e05801.
but i am not sure (i don't use coverity because the resource is very 
limit),

maybe we can remove it first, then wait for coverity test result.

+
+qemuDomainMarkDeviceForRemoval(vm, tmpRNG-info);
+
+

Re: [libvirt] [PATCHv5 15/18] LXC: use the new net devices routes definition

2015-01-05 Thread Daniel P. Berrange
On Tue, Dec 30, 2014 at 11:27:24AM +0100, Cédric Bosdonnat wrote:
 Actually set routes in lxc containers if there are defined ones.
 ---
  src/lxc/lxc_container.c | 26 ++
  1 file changed, 26 insertions(+)

ACK

Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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

[libvirt] [PATCH] networkGetDHCPLeases: Remove unnecessary error reporting

2015-01-05 Thread Nehal J Wani
Lack of a lease (whether mac is given or not) is a normal expected scenario.
There is no need to raise an error.

Signed-off-by: Nehal J Wani nehaljw.k...@gmail.com
---
 src/network/bridge_driver.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 29222d0..6a49a23 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3654,12 +3654,6 @@ networkGetDHCPLeases(virNetworkPtr network,
 VIR_FREE(lease);
 }
 
-if (need_results  mac  !leases_ret) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(no lease with matching MAC address: %s), mac);
-goto error;
-}
-
 if (leases_ret) {
 /* NULL terminated array */
 ignore_value(VIR_REALLOC_N(leases_ret, nleases + 1));
-- 
2.1.0

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


Re: [libvirt] [PATCHv5 18/18] Report error if a driver can't handle multiple IP addresses

2015-01-05 Thread Daniel P. Berrange
On Tue, Dec 30, 2014 at 11:27:27AM +0100, Cédric Bosdonnat wrote:
 Drivers supporting one and only one IP address raise an error if more IP
 addresses are configured.
 ---
  src/vbox/vbox_common.c | 12 +---
  src/xenconfig/xen_common.c | 12 ++--
  src/xenconfig/xen_sxpr.c   | 12 ++--
  3 files changed, 29 insertions(+), 7 deletions(-)

ACK

Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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

Re: [libvirt] [PATCH] networkGetDHCPLeases: Remove unnecessary error reporting

2015-01-05 Thread John Ferlan


On 01/05/2015 12:49 PM, Nehal J Wani wrote:
 Lack of a lease (whether mac is given or not) is a normal expected scenario.
 There is no need to raise an error.
 
 Signed-off-by: Nehal J Wani nehaljw.k...@gmail.com
 ---
  src/network/bridge_driver.c | 6 --
  1 file changed, 6 deletions(-)
 


Since it was introduced by your own commit id 'ba5139821' and a recent
query here had Dan's blessing:

http://www.redhat.com/archives/libvir-list/2015-January/msg00055.html


ACK - although perhaps it would be nice to put the information from the
above linked query in the commit message in order to at least provide a
bit more context as to why it's being removed.  I'd say cut-n-paste the
text after In my opinion

John

 diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
 index 29222d0..6a49a23 100644
 --- a/src/network/bridge_driver.c
 +++ b/src/network/bridge_driver.c
 @@ -3654,12 +3654,6 @@ networkGetDHCPLeases(virNetworkPtr network,
  VIR_FREE(lease);
  }
  
 -if (need_results  mac  !leases_ret) {
 -virReportError(VIR_ERR_INTERNAL_ERROR,
 -   _(no lease with matching MAC address: %s), mac);
 -goto error;
 -}
 -
  if (leases_ret) {
  /* NULL terminated array */
  ignore_value(VIR_REALLOC_N(leases_ret, nleases + 1));
 

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


Re: [libvirt] [PATCH 0/2] Misc fixes

2015-01-05 Thread Cedric Bosdonnat
Hi Jan,

Thanks for your review. Pushed.

--
Cedric

On Mon, 2015-01-05 at 10:37 +0100, Ján Tomko wrote:
 On 12/30/2014 11:33 AM, Cédric Bosdonnat wrote:
  Hi there,
  
  Here are 2 patches fixing tiny annoying problems. One of them, makes
  apparmor profiles handle /usr/lib64 folder and the other one fixes an
  uncleaned piece of domain config.
  
  Cédric Bosdonnat (2):
Teach AppArmor, that /usr/lib64 may exist.
Fix error when starting a container after an error
  
   examples/apparmor/libvirt-qemu   | 2 +-
   examples/apparmor/usr.lib.libvirt.virt-aa-helper | 4 ++--
   examples/apparmor/usr.sbin.libvirtd  | 4 ++--
   src/lxc/lxc_process.c| 1 +
   4 files changed, 6 insertions(+), 5 deletions(-)
  
 
 ACK series
 
 Jan
 


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

Re: [libvirt] [PATCHv5 01/18] Forgot to cleanup ifname_guest* in domain network def parsing

2015-01-05 Thread Cedric Bosdonnat
Hi Daniel,

Thanks a lot for your reviews. I just pushed the patch series with the
IP Doc commit squashed.

--
Cedric

On Mon, 2015-01-05 at 17:26 +, Daniel P. Berrange wrote:
 On Tue, Dec 30, 2014 at 11:27:10AM +0100, Cédric Bosdonnat wrote:
  ---
   src/conf/domain_conf.c | 2 ++
   1 file changed, 2 insertions(+)
  
  diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
  index aafc05e..914faf9 100644
  --- a/src/conf/domain_conf.c
  +++ b/src/conf/domain_conf.c
  @@ -7903,6 +7903,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
   VIR_FREE(vhostuser_path);
   VIR_FREE(vhostuser_mode);
   VIR_FREE(ifname);
  +VIR_FREE(ifname_guest);
  +VIR_FREE(ifname_guest_actual);
   VIR_FREE(dev);
   virDomainActualNetDefFree(actual);
   VIR_FREE(script);
 
 ACK
 
 Regards,
 Daniel


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

Re: [libvirt] [PATCH 02/12] qemu: rename qemuBuildRNGDeviceArgs to qemuBuildRNGDevStr and change something

2015-01-05 Thread Peter Krempa
Subject: change something? That's a really vague statement.

How about:

qemu: refactor qemuBuildRNGDeviceArgs to allow reuse in RNG hotplug

On 01/03/15 06:06, Luyao Huang wrote:
 rename qemuBuildRNGDeviceArgs to qemuBuildRNGDevStr, we need this function
 to build a cmdline.

Rename qemuBuildRNGDeviceArgs to qemuBuildRNGDevStr and change the
return type so that it can be reused in the device hotplug code later.


 
 Signed-off-by: Luyao Huang lhu...@redhat.com
 ---
  src/qemu/qemu_command.c | 33 -
  src/qemu/qemu_command.h |  4 
  2 files changed, 20 insertions(+), 17 deletions(-)
 
 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
 index c1e9bca..46e289d 100644
 --- a/src/qemu/qemu_command.c
 +++ b/src/qemu/qemu_command.c
 @@ -5800,22 +5800,19 @@ qemuBuildRNGBackendArgs(virCommandPtr cmd,
  return ret;
  }
  
 -

Don't delete the line. Functions are usually separated by two newlines.

 -static int
 -qemuBuildRNGDeviceArgs(virCommandPtr cmd,
 -   virDomainDefPtr def,
 -   virDomainRNGDefPtr dev,
 -   virQEMUCapsPtr qemuCaps)
 +char *
 +qemuBuildRNGDevStr(virDomainDefPtr def,
 +   virDomainRNGDefPtr dev,
 +   virQEMUCapsPtr qemuCaps)
  {
  virBuffer buf = VIR_BUFFER_INITIALIZER;
 -int ret = -1;
  
  if (dev-model != VIR_DOMAIN_RNG_MODEL_VIRTIO ||
  !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG)) {
  virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
 _(this qemu doesn't support RNG device type '%s'),
 virDomainRNGModelTypeToString(dev-model));
 -goto cleanup;
 +goto error;
  }
  
  if (dev-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)

ACK, looks good except for the commit message and the spurious line
deletion.

Peter




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 1/2] Teach AppArmor, that /usr/lib64 may exist.

2015-01-05 Thread Eric Blake
On 12/30/2014 03:33 AM, Cédric Bosdonnat wrote:

s/,// in the subject
Also, we tend to avoid trailing '.' in commit summary lines, although
that is not strictly enforced

 The apparmor profiles forgot about /usr/lib64 folders, just add lib64
 as a possible alternative to lib in the paths
 ---
  examples/apparmor/libvirt-qemu   | 2 +-
  examples/apparmor/usr.lib.libvirt.virt-aa-helper | 4 ++--
  examples/apparmor/usr.sbin.libvirtd  | 4 ++--
  3 files changed, 5 insertions(+), 5 deletions(-)

ACK

-- 
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 10/12] audit: make function virDomainAuditRNG global

2015-01-05 Thread Peter Krempa
In subject:

audit: export virDomainAuditRNG

On 01/03/15 06:06, Luyao Huang wrote:
 Signed-off-by: Luyao Huang lhu...@redhat.com
 ---
  src/conf/domain_audit.c  | 2 +-
  src/conf/domain_audit.h  | 7 +++
  src/libvirt_private.syms | 1 +
  3 files changed, 9 insertions(+), 1 deletion(-)
 

ACK,

Peter




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

[libvirt] [PATCH] maint: update to latest gnulib

2015-01-05 Thread Daniel P. Berrange
Sync to latest gnulib to get files updated with 2015 copyright
date to fix syntax-check

* .gnulib: update to latest
* bootstrap: Regenerate from upstream

Signed-off-by: Daniel P. Berrange berra...@redhat.com
---
 .gnulib   | 2 +-
 bootstrap | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Pushed as build-breaker fix for 'make syntax-check' year check

diff --git a/.gnulib b/.gnulib
index 3914f31..498a1b6 16
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 3914f3153576e9a5ba4002bde27de05211b5a79c
+Subproject commit 498a1b6bc7d70f944ca0f939e1bc470889fdce76
diff --git a/bootstrap b/bootstrap
index e0c4ec2..2fdf267 100755
--- a/bootstrap
+++ b/bootstrap
@@ -4,7 +4,7 @@ scriptversion=2014-12-08.12; # UTC
 
 # Bootstrap this package from checked-out sources.
 
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2015 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-- 
2.1.0

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


Re: [libvirt] [PATCH 09/12] qemu_monitor: add 2 functions qemuMonitorDetachRNGDev and qemuMonitorAttachRNGDev

2015-01-05 Thread Peter Krempa
On 01/03/15 06:06, Luyao Huang wrote:
 These 2 functions just do some basic check and then call
 qemuMonitorJSONAttachRNGDev and qemuMonitorDelObject to
 help us.
 
 Signed-off-by: Luyao Huang lhu...@redhat.com
 ---
  src/qemu/qemu_monitor.c | 43 +++
  src/qemu/qemu_monitor.h |  7 +++
  2 files changed, 50 insertions(+)
 

This patch can be folded into the previous one. And again the commit
message could be improved.

Peter




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 06/12] qemu: add id when build RNG device and rename object id

2015-01-05 Thread Peter Krempa
On 01/05/15 15:51, Peter Krempa wrote:
 On 01/03/15 06:06, Luyao Huang wrote:
 We didn't set a id when we build RNG device cmdline before.
 Give a id to every RNG device and we can hotunplug it via
 QMP cmd device_del.

 Signed-off-by: Luyao Huang lhu...@redhat.com
 ---
  src/qemu/qemu_command.c | 12 ++--
  1 file changed, 6 insertions(+), 6 deletions(-)

 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
 index 46e289d..a4073ee 100644
 --- a/src/qemu/qemu_command.c
 +++ b/src/qemu/qemu_command.c
 @@ -5761,7 +5761,7 @@ qemuBuildRNGBackendArgs(virCommandPtr cmd,
  goto cleanup;
  }
  
 -virBufferAsprintf(buf, rng-random,id=%s,filename=%s,
 +virBufferAsprintf(buf, rng-random,id=obj%s,filename=%s,
dev-info.alias, dev-source.file);
  
  virCommandAddArg(cmd, -object);
 @@ -5784,7 +5784,7 @@ qemuBuildRNGBackendArgs(virCommandPtr cmd,
  virCommandAddArgList(cmd, -chardev, backend, NULL);
  
  virCommandAddArg(cmd, -object);
 -virCommandAddArgFormat(cmd, rng-egd,chardev=char%s,id=%s,
 +virCommandAddArgFormat(cmd, rng-egd,chardev=char%s,id=obj%s,
 dev-info.alias, dev-info.alias);
  break;
  
 @@ -5816,13 +5816,13 @@ qemuBuildRNGDevStr(virDomainDefPtr def,
  }
  
  if (dev-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)
 -virBufferAsprintf(buf, virtio-rng-ccw,rng=%s, dev-info.alias);
 +virBufferAsprintf(buf, virtio-rng-ccw,rng=obj%s,id=%s, 
 dev-info.alias, dev-info.alias);
  else if (dev-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390)
 -virBufferAsprintf(buf, virtio-rng-s390,rng=%s, dev-info.alias);
 +virBufferAsprintf(buf, virtio-rng-s390,rng=obj%s,id=%s, 
 dev-info.alias, dev-info.alias);
  else if (dev-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO)
 -virBufferAsprintf(buf, virtio-rng-device,rng=%s, 
 dev-info.alias);
 +virBufferAsprintf(buf, virtio-rng-device,rng=obj%s,id=%s, 
 dev-info.alias, dev-info.alias);
  else
 -virBufferAsprintf(buf, virtio-rng-pci,rng=%s, dev-info.alias);
 +virBufferAsprintf(buf, virtio-rng-pci,rng=obj%s,id=%s, 
 dev-info.alias, dev-info.alias);
  
  if (dev-rate  0) {
  virBufferAsprintf(buf, ,max-bytes=%u, dev-rate);

 
 
 This breaks the testsuite as you didn't fix the expected outputs after
 such a change. Please always run make check before posting patches.
 
 Additional question. Is this change even necessary? The RNG device does
 have it's alias already whithout the obj prefix ... thus it's just
 rng0 for example.

I misread the code. This is actually necessary as otherwise the -device
would have the same ID as the backend object. That makes sense to
change, although we need to make sure then that the code will work in
case of a long running VM (with the incorrect name) and a new libvirt
instance.

At any rate ... you need to fix the tests after this commit

 

Peter




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 12/12] qemu: Implement RNG device hotunplug on live level

2015-01-05 Thread Peter Krempa
On 01/03/15 06:06, Luyao Huang wrote:
 We have enough patches for hotunplug RNG device, maybe we can
 implement live hotunplug of a RNG device.
 
 Signed-off-by: Luyao Huang lhu...@redhat.com
 ---
  src/qemu/qemu_driver.c  |  4 +-
  src/qemu/qemu_hotplug.c | 97 
 -
  src/qemu/qemu_hotplug.h |  4 +-
  3 files changed, 102 insertions(+), 3 deletions(-)
 
 diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
 index 2ad6e01..f7600f3 100644
 --- a/src/qemu/qemu_driver.c
 +++ b/src/qemu/qemu_driver.c
 @@ -7017,6 +7017,9 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm,
  case VIR_DOMAIN_DEVICE_CHR:
  ret = qemuDomainDetachChrDevice(driver, vm, dev-data.chr);
  break;
 +case VIR_DOMAIN_DEVICE_RNG:
 +ret = qemuDomainDetachRNGDevice(driver, vm, dev-data.rng);
 +break;
  case VIR_DOMAIN_DEVICE_FS:
  case VIR_DOMAIN_DEVICE_INPUT:
  case VIR_DOMAIN_DEVICE_SOUND:
 @@ -7027,7 +7030,6 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm,
  case VIR_DOMAIN_DEVICE_SMARTCARD:
  case VIR_DOMAIN_DEVICE_MEMBALLOON:
  case VIR_DOMAIN_DEVICE_NVRAM:
 -case VIR_DOMAIN_DEVICE_RNG:
  case VIR_DOMAIN_DEVICE_SHMEM:
  case VIR_DOMAIN_DEVICE_REDIRDEV:
  case VIR_DOMAIN_DEVICE_NONE:
 diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
 index 7f1e612..d61e2a1 100644
 --- a/src/qemu/qemu_hotplug.c
 +++ b/src/qemu/qemu_hotplug.c
 @@ -2921,6 +2921,52 @@ qemuDomainRemoveChrDevice(virQEMUDriverPtr driver,
  return ret;
  }
  
 +static int
 +qemuDomainRemoveRNGDevice(virQEMUDriverPtr driver,
 +  virDomainObjPtr vm,
 +  virDomainRNGDefPtr rng)
 +{
 +virObjectEventPtr event;
 +char *charAlias = NULL;
 +char *objAlias = NULL;
 +qemuDomainObjPrivatePtr priv = vm-privateData;
 +int ret = -1;
 +int rc;
 +
 +VIR_DEBUG(Removing RNG device %s from domain %p %s,
 +  rng-info.alias, vm, vm-def-name);
 +
 +if (virAsprintf(objAlias, obj%s, rng-info.alias)  0)
 +goto cleanup;
 +
 +if (virAsprintf(charAlias, char%s, rng-info.alias)  0)
 +goto cleanup;
 +
 +qemuDomainObjEnterMonitor(driver, vm);
 +rc = qemuMonitorDetachRNGDev(priv-mon, objAlias);
 +if (rc == 0  rng-backend == VIR_DOMAIN_RNG_BACKEND_EGD)
 +ignore_value(qemuMonitorDetachCharDev(priv-mon, charAlias));
 +qemuDomainObjExitMonitor(driver, vm);
 +
 +virDomainAuditRNG(vm, rng, NULL, detach, rc == 0);
 +
 +if (rc  0)
 +goto cleanup;
 +
 +event = virDomainEventDeviceRemovedNewFromObj(vm, rng-info.alias);
 +if (event)
 +qemuDomainEventQueue(driver, event);
 +
 +qemuDomainRNGRemove(vm-def, rng);
 +qemuDomainReleaseDeviceAddress(vm, rng-info, NULL);
 +virDomainRNGDefFree(rng);
 +ret = 0;
 +
 + cleanup:
 +VIR_FREE(charAlias);
 +VIR_FREE(objAlias);
 +return ret;
 +}
  
  void
  qemuDomainRemoveDevice(virQEMUDriverPtr driver,
 @@ -2944,6 +2990,9 @@ qemuDomainRemoveDevice(virQEMUDriverPtr driver,
  case VIR_DOMAIN_DEVICE_CHR:
  qemuDomainRemoveChrDevice(driver, vm, dev-data.chr);
  break;
 +case VIR_DOMAIN_DEVICE_RNG:
 +qemuDomainRemoveRNGDevice(driver, vm, dev-data.rng);
 +break;
  
  case VIR_DOMAIN_DEVICE_NONE:
  case VIR_DOMAIN_DEVICE_LEASE:
 @@ -2958,7 +3007,6 @@ qemuDomainRemoveDevice(virQEMUDriverPtr driver,
  case VIR_DOMAIN_DEVICE_SMARTCARD:
  case VIR_DOMAIN_DEVICE_MEMBALLOON:
  case VIR_DOMAIN_DEVICE_NVRAM:
 -case VIR_DOMAIN_DEVICE_RNG:
  case VIR_DOMAIN_DEVICE_SHMEM:
  case VIR_DOMAIN_DEVICE_TPM:
  case VIR_DOMAIN_DEVICE_PANIC:
 @@ -3830,3 +3878,50 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver,
  VIR_FREE(devstr);
  return ret;
  }
 +
 +int qemuDomainDetachRNGDevice(virQEMUDriverPtr driver,
 +  virDomainObjPtr vm,
 +  virDomainRNGDefPtr rng)
 +{
 +int ret = -1;
 +qemuDomainObjPrivatePtr priv = vm-privateData;
 +virDomainDefPtr vmdef = vm-def;
 +virDomainRNGDefPtr tmpRNG;
 +int rc;
 +
 +if (!(tmpRNG = virDomainRNGFind(vmdef, rng))) {
 +virReportError(VIR_ERR_OPERATION_INVALID, %s,
 +   _(device not present in domain configuration));
 +return ret;
 +}
 +
 +if (!virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_DEVICE)) {
 +virReportError(VIR_ERR_OPERATION_INVALID, %s,
 +   _(qemu does not support -device));
 +return ret;
 +}
 +
 +if (!tmpRNG-info.alias  qemuAssignDeviceRNGAlias(vmdef, tmpRNG, -1)  
 0)
 +return ret;
 +
 +sa_assert(tmpRNG-info.alias);

Did coverity complain here?


 +
 +qemuDomainMarkDeviceForRemoval(vm, tmpRNG-info);
 +
 +qemuDomainObjEnterMonitor(driver, vm);
 +if (qemuMonitorDelDevice(priv-mon, tmpRNG-info.alias)  0) {
 +qemuDomainObjExitMonitor(driver, vm);
 + 

Re: [libvirt] [PATCH 01/12] qemu: introduce a new func qemuAssignDeviceRNGAlias for rng device

2015-01-05 Thread Peter Krempa
Subject: perhaps..

qemu: Add helper to assign RNG device aliases

On 01/03/15 06:06, Luyao Huang wrote:
 This function used to set a alias name for RNG device, usage just

This function is used to assign an alias for a RNG device. It will be
later reused when hotplugging RNGs.

 like other named qemuAssignDevice***Alias functions.
 
 Signed-off-by: Luyao Huang lhu...@redhat.com
 ---
  src/qemu/qemu_command.c | 25 -
  src/qemu/qemu_command.h |  1 +
  2 files changed, 25 insertions(+), 1 deletion(-)
 

ACK with the commit message changes. (Please include the change in the
next posting, as I'm already requiring a new version).

Peter




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 07/12] qemu: introduce 2 func qemuDomainRNGInsert and qemuDomainRNGRemove

2015-01-05 Thread Peter Krempa
On 01/03/15 06:06, Luyao Huang wrote:
 qemu side functions, call virDomainRNGInsert and virDomainRNGRemove
 to help us.
 
 Signed-off-by: Luyao Huang lhu...@redhat.com
 ---
  src/qemu/qemu_hotplug.c | 23 +++
  src/qemu/qemu_hotplug.h |  7 +++
  2 files changed, 30 insertions(+)
 
 diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
 index 7f93b9b..f9327b4 100644
 --- a/src/qemu/qemu_hotplug.c
 +++ b/src/qemu/qemu_hotplug.c
 @@ -1501,6 +1501,29 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr driver,
  return ret;
  }
  
 +int
 +qemuDomainRNGInsert(virDomainDefPtr vmdef,
 +virDomainRNGDefPtr rng)
 +{
 +return virDomainRNGInsert(vmdef, rng);
 +}

This wrapper doesn't seem useful.

 +
 +virDomainRNGDefPtr
 +qemuDomainRNGRemove(virDomainDefPtr vmdef,
 +virDomainRNGDefPtr rng)
 +{
 +virDomainRNGDefPtr ret;
 +
 +if (!(ret = virDomainRNGRemove(vmdef, rng))) {
 +virReportError(VIR_ERR_INVALID_ARG, %s,
 +   _(device not present in domain configuration));
 +return NULL;
 +}

Given that this function is used exactly once in the series you've
posted it doesn't make much sense to have the code separate.


 +
 +return ret;
 +}
 +
 +
  static int
  qemuDomainAttachHostUSBDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm,
 diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h
 index d13c532..7b838ee 100644
 --- a/src/qemu/qemu_hotplug.h
 +++ b/src/qemu/qemu_hotplug.h
 @@ -107,6 +107,13 @@ virDomainChrDefPtr
  qemuDomainChrRemove(virDomainDefPtr vmdef,
  virDomainChrDefPtr chr);
  
 +int
 +qemuDomainRNGInsert(virDomainDefPtr vmdef,
 +virDomainRNGDefPtr rng);
 +virDomainRNGDefPtr
 +qemuDomainRNGRemove(virDomainDefPtr vmdef,
 +virDomainRNGDefPtr rng);
 +

Both of the functions above are used only in qemu_hotplug.c. It doesn't
make sense to export them.

  void qemuDomainRemoveDevice(virQEMUDriverPtr driver,
  virDomainObjPtr vm,
  virDomainDeviceDefPtr dev);
 

Peter




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 08/12] qemu: introduce 2 functions for attach a rng object in json monitor

2015-01-05 Thread Peter Krempa
On 01/03/15 06:06, Luyao Huang wrote:
 We need a new function to build a RNG device object, and need a
 function to build a props which will be used in qemuMonitorJSONAddObject.
 
 Signed-off-by: Luyao Huang lhu...@redhat.com
 ---
  src/qemu/qemu_monitor_json.c | 58 
 
  src/qemu/qemu_monitor_json.h |  5 
  2 files changed, 63 insertions(+)
 
 diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
 index e567aa7..4430819 100644
 --- a/src/qemu/qemu_monitor_json.c
 +++ b/src/qemu/qemu_monitor_json.c
 @@ -6166,6 +6166,64 @@ qemuMonitorJSONDetachCharDev(qemuMonitorPtr mon,
  return ret;
  }
  
 +static virJSONValuePtr
 +qemuMonitorJSONRNGPropsCommand(const char *name,
 +   const char *data)
 +{
 +virJSONValuePtr ret;
 +
 +if (!(ret = virJSONValueNewObject()))
 +goto error;
 +
 +if (virJSONValueObjectAppendString(ret, name, data)  0)
 +goto error;
 +
 +return ret;
 +
 + error:
 +virJSONValueFree(ret);
 +return NULL;
 +}

To allow adding generic properties to objects I've added the
virJSONValueObjectCreate function that allows to create generic json
value objects. Please use that func instead of the above.


 +
 +int
 +qemuMonitorJSONAttachRNGDev(qemuMonitorPtr mon,
 +const char *chrID,
 +const char *objID,
 +virDomainRNGDefPtr rng)
 +{
 +const char *type = NULL;
 +virJSONValuePtr props = NULL;
 +
 +switch ((virDomainRNGBackend) rng-backend) {
 +case VIR_DOMAIN_RNG_BACKEND_RANDOM:
 +type = rng-random;
 +if (!(props = qemuMonitorJSONRNGPropsCommand(filename, 
 rng-source.file)))

With usage of virJSONValueObjectCreate the code will look like:

if (!(props = virJSONValueObjectCreate(s:filename, rng-source.file,
NULL)))


 +goto cleanup;
 +break;
 +
 +case VIR_DOMAIN_RNG_BACKEND_EGD:
 +if (!chrID) {
 +virReportError(VIR_ERR_INTERNAL_ERROR,%s,
 +   _(miss chardev id));
 +goto cleanup;
 +}

The chardev and backend object ID can (and should) be inferred from the
rng device ID as they should be the same (except for the char/obj
prefix).

 +type = rng-egd;
 +if (!(props = qemuMonitorJSONRNGPropsCommand(chardev, chrID)))
 +goto cleanup;
 +break;
 +
 +case VIR_DOMAIN_RNG_BACKEND_LAST:
 +/*shouldn't happen*/
 +goto cleanup;
 +}
 +
 +return qemuMonitorJSONAddObject(mon, type, objID, props);
 +
 + cleanup:
 +virJSONValueFree(props);
 +return -1;
 +}
 +
  
  int

Peter




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 11/12] qemu: Implement RNG device hotplug on live level

2015-01-05 Thread Peter Krempa
On 01/03/15 06:06, Luyao Huang wrote:
 We have enough patches for hotplug RNG device, maybe we can
 implement live hotplug of a RNG device.
 
 Signed-off-by: Luyao Huang lhu...@redhat.com
 ---
  src/qemu/qemu_driver.c  |  8 -
  src/qemu/qemu_hotplug.c | 92 
 +
  src/qemu/qemu_hotplug.h |  3 ++
  3 files changed, 102 insertions(+), 1 deletion(-)
 

 diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
 index f9327b4..7f1e612 100644
 --- a/src/qemu/qemu_hotplug.c
 +++ b/src/qemu/qemu_hotplug.c
 @@ -1523,6 +1523,98 @@ qemuDomainRNGRemove(virDomainDefPtr vmdef,
  return ret;
  }
  
 +int qemuDomainAttachRNGDevice(virQEMUDriverPtr driver,
 +  virDomainObjPtr vm,
 +  virDomainRNGDefPtr rng)
 +{
 +int ret = -1;
 +qemuDomainObjPrivatePtr priv = vm-privateData;
 +virDomainDefPtr vmdef = vm-def;
 +char *devstr = NULL;
 +char *charAlias = NULL;
 +char *objAlias = NULL;
 +bool need_remove = false;
 +bool releaseaddr = false;
 +
 +if (!virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_DEVICE)) {
 +virReportError(VIR_ERR_OPERATION_INVALID, %s,
 +   _(qemu does not support -device));
 +return ret;
 +}

Additionally to the -device support, qemu also needs to support chardev
hotplug and the rng device with the appropriate backends, we already
have capability bits for them so you need to check them here.

 +
 +if (qemuAssignDeviceRNGAlias(vmdef, rng, -1)  0)
 +return ret;
 +
 +if (rng-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
 +if (STRPREFIX(vm-def-os.machine, s390-ccw) 
 +virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
 +rng-info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
 +} else if (virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_VIRTIO_S390)) {
 +rng-info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390;
 +}
 +}
 +
 +if (rng-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE ||
 +rng-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
 +if (virDomainPCIAddressEnsureAddr(priv-pciaddrs, rng-info)  0)
 +return ret;
 +} else if (rng-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
 +if (virDomainCCWAddressAssign(rng-info, priv-ccwaddrs,
 +  !rng-info.addr.ccw.assigned)  0)

Line above is misaligned.

 +return ret;
 +}
 +releaseaddr = true;
 +if (!(devstr = qemuBuildRNGDevStr(vmdef, rng, priv-qemuCaps)))
 +return ret;

After you set releaseaddr to true you need to jump to cleanup in case of
error so that the address gets cleared.

 +
 +if (virAsprintf(objAlias, obj%s, rng-info.alias)  0)
 +goto cleanup;
 +
 +if (rng-backend == VIR_DOMAIN_RNG_BACKEND_EGD) {
 +if (virAsprintf(charAlias, char%s, rng-info.alias)  0)
 +goto cleanup;
 +
 +qemuDomainObjEnterMonitor(driver, vm);
 +if (qemuMonitorAttachCharDev(priv-mon, charAlias, 
 rng-source.chardev)  0) {
 +qemuDomainObjExitMonitor(driver, vm);
 +goto audit;
 +}
 +need_remove = true;

This variable should be named remove_chardev so that it's clear what
it's used to.

 +} else {
 +qemuDomainObjEnterMonitor(driver, vm);
 +}
 +
 +if (qemuMonitorAttachRNGDev(priv-mon, charAlias, objAlias, rng)  0) {
 +if (need_remove)
 +qemuMonitorDetachCharDev(priv-mon, charAlias);
 +qemuDomainObjExitMonitor(driver, vm);
 +goto audit;
 +}
 +
 +if (devstr  qemuMonitorAddDevice(priv-mon, devstr)  0) {
 +qemuMonitorDetachRNGDev(priv-mon, objAlias);
 +if (need_remove)
 +qemuMonitorDetachCharDev(priv-mon, charAlias);
 +qemuDomainObjExitMonitor(driver, vm);
 +goto audit;
 +}
 +qemuDomainObjExitMonitor(driver, vm);
 +
 +if (qemuDomainRNGInsert(vmdef, rng)  0)
 +goto cleanup;
 +
 +ret = 0;
 + audit:
 +virDomainAuditRNG(vm, NULL, rng, attach, ret == 0);
 + cleanup:
 +if (releaseaddr)
 +qemuDomainReleaseDeviceAddress(vm, rng-info, NULL);
 +VIR_FREE(charAlias);
 +VIR_FREE(objAlias);
 +VIR_FREE(devstr);
 +return ret;
 +}
 +
  
  static int
  qemuDomainAttachHostUSBDevice(virQEMUDriverPtr driver,


The rest looks good.

Peter




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