[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 2/2] qemu: migration: Ignore null ptr in qemuMigrationStopNBDServer

mig->nbd is initialized by qemuMigrationCookieXMLParse(called by qemuMigrationEatCookie),with a condition that
the nbd infomation contained in Cookie string. I found in debug info that qemuMigrationStartNBDServer had been called in 
qemuMigrationPrepareAny(mig->nbd not null), but at in qemuMigrationFinish qemuMigrationStopNBDServer can not really
stop nbd server bucause mig->nbd is not initialized(that is because cookie string does not contain nbd information ).

so ,there are two solutions:
qemuMigrationStopNBDServer  ignore mig->nbd null ptr
2 add cookie info for nbd same stage (that is lost in which stage i am not sure~ )

I choose an easy way solution 1 with least code changing, maybe is not google way :)

cookie log is like this:
2014-10-30 08:38:14.106+0000: 15078: debug : qemuMigrationRun:3254 : driver=0x7f936413cd40, vm=0x7f934400b850, cookiein=<qemu-migration>
  <nbd port='49153'/>

2014-10-30 08:39:12.527+0000: 15076: debug : virObjectRef:296 : OBJECT_REF: obj=0x7f9364138880
2014-10-30 08:39:12.527+0000: 15076: debug : qemuMigrationFinish:4507 : driver=0x7f936413cd40, dconn=0x7f9358002720, vm=0x7f935c002da0, cookiein=<qemu-migration>
  <feature name='persistent'/>
  <domain type='kvm'>
    <memory unit='KiB'>2097152</memory>
    <currentMemory unit='KiB'>2097152</currentMemory>
    <vcpu placement='static' cpuset='0-7'>2</vcpu>
      <type arch='x86_64' machine='pc-i440fx-2.0'>hvm</type>
      <boot dev='hd'/>
    <clock offset='localtime'/>
      <disk type='file' device='disk'>
        <driver name='qemu' type='qcow2' cache='none'/>
        <source file='/tvm/tvm/3cd4c349-e058-4a1a-8b3d-cc988efd11e2/tlinux1.2-tvm-64bit-2.2-20140716_incremental.qcow2'/>
        <target dev='vda' bus='virtio'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
      <disk type='file' device='disk'>
        <driver name='qemu' type='qcow2' cache='none'/>
        <source file='/tvm/tvm/3cd4c349-e058-4a1a-8b3d-cc988efd11e2/EXT3_50G.qcow2_incremental.qcow2'/>
        <target dev='vdb' bus='virtio'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
      <interface type='bridge'>
        <mac address='54:52:00:02:b2:32'/>
        <source bridge='br1'/>
        <model type='virtio'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
      <serial type='pty'>
        <target port='0'/>
      <console type='pty'>
        <target type='serial' port='0'/>
      <input type='mouse' bus='ps2'/>
      <graphics type='vnc' port='-1' autoport='yes' listen=''>
        <listen type='address' address=''/>
        <model type='cirrus' vram='9216' heads='1'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
      <memballoon model='virtio'>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
, cookieinlen=2567, cookieout=0x7f93722eab08, cookieoutlen=0x7f93722eab14, flags=289, retcode=0

2014-10-31 18:05 GMT+08:00 Ján Tomko <jtomko redhat com>:
On 10/31/2014 09:17 AM, weiwei li wrote:
> qemuMigrationCookiePtr mig->nbd may be null when MigrationCookie
> do not have nbd information ,but nbd port did allocated before and
> must be released here, so ignore mig->nbd null ptr and just warn.

StartNBDServer is only run when mig->nbd is present, so if it's not there we
didn't start the server or allocate the port. Are you sure this patch is


> Signed-off-by: Weiwei Li <nuonuoli tencent com <mailto:nuonuoli tencent com>>
> ---
>  src/qemu/qemu_migration.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 0ad8054..134b041 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -1584,7 +1584,7 @@ qemuMigrationStopNBDServer(virQEMUDriverPtr driver,
>      qemuDomainObjPrivatePtr priv = vm->privateData;
>      if (!mig->nbd)
> -        return;
> +        VIR_WARN("mig->nbd is null");
>      if (qemuDomainObjEnterMonitorAsync(driver, vm,
>                                         QEMU_ASYNC_JOB_MIGRATION_IN) < 0)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]