[PATCH v2 1/2] libxl: add validation if sound device is supported

2022-12-20 Thread Marek Marczykowski-Górecki
Xen supports only subset of libvirt's sound devices, and starting with
Xen 4.17 it is enforced by libxl. Verify it early.

Signed-off-by: Marek Marczykowski-Górecki 
---
 src/libxl/libxl_domain.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 2d53250895..6507e34469 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -312,6 +312,27 @@ libxlDomainDefValidate(const virDomainDef *def,
 return -1;
 }
 
+if (def->nsounds > 0) {
+virDomainSoundDef *snd = def->sounds[0];
+switch (snd->model) {
+case VIR_DOMAIN_SOUND_MODEL_ICH6:
+case VIR_DOMAIN_SOUND_MODEL_ES1370:
+case VIR_DOMAIN_SOUND_MODEL_AC97:
+case VIR_DOMAIN_SOUND_MODEL_SB16:
+break;
+default:
+case VIR_DOMAIN_SOUND_MODEL_PCSPK:
+case VIR_DOMAIN_SOUND_MODEL_ICH7:
+case VIR_DOMAIN_SOUND_MODEL_USB:
+case VIR_DOMAIN_SOUND_MODEL_ICH9:
+case VIR_DOMAIN_SOUND_MODEL_LAST:
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+_("unsupported audio model %s"),
+virDomainSoundModelTypeToString(snd->model));
+return -1;
+}
+}
+
 return 0;
 }
 
-- 
2.37.3



[PATCH v2 2/2] libxl: adjust 'ich6' sound card name

