1. 21 3月, 2014 40 次提交
    • W
      cgroup: Fix start VMs coincidently failed · bfb29654
      Wang Yufei 提交于
      When I start multi VMs coincidently and any of the cgroup directories
      named machine doesn't exist. There's a chance that VM start failed because
      of creating directory failed:
      Unable to initialize /machine cgroup: File exists
      When the errno returned by mkdir in virCgroupMakeGroup is EEXIST,
      we should pass it through and continue to start the VM.
      Signed-off-by: NWang Yufei <james.wangyufei@huawei.com>
      bfb29654
    • D
      Allow caller to handle DBus error messages · edff187a
      Daniel P. Berrange 提交于
      The caller may not want all DBus error conditions to be turned
      into libvirt errors, so provide a way for the caller to get
      back the full DBusError object. They can then check the errors
      and only report those that they consider to be fatal.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      edff187a
    • D
      Introduce alternate way to encode/decode arrays in DBus messages · 2c646033
      Daniel P. Berrange 提交于
      Currently the DBus helper APIs require the values for an array
      to be passed inline in the variadic argument list. This change
      introduces support for passing arrays using a pointer to a plain
      C array of the basic type. This is of particular benefit for
      decoding messages when you don't know how many array elements
      are being received.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      2c646033
    • D
      Remove bogus call to dbus_set_error_from_message · 217ac43e
      Daniel P. Berrange 提交于
      The dbus_connection_send_with_reply_and_block method will
      automatically call dbus_set_error_from_message for us. We
      mistakenly thought we had todo it because of a flaw in the
      systemd unit test mock impl. The latter should have directly
      set the error object, instead of creating an error message
      object.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      217ac43e
    • D
      Remove bogus unref in virDBusMessageRead · dc7f3ffc
      Daniel P. Berrange 提交于
      The virDBusMessageRead method should not have side-effects on
      the message parameter passed in, so unref'ing it is wrong.
      The caller should unref only when they decided they are done
      with it.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      dc7f3ffc
    • D
      Add DBus helper methods for creating reply messages · bd93dea3
      Daniel P. Berrange 提交于
      The test suites often have to create DBus method reply messages
      with payloads. Create two helpers for simplifying the process
      of creating replies with payloads.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      bd93dea3
    • D
      Refactor dbus helper methods for method calls · 838d0b04
      Daniel P. Berrange 提交于
      Split the virDBusMethodCall method into a couple of new methods
      virDBusCall, virDBusCreateMethod and virDBusCreateMethodV.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      838d0b04
    • Z
      virlog: Modify virLogParseDefaultPriority's comment of return value · 835a1cdf
      Zhou Yimin 提交于
      virLogParseDefaultPriority's successful return value is the same as
      virLogSetDefaultPriority's successful return value. So it should be 0
      rather than the parsed log level.
      Signed-off-by: NZhou Yimin <zhouyimin@huawei.com>
      835a1cdf
    • J
      Fix typo in configure.ac · b7a5a6ab
      Ján Tomko 提交于
      s/profram/program/
      b7a5a6ab
    • J
      Define ISCSIADM unconditionally · 69ad6b57
      Ján Tomko 提交于
      Commit 5e1d5dde moved the functions using isciadm to util/viriscsi.c,
      but ISCSIADM was only defined when the iscsi backend was compiled in.
      
      Define it unconditionally to fix the build (and allow testing
      of viriscsi.c) even if iscsi backend is disabled.
      69ad6b57
    • J
      Check boot order on device attach · 585076c7
      Jiri Denemark 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1007754
      
      When attaching a new device, we need to check if its boot order
      configuration is compatible with current domain definition.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      585076c7
    • J
      conf: Introduce virDomainDeviceGetInfo API · 563a12b3
      Jiri Denemark 提交于
      The offset of virDomainDeviceInfo structure within a device definition
      varies with device type and some types do not contain the info structure
      at all. This new API makes it easier to access the info structure from a
      generic virDomainDeviceDef structure.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      563a12b3
    • J
      Pass action to virDomainDefCompatibleDevice · 1c131661
      Jiri Denemark 提交于
      When checking compatibility of a device with a domain definition, we
      should know what we're going to do with the device. Because we may need
      to check for different things when we're attaching a new device versus
      detaching an existing device.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      1c131661
    • J
      Fix usage of virDomainDefCompatibleDevice · 6dc75f56
      Jiri Denemark 提交于
      A device needs to be checked for compatibility with the domain
      definition it corresponds to. Specifically, for VIR_DOMAIN_AFFECT_CONFIG
      case we should check against persistent def rather than active def.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      6dc75f56
    • J
      qemu: Return meaningful error when qemu dies early · cfa7ceab
      Jiri Denemark 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=844378
      
      When qemu dies early after connecting to its monitor but before we
      actually try to read something from the monitor, we would just fail
      domain start with useless message:
      
          "An error occurred, but the cause is unknown"
      
      This is because the real error gets reported in a monitor EOF handler
      executing within libvirt's event loop.
      
      The fix is to take any error set in qemuMonitor structure and propagate
      it into the thread-local error when qemuMonitorClose is called and no
      thread-local error is set.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      cfa7ceab
    • J
      tests: Set abs_*dir in a consistent way · 11cb128f
      Jiri Denemark 提交于
      Use $(shell cd $(...) && pwd) to set abs_*dir variables similarly to
      what src/Makefile.am does.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      11cb128f
    • E
      qemu: allow filtering events by regex · 43b17dd4
      Eric Blake 提交于
      When listening for a subset of monitor events, it can be tedious
      to register for each event name in series; nicer is to register
      for multiple events in one go.  Implement a flag to use regex
      interpretation of the event filter.
      
      While at it, prove how much I hate the shift key, by adding a
      way to filter for 'shutdown' instead of 'SHUTDOWN'. :)
      
      * include/libvirt/libvirt-qemu.h
      (virConnectDomainQemuMonitorEventRegisterFlags): New enum.
      * src/libvirt-qemu.c (virConnectDomainQemuMonitorEventRegister):
      Document flags.
      * tools/virsh-domain.c (cmdQemuMonitorEvent): Expose them.
      * tools/virsh.pod (qemu-monitor-event): Document this.
      * src/conf/domain_event.c
      (virDomainQemuMonitorEventStateRegisterID): Add flags.
      (virDomainQemuMonitorEventFilter): Handle regex, and optimize
      client side.
      (virDomainQemuMonitorEventCleanup): Clean up regex.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      43b17dd4
    • E
      qemu: enable monitor event filtering by name · d0ba8dd7
      Eric Blake 提交于
      Filtering monitor events by name requires tracking the name for
      the duration of the filtering.  In order to free the name, I
      found it easiest to just piggyback on the user's freecb function,
      which gets called when the event is deregistered.
      
      For events without a name filter, we have the design of multiple
      client registrations sharing a common server registration, because
      the server side uses the same callback function and we reject
      duplicate use of the same function.  But with events in the mix,
      we want to be able to allow the same function pointer to be used
      with more than one event name.  The solution is to tweak the
      duplicate detection code to only act when there is no additional
      filtering; if name filtering is in use, there is exactly one
      client registration per server registration.  Yes, this means
      that there is no longer a bound on the number of server
      registrations possible, so a malicious client could repeatedly
      register for the same name event to exhaust server memory.  On
      the other hand, we already restricted monitor events to require
      write access (compared to normal events only needing read access),
      and separated it into the intentionally unsupported
      libvirt-qemu.so, with documentation that using this function is
      for debug purposes only; so it is not a security risk worth
      worrying about a client trying to abuse multiple registrations.
      
      * src/conf/domain_event.c (virDomainQemuMonitorEventData): New
      struct.
      (virDomainQemuMonitorEventFilter)
      (virDomainQemuMonitorEventCleanup): New functions.
      (virDomainQemuMonitorEventDispatchFunc)
      (virDomainQemuMonitorEventStateRegisterID): Use new struct.
      * src/conf/object_event.c (virObjectEventCallbackListCount)
      (virObjectEventCallbackListAddID)
      (virObjectEventCallbackListRemoveID)
      (virObjectEventCallbackListMarkDeleteID): Drop duplicate detection
      when filtering is in effect.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d0ba8dd7
    • E
      qemu: enable monitor event reporting · 3566599a
      Eric Blake 提交于
      Wire up all the pieces to send arbitrary qemu events to a
      client using libvirt-qemu.so.  If the extra bookkeeping of
      generating event objects even when no one is listening turns
      out to be noticeable, we can try to further optimize things
      by adding a counter for how many connections are using events,
      and only dump events when the counter is non-zero; but for
      now, I didn't think it was worth the code complexity.
      
      * src/qemu/qemu_driver.c
      (qemuConnectDomainQemuMonitorEventRegister)
      (qemuConnectDomainQemuMonitorEventDeregister): New functions.
      * src/qemu/qemu_monitor.h (qemuMonitorEmitEvent): New prototype.
      (qemuMonitorDomainEventCallback): New typedef.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONIOProcessEvent):
      Report events.
      * src/qemu/qemu_monitor.c (qemuMonitorEmitEvent): New function, to
      pass events through.
      * src/qemu/qemu_process.c (qemuProcessHandleEvent): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      3566599a
    • 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
    • E
      qemu: create object for qemu monitor events · 8059afca
      Eric Blake 提交于
      Create qemu monitor events as a distinct class to normal domain
      events, because they will be filtered differently.  For ease of
      review, the logic for filtering by event name is saved for a later
      patch.
      
      * src/conf/domain_event.c (virDomainQemuMonitorEventClass): New
      class.
      (virDomainEventsOnceInit): Register it.
      (virDomainQemuMonitorEventDispose, virDomainQemuMonitorEventNew)
      (virDomainQemuMonitorEventDispatchFunc)
      (virDomainQemuMonitorEventStateRegisterID): New functions.
      * src/conf/domain_event.h (virDomainQemuMonitorEventNew)
      (virDomainQemuMonitorEventStateRegisterID): New prototypes.
      * src/libvirt_private.syms (conf/domain_conf.h): Export them.
      8059afca
    • E
      qemu: virsh wrapper for qemu events · 88996de1
      Eric Blake 提交于
      Any new API deserves a good virsh wrapper :)
      
          qemu-monitor-event [<domain>] [<event>] [--pretty] [--loop] [--timeout <number>]
      
      Very similar to the previous work on 'virsh event'.  For an
      example session:
      
      $ virsh -c qemu:///system qemu-monitor-event --event SHUTDOWN&
      $ virsh -c qemu:///system start f18-live
      Domain f18-live started
      
      $ virsh -c qemu:///system destroy f18-live
      Domain f18-live destroyed
      
      event SHUTDOWN at 1391212552.026544 for domain f18-live: (null)
      events received: 1
      
      [1]+  Done                    virsh -c qemu:///system qemu-monitor-event --event SHUTDOWN
      $
      
      * tools/virsh-domain.c (cmdQemuMonitorEvent): New command.
      * tools/virsh.pod (qemu-monitor-event): Document it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      88996de1
    • E
      qemu: new API for tracking arbitrary monitor events · 26295203
      Eric Blake 提交于
      Several times in the past, qemu has implemented a new event,
      but libvirt has not yet caught up to reporting that event to
      the user applications.  While it is possible to track libvirt
      logs to see that an unknown event was received and ignored,
      it would be nicer to copy what 'virsh qemu-monitor-command'
      does, and expose this information to the end developer as
      one of our unsupported qemu-specific commands.
      
      If you find yourself needing to use this API for more than
      just development purposes, please ask on the libvirt list
      for a supported counterpart event to be added in libvirt.so.
      
      While the supported virConnectDomainEventRegisterAny() API
      takes an id which determines the signature of the callback,
      this version takes a string filter and always uses the same
      signature.  Furthermore, I chose to expose this as a new API
      instead of trying to add a new eventID at the top level, in
      part because the generic option lacks event name filtering,
      and in part because the normal domain event namespace should
      not be polluted by a qemu-only event.  I also added a flags
      argument; unused for now, but we might decide to use it to
      allow a user to request event names by glob or regex instead
      of literal match.
      
      This API intentionally requires full write access (while
      normal event registration is allowed on read-only clients);
      this is in part due to the fact that it should only be used
      by debugging situations, and in part because the design of
      per-event filtering in later patches ended up allowing for
      duplicate registrations that could potentially be abused to
      exhaust server memory - requiring write privileges means
      that such abuse will not serve as a denial of service attack
      against users with higher privileges.
      
      * include/libvirt/libvirt-qemu.h
      (virConnectDomainQemuMonitorEventCallback)
      (virConnectDomainQemuMonitorEventRegister)
      (virConnectDomainQemuMonitorEventDeregister): New prototypes.
      * src/libvirt-qemu.c (virConnectDomainQemuMonitorEventRegister)
      (virConnectDomainQemuMonitorEventDeregister): New functions.
      * src/libvirt_qemu.syms (LIBVIRT_QEMU_1.2.1): Export them.
      * src/driver.h (virDrvConnectDomainQemuMonitorEventRegister)
      (virDrvConnectDomainQemuMonitorEventDeregister): New callbacks.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      26295203
    • J
      Fix indentation in iscsi storage backend · 072357b0
      Ján Tomko 提交于
      072357b0
    • J
      Ignore missing files on pool refresh · ee640f44
      Ján Tomko 提交于
      If we cannot stat/open a file on pool refresh, returning -1 aborts
      the refresh and the pool is undefined.
      
      Only treat missing files as fatal unless VolOpenCheckMode is called
      with the VIR_STORAGE_VOL_OPEN_ERROR flag. If this flag is missing
      (when it's called from virStorageBackendProbeTarget in
      virStorageBackendFileSystemRefresh), only emit a warning and return
      -2 to let the caller skip over the file.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=977706
      ee640f44
    • J
      Ignore char devices in storage pools by default · 0edfc9ef
      Ján Tomko 提交于
      Without this, using /dev/mapper as a directory pool
      fails in virStorageBackendUpdateVolTargetInfoFD:
      cannot seek to end of file '/dev/mapper/control': Illegal seek
      
      Skip over character devices by default.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=710866
      0edfc9ef
    • J
      Add test for virISCSIScanTargets · 444122d9
      Ján Tomko 提交于
      444122d9
    • J
      Add test for virISCSIGetSession · c22e989d
      Ján Tomko 提交于
      Parse iscsiadm output with and without the recently introduced
      flashnode info. [1]
      
      This should check that commits like 57e17a74 (fixing [2]) do
      not break iscsiadm output parsing.
      
      [1] https://github.com/mikechristie/open-iscsi/commit/181af9a
      [2] https://bugzilla.redhat.com/show_bug.cgi?id=1067173
      c22e989d
    • J
      Move functions using iscsiadm to viriscsi.c · 5e1d5dde
      Ján Tomko 提交于
      Remove the 'StorageBackend' from names of the functions and fix
      indentation.
      5e1d5dde
    • J
      Remove storage pool from the arguments of a few functions · 55074071
      Ján Tomko 提交于
      virStorageBackendISCSISession only needs the path of the source
      device and virStorageBackendISCSIRescanLUNs doesn't need the pool
      at all.
      
      This will allow the functions to be moved to src/util.
      55074071
    • J
      Don't create iscsiadm command line in ISCSIPool{Start,Stop} · 20534275
      Ján Tomko 提交于
      Create ISCSIConnection{Login,Logout} wrappers for that.
      20534275
    • J
      Switch virCommandRunRegex to use virStringSplit · 7dbbad35
      Ján Tomko 提交于
      Instead of running the command asynchronously and reading the output
      via fgets, let virCommand collect the output and split it with
      virStringSplit.
      7dbbad35
    • J
      Move virStorageBackendRun to vircommand · f2cc4286
      Ján Tomko 提交于
      The only storage-specific parameter is the pool object, which
      is only used for passing to the callback function.
      f2cc4286
    • J
      Sort includes in storage_backend_iscsi.c · 845255a4
      Ján Tomko 提交于
      845255a4
    • M
      Require K&R styled curly braces around function bodies · 9b7ac663
      Martin Kletzander 提交于
      Although not explicitly requested, we are using K&R (or Kernel)
      indentation for curly braces around functions in HACKING file and most
      of the code.  Using grep -P, this patch add the syntax-check rule for
      it (while skipping all the false positives with foreach constructs).
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      9b7ac663
    • M
      95aed7fe
    • M
      cd4da711
    • M
    • M
    • M
      969c4f04