[dts] [PATCH V1 2/3][migration] framework: update code support migration

Wang, Yinan yinan.wang at intel.com
Thu Oct 10 10:04:04 CEST 2019


Acked-by: Wang, Yinan <yinan.wang at intel.com>

> -----Original Message-----
> From: Ma, LihongX
> Sent: 2019年10月10日 8:19
> To: dts at dpdk.org
> Cc: Wang, Yinan <yinan.wang at intel.com>; Ma, LihongX <lihongx.ma at intel.com>
> Subject: [dts][PATCH V1 2/3][migration] framework: update code support
> migration
> 
> Signed-off-by: lihong <lihongx.ma at intel.com>
> ---
>  framework/virt_base.py |  8 ++++++++
>  framework/virt_dut.py  | 12 ++++++++----
>  2 files changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/framework/virt_base.py b/framework/virt_base.py index
> 7c1e1de..6e3462c 100644
> --- a/framework/virt_base.py
> +++ b/framework/virt_base.py
> @@ -65,6 +65,8 @@ class VirtBase(object):
>          self.host_dut = dut
>          self.vm_name = vm_name
>          self.suite = suite_name
> +        # indicate whether the current vm is migration vm
> +        self.migration_vm = False
> 
>          # create self used host session, need close it later
>          self.host_session = self.host_dut.new_session(self.vm_name)
> @@ -330,6 +332,8 @@ class VirtBase(object):
>          """
>          try:
>              if self.vm_status is ST_PAUSE:
> +                # flag current vm is migration vm
> +                self.migration_vm = True
>                  # connect backup vm dut and it just inherited from host
>                  vm_dut = self.instantiate_vm_dut(set_target, cpu_topo,
> bind_dev=False, autodetect_topo=False)
>          except Exception as vm_except:
> @@ -419,9 +423,13 @@ class VirtBase(object):
>          vm_dut.host_dut = self.host_dut
>          vm_dut.host_session = self.host_session
>          vm_dut.init_log()
> +        vm_dut.migration_vm = self.migration_vm
> 
>          read_cache = False
>          skip_setup = self.host_dut.skip_setup
> +        # if current vm is migration vm, skip compile dpdk
> +        if self.migration_vm:
> +	        skip_setup = True
>          base_dir = self.host_dut.base_dir
>          vm_dut.set_speedup_options(read_cache, skip_setup)
> 
> diff --git a/framework/virt_dut.py b/framework/virt_dut.py index
> b6f40d8..e4394b9 100644
> --- a/framework/virt_dut.py
> +++ b/framework/virt_dut.py
> @@ -58,6 +58,7 @@ class VirtDut(DPDKdut):
>          self.hyper = hyper
>          self.cpu_topo = cpu_topo
>          self.dut_id = dut_id
> +        self.migration_vm = False
> 
>          self.vm_ip = crb['IP']
>          self.NAME = 'virtdut' + LOG_NAME_SEP + '%s' % self.vm_ip @@
> -186,10 +187,13 @@ class VirtDut(DPDKdut):
>          self.update_ports()
> 
>          # restore dut ports to kernel
> -        if self.virttype != 'XEN':
> -            self.restore_interfaces()
> -        else:
> -            self.restore_interfaces_domu()
> +        # if current vm is migration vm, skip restore dut ports
> +        # because there maybe have some app have run
> +        if not self.migration_vm:
> +            if self.virttype != 'XEN':
> +                self.restore_interfaces()
> +            else:
> +                self.restore_interfaces_domu()
>          # rescan ports after interface up
>          self.rescan_ports()
> 
> --
> 2.7.4



More information about the dts mailing list