1. 29 10月, 2014 1 次提交
    • E
      maint: avoid static zero init in drivers · ec81cf89
      Eric Blake 提交于
      C guarantees that static variables are zero-initialized.  Some older
      compilers (and also gcc -fno-zero-initialized-in-bss) create larger
      binaries if you explicitly zero-initialize a static variable.
      
      * src/libxl/libxl_driver.c: Fix initialization.
      * src/lxc/lxc_controller.c: Likewise.
      * src/openvz/openvz_util.c (openvzKBPerPages): Likewise.
      * src/phyp/phyp_driver.c: Likewise.
      * src/remote/remote_driver.c: Likewise.
      * src/test/test_driver.c: Likewise.
      * src/uml/uml_driver.c: Likewise.
      * src/vbox/vbox_XPCOMCGlue.c: Likewise.
      * src/vbox/vbox_tmpl.c: Likewise.
      * src/xen/xen_driver.c: Likewise.
      * src/xen/xen_hypervisor.c: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      ec81cf89
  2. 23 10月, 2014 1 次提交
  3. 11 10月, 2014 1 次提交
    • J
      Xen: Defer setting default vram value to Xen drivers · 9320c3ff
      Jim Fehlig 提交于
      Allow the Xen drivers to determine default vram values.  Sane
      default vaules depend on the device model being used, so the
      drivers are in the best position to determine the defaults.
      
      For the legacy xen driver, it is best to maintain the existing
      logic for setting default vram values to ensure there are no
      regressions.  The libxl driver currently does not support
      configuring a video device.  Support will be added in a
      subsequent patch, where the benefit of this change will be
      reaped.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      9320c3ff
  4. 18 9月, 2014 2 次提交
  5. 20 8月, 2014 1 次提交
  6. 03 7月, 2014 2 次提交
    • J
      Use virBufferCheckError everywhere we report OOM error · 92a8e72f
      Ján Tomko 提交于
      Replace:
      if (virBufferError(&buf)) {
          virBufferFreeAndReset(&buf);
          virReportOOMError();
          ...
      }
      
      with:
      if (virBufferCheckError(&buf) < 0)
          ...
      
      This should not be a functional change (unless some callers
      misused the virBuffer APIs - a different error would be reported
      then)
      92a8e72f
    • J
      Report errors in virCapabilitiesFormatXML · 28b9be24
      Ján Tomko 提交于
      So far, we only report an error if formatting the siblings bitmap
      in NUMA topology fails.
      
      Be consistent and always report error in virCapabilitiesFormatXML.
      28b9be24
  7. 26 6月, 2014 1 次提交
    • J
      enhance hostdev mode 'capabilities' process · 01e508f3
      Jincheng Miao 提交于
      Currently, only LXC has hostdev mode 'capabilities' support,
      so the other drivers should forbid to define it in XML.
      The hostdev mode check is added to devicesPostParseCallback()
      for each hypervisor driver.
      
      But there are some drivers lack function devicesPostParseCallback(),
      so only add check for qemu, libxl, openvz, uml, xen, xenapi.
      Signed-off-by: NJincheng Miao <jmiao@redhat.com>
      01e508f3
  8. 29 4月, 2014 1 次提交
    • J
      xen: ensure /usr/sbin/xend exists before checking status · 4f70ae24
      Jim Fehlig 提交于
      With xend on the way out, installations may not even have
      /usr/sbin/xend, which results in the following error when the
      drivers are probed
      
      2014-04-28 18:21:19.271+0000: 22129: error : virCommandWait:2426 :
      internal error: Child process (/usr/sbin/xend status) unexpected exit
      status 127: libvirt:  error : cannot execute binary /usr/sbin/xend:
      No such file or directory
      
      Check for existence of /usr/sbin/xend before trying to run it with
      the 'status' option.
      4f70ae24
  9. 08 4月, 2014 1 次提交
  10. 25 3月, 2014 1 次提交
  11. 21 3月, 2014 1 次提交
  12. 18 3月, 2014 1 次提交
  13. 15 3月, 2014 1 次提交
    • C
      XMLToNative: Parse XML as INACTIVE · fbf14e82
      Cole Robinson 提交于
      Right now we are parsing the XML as though it's live, which for example
      will choke on hardcoded XML like:
      
        <seclabel type='dynamic' model='selinux' relabel='yes'/>
      
      Erroring with:
      
        $ sudo virsh domxml-to-native qemu-argv f
        error: XML error: security label is missing
      
      All drivers are fixed, but only qemu was tested.
      fbf14e82
  14. 10 3月, 2014 1 次提交
  15. 04 3月, 2014 1 次提交
    • E
      util: make it easier to grab only regular command exit · b9dd878f
      Eric Blake 提交于
      Auditing all callers of virCommandRun and virCommandWait that
      passed a non-NULL pointer for exit status turned up some
      interesting observations.  Many callers were merely passing
      a pointer to avoid the overall command dying, but without
      caring what the exit status was - but these callers would
      be better off treating a child death by signal as an abnormal
      exit.  Other callers were actually acting on the status, but
      not all of them remembered to filter by WIFEXITED and convert
      with WEXITSTATUS; depending on the platform, this can result
      in a status being reported as 256 times too big.  And among
      those that correctly parse the output, it gets rather verbose.
      Finally, there were the callers that explicitly checked that
      the status was 0, and gave their own message, but with fewer
      details than what virCommand gives for free.
      
      So the best idea is to move the complexity out of callers and
      into virCommand - by default, we return the actual exit status
      already cleaned through WEXITSTATUS and treat signals as a
      failed command; but the few callers that care can ask for raw
      status and act on it themselves.
      
      * src/util/vircommand.h (virCommandRawStatus): New prototype.
      * src/libvirt_private.syms (util/command.h): Export it.
      * docs/internals/command.html.in: Document it.
      * src/util/vircommand.c (virCommandRawStatus): New function.
      (virCommandWait): Adjust semantics.
      * tests/commandtest.c (test1): Test it.
      * daemon/remote.c (remoteDispatchAuthPolkit): Adjust callers.
      * src/access/viraccessdriverpolkit.c (virAccessDriverPolkitCheck):
      Likewise.
      * src/fdstream.c (virFDStreamCloseInt): Likewise.
      * src/lxc/lxc_process.c (virLXCProcessStart): Likewise.
      * src/qemu/qemu_command.c (qemuCreateInBridgePortWithHelper):
      Likewise.
      * src/xen/xen_driver.c (xenUnifiedXendProbe): Simplify.
      * tests/reconnect.c (mymain): Likewise.
      * tests/statstest.c (mymain): Likewise.
      * src/bhyve/bhyve_process.c (virBhyveProcessStart)
      (virBhyveProcessStop): Don't overwrite virCommand error.
      * src/libvirt.c (virConnectAuthGainPolkit): Likewise.
      * src/openvz/openvz_driver.c (openvzDomainGetBarrierLimit)
      (openvzDomainSetBarrierLimit): Likewise.
      * src/util/virebtables.c (virEbTablesOnceInit): Likewise.
      * src/util/viriptables.c (virIpTablesOnceInit): Likewise.
      * src/util/virnetdevveth.c (virNetDevVethCreate): Fix debug
      message.
      * src/qemu/qemu_capabilities.c (virQEMUCapsInitQMP): Add comment.
      * src/storage/storage_backend_iscsi.c
      (virStorageBackendISCSINodeUpdate): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b9dd878f
  16. 05 2月, 2014 1 次提交
    • E
      event: move event filtering to daemon (regression fix) · 11f20e43
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1058839
      
      Commit f9f56340 for CVE-2014-0028 almost had the right idea - we
      need to check the ACL rules to filter which events to send.  But
      it overlooked one thing: the event dispatch queue is running in
      the main loop thread, and therefore does not normally have a
      current virIdentityPtr.  But filter checks can be based on current
      identity, so when libvirtd.conf contains access_drivers=["polkit"],
      we ended up rejecting access for EVERY event due to failure to
      look up the current identity, even if it should have been allowed.
      
      Furthermore, even for events that are triggered by API calls, it
      is important to remember that the point of events is that they can
      be copied across multiple connections, which may have separate
      identities and permissions.  So even if events were dispatched
      from a context where we have an identity, we must change to the
      correct identity of the connection that will be receiving the
      event, rather than basing a decision on the context that triggered
      the event, when deciding whether to filter an event to a
      particular connection.
      
      If there were an easy way to get from virConnectPtr to the
      appropriate virIdentityPtr, then object_event.c could adjust the
      identity prior to checking whether to dispatch an event.  But
      setting up that back-reference is a bit invasive.  Instead, it
      is easier to delay the filtering check until lower down the
      stack, at the point where we have direct access to the RPC
      client object that owns an identity.  As such, this patch ends
      up reverting a large portion of the framework of commit f9f56340.
      We also have to teach 'make check' to special-case the fact that
      the event registration filtering is done at the point of dispatch,
      rather than the point of registration.  Note that even though we
      don't actually use virConnectDomainEventRegisterCheckACL (because
      the RegisterAny variant is sufficient), we still generate the
      function for the purposes of documenting that the filtering
      takes place.
      
      Also note that I did not entirely delete the notion of a filter
      from object_event.c; I still plan on using that for my upcoming
      patch series for qemu monitor events in libvirt-qemu.so.  In
      other words, while this patch changes ACL filtering to live in
      remote.c and therefore we have no current client of the filtering
      in object_event.c, the notion of filtering in object_event.c is
      still useful down the road.
      
      * src/check-aclrules.pl: Exempt event registration from having to
      pass checkACL filter down call stack.
      * daemon/remote.c (remoteRelayDomainEventCheckACL)
      (remoteRelayNetworkEventCheckACL): New functions.
      (remoteRelay*Event*): Use new functions.
      * src/conf/domain_event.h (virDomainEventStateRegister)
      (virDomainEventStateRegisterID): Drop unused parameter.
      * src/conf/network_event.h (virNetworkEventStateRegisterID):
      Likewise.
      * src/conf/domain_event.c (virDomainEventFilter): Delete unused
      function.
      * src/conf/network_event.c (virNetworkEventFilter): Likewise.
      * src/libxl/libxl_driver.c: Adjust caller.
      * src/lxc/lxc_driver.c: Likewise.
      * src/network/bridge_driver.c: Likewise.
      * src/qemu/qemu_driver.c: Likewise.
      * src/remote/remote_driver.c: Likewise.
      * src/test/test_driver.c: Likewise.
      * src/uml/uml_driver.c: Likewise.
      * src/vbox/vbox_tmpl.c: Likewise.
      * src/xen/xen_driver.c: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      11f20e43
  17. 23 1月, 2014 1 次提交
    • E
      api: require write permission for guest agent interaction · 7f2d27d1
      Eric Blake 提交于
      I noticed that we allow virDomainGetVcpusFlags even for read-only
      connections, but that with a flag, it can require guest agent
      interaction.  It is feasible that a malicious guest could
      intentionally abuse the replies it sends over the guest agent
      connection to possibly trigger a bug in libvirt's JSON parser,
      or withhold an answer so as to prevent the use of the agent
      in a later command such as a shutdown request.  Although we
      don't know of any such exploits now (and therefore don't mind
      posting this patch publicly without trying to get a CVE assigned),
      it is better to err on the side of caution and explicitly require
      full access to any domain where the API requires guest interaction
      to operate correctly.
      
      I audited all commands that are marked as conditionally using a
      guest agent.  Note that at least virDomainFSTrim is documented
      as needing a guest agent, but that such use is unconditional
      depending on the hypervisor (so the existing domain:fs_trim ACL
      should be sufficient there, rather than also requirng domain:write).
      But when designing future APIs, such as the plans for obtaining
      a domain's IP addresses, we should copy the approach of this patch
      in making interaction with the guest be specified via a flag, and
      use that flag to also require stricter access checks.
      
      * src/libvirt.c (virDomainGetVcpusFlags): Forbid guest interaction
      on read-only connection.
      (virDomainShutdownFlags, virDomainReboot): Improve docs on agent
      interaction.
      * src/remote/remote_protocol.x
      (REMOTE_PROC_DOMAIN_SNAPSHOT_CREATE_XML)
      (REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS)
      (REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS, REMOTE_PROC_DOMAIN_REBOOT)
      (REMOTE_PROC_DOMAIN_SHUTDOWN_FLAGS): Require domain:write for any
      conditional use of a guest agent.
      * src/xen/xen_driver.c: Fix clients.
      * src/libxl/libxl_driver.c: Likewise.
      * src/uml/uml_driver.c: Likewise.
      * src/qemu/qemu_driver.c: Likewise.
      * src/lxc/lxc_driver.c: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7f2d27d1
  18. 20 1月, 2014 1 次提交
  19. 16 1月, 2014 1 次提交
    • E
      event: filter global events by domain:getattr ACL [CVE-2014-0028] · f9f56340
      Eric Blake 提交于
      Ever since ACL filtering was added in commit 76397360 (v1.1.1), a
      user could still use event registration to obtain access to a
      domain that they could not normally access via virDomainLookup*
      or virConnectListAllDomains and friends.  We already have the
      framework in the RPC generator for creating the filter, and
      previous cleanup patches got us to the point that we can now
      wire the filter through the entire object event stack.
      
      Furthermore, whether or not domain:getattr is honored, use of
      global events is a form of obtaining a list of networks, which
      is covered by connect:search_domains added in a93cd08f (v1.1.0).
      Ideally, we'd have a way to enforce connect:search_domains when
      doing global registrations while omitting that check on a
      per-domain registration.  But this patch just unconditionally
      requires connect:search_domains, even when no list could be
      obtained, based on the following observations:
      1. Administrators are unlikely to grant domain:getattr for one
      or all domains while still denying connect:search_domains - a
      user that is able to manage domains will want to be able to
      manage them efficiently, but efficient management includes being
      able to list the domains they can access.  The idea of denying
      connect:search_domains while still granting access to individual
      domains is therefore not adding any real security, but just
      serves as a layer of obscurity to annoy the end user.
      2. In the current implementation, domain events are filtered
      on the client; the server has no idea if a domain filter was
      requested, and must therefore assume that all domain event
      requests are global.  Even if we fix the RPC protocol to
      allow for server-side filtering for newer client/server combos,
      making the connect:serach_domains ACL check conditional on
      whether the domain argument was NULL won't benefit older clients.
      Therefore, we choose to document that connect:search_domains
      is a pre-requisite to any domain event management.
      
      Network events need the same treatment, with the obvious
      change of using connect:search_networks and network:getattr.
      
      * src/access/viraccessperm.h
      (VIR_ACCESS_PERM_CONNECT_SEARCH_DOMAINS)
      (VIR_ACCESS_PERM_CONNECT_SEARCH_NETWORKS): Document additional
      effect of the permission.
      * src/conf/domain_event.h (virDomainEventStateRegister)
      (virDomainEventStateRegisterID): Add new parameter.
      * src/conf/network_event.h (virNetworkEventStateRegisterID):
      Likewise.
      * src/conf/object_event_private.h (virObjectEventStateRegisterID):
      Likewise.
      * src/conf/object_event.c (_virObjectEventCallback): Track a filter.
      (virObjectEventDispatchMatchCallback): Use filter.
      (virObjectEventCallbackListAddID): Register filter.
      * src/conf/domain_event.c (virDomainEventFilter): New function.
      (virDomainEventStateRegister, virDomainEventStateRegisterID):
      Adjust callers.
      * src/conf/network_event.c (virNetworkEventFilter): New function.
      (virNetworkEventStateRegisterID): Adjust caller.
      * src/remote/remote_protocol.x
      (REMOTE_PROC_CONNECT_DOMAIN_EVENT_REGISTER)
      (REMOTE_PROC_CONNECT_DOMAIN_EVENT_REGISTER_ANY)
      (REMOTE_PROC_CONNECT_NETWORK_EVENT_REGISTER_ANY): Generate a
      filter, and require connect:search_domains instead of weaker
      connect:read.
      * src/test/test_driver.c (testConnectDomainEventRegister)
      (testConnectDomainEventRegisterAny)
      (testConnectNetworkEventRegisterAny): Update callers.
      * src/remote/remote_driver.c (remoteConnectDomainEventRegister)
      (remoteConnectDomainEventRegisterAny): Likewise.
      * src/xen/xen_driver.c (xenUnifiedConnectDomainEventRegister)
      (xenUnifiedConnectDomainEventRegisterAny): Likewise.
      * src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc): Likewise.
      * src/libxl/libxl_driver.c (libxlConnectDomainEventRegister)
      (libxlConnectDomainEventRegisterAny): Likewise.
      * src/qemu/qemu_driver.c (qemuConnectDomainEventRegister)
      (qemuConnectDomainEventRegisterAny): Likewise.
      * src/uml/uml_driver.c (umlConnectDomainEventRegister)
      (umlConnectDomainEventRegisterAny): Likewise.
      * src/network/bridge_driver.c
      (networkConnectNetworkEventRegisterAny): Likewise.
      * src/lxc/lxc_driver.c (lxcConnectDomainEventRegister)
      (lxcConnectDomainEventRegisterAny): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      f9f56340
  20. 08 1月, 2014 1 次提交
    • E
      maint: inline VIR_IS*_DOMAIN macro · c2aa14b4
      Eric Blake 提交于
      Cleanup after a previous patch, commit 6e130ddc.  In particular,
      note that xenDomainUsedCpus can only be reached from
      xenUnifiedDomainGetXMLDesc, which in turn is only reached from
      public API that already validated the domain.
      
      * src/xen/xen_driver.c (xenDomainUsedCpus): Drop redundant check.
      * src/datatypes.h (VIR_IS_DOMAIN, VIR_IS_CONNECTED_DOMAIN):
      Delete, and inline into all callers, since no other file uses it
      any more.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c2aa14b4
  21. 07 1月, 2014 1 次提交
    • E
      event: make deregister return value match docs · 31b5bad9
      Eric Blake 提交于
      Ever since their introduction (commit 1509b802 in v0.5.0 for
      virConnectDomainEventRegister, commit 44457238 in v0.8.0 for
      virConnectDomainEventDeregisterAny), the event deregistration
      functions have been documented as returning 0 on success;
      likewise for older registration (only the newer RegisterAny
      must return a non-zero callbackID).  And now that we are
      adding virConnectNetworkEventDeregisterAny for v1.2.1, it
      should have the same semantics.
      
      Fortunately, all of the stateful drivers have been obeying
      the docs and returning 0, thanks to the way the remote_driver
      tracks things (in fact, the RPC wire protocol is unable to
      send a return value for DomainEventRegisterAny, at least not
      without adding a new RPC number).  Well, except for vbox,
      which was always failing deregistration, due to failure to
      set the return value to anything besides its initial -1.
      
      But for local drivers, such as test:///default, we've been
      returning non-zero numbers; worse, the non-zero numbers have
      differed over time.  For example, in Fedora 12 (libvirt 0.8.2),
      calling Register twice would return 0 and 1 [the callbackID
      generated under the hood]; while in Fedora 20 (libvirt 1.1.3),
      it returns 1 and 2 [the number of callbacks registered for
      that event type].  Since we have changed the behavior over
      time, and since it differs by local vs. remote, we can safely
      argue that no one could have been reasonably relying on any
      particular behavior, so we might as well obey the docs, as well
      as prepare callers that might deal with older clients to not be
      surprised if the docs are not strictly followed.
      
      For consistency, this patch fixes the code for all drivers,
      even though it only makes an impact for vbox and for local
      drivers.  By fixing all drivers, future copy and paste from
      a remote driver to a local driver is less likely to
      reintroduce the bug.
      
      Finally, update the testsuite to gain some coverage of the
      issue for local drivers, including the first test of old-style
      domain event registration via function pointer instead of
      event id.
      
      * src/libvirt.c (virConnectDomainEventRegister)
      (virConnectDomainEventDeregister)
      (virConnectDomainEventDeregisterAny): Clarify docs.
      * src/libxl/libxl_driver.c (libxlConnectDomainEventRegister)
      (libxlConnectDomainEventDeregister)
      (libxlConnectDomainEventDeregisterAny): Match documentation.
      * src/lxc/lxc_driver.c (lxcConnectDomainEventRegister)
      (lxcConnectDomainEventDeregister)
      (lxcConnectDomainEventDeregisterAny): Likewise.
      * src/test/test_driver.c (testConnectDomainEventRegister)
      (testConnectDomainEventDeregister)
      (testConnectDomainEventDeregisterAny)
      (testConnectNetworkEventDeregisterAny): Likewise.
      * src/uml/uml_driver.c (umlConnectDomainEventRegister)
      (umlConnectDomainEventDeregister)
      (umlConnectDomainEventDeregisterAny): Likewise.
      * src/vbox/vbox_tmpl.c (vboxConnectDomainEventRegister)
      (vboxConnectDomainEventDeregister)
      (vboxConnectDomainEventDeregisterAny): Likewise.
      * src/xen/xen_driver.c (xenUnifiedConnectDomainEventRegister)
      (xenUnifiedConnectDomainEventDeregister)
      (xenUnifiedConnectDomainEventDeregisterAny): Likewise.
      * src/network/bridge_driver.c
      (networkConnectNetworkEventDeregisterAny): Likewise.
      * tests/objecteventtest.c (testDomainCreateXMLOld): New test.
      (mymain): Run it.
      (testDomainCreateXML): Check return values.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      31b5bad9
  22. 05 1月, 2014 1 次提交
    • E
      maint: improve VIR_ERR_NO_SUPPORT usage · baa72449
      Eric Blake 提交于
      We weren't very consistent in our use of VIR_ERR_NO_SUPPORT; many
      users just passed __FUNCTION__ on, while others passed "%s" to
      silence over-eager compilers that warn about __FUNCTION__ not
      containing any %.  It's nicer to route all these uses through
      a single macro, so that if we ever need to change the reporting,
      we can do it in one place.
      
      I verified that 'virsh -c test:///default qemu-monitor-command test foo'
      gives the same error message before and after this patch:
      error: this function is not supported by the connection driver: virDomainQemuMonitorCommand
      
      Note that in libvirt.c, we were inconsistent on whether virDomain*
      API used virLibConnError() (with VIR_FROM_NONE) or virLibDomainError()
      (with VIR_FROM_DOMAIN); this patch unifies these errors to all use
      VIR_FROM_NONE, on the grounds that it is unlikely that a caller
      learning that a call is unimplemented can do anything in particular
      with extra knowledge of which error domain it belongs to.
      
      One particular change to note is virDomainOpenGraphics which was
      trying to fail with VIR_ERR_NO_SUPPORT after a failed
      VIR_DRV_SUPPORTS_FEATURE check; all other places that fail a
      feature check report VIR_ERR_ARGUMENT_UNSUPPORTED.
      
      * src/util/virerror.h (virReportUnsupportedError): New macro.
      * src/libvirt-qemu.c: Use new macro.
      * src/libvirt-lxc.c: Likewise.
      * src/lxc/lxc_driver.c: Likewise.
      * src/security/security_manager.c: Likewise.
      * src/util/virinitctl.c: Likewise.
      * src/libvirt.c: Likewise.
      (virDomainOpenGraphics): Use correct error for unsupported feature.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      baa72449
  23. 10 12月, 2013 2 次提交
  24. 15 10月, 2013 1 次提交
    • E
      maint: avoid 'const fooPtr' in domain_conf · d2467709
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up offenders in src/conf/domain_conf, and their fallout.
      
      Several things to note: virObjectLock() requires a non-const
      argument; if this were C++, we could treat the locking field
      as 'mutable' and allow locking an otherwise 'const' object, but
      that is a more invasive change, so I instead dropped attempts
      to be const-correct on domain lookup.  virXMLPropString and
      friends require a non-const xmlNodePtr - this is because libxml2
      is not a const-correct library.  We could make the src/util/virxml
      wrappers cast away const, but I figured it was easier to not
      try to mark xmlNodePtr as const.  Finally, virDomainDeviceDefCopy
      was a rather hard conversion - it calls virDomainDeviceDefPostParse,
      which in turn in the xen driver was actually modifying the domain
      outside of the current device being visited.  We should not be
      adding a device on the first per-device callback, but waiting until
      after all per-device callbacks are complete.
      
      * src/conf/domain_conf.h (virDomainObjListFindByID)
      (virDomainObjListFindByUUID, virDomainObjListFindByName)
      (virDomainObjAssignDef, virDomainObjListAdd): Drop attempt at
      const.
      (virDomainDeviceDefCopy): Use intended type.
      (virDomainDeviceDefParse, virDomainDeviceDefPostParseCallback)
      (virDomainVideoDefaultType, virDomainVideoDefaultRAM)
      (virDomainChrGetDomainPtrs): Make const-correct.
      * src/conf/domain_conf.c (virDomainObjListFindByID)
      (virDomainObjListFindByUUID, virDomainObjListFindByName)
      (virDomainDeviceDefCopy, virDomainObjListAdd)
      (virDomainObjAssignDef, virDomainHostdevSubsysUsbDefParseXML)
      (virDomainHostdevSubsysPciOrigStatesDefParseXML)
      (virDomainHostdevSubsysPciDefParseXML)
      (virDomainHostdevSubsysScsiDefParseXML)
      (virDomainControllerModelTypeFromString)
      (virDomainTPMDefParseXML, virDomainTimerDefParseXML)
      (virDomainSoundCodecDefParseXML, virDomainSoundDefParseXML)
      (virDomainWatchdogDefParseXML, virDomainRNGDefParseXML)
      (virDomainMemballoonDefParseXML, virDomainNVRAMDefParseXML)
      (virSysinfoParseXML, virDomainVideoAccelDefParseXML)
      (virDomainVideoDefParseXML, virDomainHostdevDefParseXML)
      (virDomainRedirdevDefParseXML)
      (virDomainRedirFilterUsbDevDefParseXML)
      (virDomainRedirFilterDefParseXML, virDomainIdMapEntrySort)
      (virDomainIdmapDefParseXML, virDomainVcpuPinDefParseXML)
      (virDiskNameToBusDeviceIndex, virDomainDeviceDefCopy)
      (virDomainVideoDefaultType, virDomainHostdevAssignAddress)
      (virDomainDeviceDefPostParseInternal, virDomainDeviceDefPostParse)
      (virDomainChrGetDomainPtrs, virDomainControllerSCSINextUnit)
      (virDomainSCSIDriveAddressIsUsed)
      (virDomainDriveAddressIsUsedByDisk)
      (virDomainDriveAddressIsUsedByHostdev): Fix fallout.
      * src/openvz/openvz_driver.c (openvzDomainDeviceDefPostParse):
      Likewise.
      * src/libxl/libxl_domain.c (libxlDomainDeviceDefPostParse):
      Likewise.
      * src/qemu/qemu_domain.c (qemuDomainDeviceDefPostParse)
      (qemuDomainDefaultNetModel): Likewise.
      * src/lxc/lxc_domain.c (virLXCDomainDeviceDefPostParse):
      Likewise.
      * src/uml/uml_driver.c (umlDomainDeviceDefPostParse): Likewise.
      * src/xen/xen_driver.c (xenDomainDeviceDefPostParse): Split...
      (xenDomainDefPostParse): ...since per-device callback is not the
      time to be adding a device.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d2467709
  25. 26 9月, 2013 1 次提交
  26. 03 9月, 2013 1 次提交
  27. 07 8月, 2013 1 次提交
    • S
      xen: Use internal interfaces in xenDomainUsedCpus · d7a45bf2
      Stefan Bader 提交于
      Since commit 95e18efd most public interfaces (xenUnified...) obtain
      a virDomainDefPtr via xenGetDomainDefFor...() which take the unified
      lock.
      This is already taken before calling xenDomainUsedCpus(), so we get
      a deadlock for active guests. Avoid this by splitting up
      xenUnifiedDomainGetVcpusFlags() and xenUnifiedDomainGetVcpus() into
      public and private function calls (which get the virDomainDefPtr passed)
      and use those in xenDomainUsedCpus().
      
          xenDomainUsedCpus
            ...
            nb_vcpu = xenUnifiedDomainGetMaxVcpus(dom);
              return xenUnifiedDomainGetVcpusFlags(...)
                ...
                if (!(def = xenGetDomainDefForDom(dom)))
                  return xenGetDomainDefForUUID(dom->conn, dom->uuid);
                    ...
                    ret = xenHypervisorLookupDomainByUUID(conn, uuid);
                      ...
                      xenUnifiedLock(priv);
                      name = xenStoreDomainGetName(conn, id);
                      xenUnifiedUnlock(priv);
            ...
            if ((ncpus = xenUnifiedDomainGetVcpus(dom, cpuinfo, nb_vcpu,
              ...
              if (!(def = xenGetDomainDefForDom(dom)))
                [again like above]
      Signed-off-by: NStefan Bader <stefan.bader@canonical.com>
      d7a45bf2
  28. 29 7月, 2013 1 次提交
    • D
      Fix probing of legacy Xen driver to not leave URI set · b7caae92
      Daniel P. Berrange 提交于
      When the legacy Xen driver probes with a NULL URI, and
      finds itself running on Xen, it will set conn->uri. A
      little bit later though it checks to see if libxl support
      exists, and if so declines the driver. This leaves the
      conn->uri set to 'xen:///', so if libxl also declines
      it, it prevents probing of the QEMU driver.
      
      Once a driver has set the conn->uri, it must *never*
      decline an open request. So we must move the libxl
      check earlier
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      b7caae92
  29. 11 7月, 2013 1 次提交
  30. 10 7月, 2013 1 次提交
  31. 26 6月, 2013 1 次提交
  32. 25 6月, 2013 2 次提交
    • J
      Use 1.1.0 everywhere in the documentation · 11a5c957
      Ján Tomko 提交于
      Since we already have the v1.1.0-rc1 tag in git.
      11a5c957
    • L
      pci: change stubDriver from const char* to char* · 53e52b4a
      Laine Stump 提交于
      Previously stubDriver was always set from a string literal, so it was
      okay to use a const char * that wasn't freed when the virPCIDevice was
      freed. This will not be the case in the near future, so it is now a
      char* that is allocated in virPCIDeviceSetStubDriver() and freed
      during virPCIDeviceFree().
      53e52b4a
  33. 24 6月, 2013 1 次提交
  34. 22 6月, 2013 1 次提交
    • J
      xen: Implement virConnectGetSysinfo · 3a3b8f69
      Jim Fehlig 提交于
      virConnectGetSysinfo was never implemented in the legacy xen driver.
      This patch provides an implementation based on the qemu driver.
      3a3b8f69
  35. 24 5月, 2013 1 次提交
    • J
      xen: Resolve Coverity FORWARD_NULL issue · 677981d1
      John Ferlan 提交于
      Commit '18b14012' refactored the Xen code resulting in a Coverity
      warning about possible NULL reference if the path where the XM driver
      takes puts the def on it's list.  Moved/duplicated the virGetDomain()
      call to pacify the possible NULL deref.
      677981d1
  36. 23 5月, 2013 1 次提交