1. 01 1月, 2012 1 次提交
  2. 29 12月, 2011 1 次提交
  3. 28 12月, 2011 1 次提交
  4. 25 12月, 2011 1 次提交
  5. 21 12月, 2011 2 次提交
  6. 19 12月, 2011 4 次提交
    • D
      Only add the timer when a callback is registered · 707781fe
      Daniel P. Berrange 提交于
      The lifetime of the virDomainEventState object is tied to
      the lifetime of the driver, which in stateless drivers is
      tied to the lifetime of the virConnectPtr.
      
      If we add & remove a timer when allocating/freeing the
      virDomainEventState object, we can get a situation where
      the timer still triggers once after virDomainEventState
      has been freed. The timeout callback can't keep a ref
      on the event state though, since that would be a circular
      reference.
      
      The trick is to only register the timer when a callback
      is registered with the event state & remove the timer
      when the callback is unregistered.
      
      The demo for the bug is to run
      
        while true ; do date ; ../tools/virsh -q -c test:///default 'shutdown test; undefine test; dominfo test' ; done
      
      prior to this fix, it will frequently hang and / or
      crash, or corrupt memory
      707781fe
    • 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
    • D
      Convert drivers to thread safe APIs for adding callbacks · 7b87a30f
      Daniel P. Berrange 提交于
      * src/libxl/libxl_driver.c, src/lxc/lxc_driver.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: Convert
        to threadsafe APIs
      7b87a30f
    • D
      Return count of callbacks when registering callbacks · d09f6ba5
      Daniel P. Berrange 提交于
      When registering a callback for a particular event some callers
      need to know how many callbacks already exist for that event.
      While it is possible to ask for a count, this is not free from
      race conditions when threaded. Thus the API for registering
      callbacks should return the count of callbacks. Also rename
      virDomainEventStateDeregisterAny to virDomainEventStateDeregisterID
      
      * src/conf/domain_event.c, src/conf/domain_event.h,
        src/libvirt_private.syms: Return count of callbacks when
        registering callbacks
      * src/libxl/libxl_driver.c, src/libxl/libxl_driver.c,
        src/qemu/qemu_driver.c, src/remote/remote_driver.c,
        src/remote/remote_driver.c, src/uml/uml_driver.c,
        src/vbox/vbox_tmpl.c, src/xen/xen_driver.c: Update
        for change in APIs
      d09f6ba5
  7. 16 12月, 2011 1 次提交
    • E
      qemu: detect truncated file as invalid save image · d99fe011
      Eric Blake 提交于
      If managed save fails at the right point in time, then the save
      image can end up with 0 bytes in length (no valid header), and
      our attempts in commit 55d88def to detect and skip invalid save
      files missed this case.
      
      * src/qemu/qemu_driver.c (qemuDomainSaveImageOpen): Also unlink
      empty file as corrupt.  Reported by Dennis Householder.
      d99fe011
  8. 14 12月, 2011 1 次提交
  9. 12 12月, 2011 1 次提交
    • J
      qemu: Disable EOF processing during qemuDomainDestroy · 5547d2b8
      Jiri Denemark 提交于
      When destroying a domain qemuDomainDestroy kills its qemu process and
      starts a new job, which means it unlocks the domain object and locks it
      again after some time. Although the object is usually unlocked for a
      pretty short time, chances are another thread processing an EOF event on
      qemu monitor is able to lock the object first and does all the cleanup
      by itself. This leads to wrong shutoff reason and lifecycle event detail
      and virDomainDestroy API incorrectly reporting failure to destroy an
      inactive domain.
      
      Reported by Charlie Smurthwaite.
      5547d2b8
  10. 10 12月, 2011 1 次提交
  11. 01 12月, 2011 4 次提交
    • L
      Fix a logic error for setting block I/O · ac6b368d
      Lei Li 提交于
      Fix a logic error, the initial value of ret = -1, if just set --config,
      it will goto endjob directly without doing its really job here.
      Signed-off-by: NLei Li <lilei@linux.vnet.ibm.com>
      ac6b368d
    • H
      qemu: filter blkio 0-device-weight at two other places · 25a5f07c
      Hu Tao 提交于
      filter 0-device-weight when:
      
        - getting blkio parameters with --config
        - starting up a domain
      
      When testing with blkio, I found these issues:
      
        (dom is down)
        virsh blkiotune dom --device-weights /dev/sda,300,/dev/sdb,500
        virsh blkiotune dom --device-weights /dev/sda,300,/dev/sdb,0
        virsh blkiotune dom
        weight         : 800
        device_weight  : /dev/sda,200,/dev/sdb,0
      
        # issue 1: shows 0 device weight of /dev/sdb that may confuse user
      
        (continued)
        virsh start dom
      
        # issue 2: If /dev/sdb doesn't exist, libvirt refuses to bring the
        # dom up because it wants to set the device weight to 0 of a
        # non-existing device. Since 0 means no weight-limit, we really don't
        # have to set it.
      25a5f07c
    • E
      qemu: amend existing table of device weights · 22cf6d46
      Eric Blake 提交于
      Prior to this patch, for a running dom, the commands:
      
      $ virsh blkiotune dom --device-weights /dev/sda,502,/dev/sdb,498
      $ virsh blkiotune dom --device-weights /dev/sda,503
      $ virsh blkiotune dom
      weight         : 500
      device_weight  : /dev/sda,503
      
      claim that /dev/sdb no longer has a non-default weight, but
      directly querying cgroups says otherwise:
      
      $ cat /cgroup/blkio/libvirt/qemu/dom/blkio.weight_device
      8:0     503
      8:16    498
      
      After this patch, an explicit 0 is required to remove a device path
      from the XML, and omitting a device path that was previously
      specified leaves that device path untouched in the XML, to match
      cgroups behavior.
      
      * src/qemu/qemu_driver.c (parseBlkioWeightDeviceStr): Rename...
      (qemuDomainParseDeviceWeightStr): ...and use correct type.
      (qemuDomainSetBlkioParameters): After parsing string, modify
      rather than replacing existing table.
      * tools/virsh.pod (blkiotune): Tweak wording.
      22cf6d46
    • L
      Implement virDomain{Set, Get}BlockIoTune for the qemu driver · eca96694
      Lei Li 提交于
      Implement the block I/O throttle setting and getting support to qemu
      driver.
      Signed-off-by: NLei Li <lilei@linux.vnet.ibm.com>
      Signed-off-by: NZhi Yong Wu <wuzhy@linux.vnet.ibm.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      eca96694
  12. 30 11月, 2011 4 次提交
    • 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
    • H
      blkiotune: add qemu support for blkiotune.device_weight · 93ab5859
      Hu Tao 提交于
      Implement setting/getting per-device blkio weights in qemu,
      using the cgroups blkio.weight_device tunable.
      93ab5859
    • E
      qemu: fix blkiotune --live --config · 659ded58
      Eric Blake 提交于
      Without this,  'virsh blkiotune --live --config --weight=n'
      only affected live.
      
      * src/qemu/qemu_driver.c (qemuDomainSetBlkioParameters): Allow
      setting both configurations at once.
      659ded58
    • E
      qemu, lxc: drop redundant checks · 51727c1d
      Eric Blake 提交于
      After the previous patch, there are now some redundant checks.
      
      * src/qemu/qemu_driver.c (qemudDomainGetVcpuPinInfo)
      (qemuGetSchedulerParametersFlags): Drop checks now guaranteed by
      libvirt.c.
      * src/lxc/lxc_driver.c (lxcGetSchedulerParametersFlags):
      Likewise.
      51727c1d
  13. 29 11月, 2011 2 次提交
    • O
      block_resize: Implement qemu driver method · d1a6c77a
      Osier Yang 提交于
      It requires the domain is running, otherwise fails. Resize to a lower
      size is supported, but should be used with extreme caution.
      
      In order to prohibit the "size" overflowing after multiplied by
      1024. We do checking in the codes. For QMP mode, the default units
      is Bytes, the passed size needs to be multiplied by 1024, however,
      for HMP mode, the default units is "Megabytes", the passed "size"
      needs to be divided by 1024 then.
      d1a6c77a
    • S
      Implement the core API to suspend/resume the host · 4ddb37c3
      Srivatsa S. Bhat 提交于
      Add the core functions that implement the functionality of the API.
      Suspend is done by using an asynchronous mechanism so that we can return
      the status to the caller before the host gets suspended. This asynchronous
      operation is achieved by suspending the host in a separate thread of
      execution. However, returning the status to the caller is only best-effort,
      but not guaranteed.
      
      To resume the host, an RTC alarm is set up (based on how long we want to
      suspend) before suspending the host. When this alarm fires, the host
      gets woken up.
      
      Suspend-to-RAM operation on a host running Linux can take upto more than 20
      seconds, depending on the load of the system. (Freezing of tasks, an operation
      preceding any suspend operation, is given up after a 20 second timeout).
      And Suspend-to-Disk can take even more time, considering the time required
      for compaction, creating the memory image and writing it to disk etc.
      So, we do not allow the user to specify a suspend duration of less than 60
      seconds, to be on the safer side, since we don't want to prematurely declare
      failure when we only had to wait for some more time.
      4ddb37c3
  14. 24 11月, 2011 2 次提交
  15. 23 11月, 2011 2 次提交
    • E
      qemu: fix a const-correctness issue · db2f6807
      Eric Blake 提交于
      Generally, functions which return malloc'd strings should be typed
      as 'char *', not 'const char *', to make it obvious that the caller
      is responsible to free things.  free(const char *) fails to compile,
      and although we have a cast embedded in VIR_FREE to work around poor
      code that frees const char *, it's better to not rely on that hack.
      
      * src/qemu/qemu_driver.c (qemuDiskPathToAlias): Change return type.
      (qemuDomainBlockJobImpl): Update caller.
      db2f6807
    • E
      blockstats: support lookup by path in blockstats · c725e2dc
      Eric Blake 提交于
      Commit 89b6284f made it possible to pass either a source name or
      the target device to most API demanding a disk designation, but
      forgot to update the documentation.  It also failed to update
      virDomainBlockStats to take both forms. This patch fixes both the
      documentation and the remaining function.
      
      Xen continues to use just device shorthand (that is, I did not
      implement path lookup there, since xen does not track a domain_conf
      to quickly tie a path back to the device shorthand).
      
      * src/libvirt.c (virDomainBlockStats, virDomainBlockStatsFlags)
      (virDomainGetBlockInfo, virDomainBlockPeek)
      (virDomainBlockJobAbort, virDomainGetBlockJobInfo)
      (virDomainBlockJobSetSpeed, virDomainBlockPull): Document
      acceptable disk naming conventions.
      * src/qemu/qemu_driver.c (qemuDomainBlockStats)
      (qemuDomainBlockStatsFlags): Allow lookup by source name.
      * src/test/test_driver.c (testDomainBlockStats): Likewise.
      c725e2dc
  16. 19 11月, 2011 2 次提交
    • D
      Rename and split the macvtap.c file · 896104c9
      Daniel P. Berrange 提交于
      Rename the macvtap.c file to virnetdevmacvlan.c to reflect its
      functionality. Move the port profile association code out into
      virnetdevvportprofile.c. Make the APIs available unconditionally
      to callers
      
      * src/util/macvtap.h: rename to src/util/virnetdevmacvlan.h,
      * src/util/macvtap.c: rename to src/util/virnetdevmacvlan.c
      * src/util/virnetdevvportprofile.c, src/util/virnetdevvportprofile.h:
        Pull in vport association code
      * src/Makefile.am, src/conf/domain_conf.h, src/qemu/qemu_conf.c,
        src/qemu/qemu_conf.h, src/qemu/qemu_driver.c: Update include
        paths & remove conditional compilation
      896104c9
    • D
      Rename Macvtap management APIs · 43925db7
      Daniel P. Berrange 提交于
      In preparation for code re-organization, rename the Macvtap
      management APIs to have the following patterns
      
        virNetDevMacVLanXXXXX     - macvlan/macvtap interface management
        virNetDevVPortProfileXXXX - virtual port profile management
      
      * src/util/macvtap.c, src/util/macvtap.h: Rename APIs
      * src/conf/domain_conf.c, src/network/bridge_driver.c,
        src/qemu/qemu_command.c, src/qemu/qemu_command.h,
        src/qemu/qemu_driver.c, src/qemu/qemu_hotplug.c,
        src/qemu/qemu_migration.c, src/qemu/qemu_process.c,
        src/qemu/qemu_process.h: Update for renamed APIs
      43925db7
  17. 12 11月, 2011 1 次提交
    • E
      API: add trivial qemu support for VIR_TYPED_PARAM_STRING · 342c0957
      Eric Blake 提交于
      Qemu will be the first driver to make use of a typed string in the
      next round of additions.  Separate out the trivial addition.
      
      * src/qemu/qemu_driver.c (qemudSupportsFeature): Advertise feature.
      (qemuDomainGetBlkioParameters, qemuDomainGetMemoryParameters)
      (qemuGetSchedulerParametersFlags, qemudDomainBlockStatsFlags):
      Allow typed strings flag where trivially supported.
      342c0957
  18. 10 11月, 2011 1 次提交
    • D
      Remove 'brControl' object · 6cfeb9a7
      Daniel P. Berrange 提交于
      The bridge management APIs in src/util/bridge.c require a brControl
      object to be passed around. This holds the file descriptor for the
      control socket. This extra object complicates use of the API for
      only a minor efficiency gain, which is in turn entirely offset by
      the need to fork/exec the brctl command for STP configuration.
      
      This patch removes the 'brControl' object entirely, instead opening
      the control socket & closing it again within the scope of each method.
      
      The parameter names for the APIs are also made to consistently use
      'brname' for bridge device name, and 'ifname' for an interface
      device name. Finally annotations are added for non-NULL parameters
      and return check validation
      
      * src/util/bridge.c, src/util/bridge.h: Remove brControl object
        and update API parameter names & annotations.
      * src/lxc/lxc_driver.c, src/network/bridge_driver.c,
        src/uml/uml_conf.h, src/uml/uml_conf.c, src/uml/uml_driver.c,
        src/qemu/qemu_command.c, src/qemu/qemu_conf.h,
        src/qemu/qemu_driver.c: Remove reference to 'brControl' object
      6cfeb9a7
  19. 09 11月, 2011 1 次提交
  20. 03 11月, 2011 2 次提交
    • D
      Allow multiple consoles per virtual guest · 0873b688
      Daniel P. Berrange 提交于
      While Xen only has a single paravirt console, UML, and
      QEMU both support multiple paravirt consoles. The LXC
      driver can also be trivially made to support multiple
      consoles. This patch extends the XML to allow multiple
      <console> elements in the XML. It also makes the UML
      and QEMU drivers support this config.
      
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Allow
        multiple <console> devices
      * src/lxc/lxc_driver.c, src/xen/xen_driver.c,
        src/xenxs/xen_sxpr.c, src/xenxs/xen_xm.c: Update for
        internal API changes
      * src/security/security_selinux.c, src/security/virt-aa-helper.c:
        Only label consoles that aren't a copy of the serial device
      * src/qemu/qemu_command.c, src/qemu/qemu_driver.c,
        src/qemu/qemu_process.c, src/uml/uml_conf.c,
        src/uml/uml_driver.c: Support multiple console devices
      * tests/qemuxml2xmltest.c, tests/qemuxml2argvtest.c: Extra
        tests for multiple virtio consoles. Set QEMU_CAPS_CHARDEV
        for all console /channel tests
      * tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-auto.args,
        tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.args
        tests/qemuxml2argvdata/qemuxml2argv-console-virtio.args: Update
        for correct chardev syntax
      * tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.args,
        tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.xml: New
        test file
      0873b688
    • E
      API: document scheduler parameter names · 319992d4
      Eric Blake 提交于
      Document the parameter names that will be used by
      virDomain{Get,Set}SchedulerParameters{,Flags}, rather than
      hard-coding those names in each driver, to match what is
      done with memory, blkio, and blockstats parameters.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_SCHEDULER_CPU_SHARES)
      (VIR_DOMAIN_SCHEDULER_VCPU_PERIOD)
      (VIR_DOMAIN_SCHEDULER_VCPU_QUOTA, VIR_DOMAIN_SCHEDULER_WEIGHT)
      (VIR_DOMAIN_SCHEDULER_CAP, VIR_DOMAIN_SCHEDULER_RESERVATION)
      (VIR_DOMAIN_SCHEDULER_LIMIT, VIR_DOMAIN_SCHEDULER_SHARES): New
      field name macros.
      * src/qemu/qemu_driver.c (qemuSetSchedulerParametersFlags)
      (qemuGetSchedulerParametersFlags): Use new defines.
      * src/test/test_driver.c (testDomainGetSchedulerParamsFlags)
      (testDomainSetSchedulerParamsFlags): Likewise.
      * src/xen/xen_hypervisor.c (xenHypervisorGetSchedulerParameters)
      (xenHypervisorSetSchedulerParameters): Likewise.
      * src/xen/xend_internal.c (xenDaemonGetSchedulerParameters)
      (xenDaemonSetSchedulerParameters): Likewise.
      * src/lxc/lxc_driver.c (lxcSetSchedulerParametersFlags)
      (lxcGetSchedulerParametersFlags): Likewise.
      * src/esx/esx_driver.c (esxDomainGetSchedulerParametersFlags)
      (esxDomainSetSchedulerParametersFlags): Likewise.
      * src/libxl/libxl_driver.c (libxlDomainGetSchedulerParametersFlags)
      (libxlDomainSetSchedulerParametersFlags): Likewise.
      319992d4
  21. 02 11月, 2011 2 次提交
    • D
      Add missing param initialization in qemuDomainBlockStatsFlags · f4786c18
      Daniel P. Berrange 提交于
      * src/qemu/qemu_driver.c: Fix use of uninitialized 'params'
      f4786c18
    • E
      qemu: allow getting < max typed parameters · 97656536
      Eric Blake 提交于
      Since all virTypedParameter APIs allow us to return the number
      of slots we actually populated, we should allow the user to
      call with nparams too small (without overrunning their array)
      or too large (ignoring the tail of the array that we can't fill),
      rather than requiring that they get things exactly right.
      
      Making this change will make it easier for a future patch to
      introduce VIR_TYPED_PARAM_STRING, with filtering in libvirt.c
      rather than in every single driver, since users already have
      to be prepared for *nparams to be smaller on exit than on entry.
      
      * src/qemu/qemu_driver.c (qemuDomainGetBlkioParameters)
      (qemuDomainGetMemoryParameters): Allow variable nparams on entry.
      (qemuGetSchedulerParametersFlags): Drop redundant check.
      (qemudDomainBlockStats, qemudDomainBlockStatsFlags): Rename...
      (qemuDomainBlockStats, qemuDomainBlockStatsFlags): ...to this.
      Don't return unavailable stats.
      97656536
  22. 01 11月, 2011 1 次提交
  23. 28 10月, 2011 1 次提交
    • D
      Wire up QEMU implementation for virDomainOpenGraphics · f877fed3
      Daniel P. Berrange 提交于
      The QEMU monitor command 'add_client' can be used to connect to
      a VNC or SPICE graphics display. This allows for implementation
      of the virDomainOpenGraphics API
      
      * src/qemu/qemu_driver.c: Implement virDomainOpenGraphics
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
        src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
        Add binding for 'add_client' command
      f877fed3
  24. 27 10月, 2011 1 次提交
    • E
      qemu: simplify use of HAVE_YAJL · 6889f33e
      Eric Blake 提交于
      Rather than making all clients of monitor commands that are JSON-only
      check whether yajl support was compiled in, it is simpler to just
      avoid setting the capability bit up front if we can't use the capability.
      
      * src/qemu/qemu_capabilities.c (qemuCapsComputeCmdFlags): Only set
      capability bit if we also have yajl library to use it.
      * src/qemu/qemu_driver.c (qemuDomainReboot): Drop #ifdefs.
      * src/qemu/qemu_process.c (qemuProcessStart): Likewise.
      * tests/qemuhelptest.c (testHelpStrParsing): Pass test even
      without yajl.
      * tests/qemuxml2argvtest.c (mymain): Simplify use of json flag.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-*.args:
      Update expected results to match.
      6889f33e