1. 29 3月, 2011 2 次提交
  2. 28 3月, 2011 3 次提交
    • E
      docs: document recent hook additions · ef701fd8
      Eric Blake 提交于
      * src/qemu/qemu_process.c (qemuProcessStart, qemuProcessStop): Fix
      typos.
      * docs/hooks.html.in: Document 'prepare' and 'release' hooks.
      ef701fd8
    • E
      qemu: don't restore state label twice · 96d56786
      Eric Blake 提交于
      Otherwise, if something like doStopVcpus fails after the first
      restore, a second restore is attempted and throws a useless
      warning.
      
      * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Avoid second
      restore of state label.
      96d56786
    • D
      Remove the Open Nebula driver · 4591df76
      Daniel P. Berrange 提交于
      The Open Nebula driver has been unmaintained since it was first
      introduced. The only commits have been for tree-wide cleanups.
      It also has a major design flaw, in that it only knows about guests
      that it has created itself, which makes it of very limited use.
      
      Discussions wrt evolution of the VMWare ESX driver, concluded that
      it should limit itself to single-node ESX operation and not try to
      manage the multi-node architecture of VirtualCenter. Open Nebula
      is a cluster like Virtual Center, not a single node system, so
      the same reasoning applies.
      
      The DeltaCloud project includes an Open Nebula driver and is a much
      better fit architecturally, since it is explicitly targetting the
      distributed multihost cluster scenario.
      
      Thus this patch deletes the libvirt Open Nebula driver with the
      recommendation that people use DeltaCloud for managing it instead.
      
      * configure.ac: Remove probe for xmlrpc & --with-one arg
      * daemon/Makefile.am, daemon/libvirtd.c, src/Makefile.am: Remove
        ONE driver build
      * src/opennebula/one_client.c, src/opennebula/one_client.h,
        src/opennebula/one_conf.c, src/opennebula/one_conf.h,
        src/opennebula/one_driver.c, src/opennebula/one_driver.c: Delete
        files
      * autobuild.sh, libvirt.spec.in, mingw32-libvirt.spec.in: Remove
        build rules for Open Nebula
      * docs/drivers.html.in, docs/sitemap.html.in: Remove reference
        to OpenNebula
      * docs/drvone.html.in: Delete file
      4591df76
  3. 26 3月, 2011 2 次提交
  4. 25 3月, 2011 9 次提交
    • P
      Add missing { for qemudDomainInterfaceStats · 24da1095
      Philipp Hahn 提交于
      Add missing open curly brace between function declaration of non-linux
      variant of qemudDomainInterfaceStats() and its body.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      24da1095
    • E
      command: add virCommandAbort for cleanup paths · 9ed54518
      Eric Blake 提交于
      Sometimes, an asynchronous helper is started (such as a compressor
      or iohelper program), but a later error means that we want to
      abort that child.  Make this easier.
      
      Note that since daemons and virCommandRunAsync can't mix, the only
      time virCommandFree can reap a process is if someone did
      virCommandRunAsync for a non-daemon and didn't stash the pid.
      
      * src/util/command.h (virCommandAbort): New prototype.
      * src/util/command.c (_virCommand): Add new field.
      (virCommandRunAsync, virCommandWait): Track whether pid was used.
      (virCommandFree): Reap child if caller did not request pid.
      (virCommandAbort): New function.
      * src/libvirt_private.syms (command.h): Export it.
      * tests/commandtest.c (test19): New test.
      9ed54518
    • E
      command: don't mix RunAsync and daemons · 4e808602
      Eric Blake 提交于
      It doesn't make sense to run a daemon without synchronously
      waiting for the child process to reply whether the daemon has
      been kicked off and pidfile written yet.
      
      * src/util/command.c (VIR_EXEC_RUN_SYNC): New constant.
      (virCommandRun): Set temporary flag.
      (virCommandRunAsync): Use it to prevent async runs of intermediate
      child when spawning asynchronous daemon grandchild.
      4e808602
    • E
      command: properly diagnose process exit via signal · 208a044a
      Eric Blake 提交于
      Child processes don't always reach _exit(); if they die from a
      signal, then any messages should still be accurate.  Most users
      either expect a 0 status (thankfully, if status==0, then
      WIFEXITED(status) is true and WEXITSTATUS(status)==0 for all
      known platforms) or were filtering on WIFEXITED before printing
      a status, but a few were missing this check.  Additionally,
      nwfilter_ebiptables_driver was making an assumption that works
      on Linux (where WEXITSTATUS shifts and WTERMSIG just masks)
      but fails on other platforms (where WEXITSTATUS just masks and
      WTERMSIG shifts).
      
      * src/util/command.h (virCommandTranslateStatus): New helper.
      * src/libvirt_private.syms (command.h): Export it.
      * src/util/command.c (virCommandTranslateStatus): New function.
      (virCommandWait): Use it to also diagnose status from signals.
      * src/security/security_apparmor.c (load_profile): Likewise.
      * src/storage/storage_backend.c
      (virStorageBackendQEMUImgBackingFormat): Likewise.
      * src/util/util.c (virExecDaemonize, virRunWithHook)
      (virFileOperation, virDirCreate): Likewise.
      * daemon/remote.c (remoteDispatchAuthPolkit): Likewise.
      * src/nwfilter/nwfilter_ebiptables_driver.c (ebiptablesExecCLI):
      Likewise.
      208a044a
    • M
      Add memory functions to libxl driver · 6ef1f6c2
      Markus Groß 提交于
      6ef1f6c2
    • W
      fix the check of the output of monitor command 'device_add' · c4dae2d9
      Wen Congyang 提交于
      Hotpluging host usb device by text mode will fail, because the monitor
      command 'device_add' outputs 'husb: using...' if it succeeds, but we
      think the command should not output anything.
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      c4dae2d9
    • E
      build: enforce reference count checking · 72d4ff5b
      Eric Blake 提交于
      Add the compiler attribute to ensure we don't introduce any more
      ref bugs like were just patched in commit 9741f346, then explicitly
      mark the remaining places in code that are safe.
      
      * src/qemu/qemu_monitor.h (qemuMonitorUnref): Mark
      ATTRIBUTE_RETURN_CHECK.
      * src/conf/domain_conf.h (virDomainObjUnref): Likewise.
      * src/conf/domain_conf.c (virDomainObjParseXML)
      (virDomainLoadStatus): Fix offenders.
      * src/openvz/openvz_conf.c (openvzLoadDomains): Likewise.
      * src/vmware/vmware_conf.c (vmwareLoadDomains): Likewise.
      * src/qemu/qemu_domain.c (qemuDomainObjBeginJob)
      (qemuDomainObjBeginJobWithDriver)
      (qemuDomainObjExitRemoteWithDriver): Likewise.
      * src/qemu/qemu_monitor.c (QEMU_MONITOR_CALLBACK): Likewise.
      Suggested by Daniel P. Berrange.
      72d4ff5b
    • E
      maint: prohibit access(,X_OK) · 391c397e
      Eric Blake 提交于
      This simplifies several callers that were repeating checks already
      guaranteed by util.c, and makes other callers more robust to now
      reject directories.  remote_driver.c was over-strict - access(,R_OK)
      is only needed to execute a script file; a binary only needs
      access(,X_OK) (besides, it's unusual to see a file with x but not
      r permissions, whether script or binary).
      
      * cfg.mk (sc_prohibit_access_xok): New syntax-check rule.
      (exclude_file_name_regexp--sc_prohibit_access_xok): Exempt one use.
      * src/network/bridge_driver.c (networkStartRadvd): Fix offenders.
      * src/qemu/qemu_capabilities.c (qemuCapsProbeMachineTypes)
      (qemuCapsInitGuest, qemuCapsInit, qemuCapsExtractVersionInfo):
      Likewise.
      * src/remote/remote_driver.c (remoteFindDaemonPath): Likewise.
      * src/uml/uml_driver.c (umlStartVMDaemon): Likewise.
      * src/util/hooks.c (virHookCheck): Likewise.
      391c397e
    • M
      Get cpu time and current memory balloon from libxl · d1c8c8d4
      Markus Groß 提交于
      d1c8c8d4
  5. 24 3月, 2011 3 次提交
    • W
      update domain status forcibly even if attach a device failed · 9450a7cb
      Wen Congyang 提交于
      Steps to reproduce this bug:
      1. virsh attach-disk domain --source diskimage --target sdb --sourcetype file --driver qemu --subdriver qcow2
         error: Failed to attach disk
         error: operation failed: adding scsi-disk,bus=scsi0.0,scsi-id=1,drive=drive-scsi0-0-1,id=scsi0-0-1 device failed: Property 'scsi-disk.drive' can't find value 'drive-scsi0-0-1'
      2. service libvirtd restart
         Stopping libvirtd daemon:                                  [  OK  ]
         Starting libvirtd daemon:                                  [  OK  ]
      3. virsh attach-disk domain --source diskimage --target sdb --sourcetype file --driver qemu --subdriver raw
         error: Failed to attach disk
         error: operation failed: adding lsi,id=scsi0,bus=pci.0,addr=0x6 device failed: Duplicate ID 'scsi0' for device
      
      The reason is that we create a new scsi controller but we do not update
      /var/run/libvirt/qemu/domain.xml.
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      9450a7cb
    • E
      command: reject pidfile on non-daemon · ee691d84
      Eric Blake 提交于
      * src/util/command.c (virCommandRunAsync): Since virExec only
      creates pidfiles for daemon, enforce this in virCommand.
      ee691d84
    • E
      domain_conf: drop unused ref-count in snapshot object · e904ce3c
      Eric Blake 提交于
      The ref count was assigned to 1 at creation, then never modified again
      until it was decremented just before freeing the object.
      
      * src/conf/domain_conf.h (_virDomainSnapshotObj): Delete unused
      field.
      (virDomainSnapshotObjUnref): Delete unused prototype.
      * src/libvirt_private.syms: Likewise.
      * src/conf/domain_conf.c (virDomainSnapshotObjNew)
      (virDomainSnapshotObjListDataFree): Update users.
      (virDomainSnapshotObjUnref): Delete.
      e904ce3c
  6. 23 3月, 2011 5 次提交
    • O
      util: Fix return value for virJSONValueFromString if it fails · 93e8b877
      Osier Yang 提交于
      Problem:
        "parser.head" is not NULL even if it's free'ed by "virJSONValueFree",
      returning "parser.head" when "virJSONValueFromString" fails will cause
      unexpected errors (libvirtd will crash sometimes), e.g.
        In function "qemuMonitorJSONArbitraryCommand":
      
              if (!(cmd = virJSONValueFromString(cmd_str)))
                  goto cleanup;
      
              if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
                  goto cleanup;
      
              ......
      
           cleanup:
              virJSONValueFree(cmd);
      
        It will continues to send command to monitor even if "virJSONValueFromString"
      is failed, and more worse, it trys to free "cmd" again.
      
        Crash example:
      {"error":{"class":"QMPBadInputObject","desc":"Expected 'execute' in QMP input","data":{"expected":"execute"}}}
      {"error":{"class":"QMPBadInputObject","desc":"Expected 'execute' in QMP input","data":{"expected":"execute"}}}
      error: server closed connection:
      error: unable to connect to '/var/run/libvirt/libvirt-sock', libvirtd may need to be started: Connection refused
      error: failed to connect to the hypervisor
      
        This fix is to:
          1) return NULL for failure of "virJSONValueFromString",
          2) and it seems "virJSONValueFree" uses incorrect loop index for type
             of "VIR_JSON_TYPE_OBJECT", fix it together.
      
      * src/util/json.c
      93e8b877
    • W
      Initialization error of qemuCgroupData in Qemu host usb hotplug · bcac844f
      Wen Congyang 提交于
      Steps to reproduce this bug:
      # cat usb.xml
      <hostdev mode='subsystem' type='usb'>
        <source>
          <address bus='0x001' device='0x003'/>
        </source>
      </hostdev>
      # virsh attach-device vm1 usb.xml
      error: Failed to attach device from usb.xml
      error: server closed connection:
      
      The reason of this bug is that we set data.cgroup to NULL, and this will cause
      libvirtd crashed.
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      bcac844f
    • E
      qemu: simplify monitor callbacks · 18d68462
      Eric Blake 提交于
      A future patch will change reference counting idioms; consolidating
      this pattern now makes the next patch smaller (touch only the new
      macro rather than every caller).
      
      * src/qemu/qemu_monitor.c (QEMU_MONITOR_CALLBACK): New helper.
      (qemuMonitorGetDiskSecret, qemuMonitorEmitShutdown)
      (qemuMonitorEmitReset, qemuMonitorEmitPowerdown)
      (qemuMonitorEmitStop, qemuMonitorEmitRTCChange)
      (qemuMonitorEmitWatchdog, qemuMonitorEmitIOError)
      (qemuMonitorEmitGraphics): Use it to reduce duplication.
      18d68462
    • E
      build: fix missing initializer · 6afa49a9
      Eric Blake 提交于
      Commit cb4aba9b forgot xenapi.
      
      * src/xenapi/xenapi_driver.c (xenapiDriver): Adjust to recent API.
      6afa49a9
    • R
      8021Qbh: use preassociate-rr during the migration prepare stage · 7708da38
      Roopa Prabhu 提交于
      This patch introduces PREASSOCIATE-RR during incoming VM migration on the
      destination host. This is similar to the usage of PREASSOCIATE during
      migration in 8021qbg libvirt code today. PREASSOCIATE-RR is a VDP operation.
      With the latest at IEEE, 8021qbh will need to support VDP operations.
      A corresponding enic driver patch to support PREASSOCIATE-RR for 8021qbh
      will be posted for net-next-2.6 inclusion soon.
      7708da38
  7. 22 3月, 2011 12 次提交
    • D
      Fix uninitialized variable & error reporting in LXC veth setup · c59176c1
      Daniel P. Berrange 提交于
      THe veth setup in LXC had a couple of flaws, first brInit did
      not report any error when it failed. Second vethCreate() did
      not correctly initialize the variable containing the return
      code, so could report failure even when it succeeded.
      
      * src/lxc/lxc_driver.c: Report error when brInit fails
      * src/lxc/veth.c: Fix uninitialized variable
      c59176c1
    • D
      Wire up virDomainMigrateSetSpeed into QEMU driver · 83cc3d1d
      Daniel P. Berrange 提交于
      Enhance the QEMU migration monitoring loop, so that it can get
      a signal to change migration speed on the fly
      
      * src/qemu/qemu_domain.h: Add signal for changing speed on the fly
      * src/qemu/qemu_driver.c: Wire up virDomainMigrateSetSpeed driver
      * src/qemu/qemu_migration.c: Support signal for changing speed
      83cc3d1d
    • D
      Wire up virDomainMigrateSetSpeed for the remote RPC driver · 118dd7d0
      Daniel P. Berrange 提交于
      * src/remote/remote_protocol.x: Define wire protocol
      * daemon/remote.c, src/remote/remote_driver.c: Add new
        functions for virDomainMigrateSetSpeed API
      * src/remote/remote_protocol.c, src/remote/remote_protocol.h,
        daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h,
        daemon/remote_dispatch_table.h: Re-generate files
      118dd7d0
    • D
      Add public API for setting migration speed on the fly · cb4aba9b
      Daniel P. Berrange 提交于
      It is possible to set a migration speed limit when starting
      migration. This new API allows the speed limit to be changed
      on the fly to adjust to changing conditions
      
      * src/driver.h, src/libvirt.c, src/libvirt_public.syms,
        include/libvirt/libvirt.h.in: Add virDomainMigrateSetMaxSpeed
      * src/esx/esx_driver.c, src/lxc/lxc_driver.c,
        src/opennebula/one_driver.c, src/openvz/openvz_driver.c,
        src/phyp/phyp_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/vmware/vmware_driver.c, src/xen/xen_driver.c,
        src/libxl/libxl_driver.c: Stub new API
      cb4aba9b
    • H
      qemu: fallback to HMP drive_add/drive_del · c33ac2e3
      Hu Tao 提交于
      fallback to HMP drive_add/drive_del commands if not found in QMP
      c33ac2e3
    • J
      qemu: Only use HMP passthrough if it is supported · 24c56ceb
      Jiri Denemark 提交于
      Avoids calling text monitor methods when it is know they will not
      succeed and also results in nicer error messages.
      24c56ceb
    • J
      qemu: Detect support for HMP passthrough · abdfca09
      Jiri Denemark 提交于
      abdfca09
    • T
      qemu: add two hook script events "prepare" and "release" · 3415eeb5
      Thibault Vincent 提交于
      Fix for bug https://bugzilla.redhat.com/show_bug.cgi?id=618970
      
      The "prepare" hook is called very early in the VM statup process
      before device labeling, so that it can allocate ressources not
      managed by libvirt, such as DRBD, or for instance create missing
      bridges and vlan interfaces.
      * src/util/hooks.c src/util/hooks.h: add definitions for new hooks
        VIR_HOOK_QEMU_OP_PREPARE and VIR_HOOK_QEMU_OP_RELEASE
      * src/qemu/qemu_process.c: use them in qemuProcessStart and
        qemuProcessStop()
      3415eeb5
    • E
      qemu: simplify interface fd handling in monitor · a24ada4e
      Eric Blake 提交于
      With only a single caller to these two monitor commands, I
      didn't need to wrap a new WithFds version, but just change
      the command itself.
      
      * src/qemu/qemu_monitor.h (qemuMonitorAddNetdev)
      (qemuMonitorAddHostNetwork): Add parameters.
      * src/qemu/qemu_monitor.c (qemuMonitorAddNetdev)
      (qemuMonitorAddHostNetwork): Add support for fd passing.
      * src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Use it to
      simplify code.
      a24ada4e
    • E
      qemu: simplify PCI configfd handling in monitor · 09831239
      Eric Blake 提交于
      This is also a bug fix - on the error path, qemu_hotplug would
      leave the configfd file leaked into qemu.  At least the next
      attempt to hotplug a PCI device would reuse the same fdname,
      and when the qemu getfd monitor command gets a new fd by the
      same name as an earlier one, it closes the earlier one, so there
      is no risk of qemu running out of fds.
      
      * src/qemu/qemu_monitor.h (qemuMonitorAddDeviceWithFd): New
      prototype.
      * src/qemu/qemu_monitor.c (qemuMonitorAddDevice): Move guts...
      (qemuMonitorAddDeviceWithFd): ...to new function, and add support
      for fd passing.
      * src/qemu/qemu_hotplug.c (qemuDomainAttachHostPciDevice): Use it
      to simplify code.
      Suggested by Daniel P. Berrange.
      09831239
    • E
      qemu: simplify monitor fd error handling · 058d4efa
      Eric Blake 提交于
      qemu_monitor was already returning -1 and setting errno to EINVAL
      on any attempt to send an fd without a unix socket, but this was
      a silent failure in the case of qemuDomainAttachHostPciDevice.
      Meanwhile, qemuDomainAttachNetDevice was doing some sanity checking
      for a better error message; it's better to consolidate that to a
      central point in the API.
      
      * src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Move sanity
      checking...
      * src/qemu/qemu_monitor.c (qemuMonitorSendFileHandle): ...into
      central location.
      Suggested by Chris Wright.
      058d4efa
    • E
      udev: fix regression with qemu:///session · 4c7508b4
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=684655 points out
      a regression introduced in commit 2215050e - non-root users
      can't connect to qemu:///session because libvirtd dies when
      it can't use pciaccess initialization.
      
      * src/node_device/node_device_udev.c (udevDeviceMonitorStartup):
      Don't abort udev driver (and libvirtd overall) if non-root user
      can't use pciaccess.
      4c7508b4
  8. 21 3月, 2011 3 次提交
    • E
      logging: fix off-by-one bug · dd5564f2
      Eric Blake 提交于
      Valgrind caught that our log wrap-around was going 1 past the end.
      Regression introduced in commit b16f47ab; previously the
      buffer was static and size+1 bytes, but now it is dynamic and
      exactly size bytes.
      
      * src/util/logging.c (virLogStr): Don't write past end of log.
      dd5564f2
    • W
      do not report OOM error when prepareCall() failed · 3c2b210a
      Wen Congyang 提交于
      We have reported error in the function prepareCall(), and
      the error is not only OOM error. So we should not report
      OOM error in the function call() when prepareCall() failed.
      3c2b210a
    • E
      util: guarantee sane errno in virFileIsExecutable · 8351358f
      Eric Blake 提交于
      If virFileIsExecutable is to replace access(file,X_OK), then
      errno must be usable on failure.
      
      * src/util/util.c (virFileIsExecutable): Set errno on failure.
      8351358f
  9. 19 3月, 2011 1 次提交
    • T
      update virGetVersion description · 83bc4fa7
      Tiziano Mueller 提交于
      The current description suggests that you always have to provide
      a valid typeVer pointer. But if you want only the libvirt version
      it's also possible to set type and typeVer to NULL to skip the
      hypervisor part.
      83bc4fa7