[libvirt] [PATCH] util: fix releasing pidfile in cleanup

2014-11-04 Thread Martin Kletzander
Coverity found out the very obvious problem in the code.  That is that
virPidFileReleasePath() was called only if
virPidFileAcquirePath() returned 0.  But virPidFileAcquirePath() doesn't
return only 0 on success, but the FD that needs to be closed.

Signed-off-by: Martin Kletzander mklet...@redhat.com
---
 src/util/virpidfile.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index 098458f..a77a326 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -592,9 +592,8 @@ virPidFileForceCleanupPath(const char *path)
 if (virPidFileReadPath(path, pid)  0)
 return -1;

-if (virPidFileAcquirePath(path, false, 0) == 0) {
-virPidFileReleasePath(path, fd);
-} else {
+fd = virPidFileAcquirePath(path, false, 0);
+if (fd  0) {
 virResetLastError();

 /* Only kill the process if the pid is valid one.  0 means
@@ -607,5 +606,8 @@ virPidFileForceCleanupPath(const char *path)
 return -1;
 }

+if (fd)
+virPidFileReleasePath(path, fd);
+
 return 0;
 }
-- 
2.1.3

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


Re: [libvirt] [PATCH] util: fix releasing pidfile in cleanup

2014-11-04 Thread Pavel Hrdina

On 11/04/2014 10:51 AM, Martin Kletzander wrote:

Coverity found out the very obvious problem in the code.  That is that
virPidFileReleasePath() was called only if
virPidFileAcquirePath() returned 0.  But virPidFileAcquirePath() doesn't
return only 0 on success, but the FD that needs to be closed.

Signed-off-by: Martin Kletzander mklet...@redhat.com
---
  src/util/virpidfile.c | 8 +---
  1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index 098458f..a77a326 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -592,9 +592,8 @@ virPidFileForceCleanupPath(const char *path)
  if (virPidFileReadPath(path, pid)  0)
  return -1;

-if (virPidFileAcquirePath(path, false, 0) == 0) {
-virPidFileReleasePath(path, fd);
-} else {
+fd = virPidFileAcquirePath(path, false, 0);
+if (fd  0) {
  virResetLastError();

  /* Only kill the process if the pid is valid one.  0 means
@@ -607,5 +606,8 @@ virPidFileForceCleanupPath(const char *path)
  return -1;
  }

+if (fd)
+virPidFileReleasePath(path, fd);
+
  return 0;
  }



ACK

Pavel

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


Re: [libvirt] [PATCH] domain: Improve error output for virDomainListGetStats

2014-11-04 Thread Peter Krempa
On 11/04/14 07:51, Luyao Huang wrote:
 When pass flags --domain and --list-* to cmdDomstats,
 a unsupport error will output from qemuConnectGetAllDomainStats.
 
 error: unsupported flags (0x1) in function qemuConnectGetAllDomainStats
 
From manual of virsh: The approaches can't be combined.
 
 Improve error to:
 
 error: --domain and --list-* flags are mutually exclusive
 
 Signed-off-by: Luyao Huang lhu...@redhat.com
 ---
  src/libvirt-domain.c | 13 +
  1 file changed, 13 insertions(+)
 
 diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
 index 7dc3146..6ae6dd2 100644
 --- a/src/libvirt-domain.c
 +++ b/src/libvirt-domain.c
 @@ -11053,6 +11053,19 @@ virDomainListGetStats(virDomainPtr *doms,
  goto cleanup;
  }
  
 +if (flags  (VIR_CONNECT_LIST_DOMAINS_ACTIVE |
 + VIR_CONNECT_LIST_DOMAINS_INACTIVE |
 + VIR_CONNECT_LIST_DOMAINS_PERSISTENT |
 + VIR_CONNECT_LIST_DOMAINS_TRANSIENT |
 + VIR_CONNECT_LIST_DOMAINS_RUNNING |
 + VIR_CONNECT_LIST_DOMAINS_SHUTOFF |
 + VIR_CONNECT_LIST_DOMAINS_PAUSED |
 + VIR_CONNECT_LIST_DOMAINS_OTHER)) {
 +virReportInvalidArg(flags, %s,
 +_(--domain and --list-* flags are mutually exclusive));
 +goto cleanup;
 +}

From what I remember it was a deliberate design decision to avoid
reporting this error either from virsh or the library itself so that we
possibly can add the filtering later on.

This should be done in the qemu driver impl of the function so that we
can possibly do it later without breaking old clients

 +
  conn = doms[0]-conn;
  virCheckConnectReturn(conn, -1);
  
 

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] domain: Improve error output for virDomainListGetStats

2014-11-04 Thread Eric Blake
On 11/04/2014 07:51 AM, Luyao Huang wrote:
 When pass flags --domain and --list-* to cmdDomstats,
 a unsupport error will output from qemuConnectGetAllDomainStats.
 
 error: unsupported flags (0x1) in function qemuConnectGetAllDomainStats
 
From manual of virsh: The approaches can't be combined.

NACK.  While they cannot be combined in the current implementation, I
see nothing that would prohibit a future implementation from allowing
the combination (for example, show me all stats for a given domain, but
only if the domain is running).  Prohibiting in libvirt-domian.c would
prevent an older RPC client from talking to a newer server that supports
the combination.  We should only prohibit combinations in libvirt-*.c if
there is no chance we will ever extend things to allow the combination.

-- 
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: fix up NBD Server can not be stopped properly

2014-11-04 Thread Ján Tomko
On 11/04/2014 06:03 AM, weiwei li wrote:
 In qemuMigrationFinish mig-nbd can not be initialized by
 qemuMigrationEatCookie without a flag QEMU_MIGRATION_COOKIE_NBD.
 That cause qemuMigrationStopNBDServer return and the NBD server
 can not be stopped properly.
 
 Signed-off-by: Weiwei Li nuonu...@tencent.com mailto:nuonu...@tencent.com

 Signed-off-by: Ján Tomko jto...@redhat.com mailto:jto...@redhat.com

You should only add Signed-off-by lines with your own name :)

 ---
  src/qemu/qemu_migration.c |3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)
 
 diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
 index 13239eb..9cb2a06 100644
 --- a/src/qemu/qemu_migration.c
 +++ b/src/qemu/qemu_migration.c
 @@ -4822,7 +4822,8 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
  VIR_FREE(priv-job.completed);
  
  cookie_flags = QEMU_MIGRATION_COOKIE_NETWORK |
 -   QEMU_MIGRATION_COOKIE_STATS;
 +   QEMU_MIGRATION_COOKIE_STATS |
 +   QEMU_MIGRATION_COOKIE_NBD;

This should be aligned with the other flags.

ACK and pushed now.

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] [PATCHv3 02/16] Domain conf: allow more than one IP address for net devices

2014-11-04 Thread Cedric Bosdonnat
Hi Daniel,

On Wed, 2014-10-22 at 11:03 +0100, Daniel P. Berrange wrote:
 I think it is probably worth a followup patch to make drivers
 report VIR_ERR_CONFIG_UNSUPPORTED in the case where  nips  1
 and the driver only supports nips==1.

Shouldn't we just VIR_WARN this? That would avoid breaking as we could
get the first ip address...

--
Cedric

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


[libvirt] [PATCH] qemu: don't setup cpuset.mems if memory mode in numatune is 'preferred'

2014-11-04 Thread Wang Rui
If the memory mode is specified as preferred, we get the following error when
starting domain.

error: Unable to write to '$my_cgroup_path/cpuset.mems': Device or resource busy

XML is configured with numatune as follows:
  numatune
memory mode='preferred' nodeset='0'/
  /numatune

If memory mode is 'preferred', cpuset.mems in cgroup shouldn't be set to
'nodeset'. I find that maybe commit 1a7be8c600905aa07ac2d78293336ba8523ad48e
changes the former logic of checking mode in virDomainNumatuneGetNodeset.

Signed-off-by: Wang Rui moon.wang...@huawei.com
---
 src/qemu/qemu_cgroup.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index b5bdb36..8685d6f 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -618,6 +618,11 @@ qemuSetupCpusetMems(virDomainObjPtr vm,
 if (!virCgroupHasController(priv-cgroup, VIR_CGROUP_CONTROLLER_CPUSET))
 return 0;
 
+if (virDomainNumatuneGetMode(vm-def-numatune, -1) !=
+VIR_DOMAIN_NUMATUNE_MEM_STRICT) {
+return 0;
+}
+
 if (virDomainNumatuneMaybeFormatNodeset(vm-def-numatune,
 nodemask,
 mem_mask, -1)  0)
-- 
1.7.12.4

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


[libvirt] internal error: Cannot find suitable CPU model for given data

2014-11-04 Thread Matias Kreder
Hello,

I am having troubles with libvirt on Fedora 21 alpha.

On virt-manager:

Unable to complete install: 'internal error: Cannot find suitable CPU
model for given data'

Traceback (most recent call last):
  File /usr/share/virt-manager/virtManager/asyncjob.py, line 89, in cb_wrapper
callback(asyncjob, *args, **kwargs)
  File /usr/share/virt-manager/virtManager/create.py, line 1854, in do_install
guest.start_install(meter=meter)
  File /usr/share/virt-manager/virtinst/guest.py, line 411, in start_install
noboot)
  File /usr/share/virt-manager/virtinst/guest.py, line 475, in _create_guest
dom = self.conn.createLinux(start_xml or final_xml, 0)
  File /usr/lib64/python2.7/site-packages/libvirt.py, line 3361, in
createLinux
if ret is None:raise libvirtError('virDomainCreateLinux() failed',
conn=self)
libvirtError: internal error: Cannot find suitable CPU model for given data

On systemctl status libvirtd I can see:

Nov 04 10:23:41 lappie.mkeder.com libvirtd[3822]: Preferred CPU model
Westmere not allowed by hypervisor; closest supported model will be
used
Nov 04 10:23:41 lappie.mkeder.com libvirtd[3822]: internal error:
Cannot find suitable CPU model for given data

I can't create the VM using any CPU configuration on virt-manager.

Intel VT is enabled on the BIOS. This is a Lenovo Thinkpad t410 that I
got yesterday. CPU is Intel(R) Core(TM) i5 CPU  M 520

[root@lappie matias]# virsh -r capabilities | grep model
  modelWestmere/model

I haven't tried Fedora 20 on it but I might re-install it soon. Just
wanted to give my feedback for Fedora 21.

[root@lappie matias]# rpm -q libvirt-daemon
libvirt-daemon-1.2.9-4.fc21.x86_64
[root@lappie matias]# rpm -q virt-manager
virt-manager-1.1.0-3.git310f6527.fc21.noarch

Doing a google search it seems that some people had the same problem a
few months ago and they solved but by updating. Seems to be some sort
of problem between libvirt and qemu-kvm.

Regards
Matias

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


Re: [libvirt] [PATCH] domain: Improve error output for virDomainListGetStats

2014-11-04 Thread Luyao Huang
Thanks for pointing out the mistake.I will move the check in
qemuConnectGetAllDomainStats, this won't make a old client
cannot use the future server and will give a good error when
use future client to connect to old server.

Thanks,
Luyao Huang
- Original Message -
From: Eric Blake ebl...@redhat.com
To: Luyao Huang lhu...@redhat.com, libvir-list@redhat.com
Sent: Tuesday, November 4, 2014 7:19:41 PM
Subject: Re: [libvirt] [PATCH] domain: Improve error output for 
virDomainListGetStats

On 11/04/2014 07:51 AM, Luyao Huang wrote:
 When pass flags --domain and --list-* to cmdDomstats,
 a unsupport error will output from qemuConnectGetAllDomainStats.
 
 error: unsupported flags (0x1) in function qemuConnectGetAllDomainStats
 
From manual of virsh: The approaches can't be combined.

NACK.  While they cannot be combined in the current implementation, I
see nothing that would prohibit a future implementation from allowing
the combination (for example, show me all stats for a given domain, but
only if the domain is running).  Prohibiting in libvirt-domian.c would
prevent an older RPC client from talking to a newer server that supports
the combination.  We should only prohibit combinations in libvirt-*.c if
there is no chance we will ever extend things to allow the combination.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org

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


Re: [libvirt] [PATCH] qemu: don't setup cpuset.mems if memory mode in numatune is 'preferred'

2014-11-04 Thread Martin Kletzander

On Tue, Nov 04, 2014 at 09:22:22PM +0800, Wang Rui wrote:

If the memory mode is specified as preferred, we get the following error when
starting domain.

error: Unable to write to '$my_cgroup_path/cpuset.mems': Device or resource busy

XML is configured with numatune as follows:
 numatune
   memory mode='preferred' nodeset='0'/
 /numatune

If memory mode is 'preferred', cpuset.mems in cgroup shouldn't be set to
'nodeset'. I find that maybe commit 1a7be8c600905aa07ac2d78293336ba8523ad48e
changes the former logic of checking mode in virDomainNumatuneGetNodeset.

Signed-off-by: Wang Rui moon.wang...@huawei.com
---
src/qemu/qemu_cgroup.c | 5 +
1 file changed, 5 insertions(+)



Thanks for catching that, it definitely is a problem, but I think it
is cause by commit 93e82727ec11d471d2ef3a18835e1fdfe062cef1.

It should be also fixed in virLXCCgroupSetupCpusetTune() for LXC.


diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index b5bdb36..8685d6f 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -618,6 +618,11 @@ qemuSetupCpusetMems(virDomainObjPtr vm,
if (!virCgroupHasController(priv-cgroup, VIR_CGROUP_CONTROLLER_CPUSET))
return 0;

+if (virDomainNumatuneGetMode(vm-def-numatune, -1) !=
+VIR_DOMAIN_NUMATUNE_MEM_STRICT) {
+return 0;
+}
+


One question, is it problem only for 'preferred' or 'interleaved' as
well?  Because if it's only problem for 'preferred', then the check is
wrong.  If it's problem for 'interleaved' as well, then the commit
message is wrong.

Anyway, after either one is fixed, I can push this.

Thank you,
Martin


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

Re: [libvirt] [PATCH] Require at least one console for LXC domain

2014-11-04 Thread Ján Tomko
On 10/31/2014 11:53 AM, Martin Kletzander wrote:
 On Fri, Oct 31, 2014 at 10:22:25AM +0100, Ján Tomko wrote:
 A domain without a console quietly dies soon after start,
 because we try to set /dev/null as a controlling TTY
 2014-10-30 15:10:59.705+: 1: error : lxcContainerSetupFDs:283 :
 ioctl(TIOCSTTY) failed: Inappropriate ioctl for device

 
 s/TIOCSTTY/TIOCSCTTY/ would make it more greppable (is that even a
 word?) and it's now true since you pushed your trivial fix for that ;)
 

I have amended the commit message.

 Report an error early instead of trying to start it.

 https://bugzilla.redhat.com/show_bug.cgi?id=1155410
 ---
 src/lxc/lxc_container.c | 6 --
 src/lxc/lxc_process.c   | 6 ++
 2 files changed, 10 insertions(+), 2 deletions(-)

 diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
 index f02b959..8aba3ba 100644
 --- a/src/lxc/lxc_container.c
 +++ b/src/lxc/lxc_container.c
 @@ -2093,8 +2093,10 @@ static int lxcContainerChild(void *data)
 if (virAsprintf(ttyPath, %s/%s.devpts/%s,
 LXC_STATE_DIR, vmDef-name, tty)  0)
 goto cleanup;
 -} else if (VIR_STRDUP(ttyPath, /dev/null)  0) {
 -goto cleanup;
 +} else {
 +virReportError(VIR_ERR_INTERNAL_ERROR, %s,
 +   _(At least one tty is required));
 +goto cleanup;
 }
 
 How about we don't attach any tty and use the ioctl(TIOCSTTY) to steal
 controlling terminal (or call open() with O_NOCTTY, or just don't call
 ioctl() at all, I don't know what we normally use)?  Then there would
 be no controlling terminal, but there would still be a session leader,
 wouldn't it?
 

I don't know if we want to run a container without a controlling terminal.
Looking at git history, back when we only supported one console and none was
specified, it seems we quietly opened one anyway and didn't report it in the 
XML.

Alternatively, we could auto-add a console in the XML.

 Anyway, this version looks OK too since it doesn't break any use case
 (there is nothing to break now).  ACK after release if you argue why
 not to use the idea above.

It's been broken long enough to make me think nobody cares about this
functionality, but I could make it work if you think it's worthwhile.

Jan




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

[libvirt] [PATCH] Transform VIR_ERROR into VIR_WARN in detect_scsi_host_caps

2014-11-04 Thread Cédric Bosdonnat
If detect_scsi_host_caps reports errors but keeps libvirtd going on
startup, the user is mislead by the error messages. Transforming them
into warning still shows the problems, but indicates this is not fatal.
---
 po/POTFILES.in|  1 -
 src/node_device/node_device_linux_sysfs.c | 22 +++---
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 89c6a44..1439ae4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -92,7 +92,6 @@ src/network/bridge_driver_linux.c
 src/network/leaseshelper.c
 src/node_device/node_device_driver.c
 src/node_device/node_device_hal.c
-src/node_device/node_device_linux_sysfs.c
 src/node_device/node_device_udev.c
 src/nodeinfo.c
 src/nwfilter/nwfilter_dhcpsnoop.c
diff --git a/src/node_device/node_device_linux_sysfs.c 
b/src/node_device/node_device_linux_sysfs.c
index be95e51..4a95b2b 100644
--- a/src/node_device/node_device_linux_sysfs.c
+++ b/src/node_device/node_device_linux_sysfs.c
@@ -62,7 +62,7 @@ detect_scsi_host_caps(union _virNodeDevCapData *d)
   d-scsi_host.host,
   port_name,
   d-scsi_host.wwpn)  0) {
-VIR_ERROR(_(Failed to read WWPN for host%d), d-scsi_host.host);
+VIR_WARN(Failed to read WWPN for host%d, d-scsi_host.host);
 goto cleanup;
 }
 
@@ -70,7 +70,7 @@ detect_scsi_host_caps(union _virNodeDevCapData *d)
   d-scsi_host.host,
   node_name,
   d-scsi_host.wwnn)  0) {
-VIR_ERROR(_(Failed to read WWNN for host%d), d-scsi_host.host);
+VIR_WARN(Failed to read WWNN for host%d, d-scsi_host.host);
 goto cleanup;
 }
 
@@ -78,8 +78,8 @@ detect_scsi_host_caps(union _virNodeDevCapData *d)
   d-scsi_host.host,
   fabric_name,
   d-scsi_host.fabric_wwn)  0) {
-VIR_ERROR(_(Failed to read fabric WWN for host%d),
-  d-scsi_host.host);
+VIR_WARN(Failed to read fabric WWN for host%d,
+ d-scsi_host.host);
 goto cleanup;
 }
 }
@@ -91,8 +91,8 @@ detect_scsi_host_caps(union _virNodeDevCapData *d)
   d-scsi_host.host,
   max_npiv_vports,
   max_vports)  0) {
-VIR_ERROR(_(Failed to read max_npiv_vports for host%d),
-  d-scsi_host.host);
+VIR_WARN(Failed to read max_npiv_vports for host%d,
+ d-scsi_host.host);
 goto cleanup;
 }
 
@@ -100,22 +100,22 @@ detect_scsi_host_caps(union _virNodeDevCapData *d)
   d-scsi_host.host,
   npiv_vports_inuse,
   vports)  0) {
-VIR_ERROR(_(Failed to read npiv_vports_inuse for host%d),
-  d-scsi_host.host);
+VIR_WARN(Failed to read npiv_vports_inuse for host%d,
+ d-scsi_host.host);
 goto cleanup;
 }
 
 if (virStrToLong_i(max_vports, NULL, 10,
d-scsi_host.max_vports)  0) {
-VIR_ERROR(_(Failed to parse value of max_npiv_vports '%s'),
+VIR_WARN(Failed to parse value of max_npiv_vports '%s',
   max_vports);
 goto cleanup;
 }
 
 if (virStrToLong_i(vports, NULL, 10,
d-scsi_host.vports)  0) {
-VIR_ERROR(_(Failed to parse value of npiv_vports_inuse '%s'),
-  vports);
+VIR_WARN(Failed to parse value of npiv_vports_inuse '%s',
+ vports);
 goto cleanup;
 }
 }
-- 
1.8.4.5

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


[libvirt] [libvirt-sandbox][PATCH 3/4] m4: sync macros with libvirt

2014-11-04 Thread Michal Privoznik
The macros under the m4 directory are outdated a bit. When trying
to compile with newer gcc I see some errors:

make[4]: Entering directory 
'/home/zippy/work/libvirt/libvirt-sanbox.git/libvirt-sandbox'
  CC   libvirt_sandbox_1_0_la-libvirt-sandbox-main.lo
gcc: warning: switch '-Wmudflap' is no longer supported

Signed-off-by: Michal Privoznik mpriv...@redhat.com
---
 m4/manywarnings.m4  | 217 
 m4/virt-compile-warnings.m4 | 216 +++
 m4/warnings.m4  |  82 +
 3 files changed, 361 insertions(+), 154 deletions(-)

diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index fd0e372..3e6dd21 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -1,5 +1,5 @@
-# manywarnings.m4 serial 3
-dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
+# manywarnings.m4 serial 7
+dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -35,14 +35,12 @@ AC_DEFUN([gl_MANYWARN_COMPLEMENT],
 # make sure your gcc understands it.
 AC_DEFUN([gl_MANYWARN_ALL_GCC],
 [
-  dnl First, check if -Wno-missing-field-initializers is needed.
-  dnl -Wmissing-field-initializers is implied by -W, but that issues
-  dnl warnings with GCC version before 4.7, for the common idiom
-  dnl of initializing types on the stack to zero, using { 0, }
+  dnl First, check for some issues that only occur when combining multiple
+  dnl gcc warning categories.
   AC_REQUIRE([AC_PROG_CC])
   if test -n $GCC; then
 
-dnl First, check -W -Werror -Wno-missing-field-initializers is supported
+dnl Check if -W -Werror -Wno-missing-field-initializers is supported
 dnl with the current $CC $CFLAGS $CPPFLAGS.
 AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported])
 AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [
@@ -77,108 +75,171 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
   ])
   AC_MSG_RESULT([$gl_cv_cc_nomfi_needed])
 fi
+
+dnl Next, check if -Werror -Wuninitialized is useful with the
+dnl user's choice of $CFLAGS; some versions of gcc warn that it
+dnl has no effect if -O is not also used
+AC_MSG_CHECKING([whether -Wuninitialized is supported])
+AC_CACHE_VAL([gl_cv_cc_uninitialized_supported], [
+  gl_save_CFLAGS=$CFLAGS
+  CFLAGS=$CFLAGS -Werror -Wuninitialized
+  AC_COMPILE_IFELSE(
+[AC_LANG_PROGRAM([[]], [[]])],
+[gl_cv_cc_uninitialized_supported=yes],
+[gl_cv_cc_uninitialized_supported=no])
+  CFLAGS=$gl_save_CFLAGS])
+AC_MSG_RESULT([$gl_cv_cc_uninitialized_supported])
+
   fi
 
+  # List all gcc warning categories.
+  # To compare this list to your installed GCC's, run this Bash command:
+  #
+  # comm -3 \
+  #  (sed -n 's/^  *\(-[^ ]*\) .*/\1/p' manywarnings.m4 | sort) \
+  #  (gcc --help=warnings | sed -n 's/^  \(-[^ ]*\) .*/\1/p' | sort |
+  #  grep -v -x -f (
+  # awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec))
+
   gl_manywarn_set=
   for gl_manywarn_item in \
--Wall \
 -W \
--Wformat-y2k \
--Wformat-nonliteral \
--Wformat-security \
--Winit-self \
--Wmissing-include-dirs \
--Wswitch-default \
--Wswitch-enum \
--Wunused \
--Wunknown-pragmas \
--Wstrict-aliasing \
--Wstrict-overflow \
--Wsystem-headers \
--Wfloat-equal \
--Wtraditional \
--Wtraditional-conversion \
--Wdeclaration-after-statement \
--Wundef \
--Wshadow \
--Wunsafe-loop-optimizations \
--Wpointer-arith \
--Wbad-function-cast \
--Wc++-compat \
--Wcast-qual \
--Wcast-align \
--Wwrite-strings \
--Wconversion \
--Wsign-conversion \
--Wlogical-op \
--Waggregate-return \
--Wstrict-prototypes \
--Wold-style-definition \
--Wmissing-prototypes \
--Wmissing-declarations \
--Wmissing-noreturn \
--Wmissing-format-attribute \
--Wpacked \
--Wpadded \
--Wredundant-decls \
--Wnested-externs \
--Wunreachable-code \
--Winline \
--Winvalid-pch \
--Wlong-long \
--Wvla \
--Wvolatile-register-var \
--Wdisabled-optimization \
--Wstack-protector \
--Woverlength-strings \
--Wbuiltin-macro-redefined \
--Wmudflap \
--Wpacked-bitfield-compat \
--Wsync-nand \
-; do
-gl_manywarn_set=$gl_manywarn_set $gl_manywarn_item
-  done
-  # The following are not documented in the manual but are included in
-  # output from gcc --help=warnings.
-  for gl_manywarn_item in \
--Wattributes \
--Wcoverage-mismatch \
--Wmultichar \
--Wunused-macros \
-; do
-gl_manywarn_set=$gl_manywarn_set $gl_manywarn_item
-  done
-  # More warnings from gcc 4.6.2 --help=warnings.
-  for gl_manywarn_item in \
 -Wabi \
+-Waddress \
+

[libvirt] [libvirt-sandbox][PATCH 2/4] Makefile: link SELINUX into libvirt-sandbox-1.0.so

2014-11-04 Thread Michal Privoznik
The code that uses SELinux is compiled into libvirt-sandbox-1.0.so so
it must be linked against -lselinux. Otherwise an error occurs:

make[4]: Entering directory 
'/home/zippy/work/libvirt/libvirt-sanbox.git/libvirt-sandbox'
  CCLD libvirt-sandbox-init-lxc
./.libs/libvirt-sandbox-1.0.so: undefined reference to `getcon'
./.libs/libvirt-sandbox-1.0.so: undefined reference to `freecon'
collect2: error: ld returned 1 exit status

Signed-off-by: Michal Privoznik mpriv...@redhat.com
---
 libvirt-sandbox/Makefile.am | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libvirt-sandbox/Makefile.am b/libvirt-sandbox/Makefile.am
index ea485b7..96302cb 100644
--- a/libvirt-sandbox/Makefile.am
+++ b/libvirt-sandbox/Makefile.am
@@ -142,12 +142,14 @@ libvirt_sandbox_1_0_la_CFLAGS = \
$(GIO_UNIX_CFLAGS) \
$(LIBVIRT_GLIB_CFLAGS) \
$(LIBVIRT_GOBJECT_CFLAGS) \
+   $(SELINUX_CFLAGS) \
$(WARN_CFLAGS) \
$(NULL)
 libvirt_sandbox_1_0_la_LIBADD = \
$(GIO_UNIX_LIBS) \
$(LIBVIRT_GLIB_LIBS) \
$(LIBVIRT_GOBJECT_LIBS) \
+   $(SELINUX_LIBS) \
$(CYGWIN_EXTRA_LIBADD) \
$(NULL)
 libvirt_sandbox_1_0_la_DEPENDENCIES = \
@@ -174,7 +176,6 @@ libvirt_sandbox_init_common_CFLAGS = \
$(LIBVIRT_GLIB_CFLAGS) \
$(LIBVIRT_GOBJECT_CFLAGS) \
$(CAPNG_CFLAGS) \
-   $(SELINUX_CFLAGS) \
$(WARN_CFLAGS) \
$(NULL)
 libvirt_sandbox_init_common_LDFLAGS = \
@@ -184,7 +185,6 @@ libvirt_sandbox_init_common_LDFLAGS = \
$(LIBVIRT_GLIB_LIBS) \
$(LIBVIRT_GOBJECT_LIBS) \
$(CAPNG_LIBS) \
-   $(SELINUX_LIBS) \
$(WARN_CFLAGS) \
$(NULL)
 libvirt_sandbox_init_common_LDADD = \
-- 
2.0.4

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


[libvirt] [libvirt-sandbox][PATCH 4/4] libvirt-sandbox-config.c: Fix comment

2014-11-04 Thread Michal Privoznik
Inline comments in the code should have only one star, two stars are
reserved for function documentation from which gtk doc is generated.
This commit resolves this warning:

  GISCAN   LibvirtSandbox-1.0.gir
libvirt-sandbox-config.c:2142: Error: LibvirtSandbox: Skipping invalid GTK-Doc 
comment block:
/** XXX hack */
^

Signed-off-by: Michal Privoznik mpriv...@redhat.com
---
 libvirt-sandbox/libvirt-sandbox-config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libvirt-sandbox/libvirt-sandbox-config.c 
b/libvirt-sandbox/libvirt-sandbox-config.c
index f996ea5..087b5ce 100644
--- a/libvirt-sandbox/libvirt-sandbox-config.c
+++ b/libvirt-sandbox/libvirt-sandbox-config.c
@@ -2139,7 +2139,7 @@ gvir_sandbox_config_load_from_keyfile(GKeyFile *file,
 gchar *str = NULL;
 GType type;
 
-/** XXX hack */
+/* XXX hack */
 GVIR_SANDBOX_TYPE_CONFIG_INTERACTIVE;
 GVIR_SANDBOX_TYPE_CONFIG_SERVICE;
 GVIR_SANDBOX_TYPE_CONFIG_SERVICE_SYSTEMD;
-- 
2.0.4

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


[libvirt] [libvirt-sandbox][PATCH 1/4] virt-selinux.m4: Define SELINUX variables

2014-11-04 Thread Michal Privoznik
Later in Makefile we are using SELINUX_{CFLAGS,LIBS} variables. But we
don't define them anywhere. As the result, if you don't have selinux
linked by default, you'll get linkage error.

Signed-off-by: Michal Privoznik mpriv...@redhat.com
---
 m4/virt-selinux.m4 | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/m4/virt-selinux.m4 b/m4/virt-selinux.m4
index ef41721..610ff58 100644
--- a/m4/virt-selinux.m4
+++ b/m4/virt-selinux.m4
@@ -1,11 +1,15 @@
 AC_DEFUN([LIBVIRT_SANDBOX_SELINUX], [
   fail=0
+  SELINUX_CFLAGS=
+  SELINUX_LIBS=
   old_LIBS=$LIBS
   old_CFLAGS=$CFLAGS
   AC_CHECK_HEADER([selinux/selinux.h],[],[fail=1])
-  AC_CHECK_LIB([selinux], [fgetfilecon],[],[fail=1])
+  AC_CHECK_LIB([selinux], [fgetfilecon],[SELINUX_LIBS=$SELINUX_LIBS 
-lselinux],[fail=1])
   LIBS=$old_LIBS
   CFLAGS=$old_CFLAGS
   test $fail = 1 
 AC_MSG_ERROR([You must install the libselinux development package in order 
to compile libvirt-sandbox])
+  AC_SUBST([SELINUX_CFLAGS])
+  AC_SUBST([SELINUX_LIBS])
 ])
-- 
2.0.4

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


[libvirt] [libvirt-sandbox][PATCH 0/4] Couple of fixes to compile again

2014-11-04 Thread Michal Privoznik
It's been a while that I tried to build libvirt-sandbox. And
guess what, it doesn't compile cleanly so here are some patches
to fix the issues I met.

Michal Privoznik (4):
  virt-selinux.m4: Define SELINUX variables
  Makefile: link SELINUX into libvirt-sandbox-1.0.so
  m4: sync macros with libvirt
  libvirt-sandbox-config.c: Fix comment

 libvirt-sandbox/Makefile.am  |   4 +-
 libvirt-sandbox/libvirt-sandbox-config.c |   2 +-
 m4/manywarnings.m4   | 217 ---
 m4/virt-compile-warnings.m4  | 216 ++
 m4/virt-selinux.m4   |   6 +-
 m4/warnings.m4   |  82 +---
 6 files changed, 369 insertions(+), 158 deletions(-)

-- 
2.0.4

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


[libvirt] [libvirt-glib][PATCH] m4: sync macros with libvirt

2014-11-04 Thread Michal Privoznik
The macros under the m4 directory are outdated a bit. When trying
to compile with newer gcc I see some errors:

make[2]: Entering directory 
'/home/zippy/work/libvirt/libvirt-glib.git/libvirt-glib'
  CC   libvirt_glib_1_0_la-libvirt-glib-error.lo
gcc: warning: switch '-Wmudflap' is no longer supported

Signed-off-by: Michal Privoznik mpriv...@redhat.com
---
 m4/manywarnings.m4  | 217 
 m4/virt-compile-warnings.m4 | 214 ---
 m4/warnings.m4  |   2 +-
 3 files changed, 299 insertions(+), 134 deletions(-)

diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index fd0e372..3e6dd21 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -1,5 +1,5 @@
-# manywarnings.m4 serial 3
-dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
+# manywarnings.m4 serial 7
+dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -35,14 +35,12 @@ AC_DEFUN([gl_MANYWARN_COMPLEMENT],
 # make sure your gcc understands it.
 AC_DEFUN([gl_MANYWARN_ALL_GCC],
 [
-  dnl First, check if -Wno-missing-field-initializers is needed.
-  dnl -Wmissing-field-initializers is implied by -W, but that issues
-  dnl warnings with GCC version before 4.7, for the common idiom
-  dnl of initializing types on the stack to zero, using { 0, }
+  dnl First, check for some issues that only occur when combining multiple
+  dnl gcc warning categories.
   AC_REQUIRE([AC_PROG_CC])
   if test -n $GCC; then
 
-dnl First, check -W -Werror -Wno-missing-field-initializers is supported
+dnl Check if -W -Werror -Wno-missing-field-initializers is supported
 dnl with the current $CC $CFLAGS $CPPFLAGS.
 AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported])
 AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [
@@ -77,108 +75,171 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
   ])
   AC_MSG_RESULT([$gl_cv_cc_nomfi_needed])
 fi
+
+dnl Next, check if -Werror -Wuninitialized is useful with the
+dnl user's choice of $CFLAGS; some versions of gcc warn that it
+dnl has no effect if -O is not also used
+AC_MSG_CHECKING([whether -Wuninitialized is supported])
+AC_CACHE_VAL([gl_cv_cc_uninitialized_supported], [
+  gl_save_CFLAGS=$CFLAGS
+  CFLAGS=$CFLAGS -Werror -Wuninitialized
+  AC_COMPILE_IFELSE(
+[AC_LANG_PROGRAM([[]], [[]])],
+[gl_cv_cc_uninitialized_supported=yes],
+[gl_cv_cc_uninitialized_supported=no])
+  CFLAGS=$gl_save_CFLAGS])
+AC_MSG_RESULT([$gl_cv_cc_uninitialized_supported])
+
   fi
 
+  # List all gcc warning categories.
+  # To compare this list to your installed GCC's, run this Bash command:
+  #
+  # comm -3 \
+  #  (sed -n 's/^  *\(-[^ ]*\) .*/\1/p' manywarnings.m4 | sort) \
+  #  (gcc --help=warnings | sed -n 's/^  \(-[^ ]*\) .*/\1/p' | sort |
+  #  grep -v -x -f (
+  # awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec))
+
   gl_manywarn_set=
   for gl_manywarn_item in \
--Wall \
 -W \
--Wformat-y2k \
--Wformat-nonliteral \
--Wformat-security \
--Winit-self \
--Wmissing-include-dirs \
--Wswitch-default \
--Wswitch-enum \
--Wunused \
--Wunknown-pragmas \
--Wstrict-aliasing \
--Wstrict-overflow \
--Wsystem-headers \
--Wfloat-equal \
--Wtraditional \
--Wtraditional-conversion \
--Wdeclaration-after-statement \
--Wundef \
--Wshadow \
--Wunsafe-loop-optimizations \
--Wpointer-arith \
--Wbad-function-cast \
--Wc++-compat \
--Wcast-qual \
--Wcast-align \
--Wwrite-strings \
--Wconversion \
--Wsign-conversion \
--Wlogical-op \
--Waggregate-return \
--Wstrict-prototypes \
--Wold-style-definition \
--Wmissing-prototypes \
--Wmissing-declarations \
--Wmissing-noreturn \
--Wmissing-format-attribute \
--Wpacked \
--Wpadded \
--Wredundant-decls \
--Wnested-externs \
--Wunreachable-code \
--Winline \
--Winvalid-pch \
--Wlong-long \
--Wvla \
--Wvolatile-register-var \
--Wdisabled-optimization \
--Wstack-protector \
--Woverlength-strings \
--Wbuiltin-macro-redefined \
--Wmudflap \
--Wpacked-bitfield-compat \
--Wsync-nand \
-; do
-gl_manywarn_set=$gl_manywarn_set $gl_manywarn_item
-  done
-  # The following are not documented in the manual but are included in
-  # output from gcc --help=warnings.
-  for gl_manywarn_item in \
--Wattributes \
--Wcoverage-mismatch \
--Wmultichar \
--Wunused-macros \
-; do
-gl_manywarn_set=$gl_manywarn_set $gl_manywarn_item
-  done
-  # More warnings from gcc 4.6.2 --help=warnings.
-  for gl_manywarn_item in \
 -Wabi \
+-Waddress \
+-Waggressive-loop-optimizations \
+

[libvirt] [v2 PATCH] qemu: Improve error output for virDomainListGetStats

2014-11-04 Thread Luyao Huang
A unsupport error will output from qemuConnectGetAllDomainStats. Add a
check for the flags in qemuConnectGetAllDomainStats and improve the error
in the current implementation.From manual of virsh:
The approaches can't be combined.

Improve error to:

error: --domain and --list-* flags are mutually exclusive

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

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6acaea8..60c3882 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18487,13 +18487,18 @@ qemuConnectGetAllDomainStats(virConnectPtr conn,
 unsigned int privflags = 0;
 unsigned int domflags = 0;
 
-if (ndoms)
-virCheckFlags(VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS, -1);
-else
-virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE |
-  VIR_CONNECT_LIST_DOMAINS_FILTERS_PERSISTENT |
-  VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE |
-  VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS, -1);
+if (ndoms  (flags  (VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE |
+   VIR_CONNECT_LIST_DOMAINS_FILTERS_PERSISTENT |
+   VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE))) {
+virReportInvalidArg(flags, %s,
+_(--domain and --list-* flags are mutually exclusive));
+return -1;
+}
+
+virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE |
+  VIR_CONNECT_LIST_DOMAINS_FILTERS_PERSISTENT |
+  VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE |
+  VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS, -1);
 
 if (virConnectGetAllDomainStatsEnsureACL(conn)  0)
 return -1;
-- 
1.8.3.1

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


Re: [libvirt] [PATCHv3 02/16] Domain conf: allow more than one IP address for net devices

2014-11-04 Thread Daniel P. Berrange
On Tue, Nov 04, 2014 at 01:43:58PM +0100, Cedric Bosdonnat wrote:
 Hi Daniel,
 
 On Wed, 2014-10-22 at 11:03 +0100, Daniel P. Berrange wrote:
  I think it is probably worth a followup patch to make drivers
  report VIR_ERR_CONFIG_UNSUPPORTED in the case where  nips  1
  and the driver only supports nips==1.
 
 Shouldn't we just VIR_WARN this? That would avoid breaking as we could
 get the first ip address...

No, it is policy that if we don't support something we must always
return an error to the application. If we only warned, then there is
no way for an application to detect if the feature works or not.

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] domain: Improve error output for virDomainListGetStats

2014-11-04 Thread Luyao Huang
Thanks your advise :) and I have moved the check 
in qemuConnectGetAllDomainStats.

