[libvirt] [libvirt-test-api][PATCH] Add a new test case for getMemoryParameters

2015-05-04 Thread Luyao Huang
Signed-off-by: Luyao Huang lhu...@redhat.com
---
 cases/test_connection.conf  |  4 ++
 repos/virconn/connection_getMemoryParameters.py | 61 +
 2 files changed, 65 insertions(+)
 create mode 100644 repos/virconn/connection_getMemoryParameters.py

diff --git a/cases/test_connection.conf b/cases/test_connection.conf
index 914acac..3c08a95 100644
--- a/cases/test_connection.conf
+++ b/cases/test_connection.conf
@@ -69,3 +69,7 @@ storage:pool_uuid
 virconn:connection_getCellsFreeMemory
 conn
 qemu:///system
+
+virconn:connection_getMemoryParameters
+conn
+qemu:///system
diff --git a/repos/virconn/connection_getMemoryParameters.py 
b/repos/virconn/connection_getMemoryParameters.py
new file mode 100644
index 000..9b88fc3
--- /dev/null
+++ b/repos/virconn/connection_getMemoryParameters.py
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+
+import libvirt
+from libvirt import libvirtError
+from  utils import utils
+
+required_params = ()
+optional_params = {'conn': ''}
+node_memory = ['full_scans',
+   'merge_across_nodes',
+   'pages_shared',
+   'pages_sharing',
+   'pages_to_scan',
+   'pages_unshared',
+   'pages_volatile',
+   'sleep_millisecs']
+
+SYSFS_MEMORY_SHARED_PATH = '/sys/kernel/mm/ksm/'
+LIBVIRT_API_PATH = '/usr/share/libvirt/api/libvirt-api.xml'
+flags=0
+
+def check_memory_parameter(libvirt_dict, parameter_name):
+a = libvirt_dict.get('shm_%s' % parameter_name)
+try:
+b = long(open('%s%s' % (SYSFS_MEMORY_SHARED_PATH, 
parameter_name)).read())
+except IOError:
+logger.info(Cannot get file in path %s%s \
+% (SYSFS_MEMORY_SHARED_PATH, parameter_name))
+return 1
+logger.info(equal %s : libvirt get %u and we get %u\
+% (parameter_name, a, b))
+if a == b:
+return 0
+else:
+return 1
+
+def connection_getMemoryParameters(params):
+
+   test API for getMemoryParameters in class virConnect
+
+global logger
+logger = params['logger']
+fail=0
+
+try:
+conn=libvirt.open(params['conn'])
+
+logger.info(get connection to libvirtd)
+
+if utils.check_flags('getMemoryParameters', LIBVIRT_API_PATH) == 1:
+return 1
+
+param_dict=conn.getMemoryParameters()
+
+for n in node_memory:
+fail=check_memory_parameter(param_dict, n)
+
+except libvirtError, e:
+logger.error(API error message: %s % e.message)
+fail=1
+return fail
-- 
1.8.3.1

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


[libvirt] [PATCH] qemu: fix the vm deadlock when delete an unexist iothread

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

Jump to endjob instead of cleanup to fix this deadlock.

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

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3695b26..5e998c9 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6379,7 +6379,7 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver,
_(cannot find IOThread '%u' in persistent 
  iothreadids),
iothread_id);
-goto cleanup;
+goto endjob;
 }
 
 virDomainIOThreadIDDel(persistentDef, iothread_id);
-- 
1.8.3.1

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


Re: [libvirt] [PATCH] qemu: fix the vm deadlock when delete an unexist iothread

2015-05-04 Thread Ján Tomko
s/delete an unexist/delete a nonexistent/ in the summary

On Mon, May 04, 2015 at 05:36:16PM +0800, Luyao Huang wrote:
 https://bugzilla.redhat.com/show_bug.cgi?id=1218145
 
 Jump to endjob instead of cleanup to fix this deadlock.
 
 Signed-off-by: Luyao Huang lhu...@redhat.com
 ---
  src/qemu/qemu_driver.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 

ACK and pushed.

Jan


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

[libvirt] [PATCH] qemu: improve error message for domain stats API

2015-05-04 Thread Pavel Hrdina
Filtering specific list of domains is not supported yet.  Print a better
error message.

old error message:
error: unsupported flags (0x1) in function qemuConnectGetAllDomainStats

new error message:
error: using filters with list of domains is not implemented yet

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1143837

Signed-off-by: Pavel Hrdina phrd...@redhat.com
Signed-off-by: Luyao Huang lhu...@redhat.com
---

Based on https://www.redhat.com/archives/libvir-list/2014-November/msg00069.html
with different commit and error message.

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

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f8d493d..b88e2cc 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -19809,15 +19809,19 @@ qemuConnectGetAllDomainStats(virConnectPtr conn,
 unsigned int privflags = 0;
 unsigned int domflags = 0;
 
-if (ndoms)
-virCheckFlags(VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING |
-  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_BACKING |
-  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, _(using filters with list of domains 

+   is not implemented yet));
+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_BACKING |
+  VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS, -1);
 
 if (virConnectGetAllDomainStatsEnsureACL(conn)  0)
 return -1;
-- 
2.3.6

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


[libvirt] [PATCH] Bump version to 1.2.16 for new dev cycle

2015-05-04 Thread Jiri Denemark
Signed-off-by: Jiri Denemark jdene...@redhat.com
---

Pushed as trivial.

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

diff --git a/configure.ac b/configure.ac
index d5fb71d..6122fa5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,7 @@ dnl You should have received a copy of the GNU Lesser General 
Public
 dnl License along with this library.  If not, see
 dnl http://www.gnu.org/licenses/.
 
