1. 25 9月, 2014 1 次提交
    • M
      Introduce virNodeAllocPages · fa5c5580
      Michal Privoznik 提交于
      A long time ago in a galaxy far, far away it has been decided
      that libvirt will manage not only domains but host as well. And
      with my latest work on qemu driver supporting huge pages, we miss
      the cherry on top: an API to allocate huge pages on the run.
      Currently users are forced to log into the host and adjust the
      huge pages pool themselves.  However, with this API the problem
      is gone - they can both size up and size down the pool.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      fa5c5580
  2. 24 9月, 2014 2 次提交
  3. 18 9月, 2014 1 次提交
  4. 15 9月, 2014 2 次提交
    • J
      daemon: Resolve Coverity FORWARD_NULL · 1f967758
      John Ferlan 提交于
      Coverity complains that the comparison:
      
        if (nfds && nfds > ((int)!!sock_path + (int)!!sock_path_ro))
      
      could mean 'sock_path' is NULL. Later in virNetSocketNewListenUNIX
      there's a direct dereference of path in the error path:
      
        if (path[0] != '@')
      
      A bit of sleuthing proves that upon entry to daemonSetupNetworking
      there is no way for 'sock_path' to be NULL since daemonUnixSocketPaths
      will set up 'sock_file' (although it may not set up 'sock_file_ro')
      in all 3 paths.
      
      Adjusted code to add ATTRIBUTE_NONNULL(3) on incoming path parameter and
      then fixup the comparison of nfds to be a comparison against 2 or 1
      depending on whether sock_path_ro is NULL or not.
      1f967758
    • M
      8035f2e6
  5. 12 9月, 2014 1 次提交
  6. 05 9月, 2014 1 次提交
    • E
      maint: use consistent if-else braces in remaining spots · d194d6e7
      Eric Blake 提交于
      I'm about to add a syntax check that enforces our documented
      HACKING style of always using matching {} on if-else statements.
      
      This patch focuses on all remaining problems, where there weren't
      enough issues to warrant splitting it further.
      
      * src/remote/remote_driver.c (doRemoteOpen): Correct use of {}.
      * src/security/virt-aa-helper.c (vah_add_path, valid_path, main):
      Likewise.
      * src/rpc/virnetsocket.c (virNetSocketNewConnectLibSSH2):
      Likewise.
      * src/esx/esx_vi_types.c (esxVI_Type_FromString): Likewise.
      * src/uml/uml_driver.c (umlDomainDetachDevice): Likewise.
      * src/util/viralloc.c (virShrinkN): Likewise.
      * src/util/virbuffer.c (virBufferURIEncodeString): Likewise.
      * src/util/virdbus.c (virDBusCall): Likewise.
      * src/util/virnetdev.c (virNetDevValidateConfig): Likewise.
      * src/util/virnetdevvportprofile.c
      (virNetDevVPortProfileGetNthParent): Likewise.
      * src/util/virpci.c (virPCIDeviceIterDevices)
      (virPCIDeviceWaitForCleanup)
      (virPCIDeviceIsBehindSwitchLackingACS): Likewise.
      * src/util/virsocketaddr.c (virSocketAddrGetNumNetmaskBits):
      Likewise.
      * src/util/viruri.c (virURIParseParams): Likewise.
      * daemon/stream.c (daemonStreamHandleAbort): Likewise.
      * tests/testutils.c (virtTestResult): Likewise.
      * tests/cputest.c (cpuTestBaseline): Likewise.
      * tools/virsh-domain.c (cmdDomPMSuspend): Likewise.
      * tools/virsh-host.c (cmdNodeSuspend): Likewise.
      * src/esx/esx_vi_generator.py (Type.generate_typefromstring):
      Tweak generated code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d194d6e7
  7. 04 9月, 2014 1 次提交
  8. 28 8月, 2014 2 次提交
  9. 27 8月, 2014 3 次提交
    • M
      vbox: Register per partes · dbb4cbf5
      Michal Privoznik 提交于
      Since times when vbox moved to the daemon (due to some licensing
      issue) the subdrivers that vbox implements were registered, but not
      opened since our generic subdrivers took priority. I've tried to fix
      this in 65b7d553 but it was not correct. Apparently moving
      vbox driver registration upfront changes the default connection URI
      which makes some users sad. So, this commit breaks vbox into pieces
      and register vbox's network and storage drivers first, and vbox driver
      then at the end. This way, the vbox driver is registered in the order
      it always was, but its subdrivers are registered prior the generic
      ones.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      dbb4cbf5
    • E
      API: Tweak virDomainOpenGraphics to return fd directly · b259e459
      Eric Blake 提交于
      Let's fix this before we bake in a painful API.  Since we know
      that we have exactly one non-negative fd on success, we might
      as well return the fd directly instead of forcing the user to
      pass in a pointer.  Furthermore, I found some memory and fd
      leaks while reviewing the code - the idea is that on success,
      libvirtd will have handed two fds in two different directions:
      one to qemu, and one to the RPC client.
      
      * include/libvirt/libvirt.h.in (virDomainOpenGraphicsFD): Drop
      unneeded parameter.
      * src/driver.h (virDrvDomainOpenGraphicsFD): Likewise.
      * src/libvirt.c (virDomainOpenGraphicsFD): Adjust interface to
      return fd directly.
      * daemon/remote.c (remoteDispatchDomainOpenGraphicsFd): Adjust
      semantics.
      * src/qemu/qemu_driver.c (qemuDomainOpenGraphicsFD): Likewise,
      and plug fd leak.
      * src/remote/remote_driver.c (remoteDomainOpenGraphicsFD):
      Likewise, and plug memory and fd leak.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b259e459
    • J
      Add RPC implementation for virDomainOpenGraphicsFd · 408aae38
      Ján Tomko 提交于
      408aae38
  10. 25 8月, 2014 1 次提交
    • Z
      daemon: Fix option -v missing info priority log · 9eac73eb
      Zhou Yimin 提交于
      Introduce by 63fbcc69.
      
      When start libvirtd with commandline "/usr/sbin/libvirtd -d -l -v",
      we expect verbose(info level) log if neither environment variable
      nor config file about logging controls is set. But in fact we can't
      get any info priority log in the default output file.
      
      The log priority of default output is VIR_LOG_DEFAULT(VIR_LOG_WARN),
      so the info log is filtered out.
      To record info priority log we must parse option -v before setting the
      default output.
      
      After this patch, we get all verbose log in the default output file.
      Signed-off-by: NZhou Yimin <zhouyimin@huawei.com>
      9eac73eb
  11. 22 8月, 2014 2 次提交
  12. 18 8月, 2014 1 次提交
    • M
      daemon: Fix driver registration ordering · 65b7d553
      Michal Privoznik 提交于
      There are some stateless drivers which implement subdrivers
      (typically vbox and its own network and storage subdrivers). However,
      as of ba5f3c7c the vbox driver lives in the daemon, not the
      client library. This means, in order for vbox (or any stateless domain
      driver) to use its subdrivers, it must register before the general
      drivers. Later, when the virConnectOpen function goes through the
      subdrivers, stateless drivers are searched first. If the connection
      request is aiming at stateless driver, it will be opened. Otherwise
      the generic subdriver is opened.
      
      The other change done in this commit is moving interface module load a
      bit earlier to match the ordering in case libvirt is built without
      driver modules.
      Reported-by: NTaowei Luo <uaedante@gmail.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      65b7d553
  13. 13 8月, 2014 2 次提交
    • P
      daemon: Limit default log level to journald to VIR_LOG_INFO · c018efa8
      Peter Krempa 提交于
      Libvirt is really chatty when the DEBUG log level is enabled. When a
      host uses journald we'd enable debug logging to journald when only
      specifying the debug log level. As journald may employ rate throttling
      this would lock up the daemon until it's able to flush all debug
      messages.
      
      This patch changes the default log level to VIR_LOG_INFO when using the
      default (unconfigured) log output to journald.
      
      To still allow debug logging to journald the user now has to explicitly
      specify journald as a log output with priority 1 in the "log_outputs"
      configuration option. This patch also changes the config file template
      to be explicit about this change and notify the user about the possible
      consequence of debug logging into journald.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1121955
      c018efa8
    • P
      libvirtd: conf: Mention support for logging into journald · 7b6228d1
      Peter Krempa 提交于
      Our docs didn't mention the explicit option to log into journald.
      7b6228d1
  14. 07 8月, 2014 1 次提交
  15. 27 6月, 2014 1 次提交
  16. 24 6月, 2014 3 次提交
    • J
      Rework remoteSerializeDHCPLease · 364586d3
      Ján Tomko 提交于
      Don't leak the temporary variables on success if NULL is returned
      for that field.
      
      Don't dereference NULL on failure to allocate some of the temporaries.
      
      Introduced by commit 990c3b65
      364586d3
    • D
      Change 'interface' to 'iface' in virNetworkDHCPLease · 6512c8b4
      Daniel P. Berrange 提交于
      Variables/fields named 'interface' clash with system
      header symbols on some platforms.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      6512c8b4
    • N
      net-dhcp-leases: Implement the remote protocol · 990c3b65
      Nehal J Wani 提交于
      Implement RPC calls for virNetworkGetDHCPLeases, virNetworkGetDHCPLeasesForMAC
      
      daemon/remote.c
         * Define remoteSerializeNetworkDHCPLeases,
                  remoteDispatchNetworkGetDHCPLeases
         * Define remoteDispatchNetworkGetDHCPLeasesForMAC
         * Define helper function remoteSerializeDHCPLease
      
      src/remote/remote_driver.c
         * Define remoteNetworkGetDHCPLeases
         * Define remoteNetworkGetDHCPLeasesForMAC
         * Define helper function remoteSerializeDHCPLease
      
      src/remote/remote_protocol.x
         * New RPC procedure: REMOTE_PROC_NETWORK_GET_DHCP_LEASES
         * Define structs remote_network_dhcp_leases, remote_network_get_dhcp_leases_args,
                          remote_network_get_dhcp_leases_ret
         * New RPC procedure: REMOTE_PROC_NETWORK_GET_DHCP_LEASES_FOR_MAC
         * Define structs remote_network_dhcp_leases_for_mac, remote_network_get_dhcp_leases_for_mac_args,
                          remote_network_get_dhcp_leases_for_mac_ret
      
      src/remote_protocol-structs
         * New structs added
      
      src/rpc/gendispatch.pl
         * Add exception (s/Dhcp/DHCP) for auto-generating names of the remote functions
           in daemon/remote_dispatch.h
      990c3b65
  17. 19 6月, 2014 2 次提交
    • M
      Introduce virNodeGetFreePages · 34f2d031
      Michal Privoznik 提交于
      The aim of the API is to get information on number of free pages
      on the system. The API behaves similar to the
      virNodeGetCellsFreeMemory(). User passes starting NUMA cell, the
      count of nodes that he's interested in, pages sizes (yes,
      multiple sizes can be queried at once) and the counts are
      returned in an array.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      34f2d031
    • E
      blockjob: use stable disk string in job event · 1bfe73a1
      Eric Blake 提交于
      When the block job event was first added, it was for block pull,
      where the active layer of the disk remains the same name.  It was
      also in a day where we only cared about local files, and so we
      always had a canonical absolute file name.  But two things have
      changed since then: we now have network disks, where determining
      a single absolute string does not really make sense; and we have
      two-phase jobs (copy and active commit) where the name of the
      active layer changes between the first event (ready, on the old
      name) and second (complete, on the pivoted name).
      
      Adam Litke reported that having an unstable string between events
      makes life harder for clients.  Furthermore, all of our API that
      operate on a particular disk of a domain accept multiple strings:
      not only the absolute name of the active layer, but also the
      destination device name (such as 'vda').  As this latter name is
      stable, even for network sources, it serves as a better string
      to supply in block job events.
      
      But backwards-compatibility demands that we should not change the
      name handed to users unless they explicitly request it.  Therefore,
      this patch adds a new event, BLOCK_JOB_2 (alas, I couldn't think of
      any nicer name - but at least Migrate2 and Migrate3 are precedent
      for a number suffix).  We must double up on emitting both old-style
      and new-style events according to what clients have registered for
      (see also how IOError and IOErrorReason emits double events, but
      there the difference was a larger struct rather than changed
      meaning of one of the struct members).
      
      Unfortunately, adding a new event isn't something that can easily
      be broken into pieces, so the commit is rather large.
      
      * include/libvirt/libvirt.h.in (virDomainEventID): Add a new id
      for VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2.
      (virConnectDomainEventBlockJobCallback): Document new semantics.
      * src/conf/domain_event.c (_virDomainEventBlockJob): Rename field,
      to ensure we catch all clients.
      (virDomainEventBlockJobNew): Add parameter.
      (virDomainEventBlockJobDispose)
      (virDomainEventBlockJobNewFromObj)
      (virDomainEventBlockJobNewFromDom)
      (virDomainEventDispatchDefaultFunc): Adjust clients.
      (virDomainEventBlockJob2NewFromObj)
      (virDomainEventBlockJob2NewFromDom): New functions.
      * src/conf/domain_event.h: Add new prototypes.
      * src/libvirt_private.syms (domain_event.h): Export new functions.
      * src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Generate two
      different events.
      * src/qemu/qemu_process.c (qemuProcessHandleBlockJob): Likewise.
      * src/remote/remote_protocol.x
      (remote_domain_event_block_job_2_msg): New struct.
      (REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_2): New RPC.
      * src/remote/remote_driver.c
      (remoteDomainBuildEventBlockJob2): New handler.
      (remoteEvents): Register new event.
      * daemon/remote.c (remoteRelayDomainEventBlockJob2): New handler.
      (domainEventCallbacks): Register new event.
      * tools/virsh-domain.c (vshEventCallbacks): Likewise.
      (vshEventBlockJobPrint): Adjust client.
      * src/remote_protocol-structs: Regenerate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1bfe73a1
  18. 02 6月, 2014 1 次提交
  19. 15 5月, 2014 1 次提交
    • M
      Introduce virDomain{Get,Set}Time APIs · 0abb3693
      Michal Privoznik 提交于
      These APIs allow users to get or set time in a domain, which may come
      handy if the domain has been resumed just recently and NTP is not
      configured or hasn't kicked in yet and the guest is running
      something time critical. In addition, NTP may refuse to re-set the clock
      if the skew is too big.
      
      In addition, new ACL attribute is introduced 'set_time'.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      0abb3693
  20. 25 4月, 2014 4 次提交
  21. 04 4月, 2014 1 次提交
    • N
      Fix Memory Leak in daemon/libvirtd.c · 34542473
      Nehal J Wani 提交于
      Fixes leak introduced by e562e82f
      
      ==4937== 64 bytes in 1 blocks are definitely lost in loss record 270 of 405
      ==4937==    at 0x4A06BE0: realloc (vg_replace_malloc.c:662)
      ==4937==    by 0x6FA41C4: __vasprintf_chk (vasprintf_chk.c:90)
      ==4937==    by 0x50C8D29: virVasprintfInternal (stdio2.h:199)
      ==4937==    by 0x50C8E3A: virAsprintfInternal (virstring.c:362)
      ==4937==    by 0x11D01A: main (libvirtd.c:1170)
      Signed-off-by: NJán Tomko <jtomko@redhat.com>
      34542473
  22. 25 3月, 2014 1 次提交
  23. 21 3月, 2014 2 次提交
    • E
      qemu: wire up RPC for qemu monitor events · e7708a1c
      Eric Blake 提交于
      These are the first async events in the qemu protocol, so this
      patch looks rather big compared to most RPC additions.  However,
      a large majority of this patch is just mechanical copy-and-paste
      from recently-added network events.  It didn't help that this
      is also the first virConnect rather than virDomain prefix
      associated with a qemu-specific API.
      
      * src/remote/qemu_protocol.x (qemu_*_domain_monitor_event_*): New
      structs and RPC messages.
      * src/rpc/gendispatch.pl: Adjust naming conventions.
      * daemon/libvirtd.h (daemonClientPrivate): Track qemu events.
      * daemon/remote.c (remoteClientFreeFunc): Likewise.
      (remoteRelayDomainQemuMonitorEvent)
      (qemuDispatchConnectDomainMonitorEventRegister)
      (qemuDispatchConnectDomainMonitorEventDeregister): New functions.
      * src/remote/remote_driver.c (qemuEvents): Handle qemu events.
      (doRemoteOpen): Register for events.
      (remoteNetworkBuildEventLifecycle)
      (remoteConnectDomainQemuMonitorEventRegister)
      (remoteConnectDomainQemuMonitorEventDeregister): New functions.
      * src/qemu_protocol-structs: Regenerate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e7708a1c
    • M
      95aed7fe
  24. 20 3月, 2014 1 次提交
  25. 18 3月, 2014 2 次提交
    • D
      Remove global log buffer feature entirely · c0c8c1d7
      Daniel P. Berrange 提交于
      A earlier commit changed the global log buffer so that it only
      records messages that are explicitly requested via the log
      filters setting. This removes the performance burden, and
      improves the signal/noise ratio for messages in the global
      buffer. At the same time though, it is somewhat pointless, since
      all the recorded log messages are already going to be sent to an
      explicit log output like syslog, stderr or the journal. The
      global log buffer is thus just duplicating this data on stderr
      upon crash.
      
      The log_buffer_size config parameter is left in the augeas
      lens to prevent breakage for users on upgrade. It is however
      completely ignored hereafter.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      c0c8c1d7
    • D
      Add virLogSource variables to all source files · 2835c1e7
      Daniel P. Berrange 提交于
      Any source file which calls the logging APIs now needs
      to have a VIR_LOG_INIT("source.name") declaration at
      the start of the file. This provides a static variable
      of the virLogSource type.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      2835c1e7