1. 28 1月, 2011 15 次提交
    • J
      docs: replace CRLF with LF · eb1be58e
      Juerg Haefliger 提交于
      eb1be58e
    • D
      Remove bogus log warning lines when launching QEMU · 0095edaa
      Daniel P. Berrange 提交于
      The refactoring of QEMU command startup was comitted with
      a couple of VIR_WARN lines left in from debugging.
      
      * src/qemu/qemu_driver.c: Remove log warning lines
      0095edaa
    • D
      Remove double close of qemu monitor · e85247e7
      Daniel P. Berrange 提交于
      When qemuMonitorSetCapabilities() fails, there is no need to
      call qemuMonitorClose(), because the caller will already see
      the error code and tear down the entire VM. The extra call to
      qemuMonitorClose resulted in a double-free due to it removing
      a ref count prematurely.
      
      * src/qemu/qemu_driver.c: Remove premature close of monitor
      e85247e7
    • D
      Prevent overfilling of self-pipe in python event loop · 331d7b09
      Daniel P. Berrange 提交于
      If the event loop takes a very long time todo something, it is
      possible for the 'self pipe' buffer to become full at which
      point the entire event loop + remote driver deadlock. Use a
      boolean flag to ensure we have strict one-in, one-out behaviour
      on writes/reads of the 'self pipe'
      331d7b09
    • O
      docs: Add docs for new extra parameter pkipath · cc4447b6
      Osier Yang 提交于
      * docs/remote.html.in
      cc4447b6
    • E
      qemu: fix error messages · b96b6f47
      Eric Blake 提交于
      Regression in commit caa805ea let a lot of bad messages slip in.
      
      * cfg.mk (msg_gen_function): Fix function name.
      * src/qemu/qemu_cgroup.c (qemuRemoveCgroup): Fix fallout from
      'make syntax-check'.
      * src/qemu/qemu_driver.c (qemudDomainGetInfo)
      (qemuDomainWaitForMigrationComplete, qemudStartVMDaemon)
      (qemudDomainSaveFlag, qemudDomainAttachDevice)
      (qemuDomainUpdateDeviceFlags): Likewise.
      * src/qemu/qemu_hotplug.c (qemuDomainAttachHostUsbDevice)
      (qemuDomainDetachPciDiskDevice, qemuDomainDetachSCSIDiskDevice):
      Likewise.
      b96b6f47
    • H
      qemu: Report more accurate error on failure to attach device. · cdbba1c4
      Hu Tao 提交于
      When attaching device from a xml file and the device is mis-configured,
      virsh gives mis-leading message "out of memory". This patch fixes this.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      cdbba1c4
    • W
      Force guest suspend at timeout · f15cad29
      Wen Congyang 提交于
      If the memory of guest OS is changed constantly, the live migration
      can not be ended ever for ever.
      
      We can use the command 'virsh migrate-setmaxdowntime' to control the
      live migration. But the value of maxdowntime is diffcult to calculate
      because it depends on the transfer speed of network and constantly
      changing memroy size. We need a easy way to control the live migration.
      
      This patch adds the support of forcing guest to suspend at timeout.
      With this patch, when we migrate the guest OS, we can specify a
      timeout. If the live migration timeouts, auto-suspend the guest OS,
      where the migration will complete offline.
      f15cad29
    • W
      Show migration progress. · d183e9d1
      Wen Congyang 提交于
      Show migration progress if `migrate --verbose'.
      d183e9d1
    • H
      Cancel migration if user presses Ctrl-C when migration is in progress · 8e6d9860
      Hu Tao 提交于
      While migration is in progress and virsh is waiting for its
      completion, user may want to terminate the progress by pressing
      Ctrl-C. But virsh just exits on user's Ctrl-C leaving migration
      in background that user isn't even aware of. It's not reasonable.
      
      This patch changes the behaviour for migration. For other
      commands Ctrl-C still terminates virsh itself.
      8e6d9860
    • E
      qemu: use separate alias for chardev and associated device · 3fdc7895
      Eric Blake 提交于
      * src/qemu/qemu_command.c (qemuBuildChrChardevStr): Alter the
      chardev alias.
      (qemuBuildCommandLine): Output an id for the chardev counterpart.
      * tests/qemuxml2argvdata/*: Update tests to match.
      Reported by Daniel P. Berrange.
      3fdc7895
    • W
      avoid vm to be deleted if qemuConnectMonitor failed · d96431f9
      Wen Congyang 提交于
      Steps to reproduce this bug:
      1. service libvirtd start
      2. virsh start <domain>
      3. kill -STOP $(cat /var/run/libvirt/qemu/<domain>.pid)
      4. service libvirtd restart
      5. kill -9 $(cat /var/run/libvirt/qemu/<domain>.pid)
      
      Then libvirtd will core dump or be in deadlock state.
      
      Make sure that json is built into libvirt and the version
      of qemu is newer than 0.13.0.
      
      The reason of libvirtd cores dump is that:
      We add vm->refs when we alloc the memory, and decrease it
      in the function qemuHandleMonitorEOF() in other thread.
      
      We add vm->refs in the function qemuConnectMonitor() and
      decrease it when the vm is inactive.
      
      The libvirtd will block in the function qemuMonitorSetCapabilities()
      because the vm is stopped by signal SIGSTOP. Now the vm->refs is 2.
      
      Then we kill the vm by signal SIGKILL. The function
      qemuMonitorSetCapabilities() failed, and then we will decrease vm->refs
      in the function qemuMonitorClose().
      In another thread, mon->fd is broken and the function
      qemuHandleMonitorEOF() is called.
      
      If qemuHandleMonitorEOF() decreases vm->refs before qemuConnectMonitor()
      returns, vm->refs will be decrease to 0 and the memory is freed.
      
      We will call qemudShutdownVMDaemon() as qemuConnectMonitor() failed.
      The memory has been freed, so qemudShutdownVMDaemon() is too dangerous.
      
      We will reference NULL pointer in the function virDomainConfVMNWFilterTeardown():
      =============
      void
      virDomainConfVMNWFilterTeardown(virDomainObjPtr vm) {
          int i;
      
          if (nwfilterDriver != NULL) {
              for (i = 0; i < vm->def->nnets; i++)
                  virDomainConfNWFilterTeardown(vm->def->nets[i]);
          }
      }
      ============
      vm->def->nnets is not 0 but vm->def->nets is NULL(We don't set vm->def->nnets
      to 0 when we free vm).
      
      We should add an extra reference of vm to avoid vm to be deleted if
      qemuConnectMonitor() failed.
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      d96431f9
    • J
      tests: Fix virtio channel tests · cedf97e7
      Jiri Denemark 提交于
      As noticed by Eric, commit 8e28c5d4,
      which fixed generation of virtio-serial port numbers, forgot to adjust
      test files which resulted in make check failure.
      cedf97e7
    • J
      4282efcc
    • E
      event: fix event-handling allocation crash · a7483a56
      Eric Blake 提交于
      Regression introduced in commit e6b68d74 (Nov 2010).
      
      Prior to that point, handlesAlloc was always a multiple of
      EVENT_ALLOC_EXTENT (10), and was an int (so even if the subtraction
      had been able to wrap, a negative value would be less than the count
      not try to free the handles array).  But after that point,
      VIR_RESIZE_N made handlesAlloc grow geometrically (with a pattern of
      10, 20, 30, 45 for the handles array) but still freed in multiples of
      EVENT_ALLOC_EXTENT; and the count changed to size_t.  Which means that
      after 31 handles have been created, then 30 handles destroyed,
      handlesAlloc is 5 while handlesCount is 1, and since (size_t)(1 - 5)
      is indeed greater than 1, this then tried to free 10 elements, which
      had the awful effect of nuking the handles array while there were
      still live handles.
      
      Nuking live handles puts libvirtd in an inconsistent state, and was
      easily reproducible by starting and then stopping 60 faqemu guests.
      
      * daemon/event.c (virEventCleanupTimeouts, virEventCleanupHandles):
      Avoid integer wrap-around causing us to delete the entire array
      while entries are still active.
      * tests/eventtest.c (mymain): Expose the bug.
      a7483a56
  2. 27 1月, 2011 5 次提交
  3. 26 1月, 2011 12 次提交
    • L
      Manually kill gzip if restore fails before starting qemu · c9c794b5
      Laine Stump 提交于
      If a guest image is saved in compressed format, and the restore fails
      in some way after the intermediate process used to uncompress the
      image has been started, but before qemu has been started to hook up to
      the uncompressor, libvirt will endlessly wait for the uncompressor to
      finish, but it never will because it's still waiting to have something
      hooked up to drain its output.
      
      The solution is to close the pipes on both sides of the uncompressor,
      then send a SIGTERM before calling waitpid on it (only if the restore
      has failed, of course).
      c9c794b5
    • D
      Fix setup of lib directory with autogen.sh --system · 3493f1bc
      Daniel P. Berrange 提交于
      On x86_64 hosts, /usr/lib64 must be used instead of /usr/lib
      Rather than attempt to whitelist architectures, just check
      for existance of /usr/lib64
      
      * autogen.sh: Fix to use /usr/lib64 if it exists
      3493f1bc
    • D
      Add check for poll error events in monitor · e0e4e4de
      Daniel P. Berrange 提交于
      Handle poll errors in the same way as hangup event
      
      * src/qemu/qemu_monitor.c: Handle error events
      e0e4e4de
    • D
      Filter out certain expected error messages from libvirtd · b8786c06
      Daniel P. Berrange 提交于
      Add a hook to the error reporting APIs to allow specific
      error messages to be filtered out. Wire up libvirtd to
      remove VIR_ERR_NO_DOMAIN & similar error codes from the
      logs. They are still logged at DEBUG level.
      
      * daemon/libvirtd.c: Filter VIR_ERR_NO_DOMAIN and friends
      * src/libvirt_private.syms, src/util/virterror.c,
        src/util/virterror_internal.h: Hook for changing error
        reporting level
      b8786c06
    • D
      Revert all previous error log priority hacks · dbfca3ff
      Daniel P. Berrange 提交于
      This reverts the additions in commit
      
        abff683f
      
      taking us back to state where all errors are fully logged
      in both libvirtd and normal clients.
      
      THe intent was to stop VIR_ERR_NO_DOMAIN (No such domain
      with UUID XXXX) messages from client apps polluting syslog
      The change affected all error codes, but more seriously,
      it also impacted errors from internal libvirtd infrastructure
      For example guest autostart no longer logged errors. The
      libvirtd network code no longer logged some errors. This
      makes debugging incredibly hard
      
      * daemon/libvirtd.c: Remove error log priority filter
      * src/util/virterror.c, src/util/virterror_internal.h: Remove
        callback for overriding log priority
      dbfca3ff
    • D
      Cleanup code style in logging APIs · 2b7ac883
      Daniel P. Berrange 提交于
      Remove use of brackets around following return statement.
      Fix indentation of two switch statements
      2b7ac883
    • L
      Set SELinux context label of pipes used for qemu migration · 34a19dda
      Laine Stump 提交于
      This patch is a partial resolution to the following bug:
      
         https://bugzilla.redhat.com/show_bug.cgi?id=667756
      
      (to complete the fix, an updated selinux-policy package is required,
      to add the policy that allows libvirt to set the context of a fifo,
      which was previously not allowed).
      
      Explanation : When an incoming migration is over a pipe (for example,
      if the image was compressed and is being fed through gzip, or was on a
      root-squash nfs server, so needed to be opened by a child process
      running as a different uid), qemu cannot read it unless the selinux
      context label for the pipe has been set properly.
      
      The solution is to check the fd used as the source of the migration
      just before passing it to qemu; if it's a fifo (implying that it's a
      pipe), we call the newly added virSecurityManagerSetFDLabel() function
      to set the context properly.
      34a19dda
    • L
      Add a function to the security driver API that sets the label of an open fd. · d89608f9
      Laine Stump 提交于
      A need was found to set the SELinux context label on an open fd (a
      pipe, as a matter of fact). This patch adds a function to the security
      driver API that will set the label on an open fd to secdef.label. For
      all drivers other than the SELinux driver, it's a NOP. For the SElinux
      driver, it calls fsetfilecon().
      
      If the return is a failure, it only returns error up to the caller if
      1) the desired label is different from the existing label, 2) the
      destination fd is of a type that supports setting the selinux context,
      and 3) selinux is in enforcing mode. Otherwise it will return
      success. This follows the pattern of the existing function
      SELinuxSetFilecon().
      d89608f9
    • J
      docs: add a link to the bindings page under the downloads menu item · 413c88e7
      Justin Clift 提交于
      So people looking to download the language bindings, but don't know
      they're under the "Docs" area.
      413c88e7
    • M
      virsh: require --mac to avoid detach-interface ambiguity · cee47aac
      Michal Privoznik 提交于
      bugfix for https://bugzilla.redhat.com/show_bug.cgi?id=671050
      
      virsh simply refutes to detach-interface in case when multiple
      interfaces are attached and --mac is not specified.
      cee47aac
    • W
      dispatch error before return · 75da8b85
      Wen Congyang 提交于
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      75da8b85
    • O
      qemu: Error prompt when managed save a shutoff domain · dbd63c4d
      Osier Yang 提交于
      The problem was introduced by commit 4303c91c, which removed the checking
      of domain state, this patch is to fix it.
      
      Otherwise, improper error will be thrown, e.g.
      
      error: Failed to save domain rhel6 state
      error: cannot resolve symlink /var/lib/libvirt/qemu/save/rhel6.save: No such
      file or directory
      dbd63c4d
  4. 25 1月, 2011 2 次提交
    • E
      build: avoid corrupted gnulib/tests/Makefile · 6cbab7c1
      Eric Blake 提交于
      Running 'make check' can sometimes fail in the gnulib/tests
      subdirectory, when doing an incremental build, because
      ./bootstrap generates a Makefile.am that tries to refer to
      ../../.. instead of ../.., and gets lost.
      
      This may be an upstream gnulib bug, where a more elegant
      solution will present itself in the future:
      http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/24898
      
      But in the meantime, I was able to reproduce both the issue,
      and this solution to work around it.
      
      * bootstrap.conf (bootstrap_epilogue): Ensure that no stray
      ../../.. components remain in gnulib/tests/Makefile.in.
      Reported by Serge Hallyn.
      6cbab7c1
    • C
      qemu: sound: Support intel 'ich6' model · 6cabc0b0
      Cole Robinson 提交于
      In QEMU, the card itself is a PCI device, but it requires a codec
      (either -device hda-output or -device hda-duplex) to actually output
      sound. Specifying <sound model='ich6'/> gives us -device intel-hda
      -device hda-duplex I think it's important that a simple <sound model='ich6'/>
      sets up a useful codec, to have consistent behavior with all other sound cards.
      
      This is basically Dan's proposal of
      
          <sound model='ich6'>
              <codec type='output' slot='0'/>
              <codec type='duplex' slot='3'/>
          </sound>
      
      without the codec bits implemented.
      
      The important thing is to keep a consistent API here, we don't want some
      <sound> devs require tweaking codecs but not others. Steps I see to
      accomplishing this:
      
          - every <sound> device has a <codec type='default'/> (unless codecs are
              manually specified)
          - <codec type='none'/> is required to specify 'no codecs'
          - new audio settings like mic=on|off could then be exposed in
              <sound> or <codec> in a consistent manner for all sound models
      
      v2:
          Use model='ich6'
      
      v3:
          Use feature detection, from eblake
          Set codec id, bus, and cad values
      
      v4:
          intel-hda isn't supported if -device isn't available
      
      v5:
          Comment spelling fixes
      6cabc0b0
  5. 22 1月, 2011 6 次提交
    • M
      4a267912
    • E
      event: fix event-handling data race · a11bd2e6
      Eric Blake 提交于
      This bug has been present since before the time that commit
      f8a519 (Dec 2008) tried to make the dispatch loop re-entrant.
      
      Dereferencing eventLoop.handles outside the lock risks crashing, since
      any other thread could have reallocated the array in the meantime.
      It's a narrow race window, however, and one that would have most
      likely resulted in passing bogus data to the callback rather than
      actually causing a segv, which is probably why it has gone undetected
      this long.
      
      * daemon/event.c (virEventDispatchHandles): Cache data while
      inside the lock, as the array might be reallocated once outside.
      a11bd2e6
    • E
      build: fix 'make check' with older git · ae0cdd47
      Eric Blake 提交于
      * .gnulib: Update to latest, for maintainer-makefile fix.
      Reported by Matthias Bolte.
      ae0cdd47
    • C
      Push unapplied fixups for previous patch · 1e1f7a89
      Cole Robinson 提交于
      - Add augeas tests
      - Clarify vnc_auto_unix_socket precedence in qemu.conf
      1e1f7a89
    • C
      qemu: Add conf option to auto setup VNC unix sockets · a942ea06
      Cole Robinson 提交于
      If vnc_auto_unix_socket is enabled, any VNC devices without a hardcoded
      listen or socket value will be setup to serve over a unix socket in
      /var/lib/libvirt/qemu/$vmname.vnc.
      
      We store the generated socket path in the transient VM definition at
      CLI build time.
      a942ea06
    • C
      qemu: Allow serving VNC over a unix domain socket · 1d9c0a08
      Cole Robinson 提交于
      QEMU supports serving VNC over a unix domain socket rather than traditional
      TCP host/port. This is specified with:
      
      <graphics type='vnc' socket='/foo/bar/baz'/>
      
      This provides better security access control than VNC listening on
      127.0.0.1, but will cause issues with tools that rely on the lax security
      (virt-manager in fedora runs as regular user by default, and wouldn't be
      able to access a socket owned by 'qemu' or 'root').
      
      Also not currently supported by any clients, though I have patches for
      virt-manager, and virt-viewer should be simple to update.
      
      v2:
          schema: Make listen vs. socket a <choice>
      1d9c0a08