1. 14 11月, 2012 1 次提交
    • P
      snapshot: qemu: Fix detection of external snapshots when deleting · 30f1bccf
      Peter Krempa 提交于
      This patch adds a helper to determine if snapshots are external and uses
      the helper to fix detection of those in snapshot deletion code.
      
      Snapshots are external if they have an external memory image or if the
      disk locations are external. As mixed snapshots are forbidden for now
      we need to check just one disk to know.
      30f1bccf
  2. 13 11月, 2012 1 次提交
    • P
      nodeinfo: Add check and workaround to guarantee valid cpu topologies · 9576afd1
      Peter Krempa 提交于
      Lately there were a few reports of the output of the virsh nodeinfo
      command being inaccurate. This patch tries to avoid that by checking if
      the topology actually makes sense. If it doesn't we then report a
      synthetic topology that indicates to the user that the host capabilities
      should be checked for the actual topology.
      9576afd1
  3. 12 11月, 2012 2 次提交
    • M
      AbortJob: Fix documentation · fd723164
      Michal Privoznik 提交于
      This API was never synchronous and probably doesn't even need to be.
      fd723164
    • M
      qemu: Allow migration to be cancelled at prepare phase · ab5e7d49
      Michal Privoznik 提交于
      Currently, if user calls virDomainAbortJob we just issue
      'migrate_cancel' and hope for the best. However, if user calls
      the API in wrong phase when migration hasn't been started yet
      (perform phase) the cancel request is just ignored. With this
      patch, the request is remembered and as soon as perform phase
      starts, migration is cancelled.
      ab5e7d49
  4. 10 11月, 2012 1 次提交
    • V
      capabilities: defaultConsoleTargetType can depend on architecture · b1c88c14
      Viktor Mihajlovski 提交于
      For S390, the default console target type cannot be of type 'serial'.
      It is necessary to at least interpret the 'arch' attribute
      value of the os/type element to produce the correct default type.
      
      Therefore we need to extend the signature of defaultConsoleTargetType
      to account for architecture. As a consequence all the drivers
      supporting this capability function must be updated.
      
      Despite the amount of changed files, the only change in behavior is
      that for S390 the default console target type will be 'virtio'.
      
      N.B.: A more future-proof approach could be to to use hypervisor
      specific capabilities to determine the best possible console type.
      For instance one could add an opaque private data pointer to the
      virCaps structure (in case of QEMU to hold capsCache) which could
      then be passed to the defaultConsoleTargetType callback to determine
      the console target type.
      Seems to be however a bit overengineered for the use case...
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      b1c88c14
  5. 09 11月, 2012 2 次提交
    • P
      qemu: Fix domain ID numbering race condition · 02cf57c0
      Peter Krempa 提交于
      When the libvirt daemon is restarted it tries to reconnect to running
      qemu domains. Since commit d38897a5 the
      re-connection code runs in separate threads. In the original
      implementation the maximum of domain ID's (that is used as an
      initializer for numbering guests created next) while libvirt was
      reconnecting to the guest.
      
      With the threaded implementation this opens a possibility for race
      conditions with the thread that is autostarting guests. When there's a
      guest running with id 1 and the daemon is restarted. The autostart code
      is reached first and spawns the first guest that should be autostarted
      as id 1. This results into the following unwanted situation:
      
       # virsh list
         Id    Name                           State
        ----------------------------------------------------
         1     guest1                         running
         1     guest2                         running
      
      This patch extracts the detection code before the re-connection threads
      are started so that the maximum id of the guests being reconnected to is
      known.
      
      The only semantic change created by this is if the guest with greatest ID
      quits before we are able to reconnect it's ID is used anyway as the
      greatest one as without this patch the greatest ID of a process we could
      successfuly reconnect to would be used.
      02cf57c0
    • P
      storage: fix broken backing chain · e0c469e5
      Philipp Hahn 提交于
      82507838 refactored the code to keep both the raw and canonicalized form
      of the backingStore, which breaks badly when the storage pool contains a
      storage volume, which is missing its backing store file:
       # ./daemon/libvirtd -l
       2012-11-07 12:43:33.279+0000: 22175: info : libvirt version: 1.0.0
       2012-11-07 12:43:33.279+0000: 22175: error : absolutePathFromBaseFile:542 : Can't canonicalize path '/var/lib/libvirt/images/base.qcow2': No such file or directory
       2012-11-07 12:43:33.280+0000: 22175: error : storageDriverAutostart:115 : Failed to autostart storage pool 'default': Can't canonicalize path '/var/lib/libvirt/images/base.qcow2': No such file or directory
      
      This is because virStorageFileGetMetadataFromBuf() aborts with -1 if the
      filename of the backingStore can not be canonicalized:
       #0  absolutePathFromBaseFile () at util/storage_file.c:541
       #1  virStorageFileGetMetadataFromBuf () at util/storage_file.c:728
       #2  virStorageFileGetMetadataFromFD () at util/storage_file.c:932
       #3  virStorageBackendProbeTarget () at storage/storage_backend_fs.c:94
       #4  virStorageBackendFileSystemRefresh () at storage/storage_backend_fs.c:849
       #5  storagePoolStart () at storage/storage_driver.c:700
       #6  virStoragePoolCreate () at libvirt.c:12471
       ...
      
      Treat files which miss their backing file as standalone files.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      e0c469e5
  6. 08 11月, 2012 2 次提交
    • P
      qemu: Fix function header formating of 2 functions · e124f498
      Peter Krempa 提交于
      Headers of qemuDomainSnapshotLoad and qemuDomainNetsRestart were
      improperly formatted.
      e124f498
    • P
      snapshot: qemu: Add support for external inactive snapshots · 9b5a514b
      Peter Krempa 提交于
      This patch adds support for external disk snapshots of inactive domains.
      The snapshot is created by calling using qemu-img by calling:
      
       qemu-img create -f format_of_snapshot -o
       backing_file=/path/to/src,backing_fmt=format_of_backing_image
       /path/to/snapshot
      
      in case the backing image format is known or probing is allowed and
      otherwise:
      
       qemu-img create -f format_of_snapshot -o  backing_file=/path/to/src
       /path/to/snapshot
      
      on each of the disks selected for snapshotting. This patch also modifies
      the snapshot preparing function to support creating external snapshots
      and to sanitize arguments. For now the user isn't able to mix external
      and internal snapshots but this restriction might be lifted in the
      future.
      9b5a514b
  7. 07 11月, 2012 1 次提交
    • M
      qemu: Emit event if 'cont' fails · a08fc66d
      Michal Privoznik 提交于
      Some operations, APIs needs domain to be paused prior operation can be
      performed, e.g. (managed-) save of a domain. The processors should be
      restored in the end. However, if 'cont' fails for some reason, we log a
      message but this is not sufficient as an event should be emitted as
      well. Mgmt application can then decide what to do.
      a08fc66d
  8. 06 11月, 2012 4 次提交
    • P
      qemu: Don't corrupt pointer in qemuDomainSaveMemory() · fb58f8e2
      Peter Krempa 提交于
      The code that was split out into the qemuDomainSaveMemory expands the
      pointer containing the XML description of the domain that it gets from
      higher layers. If the pointer changes the old one is invalid and the
      upper layer function tries to free it causing an abort.
      
      This patch changes the expansion of the original string to a new
      allocation and copy of the contents.
      fb58f8e2
    • M
      esx: Yet another connection fix for 5.1 · 9c294e6f
      Martin Kletzander 提交于
      After the connection to ESX 5.1 being broken since g1e7cd395, the fix
      in bab7752c helped a bit, but still missed a spot, so the connection
      is now successful, but some APIs (for example defineXML) don't work.
      Two cases missing are added in this patch to avoid that.
      9c294e6f
    • M
      qemu: Add controllers in specified order · 0f720ab3
      Michal Privoznik 提交于
      qemu is sensitive to the order of arguments passed. Hence, if a
      device requires a controller, the controller cmd string must
      precede device cmd string. The same apply for controllers, when
      for instance ccid controller requires usb controller. So
      controllers create partial ordering in which they should be added
      to qemu cmd line.
      0f720ab3
    • M
      qemu: Wrap controllers code into dummy loop · 77b93dbc
      Michal Privoznik 提交于
      which just re-indent code and prepare it for next patch.
      77b93dbc
  9. 05 11月, 2012 2 次提交
  10. 04 11月, 2012 1 次提交
    • P
      snapshot: qemu: Add support for external checkpoints · f569b87f
      Peter Krempa 提交于
      This patch adds support to take external system checkpoints.
      
      The functionality is layered on top of the previous disk-only snapshot
      code. When the checkpoint is requested the domain memory is saved to the
      memory image file using migration to file. (The user may specify to
      take the memory image while the guest is live with the
      VIR_DOMAIN_SNAPSHOT_CREATE_LIVE flag.)
      
      The memory save image shares format with the image created by
      virDomainSave() API.
      f569b87f
  11. 03 11月, 2012 11 次提交
    • P
      snapshot: qemu: Rename qemuDomainSnapshotCreateActive · b5fd4044
      Peter Krempa 提交于
      Before now, libvirt supported only internal snapshots for active guests.
      This patch renames this function to qemuDomainSnapshotCreateActiveInternal
      to prepare the grounds for external active snapshots.
      b5fd4044
    • P
      snapshot: qemu: Add async job type for snapshots · 2a59a3d5
      Peter Krempa 提交于
      The new external system checkpoints will require an async job while the
      snapshot is taken. This patch adds QEMU_ASYNC_JOB_SNAPSHOT to track this
      job type.
      2a59a3d5
    • P
      snapshot: Add flag to enable creating checkpoints in live state · 5f75bd4b
      Peter Krempa 提交于
      The default behavior while creating external checkpoints is to pause the
      guest while the memory state is captured. We want the users to sacrifice
      space saving for creating the memory save image while the guest is live
      to minimize downtime.
      
      This patch adds a flag that causes the guest not to be paused before
      taking the snapshot.
       *include/libvirt/libvirt.h.in:
          - add new paused reason: VIR_DOMAIN_PAUSED_SNAPSHOT
          - add new flag for taking snapshot: VIR_DOMAIN_SNAPSHOT_CREATE_LIVE
       *tools/virsh-domain-monitor.c:
          - add string representation for VIR_DOMAIN_PAUSED_SNAPSHOT
       *tools/virsh-snapshot.c:
          - add support for VIR_DOMAIN_SNAPSHOT_CREATE_LIVE
       *tools/virsh.pod:
          - add docs for --live option added to use
          VIR_DOMAIN_SNAPSHOT_CREATE_LIVE flag
      5f75bd4b
    • P
      qemu: Split out domain memory saving code to allow reuse · 2771f8b7
      Peter Krempa 提交于
      The code that saves domain memory by migration to file can be reused
      while doing external checkpoints of a machine. This patch extracts the
      common code and places it in a separate function.
      2771f8b7
    • P
      qemu: Clean up snapshot retrieval to use the new helper · ec69ca14
      Peter Krempa 提交于
      Two other places were left with the old code to look up snapshots.
      Change them to use the snapshot lookup helper.
      ec69ca14
    • P
      cpu: Add AMD Opteron G5 cpu model · d38b934c
      Peter Krempa 提交于
      d38b934c
    • P
      cpu: Add newly added cpu flags · bafffe7a
      Peter Krempa 提交于
      This patch adds a few new processor feature flags. Namely:
       f16c rdrand lwp tbm topoext perfctr_core perfctr_nb fsgsbase bmi1 hle
       avx2 bmi2 erms invpcid rtm rdseed adx tce
      bafffe7a
    • P
      qemu: Fix possible race when pausing guest · d0fc6dc8
      Peter Krempa 提交于
      When pausing the guest while migration is running (to speed up
      convergence) the virDomainSuspend API checks if the migration job is
      active before entering the job. This could cause a possible race if the
      virDomainSuspend is called while the job is active but ends before the
      Suspend API enters the job (this would require that the migration is
      aborted). This would cause a incorrect event to be emitted.
      d0fc6dc8
    • E
      snapshot: merge pre-snapshot checks · de76cae9
      Eric Blake 提交于
      Both system checkpoint snapshots and disk snapshots were iterating
      over all disks, doing a final sanity check before doing any work.
      But since future patches will allow offline snapshots to be either
      external or internal, it makes sense to share the pass over all
      disks, and then relax restrictions in that pass as new modes are
      implemented.  Future patches can then handle external disks when
      the domain is offline, then handle offline --disk-snapshot, and
      finally, combine with migration to file to gain a complete external
      system checkpoint snapshot of an active domain without using 'savevm'.
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotDiskPrepare)
      (qemuDomainSnapshotIsAllowed): Merge...
      (qemuDomainSnapshotPrepare): ...into one function.
      (qemuDomainSnapshotCreateXML): Update caller.
      de76cae9
    • E
      snapshot: populate new XML info for qemu snapshots · e260e401
      Eric Blake 提交于
      Now that the XML supports listing internal snapshots, it is worth
      always populating the <memory> and <disks> element to match.
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): Always
      parse disk info and set memory info.
      e260e401
    • E
      snapshot: improve disk align checking · f9670bf8
      Eric Blake 提交于
      There were not previous callers with require_match set to true.
      I originally implemented this bool with the intent of supporting
      ESX snapshot semantics, where the choice of internal vs. external
      vs. non-checkpointable must be made at domain start, but as ESX
      has not been wired up to use it yet, we might as well fix it to
      work with our next qemu patch for now, and worry about any further
      improvements (changing the bool to a flags argument) if the ESX
      driver decides to use this function in the future.
      
      * src/conf/snapshot_conf.c (virDomainSnapshotAlignDisks): Alter
      logic when require_match is true to deal with new XML.
      f9670bf8
  12. 02 11月, 2012 12 次提交
    • E
      snapshot: new XML for external system checkpoint · 4201a7ea
      Eric Blake 提交于
      Each <domainsnapshot> can now contain an optional <memory>
      element that describes how the VM state was handled, similar
      to disk snapshots.  The new element will always appear in
      output; for back-compat, an input that lacks the element will
      assume 'no' or 'internal' according to the domain state.
      
      Along with this change, it is now possible to pass <disks> in
      the XML for an offline snapshot; this also needs to be wired up
      in a future patch, to make it possible to choose internal vs.
      external on a per-disk basis for each disk in an offline domain.
      At that point, using the --disk-only flag for an offline domain
      will be able to work.
      
      For some examples below, remember that qemu supports the
      following snapshot actions:
      
      qemu-img: offline external and internal disk
      savevm: online internal VM and disk
      migrate: online external VM
      transaction: online external disk
      
      =====
      <domainsnapshot>
        <memory snapshot='no'/>
        ...
      </domainsnapshot>
      
      implies that there is no VM state saved (mandatory for
      offline and disk-only snapshots, not possible otherwise);
      using qemu-img for offline domains and transaction for online.
      
      =====
      <domainsnapshot>
        <memory snapshot='internal'/>
        ...
      </domainsnapshot>
      
      state is saved inside one of the disks (as in qemu's 'savevm'
      system checkpoint implementation).  If needed in the future,
      we can also add an attribute pointing out _which_ disk saved
      the internal state; maybe disk='vda'.
      
      =====
      <domainsnapshot>
        <memory snapshot='external' file='/path/to/state'/>
        ...
      </domainsnapshot>
      
      This is not wired up yet, but future patches will allow this to
      control a combination of 'virsh save /path/to/state' plus disk
      snapshots from the same point in time.
      
      =====
      
      So for 1.0.1 (and later, as needed), I plan to implement this table
      of combinations, with '*' designating new code and '+' designating
      existing code reached through new combinations of xml and/or the
      existing DISK_ONLY flag:
      
      domain  memory  disk   disk-only | result
      -----------------------------------------
      offline omit    omit   any       | memory=no disk=int, via qemu-img
      offline no      omit   any       |+memory=no disk=int, via qemu-img
      offline omit/no no     any       | invalid combination (nothing to snapshot)
      offline omit/no int    any       |+memory=no disk=int, via qemu-img
      offline omit/no ext    any       |*memory=no disk=ext, via qemu-img
      offline int/ext any    any       | invalid combination (no memory to save)
      online  omit    omit   off       | memory=int disk=int, via savevm
      online  omit    omit   on        | memory=no disk=default, via transaction
      online  omit    no/ext off       | unsupported for now
      online  omit    no     on        | invalid combination (nothing to snapshot)
      online  omit    ext    on        | memory=no disk=ext, via transaction
      online  omit    int    off       |+memory=int disk=int, via savevm
      online  omit    int    on        | unsupported for now
      online  no      omit   any       |+memory=no disk=default, via transaction
      online  no      no     any       | invalid combination (nothing to snapshot)
      online  no      int    any       | unsupported for now
      online  no      ext    any       |+memory=no disk=ext, via transaction
      online  int/ext any    on        | invalid combination (disk-only vs. memory)
      online  int     omit   off       |+memory=int disk=int, via savevm
      online  int     no/ext off       | unsupported for now
      online  int     int    off       |+memory=int disk=int, via savevm
      online  ext     omit   off       |*memory=ext disk=default, via migrate+trans
      online  ext     no     off       |+memory=ext disk=no, via migrate
      online  ext     int    off       | unsupported for now
      online  ext     ext    off       |*memory=ext disk=ext, via migrate+transaction
      
      * docs/schemas/domainsnapshot.rng (memory): New RNG element.
      * docs/formatsnapshot.html.in: Document it.
      * src/conf/snapshot_conf.h (virDomainSnapshotDef): New fields.
      * src/conf/domain_conf.c (virDomainSnapshotDefFree)
      (virDomainSnapshotDefParseString, virDomainSnapshotDefFormat):
      Manage new fields.
      * tests/domainsnapshotxml2xmltest.c: New test.
      * tests/domainsnapshotxml2xmlin/*.xml: Update existing tests.
      * tests/domainsnapshotxml2xmlout/*.xml: Likewise.
      4201a7ea
    • E
      snapshot: simplify OOM checking during parse · e66bdbb7
      Eric Blake 提交于
      * src/conf/snapshot_conf.c (virDomainSnapshotDefParseString):
      Simplify OOM reporting.
      e66bdbb7
    • D
      Remove spurious whitespace between function name & open brackets · 1c04f999
      Daniel P. Berrange 提交于
      The libvirt coding standard is to use 'function(...args...)'
      instead of 'function (...args...)'. A non-trivial number of
      places did not follow this rule and are fixed in this patch.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1c04f999
    • P
      net: Mark network persistent when assigning persistent definition · 0211fd6e
      Peter Krempa 提交于
      When assigning the new persistent definition for a transient network
      (thus making it persistent) the network needs to be marked persistent
      before actually atempting to assign the definition.
      0211fd6e
    • P
      net: Add support for changing persistent networks to transient · fa16957c
      Peter Krempa 提交于
      Until now, the network undefine API was able to undefine only inactive
      networks. The restriction doesn't make sense any more so this patch
      implements changing networks to transient.
      fa16957c
    • P
      net: Re-use checks when creating transient networks · b6dbbae1
      Peter Krempa 提交于
      When a transient network was created some of the checks weren't run on
      the definition allowing to start invalid networks.
      
      This patch splits out code to the network validation function and
      re-uses that code when creating transient networks.
      b6dbbae1
    • P
      net: Remove dnsmasq and radvd files also when destroying transient nets · e87af617
      Peter Krempa 提交于
      The network driver didn't care about config files when a network was
      destroyed, just when it was undefined leaving behind files for transient
      networks.
      
      This patch splits out the cleanup code to a helper function that handles
      the cleanup if the inactive network object is being removed and re-uses
      this code when getting rid of inactive networks.
      e87af617
    • P
      net: Move creation of dnsmasq hosts file to function starting dnsmasq · 23ae3fe4
      Peter Krempa 提交于
      The hosts file was created in the network definition function. This
      patch moves the place the file is being created to the point where
      dnsmasq is being started.
      23ae3fe4
    • P
      net: Change argument type of virNetworkObjIsDuplicate() · a3258c0e
      Peter Krempa 提交于
      The argument check_active is used only as a boolean so this patch
      changes the type and updates callers.
      a3258c0e
    • P
      conf: net: Fix deadlock if assignment of network def fails · f8230891
      Peter Krempa 提交于
      When the assignment fails, the network object is not unlocked and next
      call that would use it deadlocks.
      f8230891
    • P
      conf: net: Fix helper for applying new network definition · 947230fb
      Peter Krempa 提交于
      When there's no new definition the helper overwrote the old one with
      NULL.
      947230fb
    • D
      Remove a chunk which should not have been pushed as part of 1.0.0 · bd0cb27c
      Daniel Veillard 提交于
      I didn't noticed that that small old patch was still applied locally
      bd0cb27c