And the v2:

https://www.redhat.com/archives/libvir-list/2014-November/msg00069.html

Thanks,
Luyao Huang

- Original Message -
From: Peter Krempa pkre...@redhat.com
To: Luyao Huang lhu...@redhat.com, libvir-list@redhat.com
Sent: Tuesday, November 4, 2014 7:20:45 PM
Subject: Re: [libvirt] [PATCH] domain: Improve error output for 
virDomainListGetStats

On 11/04/14 07:51, Luyao Huang wrote:
 When pass flags --domain and --list-* to cmdDomstats,
 a unsupport error will output from qemuConnectGetAllDomainStats.
 
 error: unsupported flags (0x1) in function qemuConnectGetAllDomainStats
 
From manual of virsh: The approaches can't be combined.
 
 Improve error to:
 
 error: --domain and --list-* flags are mutually exclusive
 
 Signed-off-by: Luyao Huang lhu...@redhat.com
 ---
  src/libvirt-domain.c | 13 +
  1 file changed, 13 insertions(+)
 
 diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
 index 7dc3146..6ae6dd2 100644
 --- a/src/libvirt-domain.c
 +++ b/src/libvirt-domain.c
 @@ -11053,6 +11053,19 @@ virDomainListGetStats(virDomainPtr *doms,
  goto cleanup;
  }
  
 +if (flags  (VIR_CONNECT_LIST_DOMAINS_ACTIVE |
 + VIR_CONNECT_LIST_DOMAINS_INACTIVE |
 + VIR_CONNECT_LIST_DOMAINS_PERSISTENT |
 + VIR_CONNECT_LIST_DOMAINS_TRANSIENT |
 + VIR_CONNECT_LIST_DOMAINS_RUNNING |
 + VIR_CONNECT_LIST_DOMAINS_SHUTOFF |
 + VIR_CONNECT_LIST_DOMAINS_PAUSED |
 + VIR_CONNECT_LIST_DOMAINS_OTHER)) {
 +virReportInvalidArg(flags, %s,
 +_(--domain and --list-* flags are mutually exclusive));
 +goto cleanup;
 +}

