[PATCH] news: qemu: Add support for zero-copy migration

2022-07-22 Thread Fangge Jin
Signed-off-by: Fangge Jin 
---
 NEWS.rst | 5 +
 1 file changed, 5 insertions(+)

diff --git a/NEWS.rst b/NEWS.rst
index 79aad652e8..0eb3299e3b 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -42,6 +42,11 @@ v8.5.0 (2022-07-01)
 A new ``VIR_MIGRATE_POSTCOPY_RESUME`` flag (``virsh migrate 
--postcopy-resume``)
 was introduced for recovering from a failed post-copy migration.
 
+  * qemu: Add support for zero-copy migration
+
+With QEMU 7.1.0, libvirt can enable zerocopy for parallel migration. This 
is 
+implmented by adding a new ``VIR_MIGRATE_ZEROCOPY`` flag(``virsh migrate 
--zerocopy``).
+
   * Introduce thread_pool_min and thread_pool_max attributes to IOThread
 
 New attributes ``thread_pool_min`` and ``thread_pool_max`` were introduced
-- 
2.31.1



Re: [libvirt PATCH 01/80] qemu: Add debug messages to job recovery code

2022-05-16 Thread Fangge Jin
Hi

I'm testing this patch series, but it has conflict with latest code.
Could you please rebase to latest code and provide a V2?
Thanks.

BR,
Fangge Jin

On Tue, May 10, 2022 at 11:22 PM Jiri Denemark  wrote:

