1. 26 3月, 2015 8 次提交
  2. 25 3月, 2015 32 次提交
    • P
      tests: qemuxml2xml: Test status XML formatting and parsing · 02f0f1cc
      Peter Krempa 提交于
      Recently we've fixed a bug where the status XML could not be parsed as
      the parser used absolute path XPath queries. This test enhancement tests
      all XML files used in the qemu-xml-2-xml test as a part of a status XML
      snippet to see whether they are parsed correctly. The status XML-2-XML is
      currently tested in 223 cases with this patch.
      02f0f1cc
    • P
      util: buffer: Add support for adding text blocks with indentation · 6ff59cbc
      Peter Krempa 提交于
      The current auto-indentation buffer code applies indentation only on
      complete strings. To allow adding a string containing newlines and
      having it properly indented this patch adds virBufferAddStr.
      6ff59cbc
    • G
      Don't validata filesystem target type · db1edae8
      Guido Günther 提交于
      When using QEMU's 9pfs the target "dir" element is not necessarily an
      absolute path but merely an arbitrary identifier. So validation in that
      case currently fails with the misleading
      
         $ virt-xml-validate /tmp/test.xml
         Relax-NG validity error : Extra element devices in interleave
         /tmp/test.xml:24: element devices: Relax-NG validity error : Element domain failed to validate content
         /tmp/test.xml fails to validate
      db1edae8
    • P
      rpc: Don't unref identity object while callbacks still can be executed · a98129c0
      Peter Krempa 提交于
      While this thread is cleaning up the client and connection objects:
       #2  virFileReadAll (path=0x7f28780012b0 "/proc/1319/stat", maxlen=maxlen@entry=1024, buf=buf@entry=0x7f289c60fc40) at util/virfile.c:1287
       #3  0x00007f28adbb1539 in virProcessGetStartTime (pid=<optimized out>, timestamp=timestamp@entry=0x7f289c60fc98) at util/virprocess.c:838
       #4  0x00007f28adb91981 in virIdentityGetSystem () at util/viridentity.c:151
       #5  0x00007f28ae73f17c in remoteClientFreeFunc (data=<optimized out>) at remote.c:1131
       #6  0x00007f28adcb7f33 in virNetServerClientDispose (obj=0x7f28aecad180) at rpc/virnetserverclient.c:858
       #7  0x00007f28adba8eeb in virObjectUnref (anyobj=<optimized out>) at util/virobject.c:265
       #8  0x00007f28ae74ad05 in virNetServerHandleJob (jobOpaque=<optimized out>, opaque=0x7f28aec93ff0) at rpc/virnetserver.c:205
       #9  0x00007f28adbbef4e in virThreadPoolWorker (opaque=opaque@entry=0x7f28aec88030) at util/virthreadpool.c:145
      
      In stack frame #6 the client->identity object got unref'd, but the code
      that removes the event callbacks in frame #5 did not run yet as we are
      trying to obtain the system identity (frames #4, #3, #2).
      
      In other thead:
       #0  virObjectUnref (anyobj=anyobj@entry=0x7f288c162c60) at util/virobject.c:264
              klass = 0xdeadbeef
              obj = 0x7f288c162c60
       #1  0x00007f28ae71c709 in remoteRelayDomainEventCheckACL (client=<optimized out>, conn=<optimized out>, dom=dom@entry=0x7f28aecaafc0) at remote.c:164
       #2  0x00007f28ae71fc83 in remoteRelayDomainEventTrayChange (conn=<optimized out>, dom=0x7f28aecaafc0, ... ) at remote.c:717
       #3  0x00007f28adc04e53 in virDomainEventDispatchDefaultFunc (conn=0x7f287c0009a0, event=0x7f28aecab1a0, ...) at conf/domain_event.c:1455
       #4  0x00007f28adc03831 in virObjectEventStateDispatchCallbacks (callbacks=<optimized out>, ....) at conf/object_event.c:724
       #5  virObjectEventStateQueueDispatch (callbacks=0x7f288c083730, queue=0x7fff51f90030, state=0x7f288c18da20) at conf/object_event.c:738
       #6  virObjectEventStateFlush (state=0x7f288c18da20) at conf/object_event.c:816
       #7  virObjectEventTimer (timer=<optimized out>, opaque=0x7f288c18da20) at conf/object_event.c:562
       #8  0x00007f28adb859cd in virEventPollDispatchTimeouts () at util/vireventpoll.c:459
      
      Frame #0 is unrefing an invalid identity object while frame #2 hints
      that the client is still dispatching the event.
      
      For untrimmed backtrace see the bugzilla attachment.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1203030
      a98129c0
    • P
      daemon: Clear fake domain def object that is used to check ACL prior to use · 6ca857c7
      Peter Krempa 提交于
      The fake object is used to pass the domain name and UUID to the ACL code
      for events where we don't have the full domain def when dispatching
      events. The rest of the entries would be left uninitialized. While this
      is not a problem code-wise as the used fields are initialized it looks
      ugly in the debugger.
      6ca857c7
    • P
      util: identity: Harden virIdentitySetCurrent() · ad886fa6
      Peter Krempa 提交于
      Don't unref the old identity unless we set the new one correctly and
      unref the new one on failure to set it so that we don't leak any
      references or use invalid pointers.
      ad886fa6
    • P
      tests: qemuxml2xml: Refactor the qemuxml2xml test · 785fd9fa
      Peter Krempa 提交于
      To allow adding more tests, refactor the XML-2-XML test so that the
      files are not reloaded always and clarify the control flow.
      
      Result of this changes is that the active and inactive portions of the
      XML are tested in separate steps rather than one test step.
      785fd9fa
    • P
      qemu: domain: Don't leak device alias list · 9d574aa2
      Peter Krempa 提交于
      While adding tests for status XML parsing and formatting I've noticed
      that the device alias list is leaked.
      
      ==763001== 81 (48 direct, 33 indirect) bytes in 1 blocks are definitely lost in loss record 414 of 514
      ==763001==    at 0x4C2B8F0: calloc (vg_replace_malloc.c:623)
      ==763001==    by 0x6ACF70F: virAllocN (viralloc.c:191)
      ==763001==    by 0x447B64: qemuDomainObjPrivateXMLParse (qemu_domain.c:727)
      ==763001==    by 0x6B848F9: virDomainObjParseXML (domain_conf.c:15491)
      ==763001==    by 0x6B84CAC: virDomainObjParseNode (domain_conf.c:15608)
      9d574aa2
    • P
      qemucaps2xmltest: fix test to successfully run without kvm support · 49bf09d1
      Pavel Hrdina 提交于
      Function virQEMUCapsInitGuestFromBinary detect kvm support by testing
      whether /dev/kvm exists or whether we pass path to kvmbin.  Provide the
      path we are testing via kvmbin for testing purpose instead of detecting
      presence of /dev/kvm to successfully run the tests on all hosts.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      49bf09d1
    • L
      qemu: Report better error when memory device source has wrong NUMA node · 726072f0
      Luyao Huang 提交于
      When starting a VM with hotpluggable memory devices the user may specify
      an invalid source NUMA node. Libvirt would pass through the error from
      qemu:
      
       # virsh start test3
       error: Failed to start domain test3
       error: internal error: process exited while connecting to monitor:
       2015-03-25T01:12:17.205913Z qemu-kvm: -object memory-backend-ram,id=memdimm0
       ,size=536870912,host-nodes=1-3,policy=bind: cannot bind memory to host NUMA nodes:
       Invalid argument
      
      This patch adds a check that allows to report better error:
      
       # virsh start test3
       error: Failed to start domain test3
       error: configuration unsupported: NUMA node 1 is unavailable
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      726072f0
    • P
      util: NUMA: Change error code in virNumaNodesetIsAvailable() · 8ad871f3
      Peter Krempa 提交于
      An invalid nodeset is a configuration problem rather than an internal
      error.
      8ad871f3
    • L
      conf: Add missing apostrophe to error message · 225f7bf7
      Luyao Huang 提交于
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      225f7bf7
    • P
      Makefile: fix typo · 3edbfc88
      Pavel Hrdina 提交于
      Commit 95695388 introduced new util/virthreadjob.c/h files but the
      makefile has type that breaks rpm build.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      3edbfc88
    • C
      docs: route element must specify network address · f276f055
      Chen Fan 提交于
      because network address is required by route, so
      here we should add one avoid user misunderstand.
      Signed-off-by: NChen Fan <chen.fan.fnst@cn.fujitsu.com>
      f276f055
    • C
      docs: no 'via' attribute in route element · 1c19c5ef
      Chen Fan 提交于
      via -> gateway
      Signed-off-by: NChen Fan <chen.fan.fnst@cn.fujitsu.com>
      1c19c5ef
    • J
      qemu: Add timing to domain jobs · f6fbd36f
      Jiri Denemark 提交于
      Whenever we fail to acquire a job, we can report how long ago it was
      locked by another API.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=853839Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      f6fbd36f
    • J
      qemu: Track the API which started the current job · b79f25e8
      Jiri Denemark 提交于
      This is very helpful when we want to log and report why we could not
      acquire a state change lock. Reporting what job keeps it locked helps
      with understanding the issue. Moreover, after calling
      virDomainGetControlInfo, it's possible to tell whether libvirt is just
      stuck somewhere within the API (or it just forgot to cleanup the job) or
      whether libvirt is waiting for QEMU to reply.
      
      The error message will look like the following:
      
          # virsh resume cd
          error: Failed to resume domain cd
          error: Timed out during operation: cannot acquire state change lock
          (held by remoteDispatchDomainSuspend)
      
      https://bugzilla.redhat.com/show_bug.cgi?id=853839Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      b79f25e8
    • J
      Set thread job for every RPC call · 667cce7b
      Jiri Denemark 提交于
      Since all APIs are also RPC calls, we automatically get all APIs covered
      with thread jobs.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      667cce7b
    • J
      virThreadPool: Set thread worker name · d20f5dde
      Jiri Denemark 提交于
      Every thread created as a worker thread within a pool gets a name
      according to virThreadPoolJobFunc name.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      d20f5dde
    • J
      virThread: Set thread job · 55ebc93a
      Jiri Denemark 提交于
      Automatically assign a job to every thread created by virThreadCreate.
      The name of the virThreadFunc function passed to virThreadCreate is used
      as the job or worker name in case no name is explicitly passed.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      55ebc93a
    • J
      Force usage of virThreadCreate · 23d0c979
      Jiri Denemark 提交于
      We want all threads to be set as workers or to have a job assigned to
      them, which can easily be achieved in virThreadCreate wrapper to
      pthread_create. Let's make sure we always use the wrapper.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      23d0c979
    • J
      Add support for tracking thread jobs · 95695388
      Jiri Denemark 提交于
      Each thread can use a thread local variable to keep the name of a job
      which is currently running in the job.
      
      The virThreadJobSetWorker API is supposed to be called once by any
      thread which is used as a worker, i.e., it is waiting in a pool, woken
      up to do a job, and returned back to the pool.
      
      The virThreadJobSet/virThreadJobClear APIs are to be called at the
      beginning/end of each job.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      95695388
    • J
      POTFILES.in: Sort · 61dda4f9
      Jiri Denemark 提交于
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      61dda4f9
    • J
      Document that USB hostdevs do not need nodeDettach · e600a37d
      Ján Tomko 提交于
      The virNodeDeviceDettach API only works on PCI devices.
      
      Originally added by commit 10d3272e, but the API never
      supported USB devices.
      
      Reported by: Martin Polednik <mpolednik@redhat.com>
      e600a37d
    • P
      6c7bdcb1
    • J
      libxl: remove per-domain libxl_ctx · a5bf06ba
      Jim Fehlig 提交于
      Although needed in the Xen 4.1 libxl days, there is no longer any
      benefit to having per-domain libxl_ctx.  On the contrary, their use
      makes the code unecessarily complicated and prone to deadlocks under
      load.  As suggested by the libxl maintainers, use a single libxl_ctx
      as a handle to libxl instead of per-domain ctx's.
      
      One downside to using a single libxl_ctx is there are no longer
      per-domain log files for log messages emitted by libxl.  Messages
      for all domains will be sent to /var/log/libvirt/libxl/libxl-driver.log.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      a5bf06ba
    • J
      libxl: make libxlDomainFreeMem static · 6728645a
      Jim Fehlig 提交于
      libxlDomainFreeMem() is only used in libxl_domain.c and thus should
      be declared static.  While at it, change the signature to take a
      libxl_ctx instead of libxlDomainObjPrivatePtr, since only the
      libxl_ctx is needed.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      6728645a
    • J
      libxl: remove unnecessary libxlDomainEventsRegister · 1cca1d25
      Jim Fehlig 提交于
      This function now only enables domain death events.  Simply call
      libxl_evenable_domain_death() instead of an unnecessary wrapper.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      1cca1d25
    • J
      libxl: use global libxl_ctx in event handler · 0b0a3d63
      Jim Fehlig 提交于
      Change the domain event handler code to use the driver-wide
      libxl_ctx instead of the domain-specific one.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      0b0a3d63
    • J
      libxl: move event registration to driver initialization · 109cf8d8
      Jim Fehlig 提交于
      Register a domain event handler with the driver-wide libxl_ctx
      during driver initialization.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      109cf8d8
    • J
      libxl: Move setup of child processing code to driver initialization · 331a02a7
      Jim Fehlig 提交于
      Informing libxl how to handle its child proceses should be done once
      during driver initialization, not once for each domain-specific
      libxl_ctx object.  The related libxl documentation in
      $xen-src/tools/libxl/libxl_event.h even mentions that "it is best to
      call this at initialisation".
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      331a02a7
    • J
      libxl: use driver-wide ctx in fd and timer event handling · 57db83ae
      Jim Fehlig 提交于
      Long ago I incorrectly associated libxl fd and timer registrations
      with per-domain libxl_ctx objects.  When creating a libxlDomainObjPrivate,
      a libxl_ctx is allocated, and libxl_osevent_register_hooks is called
      passing a pointer to the libxlDomainObjPrivate.  When an fd or timer
      registration occurred, the registration callback received the
      libxlDomainObjPrivate, containing the per-domain libxl_ctx.  This
      libxl_ctx was then used when informing libxl about fd events or
      timer expirations.
      
      The problem with this approach is that fd and timer registrations do not
      share the same lifespan as libxlDomainObjPrivate, and hence the per-domain
      libxl_ctx ojects.  The result is races between per-domain libxl_ctx's being
      destoryed and events firing on associated fds/timers, typically manifesting
      as an assert in libxl
      
      libxl_internal.h:2788: libxl__ctx_unlock: Assertion `!r' failed
      
      There is no need to associate libxlDomainObjPrivate objects with libxl's
      desire to use libvirt's event loop.  Instead, the driver-wide libxl_ctx can
      be used for the fd and timer registrations.
      
      This patch moves the fd and timer handling code away from the
      domain-specific code in libxl_domain.c into libxl_driver.c.  While at it,
      function names were changed a bit to better describe their purpose.
      
      The unnecessary locking was also removed since the code simply provides a
      wrapper over the event loop interface.  Indeed the locks may have been
      causing some deadlocks when repeatedly creating/destroying muliple domains.
      There have also been rumors about such deadlocks during parallel OpenStack
      Tempest runs.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      57db83ae