From what I remember it was a deliberate design decision to avoid
reporting this error either from virsh or the library itself so that we
possibly can add the filtering later on.

This should be done in the qemu driver impl of the function so that we
can possibly do it later without breaking old clients

 +
  conn = doms[0]-conn;
  virCheckConnectReturn(conn, -1);
  
 

Peter

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


[libvirt] Local qemu migration

2014-11-04 Thread Marc-André Lureau
Hi,

Attempting to migration from session to system qemu fails because of the
following checks in  qemuMigrationCookieXMLParse():

   if (STREQ(mig-remoteHostname, mig-localHostname)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
   _(Attempt to migrate guest to the same host %s),
   mig-remoteHostname);
goto error;
}

if (memcmp(mig-remoteHostuuid, mig-localHostuuid, VIR_UUID_BUFLEN) ==
0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
   _(Attempt to migrate guest to the same host %s),
   tmp);
goto error;

Is there a technical limitation for this error? If not, could it be
overriden with an additional flag?

cheers

-- 
Marc-André Lureau
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] Local qemu migration

2014-11-04 Thread Cole Robinson

On 11/04/2014 10:43 AM, Marc-André Lureau wrote:

Hi,

Attempting to migration from session to system qemu fails because of the
following checks in  qemuMigrationCookieXMLParse():

