1. 15 6月, 2012 2 次提交
    • D
      Always pivot_root event if the new root source is '/' · e9d8861e
      Daniel P. Berrange 提交于
      This reverts
      
        commit c16b4c43
        Author: Daniel P. Berrange <berrange@redhat.com>
        Date:   Fri May 11 15:09:27 2012 +0100
      
          Avoid LXC pivot root in the root source is still /
      
      This commit broke setup of /dev, because the code which
      deals with setting up a private /dev and /dev/pts only
      works if you do a pivotroot.
      
      The original intent of avoiding the pivot root was to
      try and ensure the new root has a minimumal mount
      tree. The better way todo this is to just unmount the
      bits we don't want (ie old /proc & /sys subtrees.
      So apply the logic from
      
        commit c529b47a
        Author: Daniel P. Berrange <berrange@redhat.com>
        Date:   Fri May 11 11:35:28 2012 +0100
      
          Trim /proc & /sys subtrees before mounting new instances
      
      to the pivot_root codepath as well
      e9d8861e
    • D
      Improve error message diagnosing incorrect XML CPU mode · 92cbe7ae
      Daniel P. Berrange 提交于
      Tell the user what CPU mode value is wrong
      92cbe7ae
  2. 14 6月, 2012 4 次提交
    • P
      qemu: Enable disconnecting SPICE clients without changing password · e0f0131d
      Peter Krempa 提交于
      Libvirt updates the configuration of SPICE server only when something
      changes. This is unfortunate when the user wants to disconnect a
      existing spice session when the connected attribute is already
      "disconnect".
      
      This patch modifies the conditions for calling the password updater to
      be called when nothing changes, but the connected attribute is already
      "disconnect".
      e0f0131d
    • P
      qemu: Fix off-by-one error while unescaping monitor strings · 0f4660c8
      Peter Krempa 提交于
      While unescaping the commands the commands passed through to the monitor
      function qemuMonitorUnescapeArg() initialized lenght of the input string
      to strlen()+1 which is fine for alloc but not for iteration of the
      string.
      
      This patch fixes the off-by-one error and drops the pointless check for
      a single trailing slash that is automaticaly handled by the default
      branch of switch.
      0f4660c8
    • L
      network: fully support/use VIR_NETWORK_XML_INACTIVE flag · 1f145b2f
      Laine Stump 提交于
      commit 52d064f4 added
      VIR_NETWORK_XML_INACTIVE in order to allow suppressing the
      auto-generated list of VFs in network definitions, and a --inactive
      flag to virsh net-dumpxml to take advantage of the flag. However, it
      missed out on two opportunities:
      
      1) Use INACTIVE to get the current config of the network as it
         exists on disk, rather than the currently active config.
      
      2) Add INACTIVE to the flags used for the virsh net-edit command, so
         that it won't include the forward-pool interfaces that were
         autogenerated, and so that a re-edit of the network prior to
         restarting it will show any other edits made since the last restart
         of the network. (prior to this patch, if you edited a network a 2nd
         time without restarting, all of the previous edits would magically
         disappear).
      
      In order to fit with the new #define-based generic edit function in
      virsh.c, a new function vshNetworkGetXMLDesc() was added. This
      function first tries to call virNetworkGetXMLDesc with the INACTIVE
      flag added, then retries without if the first attempt fails (in the
      manner expected when the server doesn't support it).
      1f145b2f
    • D
      Add some missing hook functions · 6510c97b
      Daniel P. Berrange 提交于
      A core use case of the hook scripts is to be able to do things
      to a guest's network configuration. It is possible to hook into
      the 'start' operation for a QEMU guest which runs just before
      the guest is started. The TAP devices will exist at this point,
      but the QEMU process will not. It can be desirable to have a
      'started' hook too, which runs once QEMU has started.
      
      If libvirtd is restarted it will re-populate firewall rules,
      but there is no QEMU hook to trigger for existing domains.
      This is solved with a 'reconnect' hook.
      
      Finally, if attaching to an external QEMU process there needs
      to be an 'attach' hook script.
      
      This all also applies to the LXC driver
      
      * docs/hooks.html.in: Document new operations
      * src/util/hooks.c, src/util/hooks.c: Add 'started', 'reconnect'
        and 'attach' operations for QEMU. Add 'prepare', 'started',
        'release' and 'reconnect' operations for LXC
      * src/lxc/lxc_driver.c: Add hooks for 'prepare', 'started',
        'release' and 'reconnect' operations
      * src/qemu/qemu_process.c: Add hooks for 'started', 'reconnect'
        and 'reconnect' operations
      6510c97b
  3. 13 6月, 2012 14 次提交
    • D
      client rpc: Fix error checking after poll() · 5d490603
      Daniel P. Berrange 提交于
      First 'poll' can't return EWOULDBLOCK, and second, we're checking errno
      so far away from the poll() call that we've probably already trashed the
      original errno value.
      5d490603
    • J
      client rpc: Send keepalive requests from IO event loop · 4d971dc7
      Jiri Denemark 提交于
      In addition to keepalive responses, we also need to send keepalive
      requests from client IO loop to properly detect dead connection in case
      a libvirt API is called from the main loop, which prevents any timers to
      be called.
      4d971dc7
    • J
      server rpc: Remove APIs for manipulating filters on locked client · d9ad4166
      Jiri Denemark 提交于
      We don't need to add or remove filters when client object is already
      locked anymore. There's no reason to keep the *Locked variants of those
      APIs.
      d9ad4166
    • J
      rpc: Remove unused parameter in virKeepAliveStopInternal · 0ec514b3
      Jiri Denemark 提交于
      The previous commit removed the only usage of ``all'' parameter in
      virKeepAliveStopInternal, which was actually the only reason for having
      virKeepAliveStopInternal. This effectively reverts most of commit
      6446a9e2.
      0ec514b3
    • J
      rpc: Do not use timer for sending keepalive responses · bb85f229
      Jiri Denemark 提交于
      When a libvirt API is called from the main event loop (which seems to be
      common in event-based glib apps), the client IO loop would properly
      handle keepalive requests sent by a server but will not actually send
      them because the main event loop is blocked with the API. This patch
      gets rid of response timer and the thread which is processing keepalive
      requests is also responsible for queueing responses for delivery.
      bb85f229
    • J
      client rpc: Separate call creation from running IO loop · c57103e5
      Jiri Denemark 提交于
      This makes it possible to create and queue new calls while we are
      running IO loop.
      c57103e5
    • J
      rpc: Add APIs for direct triggering of keepalive timer · 28c75382
      Jiri Denemark 提交于
      Add virKeepAliveTimeout and virKeepAliveTrigger APIs that can be used to
      set poll timeouts and trigger keepalive timer. virKeepAliveTrigger
      checks if it is called to early and does nothing in that case.
      28c75382
    • J
      rpc: Refactor keepalive timer code · a2ba8686
      Jiri Denemark 提交于
      The code that needs to be run every keepalive interval of inactivity was
      only called from a timer and thus from the main event loop. We will need
      to call the code directly from another place.
      a2ba8686
    • J
      client rpc: Drop unused return value of virNetClientSendNonBlock · ca9b13e3
      Jiri Denemark 提交于
      As we never drop non-blocking calls, the return value that used to
      indicate a call was dropped is no longer needed.
      ca9b13e3
    • J
      client rpc: Just queue non-blocking call if another thread has the buck · ef392614
      Jiri Denemark 提交于
      As non-blocking calls are no longer dropped, we don't really need to
      care that much about their fate and wait for the thread with the buck
      to process them. If another thread has the buck, we can just push a
      non-blocking call to the queue and be done with it.
      ef392614
    • J
      client rpc: Don't drop non-blocking calls · 78602c4e
      Jiri Denemark 提交于
      So far, we were dropping non-blocking calls whenever sending them would
      block. In case a client is sending lots of stream calls (which are not
      supposed to generate any reply), the assumption that having other calls
      in a queue is sufficient to get a reply from the server doesn't work. I
      tried to fix this in b1e374a7 but
      failed and reverted that commit.
      
      With this patch, non-blocking calls are never dropped (unless the
      connection is being closed) and will always be sent.
      78602c4e
    • J
      client rpc: Use event loop for writing · 9e747e5c
      Jiri Denemark 提交于
      Normally, when every call has a thread associated with it, the thread
      may get the buck and be in charge of sending all calls until its own
      call is done. When we introduced non-blocking calls, we had to add
      special handling of new non-blocking calls. This patch uses event loop
      to send data if there is no thread to get the buck so that any
      non-blocking calls left in the queue are properly sent without having to
      handle them specially. It also avoids adding even more cruft to client
      IO loop in the following patches.
      
      With this change in, non-blocking calls may see unpredictable delays in
      delivery when the client has no event loop registered. However, the only
      non-blocking calls we have are keepalives and we already require event
      loop for them, which makes this a non-issue until someone introduces new
      non-blocking calls.
      9e747e5c
    • J
      client rpc: Improve debug messages in virNetClientIO · 71689f95
      Jiri Denemark 提交于
      When analyzing our debug log, I'm always confused about what each of the
      pointers mean. Let's be explicit.
      71689f95
    • E
      build: fix 'make dist' on virgin checkout · 9b5970c6
      Eric Blake 提交于
      'make dist' was depending on *protocol-structs files, which are
      stored in git but in turn depended on generated files.  We still
      want to ship the protocol-structs files, but by renaming the
      tests to something not matching a file name, we separate 'make
      check' (which depends on the generated file) from 'make dist'
      (which only depends on the git files).  After all, the tarball
      should never depend on a generated file not stored in git.
      
      I found one more case of a git file depending on a generated
      file, in a bogus virkeycode.c listing; but at least this one
      had no associated rules so it never broke 'make dist'.
      
      Reported by Wen Congyang.  Latent bug has been present since
      commit 62dee6fa, but only recently exposed by commit 7bff56a0.
      
      * src/Makefile.am ($(srcdir)/util/virkeycode.c): Drop useless
      dependency.
      (BUILT_SOURCES): ...and build virkeymaps.h sooner.
      (PROTOCOL_STRUCTS): Rather than depend on the struct file...
      (check-local): ...convert things into a phony target of...
      (check-protocol): ...a new check.
      ($(srcdir)/remote_protocol-struct): Rename to isolate the distributed
      file from the conditional test.
      (PDWTAGS): Deal with rename.  Swap to compare 'expected actual'.
      9b5970c6
  4. 12 6月, 2012 8 次提交
    • G
      openvz: wire up domainUpdateDeviceFlags · f5d61d39
      Guido Günther 提交于
      so we can update file system quota
      f5d61d39
    • G
      openvz: add persist parameter to openvzSetDiskQuota · 1d82540a
      Guido Günther 提交于
      with persist=false the domain config file will not be updated.
      1d82540a
    • G
      Introduce virDomainFSIndexByName · 0dde544c
      Guido Günther 提交于
      for containers matching virDomainDiskIndexByName.
      0dde544c
    • M
      qemu: Don't overwrite security labels · 86032b22
      Michal Privoznik 提交于
      Currently, if qemuProcessStart fail at some point, e.g. because
      domain being started wants a PCI/USB device already assigned to
      a different domain, we jump to cleanup label where qemuProcessStop
      is performed. This unconditionally calls virSecurityManagerRestoreAllLabel
      which is wrong because the other domain is still using those devices.
      
      However, once we successfully label all devices/paths in
      qemuProcessStart() from that point on, we have to perform a rollback
      on failure - that is - we have to virSecurityManagerRestoreAllLabel.
      86032b22
    • M
      qemuProcessStop: Switch to flags · 69dd7714
      Michal Privoznik 提交于
      Currently, we are passing only one boolean (migrated) so there is
      no real profit in this. But it creates starting position for
      next patch.
      69dd7714
    • E
      snapshot: implement new APIs for qemu · e3559a6e
      Eric Blake 提交于
      The two APIs are rather trivial; based on bits and pieces of other
      existing APIs.  It leaves the door open for future extension to
      qemu to report snapshots without metadata based on reading qcow2
      internal snapshot names.
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotIsCurrent)
      (qemuDomainSnapshotHasMetadata): New functions.
      e3559a6e
    • E
      snapshot: RPC for new query APIs · a2bc4a0c
      Eric Blake 提交于
      Pretty straightforward.
      
      * src/remote/remote_protocol.x
      (remote_domain_snapshot_is_current_args)
      (remote_domain_snapshot_is_current_ret)
      (remote_domain_snapshot_has_metadata_args)
      (remote_domain_snapshot_has_metadata_ret): New structs.
      (REMOTE_PROC_DOMAIN_SNAPSHOT_IS_CURRENT)
      (REMOTE_PROC_DOMAIN_SNAPSHOT_HAS_METADATA): New RPC calls.
      * src/remote/remote_driver.c (remote_driver): Call them.
      * src/remote_protocol-structs: Regenerate.
      a2bc4a0c
    • E
      snapshot: new query APIs · 2e13b9ab
      Eric Blake 提交于
      Right now, starting from just a virDomainSnapshotPtr, and wanting to
      know if it is the current snapshot for its respective domain, you have
      to use virDomainSnapshotGetDomain(), then virDomainSnapshotCurrent(),
      then compare the two names returned by virDomainSnapshotGetName().
      It is a bit easier if we can directly query this information from the
      snapshot itself.
      
      Right now, it is possible to filter a snapshot listing based on
      whether snapshots have metadata that would prevent domain deletion,
      but the only way to learn if an individual snapshot has metadata is
      to see if that snapshot appears in the list returned by a listing.
      Additionally, I hope to expand the qemu driver in a future patch to
      use qemu-img to reconstruct snapshot XML corresponding to internal
      qcow2 snapshot names not otherwise tracked by libvirt (in part, so
      that libvirt can guarantee that new snapshots are not created with
      a name that would silently corrupt the existing portion of the qcow2
      file); if I ever get that in, then it would no longer be an all-or-none
      decision on whether snapshots have metadata, and becomes all the more
      important to be able to directly determine that information from a
      particular snapshot.
      
      Other query functions (such as virDomainIsActive) do not have a flags
      argument, but since virDomainHasCurrentSnapshot takes a flags argument,
      I figured it was safer to provide a flags argument here as well.
      
      * include/libvirt/libvirt.h.in (virDomainSnapshotIsCurrent)
      (virDomainSnapshotHasMetadata): New declarations.
      * src/libvirt.c (virDomainSnapshotIsCurrent)
      (virDomainSnapshotHasMetadata): New functions.
      * src/libvirt_public.syms (LIBVIRT_0.9.13): Export them.
      * src/driver.h (virDrvDomainSnapshotIsCurrent)
      (virDrvDomainSnapshotHasMetadata): New driver callbacks.
      2e13b9ab
  5. 11 6月, 2012 5 次提交
  6. 09 6月, 2012 2 次提交
  7. 08 6月, 2012 3 次提交
    • J
      util: Fix deadlock in virLogReset · d581313a
      Jiri Denemark 提交于
      When libvirtd forks off a new child, the child then calls virLogReset(),
      which ends up closing file descriptors used as log outputs. However, we
      recently started logging closed file descriptors, which means we need to
      lock logging mutex which was already locked by virLogReset(). We don't
      really want to log anything when we are in the process of closing log
      outputs.
      d581313a
    • C
    • L
      Assign correct address type to spapr-vlan and spapr-vty. · 04a319ba
      Li Zhang 提交于
      For pseries guest, spapr-vlan and spapr-vty is based
      on spapr-vio address. According to model of network
      device, the address type should be assigned automatically.
      For serial device, serial pty device is recognized as
      spapr-vty device, which is also on spapr-vio.
      
      So this patch is to correct the address type of
      spapr-vlan and spapr-vty, and build correct
      command line of spapr-vty.
      Signed-off-by: NLi Zhang <zhlcindy@linux.vnet.ibm.com>
      Reviewed-by:   Michael Ellerman<michaele@au1.ibm.com>
      04a319ba
  8. 07 6月, 2012 2 次提交
    • E
      command: avoid potential deadlock on handshake · 5e8ab391
      Eric Blake 提交于
      There is a theoretical problem of an extreme bug where we can get
      into deadlock due to command handshaking.  Thanks to a pair of pipes,
      we have a situation where the parent thinks the child reported an
      error and is waiting for a message from the child to explain the
      error; but at the same time the child thinks it reported success
      and is waiting for the parent to acknowledge the success; so both
      processes are now blocked.
      
      Thankfully, I don't think this deadlock is possible without at
      least one other bug in the code, but I did see exactly that sort
      of situation prior to commit da831afc - I saw a backtrace where a
      double close bug in the parent caused the parent to read from the
      wrong fd and assume the child failed, even though the child really
      sent success.
      
      This potential deadlock is not quite like commit 858c2476 (a deadlock
      due to multiple readers on one pipe preventing a write from completing),
      although the solution is similar - always close unused pipe fds before
      blocking, rather than after.
      
      * src/util/command.c (virCommandHandshakeWait): Close unused fds
      sooner.
      5e8ab391
    • M
      qemu: better detection of crashed domains · bda2f17d
      Martin Kletzander 提交于
      When libvirtd is started and there is an unusable/not-connectable
      leftover from earlier started machine, it's more reasonable to say
      that the machine "crashed" if we know it was started with
      "-no-shutdown".
      This patch fixes that and also changes the other result (when machine
      was started without "-no-shutdown") to "unknown", because the previous
      "failed" reason means (according to include/libvirt/libvirt.h.in:174),
      that the machine failed to start.
      bda2f17d