1. 07 8月, 2012 1 次提交
    • D
      Convert public datatypes to inherit from virObject · 46ec5f85
      Daniel P. Berrange 提交于
      This converts the following public API datatypes to use the
      virObject infrastructure:
      
        virConnectPtr
        virDomainPtr
        virDomainSnapshotPtr
        virInterfacePtr
        virNetworkPtr
        virNodeDevicePtr
        virNWFilterPtr
        virSecretPtr
        virStreamPtr
        virStorageVolPtr
        virStoragePoolPtr
      
      The code is significantly simplified, since the mutex in the
      virConnectPtr object now only needs to be held when accessing
      the per-connection virError object instance. All other operations
      are completely lock free.
      
      * src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
        public datatypes to use virObject
      * src/conf/domain_event.c, src/phyp/phyp_driver.c,
        src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
        src/qemu/qemu_process.c, src/storage/storage_driver.c,
        src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
        tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
        tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
        to use virObjectUnref/virObjectRef
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      46ec5f85
  2. 23 7月, 2012 1 次提交
    • O
      Desert the FSF address in copyright · f9ce7dad
      Osier Yang 提交于
      Per the FSF address could be changed from time to time, and GNU
      recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html)
      
        You should have received a copy of the GNU General Public License
        along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
      
      This patch removes the explicit FSF address, and uses above instead
      (of course, with inserting 'Lesser' before 'General').
      
      Except a bunch of files for security driver, all others are changed
      automatically, the copyright for securify files are not complete,
      that's why to do it manually:
      
        src/security/security_selinux.h
        src/security/security_driver.h
        src/security/security_selinux.c
        src/security/security_apparmor.h
        src/security/security_apparmor.c
        src/security/security_driver.c
      f9ce7dad
  3. 19 7月, 2012 2 次提交
  4. 17 7月, 2012 1 次提交
    • S
      Convert 'raw MAC address' usages to use virMacAddr · 387117ad
      Stefan Berger 提交于
      Introduce new members in the virMacAddr 'class'
      - virMacAddrSet: set virMacAddr from a virMacAddr
      - virMacAddrSetRaw: setting virMacAddr from raw 6 byte MAC address buffer
      - virMacAddrGetRaw: writing virMacAddr into raw 6 byte MAC address buffer
      - virMacAddrCmp: comparing two virMacAddr
      - virMacAddrCmpRaw: comparing a virMacAddr with a raw 6 byte MAC address buffer
      
      then replace raw MAC addresses by replacing
      
      - 'unsigned char *' with virMacAddrPtr
      - 'unsigned char ... [VIR_MAC_BUFLEN]' with virMacAddr
      
      and introduce usage of above functions where necessary.
      387117ad
  5. 03 7月, 2012 1 次提交
  6. 19 6月, 2012 1 次提交
    • E
      snapshot: merge domain and snapshot computation · 7e111c6f
      Eric Blake 提交于
      Now that domain listing is a thin wrapper around child listing,
      it's easier to have a common entry point.  This restores the
      hashForEach optimization lost in the previous patch when there
      are no snapshots being filtered out of the entire list.
      
      * src/conf/domain_conf.h (virDomainSnapshotObjListGetNames)
      (virDomainSnapshotObjListNum): Add parameter.
      (virDomainSnapshotObjListGetNamesFrom)
      (virDomainSnapshotObjListNumFrom): Delete.
      * src/libvirt_private.syms (domain_conf.h): Drop deleted functions.
      * src/conf/domain_conf.c (virDomainSnapshotObjListGetNames):
      Merge, and (re)add an optimization.
      * src/qemu/qemu_driver.c (qemuDomainUndefineFlags)
      (qemuDomainSnapshotListNames, qemuDomainSnapshotNum)
      (qemuDomainSnapshotListChildrenNames)
      (qemuDomainSnapshotNumChildren): Update callers.
      * src/qemu/qemu_migration.c (qemuMigrationIsAllowed): Likewise.
      * src/conf/virdomainlist.c (virDomainListPopulate): Likewise.
      7e111c6f
  7. 12 6月, 2012 1 次提交
  8. 09 6月, 2012 1 次提交
  9. 31 5月, 2012 1 次提交
    • W
      qemu: avoid closing fd more than once · b19c236d
      Wen Congyang 提交于
      If we migrate to fd, spec->fwdType is not MIGRATION_FWD_DIRECT,
      we will close spec->dest.fd.local in qemuMigrationRun(). So we
      should set spec->dest.fd.local to -1 in qemuMigrationRun().
      
      Bug present since 0.9.5 (commit 32617617).
      b19c236d
  10. 07 5月, 2012 1 次提交
    • J
      qemu: Emit compatible XML when migrating a domain · 409b5f54
      Jiri Denemark 提交于
      When we added the default USB controller into domain XML, we efficiently
      broke migration to older versions of libvirt that didn't support USB
      controllers at all (0.9.4 and earlier) even for domains that don't use
      anything that the older libvirt can't provide. We still want to present
      the default USB controller in any XML seen by a user/app but we can
      safely remove it from the domain XML used during migration. If we are
      migrating to a new enough libvirt, it will add the controller XML back,
      while older libvirt won't be confused with it although it will still
      tell qemu to create the controller.
      
      Similar approach can be used in the future whenever we find out we
      always enabled some kind of device without properly advertising it in
      domain XML.
      409b5f54
  11. 05 5月, 2012 1 次提交
  12. 26 4月, 2012 3 次提交
    • J
      qemu: Avoid bogus error at the end of tunnelled migration · 8ef5f263
      Jiri Denemark 提交于
      Once qemu monitor reports migration has completed, we just closed our
      end of the pipe and let migration tunnel die. This generated bogus error
      in case we did so before the thread saw EOF on the pipe and migration
      was aborted even though it was in fact successful.
      
      With this patch we first wake up the tunnel thread and once it has read
      all data from the pipe and finished the stream we close the
      filedescriptor.
      
      A small additional bonus of this patch is that real errors reported
      inside qemuMigrationIOFunc are not overwritten by virStreamAbort any
      more.
      8ef5f263
    • J
      qemu: Fix detection of failed migration · 25a63451
      Jiri Denemark 提交于
      When QEMU reported failed or canceled migration, we correctly detected
      it but didn't really consider it as an error condition and migration
      protocol just went on. Luckily, some of the subsequent steps eventually
      failed end we reported an (unrelated and mostly random) error back to
      the caller.
      25a63451
    • J
      qemu: Preserve original error during migration · 6d646947
      Jiri Denemark 提交于
      In some cases (spotted with broken connection during tunneled migration)
      we were overwriting the original error with worse or even misleading
      errors generated when we were cleaning up after failed migration.
      6d646947
  13. 16 4月, 2012 1 次提交
  14. 13 4月, 2012 1 次提交
  15. 11 4月, 2012 1 次提交
    • J
      qemu: Track job owner for better debugging · 08ec1d78
      Jiri Denemark 提交于
      In case an API fails with "cannot acquire state change lock", searching
      for the API that possibly forgot to end its job is not always easy.
      Let's keep track of the job owner and print it out for easier
      identification.
      08ec1d78
  16. 30 3月, 2012 1 次提交
  17. 29 3月, 2012 1 次提交
    • C
      qemu: Make migration fail when port profile association fails on the dst host · a02500d0
      Christian Benvenuti 提交于
      In the current V3 migration protocol, Libvirt does not
      check the result of the function
      
        qemuMigrationVPAssociatePortProfiles
      
      This means that it is possible for a migration to complete
      successfully even when the VM loses network connectivity on
      the destination host.
      
      With this change libvirt aborts the migration
      (during the "finish" step) when the above function fails, that
      is to say when at least one of the port profile associations fails.
      
      Signed-off by: Christian Benvenuti <benve@cisco.com>
      a02500d0
  18. 23 3月, 2012 2 次提交
    • D
      Centralize error reporting for URI parsing/formatting problems · 1f66c18f
      Daniel P. Berrange 提交于
      Move error reporting out of the callers, into virURIParse
      and virURIFormat, to get consistency.
      
      * include/libvirt/virterror.h, src/util/virterror.c: Add VIR_FROM_URI
      * src/util/viruri.c, src/util/viruri.h: Add error reporting
      * src/esx/esx_driver.c, src/libvirt.c, src/libxl/libxl_driver.c,
        src/lxc/lxc_driver.c, src/openvz/openvz_driver.c,
        src/qemu/qemu_driver.c, src/qemu/qemu_migration.c,
        src/remote/remote_driver.c, src/uml/uml_driver.c,
        src/vbox/vbox_tmpl.c, src/vmx/vmx.c, src/xen/xen_driver.c,
        src/xen/xend_internal.c, tests/viruritest.c: Remove error
        reporting
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1f66c18f
    • D
      Use virURIFree instead of xmlFreeURI · c33dae31
      Daniel P. Berrange 提交于
      Since we defined a custom virURIPtr type, we should use a
      virURIFree method instead of assuming it will always be
      a typedef for xmlURIPtr
      
      * src/util/viruri.c, src/util/viruri.h, src/libvirt_private.syms:
        Add a virURIFree method
      * src/datatypes.c, src/esx/esx_driver.c, src/libvirt.c,
        src/qemu/qemu_migration.c, src/vmx/vmx.c, src/xen/xend_internal.c,
        tests/viruritest.c: s/xmlFreeURI/virURIFree/
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      c33dae31
  19. 22 3月, 2012 3 次提交
    • J
      qemu: Avoid dangling migration-out job when client dies · 1fdc53c3
      Jiri Denemark 提交于
      When a client which started non-p2p migration dies in a bad time, the
      source libvirtd never clears the migration job and almost nothing can be
      done with the domain without restarting the daemon. This patch makes use
      of connection close callbacks and ensures that migration job is properly
      discarded when the client disconnects.
      1fdc53c3
    • J
      qemu: Avoid dangling migration-in job on shutoff domains · 4f061ea6
      Jiri Denemark 提交于
      Destination daemon should not rely on the client or source daemon
      (depending on the type of migration) to call Finish when migration
      fails, because the client may crash before it can do so. The domain
      prepared for incoming migration is set to be destroyed (and migration
      job cleaned up) when connection with the client closes but this is not
      enough. If the associated qemu process crashes after Prepare step and
      the domain is cleaned up before the connection gets closed, autodestroy
      is not called for the domain and migration jobs remains set. In case the
      domain is defined on destination host (i.e., it is not completely
      removed once destroyed) we keep the job set for ever. To fix this, we
      register a cleanup callback which is responsible to clean migration-in
      job when a domain dies anywhere between Prepare and Finish steps. Note
      that we can't blindly clean any job when spotting EOF on monitor since
      normally an API is running at that time.
      4f061ea6
    • J
      qemu: Use unlimited speed when migrating to file · 9f71368d
      Jiri Denemark 提交于
      This reverts commit 61f2b6ba and most of
      commit d8916dc8, which effectively
      brings back commit ef1065cf written by
      Jim Fehlig:
      
      The qemu migration speed default is 32MiB/s as defined in migration.c
      
      /* Migration speed throttling */
      static int64_t max_throttle = (32 << 20);
      
      There's no need to throttle migration when targeting a file, so set
      migration speed to unlimited prior to migration, and restore to libvirt
      default value after migration.
      
      Default units is MB for migrate_set_speed monitor command, so
      (INT64_MAX / (1024 * 1024)) is used for unlimited migration speed.
      
      This was reverted because migration to file could not be canceled and
      even monitored since qemu was not processing any monitor commands until
      the migration finished. This is now different as we make sure the
      file descriptor we pass to qemu is able to properly report EAGAIN.
      Recent qemu changes might have helped as well.
      
      I tested managedsave with this patch in and indeed, it is 10x faster
      while I can still monitor its progress.
      9f71368d
  20. 13 3月, 2012 1 次提交
    • J
      qemu: Fix (managed)save and snapshots with host mode CPU · 041109af
      Jiri Denemark 提交于
      When host-model and host-passthrouh CPU modes were introduced, qemu
      driver was properly modify to update guest CPU definition during
      migration so that we use the right CPU at the destination. However,
      similar treatment is needed for (managed)save and snapshots since they
      need to save the exact CPU so that a domain can be properly restored.
      To avoid repetition of such situation, all places that need live XML
      share the code which generates it.
      
      As a side effect, this patch fixes error reporting from
      qemuDomainSnapshotWriteMetadata().
      041109af
  21. 08 3月, 2012 1 次提交
    • M
      qemu: Fix startupPolicy for snapshot-revert · b819b3b7
      Michal Privoznik 提交于
      Currently, startupPolicy='requisite' was determining cold boot
      by migrateFrom != NULL. That means, if domain was started up
      with migrateFrom set we didn't require disk source path and allowed
      it to be dropped. However, on snapshot-revert domain wasn't migrated
      but according to documentation, requisite should drop disk source
      as well.
      b819b3b7
  22. 06 3月, 2012 1 次提交
    • R
      util: Changes to support portprofiles for hostdevs · 15bbfd83
      Roopa Prabhu 提交于
      This patch includes the following changes to virnetdevmacvlan.c and
      virnetdevvportprofile.c:
      
       - removes some netlink functions which are now available in
         virnetdev.c
      
       - Adds a vf argument to all port profile functions.
      
      For 802.1Qbh devices, the port profile calls can use a vf argument if
      passed by the caller. If the vf argument is -1 it will try to derive the vf
      if the device passed is a virtual function.
      
      For 802.1Qbg devices, This patch introduces a null check for the device
      argument because during port profile assignment on a hostdev, this argument
      can be null.
      Signed-off-by: NRoopa Prabhu <roprabhu@cisco.com>
      15bbfd83
  23. 05 3月, 2012 1 次提交
  24. 29 2月, 2012 2 次提交
  25. 25 2月, 2012 1 次提交
    • M
      Fixed URI parsing · 9f748277
      Martin Kletzander 提交于
      Function xmlParseURI does not remove square brackets around IPv6
      address when parsing. One of the solutions is making wrappers around
      functions working with xmlURI*. This assures that uri->server will be
      always properly assigned and it doesn't have to be changed when used
      on some new place in the code.
      For this purpose, functions virParseURI and virSaveURI were
      added. These function are wrappers around xmlParseURI and xmlSaveUri
      respectively.
      Also there is one new syntax check function to prohibit these functions
      anywhere else.
      
      File changes:
       - src/util/viruri.h        -- declaration
       - src/util/viruri.c        -- definition
       - src/libvirt_private.syms -- symbol export
       - src/Makefile.am          -- added source and header files
       - cfg.mk                   -- added sc_prohibit_xmlURI
       - all others               -- ID name and include fixes
      9f748277
  26. 23 2月, 2012 1 次提交
    • J
      qemu: Forbid migration with cache != none · d57485f7
      Jiri Denemark 提交于
      Migrating domains with disks using cache != none is unsafe unless the
      disk images are stored on coherent clustered filesystem. Thus we forbid
      migrating such domains unless VIR_MIGRATE_UNSAFE flags is used.
      d57485f7
  27. 16 2月, 2012 2 次提交
  28. 06 2月, 2012 1 次提交
    • J
      qemu: Fix seamless spice migration · d9d518b1
      Jiri Denemark 提交于
      Calling qemuDomainMigrateGraphicsRelocate notifies spice clients to
      connect to destination qemu so that they can seamlessly switch streams
      once migration is done. Unfortunately, current qemu is not able to
      accept any connections while incoming migration connection is open.
      Thus, we need to delay opening the migration connection to the point
      spice client is already connected to the destination qemu.
      d9d518b1
  29. 04 2月, 2012 1 次提交
  30. 17 1月, 2012 1 次提交
    • J
      Clarify semantics of virDomainMigrate{,ToURI}2 · 5e31e713
      Jiri Denemark 提交于
      Commit 5d784bd6 was a nice attempt to
      clarify the semantics by requiring domain name from dxml to either match
      original name or dname. However, setting dxml domain name to dname
      doesn't really work since destination host needs to know the original
      domain name to be able to use it in migration cookies. This patch
      requires domain name in dxml to match the original domain name. The
      change should be safe and backward compatible since migration would fail
      just a bit later in the process.
      5e31e713
  31. 11 1月, 2012 1 次提交
    • D
      Change security driver APIs to use virDomainDefPtr instead of virDomainObjPtr · 99be754a
      Daniel P. Berrange 提交于
      When sVirt is integrated with the LXC driver, it will be neccessary
      to invoke the security driver APIs using only a virDomainDefPtr
      since the lxc_container.c code has no virDomainObjPtr available.
      Aside from two functions which want obj->pid, every bit of the
      security driver code only touches obj->def. So we don't need to
      pass a virDomainObjPtr into the security drivers, a virDomainDefPtr
      is sufficient. Two functions also gain a 'pid_t pid' argument.
      
      * src/qemu/qemu_driver.c, src/qemu/qemu_hotplug.c,
        src/qemu/qemu_migration.c, src/qemu/qemu_process.c,
        src/security/security_apparmor.c,
        src/security/security_dac.c,
        src/security/security_driver.h,
        src/security/security_manager.c,
        src/security/security_manager.h,
        src/security/security_nop.c,
        src/security/security_selinux.c,
        src/security/security_stack.c: Change all security APIs to use a
        virDomainDefPtr instead of virDomainObjPtr
      99be754a
  32. 16 12月, 2011 1 次提交
    • P
      migration: Add more specific error code/message on migration abort · 8fb2aeb6
      Peter Krempa 提交于
      A generic error code was returned, if the user aborted a migration job.
      This made it hard to distinguish between a user requested abort and an
      error that might have occured. This patch introduces a new error code,
      which is returned in the specific case of a user abort, while leaving
      all other failures with their existing code. This makes it easier to
      distinguish between failure while mirgrating and an user requested
      abort.
      
       * include/libvirt/virterror.h: - add new error code
       * src/util/virterror.c: - add message for the new error code
       * src/qemu/qemu_migration.h: - Emit operation aborted error instead of
                                      operation failed, on migration abort
      8fb2aeb6