[libvirt] [PATCH v2 0/5] conf: qemu: support new Hyper-V enlightenments in Qemu 3.1
by Vitaly Kuznetsov
The upcoming Qemu-3.1 release will bring us two new Hyper-V enlightenments:
hv_ipi and hv_evmcs. Support these in libvirt.
Changes since v1:
- Split patches into 'conf' and 'qemu' [John Ferlan]
- Add entries to docs/news.xml [Andrea Bolognani]
- Add a cleanup PATCH1 removing extra whitespaces from
docs/formatdomain.html.in [Andrea Bolognani]
- Minor tweaks [Andrea Bolognani]
Vitaly Kuznetsov (5):
docs: remove extra whitespate from Hyper-V enlightenments options
conf: add support for Hyper-V PV IPIs
qemu: add support for Hyper-V PV IPIs
conf: add support for Hyper-V Enlightened VMCS
qemu: add support for Hyper-V Enlightened VMCS
docs/formatdomain.html.in | 32 ++++++++++++++++++-------
docs/news.xml | 18 ++++++++++++++
docs/schemas/domaincommon.rng | 10 ++++++++
src/conf/domain_conf.c | 11 ++++++++-
src/conf/domain_conf.h | 2 ++
src/cpu/cpu_x86.c | 6 +++++
src/cpu/cpu_x86_data.h | 2 ++
src/qemu/qemu_command.c | 2 ++
src/qemu/qemu_parse_command.c | 2 ++
src/qemu/qemu_process.c | 2 ++
tests/qemuxml2argvdata/hyperv-off.xml | 2 ++
tests/qemuxml2argvdata/hyperv.args | 2 +-
tests/qemuxml2argvdata/hyperv.xml | 2 ++
tests/qemuxml2xmloutdata/hyperv-off.xml | 2 ++
tests/qemuxml2xmloutdata/hyperv.xml | 2 ++
15 files changed, 86 insertions(+), 11 deletions(-)
--
2.17.2
6 years, 1 month
[libvirt] [PATCH] rpc: Remove duplicate check from filter function return.
by Julio Faracco
This is a simple removal of a duplicated check of the return of the
filter function. There is a nested conditional checking exactly the same
thing.
Signed-off-by: Julio Faracco <jcfaracco(a)gmail.com>
---
src/rpc/virnetserverclient.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index 97cf126f56..778cd1afc0 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -1288,8 +1288,7 @@ static virNetMessagePtr virNetServerClientDispatchRead(virNetServerClientPtr cli
if (ret < 0) {
virNetMessageFree(msg);
msg = NULL;
- if (ret < 0)
- client->wantClose = true;
+ client->wantClose = true;
break;
}
if (ret > 0) {
--
2.19.1
6 years, 1 month
[libvirt] [PATCH] qemu: Using virStringListFreeCount instead VIR_FREE to free tmpPaths.
by Julio Faracco
The function qemuDomainGetHostdevPath() is using VIR_FREE to free the
paths stored in tmpPaths. Both syntax analyzer are reporting a warning
about this. Replacing the old method to function
virStringListFreeCount() fixes the warnings/errors.
Signed-off-by: Julio Faracco <jcfaracco(a)gmail.com>
---
src/qemu/qemu_domain.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 37926850b2..c374219aab 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11132,9 +11132,7 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
}
ret = 0;
cleanup:
- for (i = 0; i < tmpNpaths; i++)
- VIR_FREE(tmpPaths[i]);
- VIR_FREE(tmpPaths);
+ virStringListFreeCount(tmpPaths, tmpNpaths);
VIR_FREE(tmpPerms);
virPCIDeviceFree(pci);
virUSBDeviceFree(usb);
--
2.19.1
6 years, 1 month
[libvirt] [PATCH v4 0/2] Adding partial support for LXC 3.0 rebased configs.
by Julio Faracco
This series adds enhacements for LXC to cover rebased config settings
for version 3.0 without remove legacy ones. This serie includes some
test cases to cover new config files too. The title mentions the word
"partial" because there is a huge change with network settings which
this commit does not cover.
History:
v1-v2: Michal's suggestions to handle differences between versions.
v2-v3: Adding suggestions from Pino and John too.
v3-v4: Appluing tests for LXC v3.
Julio Faracco (2):
lxc: Include support to lxc version 3.0 or higher.
tests: Adding tests cases to cover rebased settings for LXC 3.0.
src/lxc/lxc_native.c | 52 ++++++++++++++-----
.../lxcconf2xml-blkiotune-v3.config | 11 ++++
.../lxcconf2xml-cpusettune-v3.config | 6 +++
.../lxcconf2xml-cputune-v3.config | 7 +++
.../lxcconf2xml-ethernet-v3.config | 44 ++++++++++++++++
.../lxcconf2xml-fstab-v3.config | 37 +++++++++++++
.../lxcconf2xml-idmap-v3.config | 5 ++
.../lxcconf2xml-macvlannetwork-v3.config | 13 +++++
.../lxcconf2xml-memtune-v3.config | 10 ++++
.../lxcconf2xml-nonenetwork-v3.config | 4 ++
.../lxcconf2xml-nonetwork-v3.config | 3 ++
.../lxcconf2xml-physnetwork-v3.config | 11 ++++
.../lxcconf2xml-simple-v3.config | 45 ++++++++++++++++
.../lxcconf2xml-vlannetwork-v3.config | 12 +++++
tests/lxcconf2xmltest.c | 51 +++++++++++++++++-
15 files changed, 295 insertions(+), 16 deletions(-)
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-blkiotune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-cpusettune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-cputune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-fstab-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-idmap-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-memtune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-nonenetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-nonetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-vlannetwork-v3.config
--
2.19.1
6 years, 1 month
[libvirt] [PATCH] util: Fix memory leak in virResctrlMonitorGetStats
by John Ferlan
Missed during review and surprisingly my run through Coverity also
didn't see this. I only noticed it when reading the code while fixing
the build breaker for commit 36780a86a.
With all those continues we would leak @stats.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Pushing under trivial rule.
src/util/virresctrl.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index ef5c668921..7aeca9d287 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -2684,9 +2684,6 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr monitor,
while (virDirRead(dirp, &ent, datapath) > 0) {
char *node_id = NULL;
- if (VIR_ALLOC(stat) < 0)
- goto cleanup;
-
/* Looking for directory that contains resource utilization
* information file. The directory name is arranged in format
* "mon_<node_name>_<node_id>". For example, "mon_L3_00" and
@@ -2709,6 +2706,9 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr monitor,
if (!(node_id = STRSKIP(node_id, "_")))
continue;
+ if (VIR_ALLOC(stat) < 0)
+ goto cleanup;
+
/* The node ID number should be here, parsing it. */
if (virStrToLong_uip(node_id, NULL, 0, &stat->id) < 0)
goto cleanup;
--
2.17.2
6 years, 1 month
[libvirt] [PATCH] util: Change usage of ent->d_type != DT_DIR
by John Ferlan
Fix a broken non-Linux build to use the !virFileIsDir instead
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Pushed as build breaker fix for
https://travis-ci.org/libvirt/libvirt/builds/455121079
All I can say is, well that wasn't obvious... Who knew!
src/util/virresctrl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index f7481a1036..ef5c668921 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -2693,7 +2693,7 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr monitor,
* "mon_L3_01" are two target directories for a two nodes system
* with resource utilization data file for each node respectively.
*/
- if (ent->d_type != DT_DIR)
+ if (!virFileIsDir(ent->d_name))
continue;
/* Looking for directory has a prefix 'mon_L' */
--
2.17.2
6 years, 1 month
[libvirt] [RFC PATCH] Add new migration flag VIR_MIGRATE_DRY_RUN
by Jim Fehlig
A dry run can be used as a best-effort check that a migration command
will succeed. The destination host will be checked to see if it can
accommodate the resources required by the domain. DRY_RUN will fail if
the destination host is not capable of running the domain. Although a
subsequent migration will likely succeed, the success of DRY_RUN does not
ensure a future migration will succeed. Resources on the destination host
could become unavailable between a DRY_RUN and actual migration.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
If it is agreed this is useful, my thought was to use the begin and
prepare phases of migration to implement it. qemuMigrationDstPrepareAny()
already does a lot of the heavy lifting wrt checking the host can
accommodate the domain. Some of it, and the remaining migration phases,
can be short-circuited in the case of dry run.
One interesting wrinkle I've observed is the check for cpu compatibility.
AFAICT qemu is actually invoked on the dst, "filtered-features" of the cpu
are requested via qmp, and results are checked against cpu in domain config.
If cpu on dst is insufficient, migration fails in the prepare phase with
something like "guest CPU doesn't match specification: missing features: z y z".
I was hoping to avoid launching qemu in the case of dry run, but that may
be unavoidable if we'd like a dependable dry run result.
Thanks for considering the idea!
(BTW, if it is considered useful I will follow up with a V1 series that
includes this patch and and impl for the qemu driver.)
include/libvirt/libvirt-domain.h | 12 ++++++++++++
src/qemu/qemu_migration.h | 3 ++-
tools/virsh-domain.c | 7 +++++++
tools/virsh.pod | 10 +++++++++-
4 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index fdd2d6b8ea..6d52f6ce50 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -830,6 +830,18 @@ typedef enum {
*/
VIR_MIGRATE_TLS = (1 << 16),
+ /* Setting the VIR_MIGRATE_DRY_RUN flag will cause libvirt to make a
+ * best-effort attempt to check if migration will succeed. The destination
+ * host will be checked to see if it can accommodate the resources required
+ * by the domain. For example are the network, disk, memory, and CPU
+ * resources used by the domain on the source host also available on the
+ * destination host. The dry run will fail if libvirt determines the
+ * destination host is not capable of running the domain. Although a
+ * subsequent migration will likely succeed, the success of dry run does
+ * not ensure a future migration will succeed. Resources on the destination
+ * host could become unavailable between a dry run and actual migration.
+ */
+ VIR_MIGRATE_DRY_RUN = (1 << 16),
} virDomainMigrateFlags;
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index e12b6972db..b0e2bc689b 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -57,7 +57,8 @@
VIR_MIGRATE_AUTO_CONVERGE | \
VIR_MIGRATE_RDMA_PIN_ALL | \
VIR_MIGRATE_POSTCOPY | \
- VIR_MIGRATE_TLS)
+ VIR_MIGRATE_TLS | \
+ VIR_MIGRATE_DRY_RUN)
/* All supported migration parameters and their types. */
# define QEMU_MIGRATION_PARAMETERS \
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 372bdb95d3..46f0f44917 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -10450,6 +10450,10 @@ static const vshCmdOptDef opts_migrate[] = {
.type = VSH_OT_BOOL,
.help = N_("use TLS for migration")
},
+ {.name = "dry-run",
+ .type = VSH_OT_BOOL,
+ .help = N_("check if migration will succeed without actually performing the migration")
+ },
{.name = NULL}
};
@@ -10694,6 +10698,9 @@ doMigrate(void *opaque)
if (vshCommandOptBool(cmd, "tls"))
flags |= VIR_MIGRATE_TLS;
+ if (vshCommandOptBool(cmd, "dry-run"))
+ flags |= VIR_MIGRATE_DRY_RUN;
+
if (flags & VIR_MIGRATE_PEER2PEER || vshCommandOptBool(cmd, "direct")) {
if (virDomainMigrateToURI3(dom, desturi, params, nparams, flags) == 0)
ret = '0';
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 86c041d575..715fa3887f 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -1845,7 +1845,7 @@ I<domain> I<desturi> [I<migrateuri>] [I<graphicsuri>] [I<listen-address>] [I<dna
[I<--compressed>] [I<--comp-methods> B<method-list>]
[I<--comp-mt-level>] [I<--comp-mt-threads>] [I<--comp-mt-dthreads>]
[I<--comp-xbzrle-cache>] [I<--auto-converge>] [I<auto-converge-initial>]
-[I<auto-converge-increment>] [I<--persistent-xml> B<file>] [I<--tls>]
+[I<auto-converge-increment>] [I<--persistent-xml> B<file>] [I<--tls>] [I<--dry-run>]
Migrate domain to another host. Add I<--live> for live migration; <--p2p>
for peer-2-peer migration; I<--direct> for direct migration; or I<--tunnelled>
@@ -1937,6 +1937,14 @@ Providing I<--tls> causes the migration to use the host configured TLS setup
the migration of the domain. Usage requires proper TLS setup for both source
and target.
+I<--dry-run> can be used as a best-effort check that the migration command
+will succeed. The destination host will be checked to see if it can
+accommodate the resources required by the domain. I<--dry-run> will fail if
+the destination host is not capable of running the domain. Although a
+subsequent migration will likely succeed, the success of dry run does not
+ensure a future migration will succeed. Resources on the destination host
+could become unavailable between a dry run and actual migration.
+
Running migration can be canceled by interrupting virsh (usually using
C<Ctrl-C>) or by B<domjobabort> command sent from another virsh instance.
--
2.18.0
6 years, 1 month
[libvirt] [libvirt-go PATCH] Add daemon shutdown reason to the list
by John Ferlan
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Something I know even less about ;-)... Although I see Daniel has noted
he'll take care of it - I figured I'd give it a "go" (sorry) anyway.
domain.go | 1 +
1 file changed, 1 insertion(+)
diff --git a/domain.go b/domain.go
index 3a3ef5b..e011980 100644
--- a/domain.go
+++ b/domain.go
@@ -593,6 +593,7 @@ const (
DOMAIN_SHUTOFF_SAVED = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_SAVED)
DOMAIN_SHUTOFF_FAILED = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_FAILED)
DOMAIN_SHUTOFF_FROM_SNAPSHOT = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT)
+ DOMAIN_SHUTOFF_DAEMON = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_DAEMON)
)
type DomainBlockCommitFlags int
--
2.17.2
6 years, 1 month
[libvirt] [PATCH v2 0/3] Fix some errors around VIR_ACCESS_DENIED
by John Ferlan
v1: https://www.redhat.com/archives/libvir-list/2018-November/msg00339.html
Changes since v1:
* Do the right thing, revert the bad patch and rework it. Thus patch1 is
the revert and patch2 is the rework. If it's decided that patch2 is
unnecessary or undesired, that's perfectly fine, but would then require
a slight modification to the documentation from commit 4f1107614 to
remove the reference about the access denied message.
* From review - add the virObjectUnref for the data->identity for which
a virIdentityGetCurrent reference was obtained.
v1 cover:
Patch 1 fixes my own error made in this release fortunately, but
only seen because I was invesigating Patch 2
Patch 2 is perhaps a longer term issue, but perhaps coming more to
light now that the nwfilter bindings have been separated and use
a virConnectOpen for nwfilter:///system during reconnection processing;
whereas, previously the filter bindings would have been "hidden" within
various nwfilter, domain, and network driver callbacks and throughs.
John Ferlan (3):
Revert "access: Modify the VIR_ERR_ACCESS_DENIED to include
driverName"
access: Modify the VIR_ERR_ACCESS_DENIED to include driverName
qemu: Set identity for the reconnect all thread
src/access/viraccessmanager.c | 3 ++-
src/qemu/qemu_process.c | 7 +++++++
src/rpc/gendispatch.pl | 3 ++-
src/util/virerror.c | 4 ++--
4 files changed, 13 insertions(+), 4 deletions(-)
--
2.17.2
6 years, 1 month
[libvirt] [PATCH] libvirt: add daemon itself as shutdown reason
by Nikolay Shirokovskiy
Let's introduce shutdown reason "daemon" which means we have to
kill running domain ourselves as the best action we can take at
that moment. Failure to pick up domain on daemon restart is
one example of such case. Using reason "crashed" is a bit misleading
as it is used when qemu is actually crashed or qemu destroyed on
guest panic as result of user choice that is the problem was
in qemu/guest itself. So I propose to use "crashed" only for
qemu side issues and introduce "daemon" when we have to kill the qemu
for good.
There is another example where "daemon" will be useful. If we can
not reboot domain we kill it and got "crashed" reason now. Looks
like good candidate for "daemon" reason.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
include/libvirt/libvirt-domain.h | 1 +
src/conf/domain_conf.c | 3 ++-
src/qemu/qemu_process.c | 11 ++++-------
tools/virsh-domain-monitor.c | 3 ++-
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index fdd2d6b..11fdab5 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -145,6 +145,7 @@ typedef enum {
VIR_DOMAIN_SHUTOFF_FAILED = 6, /* domain failed to start */
VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT = 7, /* restored from a snapshot which was
* taken while domain was shutoff */
+ VIR_DOMAIN_SHUTOFF_DAEMON = 8, /* daemon have to kill domain */
# ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_SHUTOFF_LAST
# endif
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9911d56..e441723 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -779,7 +779,8 @@ VIR_ENUM_IMPL(virDomainShutoffReason, VIR_DOMAIN_SHUTOFF_LAST,
"migrated",
"saved",
"failed",
- "from snapshot")
+ "from snapshot",
+ "daemon")
VIR_ENUM_IMPL(virDomainCrashedReason, VIR_DOMAIN_CRASHED_LAST,
"unknown",
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e9c7618..c4bc9ca 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7988,15 +7988,12 @@ qemuProcessReconnect(void *opaque)
/* We can't get the monitor back, so must kill the VM
* to remove danger of it ending up running twice if
* user tries to start it again later
- * If we couldn't get the monitor since QEMU supports
- * no-shutdown, we can safely say that the domain
- * crashed ... */
- state = VIR_DOMAIN_SHUTOFF_CRASHED;
- /* If BeginJob failed, we jumped here without a job, let's hope another
+ * If BeginJob failed, we jumped here without a job, let's hope another
* thread didn't have a chance to start playing with the domain yet
* (it's all we can do anyway).
*/
- qemuProcessStop(driver, obj, state, QEMU_ASYNC_JOB_NONE, stopFlags);
+ qemuProcessStop(driver, obj, VIR_DOMAIN_SHUTOFF_DAEMON,
+ QEMU_ASYNC_JOB_NONE, stopFlags);
}
goto cleanup;
}
@@ -8035,7 +8032,7 @@ qemuProcessReconnectHelper(virDomainObjPtr obj,
* is no thread that could be doing anything else with the same domain
* object.
*/
- qemuProcessStop(src->driver, obj, VIR_DOMAIN_SHUTOFF_FAILED,
+ qemuProcessStop(src->driver, obj, VIR_DOMAIN_SHUTOFF_DAEMON,
QEMU_ASYNC_JOB_NONE, 0);
qemuDomainRemoveInactiveJobLocked(src->driver, obj);
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 3a26363..f0ad558 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -212,7 +212,8 @@ VIR_ENUM_IMPL(virshDomainShutoffReason,
N_("migrated"),
N_("saved"),
N_("failed"),
- N_("from snapshot"))
+ N_("from snapshot"),
+ N_("daemon"))
VIR_ENUM_DECL(virshDomainCrashedReason)
VIR_ENUM_IMPL(virshDomainCrashedReason,
--
1.8.3.1
6 years, 1 month