2022-12-20 Thread Marek Marczykowski-Górecki
Xen 4.17 has strict parsing of 'soundhw' option that allows only
specific values (instead of passing through any value directly to
qemu's -soundhw option, it uses -device now). For 'intel-hda' audio
device, it requires "hda" string. "hda" works with older libxl too.
Other supported models are the same as in libvirt XML.

Signed-off-by: Marek Marczykowski-Górecki 
---
Changes in v2:
 - move validation to libxlDomainDefValidate
---
 src/libxl/libxl_conf.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index d13e48abb2..5ae60b76c1 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -593,7 +593,10 @@ libxlMakeDomBuildInfo(virDomainDef *def,
  */
 virDomainSoundDef *snd = def->sounds[0];
 
-b_info->u.hvm.soundhw = 
g_strdup(virDomainSoundModelTypeToString(snd->model));
+if (snd->model == VIR_DOMAIN_SOUND_MODEL_ICH6)
+b_info->u.hvm.soundhw = g_strdup("hda");
+else
+b_info->u.hvm.soundhw = 
g_strdup(virDomainSoundModelTypeToString(snd->model));
 }
 
 for (i = 0; i < def->os.nBootDevs; i++) {
-- 
2.37.3



[PATCH] libxl: adjust 'ich6' sound card name

2022-12-15 Thread Marek Marczykowski-Górecki
Xen 4.17 has strict parsing of 'soundhw' option that allows only
specific values (instead of passing through any value directly to
qemu's -soundhw option, it uses -device now). For 'intel-hda' audio
device, it requires "hda" string. "hda" works with older libxl too.
Other supported models are the same as in libvirt XML.

Signed-off-by: Marek Marczykowski-Górecki 
---
 src/libxl/libxl_conf.c | 21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index d13e48abb2..b84257bc12 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -593,7 +593,26 @@ libxlMakeDomBuildInfo(virDomainDef *def,
  */
 virDomainSoundDef *snd = def->sounds[0];
 
-b_info->u.hvm.soundhw = 
g_strdup(virDomainSoundModelTypeToString(snd->model));
+switch (snd->model) {
+case VIR_DOMAIN_SOUND_MODEL_ICH6:
+b_info->u.hvm.soundhw = g_strdup("hda");
+break;
+case VIR_DOMAIN_SOUND_MODEL_ES1370:
+case VIR_DOMAIN_SOUND_MODEL_AC97:
+case VIR_DOMAIN_SOUND_MODEL_SB16:
+b_info->u.hvm.soundhw = 
g_strdup(virDomainSoundModelTypeToString(snd->model));
+break;
+default:
+case VIR_DOMAIN_SOUND_MODEL_PCSPK:
+case VIR_DOMAIN_SOUND_MODEL_ICH7:
+case VIR_DOMAIN_SOUND_MODEL_USB:
+case VIR_DOMAIN_SOUND_MODEL_ICH9:
+case VIR_DOMAIN_SOUND_MODEL_LAST:
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+_("unsupported audio model %s"),
+virDomainSoundModelTypeToString(snd->model));
+return -1;
+}
 }
 
 for (i = 0; i < def->os.nBootDevs; i++) {
-- 
2.37.3



Re: [libvirt PATCH] libxl: Fix build with recent Xen that introduces new disk backend type

2022-08-02 Thread Marek Marczykowski-Górecki
On Mon, Aug 01, 2022 at 10:36:07AM +0100, Daniel P. Berrangé wrote:
> Generally we want to see errors triggered from new enums arriving,
> as it can be a sign that libvirt code needs a semantic change in
> order to continue operating correctly.  It isn't always correct
> to assume that the 'default' case gives the correct behaviour.

Isn't that the exact purpose of 'default' label? If use of 'default'
means "any of the other 5 specific values, but lets save some characters
to not name them explicitly", then IMHO better to name them
explicitly...

I can see a value of -Werror=switch-enum when adding new (internal) enum
value, to find all the cases where code needs to be adjusted, but even
then a grep is probably sufficient enough. On the other hand, if there
are cases where indeed all the values of (internal API) enum needs to be
handled explicitly, maybe simply omit 'default' label and use
-Werror=switch?

Anyway, if tracking all the enums values of all the used 3rd-party APIs
is desirable (like, noticing when libxl adds new disk type), then it
probably should be a separate CI job, not the default devel build.
Otherwise breakages like this will happen from time to time, and will
be annoyed for people on involved in specific code part at all.

As a short term fix, maybe Xen's CI can build libvirt with
-Wno-error=switch-enum?

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab


signature.asc
Description: PGP signature


Re: [PATCH] libxl: use b_info->{acpi,acpi} when available

2020-09-23 Thread Marek Marczykowski-Górecki
On Tue, Sep 22, 2020 at 09:41:00PM -0600, Jim Fehlig wrote:
> On 9/18/20 9:51 AM, Daniel P. Berrangé wrote:
> > On Fri, Sep 18, 2020 at 05:41:21PM +0200, Marek Marczykowski-Górecki wrote:
> > > On Fri, Sep 18, 2020 at 05:12:52PM +0200, Michal Prívozník wrote:
> > > > On 9/18/20 1:31 PM, Daniel P. Berrangé wrote:
> > > > > On Wed, Sep 16, 2020 at 11:09:31AM +0200, Michal Privoznik wrote:
> > > > > > On 9/10/20 6:18 AM, Marek Marczykowski-Górecki wrote:
> > > > > > > b_info->u.hvm.{acpi,apic} are deprecated. But also, on recent 
> > > > > > > libxl
> > > > > > > version (4.14) the old one seems to be broken. While libxl part 
> > > > > > > should
> > > > > > > be fixed too, update the usage here and at some point drop 
> > > > > > > support for
> > > > > > > the old version.
> > > > > > > b_info->acpi was added in Xen 4.8
> > > > > > > b_info->apic was added in Xen 4.10
> > > > > > > Xen 4.10 is the oldest version that still has security support 
> > > > > > > (until
> > > > > > > December 2020).
> > > > > > > 
> > > > > > > Signed-off-by: Marek Marczykowski-Górecki 
> > > > > > > 
> > > > > > > ---
> > > > > > > src/libxl/libxl_conf.c  | 13 
> > > > > > > +
> > > > > > > tests/libxlxml2domconfigdata/basic-hvm.json |  4 ++--
> > > > > > > tests/libxlxml2domconfigdata/cpu-shares-hvm.json|  4 ++--
> > > > > > > .../libxlxml2domconfigdata/fullvirt-acpi-slic.json  |  4 ++--
> > > > > > > .../fullvirt-cpuid-legacy-nest.json |  4 ++--
> > > > > > > tests/libxlxml2domconfigdata/fullvirt-cpuid.json|  4 ++--
> > > > > > > .../max-eventchannels-hvm.json  |  4 ++--
> > > > > > > tests/libxlxml2domconfigdata/max-gntframes-hvm.json |  4 ++--
> > > > > > > tests/libxlxml2domconfigdata/moredevs-hvm.json  |  4 ++--
> > > > > > > .../libxlxml2domconfigdata/variable-clock-hvm.json  |  4 ++--
> > > > > > > .../vnuma-hvm-legacy-nest.json  |  4 ++--
> > > > > > > tests/libxlxml2domconfigdata/vnuma-hvm.json |  4 ++--
> > > > > > > 12 files changed, 35 insertions(+), 22 deletions(-)
> > > > > > 
> > > > > > This looks good to me.
> > > > > > 
> > > > > > Reviewed-by: Michal Privoznik 
> > > > > > 
> > > > > > I'll wait a bit with pushing it though in case Jim wants to chime 
> > > > > > in.
> > > > > 
> > > > > This broke the build on Ubuntu 1804 due to tests failing
> > > > > 
> > > > > TEST: libxlxml2domconfigtest
> > > > > ..   10  FAIL
> > > > 
> > > > Oh, Ubuntu 18.04 has libxen-dev-4.9.2 and I'm not sure about FreeBSD, 
> > > > but
> > > > probably something old too. So we can't use xen 4.10 APIs even though 
> > > > it was
> > > > released 3 years ago.
> > > > 
> > > > Unfortunately, we will have to support Ubuntu 18.04 for quite some time
> > > > because 20.04 was released only a while ago and we have this two year
> > > > transition period:
> > > > 
> > > > https://libvirt.org/platforms.html
> > > > 
> > > > Marek, are you okay with me reverting the patch?
> > > 
> > > Technically, the driver code itself should work on both versions (there
> > > is an #ifdef for that). It's only an issue with tests, where we don't have
> > > #ifdef inside json files...
> > > 
> > > One idea would be to duplicate those affected json files and pick the
> > > right one based on the libxenlight version, but it doesn't sound nice...
> > > Any alternative ideas?
> > 
> > I think just duplicating the JSON files is the best solution because it
> > is simple, low overhead and keeps test coverage in both versions.
> 
> I'm catching up on libvirt mail and could have missed it, but I didn't see a
> follow-up patch to fix the test.
> 
> Marek, do you have time for it? If not I'll get to it tomorrow.

Sadly I'm pretty busy this week, I may find some time tomorrow but can't
promise it.

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


signature.asc
Description: PGP signature


Re: [PATCH] libxl: use b_info->{acpi,acpi} when available

2020-09-18 Thread Marek Marczykowski-Górecki
On Fri, Sep 18, 2020 at 05:12:52PM +0200, Michal Prívozník wrote:
> On 9/18/20 1:31 PM, Daniel P. Berrangé wrote:
> > On Wed, Sep 16, 2020 at 11:09:31AM +0200, Michal Privoznik wrote:
> > > On 9/10/20 6:18 AM, Marek Marczykowski-Górecki wrote:
> > > > b_info->u.hvm.{acpi,apic} are deprecated. But also, on recent libxl
> > > > version (4.14) the old one seems to be broken. While libxl part should
> > > > be fixed too, update the usage here and at some point drop support for
> > > > the old version.
> > > > b_info->acpi was added in Xen 4.8
> > > > b_info->apic was added in Xen 4.10
> > > > Xen 4.10 is the oldest version that still has security support (until
> > > > December 2020).
> > > > 
> > > > Signed-off-by: Marek Marczykowski-Górecki 
> > > > 
> > > > ---
> > > >src/libxl/libxl_conf.c  | 13 
> > > > +
> > > >tests/libxlxml2domconfigdata/basic-hvm.json |  4 ++--
> > > >tests/libxlxml2domconfigdata/cpu-shares-hvm.json|  4 ++--
> > > >.../libxlxml2domconfigdata/fullvirt-acpi-slic.json  |  4 ++--
> > > >.../fullvirt-cpuid-legacy-nest.json |  4 ++--
> > > >tests/libxlxml2domconfigdata/fullvirt-cpuid.json|  4 ++--
> > > >.../max-eventchannels-hvm.json  |  4 ++--
> > > >tests/libxlxml2domconfigdata/max-gntframes-hvm.json |  4 ++--
> > > >tests/libxlxml2domconfigdata/moredevs-hvm.json  |  4 ++--
> > > >.../libxlxml2domconfigdata/variable-clock-hvm.json  |  4 ++--
> > > >.../vnuma-hvm-legacy-nest.json  |  4 ++--
> > > >tests/libxlxml2domconfigdata/vnuma-hvm.json |  4 ++--
> > > >12 files changed, 35 insertions(+), 22 deletions(-)
> > > 
> > > This looks good to me.
> > > 
> > > Reviewed-by: Michal Privoznik 
> > > 
> > > I'll wait a bit with pushing it though in case Jim wants to chime in.
> > 
> > This broke the build on Ubuntu 1804 due to tests failing
> > 
> > TEST: libxlxml2domconfigtest
> >..   10  FAIL
> 
> Oh, Ubuntu 18.04 has libxen-dev-4.9.2 and I'm not sure about FreeBSD, but
> probably something old too. So we can't use xen 4.10 APIs even though it was
> released 3 years ago.
> 
> Unfortunately, we will have to support Ubuntu 18.04 for quite some time
> because 20.04 was released only a while ago and we have this two year
> transition period:
> 
> https://libvirt.org/platforms.html
> 
> Marek, are you okay with me reverting the patch?

Technically, the driver code itself should work on both versions (there
is an #ifdef for that). It's only an issue with tests, where we don't have
#ifdef inside json files...

One idea would be to duplicate those affected json files and pick the
right one based on the libxenlight version, but it doesn't sound nice...
Any alternative ideas?

If not, then indeed revert is the simplest solution.

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


signature.asc
Description: PGP signature


[PATCH] libxl: use b_info->{acpi,acpi} when available

2020-09-09 Thread Marek Marczykowski-Górecki
b_info->u.hvm.{acpi,apic} are deprecated. But also, on recent libxl
version (4.14) the old one seems to be broken. While libxl part should
be fixed too, update the usage here and at some point drop support for
the old version.
b_info->acpi was added in Xen 4.8
b_info->apic was added in Xen 4.10
Xen 4.10 is the oldest version that still has security support (until
December 2020).

Signed-off-by: Marek Marczykowski-Górecki 
---
 src/libxl/libxl_conf.c  | 13 +
 tests/libxlxml2domconfigdata/basic-hvm.json |  4 ++--
 tests/libxlxml2domconfigdata/cpu-shares-hvm.json|  4 ++--
 .../libxlxml2domconfigdata/fullvirt-acpi-slic.json  |  4 ++--
 .../fullvirt-cpuid-legacy-nest.json |  4 ++--
 tests/libxlxml2domconfigdata/fullvirt-cpuid.json|  4 ++--
 .../max-eventchannels-hvm.json  |  4 ++--
 tests/libxlxml2domconfigdata/max-gntframes-hvm.json |  4 ++--
 tests/libxlxml2domconfigdata/moredevs-hvm.json  |  4 ++--
 .../libxlxml2domconfigdata/variable-clock-hvm.json  |  4 ++--
 .../vnuma-hvm-legacy-nest.json  |  4 ++--
 tests/libxlxml2domconfigdata/vnuma-hvm.json |  4 ++--
 12 files changed, 35 insertions(+), 22 deletions(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index befd5eb965..5b729a019a 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -508,12 +508,25 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
 libxl_defbool_set(_info->u.hvm.pae,
   def->features[VIR_DOMAIN_FEATURE_PAE] ==
   VIR_TRISTATE_SWITCH_ON);
+#ifdef LIBXL_HAVE_BUILDINFO_APIC
+libxl_defbool_set(_info->apic,
+  def->features[VIR_DOMAIN_FEATURE_APIC] ==
+  VIR_TRISTATE_SWITCH_ON);
+/*
+ * Strictly speaking b_info->acpi was introduced earlier (Xen 4.8), but
+ * there is no separate #define in libxl.h.
+ */
+libxl_defbool_set(_info->acpi,
+  def->features[VIR_DOMAIN_FEATURE_ACPI] ==
+  VIR_TRISTATE_SWITCH_ON);
+#else
 libxl_defbool_set(_info->u.hvm.apic,
   def->features[VIR_DOMAIN_FEATURE_APIC] ==
   VIR_TRISTATE_SWITCH_ON);
 libxl_defbool_set(_info->u.hvm.acpi,
   def->features[VIR_DOMAIN_FEATURE_ACPI] ==
   VIR_TRISTATE_SWITCH_ON);
+#endif
 
 /* copy SLIC table path to acpi_firmware */
 if (def->os.slic_table)
diff --git a/tests/libxlxml2domconfigdata/basic-hvm.json 
b/tests/libxlxml2domconfigdata/basic-hvm.json
index ccd5853854..87f8cb7d8a 100644
--- a/tests/libxlxml2domconfigdata/basic-hvm.json
+++ b/tests/libxlxml2domconfigdata/basic-hvm.json
@@ -21,10 +21,10 @@
 "sched_params": {
 
 },
+"apic": "True",
+"acpi": "True",
 "type.hvm": {
 "pae": "True",
-"apic": "True",
-"acpi": "True",
 "vga": {
 "kind": "cirrus"
 },
diff --git a/tests/libxlxml2domconfigdata/cpu-shares-hvm.json 
b/tests/libxlxml2domconfigdata/cpu-shares-hvm.json
index 2e647eada2..2aa97e88c5 100644
--- a/tests/libxlxml2domconfigdata/cpu-shares-hvm.json
+++ b/tests/libxlxml2domconfigdata/cpu-shares-hvm.json
@@ -21,10 +21,10 @@
 "sched_params": {
 "weight": 1500
 },
+"apic": "True",
+"acpi": "True",
 "type.hvm": {
 "pae": "True",
-"apic": "True",
-"acpi": "True",
 "vga": {
 "kind": "cirrus"
 },
diff --git a/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json 
b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
index f16b4a971a..a2d46797aa 100644
--- a/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
+++ b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
@@ -14,10 +14,10 @@
 "shadow_memkb": 5656,
 "sched_params": {
 },
+"apic": "True",
+"acpi": "True",
 "type.hvm": {
 "pae": "True",
-"apic": "True",
-"acpi": "True",
 "acpi_firmware": "/path/to/slic.dat",
 "nographic": "True",
 "vga": {
diff --git a/tests/libxlxml2domconfigdata/fullvirt-cpuid-legacy-nest.json 
b/tests/libxlxml2domconfigdata/fullvir

Re: [libvirt PATCH] xenconfig: Add feature gfx_passthru

2020-05-13 Thread Marek Marczykowski-Górecki
On Wed, May 13, 2020 at 01:56:52PM +0200, Artur Puzio wrote:
> 
> 
> On 12.05.2020 15:47, Artur Puzio wrote:
> > On 08.05.2020 18:41, Jim Fehlig wrote:
> >> On 4/30/20 6:07 AM, Artur Puzio wrote:
> >>> gfx_passthru xl.cfg option enables GPU specific quirks required for
> >>> working
> >>> Intel GPU passthru. Qemu (used for device model by xen) will refuse
> >>> to start
> >>> a VM when an IGD is passed, but this option was not set in Xen.
> >>
> >> Do we really need to expose this setting to the user? I'm not really
> >> sure what to think about it after reading the xl.cfg(5) man page. It
> >> starts with
> >>
> >>   gfx_passthru=BOOLEAN|"STRING"
> >>
> >> The setting can be a boolean or a string - nice. And it really seems
> >> specific to Intel graphics cards. The man page claims that a value of
> >> 1 "Enables graphics device PCI passthrough and autodetects the type of
> >> device which is being used.". It also says "Note that some graphics
> >> cards (AMD/ATI cards, for example) do not necessarily require the
> >> gfx_passthru option".
> >>
> >> Can't libxl just enable this itself if there's a PCI passthrough
> >> device and it's detected as type igd?
>
> I have checked possible ways for detection and reusing existing libxl
> functions is not possible. Most of relevant functions (including
> libxl__detect_gfx_passthru_kind & libxl__is_igd_vga_passthru) use
> libxl__gc (libxl garbage collector). AFAIK no libvirt code uses
> libxl__gc. We probably shouldn't start doing that(?) Also
> libxl__detect_gfx_passthru_kind is static.
> 
> So the only way would be to reimplement detection if IGD is attached.
> Even if it would work the same as libxl detection, it would probably
> stop in the future... I think just exposing the option to the user is
> much, much easier and future proof.

Existing strategies:
1. libxl__is_igd_vga_passthru checks for Intel device (0x8086 vendor) with
VGA class (0x03). This should be easy to duplicate using libvirt
API, like virPCIDeviceReadID(dev, "vendor") and same for "class".

2. qemu uses a different approach and checks for device being
:00:02.0. Again, simple to duplicate into libvirt.

As we can see above, there are already two approaches, and it isn't
exactly clear which should be used. In fact, I think if those two
strategies won't match at some point, the domain may fail to start,
because qemu refuses to start with IGD attached (according to its
definition) but without the option enabled.

Looking at the libxl code, the only thing that option is used for, is to
add it to the qemu command line (Artur, have I missed anything?). In
that case, I think ideal solution would be to patch it at the qemu
level, to enable the option automatically. I believe this is exactly
the case for KVM case (vfio-pci). But I think that's non-trivial
approach in Xen path (if it would be easy, I think we wouldn't have this
option in the first place). For example the option makes qemu choose a
different PCI bridge configuration, which is I think done before
checking if IGD is attached. So, while there maybe a technical reason
for having this option in qmeu (instead of auto-detection), I don't
really see why user needs to provide it manually.

Since libxl already has a function to detect IGD, then adding
autodetection there would be a better idea. I don't know what libxl
maintainers would prefer, but I guess either of "not failing if
gfx_passthru=1 but IGD isn't detected" or adding "gfx_passthru=auto".

BTW Here is the discussion when the option was added to qemu:
https://lists.nongnu.org/archive/html/qemu-devel/2015-01/msg02756.html
It may be quite helpful to understand what is it about, but also why
(for example I see mentions of some specific Windows drivers).

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


signature.asc
Description: PGP signature


Re: [libvirt PATCH] libxl: vga.kind none when no device specified

2020-05-07 Thread Marek Marczykowski-Górecki
On Thu, May 07, 2020 at 09:52:44AM -0600, Jim Fehlig wrote:
> On 5/7/20 5:12 AM, Marek Marczykowski-Górecki wrote:
> > On Thu, Apr 30, 2020 at 02:31:12PM +0200, Artur Puzio wrote:
> > > When no video device is specified in config we should set both
> > > hvm.nographic to 1 and hvm.vga.kind to NONE.
> > > 
> > > Without hvm.vga.kind=LIBXL_VGA_INTERFACE_TYPE_NONE both -nographic and
> > > -device 'cirrus-vga' are on qemu cmdline.
> > 
> > Ping?
> 
> I can't find the original mail. We are in the midst of many internal IT
> changes so it is likely in a quarantine I have yet to discover.

In this case, I'll point you also another patch sent the same day:
https://www.redhat.com/archives/libvir-list/2020-April/msg01480.html

> > But also, Artur, you forgot to add Signed-off-by.
> 
> The patch looks good. Artur, can you send the patch again with a S-O-B?

He did that already:
https://www.redhat.com/archives/libvir-list/2020-May/msg00280.html


> 
> Regards,
> Jim
> 
> > 
> > > ---
> > >   src/libxl/libxl_conf.c   | 1 +
> > >   tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json | 3 +++
> > >   tests/libxlxml2domconfigdata/fullvirt-cpuid.json | 3 +++
> > >   3 files changed, 7 insertions(+)
> > > 
> > > diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> > > index 458dfc2399..a0059fc2a7 100644
> > > --- a/src/libxl/libxl_conf.c
> > > +++ b/src/libxl/libxl_conf.c
> > > @@ -2404,6 +2404,7 @@ libxlMakeVideo(virDomainDefPtr def, 
> > > libxl_domain_config *d_config)
> > >   b_info->video_memkb = def->videos[0]->vram;
> > >   } else {
> > >   libxl_defbool_set(_info->u.hvm.nographic, 1);
> > > +b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_NONE;
> > >   }
> > >   return 0;
> > > diff --git a/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json 
> > > b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
> > > index e804389fea..f16b4a971a 100644
> > > --- a/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
> > > +++ b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
> > > @@ -20,6 +20,9 @@
> > >   "acpi": "True",
> > >   "acpi_firmware": "/path/to/slic.dat",
> > >   "nographic": "True",
> > > +"vga": {
> > > +"kind": "none"
> > > +},
> > >   "vnc": {
> > >   "enable": "False"
> > >   },
> > > diff --git a/tests/libxlxml2domconfigdata/fullvirt-cpuid.json 
> > > b/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
> > > index d46b464642..ddc423bca7 100644
> > > --- a/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
> > > +++ b/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
> > > @@ -27,6 +27,9 @@
> > >   "apic": "True",
> > >   "acpi": "True",
> > >   "nographic": "True",
> > > +"vga": {
> > > +"kind": "none"
> > > +},
> > >   "vnc": {
> > >   "enable": "False"
> > >   },
> > 
> 

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


signature.asc
Description: PGP signature


Re: [libvirt PATCH] libxl: vga.kind none when no device specified

2020-05-07 Thread Marek Marczykowski-Górecki
On Thu, Apr 30, 2020 at 02:31:12PM +0200, Artur Puzio wrote:
> When no video device is specified in config we should set both
> hvm.nographic to 1 and hvm.vga.kind to NONE.
> 
> Without hvm.vga.kind=LIBXL_VGA_INTERFACE_TYPE_NONE both -nographic and
> -device 'cirrus-vga' are on qemu cmdline.

Ping?

But also, Artur, you forgot to add Signed-off-by.

> ---
>  src/libxl/libxl_conf.c   | 1 +
>  tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json | 3 +++
>  tests/libxlxml2domconfigdata/fullvirt-cpuid.json | 3 +++
>  3 files changed, 7 insertions(+)
> 
> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> index 458dfc2399..a0059fc2a7 100644
> --- a/src/libxl/libxl_conf.c
> +++ b/src/libxl/libxl_conf.c
> @@ -2404,6 +2404,7 @@ libxlMakeVideo(virDomainDefPtr def, libxl_domain_config 
> *d_config)
>  b_info->video_memkb = def->videos[0]->vram;
>  } else {
>  libxl_defbool_set(_info->u.hvm.nographic, 1);
> +b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_NONE;
>  }
>  
>  return 0;
> diff --git a/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json 
> b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
> index e804389fea..f16b4a971a 100644
> --- a/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
> +++ b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
> @@ -20,6 +20,9 @@
>  "acpi": "True",
>  "acpi_firmware": "/path/to/slic.dat",
>  "nographic": "True",
> +"vga": {
> +"kind": "none"
> +},
>  "vnc": {
>  "enable": "False"
>  },
> diff --git a/tests/libxlxml2domconfigdata/fullvirt-cpuid.json 
> b/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
> index d46b464642..ddc423bca7 100644
> --- a/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
> +++ b/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
> @@ -27,6 +27,9 @@
>      "apic": "True",
>  "acpi": "True",
>  "nographic": "True",
> +"vga": {
> +"kind": "none"
> +},
>  "vnc": {
>  "enable": "False"
>  },

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


signature.asc
Description: PGP signature


[PATCH v2 2/3] xenconfig: add support for 'permissive' option of a PCI device

2020-04-24 Thread Marek Marczykowski-Górecki
Add support for xl.cfg(5) pci device 'permissive' option in
domXML-to-xenconfig converter. And a test for it.

Signed-off-by: Marek Marczykowski-Górecki 
---
Changes in v2:
 - new patch
---
 src/libxl/xen_common.c   | 51 +---
 tests/xlconfigdata/test-fullvirt-pci.cfg | 25 -
 tests/xlconfigdata/test-fullvirt-pci.xml | 53 +-
 tests/xlconfigtest.c |  1 +-
 4 files changed, 125 insertions(+), 5 deletions(-)
 create mode 100644 tests/xlconfigdata/test-fullvirt-pci.cfg
 create mode 100644 tests/xlconfigdata/test-fullvirt-pci.xml

diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
index 5c37e43..050b2a0 100644
--- a/src/libxl/xen_common.c
+++ b/src/libxl/xen_common.c
@@ -381,10 +381,11 @@ xenParsePCI(char *entry)
 int busID;
 int slotID;
 int funcID;
+virTristateBool permissivebool = VIR_TRISTATE_BOOL_ABSENT;
 
 domain[0] = bus[0] = slot[0] = func[0] = '\0';
 
-/* pci=[':00:1b.0',':00:13.0'] */
+/* pci=[':00:1b.0',':00:13.0,permissive=1'] */
 if (!(key = entry))
 return NULL;
 if (!(nextkey = strchr(key, ':')))
@@ -414,14 +415,38 @@ xenParsePCI(char *entry)
 }
 
 key = nextkey + 1;
-if (strlen(key) != 1)
+if (!(nextkey = strchrnul(key, ',')))
 return NULL;
-if (virStrncpy(func, key, 1, sizeof(func)) < 0) {
+if (virStrncpy(func, key, (nextkey - key), sizeof(func)) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
_("Function %s too big for destination"), key);
 return NULL;
 }
 
+/* options */
+while (*nextkey != '\0') {
+char *data;
+key = nextkey + 1;
+if (!(data = strchr(key, '=')))
+return NULL;
+data++;
+if (!(nextkey = strchrnul(key, ',')))
+return NULL;
+if (STRPREFIX(key, "permissive=")) {
+char valuestr[5];
+int valueint;
+if (virStrncpy(valuestr, data, (nextkey - data), sizeof(valuestr)) 
< 0) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+_("Permissive %s too big for destination"), data);
+return NULL;
+}
+/* xl.cfg(5) specifies false as 0 and true as any other numeric 
value */
+if (virStrToLong_i(valuestr, NULL, 10, ) < 0)
+return NULL;
+permissivebool = valueint ? VIR_TRISTATE_BOOL_YES : 
VIR_TRISTATE_BOOL_NO;
+}
+}
+
 if (virStrToLong_i(domain, NULL, 16, ) < 0)
 return NULL;
 if (virStrToLong_i(bus, NULL, 16, ) < 0)
@@ -435,6 +460,7 @@ xenParsePCI(char *entry)
return NULL;
 
 hostdev->managed = false;
+hostdev->permissive = permissivebool;
 hostdev->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
 hostdev->source.subsys.u.pci.addr.domain = domainID;
 hostdev->source.subsys.u.pci.addr.bus = busID;
@@ -1857,12 +1883,27 @@ xenFormatPCI(virConfPtr conf, virDomainDefPtr def)
 def->hostdevs[i]->source.subsys.type == 
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
 virConfValuePtr val, tmp;
 char *buf;
+const char *permissive_str = NULL;
+
+switch (def->hostdevs[i]->permissive) {
+case VIR_TRISTATE_BOOL_YES:
+permissive_str = ",permissive=1";
+break;
+case VIR_TRISTATE_BOOL_NO:
+permissive_str = ",permissive=0";
+break;
+case VIR_TRISTATE_BOOL_ABSENT:
+case VIR_TRISTATE_BOOL_LAST:
+permissive_str = "";
+break;
+}
 
-buf = g_strdup_printf("%04x:%02x:%02x.%x",
+buf = g_strdup_printf("%04x:%02x:%02x.%x%s",
   
def->hostdevs[i]->source.subsys.u.pci.addr.domain,
   
def->hostdevs[i]->source.subsys.u.pci.addr.bus,
   
def->hostdevs[i]->source.subsys.u.pci.addr.slot,
-  
def->hostdevs[i]->source.subsys.u.pci.addr.function);
+  
def->hostdevs[i]->source.subsys.u.pci.addr.function,
+  permissive_str);
 
 if (VIR_ALLOC(val) < 0) {
 VIR_FREE(buf);
diff --git a/tests/xlconfigdata/test-fullvirt-pci.cfg 
b/tests/xlconfigdata/test-fullvirt-pci.cfg
new file mode 100644
index 000..5a3f572
--- /dev/null
+++ b/tests/xlconfigdata/test-fullvirt-pci.cfg
@@ -0,0 +1,25 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+pae = 1
+acpi = 1
+apic = 1
+viridian = 0
+rtc_timeoffset = 0
+l

[PATCH v2 1/3] libxl: Add 'permissive' option for PCI devices

2020-04-24 Thread Marek Marczykowski-Górecki
From: Simon Gaiser 

By setting the permissive flag the Xen guest access to the PCI config space
is not filtered. This might be a security risk, but it's required for
some devices and the IOMMU and interrupt remapping should (mostly?)
contain it. Because of it (and that the attribute is Xen only), in an
example include "permissive='no'" - to not expose users copying from
documentation to extra risk.

Example usage:


  ...
  

  

  


Signed-off-by: Simon Gaiser 
Signed-off-by: Marek Marczykowski-Górecki 
---
Changes in v2:
 - improve documentation (version info, example)
 - update schema
 - use virTristateBool
 - add a test
 - improve commit message
 - news entry
---
 docs/formatdomain.html.in  |  7 +--
 docs/news.xml  | 11 +++-
 docs/schemas/domaincommon.rng  | 10 ++-
 src/conf/domain_conf.c | 19 +++-
 src/conf/domain_conf.h |  1 +-
 src/libxl/libxl_conf.c |  1 +-
 tests/libxlxml2domconfigdata/moredevs-hvm.json |  6 ++-
 tests/libxlxml2domconfigdata/moredevs-hvm.xml  |  5 +-
 8 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index c530573..0d1146e 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4987,7 +4987,7 @@
 
 ...
 devices
-  hostdev mode='subsystem' type='pci' managed='yes'
+  hostdev mode='subsystem' type='pci' managed='yes' permissive='no'
 source
   address domain='0x' bus='0x06' slot='0x02' function='0x0'/
 /source
@@ -5082,7 +5082,10 @@
 (or virsh nodedev-detach before starting the guest
 or hot-plugging the device and virNodeDeviceReAttach
 (or virsh nodedev-reattach) after hot-unplug or
-stopping the guest.
+stopping the guest. When permissive
+(since 6.3.0, Xen only) is "yes"
+the pci config space access will not be filtered. This might be
+a security issue. The default is "no".
   
   scsi
   For SCSI devices, user is responsible to make sure the device
diff --git a/docs/news.xml b/docs/news.xml
index 5835013..a8e992a 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -109,6 +109,17 @@
   and/or fine tuned per individual host.
 
   
+  
+
+  xen: Add support for 'permissive' PCI device option
+
+
+  permissive is a Xen-specific PCI device option that
+  disables config space write filtering. It is needed for proper
+  functioning of some devices using non-standard config space
+  registers.
+
+  
 
 
 
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 7f18e5b..5a71222 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3065,6 +3065,11 @@
   
 
   
+  
+
+  
+
+  
   
 
   
@@ -4899,6 +4904,11 @@
 
   
 
+
+  
+
+  
+
 
   
   
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 89cd8c5..fe1a864 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8434,6 +8434,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
 virDomainHostdevSubsysSCSIVHostPtr scsihostsrc = 
>source.subsys.u.scsi_host;
 virDomainHostdevSubsysMediatedDevPtr mdevsrc = >source.subsys.u.mdev;
 g_autofree char *managed = NULL;
+g_autofree char *permissive = NULL;
 g_autofree char *sgio = NULL;
 g_autofree char *rawio = NULL;
 g_autofree char *backendStr = NULL;
@@ -8449,6 +8450,15 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
 if ((managed = virXMLPropString(node, "managed")) != NULL)
 ignore_value(virStringParseYesNo(managed, >managed));
 
+if ((permissive = virXMLPropString(node, "permissive")) != NULL) {
+if ((def->permissive = virTristateBoolTypeFromString(permissive)) < 0) 
{
+virReportError(VIR_ERR_XML_ERROR,
+   _("unknown hostdev permissive setting '%s'"),
+   permissive);
+return -1;
+}
+}
+
 sgio = virXMLPropString(node, "sgio");
 rawio = virXMLPropString(node, "rawio");
 model = virXMLPropString(node, "model");
@@ -26091,6 +26101,9 @@ virDomainActualNetDefFormat(virBufferPtr buf,
 virDomainHostdevDefPtr hostdef = virDomainNetGetActualHostdev(def);
 if  (hostdef && hostdef->managed)
 virBufferAddLit(buf, " managed='yes'");
+if  (hostdef && hostdef->permissive

[PATCH v2 3/3] xenconfig: add support for 'seize' option of a PCI device

2020-04-24 Thread Marek Marczykowski-Górecki
Add support for xl.cfg(5) pci device 'seize' option in
domXML-to-xenconfig converter. And a test for it.
It is functional equivalent of 'managed' attribute of a hostdev, so map
it directly.

Signed-off-by: Marek Marczykowski-Górecki 
---
Changes in v2:
 - new patch
---
 src/libxl/xen_common.c   | 19 +--
 tests/xlconfigdata/test-fullvirt-pci.cfg |  2 +-
 tests/xlconfigdata/test-fullvirt-pci.xml |  2 +-
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
index 050b2a0..8ae4aaa 100644
--- a/src/libxl/xen_common.c
+++ b/src/libxl/xen_common.c
@@ -382,6 +382,7 @@ xenParsePCI(char *entry)
 int slotID;
 int funcID;
 virTristateBool permissivebool = VIR_TRISTATE_BOOL_ABSENT;
+virTristateBool seizebool = VIR_TRISTATE_BOOL_ABSENT;
 
 domain[0] = bus[0] = slot[0] = func[0] = '\0';
 
@@ -432,18 +433,23 @@ xenParsePCI(char *entry)
 data++;
 if (!(nextkey = strchrnul(key, ',')))
 return NULL;
-if (STRPREFIX(key, "permissive=")) {
+if (STRPREFIX(key, "permissive=") || STRPREFIX(key, "seize=")) {
 char valuestr[5];
 int valueint;
+virTristateBool valuebool;
 if (virStrncpy(valuestr, data, (nextkey - data), sizeof(valuestr)) 
< 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-_("Permissive %s too big for destination"), data);
+_("%s %s too big for destination"), key, data);
 return NULL;
 }
 /* xl.cfg(5) specifies false as 0 and true as any other numeric 
value */
 if (virStrToLong_i(valuestr, NULL, 10, ) < 0)
 return NULL;
-permissivebool = valueint ? VIR_TRISTATE_BOOL_YES : 
VIR_TRISTATE_BOOL_NO;
+valuebool = valueint ? VIR_TRISTATE_BOOL_YES : 
VIR_TRISTATE_BOOL_NO;
+if (STRPREFIX(key, "permissive="))
+permissivebool = valuebool;
+else if (STRPREFIX(key, "seize="))
+seizebool = valuebool;
 }
 }
 
@@ -459,7 +465,7 @@ xenParsePCI(char *entry)
 if (!(hostdev = virDomainHostdevDefNew()))
return NULL;
 
-hostdev->managed = false;
+hostdev->managed = seizebool == VIR_TRISTATE_BOOL_YES;
 hostdev->permissive = permissivebool;
 hostdev->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
 hostdev->source.subsys.u.pci.addr.domain = domainID;
@@ -1898,12 +1904,13 @@ xenFormatPCI(virConfPtr conf, virDomainDefPtr def)
 break;
 }
 
-buf = g_strdup_printf("%04x:%02x:%02x.%x%s",
+buf = g_strdup_printf("%04x:%02x:%02x.%x%s%s",
   
def->hostdevs[i]->source.subsys.u.pci.addr.domain,
   
def->hostdevs[i]->source.subsys.u.pci.addr.bus,
   
def->hostdevs[i]->source.subsys.u.pci.addr.slot,
   
def->hostdevs[i]->source.subsys.u.pci.addr.function,
-  permissive_str);
+  permissive_str,
+  def->hostdevs[i]->managed ? ",seize=1" : "");
 
 if (VIR_ALLOC(val) < 0) {
 VIR_FREE(buf);
diff --git a/tests/xlconfigdata/test-fullvirt-pci.cfg 
b/tests/xlconfigdata/test-fullvirt-pci.cfg
index 5a3f572..dcf2acd 100644
--- a/tests/xlconfigdata/test-fullvirt-pci.cfg
+++ b/tests/xlconfigdata/test-fullvirt-pci.cfg
@@ -17,7 +17,7 @@ sdl = 0
 vnc = 1
 vncunused = 1
 vnclisten = "127.0.0.1"
-pci = [ ":01:1a.1", ":02:00.0,permissive=1" ]
+pci = [ ":01:1a.1", ":02:00.0,permissive=1,seize=1" ]
 parallel = "none"
 serial = "none"
 builder = "hvm"
diff --git a/tests/xlconfigdata/test-fullvirt-pci.xml 
b/tests/xlconfigdata/test-fullvirt-pci.xml
index dec390a..30fa1f5 100644
--- a/tests/xlconfigdata/test-fullvirt-pci.xml
+++ b/tests/xlconfigdata/test-fullvirt-pci.xml
@@ -42,7 +42,7 @@
 
   
 
-
+
   
   
 
-- 
git-series 0.9.1




Re: [PATCH 0/5] Xen: Add support for xl.cfg passthrough setting

2020-04-24 Thread Marek Marczykowski-Górecki
On Fri, Apr 17, 2020 at 04:29:34PM -0600, Jim Fehlig wrote:
> Hi All,
> 
> Note: This series is based on Marek's patches adding support for e820_host
> 
> https://www.redhat.com/archives/libvir-list/2020-April/msg00633.html
> 
> which I've ACK'ed, but am waiting to commit until this related setting is
> hashed out.
> 
> This series adds support for Xen's xl.cfg(5) 'passthrough' setting.
> Starting with xen 4.13 this setting must be enabled in order to assign
> PCI passthrough devices to a guest. libxl will enable it automatically
> if the guest config has PCI devices at creation time, but otherwise
> 'passthrough' must be enabled to hotplug PCI devices.
> 
> The passthrough setting is mapped to a xen hypervisor feature of the
> same name. Xen hypervisor features were recently added by the series
> mentioned above.

I'm wondering how does it relate to other drivers/hypervisors. Is there
any other that requires some option to be enabled to enable PCI hot
plugging? If yes, I'd try to model this one similar to existing cases.
Otherwise modeling it as a Xen feature would make sense.

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


signature.asc
Description: PGP signature


[PATCH] Add 'permissive' option for PCI devices

2020-04-17 Thread Marek Marczykowski-Górecki
From: Simon Gaiser 

By setting the permissive flag the guest access to the PCI config space
is not filtered. This might be a security risk, but it's required for
some devices and the IOMMU and interrupt remapping should (mostly?)
contain it.

Signed-off-by: Simon Gaiser 
Signed-off-by: Marek Marczykowski-Górecki 
---
 docs/formatdomain.html.in |  3 +++
 docs/schemas/domaincommon.rng |  5 +
 src/conf/domain_conf.c| 12 
 src/conf/domain_conf.h|  1 +
 src/libxl/libxl_conf.c|  1 +
 5 files changed, 22 insertions(+)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 6f43976815..79a5176ccd 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5051,6 +5051,9 @@
 or hot-plugging the device and virNodeDeviceReAttach
 (or virsh nodedev-reattach) after hot-unplug or
 stopping the guest.
+When permissive is "yes" the pci config space access
+will not be filtered. This might be a security issue. The default
+is "no".
   
   scsi
   For SCSI devices, user is responsible to make sure the device
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 65d6580434..9389eec3d8 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3064,6 +3064,11 @@
   
 
   
+  
+
+  
+
+  
   
 
   
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8e8146374c..607cae61d4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8419,6 +8419,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
 virDomainHostdevSubsysSCSIVHostPtr scsihostsrc = 
>source.subsys.u.scsi_host;
 virDomainHostdevSubsysMediatedDevPtr mdevsrc = >source.subsys.u.mdev;
 g_autofree char *managed = NULL;
+g_autofree char *permissive = NULL;
 g_autofree char *sgio = NULL;
 g_autofree char *rawio = NULL;
 g_autofree char *backendStr = NULL;
@@ -8434,6 +8435,11 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
 if ((managed = virXMLPropString(node, "managed")) != NULL)
 ignore_value(virStringParseYesNo(managed, >managed));
 
+if ((permissive = virXMLPropString(node, "permissive")) != NULL) {
+if (STREQ(permissive, "yes"))
+def->permissive = true;
+}
+
 sgio = virXMLPropString(node, "sgio");
 rawio = virXMLPropString(node, "rawio");
 model = virXMLPropString(node, "model");
@@ -25942,6 +25948,8 @@ virDomainActualNetDefFormat(virBufferPtr buf,
 virDomainHostdevDefPtr hostdef = virDomainNetGetActualHostdev(def);
 if  (hostdef && hostdef->managed)
 virBufferAddLit(buf, " managed='yes'");
+if  (hostdef && hostdef->permissive)
+virBufferAddLit(buf, " permissive='yes'");
 }
 if (def->trustGuestRxFilters)
 virBufferAsprintf(buf, " trustGuestRxFilters='%s'",
@@ -26130,6 +26138,8 @@ virDomainNetDefFormat(virBufferPtr buf,
 virBufferAsprintf(buf, "managed)
 virBufferAddLit(buf, " managed='yes'");
+if (hostdef && hostdef->permissive)
+virBufferAddLit(buf, " permissive='yes'");
 if (def->trustGuestRxFilters)
 virBufferAsprintf(buf, " trustGuestRxFilters='%s'",
   
virTristateBoolTypeToString(def->trustGuestRxFilters));
@@ -27914,6 +27924,8 @@ virDomainHostdevDefFormat(virBufferPtr buf,
 if (def->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
 virBufferAsprintf(buf, " managed='%s'",
   def->managed ? "yes" : "no");
+if (def->permissive)
+virBufferAddLit(buf, " permissive='yes'");
 
 if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI &&
 scsisrc->sgio)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index aad3f82db7..b81a3ce901 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -345,6 +345,7 @@ struct _virDomainHostdevDef {
 bool missing;
 bool readonly;
 bool shareable;
+bool permissive;
 union {
 virDomainHostdevSubsys subsys;
 virDomainHostdevCaps caps;
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index b3f67f817a..55f2a09e3e 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -2249,6 +2249,7 @@ libxlMakePCI(virDomainHostdevDefPtr hostdev, 
libxl_device_pci *pcidev)
 pcidev->bus = pcisrc->addr.bus;
 pcidev->dev = pcisrc->addr.slot;
 pcidev->func = pcisrc->addr.function;
+pcidev->permissive = hostdev->permissive;
 
 return 0;
 }
-- 
2.21.1




Re: [PATCH] libxl: enable Xen's e820_host setting

2020-04-14 Thread Marek Marczykowski-Górecki
On Tue, Apr 14, 2020 at 03:56:47PM -0600, Jim Fehlig wrote:
> On 4/13/20 1:17 PM, Marek Marczykowski-Górecki wrote:
> > FWIW, in Qubes we have a patches adding e820_host setting here:
> > https://github.com/QubesOS/qubes-core-libvirt/
> > (patches 8-11)
> > Not submitted before, exactly to avoid adding temporary options. But
> > since 8+ years later it is still there, I think it's safe to assume it
> > will be there for some more. Or at least it's worth to unbreak some
> > configurations in the meantime.
> 
> BTW, the other piece of the puzzle for PCI passthrough starting with xen
> 4.13 is the xl.cfg 'passthrough' option. See xen commit babde47a3fe. Without
> that enabled, hotplugging a PCI device to an HVM or PV domain is not
> possible, with or without e820_host. AFAICT there are no patches in your
> queue for the 'passthrough' option. Perhaps you haven't rebased to xen 4.13.

TBH, I don't do PCI hotplugging.

> Do you have any thoughts on modeling that option?
>
> My thoughts are adding another xen hypervisor feature (similar to e820_host)
> or map it to the new IOMMU device in libvirt [1]. I suppose it depends on
> the need to support the {sync,share}_pt values vs a simple enable/disable.
> If enabling and disabling passthrough is enough, I'd lean towards another
> xen hypervisor feature. Otherwise we'll need to explore the IOMMU device?

Isn't IOMMU device about allowing the guest to control (v)IOMMU? I've seen
some discussion about it in context of Xen, so IMO we should not use it
now for something else.
What about adding  ?
I'm not sure about {sync,share}_pt, but probably could be squeezed there
if needed.

> Regards,
> Jim
> 
> [1] https://libvirt.org/formatdomain.html#elementsIommu

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


signature.asc
Description: PGP signature


[PATCH v2 2/4] libxl: make use of e820_host feature

2020-04-13 Thread Marek Marczykowski-Górecki
Signed-off-by: Marek Marczykowski-Górecki 
Reviewed-by: Jim Fehlig 
---
 src/libxl/libxl_conf.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index b3f67f8..05d671b 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -692,6 +692,20 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
 b_info->u.pv.kernel = g_strdup(def->os.kernel);
 }
 b_info->u.pv.ramdisk = g_strdup(def->os.initrd);
+
+if (def->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
+switch ((virTristateSwitch) 
def->xen_features[VIR_DOMAIN_XEN_E820_HOST]) {
+case VIR_TRISTATE_SWITCH_ON:
+libxl_defbool_set(_info->u.pv.e820_host, true);
+break;
+case VIR_TRISTATE_SWITCH_OFF:
+libxl_defbool_set(_info->u.pv.e820_host, false);
+break;
+case VIR_TRISTATE_SWITCH_ABSENT:
+case VIR_TRISTATE_SWITCH_LAST:
+break;
+}
+}
 }
 
 /* only the 'xen' balloon device model is supported */
-- 
git-series 0.9.1




[PATCH v2 1/4] conf: add xen specific feature: e820_host

2020-04-13 Thread Marek Marczykowski-Górecki
e820_host is a Xen-specific option, only available for PV domains, that
provides the domain a virtual e820 memory map based on the host one. It
is required when using PCI passthrough and is generally considered safe
for any PV kernel. e820_host is silently ignored if set in HVM domain
configuration. See xl.cfg(5) man page in the Xen documentation for more
details.

Signed-off-by: Marek Marczykowski-Górecki 

---
Changes in v2:
 - add documentation
 - use virXMLPropString
 - add enum entries at the end
---
 docs/formatdomain.html.in |  20 +++-
 docs/schemas/domaincommon.rng |  16 +-
 src/conf/domain_conf.c| 102 +++-
 src/conf/domain_conf.h|   9 +++-
 src/qemu/qemu_validate.c  |   1 +-
 5 files changed, 148 insertions(+)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 6f43976..11d970c 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2061,6 +2061,9 @@
 hidden state='on'/
 hint-dedicated state='on'/
   /kvm
+  xen
+e820_host state='on'/
+  /xen
   pvspinlock state='on'/
   gic version='2'/
   ioapic driver='qemu'/
@@ -2242,6 +2245,23 @@
 
   
   
+  xen
+  Various features to change the behavior of the Xen hypervisor.
+  
+
+  Feature
+  Description
+  Value
+  Since
+
+
+  e820_host
+  Expose the host e820 to the guest (PV only)
+  on, off
+  6.3.0
+
+  
+  
   pmu
   Depending on the state attribute (values 
on,
 off, default on) enable or disable the
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 65d6580..2b5f844 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5349,6 +5349,9 @@
 
   
   
+
+  
+  
 
   
 
@@ -6337,6 +6340,19 @@
 
   
 
+  
+  
+
+  
+
+  
+
+  
+
+  
+
+  
+
   
   
 
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8e81463..473adea 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -173,6 +173,7 @@ VIR_ENUM_IMPL(virDomainFeature,
   "nested-hv",
   "msrs",
   "ccf-assist",
+  "xen",
 );
 
 VIR_ENUM_IMPL(virDomainCapabilitiesPolicy,
@@ -206,6 +207,11 @@ VIR_ENUM_IMPL(virDomainKVM,
   "hint-dedicated",
 );
 
+VIR_ENUM_IMPL(virDomainXen,
+  VIR_DOMAIN_XEN_LAST,
+  "e820_host"
+);
+
 VIR_ENUM_IMPL(virDomainMsrsUnknown,
   VIR_DOMAIN_MSRS_UNKNOWN_LAST,
   "ignore",
@@ -20862,6 +20868,7 @@ virDomainDefParseXML(xmlDocPtr xml,
 case VIR_DOMAIN_FEATURE_HYPERV:
 case VIR_DOMAIN_FEATURE_KVM:
 case VIR_DOMAIN_FEATURE_MSRS:
+case VIR_DOMAIN_FEATURE_XEN:
 def->features[val] = VIR_TRISTATE_SWITCH_ON;
 break;
 
@@ -21172,6 +21179,51 @@ virDomainDefParseXML(xmlDocPtr xml,
 VIR_FREE(nodes);
 }
 
+if (def->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
+int feature;
+int value;
+if ((n = virXPathNodeSet("./features/xen/*", ctxt, )) < 0)
+goto error;
+
+for (i = 0; i < n; i++) {
+feature = virDomainXenTypeFromString((const char *)nodes[i]->name);
+if (feature < 0) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _("unsupported Xen feature: %s"),
+   nodes[i]->name);
+goto error;
+}
+
+switch ((virDomainXen) feature) {
+case VIR_DOMAIN_XEN_E820_HOST:
+if (!(tmp = virXMLPropString(nodes[i], "state"))) {
+virReportError(VIR_ERR_XML_ERROR,
+   _("missing 'state' attribute for "
+ "Xen feature '%s'"),
+   nodes[i]->name);
+goto error;
+}
+
+if ((value = virTristateSwitchTypeFromString(tmp)) < 0) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _("invalid value of state argument "
+ "for Xen feature '%s'"),
+   nodes[i]->name);
+goto error;
+}
+
+VIR_FREE(tmp);
+def->xen_features[feature] = value;
+break;
+
+/* coverity[dead_error_begin] */
+   

[PATCH v2 3/4] xenconfig: parse e820_host option

2020-04-13 Thread Marek Marczykowski-Górecki
Signed-off-by: Marek Marczykowski-Górecki 
Reviewed-by: Jim Fehlig 
---
 src/libxl/xen_common.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
index 9a385eb..bbb9739 100644
--- a/src/libxl/xen_common.c
+++ b/src/libxl/xen_common.c
@@ -592,6 +592,13 @@ xenParseCPUFeatures(virConfPtr conf,
 
 def->clock.timers[def->clock.ntimers - 1] = timer;
 }
+} else {
+if (xenConfigGetBool(conf, "e820_host", , 0) < 0) {
+return -1;
+} else if (val) {
+def->features[VIR_DOMAIN_FEATURE_XEN] = VIR_TRISTATE_SWITCH_ON;
+def->xen_features[VIR_DOMAIN_XEN_E820_HOST] = 
VIR_TRISTATE_SWITCH_ON;
+}
 }
 
 return 0;
@@ -2138,6 +2145,12 @@ xenFormatCPUFeatures(virConfPtr conf, virDomainDefPtr 
def)
 (def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] ==
  VIR_TRISTATE_SWITCH_ON) ? 1 : 0) < 0)
 return -1;
+} else {
+if (def->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
+if (def->xen_features[VIR_DOMAIN_XEN_E820_HOST] == 
VIR_TRISTATE_SWITCH_ON)
+if (xenConfigSetInt(conf, "e820_host", 1) < 0)
+return -1;
+}
 }
 
 for (i = 0; i < def->clock.ntimers; i++) {
-- 
git-series 0.9.1




[PATCH v2 4/4] tests: check e820_host option handling

2020-04-13 Thread Marek Marczykowski-Górecki
Signed-off-by: Marek Marczykowski-Górecki 
Reviewed-by: Jim Fehlig 
---
 tests/xlconfigdata/test-paravirt-e820_host.cfg | 13 +++-
 tests/xlconfigdata/test-paravirt-e820_host.xml | 37 +++-
 tests/xlconfigtest.c   |  1 +-
 3 files changed, 51 insertions(+)
 create mode 100644 tests/xlconfigdata/test-paravirt-e820_host.cfg
 create mode 100644 tests/xlconfigdata/test-paravirt-e820_host.xml

diff --git a/tests/xlconfigdata/test-paravirt-e820_host.cfg 
b/tests/xlconfigdata/test-paravirt-e820_host.cfg
new file mode 100644
index 000..b9e5a48
--- /dev/null
+++ b/tests/xlconfigdata/test-paravirt-e820_host.cfg
@@ -0,0 +1,13 @@
+name = "XenGuest1"
+uuid = "45b60f51-88a9-47a8-a3b3-5e66d71b2283"
+maxmem = 512
+memory = 512
+vcpus = 4
+e820_host = 1
+localtime = 0
+on_poweroff = "preserve"
+on_reboot = "restart"
+on_crash = "preserve"
+vif = [ "mac=5a:36:0e:be:00:09" ]
+bootloader = "/usr/bin/pygrub"
+disk = [ 
"format=qcow2,vdev=xvda,access=rw,backendtype=qdisk,target=/var/lib/xen/images/debian/disk.qcow2"
 ]
diff --git a/tests/xlconfigdata/test-paravirt-e820_host.xml 
b/tests/xlconfigdata/test-paravirt-e820_host.xml
new file mode 100644
index 000..955a780
--- /dev/null
+++ b/tests/xlconfigdata/test-paravirt-e820_host.xml
@@ -0,0 +1,37 @@
+
+  XenGuest1
+  45b60f51-88a9-47a8-a3b3-5e66d71b2283
+  524288
+  524288
+  4
+  /usr/bin/pygrub
+  
+linux
+  
+  
+
+  
+
+  
+  
+  preserve
+  restart
+  preserve
+  
+
+  
+  
+  
+
+
+
+  
+
+
+  
+
+
+
+
+  
+
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index 8faef16..8ea2503 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -300,6 +300,7 @@ mymain(void)
 DO_TEST("vif-multi-ip");
 DO_TEST("usb");
 DO_TEST("usbctrl");
+DO_TEST("paravirt-e820_host");
 
 testXLFreeDriver(driver);
 
-- 
git-series 0.9.1




[PATCH v2 0/4] libxl: add e820_host option to the libvirt config

2020-04-13 Thread Marek Marczykowski-Górecki
Context:
- old thread on xen-devel: http://xen.markmail.org/thread/awcswnywzei4s65e
- new thread here: 
https://www.redhat.com/archives/libvir-list/2020-April/msg00447.html

Marek Marczykowski-Górecki (4):
  conf: add xen specific feature: e820_host
  libxl: make use of e820_host feature
  xenconfig: parse e820_host option
  tests: check e820_host option handling

 docs/formatdomain.html.in  |  20 -
 docs/schemas/domaincommon.rng  |  16 +++-
 src/conf/domain_conf.c | 102 ++-
 src/conf/domain_conf.h |   9 ++-
 src/libxl/libxl_conf.c |  14 ++-
 src/libxl/xen_common.c |  13 ++-
 src/qemu/qemu_validate.c   |   1 +-
 tests/xlconfigdata/test-paravirt-e820_host.cfg |  13 ++-
 tests/xlconfigdata/test-paravirt-e820_host.xml |  37 +++-
 tests/xlconfigtest.c   |   1 +-
 10 files changed, 226 insertions(+)
 create mode 100644 tests/xlconfigdata/test-paravirt-e820_host.cfg
 create mode 100644 tests/xlconfigdata/test-paravirt-e820_host.xml

base-commit: 7118bdee1550b6022e7362402ca8204add4cf80b
-- 
git-series 0.9.1




[PATCH 1/4] conf: add xen specific feature: e820_host

2020-04-13 Thread Marek Marczykowski-Górecki
This is Xen specific option to provide domain e820 map based on host
one. Useful when using PCI passthrough, see Xen documentation for more
details.

Signed-off-by: Marek Marczykowski-Górecki 
---
 docs/schemas/domaincommon.rng |  16 +-
 src/conf/domain_conf.c| 106 +++-
 src/conf/domain_conf.h|   9 +++-
 src/qemu/qemu_validate.c  |   1 +-
 4 files changed, 132 insertions(+)

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 65d6580..2b5f844 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5349,6 +5349,9 @@
 
   
   
+
+  
+  
 
   
 
@@ -6337,6 +6340,19 @@
 
   
 
+  
+  
+
+  
+
+  
+
+  
+
+  
+
+  
+
   
   
 
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8e81463..13ff168 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -160,6 +160,7 @@ VIR_ENUM_IMPL(virDomainFeature,
   "privnet",
   "hyperv",
   "kvm",
+  "xen",
   "pvspinlock",
   "capabilities",
   "pmu",
@@ -206,6 +207,11 @@ VIR_ENUM_IMPL(virDomainKVM,
   "hint-dedicated",
 );
 
+VIR_ENUM_IMPL(virDomainXen,
+  VIR_DOMAIN_XEN_LAST,
+  "e820_host"
+);
+
 VIR_ENUM_IMPL(virDomainMsrsUnknown,
   VIR_DOMAIN_MSRS_UNKNOWN_LAST,
   "ignore",
@@ -20862,6 +20868,7 @@ virDomainDefParseXML(xmlDocPtr xml,
 case VIR_DOMAIN_FEATURE_HYPERV:
 case VIR_DOMAIN_FEATURE_KVM:
 case VIR_DOMAIN_FEATURE_MSRS:
+case VIR_DOMAIN_FEATURE_XEN:
 def->features[val] = VIR_TRISTATE_SWITCH_ON;
 break;
 
@@ -21172,6 +21179,55 @@ virDomainDefParseXML(xmlDocPtr xml,
 VIR_FREE(nodes);
 }
 
+if (def->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
+int feature;
+int value;
+node = ctxt->node;
+if ((n = virXPathNodeSet("./features/xen/*", ctxt, )) < 0)
+goto error;
+
+for (i = 0; i < n; i++) {
+feature = virDomainXenTypeFromString((const char *)nodes[i]->name);
+if (feature < 0) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _("unsupported Xen feature: %s"),
+   nodes[i]->name);
+goto error;
+}
+
+ctxt->node = nodes[i];
+
+switch ((virDomainXen) feature) {
+case VIR_DOMAIN_XEN_E820_HOST:
+if (!(tmp = virXPathString("string(./@state)", ctxt))) {
+virReportError(VIR_ERR_XML_ERROR,
+   _("missing 'state' attribute for "
+ "Xen feature '%s'"),
+   nodes[i]->name);
+goto error;
+}
+
+if ((value = virTristateSwitchTypeFromString(tmp)) < 0) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _("invalid value of state argument "
+ "for Xen feature '%s'"),
+   nodes[i]->name);
+goto error;
+}
+
+VIR_FREE(tmp);
+def->xen_features[feature] = value;
+break;
+
+/* coverity[dead_error_begin] */
+case VIR_DOMAIN_XEN_LAST:
+break;
+}
+}
+VIR_FREE(nodes);
+ctxt->node = node;
+}
+
 if (def->features[VIR_DOMAIN_FEATURE_SMM] == VIR_TRISTATE_SWITCH_ON) {
 int rv = virDomainParseScaledValue("string(./features/smm/tseg)",
"string(./features/smm/tseg/@unit)",
@@ -23173,6 +23229,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr 
src,
 case VIR_DOMAIN_FEATURE_PRIVNET:
 case VIR_DOMAIN_FEATURE_HYPERV:
 case VIR_DOMAIN_FEATURE_KVM:
+case VIR_DOMAIN_FEATURE_XEN:
 case VIR_DOMAIN_FEATURE_PVSPINLOCK:
 case VIR_DOMAIN_FEATURE_PMU:
 case VIR_DOMAIN_FEATURE_VMPORT:
@@ -23344,6 +23401,30 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr 
src,
 }
 }
 
+/* xen */
+if (src->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
+for (i = 0; i < VIR_DOMAIN_XEN_LAST; i++) {
+switch ((virDomainXen) i) {
+   

[PATCH 2/4] libxl: make use of e820_host feature

2020-04-13 Thread Marek Marczykowski-Górecki
Signed-off-by: Marek Marczykowski-Górecki 
---
 src/libxl/libxl_conf.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index b3f67f8..05d671b 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -692,6 +692,20 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
 b_info->u.pv.kernel = g_strdup(def->os.kernel);
 }
 b_info->u.pv.ramdisk = g_strdup(def->os.initrd);
+
+if (def->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
+switch ((virTristateSwitch) 
def->xen_features[VIR_DOMAIN_XEN_E820_HOST]) {
+case VIR_TRISTATE_SWITCH_ON:
+libxl_defbool_set(_info->u.pv.e820_host, true);
+break;
+case VIR_TRISTATE_SWITCH_OFF:
+libxl_defbool_set(_info->u.pv.e820_host, false);
+break;
+case VIR_TRISTATE_SWITCH_ABSENT:
+case VIR_TRISTATE_SWITCH_LAST:
+break;
+}
+}
 }
 
 /* only the 'xen' balloon device model is supported */
-- 
git-series 0.9.1




[PATCH 4/4] tests: check e820_host option handling

2020-04-13 Thread Marek Marczykowski-Górecki
Signed-off-by: Marek Marczykowski-Górecki 
---
 tests/xlconfigdata/test-paravirt-e820_host.cfg | 13 +++-
 tests/xlconfigdata/test-paravirt-e820_host.xml | 37 +++-
 tests/xlconfigtest.c   |  1 +-
 3 files changed, 51 insertions(+)
 create mode 100644 tests/xlconfigdata/test-paravirt-e820_host.cfg
 create mode 100644 tests/xlconfigdata/test-paravirt-e820_host.xml

diff --git a/tests/xlconfigdata/test-paravirt-e820_host.cfg 
b/tests/xlconfigdata/test-paravirt-e820_host.cfg
new file mode 100644
index 000..b9e5a48
--- /dev/null
+++ b/tests/xlconfigdata/test-paravirt-e820_host.cfg
@@ -0,0 +1,13 @@
+name = "XenGuest1"
+uuid = "45b60f51-88a9-47a8-a3b3-5e66d71b2283"
+maxmem = 512
+memory = 512
+vcpus = 4
+e820_host = 1
+localtime = 0
+on_poweroff = "preserve"
+on_reboot = "restart"
+on_crash = "preserve"
+vif = [ "mac=5a:36:0e:be:00:09" ]
+bootloader = "/usr/bin/pygrub"
+disk = [ 
"format=qcow2,vdev=xvda,access=rw,backendtype=qdisk,target=/var/lib/xen/images/debian/disk.qcow2"
 ]
diff --git a/tests/xlconfigdata/test-paravirt-e820_host.xml 
b/tests/xlconfigdata/test-paravirt-e820_host.xml
new file mode 100644
index 000..955a780
--- /dev/null
+++ b/tests/xlconfigdata/test-paravirt-e820_host.xml
@@ -0,0 +1,37 @@
+
+  XenGuest1
+  45b60f51-88a9-47a8-a3b3-5e66d71b2283
+  524288
+  524288
+  4
+  /usr/bin/pygrub
+  
+linux
+  
+  
+
+  
+
+  
+  
+  preserve
+  restart
+  preserve
+  
+
+  
+  
+  
+
+
+
+  
+
+
+  
+
+
+
+
+  
+
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index 8faef16..8ea2503 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -300,6 +300,7 @@ mymain(void)
 DO_TEST("vif-multi-ip");
 DO_TEST("usb");
 DO_TEST("usbctrl");
+DO_TEST("paravirt-e820_host");
 
 testXLFreeDriver(driver);
 
-- 
git-series 0.9.1




[PATCH 3/4] xenconfig: parse e820_host option

2020-04-13 Thread Marek Marczykowski-Górecki
Signed-off-by: Marek Marczykowski-Górecki 
---
 src/libxl/xen_common.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
index 9a385eb..eedf4c7 100644
--- a/src/libxl/xen_common.c
+++ b/src/libxl/xen_common.c
@@ -592,6 +592,14 @@ xenParseCPUFeatures(virConfPtr conf,
 
 def->clock.timers[def->clock.ntimers - 1] = timer;
 }
+} else {
+if (xenConfigGetBool(conf, "e820_host", , 0) < 0) {
+return -1;
+
+} else if (val) {
+def->features[VIR_DOMAIN_FEATURE_XEN] = VIR_TRISTATE_SWITCH_ON;
+def->xen_features[VIR_DOMAIN_XEN_E820_HOST] = 
VIR_TRISTATE_SWITCH_ON;
+}
 }
 
 return 0;
@@ -2138,6 +2146,12 @@ xenFormatCPUFeatures(virConfPtr conf, virDomainDefPtr 
def)
 (def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] ==
  VIR_TRISTATE_SWITCH_ON) ? 1 : 0) < 0)
 return -1;
+} else {
+if (def->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
+if (def->xen_features[VIR_DOMAIN_XEN_E820_HOST] == 
VIR_TRISTATE_SWITCH_ON)
+if (xenConfigSetInt(conf, "e820_host", 1) < 0)
+return -1;
+}
 }
 
 for (i = 0; i < def->clock.ntimers; i++) {
-- 
git-series 0.9.1




[PATCH 0/4] libxl: add e820_host option to the libvirt config

2020-04-13 Thread Marek Marczykowski-Górecki
Context:
- old thread on xen-devel: http://xen.markmail.org/thread/awcswnywzei4s65e
- new thread here: 
https://www.redhat.com/archives/libvir-list/2020-April/msg00447.html

Marek Marczykowski-Górecki (4):
  conf: add xen specific feature: e820_host
  libxl: make use of e820_host feature
  xenconfig: parse e820_host option
  tests: check e820_host option handling

 docs/schemas/domaincommon.rng  |  16 +++-
 src/conf/domain_conf.c | 106 ++-
 src/conf/domain_conf.h |   9 ++-
 src/libxl/libxl_conf.c |  14 ++-
 src/libxl/xen_common.c |  14 ++-
 src/qemu/qemu_validate.c   |   1 +-
 tests/xlconfigdata/test-paravirt-e820_host.cfg |  13 ++-
 tests/xlconfigdata/test-paravirt-e820_host.xml |  37 ++-
 tests/xlconfigtest.c   |   1 +-
 9 files changed, 211 insertions(+)
 create mode 100644 tests/xlconfigdata/test-paravirt-e820_host.cfg
 create mode 100644 tests/xlconfigdata/test-paravirt-e820_host.xml

base-commit: 7118bdee1550b6022e7362402ca8204add4cf80b
-- 
git-series 0.9.1




Re: [PATCH] libxl: enable Xen's e820_host setting

2020-04-13 Thread Marek Marczykowski-Górecki
On Thu, Apr 09, 2020 at 02:52:30PM -0600, Jim Fehlig wrote:
> On 4/9/20 7:14 AM, Daniel P. Berrangé wrote:
> > On Wed, Apr 08, 2020 at 02:29:16PM -0600, Jim Fehlig wrote:
> > > Hotplugging PCI devices to Xen PV guests is only possible if the
> > > libxl_domain_build_info struct has the e820_host field enabled when the
> > > guest is created. By default it is disabled but libxl will automatically

This isn't fully true: xl will do that, not libxl. Which means under
libvirt it will always be disabled.

> > > enable e820_host if the config contains one or more PCI devices, in which
> > > case hotplugging additional PCI devices later works.
> > > 
> > > According to xl.cfg(5) man page it is safe to unconditionally enable the
> > > PV-only e820_host setting. Furthermore xen.git commits 414979ba85 and
> > > f92337d949, which introduce the setting with a default of disabled, claim
> > > the setting can be enabled or even removed "once the auto-ballooning of
> > > guests with PCI devices works". Those commits are from May 2011 so I
> > > think it is safe to say the issues have been resolved in the meantime.
> > > Regardless, we should avoid exposing a Xen setting in libvirt that could
> > > be removed later.
> > 
> > Does this have any implications for live migration compatibility if you
> > silently enable this for all guests ?
> 
> Oh, right. Thanks for the reminder! I'll have to check but I suspect it will.

Can a VM with PCI device be live migrated? If not, it shouldn't be an
issue if you enable it only for PCI-having domains (similarly as xl
does). Or patch it in libxl, see this discussion:
http://xen.markmail.org/thread/awcswnywzei4s65e

> > In QEMU/KVM if you did this, it would be considered an ABI change and
> > could break live migration of a guest launched on old libvirt, to a
> > host running new libvirt.
> 
> Nod. Do you have any suggestions on how to model this setting in libvirt? I
> proposed adding a hypervisor feature for Xen in this thread
> 
> https://www.redhat.com/archives/libvir-list/2020-April/msg00376.html
> 
> rational being that for PV guests the hypervisor serves as the BIOS and
> provides the facility to report the memory map to the OS. I couldn't really
> think of a good fit for it within the  element and its children.

FWIW, in Qubes we have a patches adding e820_host setting here:
https://github.com/QubesOS/qubes-core-libvirt/
(patches 8-11)
Not submitted before, exactly to avoid adding temporary options. But
since 8+ years later it is still there, I think it's safe to assume it
will be there for some more. Or at least it's worth to unbreak some
configurations in the meantime.

I'll rebase them on master and post here.

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


signature.asc
Description: PGP signature


[PATCH] libxl: initialize shutdown inhibit callback

2020-01-17 Thread Marek Marczykowski-Górecki
The libxl driver already tries to call shutdown inhibit callback in the
right places, but only if it's set. That last part was missing,
resulting in premature shutdown when running libvirtd
--timeout=...

Signed-off-by: Marek Marczykowski-Górecki 
---
 src/libxl/libxl_driver.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index bece313ec5..d45e42c100 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -648,8 +648,8 @@ libxlAddDom0(libxlDriverPrivatePtr driver)
 
 static int
 libxlStateInitialize(bool privileged,
- virStateInhibitCallback callback G_GNUC_UNUSED,
- void *opaque G_GNUC_UNUSED)
+ virStateInhibitCallback callback,
+ void *opaque)
 {
 libxlDriverConfigPtr cfg;
 char *driverConf = NULL;
@@ -670,6 +670,9 @@ libxlStateInitialize(bool privileged,
 return VIR_DRV_STATE_INIT_ERROR;
 }
 
+libxl_driver->inhibitCallback = callback;
+libxl_driver->inhibitOpaque = opaque;
+
 /* Allocate bitmap for vnc port reservation */
 if (!(libxl_driver->reservedGraphicsPorts =
   virPortAllocatorRangeNew(_("VNC"),
-- 
2.21.0




[RFC PATCH] libxl: support configuring paravirtualized keyboard

2020-01-17 Thread Marek Marczykowski-Górecki
Xen since 4.13 allows to configure whether PV vkb device is created or
not - instead of always creating it. Plug it into  device
configuration and give the user a choice - setting PS2 keyboard disables
PV one, and setting XEN keyboard enables PV.

There is one issue with this approach: there are implicit keyboard and
mouse device added with bus 'ps2'. This is at least done by the xen-xl
-> libvirt xml config converter (why?). When one use a config generated
this way, this commit will make behavior change - PV keyboard will get
disabled. I'm not sure if that's a big issue - both keyboards works.
Can it be this way? Or maybe some better idea how to represent
vkb_device option in libvirt xml?

Once the above is sorted out (or chosen to ignore), I'll send updated
patch with tests and config converter support.

Because the implicit keyboard is added, I also avoided to reject keybord
device on too old Xen versions. This means  will be _silently_ ignored on older Xen.

Signed-off-by: Marek Marczykowski-Górecki 
---
 src/libxl/libxl_conf.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 27de67d266..0999fb5678 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -637,6 +637,24 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
 for (i = 0; i < def->ninputs; i++) {
 char **usbdevice;
 
+#ifdef LIBXL_HAVE_BUILDINFO_VKB_DEVICE
+if (def->inputs[i]->type == VIR_DOMAIN_INPUT_TYPE_KBD) {
+switch (def->inputs[i]->bus) {
+case VIR_DOMAIN_INPUT_BUS_PS2:
+libxl_defbool_set(_info->u.hvm.vkb_device, false);
+break;
+case VIR_DOMAIN_INPUT_BUS_XEN:
+libxl_defbool_set(_info->u.hvm.vkb_device, true);
+break;
+case VIR_DOMAIN_INPUT_BUS_VIRTIO:
+default:
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+_("libxenlight supports only ps2/xen keyboard 
device"));
+return -1;
+}
+}
+#endif
+
 if (def->inputs[i]->bus != VIR_DOMAIN_INPUT_BUS_USB)
 continue;
 
-- 
2.21.0




Re: [libvirt] [PATCH v2 2/3] tests: libxl: ACPI slic table test

2019-09-16 Thread Marek Marczykowski-Górecki
On Mon, Sep 16, 2019 at 12:23:35PM +, Jim Fehlig wrote:
> On 9/15/19 1:43 PM, Marek Marczykowski-Górecki  wrote:
> > Signed-off-by: Marek Marczykowski-Górecki 
> > ---
> >   tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json | 54 +-
> >   tests/libxlxml2domconfigdata/fullvirt-acpi-slic.xml  | 32 -
> >   tests/libxlxml2domconfigtest.c   |  2 +-
> >   3 files changed, 88 insertions(+)
> >   create mode 100644 tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
> >   create mode 100644 tests/libxlxml2domconfigdata/fullvirt-acpi-slic.xml
> > 
> > diff --git a/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json 
> > b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
> > new file mode 100644
> > index 000..5d85d75
> > --- /dev/null
> > +++ b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
> > @@ -0,0 +1,54 @@
> > +{
> > +"c_info": {
> > +"type": "hvm",
> > +"name": "XenGuest2",
> > +"uuid": "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
> > +},
> > +"b_info": {
> > +"max_vcpus": 1,
> > +"avail_vcpus": [
> > +0
> > +],
> > +"max_memkb": 592896,
> > +"target_memkb": 403456,
> > +"shadow_memkb": 5656,
> > +"sched_params": {
> > +},
> > +"nested_hvm": "False",
> 
> I had to remove the above line otherwise 'make check' fails. Did it work for 
> you 
> as is?

Yes, it works for me. But what's interesting, if I remove it, it works
too. Other modifications do cause the test to fail, so the test was
called. Maybe it's about Xen libs version? 4.8 here.

> Regards,
> Jim
> 
> > +"type.hvm": {
> > +"pae": "True",
> > +"apic": "True",
> > +"acpi": "True",
> > +"acpi_firmware": "/path/to/slic.dat",
> > +"nographic": "True",
> > +"vnc": {
> > +"enable": "False"
> > +},
> > +"sdl": {
> > +"enable": "False"
> > +},
> > +"spice": {
> > +
> > +},
> > +"boot": "c",
> > +"rdm": {
> > +
> > +}
> > +},
> > +"arch_arm": {
> > +
> > +}
> > +},
> > +"disks": [
> > +{
> > +"pdev_path": "/dev/HostVG/XenGuest2",
> > +"vdev": "hda",
> > +"backend": "phy",
> > +"format": "raw",
> > +"removable": 1,
> > +"readwrite": 1
> > +}
> > +],
> > +"on_reboot": "restart",
> > +"on_crash": "restart"
> > +}
> > diff --git a/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.xml 
> > b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.xml
> > new file mode 100644
> > index 000..017fdb5
> > --- /dev/null
> > +++ b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.xml
> > @@ -0,0 +1,32 @@
> > +
> > +  XenGuest2
> > +  c7a5fdb2-cdaf-9455-926a-d65c16db1809
> > +  592896
> > +  403456
> > +  1
> > +  
> > +hvm
> > +
> > +  /path/to/slic.dat
> > +
> > +  
> > +  
> > +
> > +
> > +
> > +  
> > +  
> > +  destroy
> > +  restart
> > +  restart
> > +  
> > +
> > +  
> > +  
> > +  
> > +  
> > +
> > +
> > +
> > +  
> > +
> > diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
> > index 3b3f634..120796b 100644
> > --- a/tests/libxlxml2domconfigtest.c
> > +++ b/tests/libxlxml2domconfigtest.c
> > @@ -212,6 +212,8 @@ mymain(void)
> >   DO_TEST("fullvirt-cpuid-legacy-nest");
> >   # endif
> >   
> > +DO_TEST("fullvirt-acpi-slic");
> > +
> >   # ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS
> >   DO_TEST("max-gntframes-hvm");
> >   # endif
> > 
> 

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


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

[libvirt] [PATCH v2 1/3] libxl: add acpi slic table support

2019-09-15 Thread Marek Marczykowski-Górecki
From: Ivan Kardykov 

Libxl driver did not support setup additional acpi firmware to xen
guest. It is necessary to activate OEM Windows installs. This patch
allow to define in OS section acpi table param (which supported domain
common schema).

Signed-off-by: Ivan Kardykov 
[added info to docs/formatdomain.html.in]
Signed-off-by: Marek Marczykowski-Górecki 
---
 docs/formatdomain.html.in | 3 ++-
 src/libxl/libxl_conf.c| 5 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 86a5261..c80f09a 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -363,7 +363,8 @@
   The table element contains a fully-qualified path
 to the ACPI table. The type attribute contains the
 ACPI table type (currently only slic is supported)
-Since 1.3.5 (QEMU only)
+Since 1.3.5 (QEMU)
+Since 5.8.0 (Xen)
 
 
 Container boot
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index c76704a..c0d4861 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -506,6 +506,11 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
   def->features[VIR_DOMAIN_FEATURE_ACPI] ==
   VIR_TRISTATE_SWITCH_ON);
 
+/* copy SLIC table path to acpi_firmware */
+if (def->os.slic_table &&
+VIR_STRDUP(b_info->u.hvm.acpi_firmware, def->os.slic_table) < 
0)
+return -1;
+
 if (def->nsounds > 0) {
 /*
  * Use first sound device.  man xl.cfg(5) describes soundhw as

base-commit: 281a7f1d400aeb0d4d53dd3b628b7275f49854d0
-- 
git-series 0.9.1

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

[libvirt] [PATCH v2 2/3] tests: libxl: ACPI slic table test

2019-09-15 Thread Marek Marczykowski-Górecki
Signed-off-by: Marek Marczykowski-Górecki 
---
 tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json | 54 +-
 tests/libxlxml2domconfigdata/fullvirt-acpi-slic.xml  | 32 -
 tests/libxlxml2domconfigtest.c   |  2 +-
 3 files changed, 88 insertions(+)
 create mode 100644 tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
 create mode 100644 tests/libxlxml2domconfigdata/fullvirt-acpi-slic.xml

diff --git a/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json 
b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
new file mode 100644
index 000..5d85d75
--- /dev/null
+++ b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
@@ -0,0 +1,54 @@
+{
+"c_info": {
+"type": "hvm",
+"name": "XenGuest2",
+"uuid": "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+},
+"b_info": {
+"max_vcpus": 1,
+"avail_vcpus": [
+0
+],
+"max_memkb": 592896,
+"target_memkb": 403456,
+"shadow_memkb": 5656,
+"sched_params": {
+},
+"nested_hvm": "False",
+"type.hvm": {
+"pae": "True",
+"apic": "True",
+"acpi": "True",
+"acpi_firmware": "/path/to/slic.dat",
+"nographic": "True",
+"vnc": {
+"enable": "False"
+},
+"sdl": {
+"enable": "False"
+},
+"spice": {
+
+},
+"boot": "c",
+"rdm": {
+
+}
+},
+"arch_arm": {
+
+}
+},
+"disks": [
+{
+"pdev_path": "/dev/HostVG/XenGuest2",
+"vdev": "hda",
+"backend": "phy",
+"format": "raw",
+"removable": 1,
+"readwrite": 1
+}
+],
+"on_reboot": "restart",
+"on_crash": "restart"
+}
diff --git a/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.xml 
b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.xml
new file mode 100644
index 000..017fdb5
--- /dev/null
+++ b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.xml
@@ -0,0 +1,32 @@
+
+  XenGuest2
+  c7a5fdb2-cdaf-9455-926a-d65c16db1809
+  592896
+  403456
+  1
+  
+hvm
+
+  /path/to/slic.dat
+
+  
+  
+
+
+
+  
+  
+  destroy
+  restart
+  restart
+  
+
+  
+  
+  
+  
+
+
+
+  
+
diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
index 3b3f634..120796b 100644
--- a/tests/libxlxml2domconfigtest.c
+++ b/tests/libxlxml2domconfigtest.c
@@ -212,6 +212,8 @@ mymain(void)
 DO_TEST("fullvirt-cpuid-legacy-nest");
 # endif
 
+DO_TEST("fullvirt-acpi-slic");
+
 # ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS
 DO_TEST("max-gntframes-hvm");
 # endif
-- 
git-series 0.9.1

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

[libvirt] [PATCH v2 3/3] libxl: add slic_table <-> acpi_firmware conversion

2019-09-15 Thread Marek Marczykowski-Górecki
This isn't exactly equivalent setting (acpi_firmware may point to
non-SLIC ACPI table), but it's the most behavior preserving option.

Signed-off-by: Marek Marczykowski-Górecki 
---
 src/libxl/xen_xl.c |  7 ++-
 tests/xlconfigdata/test-fullvirt-acpi-slic.cfg | 26 -
 tests/xlconfigdata/test-fullvirt-acpi-slic.xml | 63 +++-
 tests/xlconfigtest.c   |  1 +-
 4 files changed, 97 insertions(+)
 create mode 100644 tests/xlconfigdata/test-fullvirt-acpi-slic.cfg
 create mode 100644 tests/xlconfigdata/test-fullvirt-acpi-slic.xml

diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
index 3a41a4a..015f0aa 100644
--- a/src/libxl/xen_xl.c
+++ b/src/libxl/xen_xl.c
@@ -134,6 +134,9 @@ xenParseXLOS(virConfPtr conf, virDomainDefPtr def, 
virCapsPtr caps)
 }
 }
 
+if (xenConfigCopyStringOpt(conf, "acpi_firmware", >os.slic_table) 
< 0)
+return -1;
+
 #ifdef LIBXL_HAVE_BUILDINFO_KERNEL
 if (xenConfigCopyStringOpt(conf, "kernel", >os.kernel) < 0)
 return -1;
@@ -1247,6 +1250,10 @@ xenFormatXLOS(virConfPtr conf, virDomainDefPtr def)
 return -1;
 }
 
+if (def->os.slic_table &&
+xenConfigSetString(conf, "acpi_firmware", def->os.slic_table) < 0)
+return -1;
+
 #ifdef LIBXL_HAVE_BUILDINFO_KERNEL
 if (def->os.kernel &&
 xenConfigSetString(conf, "kernel", def->os.kernel) < 0)
diff --git a/tests/xlconfigdata/test-fullvirt-acpi-slic.cfg 
b/tests/xlconfigdata/test-fullvirt-acpi-slic.cfg
new file mode 100644
index 000..99b1726
--- /dev/null
+++ b/tests/xlconfigdata/test-fullvirt-acpi-slic.cfg
@@ -0,0 +1,26 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+pae = 1
+acpi = 1
+apic = 1
+viridian = 0
+rtc_timeoffset = 0
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+device_model = "/usr/lib/xen/bin/qemu-system-i386"
+sdl = 0
+vnc = 1
+vncunused = 1
+vnclisten = "127.0.0.1"
+vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000" ]
+parallel = "none"
+serial = "none"
+builder = "hvm"
+acpi_firmware = "/sys/firmware/acpi/tables/SLIC"
+boot = "d"
+disk = [ 
"format=raw,vdev=hda,access=rw,backendtype=phy,target=/dev/HostVG/XenGuest2", 
"format=qcow2,vdev=hdb,access=rw,backendtype=qdisk,target=/var/lib/libvirt/images/XenGuest2-home",
 
"format=raw,vdev=hdc,access=ro,backendtype=qdisk,devtype=cdrom,target=/root/boot.iso"
 ]
diff --git a/tests/xlconfigdata/test-fullvirt-acpi-slic.xml 
b/tests/xlconfigdata/test-fullvirt-acpi-slic.xml
new file mode 100644
index 000..9727422
--- /dev/null
+++ b/tests/xlconfigdata/test-fullvirt-acpi-slic.xml
@@ -0,0 +1,63 @@
+
+  XenGuest2
+  c7a5fdb2-cdaf-9455-926a-d65c16db1809
+  592896
+  403456
+  1
+  
+hvm
+/usr/lib/xen/boot/hvmloader
+
+  /sys/firmware/acpi/tables/SLIC
+
+
+  
+  
+
+
+
+  
+  
+  destroy
+  restart
+  restart
+  
+/usr/lib/xen/bin/qemu-system-i386
+
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+  
+
+
+
+
+  
+  
+  
+  
+
+
+
+
+  
+
+
+  
+
+
+  
+
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index 80ac9b2..f49202d 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -266,6 +266,7 @@ mymain(void)
 DO_TEST("fullvirt-nestedhvm");
 DO_TEST("fullvirt-nestedhvm-disabled");
 DO_TEST("fullvirt-cpuid");
+DO_TEST("fullvirt-acpi-slic");
 #ifdef LIBXL_HAVE_VNUMA
 DO_TEST("fullvirt-vnuma");
 DO_TEST_PARSE("fullvirt-vnuma-autocomplete", false);
-- 
git-series 0.9.1

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

Re: [libvirt] [PATCH 1/2] libxl: add acpi slic table support

2019-09-11 Thread Marek Marczykowski-Górecki
On Wed, Sep 11, 2019 at 01:31:34PM +, Jim Fehlig wrote:
> On 9/11/19 5:43 AM, Marek Marczykowski-Górecki  wrote:
> > On Wed, Sep 11, 2019 at 02:34:57AM +, Jim Fehlig wrote:
> >> On 9/10/19 5:24 PM, Marek Marczykowski-Górecki  wrote:
> >>> On Tue, Sep 10, 2019 at 10:54:15PM +, Jim Fehlig wrote:
> >>>> On 9/6/19 8:31 PM, Marek Marczykowski-Górecki  wrote:
> >>>>> From: Ivan Kardykov 
> >>>>>
> >>>>> Libxl driver did not support setup additional acpi firmware to xen
> >>>>> guest. It is necessary to activate OEM Windows installs. This patch
> >>>>> allow to define in OS section acpi table param (which supported domain
> >>>>> common schema).
> >>>>>
> >>>>> Signed-off-by: Ivan Kardykov 
> >>>>> [added info to docs/formatdomain.html.in]
> >>>>> Signed-off-by: Marek Marczykowski-Górecki 
> >>>>> 
> >>>>> ---
> >>>>> docs/formatdomain.html.in | 3 ++-
> >>>>> src/libxl/libxl_conf.c| 5 +
> >>>>> 2 files changed, 7 insertions(+), 1 deletion(-)
> >>>>>
> >>>>> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> >>>>> index fcb7c59c00..de612ae870 100644
> >>>>> --- a/docs/formatdomain.html.in
> >>>>> +++ b/docs/formatdomain.html.in
> >>>>> @@ -363,7 +363,8 @@
> >>>>>   The table element contains a fully-qualified 
> >>>>> path
> >>>>> to the ACPI table. The type attribute contains 
> >>>>> the
> >>>>> ACPI table type (currently only slic is 
> >>>>> supported)
> >>>>> -Since 1.3.5 (QEMU only)
> >>>>> +Since 1.3.5 (QEM)
> >>>>
> >>>> You removed one too many characters :-). s/QEM/QEMU/
> >>>>
> >>>>> +Since 5.8.0 (Xen)
> >>>>> 
> >>>>> 
> >>>>> Container boot
> >>>>> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> >>>>> index 766a726ebc..c1e248d98c 100644
> >>>>> --- a/src/libxl/libxl_conf.c
> >>>>> +++ b/src/libxl/libxl_conf.c
> >>>>> @@ -506,6 +506,11 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
> >>>>>   def->features[VIR_DOMAIN_FEATURE_ACPI] ==
> >>>>>   VIR_TRISTATE_SWITCH_ON);
> >>>>> 
> >>>>> +/* copy SLIC table path to acpi_firmware */
> >>>>> +if (def->os.slic_table &&
> >>>>> +VIR_STRDUP(b_info->u.hvm.acpi_firmware, 
> >>>>> def->os.slic_table) < 0)
> >>>>> +return -1;
> >>>>> +
> >>>>
> >>>> Is 'acpi_firmware=' the xl.cfg equivalent setting? If so we'll want it 
> >>>> added to
> >>>> the domXML<->xl.cfg converter (which now lives in the src/libxl/ 
> >>>> directory).
> >>>
> >>> Functionally yes. But acpi_firmware= is about generic ACPI table, not
> >>> only SLIC. This means xl.cfg acpi_firmware= converted to domXML may be
> >>> misleading. Is it a problem?
> >>
> >> I don't think it's a problem. But let me ask another way: How would you 
> >> specify
> >> the SLIC in xl.cfg? I.e., what would a comparable xl.cfg snippet look like?
> > 
> > acpi_firmware="/sys/firmware/acpi/tables/SLIC"
> > 
> > (for those brave enough ;) )
> 
> :-)
> 
> Ok, so there is no setting to specify the type of ACPI firmware.
> 
> > My concern (maybe not important), is that
> > acpi_firmware="/path/to/non-SLIC/table" will be converted to SLIC entry
> > in libvirt xml.
> 
> Are there other tables in use? Or was this added to libxl primarily for the 
> license table? We are probably fine to imply SLIC if that is all there is 
> ATM. 
> We can add support for other tables as those become prevalent.

I'm not sure what is the primary purpose of this option, I've never
needed it for anything else. But it can point a file with multiple ACPI
tables concatenated. From man page:

acpi_firmware="STRING"
Specify a path to a file that contains extra ACPI firmware tables to
pass in to a guest. The file can contain several tables in their binary
AML form concatenated together. Each table self describes its length so
no additional information is needed. These tables will be added to the
ACPI table set in the guest. Note that existing tables cannot be
overridden by this feature. For example this cannot be used to override
tables like DSDT, FADT, etc.

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


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

Re: [libvirt] [PATCH 1/2] libxl: add acpi slic table support

2019-09-11 Thread Marek Marczykowski-Górecki
On Wed, Sep 11, 2019 at 02:34:57AM +, Jim Fehlig wrote:
> On 9/10/19 5:24 PM, Marek Marczykowski-Górecki  wrote:
> > On Tue, Sep 10, 2019 at 10:54:15PM +, Jim Fehlig wrote:
> >> On 9/6/19 8:31 PM, Marek Marczykowski-Górecki  wrote:
> >>> From: Ivan Kardykov 
> >>>
> >>> Libxl driver did not support setup additional acpi firmware to xen
> >>> guest. It is necessary to activate OEM Windows installs. This patch
> >>> allow to define in OS section acpi table param (which supported domain
> >>> common schema).
> >>>
> >>> Signed-off-by: Ivan Kardykov 
> >>> [added info to docs/formatdomain.html.in]
> >>> Signed-off-by: Marek Marczykowski-Górecki 
> >>> 
> >>> ---
> >>>docs/formatdomain.html.in | 3 ++-
> >>>src/libxl/libxl_conf.c| 5 +
> >>>2 files changed, 7 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> >>> index fcb7c59c00..de612ae870 100644
> >>> --- a/docs/formatdomain.html.in
> >>> +++ b/docs/formatdomain.html.in
> >>> @@ -363,7 +363,8 @@
> >>>  The table element contains a fully-qualified 
> >>> path
> >>>to the ACPI table. The type attribute contains the
> >>>ACPI table type (currently only slic is supported)
> >>> -Since 1.3.5 (QEMU only)
> >>> +Since 1.3.5 (QEM)
> >>
> >> You removed one too many characters :-). s/QEM/QEMU/
> >>
> >>> +Since 5.8.0 (Xen)
> >>>
> >>>
> >>>Container boot
> >>> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> >>> index 766a726ebc..c1e248d98c 100644
> >>> --- a/src/libxl/libxl_conf.c
> >>> +++ b/src/libxl/libxl_conf.c
> >>> @@ -506,6 +506,11 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
> >>>  def->features[VIR_DOMAIN_FEATURE_ACPI] ==
> >>>  VIR_TRISTATE_SWITCH_ON);
> >>>
> >>> +/* copy SLIC table path to acpi_firmware */
> >>> +if (def->os.slic_table &&
> >>> +VIR_STRDUP(b_info->u.hvm.acpi_firmware, 
> >>> def->os.slic_table) < 0)
> >>> +return -1;
> >>> +
> >>
> >> Is 'acpi_firmware=' the xl.cfg equivalent setting? If so we'll want it 
> >> added to
> >> the domXML<->xl.cfg converter (which now lives in the src/libxl/ 
> >> directory).
> > 
> > Functionally yes. But acpi_firmware= is about generic ACPI table, not
> > only SLIC. This means xl.cfg acpi_firmware= converted to domXML may be
> > misleading. Is it a problem?
> 
> I don't think it's a problem. But let me ask another way: How would you 
> specify 
> the SLIC in xl.cfg? I.e., what would a comparable xl.cfg snippet look like?

acpi_firmware="/sys/firmware/acpi/tables/SLIC"

(for those brave enough ;) )

My concern (maybe not important), is that
acpi_firmware="/path/to/non-SLIC/table" will be converted to SLIC entry
in libvirt xml.

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


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

Re: [libvirt] [PATCH 1/2] libxl: add acpi slic table support

2019-09-10 Thread Marek Marczykowski-Górecki
On Tue, Sep 10, 2019 at 10:54:15PM +, Jim Fehlig wrote:
> On 9/6/19 8:31 PM, Marek Marczykowski-Górecki  wrote:
> > From: Ivan Kardykov 
> > 
> > Libxl driver did not support setup additional acpi firmware to xen
> > guest. It is necessary to activate OEM Windows installs. This patch
> > allow to define in OS section acpi table param (which supported domain
> > common schema).
> > 
> > Signed-off-by: Ivan Kardykov 
> > [added info to docs/formatdomain.html.in]
> > Signed-off-by: Marek Marczykowski-Górecki 
> > ---
> >   docs/formatdomain.html.in | 3 ++-
> >   src/libxl/libxl_conf.c| 5 +
> >   2 files changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> > index fcb7c59c00..de612ae870 100644
> > --- a/docs/formatdomain.html.in
> > +++ b/docs/formatdomain.html.in
> > @@ -363,7 +363,8 @@
> > The table element contains a fully-qualified path
> >   to the ACPI table. The type attribute contains the
> >   ACPI table type (currently only slic is supported)
> > -Since 1.3.5 (QEMU only)
> > +Since 1.3.5 (QEM)
> 
> You removed one too many characters :-). s/QEM/QEMU/
> 
> > +Since 5.8.0 (Xen)
> >   
> >   
> >   Container boot
> > diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> > index 766a726ebc..c1e248d98c 100644
> > --- a/src/libxl/libxl_conf.c
> > +++ b/src/libxl/libxl_conf.c
> > @@ -506,6 +506,11 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
> > def->features[VIR_DOMAIN_FEATURE_ACPI] ==
> > VIR_TRISTATE_SWITCH_ON);
> >   
> > +/* copy SLIC table path to acpi_firmware */
> > +if (def->os.slic_table &&
> > +VIR_STRDUP(b_info->u.hvm.acpi_firmware, 
> > def->os.slic_table) < 0)
> > +return -1;
> > +
> 
> Is 'acpi_firmware=' the xl.cfg equivalent setting? If so we'll want it added 
> to 
> the domXML<->xl.cfg converter (which now lives in the src/libxl/ directory).

Functionally yes. But acpi_firmware= is about generic ACPI table, not
only SLIC. This means xl.cfg acpi_firmware= converted to domXML may be
misleading. Is it a problem?

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


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

[libvirt] [PATCH 1/2] libxl: add acpi slic table support

2019-09-06 Thread Marek Marczykowski-Górecki
From: Ivan Kardykov 

Libxl driver did not support setup additional acpi firmware to xen
guest. It is necessary to activate OEM Windows installs. This patch
allow to define in OS section acpi table param (which supported domain
common schema).

Signed-off-by: Ivan Kardykov 
[added info to docs/formatdomain.html.in]
Signed-off-by: Marek Marczykowski-Górecki 
---
 docs/formatdomain.html.in | 3 ++-
 src/libxl/libxl_conf.c| 5 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index fcb7c59c00..de612ae870 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -363,7 +363,8 @@
   The table element contains a fully-qualified path
 to the ACPI table. The type attribute contains the
 ACPI table type (currently only slic is supported)
-Since 1.3.5 (QEMU only)
+Since 1.3.5 (QEM)
+Since 5.8.0 (Xen)
 
 
 Container boot
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 766a726ebc..c1e248d98c 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -506,6 +506,11 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
   def->features[VIR_DOMAIN_FEATURE_ACPI] ==
   VIR_TRISTATE_SWITCH_ON);
 
+/* copy SLIC table path to acpi_firmware */
+if (def->os.slic_table &&
+VIR_STRDUP(b_info->u.hvm.acpi_firmware, def->os.slic_table) < 
0)
+return -1;
+
 if (def->nsounds > 0) {
 /*
  * Use first sound device.  man xl.cfg(5) describes soundhw as
-- 
2.21.0


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

[libvirt] [PATCH 2/2] tests: libxl: ACPI slic table test

2019-09-06 Thread Marek Marczykowski-Górecki
Signed-off-by: Marek Marczykowski-Górecki 
---
 .../fullvirt-acpi-slic.json   | 54 +++
 .../fullvirt-acpi-slic.xml| 32 +++
 tests/libxlxml2domconfigtest.c|  2 +
 3 files changed, 88 insertions(+)
 create mode 100644 tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
 create mode 100644 tests/libxlxml2domconfigdata/fullvirt-acpi-slic.xml

diff --git a/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json 
b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
new file mode 100644
index 00..5d85d75af5
--- /dev/null
+++ b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
@@ -0,0 +1,54 @@
+{
+"c_info": {
+"type": "hvm",
+"name": "XenGuest2",
+"uuid": "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+},
+"b_info": {
+"max_vcpus": 1,
+"avail_vcpus": [
+0
+],
+"max_memkb": 592896,
+"target_memkb": 403456,
+"shadow_memkb": 5656,
+"sched_params": {
+},
+"nested_hvm": "False",
+"type.hvm": {
+"pae": "True",
+"apic": "True",
+"acpi": "True",
+"acpi_firmware": "/path/to/slic.dat",
+"nographic": "True",
+"vnc": {
+"enable": "False"
+},
+"sdl": {
+"enable": "False"
+},
+"spice": {
+
+},
+"boot": "c",
+"rdm": {
+
+}
+},
+"arch_arm": {
+
+}
+},
+"disks": [
+{
+"pdev_path": "/dev/HostVG/XenGuest2",
+"vdev": "hda",
+"backend": "phy",
+"format": "raw",
+"removable": 1,
+"readwrite": 1
+}
+],
+"on_reboot": "restart",
+"on_crash": "restart"
+}
diff --git a/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.xml 
b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.xml
new file mode 100644
index 00..017fdb5062
--- /dev/null
+++ b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.xml
@@ -0,0 +1,32 @@
+
+  XenGuest2
+  c7a5fdb2-cdaf-9455-926a-d65c16db1809
+  592896
+  403456
+  1
+  
+hvm
+
+  /path/to/slic.dat
+
+  
+  
+
+
+
+  
+  
+  destroy
+  restart
+  restart
+  
+
+  
+  
+  
+  
+
+
+
+  
+
diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
index 3b3f63403e..120796b110 100644
--- a/tests/libxlxml2domconfigtest.c
+++ b/tests/libxlxml2domconfigtest.c
@@ -212,6 +212,8 @@ mymain(void)
 DO_TEST("fullvirt-cpuid-legacy-nest");
 # endif
 
+DO_TEST("fullvirt-acpi-slic");
+
 # ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS
 DO_TEST("max-gntframes-hvm");
 # endif
-- 
2.21.0


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

[libvirt] [PATCH] libxl: Fix libxlDomainPMSuspendForDuration domain active check

2019-09-06 Thread Marek Marczykowski-Górecki
virDomainObjCheckActive() returns -1 if domain is not active, not 0.

Fixes cb50436c6f "libxl: implement virDomainPM* functions"
Signed-off-by: Marek Marczykowski-Górecki 
---
 src/libxl/libxl_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index d0396e4781..215471fa0d 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1459,7 +1459,7 @@ libxlDomainPMSuspendForDuration(virDomainPtr dom,
 if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
 goto cleanup;
 
-if (!virDomainObjCheckActive(vm))
+if (virDomainObjCheckActive(vm) < 0)
 goto endjob;
 
 /* Unlock virDomainObjPtr to not deadlock with even handler, which will try
-- 
2.21.0


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

[libvirt] [PATCH 2/2] libxl: handle external domain destroy

2018-12-07 Thread Marek Marczykowski-Górecki
If domain is killed with `xl destroy`, libvirt will not notice it and
still report the domain as running. Also trying to destroy the domain
through libvirt will fail. The only way to recover from such a situation
is to restart libvirt daemon. The problem is that even though libxl
report LIBXL_EVENT_TYPE_DOMAIN_DEATH, libvirt ignore it as all the
domain cleanup is done in a function actually destroying the domain. If
destroy is done outside of libvirt, there is no place where it would be
handled.

Fix this by doing domain cleanup in LIBXL_EVENT_TYPE_DOMAIN_DEATH too.
To avoid doing it twice, add a ignoreDeathEvent flag
libxlDomainObjPrivate, set when the domain death is triggered by libvirt
itself.

Signed-off-by: Marek Marczykowski-Górecki 
---
 src/libxl/libxl_domain.c | 71 ++--
 src/libxl/libxl_domain.h |  3 ++
 2 files changed, 71 insertions(+), 3 deletions(-)

diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 5fe3f44fbe..6d1e15b14c 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -609,6 +609,54 @@ libxlDomainShutdownThread(void *opaque)
 virObjectUnref(cfg);
 }
 
+static void
+libxlDomainDeathThread(void *opaque)
+{
+struct libxlShutdownThreadInfo *shutdown_info = opaque;
+virDomainObjPtr vm = NULL;
+libxl_event *ev = shutdown_info->event;
+libxlDriverPrivatePtr driver = shutdown_info->driver;
+virObjectEventPtr dom_event = NULL;
+libxlDriverConfigPtr cfg;
+libxlDomainObjPrivatePtr priv;
+
+cfg = libxlDriverConfigGet(driver);
+
+vm = virDomainObjListFindByID(driver->domains, ev->domid);
+if (!vm) {
+/* vm->def->id already cleared, means the death was handled by the
+ * driver already */
+goto cleanup;
+}
+
+priv = vm->privateData;
+
+if (priv->ignoreDeathEvent) {
+priv->ignoreDeathEvent = false;
+goto cleanup;
+}
+
+if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
+goto cleanup;
+
+virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, VIR_DOMAIN_SHUTOFF_DESTROYED);
+dom_event = virDomainEventLifecycleNewFromObj(vm,
+  VIR_DOMAIN_EVENT_STOPPED,
+  
VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
+libxlDomainCleanup(driver, vm);
+if (!vm->persistent)
+virDomainObjListRemove(driver->domains, vm);
+libxlDomainObjEndJob(driver, vm);
+
+ cleanup:
+virDomainObjEndAPI();
+virObjectEventStateQueue(driver->domainEventState, dom_event);
+libxl_event_free(cfg->ctx, ev);
+VIR_FREE(shutdown_info);
+virObjectUnref(cfg);
+}
+
+
 /*
  * Handle previously registered domain event notification from libxenlight.
  */