if (STREQ(mig-remoteHostname, mig-localHostname)) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
_(Attempt to migrate guest to the same host %s),
mig-remoteHostname);
 goto error;
 }

 if (memcmp(mig-remoteHostuuid, mig-localHostuuid, VIR_UUID_BUFLEN) == 0) 
{
 virReportError(VIR_ERR_INTERNAL_ERROR,
_(Attempt to migrate guest to the same host %s),
tmp);
 goto error;

Is there a technical limitation for this error? If not, could it be overriden
with an additional flag?


Trying to prevent migrating to the same libvirtd instance which would 
historically deadlock in libvirt's qemu driver. But migrating session - 
system shouldn't suffer from that problem, so maybe it should be smarter.


Maybe with the more fine grained locking these days we can actually make 
localhost migration work? Would be useful for testing


- Cole

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


[libvirt] [Patch v6 0/5] Libvirt CPU enhancements for Power KVM

2014-11-04 Thread Prerna Saxena
This patch series is a collection of enhancements for PowerPC CPUs on PowerKVM.
The v5 of this series has been acked. I have just rebased the patches on top of 
latest master and added a testcase.

 Series Summary:
==
Patch 1/5 : Introduce a new architecture 'ppc64le' for libvirt.
Patch 2/5 : Add libvirt support for VMs running in 'compat' mode on Power KVM.
Patch 3/5 : Improve PVR handling to fall back to cpu generation.
Patch 4/5 : Add documentation describing compat mode usage for PowerPC guests.
Patch 5/5 : Add a test case for compat mode.

 Detail:

* PowerPC has traditionally been a Big-endian architecture. However, with 
PowerPC ISA version 2.07, it can run in Little-endian mode as well. IBM Power8 
processors, compliant with ISA 2.07 allow launching VMs in little-endian mode. 
This is signified by 'ppc64le' architecture. Patch 1 adds this support to 
libvirt, to allow running VMs based on ppc64le architecture.

* Patch 2,3 tweak libvirt to correctly model PowerPC CPUs based on recent 
PowerKVM implementation.

PowerKVM permits VMs with vcpus in the following allowed modes :
i) Host native mode:
  where the vcpu seen in the VM belongs to the same processor generation as 