-AC_INIT([libvirt], [1.2.15], [libvir-list@redhat.com], [], 
[http://libvirt.org])
+AC_INIT([libvirt], [1.2.16], [libvir-list@redhat.com], [], 
[http://libvirt.org])
 AC_CONFIG_SRCDIR([src/libvirt.c])
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_HEADERS([config.h])
-- 
2.4.0

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


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

2015-05-04 Thread Matthias Gatto
On Thu, Apr 23, 2015 at 2:41 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.

 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)

 V2:
 -Rebase on master
 -Add Documentation

 V3:
 -Transforme the backingStore field in virStorageSource into
  an array of pointer instead of a pointer
 -Modify virStorageSourceSetBackingStore to allow it to expand
  the backingStore size.

 V4:
 -Rebase on master

 V5:
 -Rebase on master
 -patch 1-4/9: use patchs from John Ferlan
 -patch 4/9: check return of virStorageSourceSetBackingStore
 -patch 5/9: report type of error on virStorageSourceSetBackingStore

 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: change backingStore to backingStores.
   virstoragefile: Add quorum in virstoragefile
   domain_conf: Read and Write quorum config
   qemu: Add quorum support in qemuBuildDriveDevStr
   virstoragefile: Add node-name

  docs/formatdomain.html.in |  30 +-
  docs/schemas/domaincommon.rng |  26 -
  docs/schemas/storagecommon.rng|   1 +
  docs/schemas/storagevol.rng   |   1 +
  src/conf/domain_conf.c| 195 
 ++
  src/conf/storage_conf.c   |  23 ++--
  src/libvirt_private.syms  |   2 +
  src/qemu/qemu_cgroup.c|   4 +-
  src/qemu/qemu_command.c   | 114 
  src/qemu/qemu_domain.c|   2 +-
  src/qemu/qemu_driver.c|  39 ---
  src/qemu/qemu_migration.c |   1 +
  src/qemu/qemu_monitor_json.c  |   4 +-
  src/security/security_dac.c   |   2 +-
  src/security/security_selinux.c   |   4 +-
  src/security/virt-aa-helper.c |   2 +-
  src/storage/storage_backend.c |  22 ++--
  src/storage/storage_backend_fs.c  |  38 ---
  src/storage/storage_backend_gluster.c |  11 +-
  src/storage/storage_backend_logical.c |  15 ++-
  src/storage/storage_driver.c  |   3 +-
  src/util/virstoragefile.c | 122 ++---
  src/util/virstoragefile.h |  13 ++-
  tests/virstoragetest.c|  18 ++--
  24 files changed, 551 insertions(+), 141 deletions(-)

 --
 2.3.5

ping

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


Re: [libvirt] [PATCH 5/6] conf: Add helper to convert list of virDomains to a list of virDomainObjs

2015-05-04 Thread Michal Privoznik
On 30.04.2015 14:44, Peter Krempa wrote:
 Add virDomainObjListConvert that will take a list of virDomains, apply
 filters and return a list of virDomainObjs.
 ---
  src/conf/domain_conf.c   | 54 
 
  src/conf/domain_conf.h   |  9 
  src/libvirt_private.syms |  1 +
  3 files changed, 64 insertions(+)
 
 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
 index 66fe470..73dc33f 100644
 --- a/src/conf/domain_conf.c
 +++ b/src/conf/domain_conf.c
 @@ -23072,6 +23072,60 @@ virDomainObjListCollect(virDomainObjListPtr domlist,
 
 
  int
 +virDomainObjListConvert(virDomainObjListPtr domlist,
 +virConnectPtr conn,
 +virDomainPtr *doms,
 +size_t ndoms,
 +virDomainObjPtr **vms,
 +size_t *nvms,
 +virDomainObjListACLFilter filter,
 +unsigned int flags,
 +bool skip_missing)
 +{
 +char uuidstr[VIR_UUID_STRING_BUFLEN];
 +virDomainObjPtr vm;
 +size_t i;
 +
 +*nvms = 0;
 +*vms = NULL;
 +
 +virObjectLock(domlist);
 +for (i = 0; i  ndoms; i++) {
 +virDomainPtr dom = doms[i];
 +
 +virUUIDFormat(dom-uuid, uuidstr);
 +
 +if (!(vm = virHashLookup(domlist-objs, uuidstr))) {
 +if (!skip_missing) {
 +virReportError(VIR_ERR_NO_DOMAIN,
 +   _(no domain with matching uuid '%s' (%s)),
 +   uuidstr, dom-name);
 +virObjectUnlock(domlist);

Move Unlock() before the virReportError(). Not that it would matter,
but: a) it keeps list locked for shorter time b) I always felt like
ReportError() and goto error should be joined together.

 +goto error;
 +}
 +} else {
 +virObjectRef(vm);
 +
 +if (VIR_APPEND_ELEMENT(*vms, *nvms, vm)  0)

Please unlock the @domlist before jumping anywhere.

 +goto error;
 +}
 +}
 +virObjectUnlock(domlist);
 +
 +virDomainObjListFilter(vms, nvms, conn, filter, flags);
 +
 +return 0;
 +
 + error:
 +virObjectListFreeCount(*vms, *nvms);
 +*vms = NULL;
 +*nvms = 0;
 +
 +return -1;
 +}
 +
 +

Michal

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


Re: [libvirt] [PATCH 0/6] Refactor critical section in virDomainListAllDomains and fix qemuConnectGetAllDomainStats

2015-05-04 Thread Michal Privoznik
On 30.04.2015 14:44, Peter Krempa wrote:
 Peter Krempa (6):
   util: Make the virDomainListFree helper more universal
   conf: Extract code to filter domain list into a separate function
   conf: Rename virDomainObjListFilter type to virDomainObjListACLFilter
   conf: Refactor domain list collection critical section
   conf: Add helper to convert list of virDomains to a list of
 virDomainObjs
   qemu: Convert qemuConnectGetAllDomainStats to use new helpers
 
  daemon/remote.c  |   2 +-
  src/conf/domain_conf.c   | 258 
 ---
  src/conf/domain_conf.h   |  29 +++--
  src/libvirt_private.syms |   5 +-
  src/qemu/qemu_driver.c   |  86 +++
  src/util/virobject.c |  41 +++
  src/util/virobject.h |   2 +
  tools/virsh-domain-monitor.c |   2 +-
  8 files changed, 275 insertions(+), 150 deletions(-)
 

ACK series, but see my comment to 5/6 before pushing.

Michal

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


Re: [libvirt] [PATCH] qemu: improve error message for domain stats API

2015-05-04 Thread Michal Privoznik
On 04.05.2015 12:44, Pavel Hrdina wrote:
 Filtering specific list of domains is not supported yet.  Print a better
 error message.
 
 old error message:
 error: unsupported flags (0x1) in function qemuConnectGetAllDomainStats
 
 new error message:
 error: using filters with list of domains is not implemented yet
 
 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1143837
 
 Signed-off-by: Pavel Hrdina phrd...@redhat.com
 Signed-off-by: Luyao Huang lhu...@redhat.com
 ---
 
 Based on 
 https://www.redhat.com/archives/libvir-list/2014-November/msg00069.html
 with different commit and error message.
 
  src/qemu/qemu_driver.c | 22 +-
  1 file changed, 13 insertions(+), 9 deletions(-)
 

NACK. Once Peter's series is merged, this feature is implemented.

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

Michal

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


Re: [libvirt] [PATCH] qemu: improve error message for domain stats API

2015-05-04 Thread Pavel Hrdina
On Mon, May 04, 2015 at 01:29:03PM +0200, Michal Privoznik wrote:
 On 04.05.2015 12:44, Pavel Hrdina wrote:
  Filtering specific list of domains is not supported yet.  Print a better
  error message.
  
  old error message:
  error: unsupported flags (0x1) in function qemuConnectGetAllDomainStats
  
  new error message:
  error: using filters with list of domains is not implemented yet
  
  Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1143837
  
  Signed-off-by: Pavel Hrdina phrd...@redhat.com
  Signed-off-by: Luyao Huang lhu...@redhat.com
  ---
  
  Based on 
  https://www.redhat.com/archives/libvir-list/2014-November/msg00069.html
  with different commit and error message.
  
   src/qemu/qemu_driver.c | 22 +-
   1 file changed, 13 insertions(+), 9 deletions(-)
  
 
 NACK. Once Peter's series is merged, this feature is implemented.
 
 https://www.redhat.com/archives/libvir-list/2015-April/msg01561.html
 
 Michal

That's good.  I should probably read all marked series to catch up on things and
not post another patch like this :).  I'll watch that series and close the bug
after it will get merged.

Pavel

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


[libvirt] [PATCH v2 0/2] Introduce GIC for aarch64

2015-05-04 Thread Michal Privoznik
diff to v1:
- John's review worked in (hopefully)

Michal Privoznik (2):
  Introduce GIC feature
  qemu: Implement GIC

 docs/formatdomain.html.in  | 10 ++
 docs/schemas/domaincommon.rng  | 11 ++-
 src/conf/domain_conf.c | 37 +-
 src/conf/domain_conf.h |  2 ++
 src/qemu/qemu_command.c| 13 
 .../qemuxml2argvdata/qemuxml2argv-aarch64-gic.args |  6 
 .../qemuxml2argvdata/qemuxml2argv-aarch64-gic.xml  | 26 +++
 tests/qemuxml2argvtest.c   |  2 ++
 8 files changed, 105 insertions(+), 2 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.xml

-- 
2.3.6

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


[libvirt] [PATCH v2 1/2] Introduce GIC feature

2015-05-04 Thread Michal Privoznik
Some platforms, like aarch64, don't have APIC but GIC. So there's
no reason to have apic/ feature turned on. However, we are
still missing gic/ feature. This commit introduces the feature
to XML parser and formatter, adds documentation and updates RNG
schema.

Signed-off-by: Michal Privoznik mpriv...@redhat.com
---
 docs/formatdomain.html.in | 10 ++
 docs/schemas/domaincommon.rng | 11 ++-
 src/conf/domain_conf.c| 37 -
 src/conf/domain_conf.h|  2 ++
 4 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index d484152..fe7f9c5 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1439,6 +1439,7 @@
   lt;hidden state='on'/gt;
 lt;/kvmgt;
 lt;pvspinlock/gt;
+lt;gic version='2'/gt;
 
   lt;/featuresgt;
   .../pre
@@ -1545,6 +1546,15 @@
 the emulation of VMWare IO port, for vmmouse etc.
 span class=sinceSince 1.2.16/span
   /dd
+  dtcodegic/code/dt
+  ddEnable for architectures using a General Interrupt
+  Controller instead of APIC in order to handle interrupts.
+  For example, the 'aarch64' architecture uses
+  codegic/code instead of codeapic/code. The optional
+  attribute codeversion/code specifies the GIC version;
+  however, it may not be supported by all hypervisors. span
+  class=sinceSince 1.2.16/span
+  /dd
 /dl
 
 h3a name=elementsTimeTime keeping/a/h3
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 64d22ea..c151e92 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3965,7 +3965,7 @@
 /element
   /define
   !--
-  A set of optional features: PAE, APIC, ACPI,
+  A set of optional features: PAE, APIC, ACPI, GIC,
   HyperV Enlightenment, KVM features, paravirtual spinlocks and HAP support
 --
   define name=features
@@ -4035,6 +4035,15 @@
   /optional
 /element
   /optional
+  optional
+element name=gic
+  optional
+attribute name=version
+  ref name=positiveInteger/
+/attribute
+  /optional
+/element
+  /optional
 /interleave
   /element
 /optional
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fe8b8ca..4cd36a1 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -144,7 +144,8 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST,
   pvspinlock,
   capabilities,
   pmu,
-  vmport)
+  vmport,
+  gic)
 
 VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, VIR_DOMAIN_CAPABILITIES_POLICY_LAST,
   default,
@@ -14511,6 +14512,22 @@ virDomainDefParseXML(xmlDocPtr xml,
 ctxt-node = node;
 break;
 
+case VIR_DOMAIN_FEATURE_GIC:
+node = ctxt-node;
+ctxt-node = nodes[i];
+if ((tmp = virXPathString(string(./@version), ctxt))) {
+if (virStrToLong_uip(tmp, NULL, 10, def-gic_version)  0 ||
+def-gic_version == 0) {
+virReportError(VIR_ERR_XML_ERROR,
+   _(malformed gic version: %s), tmp);
+goto error;
+}
+VIR_FREE(tmp);
+}
+def-features[val] = VIR_TRISTATE_SWITCH_ON;
+ctxt-node = node;
+break;
+
 /* coverity[dead_error_begin] */
 case VIR_DOMAIN_FEATURE_LAST:
 break;
@@ -16593,6 +16610,14 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr 
src,
 return false;
 }
 