@@ -619,8 +667,10 @@ libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST 
libxl_event *event)
 struct libxlShutdownThreadInfo *shutdown_info = NULL;
 virThread thread;
 libxlDriverConfigPtr cfg;
+int ret = -1;
 
-if (event->type != LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN) {
+if (event->type != LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN &&
+event->type != LIBXL_EVENT_TYPE_DOMAIN_DEATH) {
 VIR_INFO("Unhandled event type %d", event->type);
 goto error;
 }
@@ -634,8 +684,14 @@ libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST 
libxl_event *event)
 
 shutdown_info->driver = driver;
 shutdown_info->event = (libxl_event *)event;
-if (virThreadCreate(, false, libxlDomainShutdownThread,
-shutdown_info) < 0) {
+if (event->type == LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN)
+ret = virThreadCreate(, false, libxlDomainShutdownThread,
+  shutdown_info);
+else if (event->type == LIBXL_EVENT_TYPE_DOMAIN_DEATH)
+ret = virThreadCreate(, false, libxlDomainDeathThread,
+  shutdown_info);
+
+if (ret < 0) {
 /*
  * Not much we can do on error here except log it.
  */
@@ -751,14 +807,21 @@ libxlDomainDestroyInternal(libxlDriverPrivatePtr driver,
virDomainObjPtr vm)
 {
 libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
+libxlDomainObjPrivatePtr priv = vm->privateData;
 int ret = -1;
 
+/* Ignore next LIBXL_EVENT_TYPE_DOMAIN_DEATH as the caller will handle
+ * domain death appropriately already (having more info, like the reason).
+ */
+priv->ignoreDeathEvent = true;
 /* Unlock virDomainObj during destroy, which can take considerable
  * time on large memory domains.
  */
 virObjectUnlock(vm);
 ret = libxl_domain_destroy(cfg->ctx, vm->def->id, NULL);
 virObjectLock(vm);
+if (ret)
+priv->ignoreDeathEvent = false;
 
 virObjectUnref(cfg);
 return ret;
@@ -811,6 +874,8 @@ libxlDomainClea

[libvirt] [PATCH 1/2] libxl: add missing cleanup on error path in libxlDomainPMWakeup

2018-12-07 Thread Marek Marczykowski-Górecki
Since domain was suspended before and on failed wakeup is destroyed,
send an event.
Also, add missing libxlDomainCleanup.

Signed-off-by: Marek Marczykowski-Górecki 
---
 src/libxl/libxl_driver.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 5aa68a7c43..eb719345e8 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1527,6 +1527,9 @@ libxlDomainPMWakeup(virDomainPtr dom, unsigned int flags)
 libxlDomainDestroyInternal(driver, vm);
 vm->def->id = -1;
 virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, VIR_DOMAIN_SHUTOFF_FAILED);
+event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED,
+  VIR_DOMAIN_EVENT_STOPPED_FAILED);
+libxlDomainCleanup(driver, vm);
 
  endjob:
 libxlDomainObjEndJob(driver, vm);
-- 
2.17.2

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

[libvirt] libxl driver does not notice domain killed with xl destroy

2018-12-07 Thread Marek Marczykowski-Górecki
Hi,

If one kills a domain with `xl destroy`, libvirt will not notice it and
still report the domain as running. Also trying to destroy the domain
through libvirt will fail. The only way to recover from such a situation
is to restart libvirt daemon.

While (I think) the right answer is "don't use xl destroy", libvirt
could do better.

libxl actually report such cases via LIBXL_EVENT_TYPE_DOMAIN_DEATH, but
it is ignored by libvirt's libxl driver. The problem is that
LIBXL_EVENT_TYPE_DOMAIN_DEATH is also reported when it's triggered by
libvirt (for example libxlDomainShutdownHandleDestroy, or
libxlDomainDestroyFlags).
For a proper solution I need a race-free way for checking if given
LIBXL_EVENT_TYPE_DOMAIN_DEATH was caused by libvirt (and is already
handled - including setting appropriate domain object state etc).

A bit of context:

https://github.com/libvirt/libvirt/blob/master/src/libxl/libxl_domain.c#L750-L765
libxlDomainDestroyInternal(libxlDriverPrivatePtr driver,
   virDomainObjPtr vm)
{
libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
int ret = -1;


/* Unlock virDomainObj during destroy, which can take considerable
 * time on large memory domains.
 */
virObjectUnlock(vm);
ret = libxl_domain_destroy(cfg->ctx, vm->def->id, NULL);
virObjectLock(vm);


virObjectUnref(cfg);
return ret;
}

Example usage:
https://github.com/libvirt/libvirt/blob/master/src/libxl/libxl_driver.c#L1357-L1409
static int
libxlDomainDestroyFlags(virDomainPtr dom,
unsigned int flags)
{
(...)
if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
goto cleanup;


if (virDomainObjCheckActive(vm) < 0)
goto endjob;


if (libxlDomainDestroyInternal(driver, vm) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
   _("Failed to destroy domain '%d'"), vm->def->id);
goto endjob;
}


virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF,
 VIR_DOMAIN_SHUTOFF_DESTROYED);


