You need to sign in or sign up before continuing.
  1. 21 6月, 2013 1 次提交
  2. 20 6月, 2013 1 次提交
  3. 14 6月, 2013 1 次提交
    • F
      Implement dispose method for libxlDomainObjPrivate · d58ce136
      Frediano Ziglio 提交于
      When creating a timer/event handler reference counting is used. So it could
      be possible (in theory) that libxlDomainObjPrivateFree is called with
      reference counting >1. The problem is that libxlDomainObjPrivateFree leave
      the object in an invalid state with ctx freed (but still having dandling
      pointer). This can lead timer/event handler to core.
      
      This patch implements a dispose method for libxlDomainObjPrivate, and moves
      freeing the libxl ctx to the dispose method, ensuring the ctx is valid while
      the object's reference count is > 0.
      Signed-off-by: NFrediano Ziglio <frediano.ziglio@citrix.com>
      d58ce136
  4. 12 6月, 2013 1 次提交
    • J
      libxl: Report connect type as Xen · 47d14c37
      Jim Fehlig 提交于
      Currently, the libxl driver reports a connection type of "xenlight".
      To be compatible with the legacy Xen driver, it should return "Xen".
      
      Note: I noticed this while testing the libxl driver on OpenStack.
      After switching my Xen compute nodes to use the libxl stack, I
      could no longer launch instances on those nodes since
      hypervisor_type was reported as "xenlight" instead of "xen".
      47d14c37
  5. 07 6月, 2013 1 次提交
  6. 03 6月, 2013 1 次提交
  7. 21 5月, 2013 1 次提交
  8. 17 5月, 2013 2 次提交
    • J
      libxl: fix leaking libxl events · a2619bb1
      Jim Fehlig 提交于
      libxl expects the event handler to free the event passed to it.  From
      libxl_event.h:
      
         event becomes owned by the application and must be freed, either
         by event_occurs or later
      a2619bb1
    • J
      libxl: fix build with Xen4.3 · 43b0ff5b
      Jim Fehlig 提交于
      Xen 4.3 fixes a mistake in the libxl event handler signature where the
      event owned by the application was defined as const.  Detect this and
      define the libvirt libxl event handler signature appropriately.
      43b0ff5b
  9. 11 5月, 2013 1 次提交
    • L
      util: fix virFileOpenAs return value and resulting error logs · a2c1bedb
      Laine Stump 提交于
      This resolves:
      
           https://bugzilla.redhat.com/show_bug.cgi?id=851411
           https://bugzilla.redhat.com/show_bug.cgi?id=955500
      
      The first problem was that virFileOpenAs was returning fd (-1) in one
      of the error cases rather than ret (-errno), so the caller thought
      that the error was EPERM rather than ENOENT.
      
      The second problem was that some log messages in the general purpose
      qemuOpenFile() function would always say "Failed to create" even if
      the caller hadn't included O_CREAT (i.e. they were trying to open an
      existing file).
      
      This fixes virFileOpenAs to jump down to the error return (which
      returns ret instead of fd) in the previously mentioned incorrect
      failure case of virFileOpenAs(), removes all error logging from
      virFileOpenAs() (since the callers report it), and modifies
      qemuOpenFile to appropriately use "open" or "create" in its log
      messages.
      
      NB: I seriously considered removing logging from all callers of
      virFileOpenAs(), but there is at least one case where the caller
      doesn't want virFileOpenAs() to log any errors, because it's just
      going to try again (qemuOpenFile()). We can't simply make a silent
      variation of virFileOpenAs() though, because qemuOpenFile() can't make
      the decision about whether or not it wants to retry until after
      virFileOpenAs() has already returned an error code.
      
      Likewise, I also considered changing virFileOpenAs() to return -1 with
      errno set on return, and may still do that, but only as a separate
      patch, as it obscures the intent of this patch too much.
      a2c1bedb
  10. 09 5月, 2013 1 次提交
  11. 08 5月, 2013 2 次提交
    • D
      Unmerge attach/update/modify device APIs in drivers · a605b7e0
      Daniel P. Berrange 提交于
      The LXC, QEMU, and LibXL drivers have all merged their handling of
      the attach/update/modify device APIs into one large
      
        'xxxxDomainModifyDeviceFlags'
      
      which then does a 'switch()' based on the actual API being invoked.
      While this saves some lines of code, it is not really all that
      significant in the context of the driver API impls as a whole.
      
      This merger of the handling of different APIs creates pain when
      wanting to automated analysis of the code and do things which
      are specific to individual APIs. The slight duplication of code
      from unmerged the API impls, is preferrable to allow for easier
      automated analysis.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      a605b7e0
    • D
      Separate virGetHostname() API contract from driver APIs · ead63031
      Daniel P. Berrange 提交于
      Currently the virGetHostname() API has a bogus virConnectPtr
      parameter. This is because virtualization drivers directly
      reference this API in their virDriverPtr tables, tieing its
      API design to the public virConnectGetHostname API design.
      
      This also causes problems for access control checks since
      these must only be done for invocations from the public
      API, not internal invocation.
      
      Remove the bogus virConnectPtr parameter, and make each
      hypervisor driver provide a dedicated function for the
      driver API impl. This will allow access control checks
      to be easily inserted later.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      ead63031
  12. 02 5月, 2013 1 次提交
    • M
      virutil: Move string related functions to virstring.c · 7c9a2d88
      Michal Privoznik 提交于
      The source code base needs to be adapted as well. Some files
      include virutil.h just for the string related functions (here,
      the include is substituted to match the new file), some include
      virutil.h without any need (here, the include is removed), and
      some require both.
      7c9a2d88
  13. 27 4月, 2013 1 次提交
    • B
      fix segfault during virsh save in pv guest · 91d1911c
      Bamvor Jian Zhang 提交于
      this patch fix the wrong sequence for fd and timeout register. the sequence
      was right in dfa1e1dd for fd register, but it changed in e0622ca2.
      in this patch, set priv, xl_priv in info and increase info->priv ref count
      before virEventAddHandle. if do this after virEventAddHandle, the fd
      callback or fd deregister maybe got the empty priv, xl_priv or wrong ref
      count.
      
      after apply this patch, test more than 100 rounds passed compare to fail
      within 3 rounds without this patch. each round includes define -> start ->
      destroy -> create -> suspend -> resume -> reboot -> shutdown -> save ->
      resotre -> dump -> destroy -> create -> setmem -> setvcpus -> destroy.
      Signed-off-by: NBamvor Jian Zhang <bjzhang@suse.com>
      91d1911c
  14. 24 4月, 2013 2 次提交
  15. 17 4月, 2013 1 次提交
    • O
      cleanup: Remove the duplicate header · bc95be5d
      Osier Yang 提交于
      Detected by a simple Shell script:
      
      for i in $(git ls-files -- '*.[ch]'); do
          awk 'BEGIN {
              fail=0
          }
          /# *include.*\.h/{
              match($0, /["<][^">]*[">]/)
              arr[substr($0, RSTART+1, RLENGTH-2)]++
          }
          END {
              for (key in arr) {
                  if (arr[key] > 1) {
                      fail=1
                      printf("%d %s\n", arr[key], key)
                  }
              }
              if (fail == 1)
                  exit 1
          }' $i
      
          if test $? != 0; then
              echo "Duplicate header(s) in $i"
          fi
      done;
      
      A later patch will add the syntax-check to avoid duplicate
      headers.
      bc95be5d
  16. 05 4月, 2013 5 次提交
    • P
      virCaps: get rid of defaultConsoleTargetType callback · 482e5f15
      Peter Krempa 提交于
      This patch refactors various places to allow removing of the
      defaultConsoleTargetType callback from the virCaps structure.
      
      A new console character device target type is introduced -
      VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE - to mark that no type was
      specified in the XML. This type is at the end converted to the standard
      VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL. Other types that are
      different from this default have to be processed separately in the
      device post parse callback.
      482e5f15
    • P
      virCaps: get rid of macPrefix field · 46becc18
      Peter Krempa 提交于
      Use the virDomainXMLConf structure to hold this data and tweak the code
      to avoid semantic change.
      
      Without configuration the KVM mac prefix is used by default. I chose it
      as it's in the privately administered segment so it should be usable for
      any purposes.
      46becc18
    • P
      conf callback: Rearrange function parameters · ad0d10b2
      Peter Krempa 提交于
      Move the xmlopt and caps arguments to the end of the argument list.
      ad0d10b2
    • P
      conf: Add post XML parse callbacks and prepare for cleaning of virCaps · 43b99fc4
      Peter Krempa 提交于
      This patch adds instrumentation that will allow hypervisor drivers to
      fill and validate domain and device definitions after parsed by the XML
      parser.
      
      With this patch, after the XML is parsed, a callback to the driver is
      issued requesting to fill and validate driver specific details of the
      configuration. This allows to use sensible defaults and checks on a per
      driver basis at the time the XML is parsed.
      
      Two callback pointers are stored in the new virDomainXMLConf object:
      * virDomainDeviceDefPostParseCallback (devicesPostParseCallback)
        - called for a single device parsed and for every single device in a
          domain config. A virDomainDeviceDefPtr is passed along with the
          domain definition and virCaps.
      
      * virDomainDefPostParseCallback, (domainPostParseCallback)
        - A callback that is meant to process the domain config after it's
        parsed.  A virDomainDefPtr is passed along with virCaps.
      
      Both types of callbacks support arbitrary opaque data passed for the
      callback functions.
      
      Errors may be reported in those callbacks resulting in a XML parsing
      failure.
      43b99fc4
    • P
      maint: Rename xmlconf to xmlopt and virDomainXMLConfig to virDomainXMLOption · e84b1931
      Peter Krempa 提交于
      This patch is the result of running:
      
      for i in $(git ls-files | grep -v html | grep -v \.po$ ); do
        sed -i -e "s/virDomainXMLConf/virDomainXMLOption/g" -e "s/xmlconf/xmlopt/g" $i
      done
      
      and a few manual tweaks.
      e84b1931
  17. 13 3月, 2013 1 次提交
    • P
      virCaps: conf: start splitting out irrelevat data · 27cf98e2
      Peter Krempa 提交于
      The virCaps structure gathered a ton of irrelevant data over time that.
      The original reason is that it was propagated to the XML parser
      functions.
      
      This patch aims to create a new data structure virDomainXMLConf that
      will contain immutable data that are used by the XML parser. This will
      allow two things we need:
      
      1) Get rid of the stuff from virCaps
      
      2) Allow us to add callbacks to check and add driver specific stuff
      after domain XML is parsed.
      
      This first attempt removes pointers to private data allocation functions
      to this new structure and update all callers and function that require
      them.
      27cf98e2
  18. 06 3月, 2013 1 次提交
    • J
      libxl_driver: Resolve Coverity errors · 40e90449
      John Ferlan 提交于
      1. The virObjectLock() call was unconditional, but Unlock was conditional
         on vm being valid.  Removed the check
      
      2. A call to virDomainEventNewFromObj() isn't guaranteed to return an
         event - that check needs to be made prior to libxlDomainEventQueue()
         of the event. Did not add libxlDriverLock/Unlock around the call since
         some callers already have lock taken
      
      3. Need to initialize fd = -1 in libxlDoDomainSave() since we can jump
         to cleanup before it's set.
      
      4. Missing break;'s in libxlDomainModifyDeviceFlags() for case
         LIBXL_DEVICE_UPDATE.  The default: case would report an error
      40e90449
  19. 08 2月, 2013 1 次提交
  20. 06 2月, 2013 1 次提交
    • D
      Merge virDomainObjListIsDuplicate into virDomainObjListAdd · eea87129
      Daniel P. Berrange 提交于
      The duplicate VM checking should be done atomically with
      virDomainObjListAdd, so shoud not be a separate function.
      Instead just use flags to indicate what kind of checks are
      required.
      
      This pair, used in virDomainCreateXML:
      
         if (virDomainObjListIsDuplicate(privconn->domains, def, 1) < 0)
           goto cleanup;
         if (!(dom = virDomainObjListAdd(privconn->domains,
                                         privconn->caps,
                                         def, false)))
           goto cleanup;
      
      Changes to
      
         if (!(dom = virDomainObjListAdd(privconn->domains,
                                         privconn->caps,
                                         def,
                                         VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                         NULL)))
           goto cleanup;
      
      This pair, used in virDomainRestoreFlags:
      
         if (virDomainObjListIsDuplicate(privconn->domains, def, 1) < 0)
           goto cleanup;
         if (!(dom = virDomainObjListAdd(privconn->domains,
                                         privconn->caps,
                                         def, true)))
           goto cleanup;
      
      Changes to
      
         if (!(dom = virDomainObjListAdd(privconn->domains,
                                         privconn->caps,
                                         def,
                                         VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
                                         VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                         NULL)))
           goto cleanup;
      
      This pair, used in virDomainDefineXML:
      
         if (virDomainObjListIsDuplicate(privconn->domains, def, 0) < 0)
           goto cleanup;
         if (!(dom = virDomainObjListAdd(privconn->domains,
                                         privconn->caps,
                                         def, false)))
           goto cleanup;
      
      Changes to
      
         if (!(dom = virDomainObjListAdd(privconn->domains,
                                         privconn->caps,
                                         def,
                                         0, NULL)))
           goto cleanup;
      eea87129
  21. 05 2月, 2013 2 次提交
  22. 26 1月, 2013 6 次提交
    • J
      libxl: Domain event handler improvements · 70291149
      Jim Fehlig 提交于
      Since libxl provides the domain ID in the event handler callback,
      find the domain object based on the ID.  This approach prevents
      processing the callback on a domain that has already been reaped.
      
      Also, similar to the xl implementation, ignore the SUSPEND shutdown
      reason.  By calling libxl_domain_suspend(), we know a shutdown
      event with SUSPEND reason will be generated, but it can be safely
      ignored since any subsequent cleanup will be done by the callers.
      70291149
    • J
      libxl: Fix removing non-persistent domain after save · 02ed255e
      Jim Fehlig 提交于
      libxlDoDomainSave() was removing non-persistent domains, but
      required callers to have the virDomainObj locked.  Callers could
      potentially unlock an already freed virDomainObj.  Move this
      logic to the callers of libxlDoDomainSave().
      02ed255e
    • J
      libxl: Explicitly remove timeouts · ce33422d
      Jim Fehlig 提交于
      I've noticed that libxl can invoke timeout reregister/modify hooks
      after returning from libxl_ctx_free.  Explicitly remove the
      timeouts before freeing the libxl ctx to avoid executing hooks on
      stale objects.
      ce33422d
    • J
      libxl: Fix race between destruction of objects · 889ce746
      Jim Fehlig 提交于
      It is possible to destroy and cleanup a VM, resulting in freeing the
      libxlDomainObjPrivate object and associated libxl ctx, before all fds and
      timeouts have been deregistered and destroyed.
      
      Fix this race by incrementing the reference count on libxlDomainObjPrivate
      for each fd and timeout registration.  Only when all fds and timeouts are
      deregistered and destroyed will the libxlDomainObjPrivate be destroyed.
      889ce746
    • J
      libxl: Fix races in libxl event code · e0622ca2
      Jim Fehlig 提交于
      The libxl driver is racy in it's interactions with libxl and libvirt's
      event loop.  The event loop can invoke callbacks after libxl has
      deregistered the event, and possibly access freed data associated with
      the event.
      
      This patch fixes the race by converting libxlDomainObjPrivate to a
      virObjectLockable, and locking it while executing libxl upcalls and
      libvirt event loop callbacks.
      
      Note that using the virDomainObj lock is not satisfactory since it may
      be desirable to hold the virDomainObj lock even when libxl events such
      as reading and writing to xenstore need processed.
      e0622ca2
    • J
      libxl: Fix handling of timeouts · 04172610
      Jim Fehlig 提交于
      xen-unstable changeset 26469 makes changes wrt modifying and deregistering
      timeouts.
      
      First, timeout modify callbacks will only be invoked with an
      abs_t of {0,0}, i.e. make the timeout fire immediately.  Prior to this
      commit, timeout modify callbacks were never invoked.
      
      Second, timeout deregister hooks will no longer be called.
      
      This patch makes changes in the libvirt libxl driver that should be
      compatible before and after changeset 26469.
      
      While at it, fix a potential overflow in the timeout register callback.
      04172610
  23. 17 1月, 2013 5 次提交