+/* GIC version */
+if (src-gic_version != dst-gic_version) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _(Source GIC version '%u' does not match destination 
'%u'),
+   src-gic_version, dst-gic_version);
+return false;
+}
+
 /* hyperv */
 if (src-features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_TRISTATE_SWITCH_ON) {
 for (i = 0; i  VIR_DOMAIN_HYPERV_LAST; i++) {
@@ -21232,6 +21257,16 @@ virDomainDefFormatInternal(virDomainDefPtr def,
 virBufferAddLit(buf, /capabilities\n);
 break;
 
+case VIR_DOMAIN_FEATURE_GIC:
+if (def-features[i] == VIR_TRISTATE_SWITCH_ON) {
+virBufferAddLit(buf, gic);
+if (def-gic_version)
+virBufferAsprintf(buf,  version='%u',
+  def-gic_version);
+virBufferAddLit(buf, /\n);
+}
+break;
+
 /* coverity[dead_error_begin] */
 case VIR_DOMAIN_FEATURE_LAST:
 break;
diff --git a/src/conf/domain_conf.h 

[libvirt] [PATCH 2/2] qemu: Forbid unsupported parameters for tunnelled migration

2015-05-04 Thread Jiri Denemark
Neither migrate URI nor lister address make any sense for tunnelled
migration.

https://bugzilla.redhat.com/show_bug.cgi?id=1066375

Signed-off-by: Jiri Denemark jdene...@redhat.com
---
 src/qemu/qemu_migration.c | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index eb70f29..20c2193 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -4814,6 +4814,20 @@ static int doPeer2PeerMigrate(virQEMUDriverPtr driver,
   NULLSTR(uri), NULLSTR(graphicsuri), NULLSTR(listenAddress),
   flags, NULLSTR(dname), resource);
 
+if (flags  VIR_MIGRATE_TUNNELLED  uri) {
+virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, %s,
+   _(migration URI is not supported by tunnelled 
+ migration));
+goto cleanup;
+}
+
+if (flags  VIR_MIGRATE_TUNNELLED  listenAddress) {
+virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, %s,
+   _(listen address is not supported by tunnelled 
+ migration));
+goto cleanup;
+}
+
 /* the order of operations is important here; we make sure the
  * destination side is completely setup before we touch the source
  */
@@ -4857,7 +4871,7 @@ static int doPeer2PeerMigrate(virQEMUDriverPtr driver,
 
 /* Only xmlin, dname, uri, and bandwidth parameters can be used with
  * old-style APIs. */
-if (!useParams  graphicsuri) {
+if (!useParams  (graphicsuri || listenAddress)) {
 virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, %s,
_(Migration APIs with extensible parameters are not 
  supported but extended parameters were passed));
-- 
2.4.0

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


[libvirt] [PATCH v2 2/2] qemu: Implement GIC

2015-05-04 Thread Michal Privoznik
The only version that's supported in QEMU is version 2, currently.
Fortunately, it is enabled by aarch64 automatically, so there's
nothing for us that needs to be put onto command line.

Signed-off-by: Michal Privoznik mpriv...@redhat.com
---
 src/qemu/qemu_command.c| 13 +++
 .../qemuxml2argvdata/qemuxml2argv-aarch64-gic.args |  6 +
 .../qemuxml2argvdata/qemuxml2argv-aarch64-gic.xml  | 26 ++
 tests/qemuxml2argvtest.c   |  2 ++
 4 files changed, 47 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.xml

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 952a10e..c32d8c6 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7202,6 +7202,19 @@ qemuBuildCpuArgStr(virQEMUDriverPtr driver,
 have_cpu = true;
 }
 
+if (def-features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ON) {
+if (def-gic_version  def-gic_version != 2) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _(gic version '%u' is not supported),
+   def-gic_version);
+goto cleanup;
+}
+
+/* There's no command line argument currently to turn on/off GIC. It's
+ * done automatically by qemu-system-aarch64. But if this changes, lets
+ * put the code here. */
+}
+
 if (virBufferCheckError(buf)  0)
 goto cleanup;
 
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.args 
b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.args
new file mode 100644
index 000..e61cd1e
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-aarch64 -S -M virt -no-kvm -cpu cortex-a53 -m 1024 -smp 1 
\
+-nographic -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -boot c \
+-kernel /aarch64.kernel -initrd /aarch64.initrd -append console=ttyAMA0 -usb \
+-net nic,macaddr=52:54:00:09:a4:37,vlan=0,model=virtio,name=net0 \
+-net user,vlan=0,name=hostnet0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.xml
new file mode 100644
index 000..08d3d71
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.xml
@@ -0,0 +1,26 @@
+domain type=qemu
+  nameaarch64test/name
+  uuid6ba410c5-1e5c-4d57-bee7-2228e7ffa32f/uuid
+  memory1048576/memory
+  currentMemory1048576/currentMemory
+  vcpu1/vcpu
+  features
+acpi/
+gic version='2'/
+  /features
+  cpu match='exact'
+modelcortex-a53/model
+  /cpu
+  os
+type arch=aarch64 machine=virthvm/type
+kernel/aarch64.kernel/kernel
+initrd/aarch64.initrd/initrd
+cmdlineconsole=ttyAMA0/cmdline
+  /os
+  devices
+emulator/usr/bin/qemu-system-aarch64/emulator
+interface type='user'
+  mac address='52:54:00:09:a4:37'/
+/interface
+  /devices
+/domain
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 4678261..97c7fba 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1541,6 +1541,8 @@ mymain(void)
 DO_TEST(aarch64-cpu-model-host, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
 QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
 QEMU_CAPS_CPU_HOST, QEMU_CAPS_KVM);
+DO_TEST(aarch64-gic, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
+QEMU_CAPS_KVM);
 
 DO_TEST(kvm-pit-device, QEMU_CAPS_KVM_PIT_TICK_POLICY);
 DO_TEST(kvm-pit-delay, QEMU_CAPS_NO_KVM_PIT);
-- 
2.3.6

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


[libvirt] [PATCH 1/2] virsh: Don't check migrate parameters

2015-05-04 Thread Jiri Denemark
Just pass anything a user specified to the appropriate API. It's the API
or libvirtd that should be responsible for checking its parameters.

https://bugzilla.redhat.com/show_bug.cgi?id=1066375

Signed-off-by: Jiri Denemark jdene...@redhat.com
---
 tools/virsh-domain.c | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 861766f..14e1e35 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -9894,18 +9894,7 @@ doMigrate(void *opaque)
 if (vshCommandOptBool(cmd, abort-on-error))
 flags |= VIR_MIGRATE_ABORT_ON_ERROR;
 
-if ((flags  VIR_MIGRATE_PEER2PEER) ||
-vshCommandOptBool(cmd, direct)) {
-
-/* migrateuri doesn't make sense for tunnelled migration */
-if (flags  VIR_MIGRATE_TUNNELLED 
-virTypedParamsGetString(params, nparams,
-VIR_MIGRATE_PARAM_URI, NULL) == 1) {
-vshError(ctl, %s, _(migrate: Unexpected migrateuri for 
-  peer2peer/direct migration));
-goto out;
-}
-
+if (flags  VIR_MIGRATE_PEER2PEER || vshCommandOptBool(cmd, direct)) {
 if (virDomainMigrateToURI3(dom, desturi, params, nparams, flags) == 0)
 ret = '0';
 } else {
-- 
2.4.0

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


[libvirt] [PATCH 0/2] Forbid unsupported parameters for tunnelled migration

2015-05-04 Thread Jiri Denemark
Jiri Denemark (2):
  virsh: Don't check migrate parameters
  qemu: Forbid unsupported parameters for tunnelled migration

 src/qemu/qemu_migration.c | 16 +++-
 tools/virsh-domain.c  | 13 +
 2 files changed, 16 insertions(+), 13 deletions(-)

-- 
2.4.0

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


Re: [libvirt] [PATCH] test: remove s390 tests used only for testing usb and ide controllers

2015-05-04 Thread Boris Fiuczynski

Hi Laine,
thanks for cleaning this up.
The patch looks good to me.

Reviewed-by: Boris Fiuczynski fiu...@linux.vnet.ibm.com


On 04/30/2015 10:40 PM, Laine Stump wrote:

Back in 2013, commit 877bc089 added in some tests that made sure no
error was generated on a domain definition that had an automatically
added usb controller if that domain didn't have a PCI bus to attach
the usb controller to. In particular, two s390-specific tests were
added, one with controller type='usb' model='none'/ and another
(called s390-piix-controllers) that had both usb and ide
controllers, but nothing attached to them.

Then in February of this year, commit 09ab9dcc eliminated the annoying
auto-adding of a usb device for s390 and s390x machines, stating:

  Since s390 does not support usb the default creation of a usb
   controller for a domain should not occur.

Since s390 doesn't support usb and usb controllers aren't added to
s390 domain definitions automatically, there is no reason to have the
tests with a usb controller and expect them to succeed. And since the
only reference of an IDE controller wrt s390 that I've found is in the
one test case mentioned above, and the commit log that added it
specifically mentions the purpose to be quieting error messages on
machines with no PCI bus, I'm assuming that the s390 also doesn't
support IDE controllers. Based on that reasoning (and the fact that
s390-piix-controllers causes a test error for an upcoming patch), this
patch removes those two tests.
---
  .../qemuxml2argv-s390-piix-controllers.args| 12 
  .../qemuxml2argv-s390-piix-controllers.xml | 34 --
  .../qemuxml2argv-s390-usb-none.args| 12 
  .../qemuxml2argv-s390-usb-none.xml | 29 --
  tests/qemuxml2argvtest.c   | 10 ---
  5 files changed, 97 deletions(-)
  delete mode 100644 
tests/qemuxml2argvdata/qemuxml2argv-s390-piix-controllers.args
  delete mode 100644 
tests/qemuxml2argvdata/qemuxml2argv-s390-piix-controllers.xml
  delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-usb-none.args
  delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-usb-none.xml

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-piix-controllers.args 
b/tests/qemuxml2argvdata/qemuxml2argv-s390-piix-controllers.args
deleted file mode 100644
index e939be4..000
--- a/tests/qemuxml2argvdata/qemuxml2argv-s390-piix-controllers.args
+++ /dev/null
@@ -1,12 +0,0 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-/usr/bin/qemu-system-s390x -S -M s390-virtio -m 214 -smp 1 -nographic \
--nodefconfig -nodefaults \
--chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \
--mon chardev=charmonitor,id=monitor,mode=readline -no-acpi \
--device virtio-serial-s390,id=virtio-serial0 -drive \
-file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \
--device virtio-blk-s390,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
--chardev pty,id=charconsole0 \
--device virtconsole,chardev=charconsole0,id=console0 \
--object rng-random,id=objrng0,filename=/dev/hwrng \
--device virtio-rng-s390,rng=objrng0,id=rng0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-piix-controllers.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-s390-piix-controllers.xml
deleted file mode 100644
index a8b72d7..000
--- a/tests/qemuxml2argvdata/qemuxml2argv-s390-piix-controllers.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-domain type='qemu'
-  nametest/name
-  memory219100/memory
-  currentMemory219100/currentMemory
-  os
-type arch='s390x' machine='s390-virtio'hvm/type
-  /os
-  clock offset='utc'/
-  on_poweroffdestroy/on_poweroff
-  on_rebootrestart/on_reboot
-  on_crashdestroy/on_crash
-  devices
-  emulator/usr/bin/qemu-system-s390x/emulator
-disk type='block' device='disk'
-  source dev='/dev/HostVG/QEMUGuest1'/
-  target dev='hda' bus='virtio'/
-  boot order='1'/
-/disk
-console type='pty'
-  target type='virtio'/
-/console
-controller type='usb' index='0'
-  address type='pci' domain='0x' bus='0x00' slot='0x01' 
function='0x2'/
-/controller
-controller type='ide' index='0'
-  address type='pci' domain='0x' bus='0x00' slot='0x01' 
function='0x1'/
-/controller
-memballoon model='virtio'
-/memballoon
-rng model='virtio'
-  backend model='random'/dev/hwrng/backend
-/rng
-  /devices
-/domain
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-usb-none.args 
b/tests/qemuxml2argvdata/qemuxml2argv-s390-usb-none.args
deleted file mode 100644
index 51fcfa6..000
--- a/tests/qemuxml2argvdata/qemuxml2argv-s390-usb-none.args
+++ /dev/null
@@ -1,12 +0,0 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-/usr/bin/qemu-system-s390x -S -M s390-virtio -m 214 -smp 1 \
--nographic -nodefconfig -nodefaults \
--chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \

Re: [libvirt] [PATCH 0/2] Forbid unsupported parameters for tunnelled migration

2015-05-04 Thread Michal Privoznik
On 04.05.2015 14:10, Jiri Denemark wrote:
 Jiri Denemark (2):
   virsh: Don't check migrate parameters
   qemu: Forbid unsupported parameters for tunnelled migration
 
  src/qemu/qemu_migration.c | 16 +++-
  tools/virsh-domain.c  | 13 +
  2 files changed, 16 insertions(+), 13 deletions(-)
 

ACK series. Although it would be nice to have those patches swapped, so
that there's no window where arguments are not checked.

Michal

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


Re: [libvirt] [PATCH] test: remove s390 tests used only for testing usb and ide controllers

2015-05-04 Thread Michal Privoznik
On 30.04.2015 22:40, Laine Stump wrote:
 Back in 2013, commit 877bc089 added in some tests that made sure no
 error was generated on a domain definition that had an automatically
 added usb controller if that domain didn't have a PCI bus to attach
 the usb controller to. In particular, two s390-specific tests were
 added, one with controller type='usb' model='none'/ and another
 (called s390-piix-controllers) that had both usb and ide
 controllers, but nothing attached to them.
 
 Then in February of this year, commit 09ab9dcc eliminated the annoying
 auto-adding of a usb device for s390 and s390x machines, stating:
 
  Since s390 does not support usb the default creation of a usb
   controller for a domain should not occur.
 
 Since s390 doesn't support usb and usb controllers aren't added to
 s390 domain definitions automatically, there is no reason to have the
 tests with a usb controller and expect them to succeed. And since the
 only reference of an IDE controller wrt s390 that I've found is in the
 one test case mentioned above, and the commit log that added it
 specifically mentions the purpose to be quieting error messages on
 machines with no PCI bus, I'm assuming that the s390 also doesn't
 support IDE controllers. Based on that reasoning (and the fact that
 s390-piix-controllers causes a test error for an upcoming patch), this
 patch removes those two tests.
 ---
  .../qemuxml2argv-s390-piix-controllers.args| 12 
  .../qemuxml2argv-s390-piix-controllers.xml | 34 
 --
  .../qemuxml2argv-s390-usb-none.args| 12 
  .../qemuxml2argv-s390-usb-none.xml | 29 --
  tests/qemuxml2argvtest.c   | 10 ---
  5 files changed, 97 deletions(-)
  delete mode 100644 
 tests/qemuxml2argvdata/qemuxml2argv-s390-piix-controllers.args
  delete mode 100644 
 tests/qemuxml2argvdata/qemuxml2argv-s390-piix-controllers.xml
  delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-usb-none.args
  delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-usb-none.xml

Since Boris already checked the patch, just to obey the formal process: ACK

Michal

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


Re: [libvirt] [PATCH] test: remove s390 tests used only for testing usb and ide controllers

2015-05-04 Thread Ján Tomko
On Thu, Apr 30, 2015 at 04:40:46PM -0400, Laine Stump wrote:
 Back in 2013, commit 877bc089 added in some tests that made sure no
 error was generated on a domain definition that had an automatically
 added usb controller if that domain didn't have a PCI bus to attach
 the usb controller to. In particular, two s390-specific tests were
 added, one with controller type='usb' model='none'/ and another
 (called s390-piix-controllers) that had both usb and ide
 controllers, but nothing attached to them.
 

It was a synthetic test (I never ran the command line) meant to check
the fix for starting s390 guests:
https://www.redhat.com/archives/libvir-list/2013-April/msg01920.html
which I posted instead of this proposed patch
https://www.redhat.com/archives/libvir-list/2013-April/msg01925.html

 Then in February of this year, commit 09ab9dcc eliminated the annoying
 auto-adding of a usb device for s390 and s390x machines, stating:
 
  Since s390 does not support usb the default creation of a usb
   controller for a domain should not occur.
 
 Since s390 doesn't support usb and usb controllers aren't added to
 s390 domain definitions automatically, there is no reason to have the
 tests with a usb controller and expect them to succeed.

QEMU seems to ignore the -usb parameter, so the only reason would be:
'It worked before'. (Unless running the qemu-system-s390x binary without
an guest on x86_64 does not give me results matching the real-world
usage).

I'm okay with breaking the controllers with explicit PCI addresses,
since libvirt stopped adding those almost 2 years ago.

Erroring out on bare controller type='usb' would break domains that
worked just three releases ago (the tests and the fix was added
precisely to avoid that).

Also, USB controller model='none' should be allowed.

 And since the
 only reference of an IDE controller wrt s390 that I've found is in the
 one test case mentioned above, and the commit log that added it
 specifically mentions the purpose to be quieting error messages on
 machines with no PCI bus, I'm assuming that the s390 also doesn't
 support IDE controllers. Based on that reasoning

The IDE controller seem to be added only if something uses the IDE bus
(the problem seems to be the disk target starting with 'hd')
Both tests can be fixed to avoid that.

 (and the fact that
 s390-piix-controllers causes a test error for an upcoming patch),

Honestly, that is not a great reason to remove a test :)

 this patch removes those two tests.

Jan


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

Re: [libvirt] [PATCH] tests: Fix grammar in comments.

2015-05-04 Thread Michal Privoznik
On 28.04.2015 17:43, Andrea Bolognani wrote:
 Replace all occurrences of stream write to differences to
 with stream to write differences to.
 ---
  tests/testutils.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/tests/testutils.c b/tests/testutils.c
 index 6a8fe6a..89026c6 100644
 --- a/tests/testutils.c
 +++ b/tests/testutils.c
 @@ -458,7 +458,7 @@ virtTestCaptureProgramOutput(const char *const argv[] 
 ATTRIBUTE_UNUSED,
  
  
  /**
 - * @param stream: output stream write to differences to
 + * @param stream: output stream to write differences to
   * @param expect: expected output text
   * @param expectName: name designator of the expected text
   * @param actual: actual output text
 @@ -532,7 +532,7 @@ int virtTestDifferenceFull(FILE *stream,
  }
  
  /**
 - * @param stream: output stream write to differences to
 + * @param stream: output stream to write differences to
   * @param expect: expected output text
   * @param actual: actual output text
   *
 @@ -548,7 +548,7 @@ int virtTestDifference(FILE *stream,
  
  
  /**
 - * @param stream: output stream write to differences to
 + * @param stream: output stream to write differences to
   * @param expect: expected output text
   * @param actual: actual output text
   *
 

ACKed  pushed.

Michal

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


Re: [libvirt] [PATCH 0/2] Forbid unsupported parameters for tunnelled migration

2015-05-04 Thread Jiri Denemark
On Mon, May 04, 2015 at 14:40:04 +0200, Michal Privoznik wrote:
 On 04.05.2015 14:10, Jiri Denemark wrote:
  Jiri Denemark (2):
virsh: Don't check migrate parameters
qemu: Forbid unsupported parameters for tunnelled migration
  
   src/qemu/qemu_migration.c | 16 +++-
   tools/virsh-domain.c  | 13 +
   2 files changed, 16 insertions(+), 13 deletions(-)
  
 
 ACK series. Although it would be nice to have those patches swapped, so
 that there's no window where arguments are not checked.

Well, the window will always be there when a new virsh connects to an
old libvirt... But I have no problem swapping the patches so I did that
and pushed. Thanks.

Jirka

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


Re: [libvirt] [PATCH 7/7] storage: Check for duplicate host for incoming pool def

2015-05-04 Thread Ján Tomko
On Thu, Apr 30, 2015 at 10:16:55AM -0400, John Ferlan wrote:
 On 04/30/2015 05:59 AM, Ján Tomko wrote:
  On Wed, Apr 29, 2015 at 12:37:38PM -0400, John Ferlan wrote:
  virStoragePoolSourceFindDuplicate for VIR_STORAGE_POOL_ISCSI calls
  virStoragePoolSourceFindDuplicateDevices which does the dual pool search
  through source.devices[i].path (or the IQN for the device).
 
  If a duplicate is found, then it would check if the source hostname's
  match. The formatstorage page describes Will be used in combination
  with a directory or device element. with regards to unique
  identification.
  
  That is the generic description shared with all the pools. Maybe the
  docs need some clarification?
  
 
 So you feel it's OK or better to document and restrict something that
 could essentially work given some code?  IOW: For this one pool type it
 is better to restrict based solely on the IQN - that's a preferable
 solution? Because it's not worth doing that much work just to work
 around misconfigured systems or a perception of misconfiguration?
 

d/perception of / ;)

Yes.

  Since port is optional, even that check is sketchy since
  one could have the same name, but not provide the port number in the
  incoming definition and thus have a duplicate.
 
  I suppose allowing two different 'iscsid' servers to advertise the same
  name isn't necessarily an issue. It could allow for someone to set up
  some sort of hot standby or backup (or who knows what) on separate
  servers without needing to manage the IQN mapping between the two.
 
  
  Even though it is possible to configure two servers with the same IQN,
  I don't see why we should support starting pools with both of them at
  at the same time.
  
 
 Because we have already supported it and technically it can work if
 you've done your configuration correctly and (more or less) know what
 you're doing.
 

But we haven't supported it - starting the second pool will
short-circuit because we already see a session with that IQN there.

  In the long run, the path in a vol-list is a combination of
  /dev/disk-by-path (or target... path...), the host name/addr, and
  the IQN such as:
 
  /dev/disk/by-path/ip-192.168.122.1:3260-iscsi-iqn.2013-12.com.example:iscsi-chap-netpool-lun-1
 
  and this links to the block device on the host (eg, ../../dev/sdb).
 
  If there was a second pool started using the same host as the first
  pool, but just by a different name, it too would use the same block
  device, so now there would be two pools using the same device. Since
  using the same device isn't allowed for other pools, the iSCSI pool
  should also block usage.
  
  So we have bug A - starting two pools from the same host with the same IQN
  
  And yes, a completely separate host using the
  same IQN would also use the same block device (but that's a different
  bug IMO).
 
  
  and bug B - starting two pools from different hosts with the same IQN
  
  Since we can't reliably tell it the hosts are different or the same,
  and I doubt the usefulness of two different hosts using the same IQN,
  why not just reduce this to one bug and reject duplicate IQNs regardless
  of the host?
  
 
 
 IMO, using address name resolution while not a perfect solution is
 better than deciding to disallow something that someone may have a
 reason to configure in such a manner. If the name resolution causes an
 issue due to unreliable DNS or some other DNS factor beyond the scope of
 libvirt, then the host configuration has far greater issues. I could
 just as easily claim I doubt someone would have such an unreliable DNS
 configuration, but I'm sure I'd be wrong too!  Still having an
 unreliable DNS is allowed.
 

The difference would be in the amount of code added to libvirt. :)

 
 BTW: Beyond this bz (1171984), there is an iSCSI ipv4 vs. ipv6 host name
 configuration issue described in bz1188463 and bz1207929 which describes
 a usage with gluster volume lookups where a failure is declared
 seemingly because the pool is defined with the IP address while the
 vol-name lookup was done using a name. The changes in v2 could easily be
 reused in order to ascertain that the name and number match. Beyond
 that it'd be up the gluster code to do it's own resolution in order to
 find the target.

The lookup code in v2 can be used by gluster regardless of its usage by
iSCSI pool (where checking the IQN should be enough) or NFS (where I'm
not sure we want to check the hostname at all - historically we've
allowed starting a NFS pool as long as there was something mounted to
the target path).

 
 John
 

Jan


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

Re: [libvirt] [PATCH] tests: Fix grammar in comments.

2015-05-04 Thread Andrea Bolognani
On Monday, May 4, 2015 at 3:04:24 PM, Michal Privoznik wrote:

 ACKed  pushed.

Thanks!

-- 
Andrea Bolognani abolo...@redhat.com

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


Re: [libvirt] [PATCH] test: remove s390 tests used only for testing usb and ide controllers

2015-05-04 Thread Stefan Zimmermann
Fine with me.

Reviewed-by: Stefan Zimmermann s...@linux.vnet.ibm.com

On Thu, 2015-04-30 at 16:40 -0400, Laine Stump wrote:
 Back in 2013, commit 877bc089 added in some tests that made sure no
 error was generated on a domain definition that had an automatically
 added usb controller if that domain didn't have a PCI bus to attach
 the usb controller to. In particular, two s390-specific tests were
 added, one with controller type='usb' model='none'/ and another
 (called s390-piix-controllers) that had both usb and ide
 controllers, but nothing attached to them.
 
 Then in February of this year, commit 09ab9dcc eliminated the annoying
 auto-adding of a usb device for s390 and s390x machines, stating:
 
  Since s390 does not support usb the default creation of a usb
   controller for a domain should not occur.
 
 Since s390 doesn't support usb and usb controllers aren't added to
 s390 domain definitions automatically, there is no reason to have the
 tests with a usb controller and expect them to succeed. And since the
 only reference of an IDE controller wrt s390 that I've found is in the
 one test case mentioned above, and the commit log that added it
 specifically mentions the purpose to be quieting error messages on
 machines with no PCI bus, I'm assuming that the s390 also doesn't
 support IDE controllers. Based on that reasoning (and the fact that
 s390-piix-controllers causes a test error for an upcoming patch), this
 patch removes those two tests.
 ---
  .../qemuxml2argv-s390-piix-controllers.args| 12 
  .../qemuxml2argv-s390-piix-controllers.xml | 34 
 --
  .../qemuxml2argv-s390-usb-none.args| 12 
  .../qemuxml2argv-s390-usb-none.xml | 29 --
  tests/qemuxml2argvtest.c   | 10 ---
  5 files changed, 97 deletions(-)
  delete mode 100644 
 tests/qemuxml2argvdata/qemuxml2argv-s390-piix-controllers.args
  delete mode 100644 
 tests/qemuxml2argvdata/qemuxml2argv-s390-piix-controllers.xml
  delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-usb-none.args
  delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-usb-none.xml
 
 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-piix-controllers.args 
 b/tests/qemuxml2argvdata/qemuxml2argv-s390-piix-controllers.args
 deleted file mode 100644
 index e939be4..000
 --- a/tests/qemuxml2argvdata/qemuxml2argv-s390-piix-controllers.args
 +++ /dev/null
 @@ -1,12 +0,0 @@
 -LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test 
 QEMU_AUDIO_DRV=none \
 -/usr/bin/qemu-system-s390x -S -M s390-virtio -m 214 -smp 1 -nographic \
 --nodefconfig -nodefaults \
 --chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \
 --mon chardev=charmonitor,id=monitor,mode=readline -no-acpi \
 --device virtio-serial-s390,id=virtio-serial0 -drive \
 -file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \
 --device virtio-blk-s390,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 
 \
 --chardev pty,id=charconsole0 \
 --device virtconsole,chardev=charconsole0,id=console0 \
 --object rng-random,id=objrng0,filename=/dev/hwrng \
 --device virtio-rng-s390,rng=objrng0,id=rng0
 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-piix-controllers.xml 
 b/tests/qemuxml2argvdata/qemuxml2argv-s390-piix-controllers.xml
 deleted file mode 100644
 index a8b72d7..000
 --- a/tests/qemuxml2argvdata/qemuxml2argv-s390-piix-controllers.xml
 +++ /dev/null
 @@ -1,34 +0,0 @@
 -domain type='qemu'
 -  nametest/name
 -  memory219100/memory
 -  currentMemory219100/currentMemory
 -  os
 -type arch='s390x' machine='s390-virtio'hvm/type
 -  /os
 -  clock offset='utc'/
 -  on_poweroffdestroy/on_poweroff
 -  on_rebootrestart/on_reboot
 -  on_crashdestroy/on_crash
 -  devices
 -  emulator/usr/bin/qemu-system-s390x/emulator
 -disk type='block' device='disk'
 -  source dev='/dev/HostVG/QEMUGuest1'/
 -  target dev='hda' bus='virtio'/
 -  boot order='1'/
 -/disk
 -console type='pty'
 -  target type='virtio'/
 -/console
 -controller type='usb' index='0'
 -  address type='pci' domain='0x' bus='0x00' slot='0x01' 
 function='0x2'/
 -/controller
 -controller type='ide' index='0'
 -  address type='pci' domain='0x' bus='0x00' slot='0x01' 
 function='0x1'/
 -/controller
 -memballoon model='virtio'
 -/memballoon
 -rng model='virtio'
 -  backend model='random'/dev/hwrng/backend
 -/rng
 -  /devices
 -/domain
 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-usb-none.args 
 b/tests/qemuxml2argvdata/qemuxml2argv-s390-usb-none.args
 deleted file mode 100644
 index 51fcfa6..000
 --- a/tests/qemuxml2argvdata/qemuxml2argv-s390-usb-none.args
 +++ /dev/null
 @@ -1,12 +0,0 @@
 -LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test 
 QEMU_AUDIO_DRV=none \
 -/usr/bin/qemu-system-s390x -S -M s390-virtio -m 214 -smp 1 \
 --nographic -nodefconfig -nodefaults \
 --chardev 

Re: [libvirt] [PATCH 2/2] qemu: Forbid unsupported parameters for tunnelled migration

2015-05-04 Thread Eric Blake
On 05/04/2015 06:10 AM, Jiri Denemark wrote:
 Neither migrate URI nor lister address make any sense for tunnelled

s/lister/listener/ ?

 migration.
 
 https://bugzilla.redhat.com/show_bug.cgi?id=1066375
 
 Signed-off-by: Jiri Denemark jdene...@redhat.com
 ---
  src/qemu/qemu_migration.c | 16 +++-
  1 file changed, 15 insertions(+), 1 deletion(-)
 
-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



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

Re: [libvirt] [PATCH v2 0/2] Introduce GIC for aarch64

2015-05-04 Thread John Ferlan


On 05/04/2015 08:09 AM, Michal Privoznik wrote:
 diff to v1:
 - John's review worked in (hopefully)
 
 Michal Privoznik (2):
   Introduce GIC feature
   qemu: Implement GIC
 
  docs/formatdomain.html.in  | 10 ++
  docs/schemas/domaincommon.rng  | 11 ++-
  src/conf/domain_conf.c | 37 
 +-
  src/conf/domain_conf.h |  2 ++
  src/qemu/qemu_command.c| 13 
  .../qemuxml2argvdata/qemuxml2argv-aarch64-gic.args |  6 
  .../qemuxml2argvdata/qemuxml2argv-aarch64-gic.xml  | 26 +++
  tests/qemuxml2argvtest.c   |  2 ++
  8 files changed, 105 insertions(+), 2 deletions(-)
  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.args
  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic.xml
 


As long as you remove the comment in domain_conf.h:

+unsigned int gic_version; /* by default 2 */


ACK series


John

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


Re: [libvirt] [PATCH v3] polkit: Allow password-less access for 'libvirt' group

2015-05-04 Thread Cole Robinson
On 04/30/2015 09:14 AM, Cole Robinson wrote:
 Many users, who admin their own machines, want to be able to access
 system libvirtd via tools like virt-manager without having to enter
 a root password. Just google 'virt-manager without password' and
 you'll find many hits. I've read at least 5 blog posts over the years
 describing slightly different ways of achieving this goal.
 
 Let's finally add official support for this.
 
 Install a polkit-1 rules file granting password-less auth for any user
 in the new 'libvirt' group. Create the group on RPM install
 
 https://bugzilla.redhat.com/show_bug.cgi?id=957300
 ---
 v3:
 Back to group=libvirt to match what debian and suse are using
 
 Patch is unchanged otherwise. So unless there's objects all carry
 over the previous ACK from danpb and push after the release is out
 

Pushed now

Thanks,
Cole

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


Re: [libvirt] [PATCH 6/6] storage: fs: Only force directory permissions if required

2015-05-04 Thread Cole Robinson
On 04/28/2015 09:54 PM, Cole Robinson wrote:
 On 04/28/2015 09:36 AM, Peter Krempa wrote:
 On Mon, Apr 27, 2015 at 16:48:44 -0400, Cole Robinson wrote:
 Only set directory permissions at pool build time, if:

 - User explicitly requested a mode via the XML
 - The directory needs to be created
 - We need to do the crazy NFS root-squash workaround

 This allows qemu:///session to call build on an existing directory
 like /tmp.
 ---
  src/storage/storage_backend_fs.c | 16 +++-
  src/util/virfile.c   |  2 +-
  2 files changed, 12 insertions(+), 6 deletions(-)

 diff --git a/src/storage/storage_backend_fs.c 
 b/src/storage/storage_backend_fs.c
 index 344ee4c..e11c240 100644
 --- a/src/storage/storage_backend_fs.c
 +++ b/src/storage/storage_backend_fs.c
 @@ -769,6 +769,8 @@ virStorageBackendFileSystemBuild(virConnectPtr conn 
 ATTRIBUTE_UNUSED,
  int err, ret = -1;
  char *parent = NULL;
  char *p = NULL;
 +mode_t mode;
 +bool needs_create_as_uid;
  
  virCheckFlags(VIR_STORAGE_POOL_BUILD_OVERWRITE |
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, ret);
 @@ -802,19 +804,23 @@ virStorageBackendFileSystemBuild(virConnectPtr conn 
 ATTRIBUTE_UNUSED,
  }
  }
  
 +needs_create_as_uid = (pool-def-type == VIR_STORAGE_POOL_NETFS);
 +mode = pool-def-target.perms.mode;
 +if (mode == (mode_t) -1 
 +(needs_create_as_uid || !virFileExists(pool-def-target.path)))
 +mode = VIR_STORAGE_DEFAULT_POOL_PERM_MODE;
 +
  /* Now create the final dir in the path with the uid/gid/mode
   * requested in the config. If the dir already exists, just set
   * the perms. */
  if ((err = virDirCreate(pool-def-target.path,
 -(pool-def-target.perms.mode == (mode_t) -1 ?
 - VIR_STORAGE_DEFAULT_POOL_PERM_MODE :
 - pool-def-target.perms.mode),
 +mode,
  pool-def-target.perms.uid,
  pool-def-target.perms.gid,
  VIR_DIR_CREATE_FORCE_PERMS |
  VIR_DIR_CREATE_ALLOW_EXIST |
 -(pool-def-type == VIR_STORAGE_POOL_NETFS
 -? VIR_DIR_CREATE_AS_UID : 0)))  0) {
 +(needs_create_as_uid ? VIR_DIR_CREATE_AS_UID : 
 0)
 +))  0) {

 Closing parentheses on a separate line are ugly. I'd rather see
 violating the 80 cols rule rather than damaging readability of the code.

  goto error;
  }
  
 diff --git a/src/util/virfile.c b/src/util/virfile.c
 index 676e7b4..7e49f39 100644
 --- a/src/util/virfile.c
 +++ b/src/util/virfile.c
 @@ -2311,7 +2311,7 @@ virDirCreateNoFork(const char *path,
   path, (unsigned int) uid, (unsigned int) gid);
  goto error;
  }
 -if ((flags  VIR_DIR_CREATE_FORCE_PERMS)
 +if (((flags  VIR_DIR_CREATE_FORCE_PERMS)  mode != (mode_t) -1)

 This is a usage error of the function. Using mode == -1 and requesting
 it to be set doesn't make much sense.

 
 And to clarify, I'll push patches 1-4 when the new release opens, since they
 had minor changes. Then I'll post a new series with 5-6 + additional patches
 

Pushed patches 1-4 now.

Thanks,
Cole

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


Re: [libvirt] [PATCH] test: remove s390 tests used only for testing usb and ide controllers

2015-05-04 Thread Laine Stump
On 05/04/2015 08:59 AM, Ján Tomko wrote:
 On Thu, Apr 30, 2015 at 04:40:46PM -0400, Laine Stump wrote:
 Back in 2013, commit 877bc089 added in some tests that made sure no
 error was generated on a domain definition that had an automatically
 added usb controller if that domain didn't have a PCI bus to attach
 the usb controller to. In particular, two s390-specific tests were
 added, one with controller type='usb' model='none'/ and another
 (called s390-piix-controllers) that had both usb and ide
 controllers, but nothing attached to them.

 It was a synthetic test (I never ran the command line) meant to check
 the fix for starting s390 guests:
 https://www.redhat.com/archives/libvir-list/2013-April/msg01920.html
 which I posted instead of this proposed patch
 https://www.redhat.com/archives/libvir-list/2013-April/msg01925.html

(Thanks for the extra history. I had extracted part of it from the
commit logs, but didn't know about that original patch.)

Yes, that definitely would not be the right fix. We shouldn't pretend
that a domain has hardware that it doesn't actually have (it was fixing
up yet another occurrence of that problem that led me to this).


 Then in February of this year, commit 09ab9dcc eliminated the annoying
 auto-adding of a usb device for s390 and s390x machines, stating:

  Since s390 does not support usb the default creation of a usb
   controller for a domain should not occur.

 Since s390 doesn't support usb and usb controllers aren't added to
 s390 domain definitions automatically, there is no reason to have the
 tests with a usb controller and expect them to succeed.
 QEMU seems to ignore the -usb parameter,

Will the badness never end? :-/

(seriously, this entire collection of problems/patches is all due to one
bit of code or another silently implying that nonexistent things exist
and/or not logging an error and failing when they actually don't exist.
If everyone involved would just *tell the truth* we could stop the
insanity).

  so the only reason would be:
 'It worked before'. (Unless running the qemu-system-s390x binary without
 an guest on x86_64 does not give me results matching the real-world
 usage).

 I'm okay with breaking the controllers with explicit PCI addresses,
 since libvirt stopped adding those almost 2 years ago.

 Erroring out on bare controller type='usb' would break domains that
 worked just three releases ago (the tests and the fix was added
 precisely to avoid that).

Ugh. This is very distasteful, but I do see your point. Note that this
patch doesn't add any new error conditions, it just removes a test that
verifies acceptance of something that shouldn't have happened in the
first place. However, it was libvirt itself that created these
technically invalid configs (by auto-adding the usb, so it would be a
bit mean-spirited to suddenly begin failing.

The other patch I refer to in the commit log is one that results in an
error log only for IDE controllers in a domain that doesn't support IDE,
though. Since libvirt itself never adds an IDE controller automatically
unless someone adds a disk that attaches to an IDE controller, and since
any disk attached to a nonexistent IDE controller would result in an
error from QEMU on startup (except in the case of a Q35 domain, which is
exactly the ignored case where I *want* it to cause an error), I
seriously doubt that there are any configs in the wild that match the
following:

  1) target domain doesn't support IDE
  2) config has IDE controller
  3) config has no IDE disk (and thus currently doesn't cause an error)

 Also, USB controller model='none' should be allowed.

Yeah, I guess I can live with that one.


 And since the
 only reference of an IDE controller wrt s390 that I've found is in the
 one test case mentioned above, and the commit log that added it
 specifically mentions the purpose to be quieting error messages on
 machines with no PCI bus, I'm assuming that the s390 also doesn't
 support IDE controllers. Based on that reasoning
 The IDE controller seem to be added only if something uses the IDE bus
 (the problem seems to be the disk target starting with 'hd')

Right. So up until now there are only two ways an IDE controller would
have been added:

1) user adds a disk and says that it attaches to the IDE bus. qemu
generates an error, user removes disk.