the host.
  Example: A POWER7 host, conforming to PowerISA version 2.06, will run VMs 
with power7 vcpus.
ii) Binary Compatibility (compat) mode:
  PowerISA allows processors to run VMs in binary compatibility (compat) 
mode supporting an older version of ISA.
  As an example: In compatibility mode, a POWER7 host can run a power6 
VM, conforming to power ISA v2.05.
  Similarly, a POWER8 host can run a power7 VM conforming to PowerISA 
v2.06.

QEMU has recently added support to explicitly denote a VM running in 
compatibility mode through commits 6d9412ea  8dfa3a5e85. Henceforth, VMs of 
type (i) will be invoked with the QEMU invocation -cpu host, while VMs of 
type (ii) will be invoked using -cpu host, compat=power6.
Now, an explicit cpu selection using -cpu POWER6 is not valid. Instead, the 
recommended practice is to use the matching compat mode, if the requested cpu 
type differs from the host.
Patches 2-3 address various aspects of this change.

* Patch 2 : Adds support for generating the correct command line for QEMU. 
Existing xml semantics of 'host-model' are interpreted differently on PowerPc 
architecture to signify this type.

* Patch 3 : PowerKVM vCPUs differ uniquely across generations ( such as power6, 
power7, power8). Each generation signifies a new PowerISA version that exhibits 
features unique to that generation. The higher order 16 bits of PVR denote the 
processor generation and the lower order 16 bits denote the cpu chip 
(sub)version.
For all practical purposes of launching a VM, we care about the generation the 
vCPU will belong to, and not specifically the chip version. In fact, PowerKVM 
does not seek out specification of a unique chip version(such as POWER7_v2.3) 
for running a vCPU. This patch updates the libvirt PVR check to reflect this 
relationship.

* Patch 4 : Documentation is added to explain functionality introduced by Patch 
2.
* Patch 5 : Added a test case for patch 2.

 Changelog:
=
v1 : https://www.redhat.com/archives/libvir-list/2014-June/msg01338.html
v2 : http://www.redhat.com/archives/libvir-list/2014-October/msg00351.html
v3 : http://www.mail-archive.com/libvir-list@redhat.com/msg104010.html
v4 : http://www.mail-archive.com/libvir-list@redhat.com/msg104067.html
v5 : http://www.mail-archive.com/libvir-list@redhat.com/msg104311.html 

