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

weiwei li weiweili821 at gmail.com
Mon Nov 3 04:22:44 UTC 2014


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:
1 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>
  <name>3cd4c349-e058-4a1a-8b3d-cc988efd11e2</name>
  <uuid>3cd4c349-e058-4a1a-8b3d-cc988efd11e2</uuid>
  <hostname>50e54929-059c-ffff-ffff-ffffffffffff_10.180.39.36</hostname>
  <hostuuid>50e54929-059c-ffff-ffff-ffffffffffff</hostuuid>
  <nbd port='49153'/>
</qemu-migration>

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>
  <name>3cd4c349-e058-4a1a-8b3d-cc988efd11e2</name>
  <uuid>3cd4c349-e058-4a1a-8b3d-cc988efd11e2</uuid>
  <hostname>50e54929-059c-ffff-ffff-ffffffffffff_10.180.39.36</hostname>
  <hostuuid>50e54929-059c-ffff-ffff-ffffffffffff</hostuuid>
  <feature name='persistent'/>
  <domain type='kvm'>
    <name>3cd4c349-e058-4a1a-8b3d-cc988efd11e2</name>
    <uuid>3cd4c349-e058-4a1a-8b3d-cc988efd11e2</uuid>
    <memory unit='KiB'>2097152</memory>
    <currentMemory unit='KiB'>2097152</currentMemory>
    <vcpu placement='static' cpuset='0-7'>2</vcpu>
    <os>
      <type arch='x86_64' machine='pc-i440fx-2.0'>hvm</type>
      <boot dev='hd'/>
    </os>
    <features>
      <acpi/>
      <apic/>
      <pae/>
    </features>
    <clock offset='localtime'/>
    <on_poweroff>destroy</on_poweroff>
    <on_reboot>restart</on_reboot>
    <on_crash>restart</on_crash>
    <devices>
      <emulator>/usr/bin/qemu-system-x86_64</emulator>
      <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>
      <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'/>
      </disk>
      <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'/>
      </interface>
      <serial type='pty'>
        <target port='0'/>
      </serial>
      <console type='pty'>
        <target type='serial' port='0'/>
      </console>
      <input type='mouse' bus='ps2'/>
      <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'>
        <listen type='address' address='0.0.0.0'/>
      </graphics>
      <video>
        <model type='cirrus' vram='9216' heads='1'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x02'
function='0x0'/>
      </video>
      <memballoon model='virtio'>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x06'
function='0x0'/>
      </memballoon>
    </devices>
  </domain>
  <nbd/>
</qemu-migration>
, cookieinlen=2567, cookieout=0x7f93722eab08, cookieoutlen=0x7f93722eab14,
flags=289, retcode=0

2014-10-31 18:05 GMT+08:00 Ján Tomko <jtomko at 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
> necessary?
>
> Jan
>
> >
> > Signed-off-by: Weiwei Li <nuonuoli at tencent.com <mailto:
> nuonuoli at 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)
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20141103/c42609da/attachment-0001.htm>


More information about the libvir-list mailing list