> Signed-off-by: Jiri Denemark 
> ---
>  src/qemu/qemu_process.c | 13 +
>  1 file changed, 13 insertions(+)
>
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index b0b00eb0a2..1925559fad 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -3445,6 +3445,9 @@ qemuProcessRecoverMigrationIn(virQEMUDriver *driver,
>  (state == VIR_DOMAIN_RUNNING &&
>   reason == VIR_DOMAIN_RUNNING_POSTCOPY);
>
> +VIR_DEBUG("Active incoming migration in phase %s",
> +  qemuMigrationJobPhaseTypeToString(job->phase));
> +
>  switch ((qemuMigrationJobPhase) job->phase) {
>  case QEMU_MIGRATION_PHASE_NONE:
>  case QEMU_MIGRATION_PHASE_PERFORM2:
> @@ -3506,6 +3509,9 @@ qemuProcessRecoverMigrationOut(virQEMUDriver *driver,
>   reason == VIR_DOMAIN_PAUSED_POSTCOPY_FAILED);
>  bool resume = false;
>
> +VIR_DEBUG("Active outgoing migration in phase %s",
> +  qemuMigrationJobPhaseTypeToString(job->phase));
> +
>  switch ((qemuMigrationJobPhase) job->phase) {
>  case QEMU_MIGRATION_PHASE_NONE:
>  case QEMU_MIGRATION_PHASE_PREPARE:
> @@ -3601,6 +3607,13 @@ qemuProcessRecoverJob(virQEMUDriver *driver,
>
>  state = virDomainObjGetState(vm, );
>
> +VIR_DEBUG("Recovering job for domain %s, state=%s(%s), async=%s,
> job=%s",
> +  vm->def->name,
> +  virDomainStateTypeToString(state),
> +  virDomainStateReasonToString(state, reason),
> +  virDomainAsyncJobTypeToString(job->asyncJob),
> +  virDomainJobTypeToString(job->active));
> +
>  switch (job->asyncJob) {
>  case VIR_ASYNC_JOB_MIGRATION_OUT:
>  if (qemuProcessRecoverMigrationOut(driver, vm, job,
> --
> 2.35.1
>
>


Re: [PATCH] qemu: save status xml after generating taint message

2021-07-22 Thread Fangge Jin
On Wed, Jul 21, 2021 at 10:54 PM Michal Prívozník 
wrote:

>
> > The bug quoted shows a few examples where we fail to save status.
> >
> > I'm very surprised we don't save status when hotplugging a NIC or a
> > disk, as the BZ suggests.
>
> I'm not convinced that the steps there are 100% correct. We do call
> virDomainObjSave() after live attach:
>
>
> https://gitlab.com/libvirt/libvirt/-/blob/master/src/qemu/qemu_driver.c#L7834
>
> The two steps for hot-unplug in the BZ actually failed.
(sorry I didn't mention the result in the steps)


> >
> > Missing status save in QMP monitor command passthrough is less
> > surprising though since we're not actually changing the VM state
> > when doing that, so would not have reason to save state except
> > for the taint message.
>
> Yep. For a few cases it is hidden in BeginJob() and EndJob() but not for
> agent jobs.
>
> Michal
>
>


[PATCH] qemu.conf: Re-word the description for *_tls_x509_verify

2020-08-21 Thread Fangge Jin
The original descirption for *_tls_x509_verify is a little misleading
by saying that "Enabling this option will reject any client who does
not have a ca-cert.pem certificate".

Signed-off-by: Fangge Jin 
---
 src/qemu/qemu.conf | 20 
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index a96bedb114..b1bd3cecbd 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -109,9 +109,8 @@
 # issuing an x509 certificate to every client who needs to connect.
 #
 # Enabling this option will reject any client that does not have a
-# ca-cert.pem certificate signed by the CA in the vnc_tls_x509_cert_dir
-# (or default_tls_x509_cert_dir) as well as the corresponding client-*.pem
-# files described in default_tls_x509_cert_dir.
+# certificate(as described in default_tls_x509_verify) signed by the
+# CA in the vnc_tls_x509_cert_dir (or default_tls_x509_cert_dir).
 #
 # If this option is not supplied, it will be set to the value of
 # "default_tls_x509_verify".
@@ -248,9 +247,8 @@
 # issuing an x509 certificate to every client who needs to connect.
 #
 # Enabling this option will reject any client that does not have a
-# ca-cert.pem certificate signed by the CA in the chardev_tls_x509_cert_dir
-# (or default_tls_x509_cert_dir) as well as the corresponding client-*.pem
-# files described in default_tls_x509_cert_dir.
+# certificate(as described in default_tls_x509_verify) signed by the
+# CA in the chardev_tls_x509_cert_dir (or default_tls_x509_cert_dir).
 #
 # If this option is not supplied, it will be set to the value of
 # "default_tls_x509_verify".
@@ -375,9 +373,8 @@
 # issuing an x509 certificate to every client who needs to connect.
 #
 # Enabling this option will reject any client that does not have a
-# ca-cert.pem certificate signed by the CA in the migrate_tls_x509_cert_dir
-# (or default_tls_x509_cert_dir) as well as the corresponding client-*.pem
-# files described in default_tls_x509_cert_dir.
+# certificate(as described in default_tls_x509_verify) signed by the
+# CA in the migrate_tls_x509_cert_dir (or default_tls_x509_cert_dir).
 #
 # If this option is not supplied, it will be set to the value of
 # "default_tls_x509_verify".
@@ -412,9 +409,8 @@
 # issuing an x509 certificate to every client who needs to connect.
 #
 # Enabling this option will reject any client that does not have a
-# ca-cert.pem certificate signed by the CA in the backup_tls_x509_cert_dir
-# (or default_tls_x509_cert_dir) as well as the corresponding client-*.pem
-# files described in default_tls_x509_cert_dir.
+# certificate(as described in default_tls_x509_verify) signed by the
+# CA in the backup_tls_x509_cert_dir (or default_tls_x509_cert_dir).
 #
 # If this option is not supplied, it will be set to the value of
 # "default_tls_x509_verify".
-- 
2.20.1



[PATCH] docs: add kbase entry for migrationinternals

2020-08-20 Thread Fangge Jin
Commit c051e56d27 added migrationinternals.rst in kbase, but the
entry was missing.

Signed-off-by: Fangge Jin 
---
 docs/kbase.rst | 4 
 1 file changed, 4 insertions(+)

diff --git a/docs/kbase.rst b/docs/kbase.rst
index 78daaa5989..546be6785e 100644
--- a/docs/kbase.rst
+++ b/docs/kbase.rst
@@ -44,3 +44,7 @@ Knowledge base
 
`Incremental backup internals `__
   Incremental backup implementation details relevant for users
+
+   `VM migration internals `__
+  VM migration implementation details, complementing the info in
+  `migration `__
-- 
2.20.1



[PATCH] src: fix word spell typos

2020-07-08 Thread Fangge Jin
Signed-off-by: Fangge Jin 
---
 src/bhyve/libvirtd_bhyve.aug   | 2 +-
 src/cpu/cpu_arm.c  | 4 ++--
 src/esx/esx_vi.c   | 2 +-
 src/interface/interface_backend_udev.c | 4 ++--
 src/internal.h | 2 +-
 src/libvirt-domain.c   | 2 +-
 src/libvirt-nodedev.c  | 2 +-
 src/libxl/libxl_conf.c | 2 +-
 src/libxl/libxl_driver.c   | 2 +-
 src/libxl/libxl_logger.c   | 2 +-
 src/locking/libvirt_lockd.aug  | 2 +-
 src/locking/libvirt_sanlock.aug| 2 +-
 src/locking/virtlockd.aug  | 2 +-
 src/logging/virtlogd.aug   | 2 +-
 src/lxc/libvirtd_lxc.aug   | 2 +-
 src/lxc/lxc_native.c   | 2 +-
 src/lxc/lxc_process.c  | 2 +-
 src/node_device/node_device_udev.c | 2 +-
 src/qemu/qemu_agent.c  | 2 +-
 src/qemu/qemu_blockjob.c   | 2 +-
 src/qemu/qemu_capabilities.c   | 4 ++--
 src/qemu/qemu_command.c| 4 ++--
 src/qemu/qemu_conf.c   | 2 +-
 src/qemu/qemu_domain.c | 8 
 src/qemu/qemu_domain_address.c | 2 +-
 src/qemu/qemu_driver.c | 4 ++--
 src/qemu/qemu_hotplug.c| 2 +-
 src/qemu/qemu_migration.c  | 2 +-
 src/qemu/qemu_monitor.c| 2 +-
 src/qemu/qemu_qapi.c   | 4 ++--
 src/qemu/qemu_security.c   | 2 +-
 src/remote/libvirtd.aug.in | 2 +-
 src/remote/remote_daemon_dispatch.c| 2 +-
 src/rpc/virnetlibsshsession.c  | 4 ++--
 src/rpc/virnetserverprogram.c  | 2 +-
 src/rpc/virnetsshsession.c | 4 ++--
 src/storage/storage_util.c | 4 ++--
 src/util/virbuffer.h   | 2 +-
 src/util/vircommand.c  | 2 +-
 src/util/virdnsmasq.c  | 2 +-
 src/util/virhostcpu.c  | 2 +-
 src/util/virnetdev.c   | 2 +-
 src/util/virnetdevopenvswitch.c| 4 ++--
 src/util/virnetdevtap.c| 2 +-
 src/util/virqemu.c | 2 +-
 src/util/virresctrl.c  | 2 +-
 src/util/virsysinfo.c  | 2 +-
 src/util/virsystemd.c  | 2 +-
 src/util/virtpm.c  | 2 +-
 src/vbox/vbox_common.h | 2 +-
 src/vbox/vbox_network.c| 4 ++--
 src/vbox/vbox_snapshot_conf.c  | 4 ++--
 src/vbox/vbox_tmpl.c   | 2 +-
 src/vmx/vmx.c  | 2 +-
 src/vz/vz_driver.c | 2 +-
 src/vz/vz_sdk.c| 4 ++--
 56 files changed, 72 insertions(+), 72 deletions(-)

diff --git a/src/bhyve/libvirtd_bhyve.aug b/src/bhyve/libvirtd_bhyve.aug
index 66079376c4..b6bee261a6 100644
--- a/src/bhyve/libvirtd_bhyve.aug
+++ b/src/bhyve/libvirtd_bhyve.aug
@@ -24,7 +24,7 @@ module Libvirtd_bhyve =
 
let log_entry = str_entry "firmware_dir"
 
-   (* Each enty in the config is one of the following three ... *)
+   (* Each entry in the config is one of the following three ... *)
let entry = log_entry
let comment = [ label "#comment" . del /#[ \t]*/ "# " .  store /([^ 
\t\n][^\n]*)?/ . del /\n/ "\n" ]
let empty = [ label "#empty" . eol ]
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
index cd4f720c95..016d414143 100644
--- a/src/cpu/cpu_arm.c
+++ b/src/cpu/cpu_arm.c
@@ -528,9 +528,9 @@ virCPUarmCpuDataFromRegs(virCPUarmData *data)
 asm("mrs %0, MIDR_EL1" : "=r" (cpuid));
 VIR_DEBUG("CPUID read from register:  0x%016lx", cpuid);
 
-/* parse the coresponding part_id bits */
+/* parse the corresponding part_id bits */
 data->pvr = (cpuid >> 4) & 0xfff;
-/* parse the coresponding vendor_id bits */
+/* parse the corresponding vendor_id bits */
 data->vendor_id = (cpuid >> 24) & 0xff;
 
 hwcaps = getauxval(AT_HWCAP);
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 16690edfbe..7564ece7e9 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -3419,7 +3419,7 @@ esxVI_LookupFileInfoByDatastorePath(esxVI_Context *ctx,
 
 if (STREQ(directoryName, directoryAndFileName)) {
 /*
- * The  part of the datatore path didn't contain a '/', assume
+ * The  part of the datastore path didn't contain a '/', assume
  * that the  part is actually the file name.
  */
 datastorePathWithoutFileName = g_strdup_printf("[%s]", datastoreName);
diff --git a/src/interface/interface_backend_udev.c 
b/src/interface/interface_backend_udev.c
index e388f98536..670de48d52 100644
--- a/src/interface/interface_backend_udev.c
+++ b/src/interface/interface_backend_udev.c
@@ -653,7 +653,7 @@ udevGetIfaceDefBond(struct udev *udev,
 
 /* bonding/mode is in the format: "balance-rr 0" so we find