[libvirt] [PATCH v3 1/5] cpu_x86: add Edx to KVM_FEATURE_DEF()

2019-08-05 Thread Vitaly Kuznetsov
Some Hyper-V features (like the upcoming Direct Synthetic timers) are
announced by feature bits in Edx but KVM_FEATURE_DEF() supports only Eax.

Signed-off-by: Vitaly Kuznetsov 
---
 src/cpu/cpu_x86.c | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index b58eb2c9d8..d2d9537c32 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -59,9 +59,9 @@ struct _virCPUx86Feature {
 { .type = VIR_CPU_X86_DATA_CPUID, \
   .data = { .cpuid = {__VA_ARGS__} } }
 
-#define KVM_FEATURE_DEF(Name, Eax_in, Eax) \
+#define KVM_FEATURE_DEF(Name, Eax_in, Eax, Edx) \
 static virCPUx86DataItem Name ## _data[] = { \
-CPUID(.eax_in = Eax_in, .eax = Eax), \
+CPUID(.eax_in = Eax_in, .eax = Eax, .edx = Edx), \
 }
 
 #define KVM_FEATURE(Name) \
@@ -74,32 +74,32 @@ struct _virCPUx86Feature {
 }
 
 KVM_FEATURE_DEF(VIR_CPU_x86_KVM_PV_UNHALT,
-0x4001, 0x0080);
+0x4001, 0x0080, 0x0);
 
 KVM_FEATURE_DEF(VIR_CPU_x86_HV_RUNTIME,
-0x4003, 0x0001);
+0x4003, 0x0001, 0x0);
 KVM_FEATURE_DEF(VIR_CPU_x86_HV_SYNIC,
-0x4003, 0x0004);
+0x4003, 0x0004, 0x0);
 KVM_FEATURE_DEF(VIR_CPU_x86_HV_STIMER,
-0x4003, 0x0008);
+0x4003, 0x0008, 0x0);
 KVM_FEATURE_DEF(VIR_CPU_x86_HV_RELAXED,
-0x4003, 0x0020);
+0x4003, 0x0020, 0x0);
 KVM_FEATURE_DEF(VIR_CPU_x86_HV_VAPIC,
-0x4003, 0x0030);
+0x4003, 0x0030, 0x0);
 KVM_FEATURE_DEF(VIR_CPU_x86_HV_VPINDEX,
-0x4003, 0x0040);
+0x4003, 0x0040, 0x0);
 KVM_FEATURE_DEF(VIR_CPU_x86_HV_RESET,
-0x4003, 0x0080);
+0x4003, 0x0080, 0x0);
 KVM_FEATURE_DEF(VIR_CPU_x86_HV_FREQUENCIES,
-0x4003, 0x0800);
+0x4003, 0x0800, 0x0);
 KVM_FEATURE_DEF(VIR_CPU_x86_HV_REENLIGHTENMENT,
-0x4003, 0x2000);
+0x4003, 0x2000, 0x0);
 KVM_FEATURE_DEF(VIR_CPU_x86_HV_TLBFLUSH,
-0x4004, 0x0004);
+0x4004, 0x0004, 0x0);
 KVM_FEATURE_DEF(VIR_CPU_x86_HV_IPI,
-0x4004, 0x0400);
+0x4004, 0x0400, 0x0);
 KVM_FEATURE_DEF(VIR_CPU_x86_HV_EVMCS,
-0x4004, 0x4000);
+0x4004, 0x4000, 0x0);
 
 static virCPUx86Feature x86_kvm_features[] =
 {
-- 
2.20.1

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


[libvirt] [PATCH v3 0/5] Add support for Direct Mode for Hyper-V Synthetic timers

2019-08-05 Thread Vitaly Kuznetsov
Changes since v2:
- Post 5.6.0 rebase, patches 1-3 are dropped as they were already merged.

Original description:

QEMU-4.1 will bring us Direct Mode for Hyper-V Synthetic timers support,
we need to support it in libvirt too. As this is not a new enlightenment
but rather an enhancement of an existing one ('stimer'), support it in


  


form. Backwards compatibility is (hopefully) preserved.

Vitaly Kuznetsov (5):
  cpu_x86: add Edx to KVM_FEATURE_DEF()
  conf: change the way how Hyper-V features are printed out
  conf: add support for Direct Mode for Hyper-V Synthetic timers
  qemu: add support for Direct Mode for Hyper-V Synthetic timers
  news: mention Direct Mode for Hyper-V Synthetic timers support

 docs/formatdomain.html.in   | 10 ++--
 docs/news.xml   |  9 
 docs/schemas/domaincommon.rng   | 16 +-
 src/conf/domain_conf.c  | 77 ++---
 src/conf/domain_conf.h  |  1 +
 src/cpu/cpu_x86.c   | 33 +++--
 src/cpu/cpu_x86_data.h  |  2 +
 src/qemu/qemu_command.c | 12 +++--
 src/qemu/qemu_process.c | 20 +++-
 tests/qemuxml2argvdata/hyperv.args  |  4 +-
 tests/qemuxml2argvdata/hyperv.xml   |  4 +-
 tests/qemuxml2xmloutdata/hyperv.xml |  4 +-
 12 files changed, 155 insertions(+), 37 deletions(-)

-- 
2.20.1

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


[libvirt] [PATCH v3 4/5] qemu: add support for Direct Mode for Hyper-V Synthetic timers

2019-08-05 Thread Vitaly Kuznetsov
QEMU-4.1 supports 'Direct Mode' for Hyper-V synthetic timers
(hv-stimer-direct CPU flag): Windows guests can request that timer
expiration notifications are delivered as normal interrupts (and not
VMBus messages). This is used by Hyper-V on KVM.

Signed-off-by: Vitaly Kuznetsov 
---
 src/qemu/qemu_command.c | 12 
 src/qemu/qemu_process.c | 20 ++--
 tests/qemuxml2argvdata/hyperv.args  |  4 ++--
 tests/qemuxml2argvdata/hyperv.xml   |  4 +++-
 tests/qemuxml2xmloutdata/hyperv.xml |  4 +++-
 5 files changed, 34 insertions(+), 10 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c8494de785..af913dba34 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7152,10 +7152,10 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
 }
 
 if (def->features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_TRISTATE_SWITCH_ON) {
-const char *hvPrefix = "hv-";
+const char *hvDelimiter = "-";
 
 if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CANONICAL_CPU_FEATURES))
