1. 06 9月, 2014 1 次提交
    • E
      blockjob: split up virsh blockjob info · c47f6aad
      Eric Blake 提交于
      I have plans to make future enhancements to the job list mode,
      which will be easier to do if the common blockJobImpl function
      is not mixing a query command with multiple modify commands.
      Besides, it just feels weird that all callers to blockJobImpl
      had to supply both a bandwidth input argument (unused for info
      mode) and an info output argument (unused for all other modes);
      not to mention I just made similar cleanups on the libvirtd
      side.
      
      The only reason blockJobImpl returned int was because of info
      mode returning -1/0/1 (all other job API are -1/0), so that
      can also be cleaned up.  No user-visible changes in this commit.
      
      * tools/virsh-domain.c (blockJobImpl): Change signature and return
      value.  Drop info handling.
      (cmdBlockJob): Handle info here.
      (cmdBlockCommit, cmdBlockCopy, cmdBlockPull): Adjust callers.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c47f6aad
  2. 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
  3. 27 8月, 2014 2 次提交
  4. 26 8月, 2014 1 次提交
  5. 19 8月, 2014 1 次提交
    • C
      cmdMigrate: move vshConnect before vshWatchJob · 7eabd550
      Chunyan Liu 提交于
      A possible fix to issue:
      http://www.redhat.com/archives/libvir-list/2014-August/thread.html#00227
      
      While doing migration on KVM host, found problem sometimes:
      VM is already running on the target host and disappears from source
      host, but 'virsh migrate' command line hangs, cannot exit normally.
      If pressing "ENTER" key, it will exit.
      
      The code hangs at tools/virsh-domain.c: cmdMigrate
      ->vshWatchJob->poll():
      poll() is trying to select pipe_fd, which is used to receive message
      from doMigrate thread. In debugging, found that doMigrate finishes
      and at the end it does call safewrite() to write the retval ('0' or
      '1') to pipe_fd, and the write is completed. But cmdMigrate poll()
      cannot get the event. If pressing "ENTER" key, poll() can get the
      event and select pipe_fd, then command line can exit.
      
      In current code, authentication thread which is called by vshConnect
      will use stdin, and at the same time, in cmdMigrate main process,
      poll() is listening to stdin, that probably affect poll() to get
      pipe_fd event. Better to move authentication before vshWatchJob. With
      this change, above problem does not exist.
      Signed-off-by: NChunyan Liu <cyliu@suse.com>
      7eabd550
  6. 04 8月, 2014 1 次提交
  7. 24 7月, 2014 3 次提交
  8. 16 7月, 2014 1 次提交
    • M
      Fix const correctness · 607806f8
      Michal Privoznik 提交于
      In many places we define a variable as a 'const char *' when in fact
      we modify it just a few lines below. Or even free it. We should not do
      that.
      
      There's one exception though, in xenSessionFree() xenapi_utils.c. We
      are freeing the xen_session structure which is defined in
      xen/api/xen_common.h public header. The structure contains session_id
      which is type of 'const char *' when in fact it should have been just
      'char *'. So I'm leaving this unmodified, just noticing the fact in
      comment.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      607806f8
  9. 09 7月, 2014 1 次提交
  10. 08 7月, 2014 2 次提交
  11. 07 7月, 2014 1 次提交
  12. 02 7月, 2014 1 次提交
  13. 26 6月, 2014 1 次提交
  14. 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
  15. 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
  16. 12 6月, 2014 2 次提交
  17. 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
  18. 06 6月, 2014 3 次提交
  19. 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
  20. 13 5月, 2014 2 次提交
  21. 06 5月, 2014 1 次提交
  22. 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
  23. 25 3月, 2014 2 次提交
  24. 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
  25. 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
  26. 14 3月, 2014 1 次提交
  27. 04 3月, 2014 1 次提交
    • 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