1. 02 7月, 2014 1 次提交
  2. 26 6月, 2014 1 次提交
  3. 19 6月, 2014 2 次提交
    • E
      virsh: expose new active commit controls · f182da20
      Eric Blake 提交于
      Add knobs to virsh to manage a 2-phase active commit of the top
      layer, similar to knobs already present on blockcopy.  While this
      code will fail until later patches actually implement the new
      knobs in the qemu driver, doing it now proves that the API is
      usable and also makes it easier for testing the qemu changes as
      they are made.
      
      * tools/virsh-domain.c (cmdBlockCommit): Add --active, --pivot,
      and --keep-overlay options, modeled after blockcopy.
      (blockJobImpl): Support --active flag.
      * tools/virsh.pod (blockcommit): Document new flags.
      (blockjob): Mention 2-phase commit interaction.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      f182da20
    • 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
  4. 13 6月, 2014 1 次提交
    • E
      virsh: improve blockcopy UI · 17840379
      Eric Blake 提交于
      Peter's review of an early version of my addition of active block
      commit pointed out some issues that I was copying from the block
      copy code; fix them up now before perpetuating them.
      
      For virsh commands that manage a single API call, it's nice to have
      a 1:1 mapping of options to flags, so that we can test that
      lower-layer software handles flag combinations correctly.  But where
      virsh is introducing syntactic sugar to combine multiple API calls
      into a single user interface, we might as well make that interface
      compact.  That is, we should allow the shorter command-line of
      'blockcopy $dom $disk --pivot' without having to explicitly specify
      --wait, because this isn't directly a flag passed to a single
      underlying API call.
      
      Also, my use of embedded ?: ternaries bordered on unreadable.
      
      * tools/virsh-domain.c (cmdBlockCopy): Make --pivot, --finish,
      and --timeout imply --wait. Drop excess ?: operators.
      * tools/virsh.pod (blockcopy): Update documentation.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      17840379
  5. 12 6月, 2014 2 次提交
  6. 11 6月, 2014 1 次提交
    • E
      blockcommit: document semantics of committing active layer · b2980250
      Eric Blake 提交于
      Now that qemu 2.0 allows commit of the active layer, people are
      attempting to use virsh blockcommit and getting into a stuck
      state, because libvirt is unprepared to handle the two-phase
      commit required by qemu.
      
      Stepping back a bit, there are two valid semantics for a
      commit operation:
      
      1. Maintain a 'golden' base, and a transient overlay. Make
      changes in the overlay, and if everything appears to work,
      commit those changes into the base, but still keep the overlay
      for the next round of changes; repeat the cycle as desired.
      
      2. Create an external snapshot, then back up the stable state
      in the backing file. Once the backup is complete, commit the
      overlay back into the base, and delete the temporary snapshot.
      
      Since qemu doesn't know up front which of the two styles is
      preferred, a block commit of the active layer merely gets
      the job into a synchronized state, and sends an event; then
      the user must either cancel (case 1) or complete (case 2),
      where qemu then sends a second event that actually ends the
      job.  However, until commit e6bcbcd3, libvirt was blindly
      assuming the semantics that apply to a commit of an
      intermediate image, where there is only one sane conclusion
      (the job automatically ends with fewer elements in the chain);
      and getting stuck because it wasn't prepared for qemu to enter
      a second phase of the job.
      
      This patch adds a flag to the libvirt API that a user MUST
      supply in order to acknowledge that they will be using two-phase
      semantics.  It might be possible to have a mode where if the
      flag is omitted, we automatically do the case 2 semantics on
      the user's behalf; but before that happens, I must do additional
      patches to track the fact that we are doing an active commit
      in the domain XML.  Later patches will add support of the flag,
      and once 2-phase semantics are working, we can then decide
      whether to relax things to allow an omitted flag to cause an
      automatic pivot.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_BLOCK_COMMIT_ACTIVE)
      (VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT): New enums.
      * src/libvirt.c (virDomainBlockCommit): Document two-phase job
      when committing active layer, through new flag.
      (virDomainBlockJobAbort): Document that pivot also occurs after
      active commit.
      * tools/virsh-domain.c (vshDomainBlockJob): Cover new job.
      * src/qemu/qemu_driver.c (qemuDomainBlockCommit): Explicitly
      reject active copy; later patches will add it in.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b2980250
  7. 06 6月, 2014 3 次提交
  8. 15 5月, 2014 1 次提交
    • L
      virsh: reject undefine --wipe-storage without also naming storage · ed595090
      Li Yang 提交于
      For now, if only '--wipe-storage' is assigned, user can undefine a
      domain normally. But actually '--wipe-storage' doesn't do anything,
      and this may confuse user. Better is to require that '--wipe-storage'
      only works if the user specifies volumes to be removed.
      
      Before:
      $ virsh undefine virt-tests-vm1 --wipe-storage
      Domain virt-tests-vm1 has been undefined
      
      After:
      $ virsh undefine virt-tests-vm1 --wipe-storage
      error: '--wipe-storage' requires '--storage <string>' or '--remove-all-storage'
      Signed-off-by: NLi Yang <liyang.fnst@cn.fujitsu.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      ed595090
  9. 13 5月, 2014 2 次提交
  10. 06 5月, 2014 1 次提交
  11. 31 3月, 2014 1 次提交
    • E
      virsh: fix 'help event' · 14d7fcc2
      Eric Blake 提交于
      'virsh help event' included a summary line "event - (null)"
      due to a misnamed info field.
      
      * tools/virsh-domain.c (info_event): Use correct name.
      * tools/virsh-network.c (info_network_event): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      14d7fcc2
  12. 25 3月, 2014 2 次提交
  13. 21 3月, 2014 3 次提交
    • C
      libvirt support to force convergence of live guest migration · 05e1b06a
      Chegu Vinod 提交于
      Busy enterprise workloads hosted on large sized VM's tend to dirty
      memory faster than the transfer rate achieved via live guest migration.
      Despite some good recent improvements (& using dedicated 10Gig NICs
      between hosts) the live migration may NOT converge.
      
      Recently support was added in qemu (version 1.6) to allow a user to
      choose if they wish to force convergence of their migration via a
      new migration capability : "auto-converge". This feature allows for qemu
      to auto-detect lack of convergence and trigger a throttle-down of the
      VCPUs.
      
      This patch includes the libvirt support needed to trigger this
      feature. (Testing is in progress)
      Signed-off-by: NChegu Vinod <chegu_vinod@hp.com>
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      05e1b06a
    • 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: 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
  14. 18 3月, 2014 2 次提交
    • M
      qemuDomainSetInterfaceParameters: Allow bandwidth clear out · 14973382
      Michal Privoznik 提交于
      We allow translation from no_bandwidth to has_bandwidth for a vnic.
      However, going in the opposite direction is not implemented. It's not
      limitation of the API rather than internal implementation. The problem
      is, we correctly detect that user hasn't specified any outbound (say
      he wants to clear out outbound). However, this gets overwritten by
      current vnic outbound settings. Then, virNetDevBandwidthSet doesn't
      change anything. We need to stop overwriting the outbound if users
      don't want us to. Same applies for inbound.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      14973382
    • M
      virsh: Add keepalive in new vshConnect function · 676cb4f4
      Martin Kletzander 提交于
      Introducing keepalive similarly to Guannan around 2 years ago.  Since
      we want to introduce keepalive for every connection, it makes sense to
      wrap the connecting function into new virsh one that can deal
      keepalive as well.
      
      Function vshConnect() is now used for connecting and keepalive added
      in that function (if possible) helps preventing long waits e.g. while
      nework goes down during migration.
      
      This patch also adds the options for keepalive tuning into virsh and
      fails connecting only when keepalives are explicitly requested and
      cannot be set (whether it is due to missing support in connected
      driver or remote server).  If not explicitely requested, a debug
      message is printed (hence the addition to virsh-optparse test).
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1073506
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=822839Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      676cb4f4
  15. 14 3月, 2014 1 次提交
  16. 04 3月, 2014 3 次提交
    • E
      virsh: report exit status of failed lxc-enter-namespace · 2ebf593a
      Eric Blake 提交于
      'virsh lxc-enter-namespace' does not have a way to reflect exit
      status to the caller in single-command mode, but we might as well
      at least report the exit status.  Prior to this patch,
      
      $ virsh -c lxc:/// lxc-enter-namespace shell /bin/sh 'exit 3'; echo $?
      1
      
      now it gives some details:
      
      $ virsh -c lxc:/// lxc-enter-namespace shell /bin/sh -c 'exit 3'; echo $?
      error: internal error: Child process (31557) unexpected exit status 3
      1
      
      Also useful:
      
      $ virsh -c lxc:/// lxc-enter-namespace shell /bin/sh -c 'kill $$'; echo $?
      error: internal error: Child process (31585) unexpected fatal signal 15
      1
      
      * tools/virsh-domain.c (cmdLxcEnterNamespace): Avoid magic numbers.
      Dispatch any error.
      * tools/virsh.pod: Document that non-zero exit status is collapsed.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      2ebf593a
    • E
      virFork: simplify semantics · 25f87817
      Eric Blake 提交于
      The old semantics of virFork() violates the priciple of good
      usability: it requires the caller to check the pid argument
      after use, *even when virFork returned -1*, in order to properly
      abort a child process that failed setup done immediately after
      fork() - that is, the caller must call _exit() in the child.
      While uses in virfile.c did this correctly, uses in 'virsh
      lxc-enter-namespace' and 'virt-login-shell' would happily return
      from the calling function in both the child and the parent,
      leading to very confusing results. [Thankfully, I found the
      problem by inspection, and can't actually trigger the double
      return on error without an LD_PRELOAD library.]
      
      It is much better if the semantics of virFork are impossible
      to abuse.  Looking at virFork(), the parent could only ever
      return -1 with a non-negative pid if it misused pthread_sigmask,
      but this never happens.  Up until this patch series, the child
      could return -1 with non-negative pid if it fails to set up
      signals correctly, but we recently fixed that to make the child
      call _exit() at that point instead of forcing the caller to do
      it.  Thus, the return value and contents of the pid argument are
      now redundant (a -1 return now happens only for failure to fork,
      a child 0 return only happens for a successful 0 pid, and a
      parent 0 return only happens for a successful non-zero pid),
      so we might as well return the pid directly rather than an
      integer of whether it succeeded or failed; this is also good
      from the interface design perspective as users are already
      familiar with fork() semantics.
      
      One last change in this patch: before returning the pid directly,
      I found cases where using virProcessWait unconditionally on a
      cleanup path of a virFork's -1 pid return would be nicer if there
      were a way to avoid it overwriting an earlier message.  While
      such paths are a bit harder to come by with my change to a direct
      pid return, I decided to keep the virProcessWait change in this
      patch.
      
      * src/util/vircommand.h (virFork): Change signature.
      * src/util/vircommand.c (virFork): Guarantee that child will only
      return on success, to simplify callers.  Return pid rather than
      status, now that the situations are always the same.
      (virExec): Adjust caller, also avoid open-coding process death.
      * src/util/virprocess.c (virProcessWait): Tweak semantics when pid
      is -1.
      (virProcessRunInMountNamespace): Adjust caller.
      * src/util/virfile.c (virFileAccessibleAs, virFileOpenForked)
      (virDirCreate): Likewise.
      * tools/virt-login-shell.c (main): Likewise.
      * tools/virsh-domain.c (cmdLxcEnterNamespace): Likewise.
      * tests/commandtest.c (test23): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      25f87817
    • E
      util: make it easier to grab only regular process exit · c72e76c3
      Eric Blake 提交于
      Right now, a caller waiting for a child process either requires
      the child to have status 0, or must use WIFEXITED() and friends
      itself.  But in many cases, we want the middle ground of treating
      fatal signals as an error, and directly accessing the normal exit
      value without having to use WEXITSTATUS(), in order to easily
      detect an expected non-zero exit status.  This adds the middle
      ground to the low-level virProcessWait; the next patch will add
      it to virCommand.
      
      * src/util/virprocess.h (virProcessWait): Alter signature.
      * src/util/virprocess.c (virProcessWait): Add parameter.
      (virProcessRunInMountNamespace): Adjust caller.
      * src/util/vircommand.c (virCommandWait): Likewise.
      * src/util/virfile.c (virFileAccessibleAs): Likewise.
      * src/lxc/lxc_container.c (lxcContainerHasReboot)
      (lxcContainerAvailable): Likewise.
      * daemon/libvirtd.c (daemonForkIntoBackground): Likewise.
      * tools/virt-login-shell.c (main): Likewise.
      * tools/virsh-domain.c (cmdLxcEnterNamespace): Likewise.
      * tests/testutils.c (virtTestCaptureProgramOutput): Likewise.
      * tests/commandtest.c (test23): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c72e76c3
  17. 01 3月, 2014 2 次提交
    • E
      virsh: add --all flag to 'event' command · 0e16ae40
      Eric Blake 提交于
      Similar to our event-test demo program, it's nice to be able to
      have a mode where we can sniff all events at once, rather than
      having to spawn multiple virsh in parallel with one for each
      event type.
      
      (Can I just say our RegisterAny design is lousy?  The fact that
      the majority of our callback pointers have a function signature
      with the opaque data in a different position, and that we have
      to cast the function signature before registering it, makes it
      hard to write a generic callback function; we have to write one
      for every type of event id.  Life would have been easier if we
      had designed the callback as a fixed signature with a void*
      and size parameter, and then allowed the caller to downcast
      the void* to a particular struct for data specific to their
      callback id, where we could have then had a single function
      with a switch statement for each event id, and register that
      one function for all types of events.  It would also be nicer
      if the callback functions knew which callbackID was being used
      when invoking that callback, so that I could use a common data
      structure among all registrations instead of having to create
      an array of one data per callback.  But I really don't want to
      go add yet another event API design.)
      
      * tools/virsh-domain.c (cmdEvent): Add --all parameter; convert
      all callbacks to support shared counter.
      * tools/virsh.pod (event): Document it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      0e16ae40
    • E
      virsh: support remaining domain events · bb4a9a52
      Eric Blake 提交于
      Earlier, I added 'virsh event' for lifecycle events, to get the
      concept approved; this patch finishes the support for all other
      events, although the user still has to register for one event
      type at a time.  A future patch may add an --all parameter to
      make it possible to register for all events through a single
      call.
      
      * tools/virsh-domain.c (vshDomainEventWatchdogToString)
      (vshDomainEventIOErrorToString, vshGraphicsPhaseToString)
      (vshGraphicsAddressToString, vshDomainBlockJobStatusToString)
      (vshDomainEventDiskChangeToString)
      (vshDomainEventTrayChangeToString, vshEventGenericPrint)
      (vshEventRTCChangePrint, vshEventWatchdogPrint)
      (vshEventIOErrorPrint, vshEventGraphicsPrint)
      (vshEventIOErrorReasonPrint, vshEventBlockJobPrint)
      (vshEventDiskChangePrint, vshEventTrayChangePrint)
      (vshEventPMChangePrint, vshEventBalloonChangePrint)
      (vshEventDeviceRemovedPrint): New helper routines.
      (cmdEvent): Support full array of event callbacks.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      bb4a9a52
  18. 26 2月, 2014 1 次提交
    • M
      virsh: Honour -q in domblklist, vcpupin and emulatorpin · e53b0624
      Michal Privoznik 提交于
      If user wants to grep some info from domain, e.g. disk paths:
      
          # virsh -q domblklist win7 | awk '{print $2}'
          Source
      
          /var/lib/libvirt/images/windows.qcow2
          /home/zippy/work/tmp/en_windows_7_professional_x64_dvd_X15-65805.iso
      
      while with my change:
      
          # virsh -q domblklist win7 | awk '{print $2}'
          /var/lib/libvirt/images/windows.qcow2
          /home/zippy/work/tmp/en_windows_7_professional_x64_dvd_X15-65805.iso
      
      We don't print table header in other commands, like list.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      e53b0624
  19. 25 2月, 2014 3 次提交
    • C
      virsh: initialize str to NULL to solve a build issue · 7a8d7af6
      Chen Hanxiao 提交于
      Fix a -Werror=maybe-uninitialized issue.
      Signed-off-by: NChen Hanxiao <chenhanxiao@cn.fujitsu.com>
      Signed-off-by: NJán Tomko <jtomko@redhat.com>
      7a8d7af6
    • E
      virsh: use more compact VIR_ENUM_IMPL · 466b12ab
      Eric Blake 提交于
      Dan Berrange suggested that using VIR_ENUM_IMPL is more compact
      than open-coding switch statements, and still just as forceful
      at making us remember to update lists if we add enum values
      in the future.  Make this change throughout virsh.
      
      Sure enough, doing this change caught that we missed at least
      VIR_STORAGE_VOL_NETDIR.
      
      * tools/virsh-domain-monitor.c (vshDomainIOErrorToString)
      (vshDomainControlStateToString, vshDomainStateToString)
      (vshDomainStateReasonToString): Change switch to enum lookup.
      (cmdDomControl, cmdDominfo): Update caller.
      * tools/virsh-domain.c (vshDomainVcpuStateToString)
      (vshDomainEventToString, vshDomainEventDetailToString): Change
      switch to enum lookup.
      (vshDomainBlockJobToString, vshDomainJobToString): New functions.
      (cmdVcpuinfo, cmdBlockJob, cmdDomjobinfo, cmdEvent): Update
      callers.
      * tools/virsh-network.c (vshNetworkEventToString): Change switch
      to enum lookup.
      * tools/virsh-pool.c (vshStoragePoolStateToString): New function.
      (cmdPoolList, cmdPoolInfo): Update callers.
      * tools/virsh-volume.c (vshVolumeTypeToString): Change switch to
      enum lookup.
      (cmdVolInfo, cmdVolList): Update callers.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      466b12ab
    • J
      virsh: Don't leak buffer if GetFDs fails in cmdCreate · fe1b6e72
      Ján Tomko 提交于
      Change the logic of the function to return false by default
      and move the freeing of the buffer to the cleanup section.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1067338
      fe1b6e72
  20. 21 2月, 2014 2 次提交
    • E
      virsh: add event command, for lifecycle events · 99fa96c3
      Eric Blake 提交于
      Add 'virsh event --list' and 'virsh event [dom] --event=name
      [--loop] [--timeout]'.  Borrows somewhat from event-test.c,
      but defaults to a one-shot notification, and takes advantage
      of the event loop integration to allow Ctrl-C to interrupt the
      wait for an event.  For now, this just does lifecycle events.
      
      * tools/virsh.pod (event): Document new command.
      * tools/virsh-domain.c (vshDomainEventToString)
      (vshDomainEventDetailToString, vshDomEventData)
      (vshEventLifecyclePrint, cmdEvent): New struct and functions.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      99fa96c3
    • E
      virsh: common code for parsing --seconds · 5093b047
      Eric Blake 提交于
      Several virsh commands ask for a --timeout parameter in
      seconds, then use it to control interfaces that operate on
      millisecond limits; I also plan on adding a 'virsh event'
      command that also does this.  Factor this into a common
      function.
      
      * tools/virsh.h (vshCommandOptTimeoutToMs): New prototype.
      * tools/virsh.c (vshCommandOptTimeoutToMs): New function.
      * tools/virsh-domain.c (cmdBlockCommit, cmdBlockCopy)
      (cmdBlockPull, cmdMigrate): Use it.
      (vshWatchJob): Adjust timeout scale.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      5093b047
  21. 20 2月, 2014 1 次提交
    • J
      virsh: fix memleak when starting a guest with invalid fd · 6c1059ef
      Jincheng Miao 提交于
      When start a guest with --pass-fd, if the argument of --pass-fd is invalid,
      virsh will exit, but doesn't free the variable 'dom'.
      
      The valgrind said:
      ...
      ==24569== 63 (56 direct, 7 indirect) bytes in 1 blocks are definitely lost in loss record 130 of 234
      ==24569==    at 0x4C2A1D4: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==24569==    by 0x4E879A4: virAllocVar (viralloc.c:544)
      ==24569==    by 0x4EBD625: virObjectNew (virobject.c:190)
      ==24569==    by 0x4F3A18A: virGetDomain (datatypes.c:226)
      ==24569==    by 0x4F9311F: remoteDomainLookupByName (remote_driver.c:6636)
      ==24569==    by 0x4F44F20: virDomainLookupByName (libvirt.c:2277)
      ==24569==    by 0x12F616: vshCommandOptDomainBy (virsh-domain.c:105)
      ==24569==    by 0x131C79: cmdStart (virsh-domain.c:3330)
      ==24569==    by 0x12C4AB: vshCommandRun (virsh.c:1752)
      ==24569==    by 0x127001: main (virsh.c:3218)
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1067338Signed-off-by: NJincheng Miao <jmiao@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6c1059ef
  22. 20 1月, 2014 2 次提交
  23. 08 1月, 2014 2 次提交