event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED,
 VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
(...)
}

It's tricky, because domain object lock is released for the
libxl_domain_destroy() call time and I think there is no guarantee that
the lock will be taken back by libxlDomainDestroyInternal() before
LIBXL_EVENT_TYPE_DOMAIN_DEATH is reported (and possibly handled). Which means
I can't use domain object state for checking if libvirt already know
about this domain death, because it is set to VIR_DOMAIN_SHUTOFF, after
libxlDomainDestroyInternal() call. And while setting domain
object state twice (once from LIBXL_EVENT_TYPE_DOMAIN_DEATH handler,
then from libxlDomainDestroyInternal() caller) wouldn't be that bad
(only ugly), but emitting domain lifecycle event twice would be a major
problem.

Any ideas? Some internal flag set by libxlDomainDestroyInternal() just
before libxl_domain_destroy() call? Where would be a place for such
thing?

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


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

[libvirt] [PATCH v5 6/6] news: add libxl PVH

2018-11-26 Thread Marek Marczykowski-Górecki
Signed-off-by: Marek Marczykowski-Górecki 
---
New patch in v5
---
 docs/news.xml | 8 
 1 file changed, 8 insertions(+)

diff --git a/docs/news.xml b/docs/news.xml
index 4406aeb..d345271 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -68,6 +68,14 @@
   be viewed via the domain statistics.
 
   
+  
+
+  libxl: Add XEN PVH support
+
+
+  The libxl driver now has support for PVH os type.
+
+  
 
 
 
-- 
git-series 0.9.1

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

[libvirt] [PATCH v5 4/6] xenconfig: add support for parsing type= xl config entry

2018-11-26 Thread Marek Marczykowski-Górecki
builder="hvm" is deprecated since Xen 4.10, new syntax is type="hvm" (or
type="pv", which is default). Since the old one is still supported,
still use it when writing native config, so the config will work on
older Xen too (and will also not complicate tests).

Signed-off-by: Marek Marczykowski-Górecki 
---
"type" option is the only syntax for specifying PVH guest, coming in
next patch.

Changes in v2:
 - fix code style
---
 src/xenconfig/xen_common.c| 18 +---
 tests/xlconfigdata/test-fullvirt-type.cfg | 21 +++-
 tests/xlconfigdata/test-fullvirt-type.xml | 27 -
 tests/xlconfigdata/test-paravirt-type.cfg | 13 -
 tests/xlconfigdata/test-paravirt-type.xml | 25 ++-
 tests/xlconfigtest.c  |  2 ++-
 6 files changed, 103 insertions(+), 3 deletions(-)
 create mode 100644 tests/xlconfigdata/test-fullvirt-type.cfg
 create mode 100644 tests/xlconfigdata/test-fullvirt-type.xml
 create mode 100644 tests/xlconfigdata/test-paravirt-type.cfg
 create mode 100644 tests/xlconfigdata/test-paravirt-type.xml

diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index 0a99587..6c27936 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -1098,9 +1098,21 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr 
def, virCapsPtr caps)
 if (xenConfigGetUUID(conf, "uuid", def->uuid) < 0)
 goto out;
 
-if ((xenConfigGetString(conf, "builder", , "linux") == 0) &&
-STREQ(str, "hvm"))
-hvm = 1;
+if (xenConfigGetString(conf, "type", , NULL) == 0 && str) {
+if (STREQ(str, "pv")) {
+hvm = 0;
+} else if (STREQ(str, "hvm")) {
+hvm = 1;
+} else {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _("type %s is not supported"), str);
+return -1;
+}
+} else {
+if ((xenConfigGetString(conf, "builder", , "linux") == 0) &&
+STREQ(str, "hvm"))
+hvm = 1;
+}
 
 def->os.type = (hvm ? VIR_DOMAIN_OSTYPE_HVM : VIR_DOMAIN_OSTYPE_XEN);
 
diff --git a/tests/xlconfigdata/test-fullvirt-type.cfg 
b/tests/xlconfigdata/test-fullvirt-type.cfg
new file mode 100644
index 000..f8ecc2e
--- /dev/null
+++ b/tests/xlconfigdata/test-fullvirt-type.cfg
@@ -0,0 +1,21 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+pae = 1
+acpi = 1
+apic = 1
+viridian = 0
+rtc_timeoffset = 0
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+device_model = "/usr/lib/xen/bin/qemu-system-i386"
+sdl = 0
+vnc = 0
+parallel = "none"
+serial = "none"
+type = "hvm"
+boot = "d"
diff --git a/tests/xlconfigdata/test-fullvirt-type.xml 
b/tests/xlconfigdata/test-fullvirt-type.xml
new file mode 100644
index 000..da8e360
--- /dev/null
+++ b/tests/xlconfigdata/test-fullvirt-type.xml
@@ -0,0 +1,27 @@
+
+  XenGuest2
+  c7a5fdb2-cdaf-9455-926a-d65c16db1809
+  592896
+  403456
+  1
+  
+hvm
+/usr/lib/xen/boot/hvmloader
+
+  
+  
+
+
+
+  
+  
+  destroy
+  restart
+  restart
+  
+/usr/lib/xen/bin/qemu-system-i386
+
+
+
+  
+
diff --git a/tests/xlconfigdata/test-paravirt-type.cfg 
b/tests/xlconfigdata/test-paravirt-type.cfg
new file mode 100644
index 000..078db99
--- /dev/null
+++ b/tests/xlconfigdata/test-paravirt-type.cfg
@@ -0,0 +1,13 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+type = "pv"
+maxmem = 579
+memory = 394
+vcpus = 1
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+kernel = "/tmp/vmlinuz"
+ramdisk = "/tmp/initrd"
+cmdline = "root=/dev/xvda1 console=hvc0"
diff --git a/tests/xlconfigdata/test-paravirt-type.xml 
b/tests/xlconfigdata/test-paravirt-type.xml
new file mode 100644
index 000..4357640
--- /dev/null
+++ b/tests/xlconfigdata/test-paravirt-type.xml
@@ -0,0 +1,25 @@
+
+  XenGuest2
+  c7a5fdb2-cdaf-9455-926a-d65c16db1809
+  592896
+  403456
+  1
+  
+linux
+/tmp/vmlinuz
+/tmp/initrd
+root=/dev/xvda1 console=hvc0
+  
+  
+  destroy
+  restart
+  restart
+  
+
+  
+
+
+
+
+  
+
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index b2e4591..6e3267e 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -279,6 +279,8 @@ mymain(void)
 DO_TEST_FORMAT("paravirt-cmdline-extra-root", false);
 DO_TEST_FORMAT("paravirt-cmdline-bogus-extra-root", false);
 DO_TEST("rbd-multihost-noauth");
+DO_TEST_FORMAT("paravirt-type", false);
+DO_TEST_FORMAT("fullvirt-type", false);
 
 #ifdef LIBXL_HAVE_DEVICE_CHANNEL
 DO_TEST("channel-pty");
-- 
git-series 0.9.1

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

[libvirt] [PATCH v5 3/6] tests: add basic Xen PVH test

2018-11-26 Thread Marek Marczykowski-Górecki
Signed-off-by: Marek Marczykowski-Górecki 
---
Changes in v3:
 - update for modified "libxl: add support for PVH"
 - skip PVH test on too old Xen

Changes in v5:
 - adjust for xenpvh os type
---
 tests/libxlxml2domconfigdata/basic-pvh.json | 49 ++-
 tests/libxlxml2domconfigdata/basic-pvh.xml  | 28 +-
 tests/libxlxml2domconfigtest.c  |  3 +-
 3 files changed, 80 insertions(+)
 create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.json
 create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.xml

diff --git a/tests/libxlxml2domconfigdata/basic-pvh.json 
b/tests/libxlxml2domconfigdata/basic-pvh.json
new file mode 100644
index 000..48365c9
--- /dev/null
+++ b/tests/libxlxml2domconfigdata/basic-pvh.json
@@ -0,0 +1,49 @@
+{
+"c_info": {
+"type": "pvh",
+"name": "test-pvh",
+"uuid": "039e9ee6-4a84-3055-4c81-8ba426ae2656"
+},
+"b_info": {
+"max_vcpus": 4,
+"avail_vcpus": [
+0,
+1,
+2,
+3
+],
+"max_memkb": 524288,
+"target_memkb": 524288,
+"shadow_memkb": 8192,
+"sched_params": {
+
+},
+"kernel": "/boot/vmlinuz",
+"ramdisk": "/boot/initrd.img",
+"type.pvh": {
+},
+"arch_arm": {
+
+}
+},
+"disks": [
+{
+"pdev_path": "/var/lib/xen/images/test-pv.img",
+"vdev": "xvda",
+"backend": "qdisk",
+"format": "raw",
+"removable": 1,
+"readwrite": 1
+}
+],
+"nics": [
+{
+"devid": 0,
+"mac": "00:16:3e:3e:86:60",
+"bridge": "br0",
+"script": "/etc/xen/scripts/vif-bridge",
+"nictype": "vif"
+}
+],
+"on_reboot": "restart"
+}
diff --git a/tests/libxlxml2domconfigdata/basic-pvh.xml 
b/tests/libxlxml2domconfigdata/basic-pvh.xml
new file mode 100644
index 000..fa9ff7c
--- /dev/null
+++ b/tests/libxlxml2domconfigdata/basic-pvh.xml
@@ -0,0 +1,28 @@
+
+  test-pvh
+  039e9ee6-4a84-3055-4c81-8ba426ae2656
+  524288
+  524288
+  4
+  
+xenpvh
+/boot/vmlinuz
+/boot/initrd.img
+  
+  
+  destroy
+  restart
+  destroy
+  
+
+  
+  
+  
+
+
+  
+  
+  
+
+  
+
diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
index f380941..969d84e 100644
--- a/tests/libxlxml2domconfigtest.c
+++ b/tests/libxlxml2domconfigtest.c
@@ -203,6 +203,9 @@ mymain(void)
 
 DO_TEST("basic-pv");
 DO_TEST("basic-hvm");
+# ifdef HAVE_XEN_PVH
+DO_TEST("basic-pvh");
+# endif
 DO_TEST("cpu-shares-hvm");
 DO_TEST("variable-clock-hvm");
 DO_TEST("moredevs-hvm");
-- 
git-series 0.9.1

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

[libvirt] [PATCH v5 0/6] libxl: PVHv2 support

2018-11-26 Thread Marek Marczykowski-Górecki
This is a respin of my old PVHv1 patch[1], converted to PVHv2. The actual code
use "PVH" name.

It introduce new guest ostype VIR_DOMAIN_OSTYPE_XENPVH, and also PVH machine,
machine="xenpvh" attribute is used.

Since PVHv2 relies on features in newer Xen versions, I needed to convert also
some older code. For example b_info->u.hvm.nested_hvm was deprecated in favor
of b_info->nested_hvm. While the code do handle both old and new versions
(obviously refusing PVHv2 if Xen is too old), this isn't the case for tests.
How it should be handled, if at all?

To test this with all supported Xen versions (4.6, 4.7, 4.8, 4.9, 4.10, 4.11,
unstable), I've extended travis configuration for that[2]. It isn't exactly
trivial to build Xen 4.6-4.8 on recent system, mostly thanks to -Werror and new
warnings, but also other toolchain changes. Because of this, the configuration
is rather hacky. But it may be a good idea to include multiple pre-built Xen
versions in the base docker image and choose one using ./configure options 
(maybe
together with some symlink or environment variable like PKG_CONFIG_PATH).

[1] https://www.redhat.com/archives/libvir-list/2016-August/msg00376.html
[2] https://github.com/marmarek/libvirt/tree/travis-xen-pvh

Changes in v2:
 - drop "docs: don't refer to deprecated 'linux' ostype in example" patch -
   migrating further away from "linux" os type is offtopic to this series and
   apparently is a controversial thing
 - drop "docs: update domain schema for machine attribute" patch -
   already applied
 - apply review comments from Jim
 - rebase on master

Changes in v3:
 - rebase on master, drop already applied patches
 - use #ifdef LIBXL_DOMAIN_TYPE_PVH to detect PVH support, fix compilation
   failure on older Xen
 - exclude PVH from VIR_DOMAIN_OSTYPE_XEN <-> VIR_DOMAIN_OSTYPE_LINUX conversion
 - fix reported capabilities for PVH

Changes in v4:
 - change PVH support detection method

Changes in v5:
 - use VIR_DOMAIN_OSTYPE_XENPVH
 - add news entry

Marek Marczykowski-Górecki (6):
  libxl: reorder libxlMakeDomBuildInfo for upcoming PVH support
  libxl: add support for PVH
  tests: add basic Xen PVH test
  xenconfig: add support for parsing type= xl config entry
  xenconfig: add support for type="pvh"
  news: add libxl PVH

 docs/formatcaps.html.in |  9 ++-
 docs/news.xml   |  8 ++-
 docs/schemas/domaincommon.rng   |  2 +-
 m4/virt-driver-libxl.m4 |  3 +-
 src/conf/domain_conf.c  | 10 ++-
 src/conf/domain_conf.h  |  1 +-
 src/libxl/libxl_capabilities.c  | 38 +--
 src/libxl/libxl_conf.c  | 78 --
 src/libxl/libxl_driver.c|  6 +-
 src/xenconfig/xen_common.c  | 25 +--
 src/xenconfig/xen_xl.c  |  5 +-
 tests/libxlxml2domconfigdata/basic-pvh.json | 49 ++-
 tests/libxlxml2domconfigdata/basic-pvh.xml  | 28 -
 tests/libxlxml2domconfigtest.c  |  3 +-
 tests/testutilsxen.c| 20 +-
 tests/xlconfigdata/test-fullvirt-type.cfg   | 21 ++-
 tests/xlconfigdata/test-fullvirt-type.xml   | 27 -
 tests/xlconfigdata/test-paravirt-type.cfg   | 13 -
 tests/xlconfigdata/test-paravirt-type.xml   | 25 +++-
 tests/xlconfigdata/test-pvh-type.cfg| 13 -
 tests/xlconfigdata/test-pvh-type.xml| 25 +++-
 tests/xlconfigtest.c|  3 +-
 22 files changed, 375 insertions(+), 37 deletions(-)
 create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.json
 create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.xml
 create mode 100644 tests/xlconfigdata/test-fullvirt-type.cfg
 create mode 100644 tests/xlconfigdata/test-fullvirt-type.xml
 create mode 100644 tests/xlconfigdata/test-paravirt-type.cfg
 create mode 100644 tests/xlconfigdata/test-paravirt-type.xml
 create mode 100644 tests/xlconfigdata/test-pvh-type.cfg
 create mode 100644 tests/xlconfigdata/test-pvh-type.xml

base-commit: 794af564f4c96044b935ab898acc8e61a58b6bb5
-- 
git-series 0.9.1

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

[libvirt] [PATCH v5 5/6] xenconfig: add support for type="pvh"

2018-11-26 Thread Marek Marczykowski-Górecki
Handle PVH domain type in both directions (xen-xl->xml, xml->xen-xl).
And add a test for it.

Signed-off-by: Marek Marczykowski-Górecki 
---
Changes in v3:
 - update for modified "libxl: add support for PVH"
Changes in v5:
 - update for xenpvh ostype
---
 src/xenconfig/xen_common.c   | 17 ++---
 src/xenconfig/xen_xl.c   |  5 +
 tests/testutilsxen.c | 20 +++-
 tests/xlconfigdata/test-pvh-type.cfg | 13 +
 tests/xlconfigdata/test-pvh-type.xml | 25 +
 tests/xlconfigtest.c |  1 +
 6 files changed, 73 insertions(+), 8 deletions(-)
 create mode 100644 tests/xlconfigdata/test-pvh-type.cfg
 create mode 100644 tests/xlconfigdata/test-pvh-type.xml

diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index 6c27936..13646df 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -1090,7 +1090,7 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr def, 
virCapsPtr caps)
 {
 virCapsDomainDataPtr capsdata = NULL;
 VIR_AUTOFREE(char *) str = NULL;
-int hvm = 0, ret = -1;
+int ret = -1;
 
 if (xenConfigCopyString(conf, "name", >name) < 0)
 goto out;
@@ -1098,11 +1098,15 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr 
def, virCapsPtr caps)
 if (xenConfigGetUUID(conf, "uuid", def->uuid) < 0)
 goto out;
 
+def->os.type = VIR_DOMAIN_OSTYPE_XEN;
+
 if (xenConfigGetString(conf, "type", , NULL) == 0 && str) {
 if (STREQ(str, "pv")) {
-hvm = 0;
+def->os.type = VIR_DOMAIN_OSTYPE_XEN;
+} else if (STREQ(str, "pvh")) {
+def->os.type = VIR_DOMAIN_OSTYPE_XENPVH;
 } else if (STREQ(str, "hvm")) {
-hvm = 1;
+def->os.type = VIR_DOMAIN_OSTYPE_HVM;
 } else {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("type %s is not supported"), str);
@@ -1110,12 +1114,11 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr 
def, virCapsPtr caps)
 }
 } else {
 if ((xenConfigGetString(conf, "builder", , "linux") == 0) &&
-STREQ(str, "hvm"))
-hvm = 1;
+STREQ(str, "hvm")) {
+def->os.type = VIR_DOMAIN_OSTYPE_HVM;
+}
 }
 
-def->os.type = (hvm ? VIR_DOMAIN_OSTYPE_HVM : VIR_DOMAIN_OSTYPE_XEN);
-
 if (!(capsdata = virCapabilitiesDomainDataLookup(caps, def->os.type,
 VIR_ARCH_NONE, def->virtType, NULL, NULL)))
 goto out;
diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index 7250e57..70059df 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -1287,6 +1287,11 @@ xenFormatXLOS(virConfPtr conf, virDomainDefPtr def)
 
 /* XXX floppy disks */
 } else {
+if (def->os.type == VIR_DOMAIN_OSTYPE_XENPVH) {
+if (xenConfigSetString(conf, "type", "pvh") < 0)
+return -1;
+}
+
 if (def->os.bootloader &&
  xenConfigSetString(conf, "bootloader", def->os.bootloader) < 0)
 return -1;
diff --git a/tests/testutilsxen.c b/tests/testutilsxen.c
index d34be72..2c347a7 100644
--- a/tests/testutilsxen.c
+++ b/tests/testutilsxen.c
@@ -17,7 +17,10 @@ testXLInitCaps(void)
 "xenfv"
 };
 static const char *const xen_machines[] = {
-"xenpv"
+"xenpv",
+};
+static const char *const pvh_machines[] = {
+"xenpvh",
 };
 
 if ((caps = virCapabilitiesNew(virArchFromHost(),
@@ -54,6 +57,21 @@ testXLInitCaps(void)
 if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_XEN, NULL,
   NULL, 0, NULL) == NULL)
 goto cleanup;
+nmachines = ARRAY_CARDINALITY(pvh_machines);
+if ((machines = virCapabilitiesAllocMachines(pvh_machines, nmachines)) == 
NULL)
+goto cleanup;
+
+if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_XENPVH,
+ VIR_ARCH_X86_64,
+ "/usr/lib/xen/bin/qemu-system-i386",
+ NULL,
+ nmachines, machines)) == NULL)
+goto cleanup;
+machines = NULL;
+
+if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_XEN, NULL,
+  NULL, 0, NULL) == NULL)
+goto cleanup;
 return caps;
 
  cleanup:
diff --git a/tests/xlconfigdata/test-pvh-type.cfg 
b/tests/xlconfigdata/test-pvh-type.cfg
new file mode 100644
index 000..2493535
--- /dev/null
+++ b/tests/xlconfigdata/test-pvh-type.cfg
@@ -0,0 +1,13 @@
+name = "XenGue

[libvirt] [PATCH v5 2/6] libxl: add support for PVH

2018-11-26 Thread Marek Marczykowski-Górecki
Since this is something between PV and HVM, it makes sense to put the
setting in place where domain type is specified.
To enable it, use  It is
also included in capabilities.xml, for every supported HVM guest type - it
doesn't seems to be any other requirement (besides new enough Xen).

Signed-off-by: Marek Marczykowski-Górecki 
---
Changes in v2 proposed by Jim:
 - use new_arch_added var instead of i == nr_guest_archs for clarity
 - improve comment
 - adjust for now required Xen >= 4.6 (remove part for Xen < 4.5)

Changes in v3:
 - limit VIR_DOMAIN_OSTYPE_XEN -> VIR_DOMAIN_OSTYPE_LINUX conversion to
 Xen PV only
 - do not accept VIR_DOMAIN_OSTYPE_LINUX for PVH
 - fix reported capabilities for PVH - remove hostdev passthrough and
 video/graphics
 - use #ifdef LIBXL_DOMAIN_TYPE_PVH instead of hypervisor version to
 check for PVH support
 - compile fix for Xen < 4.9

Changes in v4:
 - revert to "i == nr_guest_archs-1" check
 - let configure check for LIBXL_DOMAIN_TYPE_PVH and use #ifdef
 HAVE_XEN_PVH then
 - fix comment about Xen version

Changes in v5:
 - use 'xenpvh' os type
---
 docs/formatcaps.html.in|  9 --
 docs/schemas/domaincommon.rng  |  2 +-
 m4/virt-driver-libxl.m4|  3 ++-
 src/conf/domain_conf.c | 10 ---
 src/conf/domain_conf.h |  1 +-
 src/libxl/libxl_capabilities.c | 38 +++---
 src/libxl/libxl_conf.c | 52 ++-
 src/libxl/libxl_driver.c   |  6 ++--
 8 files changed, 102 insertions(+), 19 deletions(-)

diff --git a/docs/formatcaps.html.in b/docs/formatcaps.html.in
index 0d9c53d..86534b2 100644
--- a/docs/formatcaps.html.in
+++ b/docs/formatcaps.html.in
@@ -74,11 +74,14 @@
 is able to run. Possible values are:
 
   xen
-  for XEN
+  for XEN PV
 
   linux
   legacy alias for xen
 
+  xenpvh
+  for XEN PVH
+
   hvm
   Unmodified operating system
 
@@ -104,8 +107,8 @@
 machineMachine type, for use in
   machine
   attribute of os/type element in domain XML. For example Xen
-  supports xenfv for HVM or xenpv for
-  PV.
+  supports xenfv for HVM, xenpv for
+  PV, or xenpvh for PVH.
 domainThe type attribute of
   this element specifies the type of hypervisor required to run the
   domain. Use in type
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 5ee727e..9b5ffa3 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -341,12 +341,14 @@
   
 xenpv
 xenfv
+xenpvh
   
 
   
   
 xen
 linux
+xenpvh
   
 
   
diff --git a/m4/virt-driver-libxl.m4 b/m4/virt-driver-libxl.m4
index 479d911..2cd97cc 100644
--- a/m4/virt-driver-libxl.m4
+++ b/m4/virt-driver-libxl.m4
@@ -75,6 +75,9 @@ AC_DEFUN([LIBVIRT_DRIVER_CHECK_LIBXL], [
 ])
   fi
 
+  dnl Check if Xen has support for PVH
+  AC_CHECK_DECL(LIBXL_DOMAIN_TYPE_PVH, [AC_DEFINE([HAVE_XEN_PVH], [1], [Define 
to 1 if Xen has PVH support.])], [], [#include ])
+
   AC_SUBST([LIBXL_CFLAGS])
   AC_SUBST([LIBXL_LIBS])
 ])
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1387483..10bf933 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -126,7 +126,8 @@ VIR_ENUM_IMPL(virDomainOS, VIR_DOMAIN_OSTYPE_LAST,
   "xen",
   "linux",
   "exe",
-  "uml")
+  "uml",
+  "xenpvh")
 
 VIR_ENUM_IMPL(virDomainBoot, VIR_DOMAIN_BOOT_LAST,
   "fd",
@@ -12932,7 +12933,8 @@ virDomainInputDefParseXML(virDomainXMLOptionPtr xmlopt,
bus);
 goto error;
 }
