1. 14 10月, 2013 1 次提交
  2. 11 10月, 2013 5 次提交
    • M
      qemu: Include listenAddress in debug prints · be651860
      Michal Privoznik 提交于
      After my patches, some functions gained one more argument
      (@listenAddress) which wasn't included in debug printing of
      arguments they were called with. Functions in question are:
      qemuMigrationPrepareDirect and qemuMigrationPerform.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      be651860
    • M
      qemu_migration: Avoid crashing if domain dies too quickly · c7ac2519
      Michal Privoznik 提交于
      I've noticed a SIGSEGV-ing libvirtd on the destination when the qemu
      died too quickly = in Prepare phase. What is happening here is:
      
      1) [Thread 3493] We are in qemuMigrationPrepareAny() and calling
      qemuProcessStart() which subsequently calls qemuProcessWaitForMonitor()
      and qemuConnectMonitor(). So far so good. The qemuMonitorOpen()
      succeeds, however switching monitor to QMP mode fails as qemu died
      meanwhile. That is qemuMonitorSetCapabilities() returns -1.
      
      2013-10-08 15:54:10.629+0000: 3493: debug : qemuMonitorSetCapabilities:1356 : mon=0x14a53da0
      2013-10-08 15:54:10.630+0000: 3493: debug : qemuMonitorJSONCommandWithFd:262 : Send command '{"execute":"qmp_capabilities","id":"libvirt-1"}' for write with FD -1
      2013-10-08 15:54:10.630+0000: 3493: debug : virEventPollUpdateHandle:147 : EVENT_POLL_UPDATE_HANDLE: watch=17 events=13
      ...
      2013-10-08 15:54:10.631+0000: 3493: debug : qemuMonitorSend:956 : QEMU_MONITOR_SEND_MSG: mon=0x14a53da0 msg={"execute":"qmp_capabilities","id":"libvirt-1"}
       fd=-1
      2013-10-08 15:54:10.631+0000: 3262: debug : virEventPollRunOnce:641 : Poll got 1 event(s)
      
      2) [Thread 3262] The event loop is trying to do the talking to monitor.
      However, qemu is dead already, remember?
      
      2013-10-08 15:54:13.436+0000: 3262: error : qemuMonitorIORead:551 : Unable to read from monitor: Connection reset by peer
      2013-10-08 15:54:13.516+0000: 3262: debug : virFileClose:90 : Closed fd 25
      ...
      2013-10-08 15:54:13.533+0000: 3493: debug : qemuMonitorSend:968 : Send command resulted in error internal error: early end of file from monitor: possible problem:
      
      3) [Thread 3493] qemuProcessStart() failed. No big deal. Go to the
      'endjob' label and subsequently to the 'cleanup'. Since the domain is
      not persistent and ret is -1, the qemuDomainRemoveInactive() is called.
      This has an (unpleasant) effect of virObjectUnref()-in the @vm object.
      Unpleasant because the event loop which is about to trigger EOF callback
      still holds a pointer to the @vm (not the reference). See the valgrind
      output below.
      
      4) [Thread 3262] So the event loop starts triggering EOF:
      
      2013-10-08 15:54:13.542+0000: 3262: debug : qemuMonitorIO:729 : Triggering EOF callback
      2013-10-08 15:54:13.543+0000: 3262: debug : qemuProcessHandleMonitorEOF:294 : Received EOF on 0x14549110 'migt10'
      
      And the monitor is cleaned up. This results in calling
      qemuProcessHandleMonitorEOF with the @vm pointer passed. The pointer is
      kept in qemuMonitor struct.
      
      ==3262== Thread 1:
      ==3262== Invalid read of size 4
      ==3262==    at 0x77ECCAA: pthread_mutex_lock (in /lib64/libpthread-2.15.so)
      ==3262==    by 0x52FAA06: virMutexLock (virthreadpthread.c:85)
      ==3262==    by 0x52E3891: virObjectLock (virobject.c:320)
      ==3262==    by 0x11626743: qemuProcessHandleMonitorEOF (qemu_process.c:296)
      ==3262==    by 0x11642593: qemuMonitorIO (qemu_monitor.c:730)
      ==3262==    by 0x52BD526: virEventPollDispatchHandles (vireventpoll.c:501)
      ==3262==    by 0x52BDD49: virEventPollRunOnce (vireventpoll.c:648)
      ==3262==    by 0x52BBC68: virEventRunDefaultImpl (virevent.c:274)
      ==3262==    by 0x542D3D9: virNetServerRun (virnetserver.c:1112)
      ==3262==    by 0x11F368: main (libvirtd.c:1513)
      ==3262==  Address 0x14549128 is 24 bytes inside a block of size 136 free'd
      ==3262==    at 0x4C2AF5C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==3262==    by 0x529B1FF: virFree (viralloc.c:580)
      ==3262==    by 0x52E3703: virObjectUnref (virobject.c:270)
      ==3262==    by 0x531557E: virDomainObjListRemove (domain_conf.c:2355)
      ==3262==    by 0x1160E899: qemuDomainRemoveInactive (qemu_domain.c:2061)
      ==3262==    by 0x1163A0C6: qemuMigrationPrepareAny (qemu_migration.c:2450)
      ==3262==    by 0x1163A923: qemuMigrationPrepareDirect (qemu_migration.c:2626)
      ==3262==    by 0x11682D71: qemuDomainMigratePrepare3Params (qemu_driver.c:10309)
      ==3262==    by 0x53B0976: virDomainMigratePrepare3Params (libvirt.c:7266)
      ==3262==    by 0x1502D3: remoteDispatchDomainMigratePrepare3Params (remote.c:4797)
      ==3262==    by 0x12DECA: remoteDispatchDomainMigratePrepare3ParamsHelper (remote_dispatch.h:5741)
      ==3262==    by 0x54322EB: virNetServerProgramDispatchCall (virnetserverprogram.c:435)
      
      The mon->vm is set in qemuMonitorOpenInternal() which is the correct
      place to increase @vm ref counter. The correct place to decrease the ref
      counter is then qemuMonitorDispose().
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      c7ac2519
    • M
      qemu_conf: Introduce "migration_address" · 1606d89c
      Michal Privoznik 提交于
      This configuration knob is there to override default listen address for
      -incoming for all qemu domains.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      1606d89c
    • M
    • M
      qemu: Introduce qemuDomainDefCheckABIStability · 7d704812
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=994364
      
      Whenever we check for ABI stability, we have new xml (e.g. provided by
      user, or obtained from snapshot, whatever) which we compare to old xml
      and see if ABI won't break. However, if the new xml was produced via
      virDomainGetXMLDesc(..., VIR_DOMAIN_XML_MIGRATABLE) it lacks some
      devices, e.g. 'pci-root' controller. Hence, the ABI stability check
      fails even though it is stable. Moreover, we can't simply fix
      virDomainDefCheckABIStability because removing the correct devices is
      task for the driver. For instance, qemu driver wants to remove the usb
      controller too, while LXC driver doesn't. That's why we need special
      qemu wrapper over virDomainDefCheckABIStability which removes the
      correct devices from domain XML, produces MIGRATABLE xml and calls the
      check ABI stability function.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      7d704812
  3. 10 10月, 2013 6 次提交
  4. 08 10月, 2013 1 次提交
  5. 07 10月, 2013 1 次提交
    • D
      Remove use of virConnectPtr from all remaining nwfilter code · 999d72fb
      Daniel P. Berrange 提交于
      The virConnectPtr is passed around loads of nwfilter code in
      order to provide it as a parameter to the callback registered
      by the virt drivers. None of the virt drivers use this param
      though, so it serves no purpose.
      
      Avoiding the need to pass a virConnectPtr means that the
      nwfilterStateReload method no longer needs to open a bogus
      QEMU driver connection. This addresses a race condition that
      can lead to a crash on startup.
      
      The nwfilter driver starts before the QEMU driver and registers
      some callbacks with DBus to detect firewalld reload. If the
      firewalld reload happens while the QEMU driver is still starting
      up though, the nwfilterStateReload method will open a connection
      to the partially initialized QEMU driver and cause a crash.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      999d72fb
  6. 04 10月, 2013 3 次提交
  7. 03 10月, 2013 3 次提交
    • L
      qemu: check actual netdev type rather than config netdev type during init · 9881bfed
      Laine Stump 提交于
      This resolves:
      
         https://bugzilla.redhat.com/show_bug.cgi?id=1012824
         https://bugzilla.redhat.com/show_bug.cgi?id=1012834
      
      Note that a similar problem was reported in:
      
         https://bugzilla.redhat.com/show_bug.cgi?id=827519
      
      but the fix only worked for <interface type='hostdev'>, *not* for
      <interface type='network'> where the network itself was a pool of
      hostdevs.
      
      The symptom in both cases was this error message:
      
         internal error: Unable to determine device index for network device
      
      In both cases the cause was lack of proper handling for netdevs
      (<interface>) of type='hostdev' when scanning the netdev list looking
      for alias names in qemuAssignDeviceNetAlias() - those that aren't
      type='hostdev' have an alias of the form "net%d", while those that are
      hostdev use "hostdev%d". This special handling was completely lacking
      prior to the fix for Bug 827519 which was:
      
      When searching for the highest alias index, libvirt looks at the alias
      for each netdev and if it is type='hostdev' it ignores the entry. If
      the type is not hostdev, then it expects the "net%d" form; if it
      doesn't find that, it fails and logs the above error message.
      
      That fix works except in the case of <interface type='network'> where
      the network uses hostdev (i.e. the network is a pool of VFs to be
      assigned to the guests via PCI passthrough). In this case, the check
      for type='hostdev' would fail because it was done as:
      
           def->net[i]->type == VIR_DOMAIN_NET_TYPE_HOSTDEV
      
      (which compares what was written in the config) when it actually
      should have been:
      
          virDomainNetGetActualType(def->net[i]) == VIR_DOMAIN_NET_TYPE_HOSTDEV
      
      (which compares the type of netdev that was actually allocated from
      the network at runtime).
      
      Of course the latter wouldn't be of any use if the netdevs of
      type='network' hadn't already acquired their actual network connection
      yet, but manual examination of the code showed that this is never the
      case.
      
      While looking through qemu_command.c, two other places were found to
      directly compare the net[i]->type field rather than getting actualType:
      
      * qemuAssignDeviceAliases() - in this case, the incorrect comparison
        would cause us to create a "net%d" alias for a netdev with
        type='network' but actualType='hostdev'. This alias would be
        subsequently overwritten by the proper "hostdev%d" form, so
        everything would operate properly, but a string would be
        leaked. This patch also fixes this problem.
      
      * qemuAssignDevicePCISlots() - would defer assigning a PCI address to
        a netdev if it was type='hostdev', but not for type='network +
        actualType='hostdev'. In this case, the actual device usually hasn't
        been acquired yet anyway, and even in the case that it has, there is
        no practical difference between assigning a PCI address while
        traversing the netdev list or while traversing the hostdev
        list. Because changing it would be an effective NOP (but potentially
        cause some unexpected regression), this usage was left unchanged.
      9881bfed
    • M
      qemuMonitorJSONSendKey: Avoid double free · 3e8343e1
      Michal Privoznik 提交于
      After successful @cmd construction the memory where @keys points to is
      part of @cmd. Avoid double freeing it.
      3e8343e1
    • M
      qemuMonitorJSONGetVirtType: Fix error message · ec07a9e8
      Michal Privoznik 提交于
      When querying for kvm, we try to find 'enabled' field. Hence the error
      message should report we haven't found 'enabled' and not 'running'
      (which is not even in the reply). Probably a typo or copy-paste error.
      ec07a9e8
  8. 02 10月, 2013 1 次提交
  9. 01 10月, 2013 2 次提交
  10. 30 9月, 2013 1 次提交
  11. 27 9月, 2013 2 次提交
  12. 26 9月, 2013 1 次提交
  13. 25 9月, 2013 13 次提交