-hvPrefix = "hv_";
+hvDelimiter = "_";
 
 for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) {
 switch ((virDomainHyperv) i) {
@@ -7172,9 +7172,13 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
 case VIR_DOMAIN_HYPERV_IPI:
 case VIR_DOMAIN_HYPERV_EVMCS:
 if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
-virBufferAsprintf(, ",%s%s",
-  hvPrefix,
+virBufferAsprintf(, ",hv%s%s",
+  hvDelimiter,
   virDomainHypervTypeToString(i));
+if ((i == VIR_DOMAIN_HYPERV_STIMER) &&
+(def->hyperv_stimer_direct == VIR_TRISTATE_SWITCH_ON))
+virBufferAsprintf(, ",hv%sstimer%sdirect", hvDelimiter,
+  hvDelimiter);
 break;
 
 case VIR_DOMAIN_HYPERV_SPINLOCKS:
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 1ed56457b1..792fa33327 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4112,10 +4112,26 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
 rc = virCPUDataCheckFeature(cpu, cpuFeature);
 VIR_FREE(cpuFeature);
 
-if (rc < 0)
+if (rc < 0) {
 return -1;
-else if (rc == 1)
+} else if (rc == 1) {
+if (i == VIR_DOMAIN_HYPERV_STIMER) {
+if (def->hyperv_stimer_direct != VIR_TRISTATE_SWITCH_ON)
+continue;
+
+rc = virCPUDataCheckFeature(cpu, "hv-stimer-direct");
+if (rc < 0)
+return -1;
+else if (rc == 1)
+continue;
+
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _("host doesn't support hyperv stimer '%s' 
feature"),
+   "direct");
+return -1;
+}
 continue;
+}
 
 switch ((virDomainHyperv) i) {
 case VIR_DOMAIN_HYPERV_RELAXED:
diff --git a/tests/qemuxml2argvdata/hyperv.args 
b/tests/qemuxml2argvdata/hyperv.args
index 086adaa349..8040da9caa 100644
--- a/tests/qemuxml2argvdata/hyperv.args
+++ b/tests/qemuxml2argvdata/hyperv.args
@@ -12,8 +12,8 @@ QEMU_AUDIO_DRV=none \
 -S \
 -machine pc,accel=tcg,usb=off,dump-guest-core=off \
 -cpu 'qemu32,hv_relaxed,hv_vapic,hv-spinlocks=0x2fff,hv_vpindex,hv_runtime,\
-hv_synic,hv_stimer,hv_reset,hv-vendor-id=KVM Hv,hv_frequencies,\
-hv_reenlightenment,hv_tlbflush,hv_ipi,hv_evmcs' \
+hv_synic,hv_stimer,hv_stimer_direct,hv_reset,hv-vendor-id=KVM Hv,\
+hv_frequencies,hv_reenlightenment,hv_tlbflush,hv_ipi,hv_evmcs' \
 -m 214 \
 -realtime mlock=off \
 -smp 6,sockets=6,cores=1,threads=1 \
diff --git a/tests/qemuxml2argvdata/hyperv.xml 
b/tests/qemuxml2argvdata/hyperv.xml
index c6feaed528..ae0f934f76 100644
--- a/tests/qemuxml2argvdata/hyperv.xml
+++ b/tests/qemuxml2argvdata/hyperv.xml
@@ -17,7 +17,9 @@
   
   
   
-  
+  
+
+  
   
   
   
diff --git a/tests/qemuxml2xmloutdata/hyperv.xml 
b/tests/qemuxml2xmloutdata/hyperv.xml
index 5510d3dfad..2e4b43d4c6 100644
--- a/tests/qemuxml2xmloutdata/hyperv.xml
+++ b/tests/qemuxml2xmloutdata/hyperv.xml
@@ -17,7 +17,9 @@
   
   
   
-  
+  
+
+  
   
   
   
-- 
2.20.1

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


[libvirt] [PATCH v3 2/5] conf: change the way how Hyper-V features are printed out

2019-08-05 Thread Vitaly Kuznetsov
Current code doesn't allow us to add sub-features as we always print the
closing '/>'. As a preparatory change to implementing 'direct' sub-feature
for 'stimer' feature switch to printing closing tag individually.

No functional change.

Signed-off-by: Vitaly Kuznetsov 
---
 src/conf/domain_conf.c | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 5cd9939031..f75ee03e9b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -28078,19 +28078,24 @@ virDomainDefFormatFeatures(virBufferPtr buf,
 case VIR_DOMAIN_HYPERV_TLBFLUSH:
 case VIR_DOMAIN_HYPERV_IPI:
 case VIR_DOMAIN_HYPERV_EVMCS:
+virBufferAddLit(, "/>\n");
 break;
 
 case VIR_DOMAIN_HYPERV_SPINLOCKS:
-if (def->hyperv_features[j] != VIR_TRISTATE_SWITCH_ON)
+if (def->hyperv_features[j] != VIR_TRISTATE_SWITCH_ON) {
+virBufferAddLit(, "/>\n");
 break;
-virBufferAsprintf(, " retries='%d'",
+}
+virBufferAsprintf(, " retries='%d'/>\n",
   def->hyperv_spinlocks);
 break;
 
 case VIR_DOMAIN_HYPERV_VENDOR_ID:
-if (def->hyperv_features[j] != VIR_TRISTATE_SWITCH_ON)
+if (def->hyperv_features[j] != VIR_TRISTATE_SWITCH_ON) {
+virBufferAddLit(, "/>\n");
 break;
-virBufferEscapeString(, " value='%s'",
+}
+virBufferEscapeString(, " value='%s'/>\n",
   def->hyperv_vendor_id);
 break;
 
@@ -28098,8 +28103,6 @@ virDomainDefFormatFeatures(virBufferPtr buf,
 case VIR_DOMAIN_HYPERV_LAST:
 break;
 }
-
-virBufferAddLit(, "/>\n");
 }
 virBufferAdjustIndent(, -2);
 virBufferAddLit(, "\n");
-- 
2.20.1

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


[libvirt] [PATCH v3 3/5] conf: add support for Direct Mode for Hyper-V Synthetic timers

2019-08-05 Thread Vitaly Kuznetsov
Support 'Direct Mode' for Hyper-V Synthetic Timers in domain config.
Make it 'stimer' enlightenment option as it is not a separate thing.

Signed-off-by: Vitaly Kuznetsov 
---
 docs/formatdomain.html.in | 10 +++---
 docs/schemas/domaincommon.rng | 16 -
 src/conf/domain_conf.c| 62 ++-
 src/conf/domain_conf.h|  1 +
 src/cpu/cpu_x86.c |  3 ++
 src/cpu/cpu_x86_data.h|  2 ++
 6 files changed, 88 insertions(+), 6 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index f5c882141a..de577e5755 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2033,7 +2033,9 @@
 vpindex state='on'/
 runtime state='on'/
 synic state='on'/
-stimer state='on'/
+stimer state='on'
+  direct state='on'/
+/stimer
 reset state='on'/
 vendor_id state='on' value='KVM Hv'/
 frequencies state='on'/
@@ -2148,9 +2150,9 @@
 
 
   stimer
-  Enable SynIC timers
-  on, off
-  1.3.3 (QEMU 2.6)
+  Enable SynIC timers, optionally with Direct Mode support
+  on, off; direct - on,off
+  1.3.3 (QEMU 2.6), direct mode 5.7.0 (QEMU 
4.1)
 
 
   reset
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index a0771da45b..6707dcc634 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5907,7 +5907,7 @@
 
 
   
-
+
   
 
 
@@ -5956,6 +5956,20 @@
 
   
 
+  
+  
+
+  
+
+  
+  
+
+  
+
+  
+
+  
+
   
   
 
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f75ee03e9b..4d95be8c08 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -20388,6 +20388,39 @@ virDomainDefParseXML(xmlDocPtr xml,
 ctxt->node = node;
 }
 
+if (def->features[VIR_DOMAIN_HYPERV_STIMER] == VIR_TRISTATE_SWITCH_ON) {
+int value;
+if ((n = virXPathNodeSet("./features/hyperv/stimer/*", ctxt, )) 
< 0)
+goto error;
+
+for (i = 0; i < n; i++) {
+if (STRNEQ((const char *)nodes[i]->name, "direct")) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _("unsupported Hyper-V stimer feature: %s"),
+   nodes[i]->name);
+goto error;
+}
+
+if (!(tmp = virXMLPropString(nodes[i], "state"))) {
+virReportError(VIR_ERR_XML_ERROR,
+   _("missing 'state' attribute for "
+ "Hyper-V stimer '%s' feature"), "direct");
+goto error;
+}
+
+if ((value = virTristateSwitchTypeFromString(tmp)) < 0) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _("invalid value of state argument "
+ "for Hyper-V stimer '%s' feature"), "direct");
+goto error;
+}
+
+VIR_FREE(tmp);
+def->hyperv_stimer_direct = value;
+}
+VIR_FREE(nodes);
+}
+
 if (def->features[VIR_DOMAIN_FEATURE_KVM] == VIR_TRISTATE_SWITCH_ON) {
 int feature;
 int value;
@@ -22612,6 +22645,17 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr 
src,
 }
 }
 
+if (src->hyperv_features[VIR_DOMAIN_HYPERV_STIMER] == 
VIR_TRISTATE_SWITCH_ON) {
+if (src->hyperv_stimer_direct != dst->hyperv_stimer_direct) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _("State of HyperV stimer direct feature differs: "
+ "source: '%s', destination: '%s'"),
+   
virTristateSwitchTypeToString(src->hyperv_stimer_direct),
+   
virTristateSwitchTypeToString(dst->hyperv_stimer_direct));
+return false;
+}
+}
+
 /* kvm */
 if (src->features[VIR_DOMAIN_FEATURE_KVM] == VIR_TRISTATE_SWITCH_ON) {
 for (i = 0; i < VIR_DOMAIN_KVM_LAST; i++) {
@@ -28071,7 +28115,6 @@ virDomainDefFormatFeatures(virBufferPtr buf,
 case VIR_DOMAIN_HYPERV_VPINDEX:
 case VIR_DOMAIN_HYPERV_RUNTIME:
 case VIR_DOMAIN_HYPERV_SYNIC:
-case VIR_DOMAIN_HYPERV_STIMER:
 case VIR_DOMAIN_HYPERV_RESET:
 case VIR_DOMAIN_HYPERV_FREQUENCIES:
 case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
@@ -28090,6 +28133,23 @@ virDomainDefFormatFeatures(virBufferPtr buf,
   def->hyperv_spinlocks);
 break;
 
+case VIR_DOMAIN_HYPERV_STIMER:
+if (def->hyperv_features[j] != VIR_TRISTATE_SWITCH_ON) {
+virBufferAddLit(, "/>\n");
+ 

[libvirt] [PATCH v3 5/5] news: mention Direct Mode for Hyper-V Synthetic timers support

2019-08-05 Thread Vitaly Kuznetsov
The QEMU driver now supports Direct Mode for Hyper-V Synthetic timers
for Hyper-V guests.

Signed-off-by: Vitaly Kuznetsov 
---
 docs/news.xml | 9 +
 1 file changed, 9 insertions(+)

diff --git a/docs/news.xml b/docs/news.xml
index a4d727b9c5..d63fca3b48 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -41,6 +41,15 @@
 
   
 
+  
+
+  qemu: Support Direct Mode for Hyper-V Synthetic timers
+
+
+  The QEMU driver now supports Direct Mode for Hyper-V Synthetic timers
+  for Hyper-V guests.
+
+  
 
 
 
-- 
2.20.1

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


Re: [libvirt] [PATCH] daemon: improve Xen support in systemd service

2019-08-05 Thread Jim Fehlig
On 8/1/19 3:36 AM, Daniel P. Berrangé  wrote:
> On Wed, Jul 31, 2019 at 06:18:00PM +, Jim Fehlig wrote:
>> The xencommons service provides all the essential services such as
>> xenstored, xenconsoled, etc. needed by the libvirt Xen driver, so
>> libvirtd should be started after xencommons.
>>
>> The xendomains service uses Xen's xl tool to operate on any domains it
>> finds running, even those managed by libvirt. Add a conflicts on the
>> xendomains service to ensure it is not enabled when libvirtd is enabled.
>>
>> Signed-off-by: Jim Fehlig 
>> ---
>>   src/remote/libvirtd.service.in | 2 ++
>>   1 file changed, 2 insertions(+)
> 
> Reviewed-by: Daniel P. Berrangé 

I've pushed this now that the release is out.

Regards,
Jim

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

Re: [libvirt] [PATCH] tools: console: Use proper constructor

2019-08-05 Thread Michal Prívozník
On 8/5/19 6:03 PM, Roman Bolshakov wrote:
> "virsh console" on macOS cannot attach to a domain and it doesn't matter if
> it's local or remote domain:
>   $ ~ virsh console vm
>   Connected to domain vm
>   Escape character is ^]
>   error: internal error: unable to wait on console condition
> 
> The error comes from pthread_cond_wait that fails with EINVAL. The mutex
> in the parent is not initialized with pthread_mutex_init and it results
> in silent failure of pthead_mutex_lock and the attach failure.
> 
> Fixes: 98361cc3b95 ("tools: console: make console virLockableObject")
> Signed-off-by: Roman Bolshakov 
> ---
>  tools/virsh-console.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Ooops, ACKed and pushed.

Michal

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


[libvirt] [PATCH] news.xml: Restore blank news example

2019-08-05 Thread Michal Privoznik
In v5.6.0-rc1~347 I've mistakenly messed up news.xml as the
change I wanted to promote was added into a comment (I blame git
rebase for that). Anyway, restore the original state of the
comment so it can be copied again.

Signed-off-by: Michal Privoznik 
---

Pushed under trivial rule.

 docs/news.xml | 13 -
 1 file changed, 13 deletions(-)

diff --git a/docs/news.xml b/docs/news.xml
index 3c5cd7d597..a4d727b9c5 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -25,19 +25,6 @@
 
 
 
-  
-
-  Remember original owners and SELinux labels of files
-
-
-  When a domain is starting up libvirt changes DAC and
-  SELinux labels so that domain can access it. However,
-  it never remembered the original labels and therefore
-  the file was returned back to root:root.
-  With this release, the original labels are remembered
-  and restored properly.
-
-  
 
 
 
-- 
2.21.0

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


[libvirt] Release of libvirt-5.6.0

2019-08-05 Thread Daniel Veillard
  It's out ! Tagged in git and with signed tarball and source rpm at the usual
place:

https://libvirt.org/sources/

I also released the 5.6.0 python bindings for the release that can be found
at:

https://libvirt.org/sources/python/


This release includes a number of new features, notably the checkpoint APIs
removes the sxpr xen support and carries a set of improvement and bug fixes
as usual:

New features:

- qemu: Introduce a new video model of type 'bochs'
Introduce a new video model type that supports the bochs-display device
that was added in qemu version 3.0.

- api: new virDomainCheckpoint APIs
Introduce several new APIs for creating and managing checkpoints in the
test and qemu drivers (the latter requires qcow2 images). Checkpoints
serve as a way to tell which portions of a disk have changed since a
point in time.

- qemu: Add support for overriding max threads per process limit
systemd-based systems impose a limit on the number of threads a process
can spawn, which in some cases can be exceeded by QEMU processes
running VMs. Add a max_threads_per_process option to qemu.conf to
override the system default.

- Remember original owners and SELinux labels of files
When a domain is starting up libvirt changes DAC and SELinux labels so
that domain can access it. However, it never remembered the original
labels and therefore the file was returned back to root:root. With this
release, the original labels are remembered and restored properly.

- network: Allow passing arbitrary options to dnsmasq
This works similarly to the existing support for passing arbitary
options to QEMU, and just like that feature it comes with no support
guarantees.

Removed features:

- xen: Remove sxpr config support
Remove the sxpr style config parser and formatter a year after the xend
driver was removed.

Improvements:

- qemu: Allow XML validation for snapshot creation
Add flag VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE to validate snapshot input
XML. For virsh, users can use it as virsh snapshot-create --validate.

- Support encrypted soft TPM
A soft TPM backend could be encrypted with passphrase. Now libvirt
supports using a secret object to hold the passphrase, and referring to
it via the encryption element of the TPM device.

- test driver: Expand API coverage
Additional APIs have been implemented in the test driver.

- Implement per-driver locking
Drivers now acquire a lock when they're loaded, ensuring that there can
never be two instances of the same driver active at a time.

- nss: Report newer addresses first
In some cases, a guest might be assigned a new IP address by DHCP
before the previous lease has expired, in which case the NSS plugin
will correctly report both addresses; many applications, however,
ignore all addresses but the first, and may thus end up trying to
connect using a stale address. To prevent that from happening, the NSS
plugin will now always report the newest address first.

- util: Optimize mass closing of FDs when spawning child processes
When the limit on the number of FDs is very high, closing all unwanted
FDs after calling fork() can take a lot of time and delay the start of
the child process. libvirt will now use an optimized algorithm that
minimizes such delays.

Bug fixes:

- logging: Ensure virtlogd rollover takes priority over logrotate
virtlogd implements its own rollover mechanism, but until now logrotate
could end up acting on the logs before virtlogd had a chance to do so
itself.


Thanks everybody who helped with this release, be it with bug reports,
patches, reviews, documenation, localization, etc ...

  Enjoy the release,

Daniel

-- 
Daniel Veillard  | Red Hat Developers Tools http://developer.redhat.com/
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


[libvirt] [PATCH] maint: Post-release version bump to 5.7.0

2019-08-05 Thread Michal Privoznik
Signed-off-by: Michal Privoznik 
---

Pushed under trivial rule.

 configure.ac  | 2 +-
 docs/news.xml | 8 
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index d18d427695..109827b89c 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 .
 
-AC_INIT([libvirt], [5.6.0], [libvir-list@redhat.com], [], 
[https://libvirt.org])
+AC_INIT([libvirt], [5.7.0], [libvir-list@redhat.com], [], 
[https://libvirt.org])
 AC_CONFIG_SRCDIR([src/libvirt.c])
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_HEADERS([config.h])
diff --git a/docs/news.xml b/docs/news.xml
index 9d95b827ed..3c5cd7d597 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -52,6 +52,14 @@
  -->
 
 
+  
+
+
+
+
+
+
+  
   
 
   
-- 
2.21.0

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


[libvirt] [PATCH 3/5] qemu_firmware: Extend qemuFirmwareGetSupported to return FW paths

2019-08-05 Thread Michal Privoznik
The qemuFirmwareGetSupported() function is called from qemu
driver to generate domain capabilities XML based on FW descriptor
files. However, the function currently reports only some features
from domcapabilities XML and not actual FW image paths. The paths
reported in the domcapabilities XML still from from pre-FW
descriptor era and therefore the XML might be a bit confusing.
For instance, it may say that secure boot is supported but
secboot enabled FW is not in the listed FW image paths.

To resolve this problem, change qemuFirmwareGetSupported() so
that it also returns a list of FW images (we have the list
anyway). Luckily, we already have a structure to represent a FW
image - virFirmware.

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

Signed-off-by: Michal Privoznik 
---
 src/qemu/qemu_capabilities.c |  3 +-
 src/qemu/qemu_firmware.c | 62 +++-
 src/qemu/qemu_firmware.h |  5 ++-
 tests/qemufirmwaretest.c |  2 +-
 4 files changed, 68 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 2388f145af..db1fc31cd9 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5165,7 +5165,8 @@ virQEMUCapsFillDomainOSCaps(virDomainCapsOSPtr os,
 os->supported = VIR_TRISTATE_BOOL_YES;
 os->firmware.report = true;
 
-if (qemuFirmwareGetSupported(machine, arch, privileged, , 
) < 0)
+if (qemuFirmwareGetSupported(machine, arch, privileged,
+ , , NULL, NULL) < 0)
 return -1;
 
 if (autoFirmwares & (1ULL << VIR_DOMAIN_OS_DEF_FIRMWARE_BIOS))
diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index 8fbe8952ba..9ba38477cc 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -1420,6 +1420,8 @@ qemuFirmwareFillDomain(virQEMUDriverPtr driver,
  * @privileged: whether running as privileged user
  * @supported: returned bitmap of supported interfaces
  * @secure: true if at least one secure boot enabled FW was found
+ * @fws: (optional) list of found firmwares
+ * @nfws: (optional) number of members in @fws
  *
  * Parse all FW descriptors (depending whether running as @privileged this may
  * or may not include user's $HOME) and for given combination of @machine and
@@ -1429,6 +1431,15 @@ qemuFirmwareFillDomain(virQEMUDriverPtr driver,
  * FW descriptor signalizes secure boot (although, this is checked against SMM
  * rather than SECURE_BOOT because reasons).
  *
+ * If @fws and @nfws are not NULL, then @fws is allocated (must be freed by
+ * caller when no longer needed) and contains list of firmwares found in form
+ * of virFirmware. This can be useful if caller wants to know the paths to
+ * firmware images (e.g. to present them in domain capabilities XML).
+ * Moreover, to allow the caller distinguish between no FW descriptors found
+ * and no matching FW descriptors found (nfws == 0 in both cases), the @fws is
+ * going to be allocated in case of the latter anyway (with no real content
+ * though).
+ *
  * Returns: 0 on success,
  * -1 otherwise.
  */
@@ -1437,7 +1448,9 @@ qemuFirmwareGetSupported(const char *machine,
  virArch arch,
  bool privileged,
  uint64_t *supported,
- bool *secure)
+ bool *secure,
+ virFirmwarePtr **fws,
+ size_t *nfws)
 {
 qemuFirmwarePtr *firmwares = NULL;
 ssize_t nfirmwares = 0;
@@ -1446,12 +1459,21 @@ qemuFirmwareGetSupported(const char *machine,
 *supported = VIR_DOMAIN_OS_DEF_FIRMWARE_NONE;
 *secure = false;
 
+if (fws) {
+*fws = NULL;
+*nfws = 0;
+}
+
 if ((nfirmwares = qemuFirmwareFetchParsedConfigs(privileged,
  , NULL)) < 0)
 return -1;
 
 for (i = 0; i < nfirmwares; i++) {
 qemuFirmwarePtr fw = firmwares[i];
+const qemuFirmwareMappingFlash *flash = >mapping.data.flash;
+const qemuFirmwareMappingMemory *memory = >mapping.data.memory;
+const char *fwpath = NULL;
+const char *nvrampath = NULL;
 size_t j;
 
 if (!qemuFirmwareMatchesMachineArch(fw, machine, arch))
@@ -1491,8 +1513,46 @@ qemuFirmwareGetSupported(const char *machine,
 break;
 }
 }
+
+switch (fw->mapping.device) {
+case QEMU_FIRMWARE_DEVICE_FLASH:
+fwpath = flash->executable.filename;
+nvrampath = flash->nvram_template.filename;
+break;
+
+case QEMU_FIRMWARE_DEVICE_MEMORY:
+fwpath = memory->filename;
+break;
+
+case QEMU_FIRMWARE_DEVICE_KERNEL:
+case QEMU_FIRMWARE_DEVICE_NONE:
+case QEMU_FIRMWARE_DEVICE_LAST:
+break;
+}
+
+if (fws && fwpath) {
+VIR_AUTOPTR(virFirmware) tmp = NULL;
+

[libvirt] [PATCH 4/5] qemufirmwaretest: Test FW path getting through qemuFirmwareGetSupported()

2019-08-05 Thread Michal Privoznik
There is one hack hidden here, but since this is in a test, it's
okay. In order to get a list of expected firmwares in
virFirmwarePtr form I'm using virFirmwareParseList(). But
usually, in real life scenario, this function is used only to
parse a list of UEFI images which have NVRAM split out. In other
words, this function expects ${FW}:${NVRAM} pairs. But in this
test, we also want to allow just a single path: ${FW} because
some reported firmwares are just a BIOS image really. To avoid
writing some parser function, let's just pass "NULL" as ${NVRAM}
and fix the result later.

Signed-off-by: Michal Privoznik 
---
 tests/qemufirmwaretest.c | 78 
 1 file changed, 71 insertions(+), 7 deletions(-)

diff --git a/tests/qemufirmwaretest.c b/tests/qemufirmwaretest.c
index bab23f696e..653476fdc1 100644
--- a/tests/qemufirmwaretest.c
+++ b/tests/qemufirmwaretest.c
@@ -105,6 +105,7 @@ struct supportedData {
 const char *machine;
 virArch arch;
 bool secure;
+const char *fwlist;
 unsigned int *interfaces;
 size_t ninterfaces;
 };
@@ -117,15 +118,35 @@ testSupportedFW(const void *opaque)
 uint64_t actualInterfaces;
 uint64_t expectedInterfaces = 0;
 bool actualSecure;
+virFirmwarePtr *expFWs = NULL;
+size_t nexpFWs = 0;
+virFirmwarePtr *actFWs = NULL;
+size_t nactFWs = 0;
 size_t i;
+int ret = -1;
 
 for (i = 0; i < data->ninterfaces; i++)
 expectedInterfaces |= 1ULL << data->interfaces[i];
 
+if (virFirmwareParseList(data->fwlist, , ) < 0) {
+fprintf(stderr, "Unable to parse list of expected FW paths\n");
+return -1;
+}
+
+/* virFirmwareParseList() expects to see pairs of paths: ${FW}:${NVRAM}.
+ * Well, some images don't have a NVRAM store. In that case NULL was 
passed:
+ * ${FW}:NULL. Now iterate over expected firmwares and fix this. */
+for (i = 0; i < nexpFWs; i++) {
+virFirmwarePtr tmp = expFWs[i];
+
+if (STREQ(tmp->nvram, "NULL"))
+VIR_FREE(tmp->nvram);
+}
+
 if (qemuFirmwareGetSupported(data->machine, data->arch, false,
- , , NULL, NULL) 
< 0) {
+ , , , 
) < 0) {
 fprintf(stderr, "Unable to get list of supported interfaces\n");
-return -1;
+goto cleanup;
 }
 
 if (actualInterfaces != expectedInterfaces) {
@@ -133,7 +154,7 @@ testSupportedFW(const void *opaque)
 "Mismatch in supported interfaces. "
 "Expected 0x%" PRIx64 " got 0x%" PRIx64 "\n",
 expectedInterfaces, actualInterfaces);
-return -1;
+goto cleanup;
 }
 
 if (actualSecure != data->secure) {
@@ -141,10 +162,42 @@ testSupportedFW(const void *opaque)
 "Mismatch in SMM requirement/support. "
 "Expected %d got %d\n",
 data->secure, actualSecure);
-return -1;
+goto cleanup;
 }
 
-return 0;
+for (i = 0; i < nactFWs; i++) {
+virFirmwarePtr actFW = actFWs[i];
+virFirmwarePtr expFW = NULL;
+
+if (i >= nexpFWs) {
+fprintf(stderr, "Unexpected FW image: %s NVRAM: %s\n",
+actFW->name, NULLSTR(actFW->nvram));
+goto cleanup;
+}
+
+expFW = expFWs[i];
+
+if (STRNEQ(actFW->name, expFW->name) ||
+STRNEQ_NULLABLE(actFW->nvram, expFW->nvram)) {
+fprintf(stderr, "Unexpected FW image: %s NVRAM: %s\n"
+"Expected: %s NVRAM: %s\n",
+actFW->name, NULLSTR(actFW->nvram),
+expFW->name, NULLSTR(expFW->nvram));
+goto cleanup;
+}
+}
+
+if (i < nexpFWs) {
+fprintf(stderr, "Expected FW image: %s NVRAM: %s got nothing\n",
+expFWs[i]->name, NULLSTR(expFWs[i]->nvram));
+goto cleanup;
+}
+
+ret = 0;
+ cleanup:
+virFirmwareFreeList(actFWs, nactFWs);
+virFirmwareFreeList(expFWs, nexpFWs);
+return ret;
 }
 
 
@@ -176,10 +229,13 @@ mymain(void)
 if (virTestRun("QEMU FW precedence test", testFWPrecedence, NULL) < 0)
 ret = -1;
 
-#define DO_SUPPORTED_TEST(machine, arch, secure, ...) \
+/* The @fwlist contains pairs of ${FW}:${NVRAM}. If there's
+ * no NVRAM expected pass literal "NULL" and test fixes that
+ * later. */
+#define DO_SUPPORTED_TEST(machine, arch, secure, fwlist, ...) \
 do { \
 unsigned int interfaces[] = {__VA_ARGS__}; \
-struct supportedData data = {machine, arch, secure, \
+struct supportedData data = {machine, arch, secure, fwlist, \
  interfaces, 
ARRAY_CARDINALITY(interfaces)}; \
 if (virTestRun("QEMU FW SUPPORTED " machine " " #arch, \
testSupportedFW, ) < 0) \
@@ -187,16 +243,24 @@ mymain(void)
 } while (0)
 
 DO_SUPPORTED_TEST("pc-i440fx-3.1", VIR_ARCH_X86_64, false,
+   

[libvirt] [PATCH 1/5] virfirmware: Expose and define autoptr for virFirmwareFree

2019-08-05 Thread Michal Privoznik
This function frees a _virFirmware struct. So far, it doesn't
need to be called from outside of the module, but this will
change shortly. In the light of recent VIR_DEFINE_AUTOPTR_FUNC()
additions, do the same to virFirmwareFree().

Signed-off-by: Michal Privoznik 
---
 src/libvirt_private.syms | 1 +
 src/util/virfirmware.c   | 2 +-
 src/util/virfirmware.h   | 5 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index c323f679b3..c66161496e 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2036,6 +2036,7 @@ virFirewallDZoneExists;
 
 
 # util/virfirmware.h
+virFirmwareFree;
 virFirmwareFreeList;
 virFirmwareParse;
 virFirmwareParseList;
diff --git a/src/util/virfirmware.c b/src/util/virfirmware.c
index f41e000447..b4747bd346 100644
--- a/src/util/virfirmware.c
+++ b/src/util/virfirmware.c
@@ -31,7 +31,7 @@
 VIR_LOG_INIT("util.firmware");
 
 
-static void
+void
 virFirmwareFree(virFirmwarePtr firmware)
 {
 if (!firmware)
diff --git a/src/util/virfirmware.h b/src/util/virfirmware.h
index ed59f34102..30bcd21fa4 100644
--- a/src/util/virfirmware.h
+++ b/src/util/virfirmware.h
@@ -31,6 +31,11 @@ struct _virFirmware {
 };
 
 
+void
+virFirmwareFree(virFirmwarePtr firmware);
+
+VIR_DEFINE_AUTOPTR_FUNC(virFirmware, virFirmwareFree);
+
 void
 virFirmwareFreeList(virFirmwarePtr *firmwares, size_t nfirmwares);
 
-- 
2.21.0

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


[libvirt] [PATCH 2/5] qemu_firmware: Document qemuFirmwareGetSupported

2019-08-05 Thread Michal Privoznik
This function is going to get some new arguments. Document the
current ones for clarity.

Signed-off-by: Michal Privoznik 
---
 src/qemu/qemu_firmware.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index bf29b10b9a..8fbe8952ba 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -1413,6 +1413,25 @@ qemuFirmwareFillDomain(virQEMUDriverPtr driver,
 }
 
 
+/**
+ * qemuFirmwareGetSupported:
+ * @machine: machine type
+ * @arch: architecture
+ * @privileged: whether running as privileged user
+ * @supported: returned bitmap of supported interfaces
+ * @secure: true if at least one secure boot enabled FW was found
+ *
+ * Parse all FW descriptors (depending whether running as @privileged this may
+ * or may not include user's $HOME) and for given combination of @machine and
+ * @arch extract information to be later reported in domain capabilities.
+ * The @supported contains a bitmap of found interfaces (and ORed values of 1
+ * << VIR_DOMAIN_OS_DEF_FIRMWARE_*). Then, @supported is true if at least one
+ * FW descriptor signalizes secure boot (although, this is checked against SMM
+ * rather than SECURE_BOOT because reasons).
+ *
+ * Returns: 0 on success,
+ * -1 otherwise.
+ */
 int
 qemuFirmwareGetSupported(const char *machine,
  virArch arch,
-- 
2.21.0

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


[libvirt] [PATCH 0/5] qemu: Use FW descriptors to report FW image paths

2019-08-05 Thread Michal Privoznik
It feels a bit odd to report a built in list of FW images when we have
FW descriptor files. Especially, when some weird architectures are
concerned. For instance, OVMF_CODE.fd is reported even for
non-x86_64/non-i386 arches, like ppc. But if FW descriptor files are
taken into the picture then no OVMF_CODE.fd is ever reported.

One can argue, that these patches are not necessary, because the whole
point of FW descriptor files is that users do not have to bother with
paths to FW images. And that is true. However, the whole ecosystem of
FW descriptor files allows sys admins and regular users to write their
own FW descriptor files and thus reporting what paths libvirt found
might come handy when writing those descriptors.

Michal Prívozník (5):
  virfirmware: Expose and define autoptr for virFirmwareFree
  qemu_firmware: Document qemuFirmwareGetSupported
  qemu_firmware: Extend qemuFirmwareGetSupported to return FW paths
  qemufirmwaretest: Test FW path getting through
qemuFirmwareGetSupported()
  qemu: Use FW descriptors to report FW image paths

 src/libvirt_private.syms |  1 +
 src/qemu/qemu_capabilities.c | 19 +++--
 src/qemu/qemu_firmware.c | 81 +++-
 src/qemu/qemu_firmware.h |  5 ++-
 src/util/virfirmware.c   |  2 +-
 src/util/virfirmware.h   |  5 +++
 tests/qemufirmwaretest.c | 78 ++
 7 files changed, 177 insertions(+), 14 deletions(-)

-- 
2.21.0

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

[libvirt] [PATCH 5/5] qemu: Use FW descriptors to report FW image paths

2019-08-05 Thread Michal Privoznik
Now that we have qemuFirmwareGetSupported() so that it also
returns a list of FW image paths, we can use it to report them in
domain capabilities instead of the old time default list.

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

Signed-off-by: Michal Privoznik 
---
 src/qemu/qemu_capabilities.c | 18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index db1fc31cd9..318cfcebf3 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5161,12 +5161,16 @@ virQEMUCapsFillDomainOSCaps(virDomainCapsOSPtr os,
 virDomainCapsLoaderPtr capsLoader = >loader;
 uint64_t autoFirmwares = 0;
 bool secure = false;
+virFirmwarePtr *firmwaresAlt = NULL;
+size_t nfirmwaresAlt = 0;
+int ret = -1;
 
 os->supported = VIR_TRISTATE_BOOL_YES;
 os->firmware.report = true;
 
 if (qemuFirmwareGetSupported(machine, arch, privileged,
- , , NULL, NULL) < 0)
+ , ,
+ , ) < 0)
 return -1;
 
 if (autoFirmwares & (1ULL << VIR_DOMAIN_OS_DEF_FIRMWARE_BIOS))
@@ -5174,9 +5178,15 @@ virQEMUCapsFillDomainOSCaps(virDomainCapsOSPtr os,
 if (autoFirmwares & (1ULL << VIR_DOMAIN_OS_DEF_FIRMWARE_EFI))
 VIR_DOMAIN_CAPS_ENUM_SET(os->firmware, VIR_DOMAIN_OS_DEF_FIRMWARE_EFI);
 
-if (virQEMUCapsFillDomainLoaderCaps(capsLoader, secure, firmwares, 
nfirmwares) < 0)
-return -1;
-return 0;
+if (virQEMUCapsFillDomainLoaderCaps(capsLoader, secure,
+firmwaresAlt ? firmwaresAlt : 
firmwares,
+firmwaresAlt ? nfirmwaresAlt : 
nfirmwares) < 0)
+goto cleanup;
+
+ret = 0;
+ cleanup:
+virFirmwareFreeList(firmwaresAlt, nfirmwaresAlt);
+return ret;
 }
 
 
-- 
2.21.0

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


[libvirt] [PATCH] tools: console: Use proper constructor

2019-08-05 Thread Roman Bolshakov
"virsh console" on macOS cannot attach to a domain and it doesn't matter if
it's local or remote domain:
  $ ~ virsh console vm
  Connected to domain vm
  Escape character is ^]
  error: internal error: unable to wait on console condition

The error comes from pthread_cond_wait that fails with EINVAL. The mutex
in the parent is not initialized with pthread_mutex_init and it results
in silent failure of pthead_mutex_lock and the attach failure.

Fixes: 98361cc3b95 ("tools: console: make console virLockableObject")
Signed-off-by: Roman Bolshakov 
---
 tools/virsh-console.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/virsh-console.c b/tools/virsh-console.c
index 826a4afcb2..e16f841e57 100644
--- a/tools/virsh-console.c
+++ b/tools/virsh-console.c
@@ -367,7 +367,7 @@ virConsoleNew(void)
 if (virConsoleInitialize() < 0)
 return NULL;
 
-if (!(con = virObjectNew(virConsoleClass)))
+if (!(con = virObjectLockableNew(virConsoleClass)))
 return NULL;
 
 if (virCondInit(>cond) < 0) {
-- 
2.20.1 (Apple Git-117)

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


Re: [libvirt] [PATCH] qemu: support bootindex on vfio-ccw mdev device

2019-08-05 Thread Boris Fiuczynski

On 8/2/19 3:30 PM, Peter Krempa wrote:

On Fri, Aug 02, 2019 at 15:15:59 +0200, Boris Fiuczynski wrote:

Add support to specify a boot order on vfio-ccw passthrough devices.

Signed-off-by: Boris Fiuczynski 
Acked-by: Jason J. Herne 
Reviewed-by: Marc Hartmayer 
---
  src/qemu/qemu_command.c   | 27 +
  .../hostdev-subsys-mdev-vfio-ccw-boot.args| 29 +++
  .../hostdev-subsys-mdev-vfio-ccw-boot.xml | 23 +++
  tests/qemuxml2argvtest.c  |  4 +++
  4 files changed, 78 insertions(+), 5 deletions(-)
  create mode 100644 
tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw-boot.args
  create mode 100644 
tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw-boot.xml


Note that I don't currently have enough information to verify that the
mdev claim is correct (e.g. why it's only with CCW devices?), but I have
two formal comments:
Since I know that on s390 you can boot from a vfio-ccw mediated device 
but not from a vfio-ap mediated device I chose the default as "not 
capable to boot from" and check especially for the "known to be capable 
to boot from" mdevs. I have no problem changing the logic if desired.


If we want to skip the checking than an qemu internal error like this 
occurs:

error: Failed to start domain mini-ap
error: internal error: qemu unexpectedly closed the monitor: 
2019-08-05T13:44:27.871697Z qemu-system-s390x: -device 
vfio-ap,id=hostdev0,sysfsdev=/sys/bus/mdev/devices/9063cba3-ecef-47b6-abcf-3fef4fdcad85,bootindex=1: 
Property '.bootindex' not found






diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index fee51158a9..36138e2ccf 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5613,6 +5613,9 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *def,
  if (qemuBuildDeviceAddressStr(, def, dev->info, qemuCaps) < 0)
  goto cleanup;
  
+if (dev->info->bootIndex)

+virBufferAsprintf(, ",bootindex=%u", dev->info->bootIndex);
+
  if (virBufferCheckError() < 0)
  goto cleanup;
  
@@ -5624,6 +5627,22 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *def,

  return ret;
  }
  
+static bool

+qemuHostdevSupportsBoot(virDomainHostdevDefPtr hostdev)


Refactor to this function should be separate from the logic change
below.


Agreed.




+{
+if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
+virDomainHostdevSubsysPtr subsys = >source.subsys;
+if (subsys->type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI ||
+subsys->type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB ||
+subsys->type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI ||
+(subsys->type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV &&
+subsys->u.mdev.model == VIR_MDEV_MODEL_TYPE_VFIO_CCW)) {


This line is misaligned. Please make sure that it's clear that the above
line belongs to the term in the brackets.


I will fix it.





+return true;
+}
+}
+return false;
+}
+
  static int
  qemuBuildHostdevCommandLine(virCommandPtr cmd,
  const virDomainDef *def,
@@ -5638,13 +5657,11 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd,
  char *devstr;
  
  if (hostdev->info->bootIndex) {

-if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
-(subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
- subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB &&
- subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI)) {
+if (!qemuHostdevSupportsBoot(hostdev)) {
  virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
 _("booting from assigned devices is only "
- "supported for PCI, USB and SCSI devices"));
+ "supported for PCI, USB, SCSI and MDEV "
+ "of model vfio-ccw devices"));


Ideally this validation will be done in the validation callback rather
than in the command line generator. (pre-existing so I don't require you
to refactor this at this time). >
Also this error can be probably stashed into qemuHostdevSupportsBoot.
(and name it like qemuHostdevValidateBoot).


Ok, I will rename the method and move the error report.




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




--
Mit freundlichen Grüßen/Kind regards
   Boris Fiuczynski

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Matthias Hartmann
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

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


Re: [libvirt] [PATCH 4/4] tests: Add separate tests for 'xres' and 'yres'

2019-08-05 Thread Ján Tomko

On Sun, Aug 04, 2019 at 10:21:21PM -0300, jcfara...@gmail.com wrote:

From: Julio Faracco 

New tests to verify resolution properties of a simple qxl video.

Signed-off-by: Julio Faracco 
---
.../video-qxl-resolution.args | 32 +++


xml->argv test should be introduced along with the qemu_command changes.


.../qemuxml2argvdata/video-qxl-resolution.xml | 40 +++
tests/qemuxml2argvtest.c  |  4 ++
.../video-qxl-resolution.xml  | 40 +++
tests/qemuxml2xmltest.c   |  1 +
5 files changed, 117 insertions(+)
create mode 100644 tests/qemuxml2argvdata/video-qxl-resolution.args
create mode 100644 tests/qemuxml2argvdata/video-qxl-resolution.xml
create mode 100644 tests/qemuxml2xmloutdata/video-qxl-resolution.xml

diff --git a/tests/qemuxml2argvdata/video-qxl-resolution.args 
b/tests/qemuxml2argvdata/video-qxl-resolution.args
new file mode 100644
index 00..71370ff735
diff --git a/tests/qemuxml2argvdata/video-qxl-resolution.xml 
b/tests/qemuxml2argvdata/video-qxl-resolution.xml
new file mode 100644
index 00..c6275c1bc5
--- /dev/null
+++ b/tests/qemuxml2argvdata/video-qxl-resolution.xml
@@ -0,0 +1,40 @@
+
+  QEMUGuest1
+  c7a5fdbd-edaf-9455-926a-d65c16db1809
+  219136
+  219136
+  1
+  
+hvm
+
+  
+  
+  destroy
+  restart
+  destroy
+  
+/usr/bin/qemu-system-i686
+
+  
+  
+  
+  
+


No need for a disk for testing graphics devices.


+
+  
+
+
+  
+
+
+
+
+
+  


I'm not a fan of blindly copying qemu's laconic arguments.
Also, for other devices, we'd put such arguments into the 
element, not .

So I propose either:

 


or


 


+  
+
+
+  
+
+  
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index c166fd18d6..b67ba8f135 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2003,6 +2003,10 @@ mymain(void)
QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
QEMU_CAPS_DEVICE_QXL,
QEMU_CAPS_QXL_MAX_OUTPUTS);
+DO_TEST("video-qxl-resolution",
+QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+QEMU_CAPS_DEVICE_QXL,
+QEMU_CAPS_QXL_MAX_OUTPUTS);


Please use DO_TEST_CAPS_LATEST which runs the test with the latest QEMU
capabilities we have collected from a real QEMU instance. With manually
enumerating the capabilities there's a risk of missing some.

If you want to test it against an older QEMU version which lacked some
capability, there's DO_TEST_CAPS_VER

Jano


DO_TEST("video-virtio-gpu-device",
QEMU_CAPS_DEVICE_VIRTIO_GPU,
QEMU_CAPS_DEVICE_VIDEO_PRIMARY);


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

Re: [libvirt] [PATCH 3/4] qemu: Generate 'xres' and 'yres' for qxl device.

2019-08-05 Thread Erik Skultety
On Mon, Aug 05, 2019 at 12:30:48PM +0200, Ján Tomko wrote:
> On Mon, Aug 05, 2019 at 08:43:14AM +0200, Erik Skultety wrote:
> > On Sun, Aug 04, 2019 at 10:21:20PM -0300, jcfara...@gmail.com wrote:
> > > From: Julio Faracco 
> > >
> > > Now, QEMU command line can define 'xres' and 'yres' if XML contains both
> > > properties from qxl model.
> > >
> > > Signed-off-by: Julio Faracco 
> > > ---
> > >  src/qemu/qemu_command.c | 4 
> > >  1 file changed, 4 insertions(+)
> > >
> > > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> > > index fee51158a9..82430e7e98 100644
> > > --- a/src/qemu/qemu_command.c
> > > +++ b/src/qemu/qemu_command.c
> > > @@ -4713,6 +4713,10 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
> > >  if (video->heads)
> > >  virBufferAsprintf(, ",max_outputs=%u", video->heads);
> > >  }
> > > +
> > > +if (video->xres && video->yres)
> > > +virBufferAsprintf(, ",xres=%u,yres=%u", video->xres, 
> > > video->yres);
> >
> > Capabilities changes are needed. The support for specifying video resolution
> > was added in qemu 2.10.0, libvirt supports as old as 1.5.0. Unfortunately,
> > device properties listing isn't QAPIfied yet, so we can't probe this 
> > properly.
> >
>
> Not sure how QAPI comes into play here, but we already do probe for
> qxl's other properties and git grep "xres" tests does show hits from
> replies files from 2.10.0 on.

I stand corrected, I must have overlooked, in which case, there shouldn't
really be any problem in querying the property properly.

Erik

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

Re: [libvirt] [PATCH 2/4] conf: Adding XML support for 'xres' and 'yres'

2019-08-05 Thread Ján Tomko

On Mon, Aug 05, 2019 at 12:39:58PM +0200, Ján Tomko wrote:

On Sun, Aug 04, 2019 at 10:21:19PM -0300, jcfara...@gmail.com wrote:

From: Julio Faracco 

XML need to support both properties together. This commit adds XML
support for QXL model if they are set. Domain configuration is able to


The commit message should show an example of the XML that is being
added.
Also, the XML->XML test should be a part of this commit.

Jano


parse this properties.

Signed-off-by: Julio Faracco 
---
src/conf/domain_conf.c | 26 ++
src/conf/domain_conf.h |  2 ++
2 files changed, 28 insertions(+)






Reviewed-by: Ján Tomko 


Oops, ignore this, I pressed the wrong key combination when sending the
e-mail.



Jano





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

Re: [libvirt] [PATCH 0/4] Adding resolution properties for QXL device

2019-08-05 Thread Gerd Hoffmann
On Mon, Aug 05, 2019 at 11:17:35AM +0200, Erik Skultety wrote:
> On Mon, Aug 05, 2019 at 09:12:26AM +0200, Gerd Hoffmann wrote:
> > On Sun, Aug 04, 2019 at 10:21:17PM -0300, jcfara...@gmail.com wrote:
> > > From: Julio Faracco 
> > >
> > > This serie adds 'xres' and 'yres' properties into XML definition for QXL
> > > video device to specify a default resolution. This serie covers a simple
> > > test case too.
> >
> > Why limit this to qxl?
> >
> > virtio and stdvga support xres+yres too.
> >
> > Note: on stdvga this requires edid support (available since 3.1, enabled
> > by default since 4.1).
> 
> Gerd, I'd already responded by the time you had a look, so just to confirm 
> that
> I'd looked at the schema properly, it isn't possible to query support for this
> from QAPI, is it?

You can check this using "qemu -device VGA,help".  I'm not sure whenever
there is a QAPI version of that.

cheers,
  Gerd

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


Re: [libvirt] [PATCH 2/4] conf: Adding XML support for 'xres' and 'yres'

2019-08-05 Thread Ján Tomko

On Sun, Aug 04, 2019 at 10:21:19PM -0300, jcfara...@gmail.com wrote:

From: Julio Faracco 

XML need to support both properties together. This commit adds XML
support for QXL model if they are set. Domain configuration is able to


The commit message should show an example of the XML that is being
added.
Also, the XML->XML test should be a part of this commit.

Jano


parse this properties.

Signed-off-by: Julio Faracco 
---
src/conf/domain_conf.c | 26 ++
src/conf/domain_conf.h |  2 ++
2 files changed, 28 insertions(+)



Reviewed-by: Ján Tomko 

Jano


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

Re: [libvirt] [PATCH 3/4] qemu: Generate 'xres' and 'yres' for qxl device.

2019-08-05 Thread Ján Tomko

On Mon, Aug 05, 2019 at 08:43:14AM +0200, Erik Skultety wrote:

On Sun, Aug 04, 2019 at 10:21:20PM -0300, jcfara...@gmail.com wrote:

From: Julio Faracco 

Now, QEMU command line can define 'xres' and 'yres' if XML contains both
properties from qxl model.

Signed-off-by: Julio Faracco 
---
 src/qemu/qemu_command.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index fee51158a9..82430e7e98 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4713,6 +4713,10 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
 if (video->heads)
 virBufferAsprintf(, ",max_outputs=%u", video->heads);
 }
+
+if (video->xres && video->yres)
+virBufferAsprintf(, ",xres=%u,yres=%u", video->xres, 
video->yres);


Capabilities changes are needed. The support for specifying video resolution
was added in qemu 2.10.0, libvirt supports as old as 1.5.0. Unfortunately,
device properties listing isn't QAPIfied yet, so we can't probe this properly.



Not sure how QAPI comes into play here, but we already do probe for
qxl's other properties and git grep "xres" tests does show hits from
replies files from 2.10.0 on.

Jano


Erik

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


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

Re: [libvirt] [PATCH 0/4] Adding resolution properties for QXL device

2019-08-05 Thread Erik Skultety
On Mon, Aug 05, 2019 at 09:12:26AM +0200, Gerd Hoffmann wrote:
> On Sun, Aug 04, 2019 at 10:21:17PM -0300, jcfara...@gmail.com wrote:
> > From: Julio Faracco 
> >
> > This serie adds 'xres' and 'yres' properties into XML definition for QXL
> > video device to specify a default resolution. This serie covers a simple
> > test case too.
>
> Why limit this to qxl?
>
> virtio and stdvga support xres+yres too.
>
> Note: on stdvga this requires edid support (available since 3.1, enabled
> by default since 4.1).

Gerd, I'd already responded by the time you had a look, so just to confirm that
I'd looked at the schema properly, it isn't possible to query support for this
from QAPI, is it?

Regards,
Erik

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


Re: [libvirt] [PATCH 0/2] test_driver: implement the remaining virDomainCreate APIs

2019-08-05 Thread Erik Skultety
On Mon, Aug 05, 2019 at 11:02:21AM +0200, Ilias Stamatis wrote:
> Ilias Stamatis (2):
>   test_driver: implement virDomainCreateWithFiles
>   test_driver: implement virDomainCreateXMLWithFile
>
>  src/test/test_driver.c | 23 +++
>  1 file changed, 23 insertions(+)

Reviewed-by: Erik Skultety 

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


Re: [libvirt] [PATCH] libxl: Implement domain metadata getter/setter

2019-08-05 Thread Erik Skultety
On Mon, Aug 05, 2019 at 10:53:33AM +0200, Michal Privoznik wrote:
> Fortunately, the code that handles metadata getting or setting is
> driver agnostic, so all that is needed from individual hypervisor
> drivers is to call the right functions.
>
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1732306
>
> Signed-off-by: Michal Privoznik 
Reviewed-by: Erik Skultety 

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


[libvirt] [PATCH 1/2] test_driver: implement virDomainCreateWithFiles

2019-08-05 Thread Ilias Stamatis
This should just forward the call to testDomainCreateWithFlags since we
can't do anything with the provided file descriptors in the test driver.

Signed-off-by: Ilias Stamatis 
---
 src/test/test_driver.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index aae9875194..ea1febd960 100755
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -3948,6 +3948,16 @@ static int testDomainCreate(virDomainPtr domain)
 return testDomainCreateWithFlags(domain, 0);
 }

+
+static int testDomainCreateWithFiles(virDomainPtr domain,
+ unsigned int nfiles ATTRIBUTE_UNUSED,
+ int *files ATTRIBUTE_UNUSED,
+ unsigned int flags)
+{
+return testDomainCreateWithFlags(domain, flags);
+}
+
+
 static int testDomainUndefineFlags(virDomainPtr domain,
unsigned int flags)
 {
@@ -8655,6 +8665,7 @@ static virHypervisorDriver testHypervisorDriver = {
 .connectNumOfDefinedDomains = testConnectNumOfDefinedDomains, /* 0.1.11 */
 .domainCreate = testDomainCreate, /* 0.1.11 */
 .domainCreateWithFlags = testDomainCreateWithFlags, /* 0.8.2 */
+.domainCreateWithFiles = testDomainCreateWithFiles, /* 5.7.0 */
 .domainDefineXML = testDomainDefineXML, /* 0.1.11 */
 .domainDefineXMLFlags = testDomainDefineXMLFlags, /* 1.2.12 */
 .domainUndefine = testDomainUndefine, /* 0.1.11 */
--
2.22.0

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


[libvirt] [PATCH 2/2] test_driver: implement virDomainCreateXMLWithFile

2019-08-05 Thread Ilias Stamatis
This should just forward the call to testDomainCreateXML since we
can't do anything with the provided file descriptors in the test driver.

Signed-off-by: Ilias Stamatis 
---
 src/test/test_driver.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index ea1febd960..b14ae51baa 100755
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1684,6 +1684,17 @@ testDomainCreateXML(virConnectPtr conn, const char *xml,
 }


+static virDomainPtr
+testDomainCreateXMLWithFiles(virConnectPtr conn,
+ const char *xml,
+ unsigned int nfiles ATTRIBUTE_UNUSED,
+ int *files ATTRIBUTE_UNUSED,
+ unsigned int flags)
+{
+return testDomainCreateXML(conn, xml, flags);
+}
+
+
 static virDomainPtr testDomainLookupByID(virConnectPtr conn,
  int id)
 {
@@ -8614,6 +8625,7 @@ static virHypervisorDriver testHypervisorDriver = {
 .connectNumOfDomains = testConnectNumOfDomains, /* 0.1.1 */
 .connectListAllDomains = testConnectListAllDomains, /* 0.9.13 */
 .domainCreateXML = testDomainCreateXML, /* 0.1.4 */
+.domainCreateXMLWithFiles = testDomainCreateXMLWithFiles, /* 5.7.0 */
 .domainLookupByID = testDomainLookupByID, /* 0.1.1 */
 .domainLookupByUUID = testDomainLookupByUUID, /* 0.1.1 */
 .domainLookupByName = testDomainLookupByName, /* 0.1.1 */
--
2.22.0

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


[libvirt] [PATCH 0/2] test_driver: implement the remaining virDomainCreate APIs

2019-08-05 Thread Ilias Stamatis
Ilias Stamatis (2):
  test_driver: implement virDomainCreateWithFiles
  test_driver: implement virDomainCreateXMLWithFile

 src/test/test_driver.c | 23 +++
 1 file changed, 23 insertions(+)

--
2.22.0

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


[libvirt] [PATCH] libxl: Implement domain metadata getter/setter

2019-08-05 Thread Michal Privoznik
Fortunately, the code that handles metadata getting or setting is
driver agnostic, so all that is needed from individual hypervisor
drivers is to call the right functions.

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

Signed-off-by: Michal Privoznik 
---
 src/libxl/libxl_driver.c | 67 
 1 file changed, 67 insertions(+)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 492028c487..ca01f620c7 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -6515,6 +6515,70 @@ libxlConnectBaselineCPU(virConnectPtr conn,
 return cpustr;
 }
 
+static int
+libxlDomainSetMetadata(virDomainPtr dom,
+   int type,
+   const char *metadata,
+   const char *key,
+   const char *uri,
+   unsigned int flags)
+{
+libxlDriverPrivatePtr driver = dom->conn->privateData;
+VIR_AUTOUNREF(libxlDriverConfigPtr) cfg = libxlDriverConfigGet(driver);
+virDomainObjPtr vm = NULL;
+int ret = -1;
+
+virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+  VIR_DOMAIN_AFFECT_CONFIG, -1);
+
+if (!(vm = libxlDomObjFromDomain(dom)))
+return -1;
+
+if (virDomainSetMetadataEnsureACL(dom->conn, vm->def, flags) < 0)
+goto cleanup;
+
+if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
+goto cleanup;
+
+ret = virDomainObjSetMetadata(vm, type, metadata, key, uri, cfg->caps,
+  driver->xmlopt, cfg->stateDir,
+  cfg->configDir, flags);
+
+if (ret == 0) {
+virObjectEventPtr ev = NULL;
+ev = virDomainEventMetadataChangeNewFromObj(vm, type, uri);
+virObjectEventStateQueue(driver->domainEventState, ev);
+}
+
+libxlDomainObjEndJob(driver, vm);
+
+ cleanup:
+virDomainObjEndAPI();
+return ret;
+}
+
+static char *
+libxlDomainGetMetadata(virDomainPtr dom,
+   int type,
+   const char *uri,
+   unsigned int flags)
+{
+virDomainObjPtr vm;
+char *ret = NULL;
+
+if (!(vm = libxlDomObjFromDomain(dom)))
+return NULL;
+
+if (virDomainGetMetadataEnsureACL(dom->conn, vm->def) < 0)
+goto cleanup;
+
+ret = virDomainObjGetMetadata(vm, type, uri, flags);
+
+ cleanup:
+virDomainObjEndAPI();
+return ret;
+}
+
 static virHypervisorDriver libxlHypervisorDriver = {
 .name = LIBXL_DRIVER_NAME,
 .connectURIProbe = libxlConnectURIProbe,
@@ -6628,6 +6692,9 @@ static virHypervisorDriver libxlHypervisorDriver = {
 .connectGetDomainCapabilities = libxlConnectGetDomainCapabilities, /* 
2.0.0 */
 .connectCompareCPU = libxlConnectCompareCPU, /* 2.3.0 */
 .connectBaselineCPU = libxlConnectBaselineCPU, /* 2.3.0 */
+.domainSetMetadata = libxlDomainSetMetadata, /* 5.7.0 */
+.domainGetMetadata = libxlDomainGetMetadata, /* 5.7.0 */
+
 };
 
 static virConnectDriver libxlConnectDriver = {
-- 
2.21.0

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


Re: [libvirt] [PATCH 0/4] Adding resolution properties for QXL device

2019-08-05 Thread Gerd Hoffmann
On Sun, Aug 04, 2019 at 10:21:17PM -0300, jcfara...@gmail.com wrote:
> From: Julio Faracco 
> 
> This serie adds 'xres' and 'yres' properties into XML definition for QXL
> video device to specify a default resolution. This serie covers a simple
> test case too.

Why limit this to qxl?

virtio and stdvga support xres+yres too.

Note: on stdvga this requires edid support (available since 3.1, enabled
by default since 4.1).

cheers,
  Gerd

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


Re: [libvirt] [PATCH 3/4] qemu: Generate 'xres' and 'yres' for qxl device.

2019-08-05 Thread Erik Skultety
On Sun, Aug 04, 2019 at 10:21:20PM -0300, jcfara...@gmail.com wrote:
> From: Julio Faracco 
>
> Now, QEMU command line can define 'xres' and 'yres' if XML contains both
> properties from qxl model.
>
> Signed-off-by: Julio Faracco 
> ---
>  src/qemu/qemu_command.c | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index fee51158a9..82430e7e98 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -4713,6 +4713,10 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
>  if (video->heads)
>  virBufferAsprintf(, ",max_outputs=%u", video->heads);
>  }
> +
> +if (video->xres && video->yres)
> +virBufferAsprintf(, ",xres=%u,yres=%u", video->xres, 
> video->yres);

Capabilities changes are needed. The support for specifying video resolution
was added in qemu 2.10.0, libvirt supports as old as 1.5.0. Unfortunately,
device properties listing isn't QAPIfied yet, so we can't probe this properly.

Erik

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


Re: [libvirt] [PATCH 1/4] docs: Adding 'xres' and 'yres' into qxl XML definition

2019-08-05 Thread Erik Skultety
On Sun, Aug 04, 2019 at 10:21:18PM -0300, jcfara...@gmail.com wrote:
> From: Julio Faracco 
>
> This commit adds 'xres' and 'yres' into qxl XML Domain group definition.
> Both, properties were added into properties group inside qxl model and
> they are set as optional.
>
> Signed-off-by: Julio Faracco 
> ---
>  docs/schemas/domaincommon.rng | 10 ++
>  1 file changed, 10 insertions(+)

Changes to the HTML docs are missing.

>
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index a0771da45b..8d95948595 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -3606,6 +3606,16 @@
>
>  
>
> +  
> +
> +  
> +
> +  
> +  
> +
> +  
> +
> +  

Both attributes should be enclosed by a single  element, there's IMO
no compelling reason to allow usage and therefore validation of one without the
other, is there?

Erik

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