-} else if (dom->os.type == VIR_DOMAIN_OSTYPE_XEN) {
+} else if (dom->os.type == VIR_DOMAIN_OSTYPE_XEN ||
+   dom->os.type == VIR_DOMAIN_OSTYPE_XENPVH) {
 if (def->bus != VIR_DOMAIN_INPUT_BUS_XEN) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported input bus %s"),
@@ -12981,7 +12983,8 @@ virDomainInputDefParseXML(virDomainXMLOptionPtr xmlopt,
 } else {
 def->bus = VIR_DOMAIN_INPUT_BUS_USB;
 }
-} else if (dom->os.type == VIR_DOMAIN_OSTYPE_XEN) {
+} else if (dom->os.type == VIR_DOMAIN_OSTYPE_XEN ||
+   dom->os.type == VIR_DOMAIN_OSTYPE_XENPVH) {
 def->bus = VIR_DOMAIN_INPUT_BUS_XEN;
 } else {
 if ((dom->virtType == VIR_DOMAIN_VIRT_VZ ||
@@ -18770,6 +18773,7 @@ virDomainDefParseBootOptions(virDomainDefPtr def,
 }
 
 if (def->os.type == VIR_DOMAIN_OST

[libvirt] [PATCH v5 1/6] libxl: reorder libxlMakeDomBuildInfo for upcoming PVH support

2018-11-26 Thread Marek Marczykowski-Górecki
Make it easier to share HVM and PVH code where relevant. No functional
change.

Signed-off-by: Marek Marczykowski-Górecki 
---
 src/libxl/libxl_conf.c | 26 ++
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index e2bfa2f..f3da0ed 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -376,18 +376,6 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
 b_info->max_memkb = virDomainDefGetMemoryInitial(def);
 b_info->target_memkb = def->mem.cur_balloon;
 if (hvm) {
-char bootorder[VIR_DOMAIN_BOOT_LAST + 1];
-
-libxl_defbool_set(_info->u.hvm.pae,
-  def->features[VIR_DOMAIN_FEATURE_PAE] ==
-  VIR_TRISTATE_SWITCH_ON);
-libxl_defbool_set(_info->u.hvm.apic,
-  def->features[VIR_DOMAIN_FEATURE_APIC] ==
-  VIR_TRISTATE_SWITCH_ON);
-libxl_defbool_set(_info->u.hvm.acpi,
-  def->features[VIR_DOMAIN_FEATURE_ACPI] ==
-  VIR_TRISTATE_SWITCH_ON);
-
 if (caps &&
 def->cpu && def->cpu->mode == (VIR_CPU_MODE_HOST_PASSTHROUGH)) {
 bool hasHwVirt = false;
@@ -474,6 +462,20 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
  "mode=host-passthrough to avoid risk of changed guest "
  "semantics when mode=custom is supported in the future");
 }
+}
+
+if (hvm) {
+char bootorder[VIR_DOMAIN_BOOT_LAST + 1];
+
+libxl_defbool_set(_info->u.hvm.pae,
+  def->features[VIR_DOMAIN_FEATURE_PAE] ==
+  VIR_TRISTATE_SWITCH_ON);
+libxl_defbool_set(_info->u.hvm.apic,
+  def->features[VIR_DOMAIN_FEATURE_APIC] ==
+  VIR_TRISTATE_SWITCH_ON);
+libxl_defbool_set(_info->u.hvm.acpi,
+  def->features[VIR_DOMAIN_FEATURE_ACPI] ==
+  VIR_TRISTATE_SWITCH_ON);
 
 if (def->nsounds > 0) {
 /*
-- 
git-series 0.9.1

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

Re: [libvirt] [PATCH v4 2/5] libxl: add support for PVH

2018-10-19 Thread Marek Marczykowski-Górecki
On Fri, Oct 19, 2018 at 04:19:21PM +0100, Daniel P. Berrangé wrote:
> On Fri, Oct 19, 2018 at 05:10:30PM +0200, Marek Marczykowski-Górecki wrote:
> > On Fri, Oct 19, 2018 at 03:59:03PM +0100, Daniel P. Berrangé wrote:
> > > On Fri, Oct 19, 2018 at 08:53:15AM -0600, Jim Fehlig wrote:
> > > > own head) for either of the two modeling approaches
> > > > 
> > > > https://www.redhat.com/archives/libvir-list/2018-October/msg00214.html
> > > > https://www.redhat.com/archives/libvir-list/2018-October/msg00891.html
> > > 
> > > It has a bad name, but essentially you should consider "ostype" to
> > > refer to the   Hypervisor <-> Guest hardware ABI.
> > 
> > Oh, if that's the case, then indeed separate ostype makes sense. Maybe
> > it worth expanding ostype description somewhere in documentation?

Also, such definition of os type, make "linux" os type for Xen PV even 
weirder...

> > > Based on what I read, and your 2 links here, PV is clearly a different
> > > hardware ABI from PVH. Guest kernels needs different modifications for
> > > PV vs PVH.
> > > 
> > > Sorry I didn't spot this sooner, and let this go off down the blind
> > > alley of switching based on machine type, when we should have used
> > > the ostype :-(
> > 
> > What machine type should it use then? Still xenpvh, but make all the
> > decisions based on ostype?
> 
> If Xen/QEMU calls the machine type 'xenpvh' then yeah we can still
> use it. 

There is no qemu in the picture, and Xen (libxl) have just one thing:
type, not separate os type and machine type. So, it's only libvirt
specific bit here and we can choose it arbitrarily. As you wrote
below, libvirt can fill it based on os type, so I'll make it "xenpvh".

> By having a distinct ostype, when the XML says "xenpvh" for
> OS type, the XML parser can automatically find the correct machine
> type name from the capabilities data. So mgmt apps using libvirt
> won't need to set the machine type themselves, can just rely on the
> default, after they've set the ostype.

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


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

Re: [libvirt] [PATCH v4 2/5] libxl: add support for PVH

2018-10-19 Thread Marek Marczykowski-Górecki
On Fri, Oct 19, 2018 at 03:59:03PM +0100, Daniel P. Berrangé wrote:
> On Fri, Oct 19, 2018 at 08:53:15AM -0600, Jim Fehlig wrote:
> > On 10/19/18 8:14 AM, Daniel P. Berrangé wrote:
> > > On Fri, Oct 19, 2018 at 08:06:18AM -0600, Jim Fehlig wrote:
> > > > On 10/19/18 3:11 AM, Daniel P. Berrangé wrote:
> > > > > On Thu, Oct 18, 2018 at 11:08:34AM -0600, Jim Fehlig wrote:
> > > > > > On 10/17/18 12:59 PM, Marek Marczykowski-Górecki wrote:
> > > > > > > On Sat, Oct 13, 2018 at 08:46:19AM -0600, Jim Fehlig wrote:
> > > > > > > > I had some couch time at the start of the weekend and was 
> > > > > > > > finally able to
> > > > > > > > try using this series with virt-install. As it turns out, 
> > > > > > > > reporting
> > > > > > > > duplicate  blocks for  'xen' is not quite 
> > > > > > > > right. Instead we
> > > > > > > > will want to report the additional  under the existing 
> > > > > > > > 'xen'
> > > > > > > >  blocks.
> > > > > > > 
> > > > > > > Is that virt-install limitation? In that case, IMO virt-install 
> > > > > > > should
> > > > > > > be fixed, instead of changing capabilities xml to match its 
> > > > > > > limitations.
> > > > > > 
> > > > > > Perhaps it is a virt-install limitation, but my suggestion was 
> > > > > > based more on
> > > > > > how the qemu driver reports the different machines
> > > > > > 
> > > > > > 
> > > > > > hvm
> > > > > > 
> > > > > >   64
> > > > > >   /usr/bin/qemu-system-x86_64
> > > > > >   pc-i440fx-3.0
> > > > > >   pc-q35-3.0
> > > > > >   ...
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > Compare that with reporting PV and PVH in different  blocks, 
> > > > > > where
> > > > > > the  and  are the same. It seems confusing from a 
> > > > > > consumers
> > > > > > POV
> > > > > > 
> > > > > > 
> > > > > > xen
> > > > > > 
> > > > > >   64
> > > > > >   /usr/bin/qemu-system-x86_64
> > > > > >   xenpv
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > xen
> > > > > > 
> > > > > >   64
> > > > > >   /usr/bin/qemu-system-x86_64
> > > > > >   xenpvh
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > How should a consumer interpret that? Is the machine for 
> > > > > > os_type=xen,
> > > > > > arch=x86_64 a xenpv or a xenpvh?
> > > > > 
> > > > > Yes, you are right - any pair of (os_type, arch) should be unique
> > > > > in the capabilities XML. So all machines should be reported in the
> > > > > same block.
> > > > 
> > > > Our difficulty with that is xenpv and xenpvh machines have different
> > > > features. Marek pointed out that the qemu driver reports the "feature"
> > > > maxCpus as an attribute on the machine element, but we're hesitant to 
> > > > keep
> > > > adding attributes for each feature that is unique to a machine.
> > > > 
> > > > Another option we discussed was reporting a superset of all features so 
> > > > that
> > > > e.g. (xen, x86_64) block would contain features supported by both PV 
> > > > and PVH
> > > > and then rejecting unsupported features when parsing domXML or starting 
> > > > the
> > > > VM. This option is rather distasteful.
> > > > 
> > > > And we also have the option of adding VIR_DOMAIN_OSTYPE_XENPVH, which 
> > > > I've
> > > > shied away from but may be a better way to go in the end. Do you have 
> > > > any
> > > > suggestions we may have overlooked?
> > > 
> > > Oooh, it looks like i've been mis-understanding PVH in all my previous
> > > re

Re: [libvirt] [PATCH v4 2/5] libxl: add support for PVH

2018-10-18 Thread Marek Marczykowski-Górecki
On Thu, Oct 18, 2018 at 11:08:34AM -0600, Jim Fehlig wrote:
> On 10/17/18 12:59 PM, Marek Marczykowski-Górecki wrote:
> > On Sat, Oct 13, 2018 at 08:46:19AM -0600, Jim Fehlig wrote:
> > > I had some couch time at the start of the weekend and was finally able to
> > > try using this series with virt-install. As it turns out, reporting
> > > duplicate  blocks for  'xen' is not quite right. Instead 
> > > we
> > > will want to report the additional  under the existing 'xen'
> > >  blocks.
> > 
> > Is that virt-install limitation? In that case, IMO virt-install should
> > be fixed, instead of changing capabilities xml to match its limitations.
> 
> Perhaps it is a virt-install limitation, but my suggestion was based more on
> how the qemu driver reports the different machines
> 
> 
>   hvm
>   
> 64
> /usr/bin/qemu-system-x86_64
> pc-i440fx-3.0
> pc-q35-3.0
> ...
>   
> 
> 
> Compare that with reporting PV and PVH in different  blocks, where
> the  and  are the same. It seems confusing from a consumers
> POV
> 
> 
>   xen
>   
> 64
> /usr/bin/qemu-system-x86_64
> xenpv
>   
> 
> 
> 
>   xen
>   
> 64
> /usr/bin/qemu-system-x86_64
> xenpvh
>   
> 
> 
> How should a consumer interpret that? Is the machine for os_type=xen,
> arch=x86_64 a xenpv or a xenpvh?

I don't see a problem - each guest block represent set of possible
configurations. Given the current structure, you could also ask "is
the os_type for arch=x86_64 a xen or a hvm?". Both are valid, with
possibly different set of features available. And the same goes for
xenpv and xenpvh machines.
Actually, I see qemu had similar problem as we have now with some features
being specific to some machine value - maxCpus. And as solution, it was
put in machine's attributes. But I think this approach is short-sighted.

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


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

Re: [libvirt] [PATCH v4 2/5] libxl: add support for PVH

2018-10-17 Thread Marek Marczykowski-Górecki
On Sat, Oct 13, 2018 at 08:46:19AM -0600, Jim Fehlig wrote:
> I had some couch time at the start of the weekend and was finally able to
> try using this series with virt-install. As it turns out, reporting
> duplicate  blocks for  'xen' is not quite right. Instead we
> will want to report the additional  under the existing 'xen'
>  blocks. 

Is that virt-install limitation? In that case, IMO virt-install should
be fixed, instead of changing capabilities xml to match its limitations.

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


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

Re: [libvirt] [PATCH v4 2/5] libxl: add support for PVH

2018-10-16 Thread Marek Marczykowski-Górecki
On Sat, Oct 13, 2018 at 08:46:19AM -0600, Jim Fehlig wrote:
> I had some couch time at the start of the weekend and was finally able to
> try using this series with virt-install. As it turns out, reporting
> duplicate  blocks for  'xen' is not quite right. Instead we
> will want to report the additional  under the existing 'xen'
>  blocks. E.g. instead of adding a duplicate
> 
>   
> xen
> 
>   64
>   /usr/lib/xen/bin/qemu-system-i386
>   xenpvh
>   
> 
> ...
>   
> 
> we'll want to include the xenpvh machine in the existing  config for 
> xen
> 
>   
> xen
> 
>   64
>   /usr/lib/xen/bin/qemu-system-i386
>   xenpvh
>   xenpv
>   
> 
>   
> 
> With this change to the capabilities reporting, virt-install works without
> modification using
> 
> virt-install --paravirt --machine xenpv ...
> 
> I didn't think too hard about the best way to handle this, but the attached
> diff is a POC hack that works with unmodified virt-install.

I can get it reported this way, but it will be wrong, because 
will be incorrectly reported. For example hap should be reported for
xenpvh, but not for xenpv, so bundling them together makes it
impossible. Similar for acpi and probably others too.

If this really needs to be reported together, I'd go with reporting
superset of features, so os_type xen entry will have all features of PV
and PVH. But then, it should probably reject PV features for PVH
machine somewhere - in post parse hook? Or maybe it should forcibly
remove them - for example I see PAE is forcibly enabled for 64bit HVM
guests.

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


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

Re: [libvirt] [PATCH v4 2/5] libxl: add support for PVH

2018-10-09 Thread Marek Marczykowski-Górecki
On Tue, Oct 09, 2018 at 04:45:01PM -0600, Jim Fehlig wrote:
> On 10/7/18 9:39 AM, Marek Marczykowski-Górecki wrote:
> > @@ -647,6 +669,22 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
> >   return -1;
> >   }
> >   #endif
> > +} else if (pvh) {
> > +if (VIR_STRDUP(b_info->cmdline, def->os.cmdline) < 0)
> > +return -1;
> > +if (VIR_STRDUP(b_info->kernel, def->os.kernel) < 0)
> > +return -1;
> > +if (VIR_STRDUP(b_info->ramdisk, def->os.initrd) < 0)
> > +return -1;
> > +#ifdef LIBXL_HAVE_BUILDINFO_BOOTLOADER
> > +if (VIR_STRDUP(b_info->bootloader, def->os.bootloader) < 0)
> > +return -1;
> > +if (def->os.bootloaderArgs) {
> > +if (!(b_info->bootloader_args =
> > +  virStringSplit(def->os.bootloaderArgs, " \t\n", 0)))
> > +return -1;
> > +}
> > +#endif
> 
> This is probably fine, but AFAIK no bootloaders currently support pvh.
> Juergen is working on support in grub2 but that seems to be a little ways
> off.

This is independent of grub2 (which could be set as "kernel"), the
"bootloader" option here is about a program run _in dom0_ to find the
kernel to load, instead of providing a path directly (see xl.cfg(5)).
Like pygrub. And while I haven't tested it with PVH, I see no reason why
it shouldn't work.

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


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

[libvirt] [PATCH v4 0/5] libxl: PVHv2 support

2018-10-07 Thread Marek Marczykowski-Górecki
This is a respin of my old PVHv1 patch[1], converted to PVHv2. The actual code
use "PVH" name.

The guest ostype reuse VIR_DOMAIN_OSTYPE_XEN, but to request PVH machine,
machine="xenpvh" attribute is used.

Since PVHv2 relies on features in newer Xen versions, I needed to convert also
some older code. For example b_info->u.hvm.nested_hvm was deprecated in favor
of b_info->nested_hvm. While the code do handle both old and new versions
(obviously refusing PVHv2 if Xen is too old), this isn't the case for tests.
How it should be handled, if at all?

To test this with all supported Xen versions (4.6, 4.7, 4.8, 4.9, 4.10, 4.11,
unstable), I've extended travis configuration for that[2]. It isn't exactly
trivial to build Xen 4.6-4.8 on recent system, mostly thanks to -Werror and new
warnings, but also other toolchain changes. Because of this, the configuration
is rather hacky. But it may be a good idea to include multiple pre-built Xen
versions in the base docker image and choose one using ./configure options 
(maybe
together with some symlink or environment variable like PKG_CONFIG_PATH).

[1] https://www.redhat.com/archives/libvir-list/2016-August/msg00376.html
[2] https://github.com/marmarek/libvirt/tree/travis-xen-pvh

Changes in v2:
 - drop "docs: don't refer to deprecated 'linux' ostype in example" patch -
   migrating further away from "linux" os type is offtopic to this series and
   apparently is a controversial thing
 - drop "docs: update domain schema for machine attribute" patch -
   already applied
 - apply review comments from Jim
 - rebase on master

Changes in v3:
 - rebase on master, drop already applied patches
 - use #ifdef LIBXL_DOMAIN_TYPE_PVH to detect PVH support, fix compilation
   failure on older Xen
 - exclude PVH from VIR_DOMAIN_OSTYPE_XEN <-> VIR_DOMAIN_OSTYPE_LINUX conversion
 - fix reported capabilities for PVH

Changes in v4:
 - change PVH support detection method

Marek Marczykowski-Górecki (5):
  libxl: reorder libxlMakeDomBuildInfo for upcoming PVH support
  libxl: add support for PVH
  tests: add basic Xen PVH test
  xenconfig: add support for parsing type= xl config entry
  xenconfig: add support for type="pvh"

 docs/formatcaps.html.in |  4 +-
 docs/schemas/domaincommon.rng   |  1 +-
 m4/virt-driver-libxl.m4 |  3 +-
 src/conf/domain_conf.c  |  6 +-
 src/libxl/libxl_capabilities.c  | 38 +--
 src/libxl/libxl_conf.c  | 76 --
 src/libxl/libxl_driver.c|  6 +-
 src/xenconfig/xen_common.c  | 27 ++--
 src/xenconfig/xen_xl.c  |  5 +-
 tests/libxlxml2domconfigdata/basic-pvh.json | 49 ++-
 tests/libxlxml2domconfigdata/basic-pvh.xml  | 28 -
 tests/libxlxml2domconfigtest.c  |  3 +-
 tests/testutilsxen.c|  3 +-
 tests/xlconfigdata/test-fullvirt-type.cfg   | 21 ++-
 tests/xlconfigdata/test-fullvirt-type.xml   | 27 -
 tests/xlconfigdata/test-paravirt-type.cfg   | 13 -
 tests/xlconfigdata/test-paravirt-type.xml   | 25 +++-
 tests/xlconfigdata/test-pvh-type.cfg| 13 -
 tests/xlconfigdata/test-pvh-type.xml| 25 +++-
 tests/xlconfigtest.c|  3 +-
 20 files changed, 341 insertions(+), 35 deletions(-)
 create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.json
 create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.xml
 create mode 100644 tests/xlconfigdata/test-fullvirt-type.cfg
 create mode 100644 tests/xlconfigdata/test-fullvirt-type.xml
 create mode 100644 tests/xlconfigdata/test-paravirt-type.cfg
 create mode 100644 tests/xlconfigdata/test-paravirt-type.xml
 create mode 100644 tests/xlconfigdata/test-pvh-type.cfg
 create mode 100644 tests/xlconfigdata/test-pvh-type.xml

base-commit: 199eee6aae7af3d813fbe98660c7e0fa1a8ae7b7
-- 
git-series 0.9.1

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

[libvirt] [PATCH v4 1/5] libxl: reorder libxlMakeDomBuildInfo for upcoming PVH support

2018-10-07 Thread Marek Marczykowski-Górecki
Make it easier to share HVM and PVH code where relevant. No functional
change.

Signed-off-by: Marek Marczykowski-Górecki 
---
 src/libxl/libxl_conf.c | 26 ++
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index e2bfa2f..f3da0ed 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -376,18 +376,6 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
 b_info->max_memkb = virDomainDefGetMemoryInitial(def);
 b_info->target_memkb = def->mem.cur_balloon;
 if (hvm) {
-char bootorder[VIR_DOMAIN_BOOT_LAST + 1];
-
-libxl_defbool_set(_info->u.hvm.pae,
-  def->features[VIR_DOMAIN_FEATURE_PAE] ==
-  VIR_TRISTATE_SWITCH_ON);
-libxl_defbool_set(_info->u.hvm.apic,
-  def->features[VIR_DOMAIN_FEATURE_APIC] ==
-  VIR_TRISTATE_SWITCH_ON);
-libxl_defbool_set(_info->u.hvm.acpi,
-  def->features[VIR_DOMAIN_FEATURE_ACPI] ==
-  VIR_TRISTATE_SWITCH_ON);
-
 if (caps &&
 def->cpu && def->cpu->mode == (VIR_CPU_MODE_HOST_PASSTHROUGH)) {
 bool hasHwVirt = false;
@@ -474,6 +462,20 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
  "mode=host-passthrough to avoid risk of changed guest "
  "semantics when mode=custom is supported in the future");
 }
+}
+
+if (hvm) {
+char bootorder[VIR_DOMAIN_BOOT_LAST + 1];
+
+libxl_defbool_set(_info->u.hvm.pae,
+  def->features[VIR_DOMAIN_FEATURE_PAE] ==
+  VIR_TRISTATE_SWITCH_ON);
+libxl_defbool_set(_info->u.hvm.apic,
+  def->features[VIR_DOMAIN_FEATURE_APIC] ==
+  VIR_TRISTATE_SWITCH_ON);
+libxl_defbool_set(_info->u.hvm.acpi,
+  def->features[VIR_DOMAIN_FEATURE_ACPI] ==
+  VIR_TRISTATE_SWITCH_ON);
 
 if (def->nsounds > 0) {
 /*
-- 
git-series 0.9.1

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

[libvirt] [PATCH v4 3/5] tests: add basic Xen PVH test

2018-10-07 Thread Marek Marczykowski-Górecki
Signed-off-by: Marek Marczykowski-Górecki 
---
Changes in v3:
 - update for modified "libxl: add support for PVH"
 - skip PVH test on too old Xen
---
 tests/libxlxml2domconfigdata/basic-pvh.json | 49 ++-
 tests/libxlxml2domconfigdata/basic-pvh.xml  | 28 +-
 tests/libxlxml2domconfigtest.c  |  3 +-
 3 files changed, 80 insertions(+)
 create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.json
 create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.xml

diff --git a/tests/libxlxml2domconfigdata/basic-pvh.json 
b/tests/libxlxml2domconfigdata/basic-pvh.json
new file mode 100644
index 000..48365c9
--- /dev/null
+++ b/tests/libxlxml2domconfigdata/basic-pvh.json
@@ -0,0 +1,49 @@
+{
+"c_info": {
+"type": "pvh",
+"name": "test-pvh",
+"uuid": "039e9ee6-4a84-3055-4c81-8ba426ae2656"
+},
+"b_info": {
+"max_vcpus": 4,
+"avail_vcpus": [
+0,
+1,
+2,
+3
+],
+"max_memkb": 524288,
+"target_memkb": 524288,
+"shadow_memkb": 8192,
+"sched_params": {
+
+},
+"kernel": "/boot/vmlinuz",
+"ramdisk": "/boot/initrd.img",
+"type.pvh": {
+},
+"arch_arm": {
+
+}
+},
+"disks": [
+{
+"pdev_path": "/var/lib/xen/images/test-pv.img",
+"vdev": "xvda",
+"backend": "qdisk",
+"format": "raw",
+"removable": 1,
+"readwrite": 1
+}
+],
+"nics": [
+{
+"devid": 0,
+"mac": "00:16:3e:3e:86:60",
+"bridge": "br0",
+"script": "/etc/xen/scripts/vif-bridge",
+"nictype": "vif"
+}
+],
+"on_reboot": "restart"
+}
diff --git a/tests/libxlxml2domconfigdata/basic-pvh.xml 
b/tests/libxlxml2domconfigdata/basic-pvh.xml
new file mode 100644
index 000..7bcf67f
--- /dev/null
+++ b/tests/libxlxml2domconfigdata/basic-pvh.xml
@@ -0,0 +1,28 @@
+
+  test-pvh
+  039e9ee6-4a84-3055-4c81-8ba426ae2656
+  524288
+  524288
+  4
+  
+xen
+/boot/vmlinuz
+/boot/initrd.img
+  
+  
+  destroy
+  restart
+  destroy
+  
+
+  
+  
+  
+
+
+  
+  
+  
+
+  
+
diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
index 22f9c2c..a2b2f81 100644
--- a/tests/libxlxml2domconfigtest.c
+++ b/tests/libxlxml2domconfigtest.c
@@ -204,6 +204,9 @@ mymain(void)
 
 DO_TEST("basic-pv");
 DO_TEST("basic-hvm");
+# ifdef HAVE_XEN_PVH
+DO_TEST("basic-pvh");
+# endif
 DO_TEST("cpu-shares-hvm");
 DO_TEST("variable-clock-hvm");
 DO_TEST("moredevs-hvm");
-- 
git-series 0.9.1

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

[libvirt] [PATCH v4 5/5] xenconfig: add support for type="pvh"

2018-10-07 Thread Marek Marczykowski-Górecki
Handle PVH domain type in both directions (xen-xl->xml, xml->xen-xl).
And add a test for it.

Signed-off-by: Marek Marczykowski-Górecki 
---
Changes in v3:
 - update for modified "libxl: add support for PVH"
---
 src/xenconfig/xen_common.c   | 11 +--
 src/xenconfig/xen_xl.c   |  5 +
 tests/testutilsxen.c |  3 ++-
 tests/xlconfigdata/test-pvh-type.cfg | 13 +
 tests/xlconfigdata/test-pvh-type.xml | 25 +
 tests/xlconfigtest.c |  1 +
 6 files changed, 55 insertions(+), 3 deletions(-)
 create mode 100644 tests/xlconfigdata/test-pvh-type.cfg
 create mode 100644 tests/xlconfigdata/test-pvh-type.xml

diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index 6c27936..30b1c9f 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -1091,6 +1091,7 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr def, 
virCapsPtr caps)
 virCapsDomainDataPtr capsdata = NULL;
 VIR_AUTOFREE(char *) str = NULL;
 int hvm = 0, ret = -1;
+const char *machine = "xenpv";
 
 if (xenConfigCopyString(conf, "name", >name) < 0)
 goto out;
@@ -1101,8 +1102,12 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr 
def, virCapsPtr caps)
 if (xenConfigGetString(conf, "type", , NULL) == 0 && str) {
 if (STREQ(str, "pv")) {
 hvm = 0;
+} else if (STREQ(str, "pvh")) {
+hvm = 0;
+machine = "xenpvh";
 } else if (STREQ(str, "hvm")) {
 hvm = 1;
+machine = "xenfv";
 } else {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("type %s is not supported"), str);
@@ -1110,14 +1115,16 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr 
def, virCapsPtr caps)
 }
 } else {
 if ((xenConfigGetString(conf, "builder", , "linux") == 0) &&
-STREQ(str, "hvm"))
+STREQ(str, "hvm")) {
 hvm = 1;
+machine = "xenfv";
+}
 }
 
 def->os.type = (hvm ? VIR_DOMAIN_OSTYPE_HVM : VIR_DOMAIN_OSTYPE_XEN);
 
 if (!(capsdata = virCapabilitiesDomainDataLookup(caps, def->os.type,
-VIR_ARCH_NONE, def->virtType, NULL, NULL)))
+VIR_ARCH_NONE, def->virtType, NULL, machine)))
 goto out;
 
 def->os.arch = capsdata->arch;
diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index 7250e57..0df8f35 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -1287,6 +1287,11 @@ xenFormatXLOS(virConfPtr conf, virDomainDefPtr def)
 
 /* XXX floppy disks */
 } else {
+if (STREQ(def->os.machine, "xenpvh")) {
+if (xenConfigSetString(conf, "type", "pvh") < 0)
+return -1;
+}
+
 if (def->os.bootloader &&
  xenConfigSetString(conf, "bootloader", def->os.bootloader) < 0)
 return -1;
diff --git a/tests/testutilsxen.c b/tests/testutilsxen.c
index d34be72..c112912 100644
--- a/tests/testutilsxen.c
+++ b/tests/testutilsxen.c
@@ -17,7 +17,8 @@ testXLInitCaps(void)
 "xenfv"
 };
 static const char *const xen_machines[] = {
-"xenpv"
+"xenpv",
+"xenpvh"
 };
 
 if ((caps = virCapabilitiesNew(virArchFromHost(),
diff --git a/tests/xlconfigdata/test-pvh-type.cfg 
b/tests/xlconfigdata/test-pvh-type.cfg
new file mode 100644
index 000..2493535
--- /dev/null
+++ b/tests/xlconfigdata/test-pvh-type.cfg
@@ -0,0 +1,13 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+type = "pvh"
+kernel = "/tmp/vmlinuz"
+ramdisk = "/tmp/initrd"
+cmdline = "root=/dev/xvda1 console=hvc0"
diff --git a/tests/xlconfigdata/test-pvh-type.xml 
b/tests/xlconfigdata/test-pvh-type.xml
new file mode 100644
index 000..7e3f182
--- /dev/null
+++ b/tests/xlconfigdata/test-pvh-type.xml
@@ -0,0 +1,25 @@
+
+  XenGuest2
+  c7a5fdb2-cdaf-9455-926a-d65c16db1809
+  592896
+  403456
+  1
+  
+xen
+/tmp/vmlinuz
+/tmp/initrd
+root=/dev/xvda1 console=hvc0
+  
+  
+  destroy
+  restart
+  restart
+  
+
+  
+
+
+
+
+  
+
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index 6e3267e..5159182 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -281,6 +281,7 @@ mymain(void)
 DO_TEST("rbd-multihost-noauth");
 DO_TEST_FORMAT("paravirt-type", false);
 DO_TEST_FORMAT("fullvirt-type", false);
+DO_TEST("pvh-type");
 
 #ifdef LIBXL_HAVE_DEVICE_CHANNEL
 DO_TEST("channel-pty");
-- 
git-series 0.9.1

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

[libvirt] [PATCH v4 4/5] xenconfig: add support for parsing type= xl config entry

2018-10-07 Thread Marek Marczykowski-Górecki
builder="hvm" is deprecated since Xen 4.10, new syntax is type="hvm" (or
type="pv", which is default). Since the old one is still supported,
still use it when writing native config, so the config will work on
older Xen too (and will also not complicate tests).

Signed-off-by: Marek Marczykowski-Górecki 
---
"type" option is the only syntax for specifying PVH guest, coming in
next patch.

Changes in v2:
 - fix code style
---
 src/xenconfig/xen_common.c| 18 +---
 tests/xlconfigdata/test-fullvirt-type.cfg | 21 +++-
 tests/xlconfigdata/test-fullvirt-type.xml | 27 -
 tests/xlconfigdata/test-paravirt-type.cfg | 13 -
 tests/xlconfigdata/test-paravirt-type.xml | 25 ++-
 tests/xlconfigtest.c  |  2 ++-
 6 files changed, 103 insertions(+), 3 deletions(-)
 create mode 100644 tests/xlconfigdata/test-fullvirt-type.cfg
 create mode 100644 tests/xlconfigdata/test-fullvirt-type.xml
 create mode 100644 tests/xlconfigdata/test-paravirt-type.cfg
 create mode 100644 tests/xlconfigdata/test-paravirt-type.xml

diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index 0a99587..6c27936 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -1098,9 +1098,21 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr 
def, virCapsPtr caps)
 if (xenConfigGetUUID(conf, "uuid", def->uuid) < 0)
 goto out;
 
-if ((xenConfigGetString(conf, "builder", , "linux") == 0) &&
-STREQ(str, "hvm"))
-hvm = 1;
+if (xenConfigGetString(conf, "type", , NULL) == 0 && str) {
+if (STREQ(str, "pv")) {
+hvm = 0;
+} else if (STREQ(str, "hvm")) {
+hvm = 1;
+} else {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _("type %s is not supported"), str);
+return -1;
+}
+} else {
+if ((xenConfigGetString(conf, "builder", , "linux") == 0) &&
+STREQ(str, "hvm"))
+hvm = 1;
+}
 
 def->os.type = (hvm ? VIR_DOMAIN_OSTYPE_HVM : VIR_DOMAIN_OSTYPE_XEN);
 
diff --git a/tests/xlconfigdata/test-fullvirt-type.cfg 
b/tests/xlconfigdata/test-fullvirt-type.cfg
new file mode 100644
index 000..f8ecc2e
--- /dev/null
+++ b/tests/xlconfigdata/test-fullvirt-type.cfg
@@ -0,0 +1,21 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+pae = 1
+acpi = 1
+apic = 1
+viridian = 0
+rtc_timeoffset = 0
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+device_model = "/usr/lib/xen/bin/qemu-system-i386"
+sdl = 0
+vnc = 0
+parallel = "none"
+serial = "none"
+type = "hvm"
+boot = "d"
diff --git a/tests/xlconfigdata/test-fullvirt-type.xml 
b/tests/xlconfigdata/test-fullvirt-type.xml
new file mode 100644
index 000..da8e360
--- /dev/null
+++ b/tests/xlconfigdata/test-fullvirt-type.xml
@@ -0,0 +1,27 @@
+
+  XenGuest2
+  c7a5fdb2-cdaf-9455-926a-d65c16db1809
+  592896
+  403456
+  1
+  
+hvm
+/usr/lib/xen/boot/hvmloader
+
+  
+  
+
+
+
+  
+  
+  destroy
+  restart
+  restart
+  
+/usr/lib/xen/bin/qemu-system-i386
+
+
+
+  
+
diff --git a/tests/xlconfigdata/test-paravirt-type.cfg 
b/tests/xlconfigdata/test-paravirt-type.cfg
new file mode 100644
index 000..078db99
--- /dev/null
+++ b/tests/xlconfigdata/test-paravirt-type.cfg
@@ -0,0 +1,13 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+type = "pv"
+maxmem = 579
+memory = 394
+vcpus = 1
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+kernel = "/tmp/vmlinuz"
+ramdisk = "/tmp/initrd"
+cmdline = "root=/dev/xvda1 console=hvc0"
diff --git a/tests/xlconfigdata/test-paravirt-type.xml 
b/tests/xlconfigdata/test-paravirt-type.xml
new file mode 100644
index 000..4357640
--- /dev/null
+++ b/tests/xlconfigdata/test-paravirt-type.xml
@@ -0,0 +1,25 @@
+
+  XenGuest2
+  c7a5fdb2-cdaf-9455-926a-d65c16db1809
+  592896
+  403456
+  1
+  
+linux
+/tmp/vmlinuz
+/tmp/initrd
+root=/dev/xvda1 console=hvc0
+  
+  
+  destroy
+  restart
+  restart
+  
+
+  
+
+
+
+
+  
+
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index b2e4591..6e3267e 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -279,6 +279,8 @@ mymain(void)
 DO_TEST_FORMAT("paravirt-cmdline-extra-root", false);
 DO_TEST_FORMAT("paravirt-cmdline-bogus-extra-root", false);
 DO_TEST("rbd-multihost-noauth");
+DO_TEST_FORMAT("paravirt-type", false);
+DO_TEST_FORMAT("fullvirt-type", false);
 
 #ifdef LIBXL_HAVE_DEVICE_CHANNEL
 DO_TEST("channel-pty");
-- 
git-series 0.9.1

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

[libvirt] [PATCH v4 2/5] libxl: add support for PVH

2018-10-07 Thread Marek Marczykowski-Górecki
Since this is something between PV and HVM, it makes sense to put the
setting in place where domain type is specified.
To enable it, use  It is
also included in capabilities.xml, for every supported HVM guest type - it
doesn't seems to be any other requirement (besides new enough Xen).

Signed-off-by: Marek Marczykowski-Górecki 
---
Changes in v2 proposed by Jim:
 - use new_arch_added var instead of i == nr_guest_archs for clarity
 - improve comment
 - adjust for now required Xen >= 4.6 (remove part for Xen < 4.5)

Changes in v3:
 - limit VIR_DOMAIN_OSTYPE_XEN -> VIR_DOMAIN_OSTYPE_LINUX conversion to
 Xen PV only
 - do not accept VIR_DOMAIN_OSTYPE_LINUX for PVH
 - fix reported capabilities for PVH - remove hostdev passthrough and
 video/graphics
 - use #ifdef LIBXL_DOMAIN_TYPE_PVH instead of hypervisor version to
 check for PVH support
 - compile fix for Xen < 4.9

Changes in v4:
 - revert to "i == nr_guest_archs-1" check
 - let configure check for LIBXL_DOMAIN_TYPE_PVH and use #ifdef
 HAVE_XEN_PVH then
 - fix comment about Xen version
---
 docs/formatcaps.html.in|  4 +--
 docs/schemas/domaincommon.rng  |  1 +-
 m4/virt-driver-libxl.m4|  3 ++-
 src/conf/domain_conf.c |  6 ++--
 src/libxl/libxl_capabilities.c | 38 ++-
 src/libxl/libxl_conf.c | 50 ++-
 src/libxl/libxl_driver.c   |  6 ++--
 7 files changed, 90 insertions(+), 18 deletions(-)

diff --git a/docs/formatcaps.html.in b/docs/formatcaps.html.in
index 0d9c53d..fe113bc 100644
--- a/docs/formatcaps.html.in
+++ b/docs/formatcaps.html.in
@@ -104,8 +104,8 @@
 machineMachine type, for use in
   machine
   attribute of os/type element in domain XML. For example Xen
-  supports xenfv for HVM or xenpv for
-  PV.
+  supports xenfv for HVM, xenpv for
+  PV, or xenpvh for PVH.
 domainThe type attribute of
   this element specifies the type of hypervisor required to run the
   domain. Use in type
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 099a949..820a7c6 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -341,6 +341,7 @@
   
 xenpv
 xenfv
+xenpvh
   
 
   
diff --git a/m4/virt-driver-libxl.m4 b/m4/virt-driver-libxl.m4
index 479d911..2cd97cc 100644
--- a/m4/virt-driver-libxl.m4
+++ b/m4/virt-driver-libxl.m4
@@ -75,6 +75,9 @@ AC_DEFUN([LIBVIRT_DRIVER_CHECK_LIBXL], [
 ])
   fi
 
+  dnl Check if Xen has support for PVH
+  AC_CHECK_DECL(LIBXL_DOMAIN_TYPE_PVH, [AC_DEFINE([HAVE_XEN_PVH], [1], [Define 
to 1 if Xen has PVH support.])], [], [#include ])
+
   AC_SUBST([LIBXL_CFLAGS])
   AC_SUBST([LIBXL_LIBS])
 ])
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9911d56..a945ad4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19094,7 +19094,8 @@ virDomainDefParseCaps(virDomainDefPtr def,
  * be 'xen'. So we accept the former and convert
  */
 if (def->os.type == VIR_DOMAIN_OSTYPE_LINUX &&
-def->virtType == VIR_DOMAIN_VIRT_XEN) {
+def->virtType == VIR_DOMAIN_VIRT_XEN &&
+(!def->os.machine || STREQ(def->os.machine, "xenpv"))) {
 def->os.type = VIR_DOMAIN_OSTYPE_XEN;
 }
 
@@ -27705,7 +27706,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
  * be 'xen'. So we convert to the former for backcompat
  */
 if (def->virtType == VIR_DOMAIN_VIRT_XEN &&
-def->os.type == VIR_DOMAIN_OSTYPE_XEN)
+def->os.type == VIR_DOMAIN_OSTYPE_XEN &&
+(!def->os.machine || STREQ(def->os.machine, "xenpv")))
 virBufferAsprintf(buf, ">%s\n",
   virDomainOSTypeToString(VIR_DOMAIN_OSTYPE_LINUX));
 else
diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
index 18596c7..eecd5e9 100644
--- a/src/libxl/libxl_capabilities.c
+++ b/src/libxl/libxl_capabilities.c
@@ -57,6 +57,7 @@ struct guest_arch {
 virArch arch;
 int bits;
 int hvm;
+int pvh;
 int pae;
 int nonpae;
 int ia64_be;
@@ -491,13 +492,33 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
 guest_archs[i].nonpae = nonpae;
 if (ia64_be)
 guest_archs[i].ia64_be = ia64_be;
+
+/*
+ * Xen 4.10 introduced support for the PVH guest type, which
+ * requires hardware virtualization support similar to the
+ * HVM guest type. Add a PVH guest type for each new HVM
+ * guest type.
+ */
+#ifdef HAVE_XEN_PVH
+if (hvm && i == nr_guest_archs-1) {
+i = nr_guest_archs;
+/* Ensure we have not exhausted the guest_archs array */
+ 

Re: [libvirt] [PATCH v3 2/5] libxl: add support for PVH

2018-10-03 Thread Marek Marczykowski-Górecki
On Wed, Oct 03, 2018 at 03:13:30PM -0600, Jim Fehlig wrote:
> On 10/2/18 4:50 PM, Jim Fehlig wrote:
> > On 9/30/18 8:15 PM, Marek Marczykowski-Górecki wrote:
> > > Since this is something between PV and HVM, it makes sense to put the
> > > setting in place where domain type is specified.
> > > To enable it, use  It is
> > > also included in capabilities.xml, for every supported HVM guest type - it
> > > doesn't seems to be any other requirement (besides new enough Xen).
> > > 
> > > Signed-off-by: Marek Marczykowski-Górecki 
> > > 
> > > ---
> > > Changes in v2 proposed by Jim:
> > >   - use new_arch_added var instead of i == nr_guest_archs for clarity
> > >   - improve comment
> > >   - adjust for now required Xen >= 4.6 (remove part for Xen < 4.5)
> > > 
> > > Changes in v3:
> > >   - limit VIR_DOMAIN_OSTYPE_XEN -> VIR_DOMAIN_OSTYPE_LINUX conversion to
> > >   Xen PV only
> > >   - do not accept VIR_DOMAIN_OSTYPE_LINUX for PVH
> > >   - fix reported capabilities for PVH - remove hostdev passthrough and
> > >   video/graphics
> > 
> > No video, graphics or hostdev passthrough - bummer. Begs the question:
> > what to do with PVH XML config containing these devices? Reject it?
> > Silently ignore? I'll also need to remember to enable these as PVH gains
> > support for the devices.
> > 
> > >   - use #ifdef LIBXL_DOMAIN_TYPE_PVH instead of hypervisor version to
> > >   check for PVH support
> > 
> > This is a much better approach than the version check. I should have
> > thought of that earlier, sorry.
> 
> Actually it is not. LIBXL_DOMAIN_TYPE_PVH is a value in the enum
> libxl_domain_type. Too bad PVH support isn't advertised in libxl.h with
> something like LIBXL_HAVE_PVH. Looks like we are stuck with the version
> check :-(.

Hmm, but that version check is a runtime check. How to fix compile error
regarding missing LIBXL_DOMAIN_TYPE_PVH then? Let configure check that
and define some HAVE_xxx?

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


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

Re: [libvirt] [PATCH v3 2/5] libxl: add support for PVH

2018-10-03 Thread Marek Marczykowski-Górecki
On Tue, Oct 02, 2018 at 06:54:01PM -0600, Jim Fehlig wrote:
> On 10/2/18 5:02 PM, Marek Marczykowski-Górecki wrote:
> > On Tue, Oct 02, 2018 at 04:50:02PM -0600, Jim Fehlig wrote:
> > > My idea to add this variable for clarity now seems diluted by the need for
> > > the extra ifdef's :-/. Your original approach would avoid them.
> > 
> > This #ifdef is only to mute compiler warning (variable set but unused).
> > If you have a better idea for that, I'd very much like to drop #ifdef
> > here.
> 
> Given the ifdef trickery needed with the extra variable, I think the better
> idea is your original idea :-)
> 
> i == nr_guest_archs - 1

Ok, will rollback to that. But I'll wait for os.machine/os.type opinion.

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


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

Re: [libvirt] [PATCH v3 2/5] libxl: add support for PVH

2018-10-02 Thread Marek Marczykowski-Górecki
On Tue, Oct 02, 2018 at 04:50:02PM -0600, Jim Fehlig wrote:
> On 9/30/18 8:15 PM, Marek Marczykowski-Górecki wrote:
> > Since this is something between PV and HVM, it makes sense to put the
> > setting in place where domain type is specified.
> > To enable it, use  It is
> > also included in capabilities.xml, for every supported HVM guest type - it
> > doesn't seems to be any other requirement (besides new enough Xen).
> > 
> > Signed-off-by: Marek Marczykowski-Górecki 
> > ---
> > Changes in v2 proposed by Jim:
> >   - use new_arch_added var instead of i == nr_guest_archs for clarity
> >   - improve comment
> >   - adjust for now required Xen >= 4.6 (remove part for Xen < 4.5)
> > 
> > Changes in v3:
> >   - limit VIR_DOMAIN_OSTYPE_XEN -> VIR_DOMAIN_OSTYPE_LINUX conversion to
> >   Xen PV only
> >   - do not accept VIR_DOMAIN_OSTYPE_LINUX for PVH
> >   - fix reported capabilities for PVH - remove hostdev passthrough and
> >   video/graphics
> 
> No video, graphics or hostdev passthrough - bummer. Begs the question: what
> to do with PVH XML config containing these devices? Reject it? Silently
> ignore? I'll also need to remember to enable these as PVH gains support for
> the devices.

This is based on assumption that by design there is no QEMU, so there is
nothing that could emulate VGA. But actually I'm not so sure about it
right now - because from libxl side it is the same as for PV, and
actually I see some code to start qemu for PV domains. I'm not sure if
it's capable of emulating VGA, but probably can do vfb+vkb backend and
expose it as VNC.

Hostdev passthrough will be there one day...

> >   - use #ifdef LIBXL_DOMAIN_TYPE_PVH instead of hypervisor version to
> >   check for PVH support
> 
> This is a much better approach than the version check. I should have thought
> of that earlier, sorry.
> 
> >   - compile fix for Xen < 4.9
> > ---
> >   docs/formatcaps.html.in|  4 +--
> >   docs/schemas/domaincommon.rng  |  1 +-
> >   src/conf/domain_conf.c |  6 ++--
> >   src/libxl/libxl_capabilities.c | 47 -
> >   src/libxl/libxl_conf.c | 50 ++-
> >   src/libxl/libxl_driver.c   |  6 ++--
> >   6 files changed, 95 insertions(+), 19 deletions(-)
> > 
> > diff --git a/docs/formatcaps.html.in b/docs/formatcaps.html.in
> > index 0d9c53d..b8102fd 100644
> > --- a/docs/formatcaps.html.in
> > +++ b/docs/formatcaps.html.in
> > @@ -104,8 +104,8 @@
> >   machineMachine type, for use in
> >  > href="formatdomain.html#attributeOSTypeMachine">machine
> > attribute of os/type element in domain XML. For example Xen
> > -  supports xenfv for HVM or xenpv for
> > -  PV.
> > +  supports xenfv for HVM, xenpv for
> > +  PV, or xenpvh for PVHv2.
> 
> s/PVHv2/PVH/
> 
> >   domainThe type 
> > attribute of
> > this element specifies the type of hypervisor required to 
> > run the
> > domain. Use in  > href="formatdomain.html#attributeDomainType">type
> > diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> > index 099a949..820a7c6 100644
> > --- a/docs/schemas/domaincommon.rng
> > +++ b/docs/schemas/domaincommon.rng
> > @@ -341,6 +341,7 @@
> > 
> >   xenpv
> >   xenfv
> > +xenpvh
> > 
> >   
> > 
> > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> > index 9911d56..a945ad4 100644
> > --- a/src/conf/domain_conf.c
> > +++ b/src/conf/domain_conf.c
> > @@ -19094,7 +19094,8 @@ virDomainDefParseCaps(virDomainDefPtr def,
> >* be 'xen'. So we accept the former and convert
> >*/
> >   if (def->os.type == VIR_DOMAIN_OSTYPE_LINUX &&
> > -def->virtType == VIR_DOMAIN_VIRT_XEN) {
> > +def->virtType == VIR_DOMAIN_VIRT_XEN &&
> > +(!def->os.machine || STREQ(def->os.machine, "xenpv"))) {
> >   def->os.type = VIR_DOMAIN_OSTYPE_XEN;
> >   }
> > @@ -27705,7 +27706,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
> >* be 'xen'. So we convert to the former for backcompat
> >*/
> >   if (def->virtType == VIR_DOMAIN_VIRT_XEN &&
> > -def->os.type == VIR_DOMAIN_OSTYPE_XEN)
> > +def->os.type == VIR_DOMAIN_OSTYPE_XEN

[libvirt] [PATCH v3 5/5] xenconfig: add support for type="pvh"

2018-09-30 Thread Marek Marczykowski-Górecki
Handle PVH domain type in both directions (xen-xl->xml, xml->xen-xl).
And add a test for it.

Signed-off-by: Marek Marczykowski-Górecki 
---
Changes in v3:
 - update for modified "libxl: add support for PVH"
---
 src/xenconfig/xen_common.c   | 11 +--
 src/xenconfig/xen_xl.c   |  5 +
 tests/testutilsxen.c |  3 ++-
 tests/xlconfigdata/test-pvh-type.cfg | 13 +
 tests/xlconfigdata/test-pvh-type.xml | 25 +
 tests/xlconfigtest.c |  1 +
 6 files changed, 55 insertions(+), 3 deletions(-)
 create mode 100644 tests/xlconfigdata/test-pvh-type.cfg
 create mode 100644 tests/xlconfigdata/test-pvh-type.xml

diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index 6c27936..30b1c9f 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -1091,6 +1091,7 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr def, 
virCapsPtr caps)
 virCapsDomainDataPtr capsdata = NULL;
 VIR_AUTOFREE(char *) str = NULL;
 int hvm = 0, ret = -1;
+const char *machine = "xenpv";
 
 if (xenConfigCopyString(conf, "name", >name) < 0)
 goto out;
@@ -1101,8 +1102,12 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr 
def, virCapsPtr caps)
 if (xenConfigGetString(conf, "type", , NULL) == 0 && str) {
 if (STREQ(str, "pv")) {
 hvm = 0;
+} else if (STREQ(str, "pvh")) {
+hvm = 0;
+machine = "xenpvh";
 } else if (STREQ(str, "hvm")) {
 hvm = 1;
+machine = "xenfv";
 } else {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("type %s is not supported"), str);
@@ -1110,14 +1115,16 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr 
def, virCapsPtr caps)
 }
 } else {
 if ((xenConfigGetString(conf, "builder", , "linux") == 0) &&
-STREQ(str, "hvm"))
+STREQ(str, "hvm")) {
 hvm = 1;
+machine = "xenfv";
+}
 }
 
 def->os.type = (hvm ? VIR_DOMAIN_OSTYPE_HVM : VIR_DOMAIN_OSTYPE_XEN);
 
 if (!(capsdata = virCapabilitiesDomainDataLookup(caps, def->os.type,
-VIR_ARCH_NONE, def->virtType, NULL, NULL)))
+VIR_ARCH_NONE, def->virtType, NULL, machine)))
 goto out;
 
 def->os.arch = capsdata->arch;
diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index 7250e57..0df8f35 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -1287,6 +1287,11 @@ xenFormatXLOS(virConfPtr conf, virDomainDefPtr def)
 
 /* XXX floppy disks */
 } else {
+if (STREQ(def->os.machine, "xenpvh")) {
+if (xenConfigSetString(conf, "type", "pvh") < 0)
+return -1;
+}
+
 if (def->os.bootloader &&
  xenConfigSetString(conf, "bootloader", def->os.bootloader) < 0)
 return -1;
diff --git a/tests/testutilsxen.c b/tests/testutilsxen.c
index d34be72..c112912 100644
--- a/tests/testutilsxen.c
+++ b/tests/testutilsxen.c
@@ -17,7 +17,8 @@ testXLInitCaps(void)
 "xenfv"
 };
 static const char *const xen_machines[] = {
-"xenpv"
+"xenpv",
+"xenpvh"
 };
 
 if ((caps = virCapabilitiesNew(virArchFromHost(),
diff --git a/tests/xlconfigdata/test-pvh-type.cfg 
b/tests/xlconfigdata/test-pvh-type.cfg
new file mode 100644
index 000..2493535
--- /dev/null
+++ b/tests/xlconfigdata/test-pvh-type.cfg
@@ -0,0 +1,13 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+type = "pvh"
+kernel = "/tmp/vmlinuz"
+ramdisk = "/tmp/initrd"
+cmdline = "root=/dev/xvda1 console=hvc0"
diff --git a/tests/xlconfigdata/test-pvh-type.xml 
b/tests/xlconfigdata/test-pvh-type.xml
new file mode 100644
index 000..7e3f182
--- /dev/null
+++ b/tests/xlconfigdata/test-pvh-type.xml
@@ -0,0 +1,25 @@
+
+  XenGuest2
+  c7a5fdb2-cdaf-9455-926a-d65c16db1809
+  592896
+  403456
+  1
+  
+xen
+/tmp/vmlinuz
+/tmp/initrd
+root=/dev/xvda1 console=hvc0
+  
+  
+  destroy
+  restart
+  restart
+  
+
+  
+
+
+
+
+  
+
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index 6e3267e..5159182 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -281,6 +281,7 @@ mymain(void)
 DO_TEST("rbd-multihost-noauth");
 DO_TEST_FORMAT("paravirt-type", false);
 DO_TEST_FORMAT("fullvirt-type", false);
+DO_TEST("pvh-type");
 
 #ifdef LIBXL_HAVE_DEVICE_CHANNEL
 DO_TEST("channel-pty");
-- 
git-series 0.9.1

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

[libvirt] [PATCH v3 1/5] libxl: reorder libxlMakeDomBuildInfo for upcoming PVH support

2018-09-30 Thread Marek Marczykowski-Górecki
Make it easier to share HVM and PVH code where relevant. No functional
change.

Signed-off-by: Marek Marczykowski-Górecki 
---
 src/libxl/libxl_conf.c | 26 ++
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index e2bfa2f..f3da0ed 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -376,18 +376,6 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
 b_info->max_memkb = virDomainDefGetMemoryInitial(def);
 b_info->target_memkb = def->mem.cur_balloon;
 if (hvm) {
-char bootorder[VIR_DOMAIN_BOOT_LAST + 1];
-
-libxl_defbool_set(_info->u.hvm.pae,
-  def->features[VIR_DOMAIN_FEATURE_PAE] ==
-  VIR_TRISTATE_SWITCH_ON);
-libxl_defbool_set(_info->u.hvm.apic,
-  def->features[VIR_DOMAIN_FEATURE_APIC] ==
-  VIR_TRISTATE_SWITCH_ON);
-libxl_defbool_set(_info->u.hvm.acpi,
-  def->features[VIR_DOMAIN_FEATURE_ACPI] ==
-  VIR_TRISTATE_SWITCH_ON);
-
 if (caps &&
 def->cpu && def->cpu->mode == (VIR_CPU_MODE_HOST_PASSTHROUGH)) {
 bool hasHwVirt = false;
@@ -474,6 +462,20 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
  "mode=host-passthrough to avoid risk of changed guest "
  "semantics when mode=custom is supported in the future");
 }
+}
+
+if (hvm) {
+char bootorder[VIR_DOMAIN_BOOT_LAST + 1];
+
+libxl_defbool_set(_info->u.hvm.pae,
+  def->features[VIR_DOMAIN_FEATURE_PAE] ==
+  VIR_TRISTATE_SWITCH_ON);
+libxl_defbool_set(_info->u.hvm.apic,
+  def->features[VIR_DOMAIN_FEATURE_APIC] ==
+  VIR_TRISTATE_SWITCH_ON);
+libxl_defbool_set(_info->u.hvm.acpi,
+  def->features[VIR_DOMAIN_FEATURE_ACPI] ==
+  VIR_TRISTATE_SWITCH_ON);
 
 if (def->nsounds > 0) {
 /*
-- 
git-series 0.9.1

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

[libvirt] [PATCH v3 2/5] libxl: add support for PVH

2018-09-30 Thread Marek Marczykowski-Górecki
Since this is something between PV and HVM, it makes sense to put the
setting in place where domain type is specified.
To enable it, use  It is
also included in capabilities.xml, for every supported HVM guest type - it
doesn't seems to be any other requirement (besides new enough Xen).

Signed-off-by: Marek Marczykowski-Górecki 
---
Changes in v2 proposed by Jim:
 - use new_arch_added var instead of i == nr_guest_archs for clarity
 - improve comment
 - adjust for now required Xen >= 4.6 (remove part for Xen < 4.5)

Changes in v3:
 - limit VIR_DOMAIN_OSTYPE_XEN -> VIR_DOMAIN_OSTYPE_LINUX conversion to
 Xen PV only
 - do not accept VIR_DOMAIN_OSTYPE_LINUX for PVH
 - fix reported capabilities for PVH - remove hostdev passthrough and
 video/graphics
 - use #ifdef LIBXL_DOMAIN_TYPE_PVH instead of hypervisor version to
 check for PVH support
 - compile fix for Xen < 4.9
---
 docs/formatcaps.html.in|  4 +--
 docs/schemas/domaincommon.rng  |  1 +-
 src/conf/domain_conf.c |  6 ++--
 src/libxl/libxl_capabilities.c | 47 -
 src/libxl/libxl_conf.c | 50 ++-
 src/libxl/libxl_driver.c   |  6 ++--
 6 files changed, 95 insertions(+), 19 deletions(-)

diff --git a/docs/formatcaps.html.in b/docs/formatcaps.html.in
index 0d9c53d..b8102fd 100644
--- a/docs/formatcaps.html.in
+++ b/docs/formatcaps.html.in
@@ -104,8 +104,8 @@
 machineMachine type, for use in
   machine
   attribute of os/type element in domain XML. For example Xen
-  supports xenfv for HVM or xenpv for
-  PV.
+  supports xenfv for HVM, xenpv for
+  PV, or xenpvh for PVHv2.
 domainThe type attribute of
   this element specifies the type of hypervisor required to run the
   domain. Use in type
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 099a949..820a7c6 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -341,6 +341,7 @@
   
 xenpv
 xenfv
+xenpvh
   
 
   
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9911d56..a945ad4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19094,7 +19094,8 @@ virDomainDefParseCaps(virDomainDefPtr def,
  * be 'xen'. So we accept the former and convert
  */
 if (def->os.type == VIR_DOMAIN_OSTYPE_LINUX &&
-def->virtType == VIR_DOMAIN_VIRT_XEN) {
+def->virtType == VIR_DOMAIN_VIRT_XEN &&
+(!def->os.machine || STREQ(def->os.machine, "xenpv"))) {
 def->os.type = VIR_DOMAIN_OSTYPE_XEN;
 }
 
@@ -27705,7 +27706,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
  * be 'xen'. So we convert to the former for backcompat
  */
 if (def->virtType == VIR_DOMAIN_VIRT_XEN &&
-def->os.type == VIR_DOMAIN_OSTYPE_XEN)
+def->os.type == VIR_DOMAIN_OSTYPE_XEN &&
+(!def->os.machine || STREQ(def->os.machine, "xenpv")))
 virBufferAsprintf(buf, ">%s\n",
   virDomainOSTypeToString(VIR_DOMAIN_OSTYPE_LINUX));
 else
diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
index 18596c7..be51a4d 100644
--- a/src/libxl/libxl_capabilities.c
+++ b/src/libxl/libxl_capabilities.c
@@ -57,6 +57,7 @@ struct guest_arch {
 virArch arch;
 int bits;
 int hvm;
+int pvh;
 int pae;
 int nonpae;
 int ia64_be;
@@ -439,6 +440,9 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
 int hvm = STRPREFIX([subs[1].rm_so], "hvm");
 virArch arch;
 int pae = 0, nonpae = 0, ia64_be = 0;
+#ifdef LIBXL_DOMAIN_TYPE_PVH
+bool new_arch_added = false;
+#endif
 
 if (STRPREFIX([subs[2].rm_so], "x86_32")) {
 arch = VIR_ARCH_I686;
@@ -475,8 +479,12 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
 if (i >= ARRAY_CARDINALITY(guest_archs))
 continue;
 /* Didn't find a match, so create a new one */
-if (i == nr_guest_archs)
+if (i == nr_guest_archs) {
 nr_guest_archs++;
+#ifdef LIBXL_DOMAIN_TYPE_PVH
+new_arch_added = true;
+#endif
+}
 
 guest_archs[i].arch = arch;
 guest_archs[i].hvm = hvm;
@@ -491,13 +499,33 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
 guest_archs[i].nonpae = nonpae;
 if (ia64_be)
 guest_archs[i].ia64_be = ia64_be;
+
+/*
+ * Xen 4.9 introduced support for the PVH guest type, which
+ * requires hardware virtualization support similar to the
+ * HVM guest type. Add a PVH guest type for each new HVM
+ 

[libvirt] [PATCH v3 3/5] tests: add basic Xen PVH test

2018-09-30 Thread Marek Marczykowski-Górecki
Signed-off-by: Marek Marczykowski-Górecki 
---
Changes in v3:
 - update for modified "libxl: add support for PVH"
 - skip PVH test on too old Xen
---
 tests/libxlxml2domconfigdata/basic-pvh.json | 49 ++-
 tests/libxlxml2domconfigdata/basic-pvh.xml  | 28 +-
 tests/libxlxml2domconfigtest.c  |  3 +-
 3 files changed, 80 insertions(+)
 create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.json
 create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.xml

diff --git a/tests/libxlxml2domconfigdata/basic-pvh.json 
b/tests/libxlxml2domconfigdata/basic-pvh.json
new file mode 100644
index 000..48365c9
--- /dev/null
+++ b/tests/libxlxml2domconfigdata/basic-pvh.json
@@ -0,0 +1,49 @@
+{
+"c_info": {
+"type": "pvh",
+"name": "test-pvh",
+"uuid": "039e9ee6-4a84-3055-4c81-8ba426ae2656"
+},
+"b_info": {
+"max_vcpus": 4,
+"avail_vcpus": [
+0,
+1,
+2,
+3
+],
+"max_memkb": 524288,
+"target_memkb": 524288,
+"shadow_memkb": 8192,
+"sched_params": {
+
+},
+"kernel": "/boot/vmlinuz",
+"ramdisk": "/boot/initrd.img",
+"type.pvh": {
+},
+"arch_arm": {
+
+}
+},
+"disks": [
+{
+"pdev_path": "/var/lib/xen/images/test-pv.img",
+"vdev": "xvda",
+"backend": "qdisk",
+"format": "raw",
+"removable": 1,
+"readwrite": 1
+}
+],
+"nics": [
+{
+"devid": 0,
+"mac": "00:16:3e:3e:86:60",
+"bridge": "br0",
+"script": "/etc/xen/scripts/vif-bridge",
+"nictype": "vif"
+}
+],
+"on_reboot": "restart"
+}
diff --git a/tests/libxlxml2domconfigdata/basic-pvh.xml 
b/tests/libxlxml2domconfigdata/basic-pvh.xml
new file mode 100644
index 000..7bcf67f
--- /dev/null
+++ b/tests/libxlxml2domconfigdata/basic-pvh.xml
@@ -0,0 +1,28 @@
+
+  test-pvh
+  039e9ee6-4a84-3055-4c81-8ba426ae2656
+  524288
+  524288
+  4
+  
+xen
+/boot/vmlinuz
+/boot/initrd.img
+  
+  
+  destroy
+  restart
+  destroy
+  
+
+  
+  
+  
+
+
+  
+  
+  
+
+  
+
diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
index 22f9c2c..a11e525 100644
--- a/tests/libxlxml2domconfigtest.c
+++ b/tests/libxlxml2domconfigtest.c
@@ -204,6 +204,9 @@ mymain(void)
 
 DO_TEST("basic-pv");
 DO_TEST("basic-hvm");
+# ifdef LIBXL_DOMAIN_TYPE_PVH
+DO_TEST("basic-pvh");
+# endif
 DO_TEST("cpu-shares-hvm");
 DO_TEST("variable-clock-hvm");
 DO_TEST("moredevs-hvm");
-- 
git-series 0.9.1

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

[libvirt] [PATCH v3 4/5] xenconfig: add support for parsing type= xl config entry

2018-09-30 Thread Marek Marczykowski-Górecki
builder="hvm" is deprecated since Xen 4.10, new syntax is type="hvm" (or
type="pv", which is default). Since the old one is still supported,
still use it when writing native config, so the config will work on
older Xen too (and will also not complicate tests).

Signed-off-by: Marek Marczykowski-Górecki 
---
"type" option is the only syntax for specifying PVH guest, coming in
next patch.

Changes in v2:
 - fix code style
---
 src/xenconfig/xen_common.c| 18 +---
 tests/xlconfigdata/test-fullvirt-type.cfg | 21 +++-
 tests/xlconfigdata/test-fullvirt-type.xml | 27 -
 tests/xlconfigdata/test-paravirt-type.cfg | 13 -
 tests/xlconfigdata/test-paravirt-type.xml | 25 ++-
 tests/xlconfigtest.c  |  2 ++-
 6 files changed, 103 insertions(+), 3 deletions(-)
 create mode 100644 tests/xlconfigdata/test-fullvirt-type.cfg
 create mode 100644 tests/xlconfigdata/test-fullvirt-type.xml
 create mode 100644 tests/xlconfigdata/test-paravirt-type.cfg
 create mode 100644 tests/xlconfigdata/test-paravirt-type.xml

diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index 0a99587..6c27936 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -1098,9 +1098,21 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr 
def, virCapsPtr caps)
 if (xenConfigGetUUID(conf, "uuid", def->uuid) < 0)
 goto out;
 
-if ((xenConfigGetString(conf, "builder", , "linux") == 0) &&
-STREQ(str, "hvm"))
-hvm = 1;
+if (xenConfigGetString(conf, "type", , NULL) == 0 && str) {
+if (STREQ(str, "pv")) {
+hvm = 0;
+} else if (STREQ(str, "hvm")) {
+hvm = 1;
+} else {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _("type %s is not supported"), str);
+return -1;
+}
+} else {
+if ((xenConfigGetString(conf, "builder", , "linux") == 0) &&
+STREQ(str, "hvm"))
+hvm = 1;
+}
 
 def->os.type = (hvm ? VIR_DOMAIN_OSTYPE_HVM : VIR_DOMAIN_OSTYPE_XEN);
 
diff --git a/tests/xlconfigdata/test-fullvirt-type.cfg 
b/tests/xlconfigdata/test-fullvirt-type.cfg
new file mode 100644
index 000..f8ecc2e
--- /dev/null
+++ b/tests/xlconfigdata/test-fullvirt-type.cfg
@@ -0,0 +1,21 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+pae = 1
+acpi = 1
+apic = 1
+viridian = 0
+rtc_timeoffset = 0
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+device_model = "/usr/lib/xen/bin/qemu-system-i386"
+sdl = 0
+vnc = 0
+parallel = "none"
+serial = "none"
+type = "hvm"
+boot = "d"
diff --git a/tests/xlconfigdata/test-fullvirt-type.xml 
b/tests/xlconfigdata/test-fullvirt-type.xml
new file mode 100644
index 000..da8e360
--- /dev/null
+++ b/tests/xlconfigdata/test-fullvirt-type.xml
@@ -0,0 +1,27 @@
+
+  XenGuest2
+  c7a5fdb2-cdaf-9455-926a-d65c16db1809
+  592896
+  403456
+  1
+  
+hvm
+/usr/lib/xen/boot/hvmloader
+
+  
+  
+
+
+
+  
+  
+  destroy
+  restart
+  restart
+  
+/usr/lib/xen/bin/qemu-system-i386
+
+
+
+  
+
diff --git a/tests/xlconfigdata/test-paravirt-type.cfg 
b/tests/xlconfigdata/test-paravirt-type.cfg
new file mode 100644
index 000..078db99
--- /dev/null
+++ b/tests/xlconfigdata/test-paravirt-type.cfg
@@ -0,0 +1,13 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+type = "pv"
+maxmem = 579
+memory = 394
+vcpus = 1
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+kernel = "/tmp/vmlinuz"
+ramdisk = "/tmp/initrd"
+cmdline = "root=/dev/xvda1 console=hvc0"
diff --git a/tests/xlconfigdata/test-paravirt-type.xml 
b/tests/xlconfigdata/test-paravirt-type.xml
new file mode 100644
index 000..4357640
--- /dev/null
+++ b/tests/xlconfigdata/test-paravirt-type.xml
@@ -0,0 +1,25 @@
+
+  XenGuest2
+  c7a5fdb2-cdaf-9455-926a-d65c16db1809
+  592896
+  403456
+  1
+  
+linux
+/tmp/vmlinuz
+/tmp/initrd
+root=/dev/xvda1 console=hvc0
+  
+  
+  destroy
+  restart
+  restart
+  
+
+  
+
+
+
+
+  
+
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index b2e4591..6e3267e 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -279,6 +279,8 @@ mymain(void)
 DO_TEST_FORMAT("paravirt-cmdline-extra-root", false);
 DO_TEST_FORMAT("paravirt-cmdline-bogus-extra-root", false);
 DO_TEST("rbd-multihost-noauth");
+DO_TEST_FORMAT("paravirt-type", false);
+DO_TEST_FORMAT("fullvirt-type", false);
 
 #ifdef LIBXL_HAVE_DEVICE_CHANNEL
 DO_TEST("channel-pty");
-- 
git-series 0.9.1

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

[libvirt] [PATCH v3 0/5] libxl: PVHv2 support

2018-09-30 Thread Marek Marczykowski-Górecki
This is a respin of my old PVHv1 patch[1], converted to PVHv2.
Should the code use "PVH" name (as libxl does internally), or "PVHv2" as in
many places in Xen documentation? I've chosen the former, but want to confirm
it.

Also, not sure about VIR_DOMAIN_OSTYPE_XENPVH (as discussed on PVHv1 patch) -
while it will be messy in many cases, there is
libxl_domain_build_info.u.{hvm,pv,pvh} which would be good to not mess up.
Also, PVHv2 needs different kernel features than PV (CONFIG_XEN_PVH vs
CONFIG_XEN_PV), so keeping the same VIR_DOMAIN_OSTYPE_XEN could be
confusing.
On the other hand, libxl_domain_build_info.u.pv is used in very few places (one
section of libxlMakeDomBuildInfo), so guarding u.hvm access with
VIR_DOMAIN_OSTYPE_HVM may be enough.
For now I've reused VIR_DOMAIN_OSTYPE_XEN - in the driver itself, most of
the code is the same as for PV.

Since PVHv2 relies on features in newer Xen versions, I needed to convert also
some older code. For example b_info->u.hvm.nested_hvm was deprecated in favor
of b_info->nested_hvm. While the code do handle both old and new versions
(obviously refusing PVHv2 if Xen is too old), this isn't the case for tests.
How it should be handled, if at all?

First few preparatory patches can be applied independently.

[1] https://www.redhat.com/archives/libvir-list/2016-August/msg00376.html

Changes in v2:
 - drop "docs: don't refer to deprecated 'linux' ostype in example" patch -
   migrating further away from "linux" os type is offtopic to this series and
   apparently is a controversial thing
 - drop "docs: update domain schema for machine attribute" patch -
   already applied
 - apply review comments from Jim
 - rebase on master

Changes in v3:
 - rebase on master, drop already applied patches
 - use #ifdef LIBXL_DOMAIN_TYPE_PVH to detect PVH support, fix compilation
   failure on older Xen
 - exclude PVH from VIR_DOMAIN_OSTYPE_XEN <-> VIR_DOMAIN_OSTYPE_LINUX conversion
 - fix reported capabilities for PVH

Marek Marczykowski-Górecki (5):
  libxl: reorder libxlMakeDomBuildInfo for upcoming PVH support
  libxl: add support for PVH
  tests: add basic Xen PVH test
  xenconfig: add support for parsing type= xl config entry
  xenconfig: add support for type="pvh"

 docs/formatcaps.html.in |  4 +-
 docs/schemas/domaincommon.rng   |  1 +-
 src/conf/domain_conf.c  |  6 +-
 src/libxl/libxl_capabilities.c  | 47 +++---
 src/libxl/libxl_conf.c  | 76 --
 src/libxl/libxl_driver.c|  6 +-
 src/xenconfig/xen_common.c  | 27 ++--
 src/xenconfig/xen_xl.c  |  5 +-
 tests/libxlxml2domconfigdata/basic-pvh.json | 49 ++-
 tests/libxlxml2domconfigdata/basic-pvh.xml  | 28 -
 tests/libxlxml2domconfigtest.c  |  3 +-
 tests/testutilsxen.c|  3 +-
 tests/xlconfigdata/test-fullvirt-type.cfg   | 21 ++-
 tests/xlconfigdata/test-fullvirt-type.xml   | 27 -
 tests/xlconfigdata/test-paravirt-type.cfg   | 13 -
 tests/xlconfigdata/test-paravirt-type.xml   | 25 +++-
 tests/xlconfigdata/test-pvh-type.cfg| 13 -
 tests/xlconfigdata/test-pvh-type.xml| 25 +++-
 tests/xlconfigtest.c|  3 +-
 19 files changed, 346 insertions(+), 36 deletions(-)
 create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.json
 create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.xml
 create mode 100644 tests/xlconfigdata/test-fullvirt-type.cfg
 create mode 100644 tests/xlconfigdata/test-fullvirt-type.xml
 create mode 100644 tests/xlconfigdata/test-paravirt-type.cfg
 create mode 100644 tests/xlconfigdata/test-paravirt-type.xml
 create mode 100644 tests/xlconfigdata/test-pvh-type.cfg
 create mode 100644 tests/xlconfigdata/test-pvh-type.xml

base-commit: 199eee6aae7af3d813fbe98660c7e0fa1a8ae7b7
-- 
git-series 0.9.1

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

Re: [libvirt] [PATCH v2 0/8] libxl: PVHv2 support

2018-09-28 Thread Marek Marczykowski-Górecki
On Mon, Sep 24, 2018 at 05:09:44PM -0600, Jim Fehlig wrote:
> On 9/18/18 6:50 PM, Marek Marczykowski-Górecki wrote:
> > This is a respin of my old PVHv1 patch[1], converted to PVHv2.
> > Should the code use "PVH" name (as libxl does internally), or "PVHv2" as in
> > many places in Xen documentation? I've chosen the former, but want to 
> > confirm
> > it.
> 
> From libvirt's perspective it should be "PVH". If anything, the Xen
> documentation should change. AFAIK the various PVH attempts/names (PVHv1,
> hvmlite, PVHv2, ...) have merged to simply be known as "PVH".
> 
> > 
> > Also, not sure about VIR_DOMAIN_OSTYPE_XENPVH (as discussed on PVHv1 patch) 
> > -
> > while it will be messy in many cases, there is
> > libxl_domain_build_info.u.{hvm,pv,pvh} which would be good to not mess up.
> > Also, PVHv2 needs different kernel features than PV (CONFIG_XEN_PVH vs
> > CONFIG_XEN_PV), so keeping the same VIR_DOMAIN_OSTYPE_XEN could be
> > confusing.
> > On the other hand, libxl_domain_build_info.u.pv is used in very few places 
> > (one
> > section of libxlMakeDomBuildInfo), so guarding u.hvm access with
> > VIR_DOMAIN_OSTYPE_HVM may be enough.
> > For now I've reused VIR_DOMAIN_OSTYPE_XEN - in the driver itself, most of
> > the code is the same as for PV.
> 
> I should have read your v1 cover letter closer and agreed on the approach
> before spending time looking at code :-). But in the end I still think the
> OS type is VIR_DOMAIN_OSTYPE_XEN with the machine attribute specifying PV vs
> PVH. I use the fact that both OS types are modified to run on Xen to
> rationalize using VIR_DOMAIN_OSTYPE_XEN for both. Perhaps it would be best
> for a third opinion and Daniel (cc'd) can chime in.
> 
> > Since PVHv2 relies on features in newer Xen versions, I needed to convert 
> > also
> > some older code. For example b_info->u.hvm.nested_hvm was deprecated in 
> > favor
> > of b_info->nested_hvm. While the code do handle both old and new versions
> > (obviously refusing PVHv2 if Xen is too old), this isn't the case for tests.
> > How it should be handled, if at all?
> 
> Due to the compilation error in patch 5, I haven't checked patches 6-8 on
> xen < 4.9, which may help me understand the problem you describe. Sorry it
> is not obvious to me from the reading.

You can already observe the problem after applying "libxl: prefer new
location of nested_hvm in libxl_domain_build_info".

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


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

[libvirt] [PATCH v2 5/8] libxl: add support for PVH

2018-09-18 Thread Marek Marczykowski-Górecki
Since this is something between PV and HVM, it makes sense to put the
setting in place where domain type is specified.
To enable it, use  It is
also included in capabilities.xml, for every supported HVM guest type - it
doesn't seems to be any other requirement (besides new enough Xen).

Signed-off-by: Marek Marczykowski-Górecki 
---
Changes in v2 proposed by Jim:
 - use new_arch_added var instead of i == nr_guest_archs for clarity
 - improve comment
 - adjust for now required Xen >= 4.6 (remove part for Xen < 4.5)
---
 docs/formatcaps.html.in|  4 ++--
 docs/schemas/domaincommon.rng  |  1 +
 src/libxl/libxl_capabilities.c | 33 ++---
 src/libxl/libxl_conf.c | 32 +++-
 src/libxl/libxl_driver.c   |  6 --
 5 files changed, 64 insertions(+), 12 deletions(-)

diff --git a/docs/formatcaps.html.in b/docs/formatcaps.html.in
index 0d9c53d..b8102fd 100644
--- a/docs/formatcaps.html.in
+++ b/docs/formatcaps.html.in
@@ -104,8 +104,8 @@
 machineMachine type, for use in
   machine
   attribute of os/type element in domain XML. For example Xen
-  supports xenfv for HVM or xenpv for
-  PV.
+  supports xenfv for HVM, xenpv for
+  PV, or xenpvh for PVHv2.
 domainThe type attribute of
   this element specifies the type of hypervisor required to run the
   domain. Use in type
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 099a949..820a7c6 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -341,6 +341,7 @@
   
 xenpv
 xenfv
+xenpvh
   
 
   
diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
index 18596c7..446fa4c 100644
--- a/src/libxl/libxl_capabilities.c
+++ b/src/libxl/libxl_capabilities.c
@@ -57,6 +57,7 @@ struct guest_arch {
 virArch arch;
 int bits;
 int hvm;
+int pvh;
 int pae;
 int nonpae;
 int ia64_be;
@@ -439,6 +440,7 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
 int hvm = STRPREFIX([subs[1].rm_so], "hvm");
 virArch arch;
 int pae = 0, nonpae = 0, ia64_be = 0;
+bool new_arch_added = false;
 
 if (STRPREFIX([subs[2].rm_so], "x86_32")) {
 arch = VIR_ARCH_I686;
@@ -475,8 +477,10 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
 if (i >= ARRAY_CARDINALITY(guest_archs))
 continue;
 /* Didn't find a match, so create a new one */
-if (i == nr_guest_archs)
+if (i == nr_guest_archs) {
 nr_guest_archs++;
+new_arch_added = true;
+}
 
 guest_archs[i].arch = arch;
 guest_archs[i].hvm = hvm;
@@ -491,13 +495,34 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
 guest_archs[i].nonpae = nonpae;
 if (ia64_be)
 guest_archs[i].ia64_be = ia64_be;
+
+/*
+ * Xen 4.9 introduced support for the PVH guest type, which
+ * requires hardware virtualization support similar to the
+ * HVM guest type. Add a PVH guest type for each new HVM
+ * guest type.
+ */
+if ((ver_info->xen_version_major > 4 ||
+(ver_info->xen_version_major == 4 &&
+ ver_info->xen_version_minor >= 9)) &&
+hvm && new_arch_added) {
+i = nr_guest_archs;
+/* Ensure we have not exhausted the guest_archs array */
+if (nr_guest_archs >= ARRAY_CARDINALITY(guest_archs))
+continue;
+guest_archs[nr_guest_archs].arch = arch;
+guest_archs[nr_guest_archs].pvh = 1;
+nr_guest_archs++;
+}
 }
 }
 regfree();
 
 for (i = 0; i < nr_guest_archs; ++i) {
 virCapsGuestPtr guest;
-char const *const xen_machines[] = {guest_archs[i].hvm ? "xenfv" : 
"xenpv"};
+char const *const xen_machines[] = {
+guest_archs[i].hvm ? "xenfv" :
+(guest_archs[i].pvh ? "xenpvh" : "xenpv")};
 virCapsGuestMachinePtr *machines;
 
 if ((machines = virCapabilitiesAllocMachines(xen_machines, 1)) == NULL)
@@ -557,7 +582,9 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
1,
0) == NULL)
 return -1;
+}
 
+if (guest_archs[i].hvm || guest_archs[i].pvh) {
 if (virCapabilitiesAddGuestFeature(guest,
"hap",

[libvirt] [PATCH v2 7/8] xenconfig: add support for parsing type= xl config entry

2018-09-18 Thread Marek Marczykowski-Górecki
builder="hvm" is deprecated since Xen 4.10, new syntax is type="hvm" (or
type="pv", which is default). Since the old one is still supported,
still use it when writing native config, so the config will work on
older Xen too (and will also not complicate tests).

Signed-off-by: Marek Marczykowski-Górecki 
---
"type" option is the only syntax for specifying PVH guest, coming in
next patch.

Changes in v2:
 - fix code style
---
 src/xenconfig/xen_common.c| 18 +---
 tests/xlconfigdata/test-fullvirt-type.cfg | 21 +++-
 tests/xlconfigdata/test-fullvirt-type.xml | 27 -
 tests/xlconfigdata/test-paravirt-type.cfg | 13 -
 tests/xlconfigdata/test-paravirt-type.xml | 25 ++-
 tests/xlconfigtest.c  |  2 ++-
 6 files changed, 103 insertions(+), 3 deletions(-)
 create mode 100644 tests/xlconfigdata/test-fullvirt-type.cfg
 create mode 100644 tests/xlconfigdata/test-fullvirt-type.xml
 create mode 100644 tests/xlconfigdata/test-paravirt-type.cfg
 create mode 100644 tests/xlconfigdata/test-paravirt-type.xml

diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index fdca984..4a7625e 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -1088,9 +1088,21 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr 
def, virCapsPtr caps)
 if (xenConfigGetUUID(conf, "uuid", def->uuid) < 0)
 goto out;
 
-if ((xenConfigGetString(conf, "builder", , "linux") == 0) &&
-STREQ(str, "hvm"))
-hvm = 1;
+if (xenConfigGetString(conf, "type", , NULL) == 0 && str) {
+if (STREQ(str, "pv")) {
+hvm = 0;
+} else if (STREQ(str, "hvm")) {
+hvm = 1;
+} else {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _("type %s is not supported"), str);
+return -1;
+}
+} else {
+if ((xenConfigGetString(conf, "builder", , "linux") == 0) &&
+STREQ(str, "hvm"))
+hvm = 1;
+}
 
 def->os.type = (hvm ? VIR_DOMAIN_OSTYPE_HVM : VIR_DOMAIN_OSTYPE_XEN);
 
diff --git a/tests/xlconfigdata/test-fullvirt-type.cfg 
b/tests/xlconfigdata/test-fullvirt-type.cfg
new file mode 100644
index 000..f8ecc2e
--- /dev/null
+++ b/tests/xlconfigdata/test-fullvirt-type.cfg
@@ -0,0 +1,21 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+pae = 1
+acpi = 1
+apic = 1
+viridian = 0
+rtc_timeoffset = 0
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+device_model = "/usr/lib/xen/bin/qemu-system-i386"
+sdl = 0
+vnc = 0
+parallel = "none"
+serial = "none"
+type = "hvm"
+boot = "d"
diff --git a/tests/xlconfigdata/test-fullvirt-type.xml 
b/tests/xlconfigdata/test-fullvirt-type.xml
new file mode 100644
index 000..da8e360
--- /dev/null
+++ b/tests/xlconfigdata/test-fullvirt-type.xml
@@ -0,0 +1,27 @@
+
+  XenGuest2
+  c7a5fdb2-cdaf-9455-926a-d65c16db1809
+  592896
+  403456
+  1
+  
+hvm
+/usr/lib/xen/boot/hvmloader
+
+  
+  
+
+
+
+  
+  
+  destroy
+  restart
+  restart
+  
+/usr/lib/xen/bin/qemu-system-i386
+
+
+
+  
+
diff --git a/tests/xlconfigdata/test-paravirt-type.cfg 
b/tests/xlconfigdata/test-paravirt-type.cfg
new file mode 100644
index 000..078db99
--- /dev/null
+++ b/tests/xlconfigdata/test-paravirt-type.cfg
@@ -0,0 +1,13 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+type = "pv"
+maxmem = 579
+memory = 394
+vcpus = 1
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+kernel = "/tmp/vmlinuz"
+ramdisk = "/tmp/initrd"
+cmdline = "root=/dev/xvda1 console=hvc0"
diff --git a/tests/xlconfigdata/test-paravirt-type.xml 
b/tests/xlconfigdata/test-paravirt-type.xml
new file mode 100644
index 000..4357640
--- /dev/null
+++ b/tests/xlconfigdata/test-paravirt-type.xml
@@ -0,0 +1,25 @@
+
+  XenGuest2
+  c7a5fdb2-cdaf-9455-926a-d65c16db1809
+  592896
+  403456
+  1
+  
+linux
+/tmp/vmlinuz
+/tmp/initrd
+root=/dev/xvda1 console=hvc0
+  
+  
+  destroy
+  restart
+  restart
+  
+
+  
+
+
+
+
+  
+
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index 36f7699..ad6a964 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -281,6 +281,8 @@ mymain(void)
 DO_TEST_FORMAT("paravirt-cmdline-extra-root", false);
 DO_TEST_FORMAT("paravirt-cmdline-bogus-extra-root", false);
 DO_TEST("rbd-multihost-noauth");
+DO_TEST_FORMAT("paravirt-type", false);
+DO_TEST_FORMAT("fullvirt-type", false);
 
 #ifdef LIBXL_HAVE_DEVICE_CHANNEL
 DO_TEST("channel-pty");
-- 
git-series 0.9.1

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

[libvirt] [PATCH v2 4/8] libxl: reorder libxlMakeDomBuildInfo for upcoming PVH support

2018-09-18 Thread Marek Marczykowski-Górecki
Make it easier to share HVM and PVH code where relevant. No functional
change.

Signed-off-by: Marek Marczykowski-Górecki 
---
 src/libxl/libxl_conf.c | 26 ++
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index e2bfa2f..f3da0ed 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -376,18 +376,6 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
 b_info->max_memkb = virDomainDefGetMemoryInitial(def);
 b_info->target_memkb = def->mem.cur_balloon;
 if (hvm) {
-char bootorder[VIR_DOMAIN_BOOT_LAST + 1];
-
-libxl_defbool_set(_info->u.hvm.pae,
-  def->features[VIR_DOMAIN_FEATURE_PAE] ==
-  VIR_TRISTATE_SWITCH_ON);
-libxl_defbool_set(_info->u.hvm.apic,
-  def->features[VIR_DOMAIN_FEATURE_APIC] ==
-  VIR_TRISTATE_SWITCH_ON);
-libxl_defbool_set(_info->u.hvm.acpi,
-  def->features[VIR_DOMAIN_FEATURE_ACPI] ==
-  VIR_TRISTATE_SWITCH_ON);
-
 if (caps &&
 def->cpu && def->cpu->mode == (VIR_CPU_MODE_HOST_PASSTHROUGH)) {
 bool hasHwVirt = false;
@@ -474,6 +462,20 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
  "mode=host-passthrough to avoid risk of changed guest "
  "semantics when mode=custom is supported in the future");
 }
+}
+
+if (hvm) {
+char bootorder[VIR_DOMAIN_BOOT_LAST + 1];
+
+libxl_defbool_set(_info->u.hvm.pae,
+  def->features[VIR_DOMAIN_FEATURE_PAE] ==
+  VIR_TRISTATE_SWITCH_ON);
+libxl_defbool_set(_info->u.hvm.apic,
+  def->features[VIR_DOMAIN_FEATURE_APIC] ==
+  VIR_TRISTATE_SWITCH_ON);
+libxl_defbool_set(_info->u.hvm.acpi,
+  def->features[VIR_DOMAIN_FEATURE_ACPI] ==
+  VIR_TRISTATE_SWITCH_ON);
 
 if (def->nsounds > 0) {
 /*
-- 
git-series 0.9.1

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

[libvirt] [PATCH v2 3/8] libxl: prefer new location of nested_hvm in libxl_domain_build_info

2018-09-18 Thread Marek Marczykowski-Górecki
If available, use b_info->nested_hvm instead of
b_info->u.hvm.nested_hvm. This will make nested HVM config available
also for PVH domains.

Signed-off-by: Marek Marczykowski-Górecki 
Reviewed-by: Jim Fehlig 
---
 src/libxl/libxl_conf.c   | 13 -
 tests/libxlxml2domconfigdata/fullvirt-cpuid.json |  2 +-
 tests/libxlxml2domconfigdata/vnuma-hvm.json  |  2 +-
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 476bcbe..e2bfa2f 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -455,7 +455,18 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
 }
 }
 }
-libxl_defbool_set(_info->u.hvm.nested_hvm, hasHwVirt);
+#ifdef LIBXL_HAVE_BUILDINFO_NESTED_HVM
+libxl_defbool_set(_info->nested_hvm, hasHwVirt);
+#else
+if (hvm) {
+libxl_defbool_set(_info->u.hvm.nested_hvm, hasHwVirt);
+} else {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+_("unsupported nested HVM setting for %s machine on 
this Xen version"),
+def->os.machine);
+return -1;
+}
+#endif
 }
 
 if (def->cpu && def->cpu->mode == VIR_CPU_MODE_CUSTOM) {
diff --git a/tests/libxlxml2domconfigdata/fullvirt-cpuid.json 
b/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
index cdc8b98..d46b464 100644
--- a/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
+++ b/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
@@ -21,11 +21,11 @@
 ],
 "sched_params": {
 },
+"nested_hvm": "False",
 "type.hvm": {
 "pae": "True",
 "apic": "True",
 "acpi": "True",
-"nested_hvm": "False",
 "nographic": "True",
 "vnc": {
 "enable": "False"
diff --git a/tests/libxlxml2domconfigdata/vnuma-hvm.json 
b/tests/libxlxml2domconfigdata/vnuma-hvm.json
index 3b2fc5f..02c10a9 100644
--- a/tests/libxlxml2domconfigdata/vnuma-hvm.json
+++ b/tests/libxlxml2domconfigdata/vnuma-hvm.json
@@ -109,11 +109,11 @@
 "sched_params": {
 
 },
+"nested_hvm": "True",
 "type.hvm": {
 "pae": "True",
 "apic": "True",
 "acpi": "True",
-"nested_hvm": "True",
 "vga": {
 "kind": "cirrus"
 },
-- 
git-series 0.9.1

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

[libvirt] [PATCH v2 0/8] libxl: PVHv2 support

2018-09-18 Thread Marek Marczykowski-Górecki
This is a respin of my old PVHv1 patch[1], converted to PVHv2.
Should the code use "PVH" name (as libxl does internally), or "PVHv2" as in
many places in Xen documentation? I've chosen the former, but want to confirm
it.

Also, not sure about VIR_DOMAIN_OSTYPE_XENPVH (as discussed on PVHv1 patch) -
while it will be messy in many cases, there is
libxl_domain_build_info.u.{hvm,pv,pvh} which would be good to not mess up.
Also, PVHv2 needs different kernel features than PV (CONFIG_XEN_PVH vs
CONFIG_XEN_PV), so keeping the same VIR_DOMAIN_OSTYPE_XEN could be
confusing.
On the other hand, libxl_domain_build_info.u.pv is used in very few places (one
section of libxlMakeDomBuildInfo), so guarding u.hvm access with
VIR_DOMAIN_OSTYPE_HVM may be enough.
For now I've reused VIR_DOMAIN_OSTYPE_XEN - in the driver itself, most of
the code is the same as for PV.

Since PVHv2 relies on features in newer Xen versions, I needed to convert also
some older code. For example b_info->u.hvm.nested_hvm was deprecated in favor
of b_info->nested_hvm. While the code do handle both old and new versions
(obviously refusing PVHv2 if Xen is too old), this isn't the case for tests.
How it should be handled, if at all?

First few preparatory patches can be applied independently.

[1] https://www.redhat.com/archives/libvir-list/2016-August/msg00376.html

Changes in v2:
 - drop "docs: don't refer to deprecated 'linux' ostype in example" patch -
   migrating further away from "linux" os type is offtopic to this series and
   apparently is a controversial thing
 - drop "docs: update domain schema for machine attribute" patch -
   already applied
 - apply review comments from Jim
 - rebase on master

Marek Marczykowski-Górecki (8):
  docs: add documentation of arch element of capabilities.xml
  libxl: set shadow memory for any guest type, not only HVM
  libxl: prefer new location of nested_hvm in libxl_domain_build_info
  libxl: reorder libxlMakeDomBuildInfo for upcoming PVH support
  libxl: add support for PVH
  tests: add basic Xen PVH test
  xenconfig: add support for parsing type= xl config entry
  xenconfig: add support for type="pvh"

 docs/formatcaps.html.in  | 22 -
 docs/formatdomain.html.in| 11 +-
 docs/schemas/domaincommon.rng|  1 +-
 src/libxl/libxl_capabilities.c   | 33 ++-
 src/libxl/libxl_conf.c   | 81 -
 src/libxl/libxl_driver.c |  6 +-
 src/xenconfig/xen_common.c   | 27 +-
 src/xenconfig/xen_xl.c   |  5 +-
 tests/libxlxml2domconfigdata/basic-pv.json   |  1 +-
 tests/libxlxml2domconfigdata/basic-pvh.json  | 49 ++-
 tests/libxlxml2domconfigdata/basic-pvh.xml   | 28 ++-
 tests/libxlxml2domconfigdata/fullvirt-cpuid.json |  2 +-
 tests/libxlxml2domconfigdata/multiple-ip.json|  1 +-
 tests/libxlxml2domconfigdata/vnuma-hvm.json  |  2 +-
 tests/libxlxml2domconfigtest.c   |  1 +-
 tests/testutilsxen.c |  3 +-
 tests/xlconfigdata/test-fullvirt-type.cfg| 21 -
 tests/xlconfigdata/test-fullvirt-type.xml| 27 ++-
 tests/xlconfigdata/test-paravirt-type.cfg| 13 +++-
 tests/xlconfigdata/test-paravirt-type.xml| 25 +-
 tests/xlconfigdata/test-pvh-type.cfg | 13 +++-
 tests/xlconfigdata/test-pvh-type.xml | 25 +-
 tests/xlconfigtest.c |  3 +-
 23 files changed, 359 insertions(+), 41 deletions(-)
 create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.json
 create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.xml
 create mode 100644 tests/xlconfigdata/test-fullvirt-type.cfg
 create mode 100644 tests/xlconfigdata/test-fullvirt-type.xml
 create mode 100644 tests/xlconfigdata/test-paravirt-type.cfg
 create mode 100644 tests/xlconfigdata/test-paravirt-type.xml
 create mode 100644 tests/xlconfigdata/test-pvh-type.cfg
 create mode 100644 tests/xlconfigdata/test-pvh-type.xml

base-commit: 16858439deaec0832de61c5ddb93d8e80adccf6c
-- 
git-series 0.9.1

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

[libvirt] [PATCH v2 6/8] tests: add basic Xen PVH test

2018-09-18 Thread Marek Marczykowski-Górecki
Signed-off-by: Marek Marczykowski-Górecki 
---
 tests/libxlxml2domconfigdata/basic-pvh.json | 49 ++-
 tests/libxlxml2domconfigdata/basic-pvh.xml  | 28 +-
 tests/libxlxml2domconfigtest.c  |  1 +-
 3 files changed, 78 insertions(+)
 create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.json
 create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.xml

diff --git a/tests/libxlxml2domconfigdata/basic-pvh.json 
b/tests/libxlxml2domconfigdata/basic-pvh.json
new file mode 100644
index 000..48365c9
--- /dev/null
+++ b/tests/libxlxml2domconfigdata/basic-pvh.json
@@ -0,0 +1,49 @@
+{
+"c_info": {
+"type": "pvh",
+"name": "test-pvh",
+"uuid": "039e9ee6-4a84-3055-4c81-8ba426ae2656"
+},
+"b_info": {
+"max_vcpus": 4,
+"avail_vcpus": [
+0,
+1,
+2,
+3
+],
+"max_memkb": 524288,
+"target_memkb": 524288,
+"shadow_memkb": 8192,
+"sched_params": {
+
+},
+"kernel": "/boot/vmlinuz",
+"ramdisk": "/boot/initrd.img",
+"type.pvh": {
+},
+"arch_arm": {
+
+}
+},
+"disks": [
+{
+"pdev_path": "/var/lib/xen/images/test-pv.img",
+"vdev": "xvda",
+"backend": "qdisk",
+"format": "raw",
+"removable": 1,
+"readwrite": 1
+}
+],
+"nics": [
+{
+"devid": 0,
+"mac": "00:16:3e:3e:86:60",
+"bridge": "br0",
+"script": "/etc/xen/scripts/vif-bridge",
+"nictype": "vif"
+}
+],
+"on_reboot": "restart"
+}
diff --git a/tests/libxlxml2domconfigdata/basic-pvh.xml 
b/tests/libxlxml2domconfigdata/basic-pvh.xml
new file mode 100644
index 000..7576596
--- /dev/null
+++ b/tests/libxlxml2domconfigdata/basic-pvh.xml
@@ -0,0 +1,28 @@
+
+  test-pvh
+  039e9ee6-4a84-3055-4c81-8ba426ae2656
+  524288
+  524288
+  4
+  
+linux
+/boot/vmlinuz
+/boot/initrd.img
+  
+  
+  destroy
+  restart
+  destroy
+  
+
+  
+  
+  
+
+
+  
+  
+  
+
+  
+
diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
index b814461..7ee1063 100644
--- a/tests/libxlxml2domconfigtest.c
+++ b/tests/libxlxml2domconfigtest.c
@@ -207,6 +207,7 @@ mymain(void)
 
 DO_TEST("basic-pv");
 DO_TEST("basic-hvm");
+DO_TEST("basic-pvh");
 DO_TEST("cpu-shares-hvm");
 DO_TEST("variable-clock-hvm");
 DO_TEST("moredevs-hvm");
-- 
git-series 0.9.1

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

[libvirt] [PATCH v2 2/8] libxl: set shadow memory for any guest type, not only HVM

2018-09-18 Thread Marek Marczykowski-Górecki
Otherwise starting PVH guest will result in "arch_setup_bootlate:
mapping shared_info failed (pfn=..., rc=-1, errno: 12): Internal error".

After this change the behavior is the same as in `xl`.

Signed-off-by: Marek Marczykowski-Górecki 
Reviewed-by: Jim Fehlig 
---
 src/libxl/libxl_conf.c| 10 +-
 tests/libxlxml2domconfigdata/basic-pv.json|  1 +
 tests/libxlxml2domconfigdata/multiple-ip.json |  1 +
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 998029d..476bcbe 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -634,11 +634,6 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
 return -1;
 }
 #endif
-
-/* Allow libxl to calculate shadow memory requirements */
-b_info->shadow_memkb =
-libxl_get_required_shadow_memory(b_info->max_memkb,
- b_info->max_vcpus);
 } else {
 /*
  * For compatibility with the legacy xen toolstack, default to pygrub
@@ -692,6 +687,11 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
 }
 }
 
+/* Allow libxl to calculate shadow memory requirements */
+b_info->shadow_memkb =
+libxl_get_required_shadow_memory(b_info->max_memkb,
+ b_info->max_vcpus);
+
 return 0;
 }
 
diff --git a/tests/libxlxml2domconfigdata/basic-pv.json 
b/tests/libxlxml2domconfigdata/basic-pv.json
index 0f846da..b71c3b0 100644
--- a/tests/libxlxml2domconfigdata/basic-pv.json
+++ b/tests/libxlxml2domconfigdata/basic-pv.json
@@ -14,6 +14,7 @@
 ],
 "max_memkb": 524288,
 "target_memkb": 524288,
+"shadow_memkb": 8192,
 "sched_params": {
 
 },
diff --git a/tests/libxlxml2domconfigdata/multiple-ip.json 
b/tests/libxlxml2domconfigdata/multiple-ip.json
index 80dca82..2db98b8 100644
--- a/tests/libxlxml2domconfigdata/multiple-ip.json
+++ b/tests/libxlxml2domconfigdata/multiple-ip.json
@@ -14,6 +14,7 @@
 ],
 "max_memkb": 524288,
 "target_memkb": 524288,
