1. 20 10月, 2012 1 次提交
    • E
      storage: use enum for disk driver type · e5e8d5d0
      Eric Blake 提交于
      Actually use the enum in the domain conf structure.
      
      * src/conf/domain_conf.h (_virDomainDiskDef): Store enum rather
      than string for disk type.
      * src/conf/domain_conf.c (virDomainDiskDefFree)
      (virDomainDiskDefParseXML, virDomainDiskDefFormat)
      (virDomainDiskDefForeachPath): Adjust users.
      * src/xenxs/xen_sxpr.c (xenParseSxprDisks, xenFormatSxprDisk):
      Likewise.
      * src/xenxs/xen_xm.c (xenParseXM, xenFormatXMDisk): Likewise.
      * src/vbox/vbox_tmpl.c (vboxAttachDrives): Likewise.
      * src/libxl/libxl_conf.c (libxlMakeDisk): Likewise.
      e5e8d5d0
  2. 18 10月, 2012 1 次提交
    • J
      qemu: Always format CPU topology · f1c70100
      Jiri Denemark 提交于
      When libvirt cannot find a suitable CPU model for host CPU (easily
      reproducible by running libvirt in a guest), it would not provide CPU
      topology in capabilities XML either. Even though CPU topology is known
      and can be queried by virNodeGetInfo. With this patch, CPU topology will
      always be provided in capabilities XML regardless on the presence of CPU
      model.
      f1c70100
  3. 11 10月, 2012 2 次提交
    • P
      qemu: Fix misleading comment for qemuDomainObjBeginJobWithDriver() · 36f7dbf4
      Peter Krempa 提交于
      The comment stated that you may call qemuDomainObjBeginJobWithDriver
      without passing qemud_driver to signal it's not locked.
      qemuDomainObjBeginJobWithDriver still accesses the qemud_driver
      structure and the lock singaling is done through a separate parameter.
      36f7dbf4
    • J
      Add MIGRATABLE flag for virDomainGetXMLDesc · 28f8dfdc
      Jiri Denemark 提交于
      Using VIR_DOMAIN_XML_MIGRATABLE flag, one can request domain's XML
      configuration that is suitable for migration or save/restore. Such XML
      may contain extra run-time stuff internal to libvirt and some default
      configuration may be removed for better compatibility of the XML with
      older libvirt releases.
      
      This flag may serve as an easy way to get the XML that can be passed
      (after desired modifications) to APIs that accept custom XMLs, such as
      virDomainMigrate{,ToURI}2 or virDomainSaveFlags.
      28f8dfdc
  4. 26 9月, 2012 1 次提交
  5. 21 9月, 2012 1 次提交
  6. 13 9月, 2012 1 次提交
    • D
      Turn QEMU capabilities object into a full virObjectPtr · beac09fd
      Daniel P. Berrange 提交于
      The current qemu capabilities are stored in a virBitmapPtr
      object, whose type is exposed to callers. We want to store
      more data besides just the flags, so we need to move to a
      struct type. This object will also need to be reference
      counted, since we'll be maintaining a cache of data per
      binary. This change introduces a 'qemuCapsPtr' virObject
      class. Most of the change is just renaming types and
      variables in all the callers
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      beac09fd
  7. 24 8月, 2012 1 次提交
    • E
      snapshot: make virDomainSnapshotObjList opaque · 3211deba
      Eric Blake 提交于
      We were failing to react to allocation failure when initializing
      a snapshot object list.  Changing things to store a pointer
      instead of a complete object adds one more possible point of
      allocation failure, but at the same time, will make it easier to
      react to failure now, as well as making it easier for a future
      patch to split all virDomainSnapshotPtr handling into a separate
      file, as I continue to add even more snapshot code.
      
      Luckily, there was only one client outside of domain_conf.c that
      was actually peeking inside the object, and a new wrapper function
      was easy.
      
      * src/conf/domain_conf.h (_virDomainObj): Use a pointer.
      (virDomainSnapshotObjListInit): Rename.
      (virDomainSnapshotObjListFree, virDomainSnapshotForEach): New
      declarations.
      (_virDomainSnapshotObjList): Move definitions...
      * src/conf/domain_conf.c: ...here.
      (virDomainSnapshotObjListInit, virDomainSnapshotObjListDeinit):
      Rename...
      (virDomainSnapshotObjListNew, virDomainSnapshotObjListFree): ...to
      these.
      (virDomainSnapshotForEach): New function.
      (virDomainObjDispose, virDomainListPopulate): Adjust callers.
      * src/qemu/qemu_domain.c (qemuDomainSnapshotDiscard)
      (qemuDomainSnapshotDiscardAllMetadata): Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationIsAllowed): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotLoad)
      (qemuDomainUndefineFlags, qemuDomainSnapshotCreateXML)
      (qemuDomainSnapshotListNames, qemuDomainSnapshotNum)
      (qemuDomainListAllSnapshots)
      (qemuDomainSnapshotListChildrenNames)
      (qemuDomainSnapshotNumChildren)
      (qemuDomainSnapshotListAllChildren)
      (qemuDomainSnapshotLookupByName, qemuDomainSnapshotGetParent)
      (qemuDomainSnapshotGetXMLDesc, qemuDomainSnapshotIsCurrent)
      (qemuDomainSnapshotHasMetadata, qemuDomainRevertToSnapshot)
      (qemuDomainSnapshotDelete): Likewise.
      * src/libvirt_private.syms (domain_conf.h): Export new function.
      3211deba
  8. 09 8月, 2012 1 次提交
    • J
      qemu: Migrate at unlimited speed by default · 6cfdeaac
      Jiri Denemark 提交于
      Previously, qemu did not respond to monitor commands during migration if
      the limit was too high. This prevented us from raising the limit
      earlier. The qemu issue seems to be fixed (according to my testing) and
      we may remove the 32Mb/s limit.
      6cfdeaac
  9. 07 8月, 2012 2 次提交
  10. 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
  11. 19 7月, 2012 1 次提交
  12. 28 6月, 2012 1 次提交
  13. 15 6月, 2012 1 次提交
  14. 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
  15. 05 5月, 2012 1 次提交
  16. 11 4月, 2012 3 次提交
    • J
      qemu: Warn on possibly incorrect usage of EnterMonitor* · 6eede368
      Jiri Denemark 提交于
      qemuDomainObjEnterMonitor{,WithDriver} should not be called from async
      jobs, only EnterMonitorAsync variant is allowed.
      6eede368
    • 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
    • J
      qemu: Avoid excessive calls to qemuDomainObjSaveJob() · 31796e2c
      Jiri Denemark 提交于
      As reported by Daniel Berrangé, we have a huge performance regression
      for virDomainGetInfo() due to the change which makes virDomainEndJob()
      save the XML status file every time it is called. Previous to that
      change, 2000 calls to virDomainGetInfo() took ~2.5 seconds. After that
      change, 2000 calls to virDomainGetInfo() take 2 *minutes* 45 secs.
      
      We made the change to be able to recover from libvirtd restart in the
      middle of a job. However, only destroy and async jobs are taken care of.
      Thus it makes more sense to only save domain state XML when these jobs
      are started/stopped.
      31796e2c
  17. 24 3月, 2012 1 次提交
    • E
      snapshot: make offline qemu snapshots atomic · 922d498e
      Eric Blake 提交于
      Offline internal snapshots can be rolled back with just a little
      bit of refactoring, meaning that we are now automatically atomic.
      
      * src/qemu/qemu_domain.c (qemuDomainSnapshotForEachQcow2): Move
      guts...
      (qemuDomainSnapshotForEachQcow2Raw): ...to new helper, to allow
      rollbacks.
      922d498e
  18. 22 3月, 2012 2 次提交
    • 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: Add support for domain cleanup callbacks · bf9f0a97
      Jiri Denemark 提交于
      Add support for registering cleanup callbacks to be run when a domain
      transitions to shutoff state.
      bf9f0a97
  19. 14 3月, 2012 1 次提交
  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. 27 2月, 2012 1 次提交
    • P
      qemu: Add ability to abort existing console while creating new one · 47161382
      Peter Krempa 提交于
      This patch fixes console corruption, that happens if two concurrent
      sessions are opened for a single console on a domain. Result of this
      corruption was that each of the console streams recieved just a part
      of the data written to the pipe so every console rendered unusable.
      
      New helper function for safe console handling is used to establish the
      console stream connection. This function ensures that no other libvirt
      client is using the console (with the ability to disconnect consoles of
      libvirt clients) and that no UUCP style lockfile is placed on the PTY
      device.
      
      * src/qemu/qemu_domain.h
              - add data structure to domain's private data dealing with
                console connections
      * src/qemu/qemu_domain.c:
              - allocate/free domain's console data structure
      * src/qemu/qemu_driver.c
              - use the new helper function for console handling
      47161382
  22. 01 2月, 2012 2 次提交
  23. 24 1月, 2012 1 次提交
    • D
      QEMU guest agent support · c160ce33
      Daniel P. Berrange 提交于
      There is now a standard QEMU guest agent that can be installed
      and given a virtio serial channel
      
          <channel type='unix'>
            <source mode='bind' path='/var/lib/libvirt/qemu/f16x86_64.agent'/>
            <target type='virtio' name='org.qemu.guest_agent.0'/>
          </channel>
      
      The protocol that runs over the guest agent is JSON based and
      very similar to the JSON monitor. We can't use exactly the same
      code because there are some odd differences in the way messages
      and errors are structured. The qemu_agent.c file is based on
      a combination and simplification of qemu_monitor.c and
      qemu_monitor_json.c
      
      * src/qemu/qemu_agent.c, src/qemu/qemu_agent.h: Support for
        talking to the agent for shutdown
      * src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Add thread
        helpers for talking to the agent
      * src/qemu/qemu_process.c: Connect to agent whenever starting
        a guest
      * src/qemu/qemu_monitor_json.c: Make variable static
      c160ce33
  24. 17 1月, 2012 2 次提交
    • J
      Taint domains configured with cpu mode=host-passthrough · c8506d66
      Jiri Denemark 提交于
      There are several reasons for doing this:
      
      - the CPU specification is out of libvirt's control so we cannot
        guarantee stable guest ABI
      - not every feature of a CPU may actually work as expected when
        advertised directly to a guest
      - migration between two machines with exactly the same CPU may work but
        no guarantees can be made
      - this mode is not supported and its use is at one's own risk
      c8506d66
    • J
      cpu: Update guest CPU in host-* mode · 277bc0dc
      Jiri Denemark 提交于
      VIR_DOMAIN_XML_UPDATE_CPU flag for virDomainGetXMLDesc may be used to
      get updated custom mode guest CPU definition in case it depends on host
      CPU. This patch implements the same behavior for host-model and
      host-passthrough CPU modes.
      277bc0dc
  25. 08 1月, 2012 1 次提交
    • L
      config: report error when script given for inappropriate interface type · 1734cdb9
      Laine Stump 提交于
      This fixes https://bugzilla.redhat.com/show_bug.cgi?id=638633
      
      Although scripts are not used by interfaces of type other than
      "ethernet" in qemu, due to the fact that the parser stores the script
      name in a union that is only valid when type is ethernet or bridge,
      there is no way for anyone except the parser itself to catch the
      problem of specifying an interface script for an inappropriate
      interface type (by the time the parsed data gets back to the code that
      called the parser, all evidence that a script was specified is
      forgotten).
      
      Since the parser itself should be agnostic to which type of interface
      allows scripts (an example of why: a script specified for an interface
      of type bridge is valid for xen domains, but not for qemu domains),
      the solution here is to move the script out of the union(s) in the
      DomainNetDef, always populate it when specified (regardless of
      interface type), and let the driver decide whether or not it is
      appropriate.
      
      Currently the qemu, xen, libxml, and uml drivers recognize the script
      parameter and do something with it (the uml driver only to report that
      it isn't supported). Those drivers have been updated to log a
      CONFIG_UNSUPPORTED error when a script is specified for an interface
      type that's inappropriate for that particular hypervisor.
      
      (NB: There was earlier discussion of solving this problem by adding a
      VALIDATE flag to all libvirt APIs that accept XML, which would cause
      the XML to be validated against the RNG files. One statement during
      that discussion was that the RNG shouldn't contain hypervisor-specific
      things, though, and a proper solution to this problem would require
      that (again, because a script for an interface of type "bridge" is
      accepted by xen, but not by qemu).
      1734cdb9
  26. 04 1月, 2012 1 次提交
  27. 19 12月, 2011 1 次提交
    • D
      Hide use of timers for domain event dispatch · 34ad1353
      Daniel P. Berrange 提交于
      Currently all drivers using domain events need to provide a callback
      for handling a timer to dispatch events in a clean stack. There is
      no technical reason for dispatch to go via driver specific code. It
      could trivially be dispatched directly from the domain event code,
      thus removing tedious boilerplate code from all drivers
      
      Also fix the libxl & xen drivers to pass 'true' when creating the
      virDomainEventState, since they run inside the daemon & thus always
      expect events to be present.
      
      * src/conf/domain_event.c, src/conf/domain_event.h: Internalize
        dispatch of events from timer callback
      * src/libxl/libxl_driver.c, src/lxc/lxc_driver.c,
        src/qemu/qemu_domain.c, src/qemu/qemu_driver.c,
        src/remote/remote_driver.c, src/test/test_driver.c,
        src/uml/uml_driver.c, src/vbox/vbox_tmpl.c,
        src/xen/xen_driver.c: Remove all timer dispatch functions
      34ad1353
  28. 30 11月, 2011 1 次提交
    • D
      Remove time APIs from src/util/util.h · a8bb75a3
      Daniel P. Berrange 提交于
      The virTimestamp and virTimeMs functions in src/util/util.h
      duplicate functionality from virtime.h, in a non-async signal
      safe manner. Remove them, and convert all code over to the new
      APIs.
      
      * src/util/util.c, src/util/util.h: Delete virTimeMs and virTimestamp
      * src/lxc/lxc_driver.c, src/qemu/qemu_domain.c,
        src/qemu/qemu_driver.c, src/qemu/qemu_migration.c,
        src/qemu/qemu_process.c, src/util/event_poll.c: Convert to use
        virtime APIs
      a8bb75a3
  29. 23 11月, 2011 1 次提交
    • P
      qemu: Avoid dereference of NULL pointer · c4b32641
      Peter Krempa 提交于
      If something fails while initializing qemu job object in
      qemuDomainObjPrivateAlloc(), memory to the private pointer is freed, but
      after that, the pointer is still dereferenced, which may result in a
      segfault.
      
      * qemuDomainObjPrivateAlloc() - Don't dereference NULL pointer.
      c4b32641
  30. 04 11月, 2011 1 次提交
    • D
      Fix naming of constant for disk event · 26ff8996
      Daniel P. Berrange 提交于
      All constants related to events should have a prefix of
      VIR_DOMAIN_EVENT_
      
      * include/libvirt/libvirt.h.in, src/qemu/qemu_domain.c:
        Rename VIR_DOMAIN_DISK_CHANGE_MISSING_ON_START to
        VIR_DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START
      26ff8996
  31. 31 10月, 2011 1 次提交
  32. 28 10月, 2011 1 次提交
  33. 25 10月, 2011 1 次提交
    • M
      startupPolicy: Emit event on disk source dropping · baf2ff7e
      Michal Privoznik 提交于
      If a disk source gets dropped because it is not accessible,
      mgmt application might want to be informed about this. Therefore
      we need to emit an event. The event presented in this patch
      is however a bit superset of what written above. The reason is simple:
      an intention to be easily expanded, e.g. on 'user ejected disk
      in guest' events. Therefore, callback gets source string and disk alias
      (which should be unique among a domain) and reason (an integer);
      baf2ff7e