or

2) user manually adds an IDE controller for no good reason.

or the *real* problem, which occurs only on Q35 domains (since the Q35
domain has a SATA controller that qemu gives the id ide (which is
identical to the integrated IDE controller on a 440fx domain):

3) user adds a disk and says that it attaches to the IDE bus. libvirt
generates commandline saying attach this to id=ide, qemu says okay,
I'm attaching this to the SATA controller named 'ide' and proceeds on
its happy way. (this later causes a problem if the user attaches a disk
to the SATA bus, or a 2nd disk to the IDE bus).

libvirt should have *always* flagged all of these as errors - 

Re: [libvirt] [PATCH v5 4/9] virstoragefile: Always use virStorageSourceSetBackingStore to set backing store

2015-05-04 Thread John Ferlan


On 04/23/2015 08:41 AM, Matthias Gatto wrote:
 Replace the parts of the code where a backing store is set manually
 with virStorageSourceSetBackingStore
 
 Signed-off-by: Matthias Gatto matthias.ga...@outscale.com
 Signed-off-by: John Ferlan jfer...@redhat.com
 ---
  src/conf/domain_conf.c|  3 ++-
  src/conf/storage_conf.c   | 17 ++---
  src/qemu/qemu_driver.c| 17 +++--
  src/storage/storage_backend_fs.c  |  7 +--
  src/storage/storage_backend_gluster.c |  5 +++--
  src/storage/storage_backend_logical.c |  9 ++---
  src/storage/storage_driver.c  |  3 ++-
  src/util/virstoragefile.c |  8 +---
  tests/virstoragetest.c|  4 ++--
  9 files changed, 46 insertions(+), 27 deletions(-)
 