+"shadow_memkb": 8192,
 "sched_params": {
 
 },
-- 
git-series 0.9.1

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

[libvirt] [PATCH v2 1/8] docs: add documentation of arch element of capabilities.xml

2018-09-18 Thread Marek Marczykowski-Górecki
Specifically, list sub-elements and where they can be used. In addition,
describe supported machine types for Xen.

Signed-off-by: Marek Marczykowski-Górecki 

---
Changes in v2:
 - clarify type@domain description, add a link to domain xml there
---
 docs/formatcaps.html.in   | 22 +-
 docs/formatdomain.html.in | 11 ++-
 2 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/docs/formatcaps.html.in b/docs/formatcaps.html.in
index 41a9a3a..0d9c53d 100644
--- a/docs/formatcaps.html.in
+++ b/docs/formatcaps.html.in
@@ -91,7 +91,27 @@
 
 
 arch
-This element brings some information on supported guest 
architecture.
+This element brings some information on supported guest
+  architecture. Possible subelements are:
+  
+wordsizeSize of CPU word in bits, for 
example 64.
+emulatorEmulator (device model) path, for
+  use in emulator
+  element of domain XML.
+loaderLoader path, for use in
+  loader element of 
domain
+  XML.
+machineMachine type, for use in
+  machine
+  attribute of os/type element in domain XML. For example Xen
+  supports xenfv for HVM or xenpv for
+  PV.
+domainThe type attribute of
+  this element specifies the type of hypervisor required to run the
+  domain. Use in type
+  attribute of the domain root element.
+  
+
 
 features
 This optional element encases possible features that can be used
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 1f12ab5..8189959 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -19,7 +19,8 @@
 
   The root element required for all virtual machines is
   named domain. It has two attributes, the
-  type specifies the hypervisor used for running
+  type
+  specifies the hypervisor used for running
   the domain. The allowed values are driver specific, but
   include "xen", "kvm", "qemu", "lxc" and "kqemu". The
   second attribute is id which is a unique
@@ -148,11 +149,11 @@
 (badly named!) refers to an OS that supports the Xen 3 hypervisor
 guest ABI. There are also two optional attributes, arch
 specifying the CPU architecture to virtualization,
-and machine referring to the machine
-type. The Capabilities XML
+and machine referring
+to the machine type. The Capabilities XML
 provides details on allowed values for
 these. Since 0.0.1
-  loader
+  loader
   The optional loader tag refers to a firmware blob,
 which is specified by absolute path,
 used to assist the domain creation process. It is used by Xen
@@ -2621,7 +2622,7 @@
 ...
 
 
-  emulator
+  emulator
   
 The contents of the emulator element specify
 the fully qualified path to the device model emulator binary.
-- 
git-series 0.9.1

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

[libvirt] [PATCH v2 8/8] xenconfig: add support for type="pvh"

2018-09-18 Thread Marek Marczykowski-Górecki
Handle PVH domain type in both directions (xen-xl->xml, xml->xen-xl).
And add a test for it.

Signed-off-by: Marek Marczykowski-Górecki 
---
 src/xenconfig/xen_common.c   | 11 +--
 src/xenconfig/xen_xl.c   |  5 +
 tests/testutilsxen.c |  3 ++-
 tests/xlconfigdata/test-pvh-type.cfg | 13 +
 tests/xlconfigdata/test-pvh-type.xml | 25 +
 tests/xlconfigtest.c |  1 +
 6 files changed, 55 insertions(+), 3 deletions(-)
 create mode 100644 tests/xlconfigdata/test-pvh-type.cfg
 create mode 100644 tests/xlconfigdata/test-pvh-type.xml

diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index 4a7625e..3c120a0 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -1081,6 +1081,7 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr def, 
virCapsPtr caps)
 virCapsDomainDataPtr capsdata = NULL;
 const char *str;
 int hvm = 0, ret = -1;
+const char *machine = "xenpv";
 
 if (xenConfigCopyString(conf, "name", >name) < 0)
 goto out;
@@ -1091,8 +1092,12 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr 
def, virCapsPtr caps)
 if (xenConfigGetString(conf, "type", , NULL) == 0 && str) {
 if (STREQ(str, "pv")) {
 hvm = 0;
+} else if (STREQ(str, "pvh")) {
+hvm = 0;
+machine = "xenpvh";
 } else if (STREQ(str, "hvm")) {
 hvm = 1;
+machine = "xenfv";
 } else {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("type %s is not supported"), str);
@@ -1100,14 +1105,16 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr 
def, virCapsPtr caps)
 }
 } else {
 if ((xenConfigGetString(conf, "builder", , "linux") == 0) &&
-STREQ(str, "hvm"))
+STREQ(str, "hvm")) {
 hvm = 1;
+machine = "xenfv";
+}
 }
 
 def->os.type = (hvm ? VIR_DOMAIN_OSTYPE_HVM : VIR_DOMAIN_OSTYPE_XEN);
 
 if (!(capsdata = virCapabilitiesDomainDataLookup(caps, def->os.type,
-VIR_ARCH_NONE, def->virtType, NULL, NULL)))
+VIR_ARCH_NONE, def->virtType, NULL, machine)))
 goto out;
 
 def->os.arch = capsdata->arch;
diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index 19b6604..f1853bd 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -1285,6 +1285,11 @@ xenFormatXLOS(virConfPtr conf, virDomainDefPtr def)
 
 /* XXX floppy disks */
 } else {
+if (STREQ(def->os.machine, "xenpvh")) {
+if (xenConfigSetString(conf, "type", "pvh") < 0)
+return -1;
+}
+
 if (def->os.bootloader &&
  xenConfigSetString(conf, "bootloader", def->os.bootloader) < 0)
 return -1;
diff --git a/tests/testutilsxen.c b/tests/testutilsxen.c
index c08ec4a..04f8920 100644
--- a/tests/testutilsxen.c
+++ b/tests/testutilsxen.c
@@ -18,7 +18,8 @@ testXLInitCaps(void)
 "xenfv"
 };
 static const char *const xen_machines[] = {
-"xenpv"
+"xenpv",
+"xenpvh"
 };
 
 if ((caps = virCapabilitiesNew(virArchFromHost(),
diff --git a/tests/xlconfigdata/test-pvh-type.cfg 
b/tests/xlconfigdata/test-pvh-type.cfg
new file mode 100644
index 000..2493535
--- /dev/null
+++ b/tests/xlconfigdata/test-pvh-type.cfg
@@ -0,0 +1,13 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+type = "pvh"
+kernel = "/tmp/vmlinuz"
+ramdisk = "/tmp/initrd"
+cmdline = "root=/dev/xvda1 console=hvc0"
diff --git a/tests/xlconfigdata/test-pvh-type.xml 
b/tests/xlconfigdata/test-pvh-type.xml
new file mode 100644
index 000..96b0e7a
--- /dev/null
+++ b/tests/xlconfigdata/test-pvh-type.xml
@@ -0,0 +1,25 @@
+
+  XenGuest2
+  c7a5fdb2-cdaf-9455-926a-d65c16db1809
+  592896
+  403456
+  1
+  
+linux
+/tmp/vmlinuz
+/tmp/initrd
+root=/dev/xvda1 console=hvc0
+  
+  
+  destroy
+  restart
+  restart
+  
+
+  
+
+
+
+
+  
+
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index ad6a964..b9cf939 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -283,6 +283,7 @@ mymain(void)
 DO_TEST("rbd-multihost-noauth");
 DO_TEST_FORMAT("paravirt-type", false);
 DO_TEST_FORMAT("fullvirt-type", false);
+DO_TEST("pvh-type");
 
 #ifdef LIBXL_HAVE_DEVICE_CHANNEL
 DO_TEST("channel-pty");
-- 
git-series 0.9.1

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

Re: [libvirt] [PATCH 10/10] xenconfig: add support for type="pvh"

2018-09-14 Thread Marek Marczykowski-Górecki
On Fri, Sep 14, 2018 at 05:21:17PM -0600, Jim Fehlig wrote:
> On 8/5/18 3:48 PM, Marek Marczykowski-Górecki wrote:
> > Handle PVH domain type in both directions (xen-xl->xml, xml->xen-xl).
> > And add a test for it.
> > 
> > Signed-off-by: Marek Marczykowski-Górecki 
> > ---
> > Does domain_conf.c (virDomainDefFormatInternal) still need to silently
> > convert VIR_DOMAIN_OSTYPE_XEN to VIR_DOMAIN_OSTYPE_LINUX? In case of
> > PVH, VIR_DOMAIN_OSTYPE_LINUX was never reported as a valid option...
> 
> I'd prefer that we switch to formatting type as VIR_DOMAIN_OSTYPE_XEN

See discussion on patch 1/10...

> and
> indicating PV vs PVH with the machine attribute.

It's already here. 

> For back compat we'd need
> to continue accepting linux when parsing XML. Other than a lot
> of changes to test suite data files, am I overlooking compatibility problems
> with such a change?

Still accepting linux obviously must stay. But if we change
what is reported when formatting XML, it may cause:
 - unexpected configuration change, confusing to the user (no manual
   change, but XML is different)
 - that XML may not load on very old libvirt versions (I can't find
   exactly which one, but older than 0.7.2, which was almost 10 years
   ago)

Personally I don't think either of this is a problem.

> 
> > ---
> >   src/xenconfig/xen_common.c   | 17 -
> >   src/xenconfig/xen_xl.c   |  5 +
> >   tests/testutilsxen.c |  3 ++-
> >   tests/xlconfigdata/test-pvh-type.cfg | 13 +
> >   tests/xlconfigdata/test-pvh-type.xml | 25 +
> >   tests/xlconfigtest.c |  1 +
> >   6 files changed, 58 insertions(+), 6 deletions(-)
> >   create mode 100644 tests/xlconfigdata/test-pvh-type.cfg
> >   create mode 100644 tests/xlconfigdata/test-pvh-type.xml
> > 
> > diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
> > index c5d81d1..3c120a0 100644
> > --- a/src/xenconfig/xen_common.c
> > +++ b/src/xenconfig/xen_common.c
> > @@ -1081,6 +1081,7 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr 
> > def, virCapsPtr caps)
> >   virCapsDomainDataPtr capsdata = NULL;
> >   const char *str;
> >   int hvm = 0, ret = -1;
> > +const char *machine = "xenpv";
> >   if (xenConfigCopyString(conf, "name", >name) < 0)
> >   goto out;
> > @@ -1089,25 +1090,31 @@ xenParseGeneralMeta(virConfPtr conf, 
> > virDomainDefPtr def, virCapsPtr caps)
> >   goto out;
> >   if (xenConfigGetString(conf, "type", , NULL) == 0 && str) {
> > -if (STREQ(str, "pv"))
> > +if (STREQ(str, "pv")) {
> >   hvm = 0;
> > -else if (STREQ(str, "hvm"))
> > +} else if (STREQ(str, "pvh")) {
> > +hvm = 0;
> > +machine = "xenpvh";
> > +} else if (STREQ(str, "hvm")) {
> >   hvm = 1;
> > -else {
> > +machine = "xenfv";
> > +} else {
> >   virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> >  _("type %s is not supported"), str);
> >   return -1;
> >   }
> 
> Ah, I see you fixed up the braces in this patch. Regardless, 'make
> syntax-check' should pass with each patch.
> 
> Reviewed-by: Jim Fehlig 
> 
> Regards,
> Jim
> 
> >   } else {
> >   if ((xenConfigGetString(conf, "builder", , "linux") == 0) &&
> > -STREQ(str, "hvm"))
> > +STREQ(str, "hvm")) {
> >   hvm = 1;
> > +machine = "xenfv";
> > +}
> >   }
> >   def->os.type = (hvm ? VIR_DOMAIN_OSTYPE_HVM : VIR_DOMAIN_OSTYPE_XEN);
> >   if (!(capsdata = virCapabilitiesDomainDataLookup(caps, def->os.type,
> > -VIR_ARCH_NONE, def->virtType, NULL, NULL)))
> > +VIR_ARCH_NONE, def->virtType, NULL, machine)))
> >   goto out;
> >   def->os.arch = capsdata->arch;
> > diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
> > index 19b6604..f1853bd 100644
> > --- a/src/xenconfig/xen_xl.c
> > +++ b/src/xenconfig/xen_xl.c
> > @@ -1285,6 +1285,11 @@ xenFormatXLOS(virConfPtr conf, virDomainDefPtr def)
> >   /* XXX floppy disks */
> >   } else {
> > +if (STREQ(def->os.machine, "xenpvh")) {
>

Re: [libvirt] [PATCH 07/10] libxl: add support for PVH

2018-09-10 Thread Marek Marczykowski-Górecki
On Mon, Sep 10, 2018 at 04:45:50PM -0600, Jim Fehlig wrote:
> On 09/10/2018 04:02 PM, Marek Marczykowski-Górecki wrote:
> > On Mon, Sep 10, 2018 at 03:44:33PM -0600, Jim Fehlig wrote:
> > > On 08/05/2018 03:48 PM, Marek Marczykowski-Górecki wrote:
> > > > Since this is something between PV and HVM, it makes sense to put the
> > > > setting in place where domain type is specified.
> > > > To enable it, use  It is
> > > > also included in capabilities.xml, for every supported HVM guest type - 
> > > > it
> > > > doesn't seems to be any other requirement (besides new enough Xen).
> > > > 
> > > > Signed-off-by: Marek Marczykowski-Górecki 
> > > > 
> > > > ---
> > > >docs/formatcaps.html.in|  4 +--
> > > >docs/schemas/domaincommon.rng  |  1 +-
> > > >src/libxl/libxl_capabilities.c | 23 ++--
> > > >src/libxl/libxl_conf.c | 41 
> > > > ++-
> > > >src/libxl/libxl_driver.c   |  6 +++--
> > > >5 files changed, 64 insertions(+), 11 deletions(-)
> > > > 
> > > > diff --git a/docs/formatcaps.html.in b/docs/formatcaps.html.in
> > > > index 34a74a9..1f17aa9 100644
> > > > --- a/docs/formatcaps.html.in
> > > > +++ b/docs/formatcaps.html.in
> > > > @@ -104,8 +104,8 @@
> > > >machineMachine type, for use in
> > > >   > > > href="formatdomain.html#attributeOSTypeMachine">machine
> > > >  attribute of os/type element in domain XML. For 
> > > > example Xen
> > > > -  supports xenfv for HVM or 
> > > > xenpv for
> > > > -  PV.
> > > > +  supports xenfv for HVM, xenpv 
> > > > for
> > > > +  PV, or xenpvh for PVHv2.
> > > >domainSupported domain type, 
> > > > named by the
> > > >  type attribute.
> > > >  
> > > > diff --git a/docs/schemas/domaincommon.rng 
> > > > b/docs/schemas/domaincommon.rng
> > > > index eded1ca..d32b0cb 100644
> > > > --- a/docs/schemas/domaincommon.rng
> > > > +++ b/docs/schemas/domaincommon.rng
> > > > @@ -341,6 +341,7 @@
> > > >  
> > > >xenpv
> > > >xenfv
> > > > +xenpvh
> > > >  
> > > >
> > > >  
> > > > diff --git a/src/libxl/libxl_capabilities.c 
> > > > b/src/libxl/libxl_capabilities.c
> > > > index 18596c7..e7b26f1 100644
> > > > --- a/src/libxl/libxl_capabilities.c
> > > > +++ b/src/libxl/libxl_capabilities.c
> > > > @@ -57,6 +57,7 @@ struct guest_arch {
> > > >virArch arch;
> > > >int bits;
> > > >int hvm;
> > > > +int pvh;
> > > >int pae;
> > > >int nonpae;
> > > >int ia64_be;
> > > > @@ -491,13 +492,29 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr 
> > > > caps)
> > > >guest_archs[i].nonpae = nonpae;
> > > >if (ia64_be)
> > > >guest_archs[i].ia64_be = ia64_be;
> > > > +
> > > > +/* On Xen >= 4.9 add PVH for each HVM guest, and do it 
> > > > only once */
> > > 
> > > I'm having problems understanding this. Do you mean add a PVH for each
> > > supported HVM arch, but exclude PAE? E.g. standard xen_caps on x86_64
> > > contains
> > > 
> > > xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p 
> > > hvm-3.0-x86_64
> > > 
> > > Given these caps, should a PVH be added that corresponds to the
> > > hvm-3.0-x86_32 cap and another for the hvm-3.0-x86_64 cap, but the
> > > hvm-3.0-x86_32p cap excluded?
> > 
> > Yes, exactly. Setting PAE (or not) is possible only for HVM, but not
> > PVH.
> > 
> > It would be much better if Xen would report support for PVH
> > explicitly...
> > 
> > > > +if ((ver_info->xen_version_major > 4 ||
> > > > +(ver_info->xen_version_major == 4 &&
> > > > + ver_info->xen_version_minor >

Re: [libvirt] [PATCH V2 1/2] libxl: drop support for Xen < 4.6

2018-09-10 Thread Marek Marczykowski-Górecki
On Mon, Sep 10, 2018 at 05:13:00PM -0600, Jim Fehlig wrote:
> Currently the libxl driver claims support for Xen >= 4.4, but
> Xen 4.4 and 4.5 are no longer supported upstream. Let's increase
> the minimum supported version to 4.6.
> 
> Since Xen 4.6 contains a pkgconfig file, drop the now unused code
> that falls back to using LIBVIRT_CHECK_LIB in the absence of
> pkgconfig file.
> 
> Signed-off-by: Jim Fehlig 
> ---
>  docs/drvxen.html.in |  2 +-
>  m4/virt-driver-libxl.m4 | 22 +-
>  2 files changed, 2 insertions(+), 22 deletions(-)
> 
> diff --git a/docs/drvxen.html.in b/docs/drvxen.html.in
> index 2e45e09527..ff67291ec6 100644
> --- a/docs/drvxen.html.in
> +++ b/docs/drvxen.html.in
> @@ -8,7 +8,7 @@
>  
>  
>The libvirt libxl driver provides the ability to manage virtual
> -  machines on any Xen release from 4.4.0 onwards.
> +  machines on any Xen release from 4.6.0 onwards.
>  
>  
>  Project Links
> diff --git a/m4/virt-driver-libxl.m4 b/m4/virt-driver-libxl.m4
> index 90338eb306..fa51afd2f8 100644
> --- a/m4/virt-driver-libxl.m4
> +++ b/m4/virt-driver-libxl.m4
> @@ -29,33 +29,13 @@ AC_DEFUN([LIBVIRT_DRIVER_CHECK_LIBXL], [
>LIBXL_API_VERSION="-DLIBXL_API_VERSION=0x040400"

I think it's also time to bump this to 0x040500 (the one used in Xen >=
4.6).

>  
>dnl search for libxl, aka libxenlight
> -  dnl Xen > 4.5 introduced a pkgconfig file, check for it first
>old_with_libxl="$with_libxl"
> -  LIBVIRT_CHECK_PKG([LIBXL], [xenlight], [4.4.0], [true])
> +  LIBVIRT_CHECK_PKG([LIBXL], [xenlight], [4.6.0], [true])
>if test "x$with_libxl" = "xyes" ; then
>  LIBXL_FIRMWARE_DIR=$($PKG_CONFIG --variable xenfirmwaredir xenlight)
>  LIBXL_EXECBIN_DIR=$($PKG_CONFIG --variable libexec_bin xenlight)
>fi
>  
> -  dnl pkgconfig file not found, fallback to lib probe
> -  if test "x$with_libxl" = "xno" ; then
> -with_libxl="$old_with_libxl"
> -
> -dnl LIBXL_API_VERSION 4.4.0 introduced a new parameter to
> -dnl libxl_domain_create_restore for specifying restore parameters.
> -dnl The libxl driver will make use of this new parameter for specifying
> -dnl the Xen migration stream version. Specify LIBXL_API_VERSION to 
> trigger
> -dnl an error if there is too old xenlight
> -libxlold_CFLAGS="$CFLAGS"
> -CFLAGS="$CFLAGS $LIBXL_API_VERSION"
> -LIBVIRT_CHECK_LIB([LIBXL], [xenlight], [libxl_ctx_alloc], [libxl.h], 
> [fail="1"])
> -CFLAGS="$libxlold_CFLAGS"
> -
> -if test $fail = 1; then
> -  AC_MSG_ERROR([You must install the libxl Library from Xen >= 4.4 to 
> compile libxenlight driver with -lxl])
> -fi
> -  fi
> -
>if test "$with_libxl" = "yes"; then
>  old_LIBS="$LIBS"
>  old_CFLAGS="$CFLAGS"

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


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

Re: [libvirt] [PATCH 07/10] libxl: add support for PVH

2018-09-10 Thread Marek Marczykowski-Górecki
On Mon, Sep 10, 2018 at 03:44:33PM -0600, Jim Fehlig wrote:
> On 08/05/2018 03:48 PM, Marek Marczykowski-Górecki wrote:
> > Since this is something between PV and HVM, it makes sense to put the
> > setting in place where domain type is specified.
> > To enable it, use  It is
> > also included in capabilities.xml, for every supported HVM guest type - it
> > doesn't seems to be any other requirement (besides new enough Xen).
> > 
> > Signed-off-by: Marek Marczykowski-Górecki 
> > ---
> >   docs/formatcaps.html.in|  4 +--
> >   docs/schemas/domaincommon.rng  |  1 +-
> >   src/libxl/libxl_capabilities.c | 23 ++--
> >   src/libxl/libxl_conf.c | 41 ++-
> >   src/libxl/libxl_driver.c   |  6 +++--
> >   5 files changed, 64 insertions(+), 11 deletions(-)
> > 
> > diff --git a/docs/formatcaps.html.in b/docs/formatcaps.html.in
> > index 34a74a9..1f17aa9 100644
> > --- a/docs/formatcaps.html.in
> > +++ b/docs/formatcaps.html.in
> > @@ -104,8 +104,8 @@
> >   machineMachine type, for use in
> >  > href="formatdomain.html#attributeOSTypeMachine">machine
> > attribute of os/type element in domain XML. For example Xen
> > -  supports xenfv for HVM or xenpv for
> > -  PV.
> > +  supports xenfv for HVM, xenpv for
> > +  PV, or xenpvh for PVHv2.
> >   domainSupported domain type, named 
> > by the
> > type attribute.
> > 
> > diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> > index eded1ca..d32b0cb 100644
> > --- a/docs/schemas/domaincommon.rng
> > +++ b/docs/schemas/domaincommon.rng
> > @@ -341,6 +341,7 @@
> > 
> >   xenpv
> >   xenfv
> > +xenpvh
> > 
> >   
> > 
> > diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
> > index 18596c7..e7b26f1 100644
> > --- a/src/libxl/libxl_capabilities.c
> > +++ b/src/libxl/libxl_capabilities.c
> > @@ -57,6 +57,7 @@ struct guest_arch {
> >   virArch arch;
> >   int bits;
> >   int hvm;
> > +int pvh;
> >   int pae;
> >   int nonpae;
> >   int ia64_be;
> > @@ -491,13 +492,29 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
> >   guest_archs[i].nonpae = nonpae;
> >   if (ia64_be)
> >   guest_archs[i].ia64_be = ia64_be;
> > +
> > +/* On Xen >= 4.9 add PVH for each HVM guest, and do it only 
> > once */
> 
> I'm having problems understanding this. Do you mean add a PVH for each
> supported HVM arch, but exclude PAE? E.g. standard xen_caps on x86_64
> contains
> 
> xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
> 
> Given these caps, should a PVH be added that corresponds to the
> hvm-3.0-x86_32 cap and another for the hvm-3.0-x86_64 cap, but the
> hvm-3.0-x86_32p cap excluded?

Yes, exactly. Setting PAE (or not) is possible only for HVM, but not
PVH.

It would be much better if Xen would report support for PVH
explicitly...

> > +if ((ver_info->xen_version_major > 4 ||
> > +(ver_info->xen_version_major == 4 &&
> > + ver_info->xen_version_minor >= 9)) &&
> > +hvm && i == nr_guest_archs-1) {
> > +i = nr_guest_archs;
> > +/* Too many arch flavours - highly unlikely ! */
> > +if (i >= ARRAY_CARDINALITY(guest_archs))
> > +continue;
> > +nr_guest_archs++;
> > +guest_archs[i].arch = arch;
> > +guest_archs[i].pvh = 1;
> > +}
> 
> Without answers to the above questions, I can't really comment on this code.
> Regardless, since PVH is not advertised in xen_caps shouldn't it be added to
> guest_archs outside of the loop parsing xen_caps?

This works on assumption that if you have HVM and new enough Xen, then
you have PVH. Just having new Xen isn't enough - for example the
hardware may lack VT-x.

> >   }
> >   }
> >   regfree();
> >   for (i = 0; i < nr_guest_archs; ++i) {
> >   virCapsGuestPtr guest;
> > -char const *const xen_machines[] = {guest_archs[i].hvm ? "xenfv" : 
> > "xenp

Re: [libvirt] [PATCH v3 2/3] libxl: implement virDomainPM* functions

2018-09-10 Thread Marek Marczykowski-Górecki
On Mon, Sep 10, 2018 at 10:06:09AM -0600, Jim Fehlig wrote:
> On 09/07/2018 01:29 PM, Marek Marczykowski-Górecki wrote:
> > Signed-off-by: Marek Marczykowski-Górecki 
> > ---
> > Changes in v2:
> >   - use virDomainObjEndAPI
> >   - drop duplicated error reporting on virDomainObjIsActive
> >   - bump version comment to 4.8.0
> > 
> > Changes in v3:
> >   - fix virDomainObjIsActive -> virDomainObjCheckActive
> >   - reuse duration not supported message from qemu
> >   - fix indentation
> >   - destroy the domain if death event re-enabling fails
> > ---
> >   src/libxl/libxl_driver.c | 127 -
> >   1 file changed, 127 insertions(+)
> 
> Reviewed-by: Jim Fehlig 
> 
> I've pushed the series.

Thanks.

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


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

[libvirt] [PATCH v3 2/3] libxl: implement virDomainPM* functions

2018-09-07 Thread Marek Marczykowski-Górecki
Signed-off-by: Marek Marczykowski-Górecki 
---
Changes in v2:
 - use virDomainObjEndAPI
 - drop duplicated error reporting on virDomainObjIsActive
 - bump version comment to 4.8.0

Changes in v3:
 - fix virDomainObjIsActive -> virDomainObjCheckActive
 - reuse duration not supported message from qemu
 - fix indentation
 - destroy the domain if death event re-enabling fails
---
 src/libxl/libxl_driver.c | 127 -
 1 file changed, 127 insertions(+)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 5a5e792..58f9f1f 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1403,6 +1403,129 @@ libxlDomainDestroy(virDomainPtr dom)
 return libxlDomainDestroyFlags(dom, 0);
 }
 
+#ifdef LIBXL_HAVE_DOMAIN_SUSPEND_ONLY
+static int
+libxlDomainPMSuspendForDuration(virDomainPtr dom,
+unsigned int target,
+unsigned long long duration,
+unsigned int flags)
+{
+virDomainObjPtr vm;
+int ret = -1;
+libxlDriverPrivatePtr driver = dom->conn->privateData;
+libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
+
+virCheckFlags(0, -1);
+if (target != VIR_NODE_SUSPEND_TARGET_MEM) {
+virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
+_("PMSuspend type %d not supported by libxenlight driver"),
+target);
+return -1;
+}
+
+if (duration != 0) {
+virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+_("Duration not supported. Use 0 for now"));
+return -1;
+}
+
+if (!(vm = libxlDomObjFromDomain(dom)))
+goto cleanup;
+
+if (virDomainPMSuspendForDurationEnsureACL(dom->conn, vm->def) < 0)
+goto cleanup;
+
+if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
+goto cleanup;
+
+if (!virDomainObjCheckActive(vm))
+goto endjob;
+
+/* Unlock virDomainObjPtr to not deadlock with even handler, which will try
+ * to send lifecycle event
+ */
+virObjectUnlock(vm);
+ret = libxl_domain_suspend_only(cfg->ctx, vm->def->id, NULL);
+virObjectLock(vm);
+
+if (ret < 0) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _("Failed to suspend domain '%d'"), vm->def->id);
+goto endjob;
+}
+
+ret = 0;
+
+ endjob:
+libxlDomainObjEndJob(driver, vm);
+
+ cleanup:
+virDomainObjEndAPI();
+return ret;
+}
+#endif
+
+static int
+libxlDomainPMWakeup(virDomainPtr dom, unsigned int flags)
+{
+libxlDriverPrivatePtr driver = dom->conn->privateData;
+virDomainObjPtr vm;
+int ret = -1;
+virObjectEventPtr event = NULL;
+libxlDomainObjPrivatePtr priv;
+libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
+
+virCheckFlags(0, -1);
+
+if (!(vm = libxlDomObjFromDomain(dom)))
+goto cleanup;
+
+if (virDomainPMWakeupEnsureACL(dom->conn, vm->def) < 0)
+goto cleanup;
+
+if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
+goto cleanup;
+
+if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PMSUSPENDED) {
+virReportError(VIR_ERR_OPERATION_INVALID,
+   "%s", _("Domain is not suspended"));
+goto endjob;
+}
+
+
+priv = vm->privateData;
+if (libxl_domain_resume(cfg->ctx, vm->def->id, 1, NULL) < 0) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _("Failed to resume domain '%d'"), vm->def->id);
+goto endjob;
+}
+virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_WAKEUP);
+/* reenable death event - libxl reports it only once */
+if (priv->deathW)
+libxl_evdisable_domain_death(cfg->ctx, priv->deathW);
+if (libxl_evenable_domain_death(cfg->ctx, vm->def->id, 0, >deathW))
+goto destroy_dom;
+
+event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED,
+ VIR_DOMAIN_EVENT_STARTED_WAKEUP);
+
+ret = 0;
+goto endjob;
+
+ destroy_dom:
+libxlDomainDestroyInternal(driver, vm);
+vm->def->id = -1;
+virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, VIR_DOMAIN_SHUTOFF_FAILED);
+
+ endjob:
+libxlDomainObjEndJob(driver, vm);
+
+ cleanup:
+virDomainObjEndAPI();
+virObjectEventStateQueue(driver->domainEventState, event);
+return ret;
+}
+
 static char *
 libxlDomainGetOSType(virDomainPtr dom)
 {
@@ -6385,6 +6508,10 @@ static virHypervisorDriver libxlHypervisorDriver = {
 .domainReboot = libxlDomainReboot, /* 0.9.0 */
 .domainDestroy = libxlDomainDestroy, /* 0.9.0 */
 .domainDestroyFlags = libxlDomainDestroyFlags, /* 0.9.4 */
+#ifdef LIBXL_HAVE_DOMAIN_SUSPEND_ONLY
+.domainPMSuspendForDuration = libxlDomainPM

[libvirt] [PATCH v3 3/3] libxl: initialize domain state with real data

2018-09-07 Thread Marek Marczykowski-Górecki
When libvirtd is started, initialize domain objects state with its real
state, not only RUNNING/SHUTOFF.

Signed-off-by: Marek Marczykowski-Górecki 
Reviewed-by: Jim Fehlig 
---
 src/libxl/libxl_driver.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 58f9f1f..006279b 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -412,6 +412,17 @@ libxlReconnectDomain(virDomainObjPtr vm,
 vm->def, hostdev_flags) < 0)
 goto error;
 
+if (d_info.shutdown &&
+d_info.shutdown_reason == LIBXL_SHUTDOWN_REASON_SUSPEND)
+virDomainObjSetState(vm, VIR_DOMAIN_PMSUSPENDED,
+ VIR_DOMAIN_PMSUSPENDED_UNKNOWN);
+else if (d_info.paused)
+virDomainObjSetState(vm, VIR_DOMAIN_PAUSED,
+ VIR_DOMAIN_PAUSED_UNKNOWN);
+else
+virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
+ VIR_DOMAIN_RUNNING_UNKNOWN);
+
 if (virAtomicIntInc(>nactive) == 1 && driver->inhibitCallback)
 driver->inhibitCallback(true, driver->inhibitOpaque);
 