Changes since v5:

* Added a new patch which introduces a test case for compat mode.
* Fixed a whitespace in documentation patch #4.
* Added listing for Power8e cpu model in cpu_map.xml


Regards,
-- 
Prerna Saxena

Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India

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


[libvirt] [PATCH v6 1/5] Cpu: Add support for Power LE Architecture.

2014-11-04 Thread Prerna Saxena

From 0c8b80da2f3ea85f65d5b6a7b841433d5162a3bd Mon Sep 17 00:00:00 2001
From: Pradipta Kr. Banerjee bpra...@in.ibm.com
Date: Tue, 28 Oct 2014 14:41:59 +0530
Subject: [PATCH 1/5] Cpu: Add support for Power LE Architecture.

This adds support for PowerPC Little Endian architecture.,
and allows libvirt to spawn VMs based on 'ppc64le' architecture.

Signed-off-by: Pradipta Kr. Banerjee bpra...@in.ibm.com
Signed-off-by: Prerna Saxena pre...@linux.vnet.ibm.com
Acked-by: Michal Privoznik mpriv...@redhat.com
---
 src/conf/domain_conf.c   |  2 +-
 src/cpu/cpu_powerpc.c|  2 +-
 src/qemu/qemu_capabilities.c |  6 +++---
 src/qemu/qemu_command.c  | 22 +++---
 src/qemu/qemu_domain.c   |  1 +
 src/util/virarch.h   |  3 +++
 6 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1b8efb1..21309b0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10043,7 +10043,7 @@ virDomainVideoDefaultType(const virDomainDef *def)
 (STREQ(def-os.type, xen) ||
  STREQ(def-os.type, linux)))
 return VIR_DOMAIN_VIDEO_TYPE_XEN;
-else if (def-os.arch == VIR_ARCH_PPC64)
+else if ARCH_IS_PPC64(def-os.arch)
 return VIR_DOMAIN_VIDEO_TYPE_VGA;
 else
 return VIR_DOMAIN_VIDEO_TYPE_CIRRUS;
diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
index 67cb9ff..d591c18 100644
--- a/src/cpu/cpu_powerpc.c
+++ b/src/cpu/cpu_powerpc.c
@@ -38,7 +38,7 @@
 
 VIR_LOG_INIT(cpu.cpu_powerpc);
 
