1. 21 1月, 2010 2 次提交
    • L
      Fix uses of virFileMakePath · 623bc48a
      Laine Stump 提交于
      * src/lxc/lxc_container.c src/lxc/lxc_controller.c src/lxc/lxc_driver.c
        src/network/bridge_driver.c src/qemu/qemu_driver.c
        src/uml/uml_driver.c: virFileMakePath returns 0 for success, or the
        value of errno on failure, so error checking should be to test
        if non-zero, not if lower than 0
      623bc48a
    • D
      Fix QEMU driver custom domain status XML extensions · ed00e45d
      Daniel P. Berrange 提交于
      Invoking the virConnectGetCapabilities() method causes the QEMU
      driver to rebuild its internal capabilities object. Unfortunately
      it was forgetting to register the custom domain status XML hooks
      again.
      
      To avoid this kind of error in the future, the code which builds
      capabilities is refactored into one single method, which can be
      called from all locations, ensuring reliable rebuilds.
      
      * src/qemu/qemu_driver.c: Fix rebuilding of capabilities XML and
        guarentee it is always consistent
      ed00e45d
  2. 20 1月, 2010 2 次提交
  3. 18 1月, 2010 9 次提交
    • D
      Auto-assign PCI addresses · a44d0dc2
      Daniel P. Berrange 提交于
      Instead of relying on QEMU to assign PCI addresses and then querying
      them with 'info pci', manually assign all PCI addresses before starting
      the guest.  These addresses are not stable across reboots. That will
      come in a later patch
      
      NB, the PIIX3 (IDE, FDC, ISA-Bridge) will always have slot 1 and
      VGA will always have slot 2. We declare the Virtio Balloon gets
      slot 3, and then all remaining slots are for configured devices.
      
      * src/qemu/qemu_conf.c: If -device is supported, then assign all PCI
        addresses when building the command line
      * src/qemu/qemu_driver.c: Don't query monitor for PCI addresses if
        they have already been assigned
      * tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-address-device.args,
        tests/qemuxml2argvdata/qemuxml2argv-net-virtio-device.args,
        tests/qemuxml2argvdata/qemuxml2argv-sound-device.args,
        tests/qemuxml2argvdata/qemuxml2argv-watchdog-device.args: Update
        to include PCI slot/bus information
      a44d0dc2
    • D
      Convert character devices over to use -device · 7b2f8cdd
      Daniel P. Berrange 提交于
      The current character device syntax uses either
      
        -serial tty,path=/dev/ttyS2
      
      Or
      
        -chardev tty,id=serial0,path=/dev/ttyS2 -serial chardev:serial0
      
      With the new -device support, we now prefer
      
        -chardev file,id=serial0,path=/tmp/serial.log -device isa-serial,chardev=serial0
      
      This patch changes the existing -chardev syntax to use this new
      scheme, and fallbacks to the old plain -serial syntax for old
      QEMU.
      
      The monitor device changes to
      
        -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -mon chardev=monitor
      
      In addition, this patch adds --nodefaults, which kills off the
      default serial, parallel, vga and nic devices. THis avoids the
      need for us to explicitly turn each off
      7b2f8cdd
    • D
      Assign device aliases for all devices at startup · 05330717
      Daniel P. Berrange 提交于
      When starting a guest, give every device a unique alias. This will
      be used for the 'id' parameter in -device args in later patches.
      It can also be used to uniquely identify devices in the monitor
      
      For old QEMU without -device, assign disk names based on QEMU's
      historical naming scheme.
      
      * src/qemu/qemu_conf.c: Assign unique device aliases
      * src/qemu/qemu_driver.c: Remove obsolete qemudDiskDeviceName
        and use the device alias in eject & blockstats commands
      05330717
    • D
      Introduce device aliases · 5da9c980
      Daniel P. Berrange 提交于
      This patch introduces the support for giving all devices a short,
      unique name, henceforth known as a 'device alias'.  These aliases
      are not set by the end user, instead being assigned by the hypervisor
      if it decides it want to support this concept.
      
      The QEMU driver sets them whenever using the -device arg syntax
      and uses them for improved hotplug/hotunplug. it is the intent
      that other APIs (block / interface stats & device hotplug) be
      able to accept device alias names in the future.
      
      The XML syntax is
      
         <alias name="video0"/>
      
      This may appear in any type of device that supports device info.
      
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Add a 'alias'
        field to virDomainDeviceInfo struct & parse/format it in XML
      * src/libvirt_private.syms: Export virDomainDefClearDeviceAliases
      * src/qemu/qemu_conf.c: Replace use of "nic_name" field with the
        standard device alias
      * src/qemu/qemu_driver.c: Clear device aliases at shutdown
      5da9c980
    • D
      Clear assigned PCI devices at shutdown · 774c757e
      Daniel P. Berrange 提交于
      The PCI device addresses are only valid while the VM is running,
      since they are auto-assigned by QEMU. After shutdown they must
      all be cleared. Future QEMU driver enhancement will allow for
      persistent PCI address assignment
      
      * src/conf/domain_conf.h, src/conf/domain_conf.c, src/libvirt_private.syms
        Add virDomainDefClearPCIAddresses() method for wiping out auto assigned
        PCI addresses
      * src/qemu/qemu_driver.c: Clear PCI addresses at VM shutdown
      774c757e
    • D
      Detect PCI addresses at QEMU startup · 989051a8
      Daniel P. Berrange 提交于
      Hotunplug of devices requires that we know their PCI address. Even
      hotplug of SCSI drives, required that we know the PCI address of
      the SCSI controller to attach the drive to. We can find this out
      by running 'info pci' and then correlating the vendor/product IDs
      with the devices we booted with.
      
      Although this approach is somewhat fragile, it is the only viable
      option with QEMU < 0.12, since there is no way for libvirto set
      explicit PCI addresses when creating devices in the first place.
      For QEMU > 0.12, this code will not be used.
      
      * src/qemu/qemu_driver.c: Assign all dynamic PCI addresses on
        startup of QEMU VM, matching vendor/product IDs
      * 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
        API for fetching PCI device address mapping
      989051a8
    • D
      Properly support SCSI drive hotplug · 3a6bf1bb
      Daniel P. Berrange 提交于
      The current SCSI hotplug support attaches a brand new SCSI controller
      for every disk. This is broken because the semantics differ from those
      used when starting the VM initially. In the latter case, each SCSI
      controller is filled before a new one is added.
      
      If the user specifies an high drive index (sdazz) then at initial
      startup, many intermediate SCSI controllers may be added with no
      drives.
      
      This patch changes SCSI hotplug so that it exactly matches the
      behaviour of initial startup. First the SCSI controller number is
      determined for the drive to be hotplugged. If any controller upto
      and including that controller number is not yet present, it is
      attached. Then finally the drive is attached to the last controller.
      
      NB, this breaks SCSI hotunplug, because there is no 'drive_del'
      command in current QEMU. Previous SCSI hotunplug was broken in
      any case because it was unplugging the entire controller, not
      just the drive in question.
      
      A future QEMU will allow proper SCSI hotunplug of a drive.
      
      This patch is derived from work done by Wolfgang Mauerer on disk
      controllers.
      
      * src/qemu/qemu_driver.c: Fix SCSI hotplug to add a drive to
       the correct controller, instead of just attaching a new
        controller.
      * 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
        support for 'drive_add' command
      3a6bf1bb
    • W
      Implement SCSI controller hotplug/unplug for QEMU · da9d937b
      Wolfgang Mauerer 提交于
      This patch allows for explicit hotplug/unplug of SCSI controllers.
      Ordinarily this is not required, since QEMU/libvirt will attach
      a new SCSI controller whenever one is required. Allowing explicit
      hotplug of controllers though, enables the caller to specify a
      static PCI address, instead of auto-assigning the next available
      PCI slot. Or it will when we have static PCI addressing.
      
      This patch is derived from Wolfgang Mauerer's disk controller
      patch series.
      
      * src/qemu/qemu_driver.c: Support hotplug & unplug of SCSI
        controllers
      * 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
        new API for attaching PCI SCSI controllers
      da9d937b
    • M
      qemu: Use log output for pty assignment if 'info chardev' is unavailable · a0356bcc
      Matthias Bolte 提交于
      qemudFindCharDevicePTYsMonitor reports an error if 'info chardev' didn't
      provide information for a requested device, even if the log output parsing
      had found the pty path for that device. This makes pty assignment fail for
      older QEMU/KVM versions. For example KVM 72 on Debian doesn't support
      'info chardev', so qemuMonitorTextGetPtyPaths cannot parse any useful
      information and the hash for device-id-to-pty-path mapping stays empty.
      
      Make qemudFindCharDevicePTYsMonitor report an error only if the log output
      parsing and the 'info chardev' parsing failed to provide the pty path.
      a0356bcc
  4. 16 1月, 2010 2 次提交
    • D
      Convert monitor over to use virDomainDeviceAddress · ab0da52b
      Daniel P. Berrange 提交于
      Convert the QEMU monitor APIs over to use virDomainDeviceAddress
      structs for passing addresses in/out, instead of individual bits.
      This makes the number of parameters smaller & easier to deal with.
      No functional change
      
      * src/qemu/qemu_driver.c, src/qemu/qemu_monitor.c,
        src/qemu/qemu_monitor.h, src/qemu/qemu_monitor_text.c,
        src/qemu/qemu_monitor_text.h: Change monitor hotplug APIs to
        take an explicit address ptr for all host/guest addresses
      ab0da52b
    • D
      Introduce a standardized data structure for device addresses · 1b0cce7d
      Daniel P. Berrange 提交于
      All guest devices now use a common device address structure
      summarized by:
      
        enum virDomainDeviceAddressType {
          VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE,
          VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI,
        };
      
        struct _virDomainDevicePCIAddress {
          unsigned int domain;
          unsigned int bus;
          unsigned int slot;
          unsigned int function;
        };
      
        struct _virDomainDeviceInfo {
          int type;
          union {
              virDomainDevicePCIAddress pci;
          } addr;
        };
      
      This replaces the anonymous structs in Disk/Net/Hostdev data
      structures. Where available, the address is *always* printed
      in the XML file, instead of being hidden in the internal state
      file.
      
        <address type='pci' domain='0x0000' bus='0x1e' slot='0x07' function='0x0'/>
      
      The structure definition is based on Wolfgang Mauerer's disk
      controller patch series.
      
      * docs/schemas/domain.rng: Define the <address> syntax and
        associate it with disk/net/hostdev devices
      * src/conf/domain_conf.h, src/conf/domain_conf.c,
        src/libvirt_private.syms: APIs for parsing/formatting address
        information. Also remove the QEMU specific 'pci_addr' attributes
      * src/qemu/qemu_driver.c: Replace use of 'pci_addr' attrs with
        new standardized format.
      1b0cce7d
  5. 14 1月, 2010 1 次提交
    • C
      Implement path lookup for USB by vendor:product · 5073aa99
      Cole Robinson 提交于
      Based off how QEMU does it, look through /sys/bus/usb/devices/* for
      matching vendor:product info, and if found, use info from the surrounding
      files to build the device's /dev/bus/usb path.
      
      This fixes USB device assignment by vendor:product when running qemu
      as non-root (well, it should, but for some reason I couldn't reproduce
      the failure people are seeing in [1], but it appears to work properly)
      
      [1] https://bugzilla.redhat.com/show_bug.cgi?id=542450
      5073aa99
  6. 12 1月, 2010 3 次提交
  7. 06 1月, 2010 2 次提交
  8. 22 12月, 2009 1 次提交
    • D
      Fix detection of JSON when restarting libvirtd · c90e545f
      Daniel P. Berrange 提交于
      The XML XPath for detecting JSON in the running VM statefile was
      wrong causing all VMs to get JSON mode enabled at libvirtd restart.
      
      In addition if a VM was running a JSON enabled QEMU once, and then
      altered to point to a non-JSON enabled QEMU later the 'monJSON'
      flag would not get reset to 0.
      
      * src/qemu/qemu_driver.c: Fix setting/detection of JSON mode
      c90e545f
  9. 21 12月, 2009 1 次提交
  10. 20 12月, 2009 2 次提交
    • A
      Implements domainMemStats in the qemu driver · c7523b41
      Adam Litke 提交于
      Support for memory statistics reporting is accepted for qemu inclusion.
      Statistics are reported via the monitor command 'info balloon' as a comma
      seprated list:
      
      (qemu) info balloon
      balloon: actual=1024,mem_swapped_in=0,mem_swapped_out=0,major_page_faults=88,minor_page_faults=105535,free_mem=1017065472,total_mem=1045229568
      
      Libvirt, qemu, and the guest operating system may support a subset of the
      statistics defined by the virtio spec.  Thus, only statistics recognized by
      components will be reported.
      
      * src/qemu/qemu_driver.c src/qemu/qemu_monitor_text.[ch]: implement the
        new entry point by using info balloon monitor command
      c7523b41
    • A
      Add new API virDomainMemoryStats to header and drivers · 3a701313
      Adam Litke 提交于
      Set up the types for the domainMemoryStats function and insert it into the
      virDriver structure definition.  Because of static initializers, update
      every driver and set the new field to NULL.
      
      * include/libvirt/libvirt.h.in: new API
      * src/driver.h src/*/*_driver.c src/vbox/vbox_tmpl.c: add the new
        entry to the driver structure
      * python/generator.py: fix compiler errors, the actual python binding is
        implemented later
      3a701313
  11. 18 12月, 2009 2 次提交
    • J
      Implement CPU selection in QEMU driver · ffb13b11
      Jiri Denemark 提交于
      * src/qemu/qemu_conf.c src/qemu/qemu_conf.h src/qemu/qemu_driver.c:
        add the new entry point, extend capabilities and code to interract
        with qemu
      ffb13b11
    • J
      Adds the internal driver API · 16e4084a
      Jiri Denemark 提交于
      * src/driver.h: add an extra entry point in the structure
      * 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/xen/xen_driver.c: add NULL entry points for
        all drivers
      16e4084a
  12. 15 12月, 2009 3 次提交
  13. 14 12月, 2009 9 次提交
    • M
      Cleanup temporary #define after use · 057ad3a2
      Matthew Booth 提交于
      * src/qemu/qemu_driver.c: #undef LOOKUP_PTYS after use in
        qemudFindCharDevicePTYsMonitor()
      057ad3a2
    • P
      Fix possible NULL pointer dereference · 921d2225
      Paolo Bonzini 提交于
      If there are no references remaining to the object, vm is set to NULL
      and vm->persistent cannot be accessed.  Fixed by this trivial patch.
      
      * src/qemu/qemu_driver.c (qemudDomainCoreDump): Avoid possible
        NULL pointer dereference on --crash dump.
      921d2225
    • P
      add --live support to "virsh dump" · 1fb7af40
      Paolo Bonzini 提交于
      This is trivial for QEMU since you just have to not stop the vm before
      starting the dump.  And for Xen, you just pass the flag down to xend.
      
      * include/libvirt/libvirt.h.in (virDomainCoreDumpFlags): Add VIR_DUMP_LIVE.
      * src/qemu/qemu_driver.c (qemudDomainCoreDump): Support live dumping.
      * src/xen/xend_internal.c (xenDaemonDomainCoreDump): Support live dumping.
      * tools/virsh.c (opts_dump): Add --live. (cmdDump): Map it to VIR_DUMP_LIVE.
      1fb7af40
    • P
      add --crash support to "virsh dump" · b927aed8
      Paolo Bonzini 提交于
      This patch adds the --crash option (already present in "xm dump-core")
      to "virsh dump".  virDomainCoreDump already has a flags argument, so
      the API/ABI is untouched.
      
      * include/libvirt/libvirt.h.in (virDomainCoreDumpFlags): New flag for
        CoreDump
      * src/test/test_driver.c (testDomainCoreDump): Do not crash
        after dump unless VIR_DUMP_CRASH is given.
      * src/qemu/qemu_driver.c (qemudDomainCoreDump): Shutdown the domain
        instead of restarting it if --crash is passed.
      * src/xen/xend_internal.c (xenDaemonDomainCoreDump): Support --crash.
      * tools/virsh.c (opts_dump): Add --crash.
        (cmdDump): Map it to flags for virDomainCoreDump and pass them.
      b927aed8
    • P
      fix various breakages in qemu Dump command · f509e162
      Paolo Bonzini 提交于
      1) qemuMigrateToCommand uses ">>" so we have to truncate the file
      before starting the migration;
      
      2) the command wasn't updated to chown the driver and set/restore
      the security lavels;
      
      3) the VM does not have to be resumed if migration fails;
      
      4) the file is not removed when migration fails.
      
      * src/qemu/qemu_driver.c (qemuDomainCoreDump): Truncate file before
        dumping, set/restore ownership and security labels for the file.
      f509e162
    • D
      Fix a couple of problems in last patch · a7d1eb3c
      Daniel Veillard 提交于
      Those were pointed by DanB in his review but not yet fixed
      
      * src/qemu/qemu_driver.c: qemudWaitForMonitor() use EnterMonitorWithDriver()
        and ExitMonitorWithDriver() there
      * src/qemu/qemu_monitor_text.c: checking fro strdu failure and hash
        table add error in qemuMonitorTextGetPtyPaths()
      a7d1eb3c
    • M
      Get QEMU pty paths from the monitor · 60e8977f
      Matthew Booth 提交于
      This change makes the QEMU driver get pty paths from the output of the
      monitor 'info chardev' command. This output is structured, and contains
      both the name of the device and the path on the same line. This is
      considerably more reliable than parsing the startup log output, which
      requires the parsing code to know which order QEMU will print pty
      information in.
      
      Note that we still need to parse the log output as the monitor itself
      may be on a pty. This should be rare, however, and the new code will
      replace all pty paths parsed by the log output method once the monitor
      is available.
      
      * src/qemu/qemu_monitor.(c|h) src/qemu_monitor_text.(c|h): Implement
        qemuMonitorGetPtyPaths().
      * src/qemu/qemu_driver.c: Get pty path information using
        qemuMonitorGetPtyPaths().
      60e8977f
    • M
      Extract the assigned pty device for QEmu channels · 033eef43
      Matthew Booth 提交于
      * src/qemu/qemu_driver.c: Parse pty devices for channels
      033eef43
    • R
      Suppress cgroup error message on sucess startup · 2597f8ec
      Ryota Ozaki 提交于
      Even if qemudStartVMDaemon suceeds, an error was logged such as
      'qemuRemoveCgroup:1778 : internal error Unable to find cgroup for'.
      This is because qemudStartVMDaemon calls qemuRemoveCgroup to
      ensure that old cgroup does not remain. This workaround makes
      sense but leaving an error message may confuse users.
      * src/qemu/qemu_driver.c: a an option to the function to suppress the
        error being logged
      2597f8ec
  14. 11 12月, 2009 1 次提交
    • P
      add virsh --suspend arg to migrate command · edc9e78b
      Paolo Bonzini 提交于
      This adds a new flag, VIR_MIGRATE_PAUSED, that mandates pausing
      the migrated VM before starting it.
      
      * include/libvirt/libvirt.h.in (virDomainMigrateFlags): Add VIR_MIGRATE_PAUSED.
      * src/qemu/qemu_driver.c (qemudDomainMigrateFinish2): Handle VIR_MIGRATE_PAUSED.
      * tools/virsh.c (opts_migrate): Add --suspend. (cmdMigrate): Handle it.
      * tools/virsh.pod (migrate): Document it.
      edc9e78b