-- 
git-series 0.9.1

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

[libvirt] [PATCH v3 0/3] libxl: implement virDomainPM* functions

2018-09-07 Thread Marek Marczykowski-Górecki
Needed libxl_domain_suspend_only is supported in Xen >= 4.11. But wakeup should
work with older versions.

Marek Marczykowski-Górecki (3):
  libxl: send lifecycle event on suspend
  libxl: implement virDomainPM* functions
  libxl: initialize domain state with real data

 src/libxl/libxl_domain.c |  20 +++---
 src/libxl/libxl_driver.c | 138 -
 2 files changed, 150 insertions(+), 8 deletions(-)

base-commit: 3ad77f853230f870efa396636e008292c7f2b1c0
-- 
git-series 0.9.1

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

[libvirt] [PATCH v3 1/3] libxl: send lifecycle event on suspend

2018-09-07 Thread Marek Marczykowski-Górecki
Signed-off-by: Marek Marczykowski-Górecki 
Reviewed-by: Jim Fehlig 
---
 src/libxl/libxl_domain.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 2ab78ac..b800bc9 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -520,6 +520,18 @@ libxlDomainShutdownThread(void *opaque)
 case VIR_DOMAIN_LIFECYCLE_ACTION_LAST:
 goto endjob;
 }
+} else if (xl_reason == LIBXL_SHUTDOWN_REASON_SUSPEND) {
+virDomainObjSetState(vm, VIR_DOMAIN_PMSUSPENDED,
+ VIR_DOMAIN_PMSUSPENDED_UNKNOWN);
+
+dom_event = virDomainEventLifecycleNewFromObj(vm,
+   VIR_DOMAIN_EVENT_PMSUSPENDED,
+   
VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY);
+/*
+ * Similar to the xl implementation, ignore SUSPEND.  Any actions 
needed
+ * after calling libxl_domain_suspend() are handled by it's callers.
+ */
+goto endjob;
 } else {
 VIR_INFO("Unhandled shutdown_reason %d", xl_reason);
 goto endjob;
@@ -563,7 +575,6 @@ void
 libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST libxl_event *event)
 {
 libxlDriverPrivatePtr driver = data;
-libxl_shutdown_reason xl_reason = event->u.domain_shutdown.shutdown_reason;
 struct libxlShutdownThreadInfo *shutdown_info = NULL;
 virThread thread;
 libxlDriverConfigPtr cfg;
@@ -574,13 +585,6 @@ libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST 
libxl_event *event)
 }
 
 /*
- * Similar to the xl implementation, ignore SUSPEND.  Any actions needed
- * after calling libxl_domain_suspend() are handled by its callers.
- */
-if (xl_reason == LIBXL_SHUTDOWN_REASON_SUSPEND)
-goto error;
-
-/*
  * Start a thread to handle shutdown.  We don't want to be tying up
  * libxl's event machinery by doing a potentially lengthy shutdown.
  */
-- 
git-series 0.9.1

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

Re: [libvirt] [PATCH v2 2/3] libxl: implement virDomainPM* functions

2018-09-07 Thread Marek Marczykowski-Górecki
On Fri, Sep 07, 2018 at 11:10:14AM -0600, Jim Fehlig wrote:
> On 09/06/2018 03:06 PM, Marek Marczykowski-Górecki wrote:
> 
> A few additional comments came to mind while looking at this patch again...

Perfect timing, I was just going to hit "send" on v3...

> > > > +/* Unlock virDomainObjPtr to not deadlock with even handler, which 
> > > > will try
> > > > + * to send lifecycle event
> > > > + */
> > > > +virObjectUnlock(vm);
> > > > +ret = libxl_domain_suspend_only(cfg->ctx, vm->def->id, NULL);
> > > > +virObjectLock(vm);
> > > > +
> > > > +if (ret < 0) {
> > > > +virReportError(VIR_ERR_INTERNAL_ERROR,
> > > > +   _("Failed to suspend domain '%d'"), 
> > > > vm->def->id);
> > > > +goto endjob;
> > > > +}
> > > > +
> 
> Should we create a lifecycle event and/or call virDomainObjSetState on
> successful suspend? Seems neither are done in the qemu driver, but might be
> an oversight there too.

Not sure about qemu, but here it is done by libxl domain death
event handler (libxlDomainShutdownThread in libxl_domain.c). See patch
1/3.

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


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

Re: [libvirt] [PATCH v2 2/3] libxl: implement virDomainPM* functions

2018-09-06 Thread Marek Marczykowski-Górecki
On Thu, Sep 06, 2018 at 02:58:30PM -0600, Jim Fehlig wrote:
> On 09/03/2018 04:09 PM, Marek Marczykowski-Górecki wrote:
> > Signed-off-by: Marek Marczykowski-Górecki 
> > ---
> > Changes in v2:
> >   - use virDomainObjEndAPI
> >   - drop duplicated error reporting on virDomainObjIsActive
> >   - bump version comment to 4.8.0
> 
> You missed some other comments from V1. I'll repeat them here.
> 
> > ---
> >   src/libxl/libxl_driver.c | 121 -
> >   1 file changed, 121 insertions(+)
> > 
> > diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> > index 5a5e792..0a4e716 100644
> > --- a/src/libxl/libxl_driver.c
> > +++ b/src/libxl/libxl_driver.c
> > @@ -1403,6 +1403,123 @@ libxlDomainDestroy(virDomainPtr dom)
> >   return libxlDomainDestroyFlags(dom, 0);
> >   }
> > +#ifdef LIBXL_HAVE_DOMAIN_SUSPEND_ONLY
> > +static int
> > +libxlDomainPMSuspendForDuration(virDomainPtr dom,
> > +unsigned int target,
> > +unsigned long long duration,
> > +unsigned int flags)
> > +{
> > +virDomainObjPtr vm;
> > +int ret = -1;
> > +libxlDriverPrivatePtr driver = dom->conn->privateData;
> > +libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
> > +
> > +virCheckFlags(0, -1);
> > +if (target != VIR_NODE_SUSPEND_TARGET_MEM) {
> > +virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
> > +_("PMSuspend type %d not supported by libxenlight driver"),
> > +target);
> > +return -1;
> > +}
> > +
> > +if (duration != 0) {
> > +virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
> > +_("libxenlight driver supports only duration=0"));
> > +return -1;
> > +}
> > +
> > +if (!(vm = libxlDomObjFromDomain(dom)))
> > +goto cleanup;
> > +
> > +if (virDomainPMSuspendForDurationEnsureACL(dom->conn, vm->def) < 0)
> > +goto cleanup;
> > +
> > +if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
> > +goto cleanup;
> > +
> > +if (!virDomainObjIsActive(vm))
> > +goto endjob;
> 
> You still need to report the error if domain is inactive. To do that use
> virDomainObjCheckActive(). E.g.
> 
> if (virDomainObjCheckActive(vm) < 0)
> goto endjob;

Ah, I've missed s/Is/Check/.

> > +
> > +/* Unlock virDomainObjPtr to not deadlock with even handler, which 
> > will try
> > + * to send lifecycle event
> > + */
> > +virObjectUnlock(vm);
> > +ret = libxl_domain_suspend_only(cfg->ctx, vm->def->id, NULL);
> > +virObjectLock(vm);
> > +
> > +if (ret < 0) {
> > +virReportError(VIR_ERR_INTERNAL_ERROR,
> > +   _("Failed to suspend domain '%d'"), vm->def->id);
> > +goto endjob;
> > +}
> > +
> > +ret = 0;
> > +
> > + endjob:
> > +libxlDomainObjEndJob(driver, vm);
> > +
> > + cleanup:
> > +virDomainObjEndAPI();
> > +return ret;
> > +}
> > +#endif
> > +
> > +static int
> > +libxlDomainPMWakeup(virDomainPtr dom,
> > +unsigned int flags)
> 
> Whitespace is off, but this line could probably be combined with the previous 
> one.
> 
> > +{
> > +libxlDriverPrivatePtr driver = dom->conn->privateData;
> > +virDomainObjPtr vm;
> > +int ret = -1;
> > +virObjectEventPtr event = NULL;
> > +libxlDomainObjPrivatePtr priv;
> > +libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
> > +
> > +virCheckFlags(0, -1);
> > +
> > +if (!(vm = libxlDomObjFromDomain(dom)))
> > +goto cleanup;
> > +
> > +if (virDomainPMWakeupEnsureACL(dom->conn, vm->def) < 0)
> > +goto cleanup;
> > +
> > +if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
> > +goto cleanup;
> > +
> > +if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PMSUSPENDED) {
> > +virReportError(VIR_ERR_OPERATION_INVALID,
> > +   "%s", _("Domain is not suspended"));
> > +goto endjob;
> > +}
> > +
> > +event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED,
> > +  

[libvirt] [PATCH v2 2/3] libxl: implement virDomainPM* functions

2018-09-03 Thread Marek Marczykowski-Górecki
Signed-off-by: Marek Marczykowski-Górecki 
---
Changes in v2:
 - use virDomainObjEndAPI
 - drop duplicated error reporting on virDomainObjIsActive
 - bump version comment to 4.8.0
---
 src/libxl/libxl_driver.c | 121 -
 1 file changed, 121 insertions(+)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 5a5e792..0a4e716 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1403,6 +1403,123 @@ libxlDomainDestroy(virDomainPtr dom)
 return libxlDomainDestroyFlags(dom, 0);
 }
 
+#ifdef LIBXL_HAVE_DOMAIN_SUSPEND_ONLY
+static int
+libxlDomainPMSuspendForDuration(virDomainPtr dom,
+unsigned int target,
+unsigned long long duration,
+unsigned int flags)
+{
+virDomainObjPtr vm;
+int ret = -1;
+libxlDriverPrivatePtr driver = dom->conn->privateData;
+libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
+
+virCheckFlags(0, -1);
+if (target != VIR_NODE_SUSPEND_TARGET_MEM) {
+virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
+_("PMSuspend type %d not supported by libxenlight driver"),
+target);
+return -1;
+}
+
+if (duration != 0) {
+virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+_("libxenlight driver supports only duration=0"));
+return -1;
+}
+
+if (!(vm = libxlDomObjFromDomain(dom)))
+goto cleanup;
+
+if (virDomainPMSuspendForDurationEnsureACL(dom->conn, vm->def) < 0)
+goto cleanup;
+
+if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
+goto cleanup;
+
+if (!virDomainObjIsActive(vm))
+goto endjob;
+
+/* Unlock virDomainObjPtr to not deadlock with even handler, which will try
+ * to send lifecycle event
+ */
+virObjectUnlock(vm);
+ret = libxl_domain_suspend_only(cfg->ctx, vm->def->id, NULL);
+virObjectLock(vm);
+
+if (ret < 0) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _("Failed to suspend domain '%d'"), vm->def->id);
+goto endjob;
+}
+
+ret = 0;
+
+ endjob:
+libxlDomainObjEndJob(driver, vm);
+
+ cleanup:
+virDomainObjEndAPI();
+return ret;
+}
+#endif
+
+static int
+libxlDomainPMWakeup(virDomainPtr dom,
+unsigned int flags)
+{
+libxlDriverPrivatePtr driver = dom->conn->privateData;
+virDomainObjPtr vm;
+int ret = -1;
+virObjectEventPtr event = NULL;
+libxlDomainObjPrivatePtr priv;
+libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
+
+virCheckFlags(0, -1);
+
+if (!(vm = libxlDomObjFromDomain(dom)))
+goto cleanup;
+
+if (virDomainPMWakeupEnsureACL(dom->conn, vm->def) < 0)
+goto cleanup;
+
+if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
+goto cleanup;
+
+if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PMSUSPENDED) {
+virReportError(VIR_ERR_OPERATION_INVALID,
+   "%s", _("Domain is not suspended"));
+goto endjob;
+}
+
+event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED,
+ VIR_DOMAIN_EVENT_STARTED_WAKEUP);
+
+priv = vm->privateData;
+if (libxl_domain_resume(cfg->ctx, vm->def->id, 1, NULL) < 0) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _("Failed to resume domain '%d'"), vm->def->id);
+goto endjob;
+}
+virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_WAKEUP);
+/* reenable death event - libxl reports it only once */
+if (priv->deathW)
+libxl_evdisable_domain_death(cfg->ctx, priv->deathW);
+if (libxl_evenable_domain_death(cfg->ctx, vm->def->id, 0, >deathW))
+goto endjob;
+
+ret = 0;
+
+ endjob:
+libxlDomainObjEndJob(driver, vm);
+
+ cleanup:
+virDomainObjEndAPI();
+virObjectEventStateQueue(driver->domainEventState, event);
+return ret;
+}
+
 static char *
 libxlDomainGetOSType(virDomainPtr dom)
 {
@@ -6385,6 +6502,10 @@ static virHypervisorDriver libxlHypervisorDriver = {
 .domainReboot = libxlDomainReboot, /* 0.9.0 */
 .domainDestroy = libxlDomainDestroy, /* 0.9.0 */
 .domainDestroyFlags = libxlDomainDestroyFlags, /* 0.9.4 */
+#ifdef LIBXL_HAVE_DOMAIN_SUSPEND_ONLY
+.domainPMSuspendForDuration = libxlDomainPMSuspendForDuration, /* 4.8.0 */
+#endif
+.domainPMWakeup = libxlDomainPMWakeup, /* 4.8.0 */
 .domainGetOSType = libxlDomainGetOSType, /* 0.9.0 */
 .domainGetMaxMemory = libxlDomainGetMaxMemory, /* 0.9.0 */
 .domainSetMaxMemory = libxlDomainSetMaxMemory, /* 0.9.2 */
-- 
git-series 0.9.1

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

[libvirt] [PATCH v2 0/3] libxl: implement virDomainPM* functions

2018-09-03 Thread Marek Marczykowski-Górecki
Needed libxl_domain_suspend_only is supported in Xen >= 4.11. But wakeup should
work with older versions.

Marek Marczykowski-Górecki (3):
  libxl: send lifecycle event on suspend
  libxl: implement virDomainPM* functions
  libxl: initialize domain state with real data

 src/libxl/libxl_domain.c |  20 +++---
 src/libxl/libxl_driver.c | 132 -
 2 files changed, 144 insertions(+), 8 deletions(-)

base-commit: 3ad77f853230f870efa396636e008292c7f2b1c0
-- 
git-series 0.9.1

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

[libvirt] [PATCH v2 1/3] libxl: send lifecycle event on suspend

2018-09-03 Thread Marek Marczykowski-Górecki
Signed-off-by: Marek Marczykowski-Górecki 
Reviewed-by: Jim Fehlig 
---
 src/libxl/libxl_domain.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 2ab78ac..b800bc9 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -520,6 +520,18 @@ libxlDomainShutdownThread(void *opaque)
 case VIR_DOMAIN_LIFECYCLE_ACTION_LAST:
 goto endjob;
 }
+} else if (xl_reason == LIBXL_SHUTDOWN_REASON_SUSPEND) {
+virDomainObjSetState(vm, VIR_DOMAIN_PMSUSPENDED,
+ VIR_DOMAIN_PMSUSPENDED_UNKNOWN);
+
+dom_event = virDomainEventLifecycleNewFromObj(vm,
+   VIR_DOMAIN_EVENT_PMSUSPENDED,
+   
VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY);
+/*
+ * Similar to the xl implementation, ignore SUSPEND.  Any actions 
needed
+ * after calling libxl_domain_suspend() are handled by it's callers.
+ */
+goto endjob;
 } else {
 VIR_INFO("Unhandled shutdown_reason %d", xl_reason);
 goto endjob;
@@ -563,7 +575,6 @@ void
 libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST libxl_event *event)
 {
 libxlDriverPrivatePtr driver = data;
-libxl_shutdown_reason xl_reason = event->u.domain_shutdown.shutdown_reason;
 struct libxlShutdownThreadInfo *shutdown_info = NULL;
 virThread thread;
 libxlDriverConfigPtr cfg;
@@ -574,13 +585,6 @@ libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST 
libxl_event *event)
 }
 
 /*
- * Similar to the xl implementation, ignore SUSPEND.  Any actions needed
- * after calling libxl_domain_suspend() are handled by its callers.
- */
-if (xl_reason == LIBXL_SHUTDOWN_REASON_SUSPEND)
-goto error;
-
-/*
  * Start a thread to handle shutdown.  We don't want to be tying up
  * libxl's event machinery by doing a potentially lengthy shutdown.
  */
-- 
git-series 0.9.1

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

[libvirt] [PATCH v2 3/3] libxl: initialize domain state with real data

2018-09-03 Thread Marek Marczykowski-Górecki
When libvirtd is started, initialize domain objects state with its real
state, not only RUNNING/SHUTOFF.

Signed-off-by: Marek Marczykowski-Górecki 
Reviewed-by: Jim Fehlig 
---
 src/libxl/libxl_driver.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 0a4e716..4b2d688 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -412,6 +412,17 @@ libxlReconnectDomain(virDomainObjPtr vm,
 vm->def, hostdev_flags) < 0)
 goto error;
 
+if (d_info.shutdown &&
+d_info.shutdown_reason == LIBXL_SHUTDOWN_REASON_SUSPEND)
+virDomainObjSetState(vm, VIR_DOMAIN_PMSUSPENDED,
+ VIR_DOMAIN_PMSUSPENDED_UNKNOWN);
+else if (d_info.paused)
+virDomainObjSetState(vm, VIR_DOMAIN_PAUSED,
+ VIR_DOMAIN_PAUSED_UNKNOWN);
+else
+virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
+ VIR_DOMAIN_RUNNING_UNKNOWN);
+
 if (virAtomicIntInc(>nactive) == 1 && driver->inhibitCallback)
 driver->inhibitCallback(true, driver->inhibitOpaque);
 
-- 
git-series 0.9.1

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

Re: [libvirt] [PATCH 01/10] docs: don't refer to deprecated 'linux' ostype in example

2018-08-31 Thread Marek Marczykowski-Górecki
On Thu, Aug 30, 2018 at 03:29:41PM +0100, Daniel P. Berrangé wrote:
> On Thu, Aug 30, 2018 at 04:27:06PM +0200, Marek Marczykowski-Górecki wrote:
> > On Mon, Aug 27, 2018 at 03:23:16PM -0600, Jim Fehlig wrote:
> > > On 08/05/2018 03:48 PM, Marek Marczykowski-Górecki wrote:
> > > > Use preferred name: 'xen'.
> > > 
> > > I'd be fine with this change if the actual code used the preferred name 
> > > too
> > > :-). E.g. config containing
> > > 
> > >   xen
> > > 
> > > will be shown as
> > > 
> > >   linux
> > > 
> > > after virsh define; virsh dumpxml. Also, virsh domxml-from-native will
> > > produce the linux variant.
> > 
> > I was thinking about this and decided to left it intact for backward
> > compatibility - so config from `virsh dumpxml` will work with very old
> > libvirt version. But if that would be acceptable, I'd very much like to
> > change that too. What are opinions about that?
> 
> We can't change what we are reporting in the XML here, no matter how
> stupid our original choice of terminology was.

Ok. What about other patches (not really depending on this one)?

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


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

Re: [libvirt] [PATCH 01/10] docs: don't refer to deprecated 'linux' ostype in example

2018-08-30 Thread Marek Marczykowski-Górecki
On Mon, Aug 27, 2018 at 03:23:16PM -0600, Jim Fehlig wrote:
> On 08/05/2018 03:48 PM, Marek Marczykowski-Górecki wrote:
> > Use preferred name: 'xen'.
> 
> I'd be fine with this change if the actual code used the preferred name too
> :-). E.g. config containing
> 
>   xen
> 
> will be shown as
> 
>   linux
> 
> after virsh define; virsh dumpxml. Also, virsh domxml-from-native will
> produce the linux variant.

I was thinking about this and decided to left it intact for backward
compatibility - so config from `virsh dumpxml` will work with very old
libvirt version. But if that would be acceptable, I'd very much like to
change that too. What are opinions about that?

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


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

[libvirt] [PATCH 3/3] libxl: initialize domain state with real data

2018-08-05 Thread Marek Marczykowski-Górecki
When libvirtd is started, initialize domain objects state with its real
state, not only RUNNING/SHUTOFF.

Signed-off-by: Marek Marczykowski-Górecki 
---
 src/libxl/libxl_driver.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 10c7aab..16b3146 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -412,6 +412,17 @@ libxlReconnectDomain(virDomainObjPtr vm,
 vm->def, hostdev_flags) < 0)
 goto error;
 
+if (d_info.shutdown &&
+d_info.shutdown_reason == LIBXL_SHUTDOWN_REASON_SUSPEND)
+virDomainObjSetState(vm, VIR_DOMAIN_PMSUSPENDED,
+ VIR_DOMAIN_PMSUSPENDED_UNKNOWN);
+else if (d_info.paused)
+virDomainObjSetState(vm, VIR_DOMAIN_PAUSED,
+ VIR_DOMAIN_PAUSED_UNKNOWN);
+else
+virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
+ VIR_DOMAIN_RUNNING_UNKNOWN);
+
 if (virAtomicIntInc(>nactive) == 1 && driver->inhibitCallback)
 driver->inhibitCallback(true, driver->inhibitOpaque);
 
-- 
git-series 0.9.1

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

[libvirt] [PATCH 0/3] libxl: implement virDomainPM* functions

2018-08-05 Thread Marek Marczykowski-Górecki
Needed libxl_domain_suspend_only is supported in Xen >= 4.11. But wakeup should
work with older versions.

Marek Marczykowski-Górecki (3):
  libxl: send lifecycle event on suspend
  libxl: implement virDomainPM* functions
  libxl: initialize domain state with real data

 src/libxl/libxl_domain.c |  20 +++---
 src/libxl/libxl_driver.c | 137 -
 2 files changed, 149 insertions(+), 8 deletions(-)

base-commit: 3ad77f853230f870efa396636e008292c7f2b1c0
-- 
git-series 0.9.1

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

[libvirt] [PATCH 2/3] libxl: implement virDomainPM* functions

2018-08-05 Thread Marek Marczykowski-Górecki
Signed-off-by: Marek Marczykowski-Górecki 
---
 src/libxl/libxl_driver.c | 126 -
 1 file changed, 126 insertions(+)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 5a5e792..10c7aab 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1403,6 +1403,128 @@ libxlDomainDestroy(virDomainPtr dom)
 return libxlDomainDestroyFlags(dom, 0);
 }
 
+#ifdef LIBXL_HAVE_DOMAIN_SUSPEND_ONLY
+static int
+libxlDomainPMSuspendForDuration(virDomainPtr dom,
+unsigned int target,
+unsigned long long duration,
+unsigned int flags)
+{
+virDomainObjPtr vm;
+int ret = -1;
+libxlDriverPrivatePtr driver = dom->conn->privateData;
+libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
+
+virCheckFlags(0, -1);
+if (target != VIR_NODE_SUSPEND_TARGET_MEM) {
+virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
+_("PMSuspend type %d not supported by libxenlight driver"),
+target);
+return -1;
+}
+
+if (duration != 0) {
+virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+_("libxenlight driver supports only duration=0"));
+return -1;
+}
+
+if (!(vm = libxlDomObjFromDomain(dom)))
+goto cleanup;
+
+if (virDomainPMSuspendForDurationEnsureACL(dom->conn, vm->def) < 0)
+goto cleanup;
+
+if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
+goto cleanup;
+
+if (!virDomainObjIsActive(vm)) {
+virReportError(VIR_ERR_OPERATION_INVALID,
+   "%s", _("Domain is not running"));
+goto endjob;
+}
+
+/* Unlock virDomainObjPtr to not deadlock with even handler, which will try
+ * to send lifecycle event
+ */
+virObjectUnlock(vm);
+ret = libxl_domain_suspend_only(cfg->ctx, vm->def->id, NULL);
+virObjectLock(vm);
+
+if (ret < 0) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _("Failed to suspend domain '%d'"), vm->def->id);
+goto endjob;
+}
+
+ret = 0;
+
+ endjob:
+libxlDomainObjEndJob(driver, vm);
+
+ cleanup:
+if (vm)
+virObjectUnlock(vm);
+return ret;
+}
+#endif
+
+static int
+libxlDomainPMWakeup(virDomainPtr dom,
+unsigned int flags)
+{
+libxlDriverPrivatePtr driver = dom->conn->privateData;
+virDomainObjPtr vm;
+int ret = -1;
+virObjectEventPtr event = NULL;
+libxlDomainObjPrivatePtr priv;
+libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
+
+virCheckFlags(0, -1);
+
+if (!(vm = libxlDomObjFromDomain(dom)))
+goto cleanup;
+
+if (virDomainPMWakeupEnsureACL(dom->conn, vm->def) < 0)
+goto cleanup;
+
+if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
+goto cleanup;
+
+if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PMSUSPENDED) {
+virReportError(VIR_ERR_OPERATION_INVALID,
+   "%s", _("Domain is not suspended"));
+goto endjob;
+}
+
+event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED,
+ VIR_DOMAIN_EVENT_STARTED_WAKEUP);
+
+priv = vm->privateData;
+if (libxl_domain_resume(cfg->ctx, vm->def->id, 1, NULL) < 0) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _("Failed to resume domain '%d'"), vm->def->id);
+goto endjob;
+}
+virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_WAKEUP);
+/* reenable death event - libxl reports it only once */
+if (priv->deathW)
+libxl_evdisable_domain_death(cfg->ctx, priv->deathW);
+if (libxl_evenable_domain_death(cfg->ctx, vm->def->id, 0, >deathW))
+goto endjob;
+
+ret = 0;
+
+ endjob:
+libxlDomainObjEndJob(driver, vm);
+
+ cleanup:
+if (vm)
+virObjectUnlock(vm);
+virObjectEventStateQueue(driver->domainEventState, event);
+return ret;
+}
+
 static char *
 libxlDomainGetOSType(virDomainPtr dom)
 {
@@ -6385,6 +6507,10 @@ static virHypervisorDriver libxlHypervisorDriver = {
 .domainReboot = libxlDomainReboot, /* 0.9.0 */
 .domainDestroy = libxlDomainDestroy, /* 0.9.0 */
 .domainDestroyFlags = libxlDomainDestroyFlags, /* 0.9.4 */
+#ifdef LIBXL_HAVE_DOMAIN_SUSPEND_ONLY
+.domainPMSuspendForDuration = libxlDomainPMSuspendForDuration, /* 4.7.0 */
+#endif
+.domainPMWakeup = libxlDomainPMWakeup, /* 4.7.0 */
 .domainGetOSType = libxlDomainGetOSType, /* 0.9.0 */
 .domainGetMaxMemory = libxlDomainGetMaxMemory, /* 0.9.0 */
 .domainSetMaxMemory = libxlDomainSetMaxMemory, /* 0.9.2 */
-- 
git-series 0.9.1

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

  1   2   3   4   >