-static const virArch archs[] = { VIR_ARCH_PPC64 };
+static const virArch archs[] = { VIR_ARCH_PPC64, VIR_ARCH_PPC64LE };
 
 struct ppc_vendor {
 char *name;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index ec6614a..2505d32 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -633,7 +633,7 @@ virQEMUCapsProbeCPUModels(virQEMUCapsPtr qemuCaps, uid_t 
runUid, gid_t runGid)
 if (qemuCaps-arch == VIR_ARCH_I686 ||
 qemuCaps-arch == VIR_ARCH_X86_64) {
 parse = virQEMUCapsParseX86Models;
-} else if (qemuCaps-arch == VIR_ARCH_PPC64) {
+} else if ARCH_IS_PPC64(qemuCaps-arch) {
 parse = virQEMUCapsParsePPCModels;
 } else {
 VIR_DEBUG(don't know how to parse %s CPU models,
@@ -2003,7 +2003,7 @@ bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps,
 return true;
 
 if (def-os.arch == VIR_ARCH_PPC ||
-def-os.arch == VIR_ARCH_PPC64) {
+ARCH_IS_PPC64(def-os.arch)) {
 /*
  * Usage of pci.0 naming:
  *
@@ -3575,7 +3575,7 @@ virQEMUCapsSupportsChardev(virDomainDefPtr def,
 !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
 return false;
 
-if ((def-os.arch == VIR_ARCH_PPC) || (def-os.arch == VIR_ARCH_PPC64)) {
+if ((def-os.arch == VIR_ARCH_PPC) || ARCH_IS_PPC64(def-os.arch)) {
 /* only pseries need -device spapr-vty with -chardev */
 return (chr-deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL 
 chr-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 917639e..96071d8 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -714,7 +714,7 @@ qemuSetSCSIControllerModel(virDomainDefPtr def,
 return -1;
 }
 } else {
-if ((def-os.arch == VIR_ARCH_PPC64) 
+if (ARCH_IS_PPC64(def-os.arch) 
 STRPREFIX(def-os.machine, pseries)) {
 *model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI;
 } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) {
@@ -1265,7 +1265,7 @@ int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def,
 
 for (i = 0; i  def-nserials; i++) {
 if (def-serials[i]-deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL 
-(def-os.arch == VIR_ARCH_PPC64) 
+ARCH_IS_PPC64(def-os.arch) 
 STRPREFIX(def-os.machine, pseries))
 def-serials[i]-info.type = 
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
 if (qemuAssignSpaprVIOAddress(def, def-serials[i]-info,
@@ -1274,7 +1274,7 @@ int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def,
 }
 
 if (def-nvram) {
-if (def-os.arch == VIR_ARCH_PPC64 
+if (ARCH_IS_PPC64(def-os.arch) 
 STRPREFIX(def-os.machine, pseries))
 def-nvram-info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
 if (qemuAssignSpaprVIOAddress(def, def-nvram-info,
@@ -4196,7 +4196,7 @@ qemuBuildUSBControllerDevStr(virDomainDefPtr domainDef,
 model = def-model;
 
 if (model == -1) {
-if (domainDef-os.arch == VIR_ARCH_PPC64)
+if ARCH_IS_PPC64(domainDef-os.arch)
 model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI;
 else
 model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI;
@@ -8579,7 +8579,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 

[libvirt] [PATCH v6 2/5] PowerPC : Add support for launching VM in 'compat' mode.

2014-11-04 Thread Prerna Saxena

From 3ad5caf37bfa48e43c88660255e6a3bbb8afddeb Mon Sep 17 00:00:00 2001
From: Prerna Saxena pre...@linux.vnet.ibm.com
Date: Tue, 28 Oct 2014 15:05:59 +0530


PowerISA allows processors to run VMs in binary compatibility (compat)
mode supporting an older version of ISA. QEMU has recently added support to
explicitly denote a VM running in compatibility mode through commit 6d9412ea
 8dfa3a5e85.
Now, a compat mode VM can be run by invoking this qemu commandline on a
POWER8 host:  -cpu host,compat=power7.

This patch allows libvirt to exploit cpu mode 'host-model' to describe this
new mode for PowerKVM guests. As an example:
When a user wants to request a power7 vm to run in compatibility mode on
a Power8 host, this can be described in XML as follows :
  cpu mode='host-model'
modelpower7/model
  /cpu

Signed-off-by: Prerna Saxena pre...@linux.vnet.ibm.com
Signed-off-by: Li Zhang zhlci...@linux.vnet.ibm.com
Signed-off-by: Pradipta Kr. Banerjee bpra...@in.ibm.com
Acked-by: Michal Privoznik mpriv...@redhat.com
---
 src/conf/cpu_conf.c |  1 +
 src/cpu/cpu_powerpc.c   | 11 ++-
 src/qemu/qemu_command.c | 10 +-
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 9b7fbb0..0e7a979 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -619,6 +619,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
 return 0;
 
 formatModel = (def-mode == VIR_CPU_MODE_CUSTOM ||
+   def-mode == VIR_CPU_MODE_HOST_MODEL ||
(flags  VIR_DOMAIN_XML_UPDATE_CPU));
 formatFallback = (def-type == VIR_CPU_TYPE_GUEST 
   (def-mode == VIR_CPU_MODE_HOST_MODEL ||
diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
index d591c18..4ea1835 100644
--- a/src/cpu/cpu_powerpc.c
+++ b/src/cpu/cpu_powerpc.c
@@ -562,8 +562,8 @@ ppcUpdate(virCPUDefPtr guest,
 static virCPUDefPtr
 ppcBaseline(virCPUDefPtr *cpus,
 unsigned int ncpus,
-const char **models,
-unsigned int nmodels,
+const char **models ATTRIBUTE_UNUSED,
+unsigned int nmodels ATTRIBUTE_UNUSED,
 unsigned int flags)
 {
 struct ppc_map *map = NULL;
@@ -583,13 +583,6 @@ ppcBaseline(virCPUDefPtr *cpus,
 goto error;
 }
 
-if (!cpuModelIsAllowed(model-name, models, nmodels)) {
-virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-_(CPU model %s is not supported by hypervisor),
-model-name);
-goto error;
-}
-
 for (i = 0; i  ncpus; i++) {
 const struct ppc_vendor *vnd;
 
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 96071d8..1333c35 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6222,7 +6222,9 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
 *hasHwVirt = hasSVM  0 ? true : false;
 }
 
-if (cpu-mode == VIR_CPU_MODE_HOST_PASSTHROUGH) {
+if ((cpu-mode == VIR_CPU_MODE_HOST_PASSTHROUGH) ||
+((cpu-mode == VIR_CPU_MODE_HOST_MODEL) 
+  ARCH_IS_PPC64(def-os.arch))) {
 const char *mode = virCPUModeTypeToString(cpu-mode);
 if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_HOST)) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -6237,6 +6239,12 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
 goto cleanup;
 }
 virBufferAddLit(buf, host);
+
+if (ARCH_IS_PPC64(def-os.arch) 
+cpu-mode == VIR_CPU_MODE_HOST_MODEL) {
+virBufferAsprintf(buf, ,compat=%s, def-cpu-model);
+}
+
 } else {
 if (VIR_ALLOC(guest)  0)
 goto cleanup;
-- 
1.9.3

-- 
Prerna Saxena

Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India

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


[libvirt] [PATCH v6 3/5]PowerPC:Improve PVR handling to fall back to cpu generation.

2014-11-04 Thread Prerna Saxena

From eebc1544e28a134ce99d39b663f09ffa89b8064a Mon Sep 17 00:00:00 2001
From: Prerna Saxena pre...@linux.vnet.ibm.com
Date: Tue, 28 Oct 2014 15:30:05 +0530

IBM Power processors differ uniquely across generations (such as power6,
power7, power8). Each generation signifies a new PowerISA version
that exhibits features unique to that generation.
The higher 16 bits of PVR for IBM Power processors encode the CPU
generation, while the CPU chip (sub)version is encoded in lower 16 bits.

For all practical purposes of launching a VM, we care about the
generation which the vCPU will belong to, and not specifically the chip
version. This patch updates the libvirt PVR check to reflect this
relationship. It allows libvirt to select the right CPU generation
in case the exact match for a a specific CPU is not found.
Hence, there will no longer be a need to add each PowerPC CPU model to
cpu_map.xml; just adding entry for the matching ISA generation will
suffice.

It also contains changes to cpu_map.xml since processor generations
as understood by QEMU compat mode go as power6, power7 or power8
[Reference : QEMU commit 8dfa3a5e85 ]

Signed-off-by: Prerna Saxena pre...@linux.vnet.ibm.com
Signed-off-by: Pradipta Kr. Banerjee bpra...@in.ibm.com
Signed-off-by: Anton Blanchard an...@samba.org
Acked-by: Michal Privoznik mpriv...@redhat.com
---
 src/cpu/cpu_map.xml   | 30 ++
 src/cpu/cpu_powerpc.c |  8 
 2 files changed, 38 insertions(+)

diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
index 18c7b0d..bd9b056 100644
--- a/src/cpu/cpu_map.xml
+++ b/src/cpu/cpu_map.xml
@@ -627,5 +627,35 @@
   pvr value='0x004b0100'/
 /model
 
+model name='power6'
+  vendor name='IBM'/
+  compat isa='2.05'/
+  pvr value='0x003e'/
+/model
+
+model name='power7'
+  vendor name='IBM'/
+  compat isa='2.06'/
+  pvr value='0x003f'/
+/model
+
+model name='power7+'
+  vendor name='IBM'/
+  compat isa='2.06B'/
+  pvr value='0x004a'/
+/model
+
+model name='power8e'
+  vendor name='IBM'/
+  compat isa='2.07'/
+  pvr value='0x004b'/
+/model
+
+model name='power8'
+  vendor name='IBM'/
+  compat isa='2.07'/
+  pvr value='0x004d'/
+/model
+
   /arch
 /cpus
diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
index 4ea1835..531868c 100644
--- a/src/cpu/cpu_powerpc.c
+++ b/src/cpu/cpu_powerpc.c
@@ -99,6 +99,14 @@ ppcModelFindPVR(const struct ppc_map *map,
 model = model-next;
 }
 
+/* PowerPC Processor Version Register is interpreted as follows :
+ * Higher order 16 bits : Power ISA generation.
+ * Lower order 16 bits : CPU chip version number.
+ * If the exact CPU isnt found, return the nearest matching CPU generation
+ */
+if (pvr  0xul)
+return ppcModelFindPVR(map, (pvr  0xul));
+
 return NULL;
 }
 
-- 
1.9.3

-- 
Prerna Saxena

Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India

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


[libvirt] [PATCH v6 4/5] docs: Add documentation for compat mode.

2014-11-04 Thread Prerna Saxena

From 23f49711d74fae7905defa1524d7e4ab838c7838 Mon Sep 17 00:00:00 2001
From: Prerna Saxena pre...@linux.vnet.ibm.com
Date: Fri, 31 Oct 2014 15:13:16 +0530


Add documentation to explain how compat-mode can be invoked with libvirt
running on PowerPC architecture.
It also mentions that this change is available libvirt 1.2.11 onwards.

Signed-off-by: Prerna Saxena pre...@linux.vnet.ibm.com
---
 docs/formatdomain.html.in | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0099ce7..bdaf808 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1047,7 +1047,20 @@
   (such as CPUID level) that don't work. Until these issues are fixed,
   it's a good idea to avoid using codehost-model/code and use
   codecustom/code mode with just the CPU model from host
-  capabilities XML./dd
+  capabilities XML.
+  span class=since(Since 1.2.11)/span. PowerISA allows
+  processors to run VMs in binary compatibility mode supporting an
+  older version of ISA.  Libvirt on PowerPC architecture uses the
+  codehost-model/code to signify a guest mode CPU running in
+  binary compatibility mode. Example:
+  When a user needs a power7 VM to run in compatibility mode
+  on a Power8 host, this can be described in XML as follows :
+pre
+  lt;cpu mode='host-model'gt;
+lt;modelgt;power7lt;/modelgt;
+  lt;/cpugt;
+  .../pre
+  /dd
   dtcodehost-passthrough/code/dt
   ddWith this mode, the CPU visible to the guest should be exactly
   the same as the host CPU even in the aspects that libvirt does not
-- 
1.9.3

-- 
Prerna Saxena

Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India

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


[libvirt] [PATCH v6 5/5]Test: Add a testcase for PowerPC compat mode cpu specification.

2014-11-04 Thread Prerna Saxena

From 88879d7eac1237b2f6ef67cb5890cb46055d56dc Mon Sep 17 00:00:00 2001
From: Prerna Saxena pre...@linux.vnet.ibm.com
Date: Mon, 3 Nov 2014 15:53:08 +0530

This introduces a testcase for PowerPC compat mode cpu specification.

Signed-off-by: Prerna Saxena pre...@linux.vnet.ibm.com
---
 .../qemuxml2argv-pseries-cpu-compat.args |  8 
 .../qemuxml2argv-pseries-cpu-compat.xml  | 20 
 tests/qemuxml2argvtest.c |  2 ++
 3 files changed, 30 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.xml

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args 
b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args
new file mode 100644
index 000..64df406
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args
@@ -0,0 +1,8 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
+QEMU_AUDIO_DRV=none /usr/bin/qemu-system-ppc64 -S -M pseries \
+-cpu host,compat=power7 \
+-m 214 -smp 4 -nographic -nodefconfig -nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -usb \
+-chardev pty,id=charserial0 \
+-device spapr-vty,chardev=charserial0,reg=0x3000
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.xml
new file mode 100644
index 000..e34a8ad
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.xml
@@ -0,0 +1,20 @@
+domain type='kvm'
+  nameQEMUGuest1/name
+  memory unit='KiB'219100/memory
+  currentMemory unit='KiB'219100/currentMemory
+  vcpu placement='static'4/vcpu
+  os
+type arch='ppc64' machine='pseries'hvm/type
+  /os
+  cpu mode='host-model'
+modelpower7/model
+  /cpu
+  clock offset='utc'/
+  devices
+  emulator/usr/bin/qemu-system-ppc64/emulator
+  console type='pty'
+address type=spapr-vio/
+  /console
+  memballoon model=none/
+  /devices
+/domain
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index abdf516..2a1ca4b 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1308,6 +1308,8 @@ mymain(void)
 QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
 DO_TEST(pseries-cpu-exact, QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
 QEMU_CAPS_NODEFCONFIG);
+DO_TEST(pseries-cpu-compat, QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST,
+QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
 DO_TEST(disk-ide-drive-split,
 QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
 QEMU_CAPS_IDE_CD);
-- 
1.9.3

-- 
Prerna Saxena

Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India

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


Re: [libvirt] Release of libvirt-python-1.2.10

2014-11-04 Thread Jason Helfman
On Mon, Nov 3, 2014 at 1:21 AM, Daniel Veillard veill...@redhat.com wrote:

  I also tagged and pushed a new version of libvirt-python,
 it is available at:

   ftp://libvirt.org/libvirt/python

 it handle the new header split in libvirt-1.2.10 and fixes a
 number of issues:

 Documentation:
 d Change the comment in getPyNodeCPUCount method reflecting correct called
 methods (Pradipta Kr. Banerjee)

 Bug Fixes:
 b virDomainBlockCopy: initialize flags to 0 (Pavel Hrdina)
 b flags cannot get right value for blockCopy function (Pavel Hrdina)
 b Fix rest of unsigned integer handling (Peter Krempa)
 b Fix parsing of 'flags' argument for bulk stats functions (Luyao Huang)
 b Fix function name when parsing arguments in libvirt_virNodeAllocPages
 (Peter Krempa)

 Improvements:
 i fix libvirt headers list (Dmitry Guryanov)
 i Improve error output when use getTime with a nonzero flags. (Luyao Huang)
 i setup.py: fix rpm build to return 1 on error (Pavel Hrdina)
 i sanitytest: define long for python version = 3 (Martin Kletzander)
 i sanitytest: count with the fact that large enums can be long (Martin
 Kletzander)
 i sanitytest: check for exported enums (Martin Kletzander)

   Thanks everybody who contributed to this release !

 Daniel


Hello All,

I am not able to build this, and receive this error.

building 'libvirtmod' extension
cc -DNDEBUG -O2 -pipe -fstack-protector -fno-strict-aliasing -fPIC -I.
-I/usr/local/include/python2.7 -c libvirt-override.c -o
build/temp.freebsd-10.0-RELEASE-p10-amd64-2.7/libvirt-override.o
-I/usr/local/include
In file included from libvirt-override.c:21:
/usr/local/include/libvirt/libvirt.h:92:11: fatal error:
'libvirt/libvirt-host.h' file not found
# include libvirt/libvirt-host.h
  ^
1 error generated.
error: command 'cc' failed with exit status 1
*** Error code 1

Any ideas?

I do have libvirt installed

Thanks!

-jgh

-- 
Jason Helfman  | FreeBSD Committer
j...@freebsd.org | http://people.freebsd.org/~jgh  | The Power to Serve
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] Release of libvirt-python-1.2.10

2014-11-04 Thread Jason Helfman
On Tue, Nov 4, 2014 at 10:49 AM, Jason Helfman j...@freebsd.org wrote:


 On Mon, Nov 3, 2014 at 1:21 AM, Daniel Veillard veill...@redhat.com
 wrote:

  I also tagged and pushed a new version of libvirt-python,
 it is available at:

   ftp://libvirt.org/libvirt/python

 it handle the new header split in libvirt-1.2.10 and fixes a
 number of issues:

 Documentation:
 d Change the comment in getPyNodeCPUCount method reflecting correct
 called methods (Pradipta Kr. Banerjee)

 Bug Fixes:
 b virDomainBlockCopy: initialize flags to 0 (Pavel Hrdina)
 b flags cannot get right value for blockCopy function (Pavel Hrdina)
 b Fix rest of unsigned integer handling (Peter Krempa)
 b Fix parsing of 'flags' argument for bulk stats functions (Luyao Huang)
 b Fix function name when parsing arguments in libvirt_virNodeAllocPages
 (Peter Krempa)

 Improvements:
 i fix libvirt headers list (Dmitry Guryanov)
 i Improve error output when use getTime with a nonzero flags. (Luyao
 Huang)
 i setup.py: fix rpm build to return 1 on error (Pavel Hrdina)
 i sanitytest: define long for python version = 3 (Martin Kletzander)
 i sanitytest: count with the fact that large enums can be long (Martin
 Kletzander)
 i sanitytest: check for exported enums (Martin Kletzander)

   Thanks everybody who contributed to this release !

 Daniel


 Hello All,

 I am not able to build this, and receive this error.

 building 'libvirtmod' extension
 cc -DNDEBUG -O2 -pipe -fstack-protector -fno-strict-aliasing -fPIC -I.
 -I/usr/local/include/python2.7 -c libvirt-override.c -o
 build/temp.freebsd-10.0-RELEASE-p10-amd64-2.7/libvirt-override.o
 -I/usr/local/include
 In file included from libvirt-override.c:21:
 /usr/local/include/libvirt/libvirt.h:92:11: fatal error:
 'libvirt/libvirt-host.h' file not found
 # include libvirt/libvirt-host.h
   ^
 1 error generated.
 error: command 'cc' failed with exit status 1
 *** Error code 1

 Any ideas?

 I do have libvirt installed

 Thanks!

 -jgh


I believe I found the issue. Please disregard.

-jgh

-- 
Jason Helfman  | FreeBSD Committer
j...@freebsd.org | http://people.freebsd.org/~jgh  | The Power to Serve
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] Release of libvirt-python-1.2.10

2014-11-04 Thread Daniel Veillard
On Tue, Nov 04, 2014 at 10:49:46AM -0800, Jason Helfman wrote:
 On Mon, Nov 3, 2014 at 1:21 AM, Daniel Veillard veill...@redhat.com wrote:
 
   I also tagged and pushed a new version of libvirt-python,
  it is available at:
 
ftp://libvirt.org/libvirt/python
 
  it handle the new header split in libvirt-1.2.10 and fixes a
  number of issues:
 
  Documentation:
  d Change the comment in getPyNodeCPUCount method reflecting correct called
  methods (Pradipta Kr. Banerjee)
 
  Bug Fixes:
  b virDomainBlockCopy: initialize flags to 0 (Pavel Hrdina)
  b flags cannot get right value for blockCopy function (Pavel Hrdina)
  b Fix rest of unsigned integer handling (Peter Krempa)
  b Fix parsing of 'flags' argument for bulk stats functions (Luyao Huang)
  b Fix function name when parsing arguments in libvirt_virNodeAllocPages
  (Peter Krempa)
 
  Improvements:
  i fix libvirt headers list (Dmitry Guryanov)
  i Improve error output when use getTime with a nonzero flags. (Luyao Huang)
  i setup.py: fix rpm build to return 1 on error (Pavel Hrdina)
  i sanitytest: define long for python version = 3 (Martin Kletzander)
  i sanitytest: count with the fact that large enums can be long (Martin
  Kletzander)
  i sanitytest: check for exported enums (Martin Kletzander)
 
Thanks everybody who contributed to this release !
 
  Daniel
 
 
 Hello All,
 
 I am not able to build this, and receive this error.
 
 building 'libvirtmod' extension
 cc -DNDEBUG -O2 -pipe -fstack-protector -fno-strict-aliasing -fPIC -I.
 -I/usr/local/include/python2.7 -c libvirt-override.c -o
 build/temp.freebsd-10.0-RELEASE-p10-amd64-2.7/libvirt-override.o
 -I/usr/local/include
 In file included from libvirt-override.c:21:
 /usr/local/include/libvirt/libvirt.h:92:11: fatal error:
 'libvirt/libvirt-host.h' file not found
 # include libvirt/libvirt-host.h
   ^
 1 error generated.
 error: command 'cc' failed with exit status 1
 *** Error code 1
 
 Any ideas?
 
 I do have libvirt installed

  You need libvirt-1.2.10 or later installed, because of the
header split for the drivers,

Daniel

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

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


Re: [libvirt] [PATCH] qemu: don't setup cpuset.mems if memory mode in numatune is 'preferred'

2014-11-04 Thread Wang Rui
On 2014/11/4 22:04, Martin Kletzander wrote:
 On Tue, Nov 04, 2014 at 09:22:22PM +0800, Wang Rui wrote:
 If the memory mode is specified as preferred, we get the following error when
 starting domain.

 error: Unable to write to '$my_cgroup_path/cpuset.mems': Device or resource 
 busy

 XML is configured with numatune as follows:
  numatune
memory mode='preferred' nodeset='0'/
  /numatune

 If memory mode is 'preferred', cpuset.mems in cgroup shouldn't be set to
 'nodeset'. I find that maybe commit 1a7be8c600905aa07ac2d78293336ba8523ad48e
 changes the former logic of checking mode in virDomainNumatuneGetNodeset.

 Signed-off-by: Wang Rui moon.wang...@huawei.com
 ---
 src/qemu/qemu_cgroup.c | 5 +
 1 file changed, 5 insertions(+)

 
 Thanks for catching that, it definitely is a problem, but I think it
 is cause by commit 93e82727ec11d471d2ef3a18835e1fdfe062cef1.
 
 It should be also fixed in virLXCCgroupSetupCpusetTune() for LXC.
 
OK. I'll try to fix it for LXC in another patch.

 diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
 index b5bdb36..8685d6f 100644
 --- a/src/qemu/qemu_cgroup.c
 +++ b/src/qemu/qemu_cgroup.c
 @@ -618,6 +618,11 @@ qemuSetupCpusetMems(virDomainObjPtr vm,
 if (!virCgroupHasController(priv-cgroup, VIR_CGROUP_CONTROLLER_CPUSET))
 return 0;

 +if (virDomainNumatuneGetMode(vm-def-numatune, -1) !=
 +VIR_DOMAIN_NUMATUNE_MEM_STRICT) {
 +return 0;
 +}
 +
 
 One question, is it problem only for 'preferred' or 'interleaved' as
 well?  Because if it's only problem for 'preferred', then the check is
 wrong.  If it's problem for 'interleaved' as well, then the commit
 message is wrong.

'interleave' with a single node(such as nodeset='0') will cause the same error.
But 'interleave' mode should not live with a single node. So maybe there's
another bugfix to check 'interleave' with single node.

If configured with 'interleave' and multiple nodes(such as nodeset='0-1'),
VM can be started successfully. And cpuset.mems is set to the same nodeset.
So I'll revise my patch.

I'll send patches V2. Conclusion:

1/3 : add check for 'interleave' mode with single numa node
2/3 : fix this problem in qemu
3/3 : fix this problem in lxc

Is it OK?

 Anyway, after either one is fixed, I can push this.
 
 Thank you,
 Martin

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


Re: [libvirt] [v5][Patch 0/4] Libvirt CPU enhancements for Power KVM

2014-11-04 Thread Prerna Saxena

On Monday 03 November 2014 02:57 PM, Michal Privoznik wrote:
 On 31.10.2014 10:15, Prerna Saxena wrote:
 This patch series is a collection of enhancements for PowerPC CPUs on 
 PowerKVM.
 In this iteration, I have followed Dan's suggestion on using existing cpu 
 mode
 format to describe powerPC compatibility mode.
 Hope this can finally make it for 1.2.10 !

   Series Summary:
 ==
 Patch 1/4 : Introduce a new architecture 'ppc64le' for libvirt.
 Patch 2/4 : Add libvirt support for VMs running in 'compat' mode on Power 
 KVM.
 Patch 3/4 : Improve PVR handling to fall back to cpu generation.
 Patch 4/4 : Add documentation describing compat mode usage for PowerPC 
 guests.

 What am I missing here is a test case. Can you please add a qemuxml2argv test 
 case? Just send it as a follow up patch and I'll merge the code then.

 Michal

Hi Michal,
I have sent out a v6 of the patches rebased on top of latest master.
Apart from introducing a testcase, these have minor changes over v5.

Thanks for the review,

-- 
Prerna Saxena

Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India

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