Other than a minor goto error issue in storage_backend_gluster.c - up
through here things seem fine to me.  Doesn't seem to be any new readers
or setters of -backingStore in recent changes (since patches 5-9
compile too). The only references are now -backingStoreRaw fetches and
saves.

However, for patches 5-9 as I understand it have some concerns from
Peter which hopefully he can elaborate on.

So that progress can be made and readers/writers of backingStore go
through the virStorageSource{Get|Set}BackingStore API's until the rest
of the concerns are understood - I'm of the opinion the patches 1-4 can
be pushed, but I'll wait until Peter chimes in before doing so...

John
 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
 index 2a05291..09f0bca 100644
 --- a/src/conf/domain_conf.c
 +++ b/src/conf/domain_conf.c
 @@ -6006,7 +6006,8 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt,
  virDomainDiskBackingStoreParse(ctxt, backingStore)  0)
  goto cleanup;
  
 -src-backingStore = backingStore;
 +if (!virStorageSourceSetBackingStore(src, backingStore, 0))
 +goto cleanup;
  ret = 0;
  
   cleanup:
 diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
 index 5781374..ca3a6d5 100644
 --- a/src/conf/storage_conf.c
 +++ b/src/conf/storage_conf.c
 @@ -1254,6 +1254,7 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
  char *capacity = NULL;
  char *unit = NULL;
  char *backingStore = NULL;
 +virStorageSourcePtr backingStorePtr;
  xmlNodePtr node;
  xmlNodePtr *nodes = NULL;
  size_t i;
 @@ -1290,20 +1291,22 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
  }
  
  if ((backingStore = virXPathString(string(./backingStore/path), 
 ctxt))) {
 -if (VIR_ALLOC(ret-target.backingStore)  0)
 +if (VIR_ALLOC(backingStorePtr)  0)
  goto error;
  
 -ret-target.backingStore-path = backingStore;
 +if (!virStorageSourceSetBackingStore(ret-target, backingStorePtr, 
 0))
 +goto error;
 +backingStorePtr-path = backingStore;
  backingStore = NULL;
  
  if (options-formatFromString) {
  char *format = 
 virXPathString(string(./backingStore/format/@type), ctxt);
  if (format == NULL)
 -ret-target.backingStore-format = options-defaultFormat;
 +backingStorePtr-format = options-defaultFormat;
  else
 -ret-target.backingStore-format = 
 (options-formatFromString)(format);
 +backingStorePtr-format = 
 (options-formatFromString)(format);
  
 -if (ret-target.backingStore-format  0) {
 +if (backingStorePtr-format  0) {
  virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
 _(unknown volume format type %s), format);
  VIR_FREE(format);
 @@ -1312,9 +1315,9 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
  VIR_FREE(format);
  }
  
 -if (VIR_ALLOC(ret-target.backingStore-perms)  0)
 +if (VIR_ALLOC(backingStorePtr-perms)  0)
  goto error;
 -if (virStorageDefParsePerms(ctxt, ret-target.backingStore-perms,
 +if (virStorageDefParsePerms(ctxt, backingStorePtr-perms,
  ./backingStore/permissions,
  DEFAULT_VOL_PERM_MODE)  0)
  goto error;
 diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
 index 26be9d6..1a98601 100644
 --- a/src/qemu/qemu_driver.c
 +++ b/src/qemu/qemu_driver.c
 @@ -14274,13 +14274,18 @@ 
 qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver,
  /* Update vm in place to match changes.  */
  need_unlink = false;
  
 -newDiskSrc-backingStore = disk-src;
 -disk-src = newDiskSrc;
 +if (!virStorageSourceSetBackingStore(newDiskSrc, disk-src, 0)) {
 +ret = -1;
 +goto cleanup;
 +}
  newDiskSrc = NULL;
  
  if (persistDisk) {
 -persistDiskSrc-backingStore = persistDisk-src;
 -persistDisk-src = persistDiskSrc;
 +if 

[libvirt] ANNOUNCE: virt-manager 1.2.0 released

2015-05-04 Thread Cole Robinson
I'm happy to announce the release of virt-manager 1.2.0!

virt-manager is a desktop application for managing KVM, Xen, and LXC
virtualization via libvirt.

The release can be downloaded from:

http://virt-manager.org/download/

The direct download links are:

http://virt-manager.org/download/sources/virt-manager/virt-manager-1.2.0.tar.gz

This release includes:

- OVMF/AAVMF Support (Laszlo Ersek, Giuseppe Scrivano, Cole Robinson)
- Improved support for AArch64 qemu/kvm
- virt-install: Support --disk type=network parameters
- virt-install: Make --disk  just work
- virt-install: Add --disk sgio= option (Giuseppe Scrivano)
- addhardware: default to an existing bus when adding a new disk
  (Giuseppe Scrivano)
- virt-install: Add --input device option
- virt-manager: Unify storagebrowser and storage details functionality
- virt-manager: allow setting a custom connection row name
- virt-install: Support --hostdev scsi passthrough
- virt-install: Fill in a bunch of --graphics spice options
- Disable spice image compression for new local VMs
- virt-manager: big reworking of the migration dialog

Thanks to everyone who has contributed to this release through testing,
bug reporting, submitting patches, and otherwise sending in feedback!

Thanks,
Cole

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


[libvirt] [PATCH 0/2] Storage : Fixes for cloning raw volumes

2015-05-04 Thread Prerna Saxena

From: Prerna Saxena pre...@linux.vnet.ibm.com
Date: Mon, 4 May 2015 12:00:46 -0700

This series has some long-overdue fixes for copying of raw
storage volumes with libvirt.


Prerna Saxena (2):
  Storage : Suppress metadata refresh for volumes being built.
  Storage : Fix cloning of raw, sparse volumes.

 src/storage/storage_backend.c | 5 -
 src/storage/storage_driver.c  | 5 -
 2 files changed, 4 insertions(+), 6 deletions(-)

-- 
1.8.3.1

-- 
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 1/2] Storage: Suppress metadata refresh for volumes being built.

2015-05-04 Thread Prerna Saxena
Libvirt periodically calls 'stat' on all volumes in a storage pool,
to update fields such as 'target.allocation'.

The operation doesnt make sense for a volume which is curently being allocated.
Also, the 'target.allocation' sub-field is taken into account while copying a 
raw image. To suppress any (potential) corruption, libvirt must not attempt to 
refresh a volume currently being built.


Signed-off-by: Prerna Saxena pre...@linux.vnet.ibm.com
---
 src/storage/storage_backend.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 289f454..355fc7f 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -1576,6 +1576,9 @@ virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol,
 {
 int ret;
 
+if (vol-building)
+return 0;
+
 if ((ret = virStorageBackendUpdateVolTargetInfo(vol-target,
 withBlockVolFormat,
 openflags))  0)
-- 
1.8.3.1

-- 
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 2/2] Storage : Fix cloning of raw, sparse volumes.

2015-05-04 Thread Prerna Saxena
When virsh vol-clone is attempted on a raw file where capacity  allocation,
the resulting cloned volume has a size that matches the virtual-size of
the parent; in place of matching its actual, disk size.
This patch fixes the cloned disk to have same _allocated_size_ as
the parent file from which it was cloned.

Reference: 
https://www.redhat.com/archives/libvir-list/2014-September/msg00064.html

Also fixes : https://bugzilla.redhat.com/show_bug.cgi?id=1130739

Signed-off-by: Prerna Saxena pre...@linux.vnet.ibm.com
---
 src/storage/storage_backend.c | 2 +-
 src/storage/storage_driver.c  | 5 -
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 355fc7f..1a7c0cc 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -429,7 +429,7 @@ createRawFile(int fd, virStorageVolDefPtr vol,
 }
 #endif
 
-remain = vol-target.allocation;
+remain = inputvol-target.capacity;
 
 if (inputvol) {
 /* allow zero blocks to be skipped if we've requested sparse
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index ac4a74a..c511035 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1990,11 +1990,6 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
 if (newvol-target.capacity  origvol-target.capacity)
 newvol-target.capacity = origvol-target.capacity;
 
-/* Make sure allocation is at least as large as the destination cap,
- * to make absolutely sure we copy all possible contents */
-if (newvol-target.allocation  origvol-target.capacity)
-newvol-target.allocation = origvol-target.capacity;
-
 if (!backend-buildVolFrom) {
 virReportError(VIR_ERR_NO_SUPPORT,
%s, _(storage pool does not support
-- 
1.8.3.1


-- 
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] add a rbd disk by virsh attach-device , the operation fails

2015-05-04 Thread 饶俊明
Hello:
add a rbd disk by virsh attach-device ,the operation fails; libvirt 
version: libvirt-0.10.2-46.el6.x86_64
operated virsh pool-info, pool-edit, attach-device domain_id /tmp/rbddisk.xml 
command:

virsh # pool-info 0a081d22-070b-3f58-a883-78e29012b052
Name:   0a081d22-070b-3f58-a883-78e29012b052
UUID:   0a081d22-070b-3f58-a883-78e29012b052
State:  running
Persistent: no
Autostart:  no
Capacity:   305.50 TiB
Allocation: 173.06 GiB
Available:  304.98 TiB

virsh # pool-edit 0a081d22-070b-3f58-a883-78e29012b052
pool type='rbd'
  name0a081d22-070b-3f58-a883-78e29012b052/name
  uuid0a081d22-070b-3f58-a883-78e29012b052/uuid
  capacity unit='bytes'335898508001280/capacity
  allocation unit='bytes'185824236409/allocation
  available unit='bytes'335327800442880/available
  source
host name='szebs01.app.paic.com.cn' port='6789'/
nameebs_sz_01_01/name
auth username='szbcs' type='ceph'
  secret uuid='0a081d22-070b-3f58-a883-78e29012b052'/
/auth
  /source
/pool

virsh # attach-device 52 /tmp/rbddisk.xml 
error: Failed to attach device from /tmp/rbddisk.xml
error: internal error unable to execute QEMU command '__com.redhat_drive_add': 
Device 'drive-virtio-disk1' could not be initialized

This context of /tmp/rbddisk.xml :
disk type='network' device='disk'
  driver name='qemu' type='raw' cache='none'/
  auth username='szbcs'
secret type='ceph' uuid='0a081d22-070b-3f58-a883-78e29012b052'/
  /auth
  source protocol='rbd' 
name='ebs_sz_01_01/5eba8a02-f251-4674-88b8-e368a07d50c5'
host name='szebs01.app.paic.com.cn' port='6789'/
  /source
  target dev='vdb' bus='virtio'/
  address type='pci' domain='0x' bus='0x00' slot='0x07' 
function='0x0'/
/disk

This error information in libvirtd log file:
2015-05-05 02:51:52.005+: 32082: error : qemuMonitorJSONCheckError:359 : 
internal error unable to execute QEMU command '__com.redhat_drive_add': Device 
'drive-virtio-disk1' could not be initialized

Thanks!!





The information in this email is confidential and may be legally privileged. If 
you have received this email in error or are not the intended recipient, please 
immediately notify the sender and delete this message from your computer. Any 
use, distribution, or copying of this email other than by the intended 
recipient is strictly prohibited. All messages sent to and from us may be 
monitored to ensure compliance with internal policies and to protect our 
business. 
Emails are not secure and cannot be guaranteed to be error free as they can be 
intercepted, amended, lost or destroyed, or contain viruses. Anyone who 
communicates with us by email is taken to accept these risks. 

��跺�浠惰��璇锋敞���锛�
��浠跺��淇�瀵�淇℃��锛���ヨ舵�浠讹��璇峰�″���ュ�浜哄苟��存�ュ伙��涓�寰�浣跨�ㄣ��浼���澶���舵�浠躲��
杩���洪��浠跺���版���稿��瑙��с�浠跺藉�琚��琚�淇���广��涓㈠け���琚���村���璁$虹��姣�绛�涓�瀹���ㄦ点��
 


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

[libvirt] [PATCH] qemu: Properly rename persistent def after migration

2015-05-04 Thread Jiri Denemark
When migrating a domain while changing its name and using
VIR_MIGRATE_PERSIST_DEST flag, libvirt would fail to properly change the
name in the persistent definition. The inconsistency results in weird
behavior when dumping domain XML, destroying the domain, restarting
libvirtd and likely in several other situations.

Since the new name is already stored in vm-def-name, we just need to
make sure the persistent definition uses this new name too.

https://bugzilla.redhat.com/show_bug.cgi?id=1076354

Signed-off-by: Jiri Denemark jdene...@redhat.com
---
 src/qemu/qemu_migration.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 20c2193..c1af704 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1392,6 +1392,14 @@ qemuMigrationEatCookie(virQEMUDriverPtr driver,
flags)  0)
 goto error;
 
+if (flags  QEMU_MIGRATION_COOKIE_PERSISTENT 
+mig-persistent 
+STRNEQ(dom-def-name, mig-persistent-name)) {
+VIR_FREE(mig-persistent-name);
+if (VIR_STRDUP(mig-persistent-name, dom-def-name)  0)
+goto error;
+}
+
 if (mig-flags  QEMU_MIGRATION_COOKIE_LOCKSTATE) {
 if (!mig-lockDriver) {
 if (virLockManagerPluginUsesState(driver-lockManager)) {
-- 
2.4.0

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


Re: [libvirt] [PATCH 7/7] storage: Check for duplicate host for incoming pool def

2015-05-04 Thread John Ferlan


On 05/04/2015 09:44 AM, Ján Tomko wrote:
 On Thu, Apr 30, 2015 at 10:16:55AM -0400, John Ferlan wrote:
 On 04/30/2015 05:59 AM, Ján Tomko wrote:
 On Wed, Apr 29, 2015 at 12:37:38PM -0400, John Ferlan wrote:
 virStoragePoolSourceFindDuplicate for VIR_STORAGE_POOL_ISCSI calls
 virStoragePoolSourceFindDuplicateDevices which does the dual pool search
 through source.devices[i].path (or the IQN for the device).

 If a duplicate is found, then it would check if the source hostname's
 match. The formatstorage page describes Will be used in combination
 with a directory or device element. with regards to unique
 identification.

 That is the generic description shared with all the pools. Maybe the
 docs need some clarification?


 So you feel it's OK or better to document and restrict something that
 could essentially work given some code?  IOW: For this one pool type it
 is better to restrict based solely on the IQN - that's a preferable
 solution? Because it's not worth doing that much work just to work
 around misconfigured systems or a perception of misconfiguration?

 
 d/perception of / ;)
 
 Yes.
 

Wasn't too much work for iscsid which is able to use an existing
session if it determines the IP Addresses are the same. Technically it's
not a misconfiguration, it seems just an artificial limitation due to an
inability to trust DNS name resolutions.

 Since port is optional, even that check is sketchy since
 one could have the same name, but not provide the port number in the
 incoming definition and thus have a duplicate.

 I suppose allowing two different 'iscsid' servers to advertise the same
 name isn't necessarily an issue. It could allow for someone to set up
 some sort of hot standby or backup (or who knows what) on separate
 servers without needing to manage the IQN mapping between the two.


 Even though it is possible to configure two servers with the same IQN,
 I don't see why we should support starting pools with both of them at
 at the same time.


 Because we have already supported it and technically it can work if
 you've done your configuration correctly and (more or less) know what
 you're doing.

 
 But we haven't supported it - starting the second pool will
 short-circuit because we already see a session with that IQN there.
 

Whether we saw it or not, iscsid will match if it determines that
the host:port portion is a duplicate.

 In the long run, the path in a vol-list is a combination of
 /dev/disk-by-path (or target... path...), the host name/addr, and
 the IQN such as:

 /dev/disk/by-path/ip-192.168.122.1:3260-iscsi-iqn.2013-12.com.example:iscsi-chap-netpool-lun-1

 and this links to the block device on the host (eg, ../../dev/sdb).

 If there was a second pool started using the same host as the first
 pool, but just by a different name, it too would use the same block
 device, so now there would be two pools using the same device. Since
 using the same device isn't allowed for other pools, the iSCSI pool
 should also block usage.

 So we have bug A - starting two pools from the same host with the same IQN

 And yes, a completely separate host using the
 same IQN would also use the same block device (but that's a different
 bug IMO).


 and bug B - starting two pools from different hosts with the same IQN

 Since we can't reliably tell it the hosts are different or the same,
 and I doubt the usefulness of two different hosts using the same IQN,
 why not just reduce this to one bug and reject duplicate IQNs regardless
 of the host?



 IMO, using address name resolution while not a perfect solution is
 better than deciding to disallow something that someone may have a
 reason to configure in such a manner. If the name resolution causes an
 issue due to unreliable DNS or some other DNS factor beyond the scope of
 libvirt, then the host configuration has far greater issues. I could
 just as easily claim I doubt someone would have such an unreliable DNS
 configuration, but I'm sure I'd be wrong too!  Still having an
 unreliable DNS is allowed.

 
 The difference would be in the amount of code added to libvirt. :)
 

Not sure that should be a reason to not accept something. The first set
of patches associated with virIsValidHostname were an afterthought
after adding the name resolution checking code.  There were added
because I thought it might be a good thing to check and/or notify that
the name to be used wasn't valid.  Allowing netfs, gluster, iscsi, and
sheepdog to go through their startups only to fail is still an option. I
guess it all depends on what you consider too much


 BTW: Beyond this bz (1171984), there is an iSCSI ipv4 vs. ipv6 host name
 configuration issue described in bz1188463 and bz1207929 which describes
 a usage with gluster volume lookups where a failure is declared
 seemingly because the pool is defined with the IP address while the
 vol-name lookup was done using a name. The changes in v2 could easily be
 reused in order to ascertain that the name and number 

[libvirt] [PATCH] libxl: support soundhw for hvm domains

2015-05-04 Thread Jim Fehlig
The xend driver and the parsing/formating code in src/xenconfig
have long supported soundhw.  Add support in the libxl driver too.

Signed-off-by: Jim Fehlig jfeh...@suse.com
---

This patch continues the tradition of silently ignoring unsupported
config in the libxl driver.  But it is an improvement; post-patch
only sound devices after the first are ignored :-).

 src/libxl/libxl_conf.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 2a09190..fccada5 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -678,6 +678,19 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
 libxl_defbool_set(b_info-u.hvm.hpet, 1);
 }
 }
+
+if (def-nsounds  0) {
+/*
+ * Use first sound device.  man xl.cfg(5) describes soundhw as
+ * a single device.  From the man page: soundhw=DEVICE
+ */
+virDomainSoundDefPtr snd = def-sounds[0];
+
+if (VIR_STRDUP(b_info-u.hvm.soundhw,
+   virDomainSoundModelTypeToString(snd-model))  0)
+return -1;
+}
+
 for (i = 0; i  def-os.nBootDevs; i++) {
 switch (def-os.bootDevs[i]) {
 case VIR_DOMAIN_BOOT_FLOPPY:
-- 
1.8.4.5

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