1. 03 11月, 2009 1 次提交
    • D
      Annotate many methods with ATTRIBUTE_RETURN_CHECK & fix problems · 46992453
      Daniel P. Berrange 提交于
      Nearly all of the methods in src/util/util.h have error codes that
      must be checked by the caller to correct detect & report failure.
      Add ATTRIBUTE_RETURN_CHECK to ensure compile time validation of
      this
      
      * daemon/libvirtd.c: Add explicit check on return value of virAsprintf
      * src/conf/domain_conf.c: Add missing check on virParseMacAddr return
        value status & report error
      * src/network/bridge_driver.c: Add missing OOM check on virAsprintf
        and report error
      * src/qemu/qemu_conf.c: Add missing check on virParseMacAddr return
        value status & report error
      * src/security/security_selinux.c: Remove call to virRandomInitialize
        that's done in libvirt.c already
      * src/storage/storage_backend_logical.c: Add check & log on virRun
        return status
      * src/util/util.c: Add missing checks on virAsprintf/Run status
      * src/util/util.h: Annotate all methods with ATTRIBUTE_RETURN_CHECK
        if they return an error status code
      * src/vbox/vbox_tmpl.c: Add missing check on virParseMacAddr
      * src/xen/xm_internal.c: Add missing checks on virAsprintf
      * tests/qemuargv2xmltest.c: Remove bogus call to virRandomInitialize()
      46992453
  2. 27 10月, 2009 1 次提交
  3. 21 10月, 2009 1 次提交
  4. 15 10月, 2009 1 次提交
    • M
      Don't copy old machines from a domain which has none · 2210f8a3
      Mark McLoughlin 提交于
      If the the qemu and kvm binaries are the same, we don't include machine
      types in the kvm domain info.
      
      However, the code which refreshes the machine types info from the
      previous capabilities structure first looks at the kvm domain's info,
      finds it matches and then copies the empty machine types list over
      for the top-level qemu domain.
      
      That doesn't make sense, we shouldn't copy an empty machin types list.
      
      * src/qemu/qemu_conf.c: qemudGetOldMachinesFromInfo(): don't copy an
        empty machine types list.
      2210f8a3
  5. 30 9月, 2009 1 次提交
  6. 29 9月, 2009 3 次提交
    • D
      Allow control over QEMU audio backend · b08e6d38
      Daniel P. Berrange 提交于
      When using VNC for graphics + keyboard + mouse, we shouldn't
      then use the host OS for audio. Audio should go back over
      VNC.
      
      When using SDL for graphics, we should use the host OS for
      audio since that's where the display is. We need to allow
      certain QEMU env variables to be passed through to guest
      too to allow choice of QEMU audio backend.
      
      * qemud/libvirtd.sysconf: Mention QEMU/SDL audio env vars
      * src/qemu_conf.c: Passthrough QEMU/SDL audio env for SDL display,
        disable host audio for VNC display
      b08e6d38
    • D
      Add API for issuing 'host_net_add' monitor command · 4c10127b
      Daniel P. Berrange 提交于
      * src/qemu/qemu_conf.h, src/qemu/qemu_conf.c: Remove prefix arg
        from qemuBuildHostNetStr which is no longer required
      * src/qemu/qemu_driver.c: Refactor to use qemuMonitorAddHostNetwork()
        API for adding host network
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
        qemuMonitorAddHostNetwork() method for adding host networks
      4c10127b
    • D
      Add API for issuing 'pci_add nic' monitor command · f8d54e7c
      Daniel P. Berrange 提交于
      * src/qemu/qemu_conf.c: Remove separator from qemuBuildNicStr()
        args, and remove hardcoded 'nic' prefix. Leave it upto callers
        instead
      * src/qemu/qemu_driver.c: Switch over to using the new
        qemuMonitorAddPCINetwork() method for NIC hotplug
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
        qemuMonitorAddPCINetwork API for PCI network device hotplug
      f8d54e7c
  7. 23 9月, 2009 1 次提交
    • C
      Introduce virStrncpy. · 03d777f3
      Chris Lalancette 提交于
      Add the virStrncpy function, which takes a dst string, source string,
      the number of bytes to copy and the number of bytes available in the
      dest string.  If the source string is too large to fit into the
      destination string, including the \0 byte, then no data is copied and
      the function returns NULL.  Otherwise, this function copies n bytes
      from source into dst, including the \0, and returns a pointer to the
      dst string.  This function is intended to replace all unsafe uses
      of strncpy in the code base, since strncpy does *not* guarantee that
      the buffer terminates with a \0.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      03d777f3
  8. 22 9月, 2009 2 次提交
    • D
      Fix handling of Xen(ner) detection · b81a7ece
      Daniel P. Berrange 提交于
      Latest upstream QEMU can be built with Xen support, which introduces
      a -xen-domid argument. This was  mistakenly detected as -domid due
      to old Xenner support. Adapt to cope with both syntax. Also only
      set domid if the virt type is xen, or the guest type is xen
      
      * src/qemu_conf.c, src/qemu_conf.h: Detect new -xen-domid flag in
        preference to -domid.
      * tests/qemuxml2argvdata/qemuxml2argv-bootloader.args,
        tests/qemuxml2argvdata/qemuxml2argv-input-xen.args: Add missing
        -domid param
      * tests/qemuxml2argvdata/qemuxml2argv-misc-uuid.args: Remove bogus
        -boot param.
      * tests/qemuxml2argvtest.c: Add missing QEMUD_CMD_FLAG_DOMID params
      b81a7ece
    • C
      aabafbea
  9. 21 9月, 2009 1 次提交
    • D
      Move QEMU driver to src/qemu/ · 58355a5b
      Daniel P. Berrange 提交于
      * src/qemu_conf.c, src/qemu_conf.h, src/qemu_driver.c,
        src/qemu_driver.h: Move to src/qemu/
      * daemon/qemud.c, src/Makefile.am, tests/qemuargv2xmltest.c,
        tests/qemuhelptest.c, tests/qemuxml2argvtest.c,
        tests/qemuxml2xmltest.c: Adapt for changed paths
      58355a5b
  10. 10 9月, 2009 4 次提交
    • D
      Fix more OOM handling bugs · cbe63e52
      Daniel P. Berrange 提交于
      * src/qemu_conf.c: Fix leak of values upon OOM
      * src/xend_internal.c: Fix missing check for OOM failure
      * tests/qemuargv2xmltest.c, tests/qemuxml2argvtest.c: Free
        stateDir upon exit to avoid leak
      cbe63e52
    • M
      Probe machine types from kvm binary too · 3e14a8dc
      Mark McLoughlin 提交于
      Currently we only probe the main qemu binary for machine types, but we
      should also probe the kvm binary.
      
      * src/qemu_conf.c: probe kvm binary machines in qemudCapsInitGuest()
      3e14a8dc
    • M
      Look up machine types from all domains in qemudGetOldMachines() · f5dd3bcd
      Mark McLoughlin 提交于
      Rather than just looking at the default domain info, look at all
      domains
      
      * src/qemu_conf.c: look at all domains in qemudGetOldMachines()
      f5dd3bcd
    • M
      Split up qemudGetOldMachines() · 44646747
      Mark McLoughlin 提交于
      We need to look at all the domain infos in guest capabilities, not
      just the defaults.
      
      In order to allow that, split out a qemudGetOldMachinesFromInfo()
      from qemudGetOldMachines(). We'll make more use of it in the next
      patch.
      
      * src/qemu_conf.c: split out qemudGetOldMachinesFromInfo() from
        qemudGetOldMachines()
      44646747
  11. 05 9月, 2009 1 次提交
  12. 04 9月, 2009 1 次提交
    • R
      Fix several memory leaks · 0cf672fa
      Ryota Ozaki 提交于
      * src/domain_conf.c src/network_conf.c src/qemu_conf.c
        src/storage_backend_fs.c: various problems spotted by valgrind
        through libvirt code
      0cf672fa
  13. 03 9月, 2009 2 次提交
    • D
      Add support for setting disk drive serial numbers · 85d15b51
      Daniel P. Berrange 提交于
      * docs/schemas/domain.rng: Add <serial> element to disks
      * src/domain_conf.h, src/domain_conf.c: XML parsing and
        formatting for disk serial numbers
      * src/qemu_conf.c: Set serial number when launching guests
      * tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.args,
        tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.xml: Add
        serial number to XML test
      85d15b51
    • D
      Support configuration of huge pages in guests · d823a05a
      Daniel P. Berrange 提交于
      Add option to domain XML for
      
           <memoryBacking>
              <hugepages/>
           </memoryBacking>
      
      * configure.in: Add check for mntent.h
      * qemud/libvirtd_qemu.aug, qemud/test_libvirtd_qemu.aug, src/qemu.conf
        Add 'hugetlbfs_mount' config parameter
      * src/qemu_conf.c, src/qemu_conf.h: Check for -mem-path flag in QEMU,
        and pass it when hugepages are requested.
        Load hugetlbfs_mount config parameter, search for mount if not given.
      * src/qemu_driver.c: Free hugetlbfs_mount/path parameter in driver shutdown.
        Create directory for QEMU hugepage usage, chowning if required.
      * docs/formatdomain.html.in: Document memoryBacking/hugepages elements
      * docs/schemas/domain.rng: Add memoryBacking/hugepages elements to schema
      * src/util.c, src/util.h, src/libvirt_private.syms: Add virFileFindMountPoint
        helper API
      * tests/qemuhelptest.c: Add -mem-path constants
      * tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c: Add tests for hugepage
        handling
      * tests/qemuxml2argvdata/qemuxml2argv-hugepages.xml,
        tests/qemuxml2argvdata/qemuxml2argv-hugepages.args: Data files for
        hugepage tests
      d823a05a
  14. 18 8月, 2009 2 次提交
    • M
      Fix bridge/tap system error reporting · 3ec80d01
      Mark McLoughlin 提交于
      * src/qemu_conf.c, src/uml_conf.c: use virReportSystemError() to report
        system errors
      3ec80d01
    • M
      Don't expose 'vnet%d' to the user · 2b1f67d4
      Mark McLoughlin 提交于
      https://bugzilla.redhat.com/517371
      
      Matt Booth points out that if you use a non-existent bridge name when
      start a guest you get a weird error message:
      
        Failed to add tap interface 'vnet%d' to bridge 'virbr0'
      
      and dev='vnet%d' appears in the dumpxml output.
      
      Fix that by not including 'vnet%d' in the error message and freeing the
      'vnet%d' string if adding the tap device to the bridge fails.
      
      * src/qemu_conf.c, src/uml_conf.c: fix qemudNetworkIfaceConnect()
        and umlConnectTapDevice() to not expose 'vnet%d' to the user
      2b1f67d4
  15. 17 8月, 2009 1 次提交
    • C
      Compressed save image format for Qemu. · 2d6a5819
      Chris Lalancette 提交于
      Implement a compressed save image format for qemu.  While ideally
      we would have the choice between compressed/non-compressed
      available to the libvirt API, unfortunately there is no "flags"
      parameter to the virDomainSave() API.  Therefore, implement this
      as a qemu.conf option.  gzip, bzip2, and lzma are implemented, and
      it should be very easy to implement additional compression
      methods.
      
      One open question is if/how we should detect the compression
      binaries.  One way to do it is to do compile-time setting of the
      paths (via configure.in), but that doesn't seem like a great thing
      to do.  My preferred solution is not to detect at all;
      when we go to run the commands that need them, if they
      aren't available, or aren't available in one of the standard paths,
      then we'll fail.  That's also the solution implemented in this patch.
      
      In the future, we'll have a more robust (managed) save/restore API,
      at which time we can expose this functionality properly in the API.
      
      V2: get rid of redundant dd command and just use >> to append data.
      V3: Add back the missing pieces for the enum and bumping the save version.
      V4: Make the compressed field in the save_header an int.
          Implement LZMA compression.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      2d6a5819
  16. 14 8月, 2009 1 次提交
    • M
      Detect KVM's PCI device assignment support · d4528d9a
      Mark McLoughlin 提交于
      PCI device assignment is only supported in KVM's fork of qemu, so we
      should really detect its availability and give a nice error if its
      not supported.
      
      * src/qemu_conf.[ch]: introduce QEMUD_CMD_FLAG_PCIDEVICE indicating
        that the -pcidevice command line option is available
      
      * tests/*: update the tests
      d4528d9a
  17. 05 8月, 2009 1 次提交
    • A
      Typo and comment fixes · 3879b334
      Aron Griffis 提交于
      * docs/schemas/*.rng: the comments were wrong
      * src/qemu_conf.c: typo in an error message
      3879b334
  18. 27 7月, 2009 8 次提交
    • M
      Make qemuBuildHostNetStr() take tapfd as a string · 32db8dd7
      Mark McLoughlin 提交于
      With hotplug, we're going to want to pass a tapfd name rather than an
      actual file descriptor, so prepare the way by passing a string tapfd to
      qemuBuildHostNetStr().
      
      * src/qemu_conf.h: qemuBuildHostNetStr() takes a string tapfd now
      
      * src/qemu_conf.c: pass qemuBuildHostNetStr() a string rather than an
        actual file descriptor
      
      * src/qemu_driver.c: update qemudDomainAttachNetDevice() for change
      32db8dd7
    • M
      Move vnet_hdr logic into qemudNetworkIfaceConnect() and export it · a3f33b65
      Mark McLoughlin 提交于
      * src/qemu_conf.h: export qemudNetworkIfaceConnect()
      
      * src/qemu_conf.c: move vnet_hdr logic into qemudNetworkIfaceConnect()
        since we need it for hotplug too
      a3f33b65
    • M
      Only probe qemu for machine types when binary changes · 707302b2
      Mark McLoughlin 提交于
      By probing for qemu machine types, we increased the time of a
      GetCapabilities call from 100us to a whopping 60ms.
      
      This patch takes the approach of only probing for machine types
      when the mtime of the emulator binary changed since the last time
      the capabilities were generated.
      
      * src/capabilities.h: cache the emulator binary mtime
      
      * src/qemu_conf.c: add qemudGetOldMachines() to copy the machine
        types from the old caps struct if the mtime for the binary hasn't
        changed
      
      * src/qemu_conf.h, src/qemu_driver.c: pass the old caps pointer to
        qemudCapsInit()
      707302b2
    • M
      Probe QEMU directly for machine aliases if not found in capabilties · c14c6b08
      Mark McLoughlin 提交于
      Not all possible emulators are actually in the capabilities, so if we
      don't find the supplied emulator we should probe it directly for machine
      types.
      
      * src/qemu_driver.c: add qemudCanonicalizeMachineDirect() to directly
        probe an emulator for the canonical machine type
      c14c6b08
    • M
      Canonicalize qemu machine types · be291b33
      Mark McLoughlin 提交于
      In qemu-0.11 there is a 'pc-0.10' machine type which allows you to run
      guests with a machine which is compatible with the pc machine in
      qemu-0.10 - e.g. using the original PCI class for virtio-blk and
      virtio-console and disabling MSI support in virtio-net. The idea here
      is that we don't want to suprise guests by changing the hardware when
      qemu is updated.
      
      I've just posted some patches for qemu-0.11 which allows libvirt to
      canonicalize the 'pc' machine alias to the latest machine version.
      
      This patches makes us use that so that when a guest is configured to
      use the 'pc' machine type, we resolve that to 'pc-0.11' machine and
      save that in the guest XML.
      
      See also:
      
        https://fedoraproject.org/wiki/Features/KVM_Stable_Guest_ABI
      
      * src/qemu_conf.c: add qemudCanonicalizeMachine() to canonicalize
        the machine type according to the machine aliases in capabilities
      
      * src/qemu_driver.c: parse aliases in qemudParseMachineTypesStr()
      be291b33
    • M
      Add virCapsGuestMachine structure · 38fd207e
      Mark McLoughlin 提交于
      A subsequent commit will add a "canonical" field to this structure,
      this patch basically just prepares the way for that.
      
      The new type is added, along with virCapabilitiesAlloc/FreeMachines()
      helpers and a whole bunch of code to make the transition.
      
      One quirk is that virCapabilitiesAddGuestDomain() and
      virCapabilitiesAddGuest() take ownership of the machine list rather
      than duping it. This makes sense to avoid needless copying.
      
      * src/capabilities.h: add the virCapsGuestMachine struct and use it
        in virCapsGuestDomainInfo, add prototypes for new functions and
        update the AddGuest() prototypes
      
      * src/capabilities.c: add code for allocating and freeing the new
        type, change the machines parameter to AddGuest() etc.
      
      * src/libvirt_private.syms: export the new helpers
      
      * src/qemu_conf.c: update all the machine type code to use the new
        struct
      
      * src/xen_internal.c: ditto
      
      * tests/testutilsqemu.c: ditto
      38fd207e
    • M
      Probe for QEMU machine types · d412487e
      Mark McLoughlin 提交于
      Currently we hardcode the QEMU machine types. We should really just
      parse the output of 'qemu -M ?' so the lists don't get out of sync.
      
      xenner doesn't support '-M ?', so we still need to hardcode that.
      
      The horrible (const char *const *) is removed in a subsequent patch.
      
      * src/qemu_conf.c: kill the arch_info*machines tables, retain the
        hardcoded xenner machine type, add qemudProbeMachineTypes() to
        run and parse 'qemu -M ?' and use it in qemudCapsInitGuest()
      d412487e
    • M
      Cleanup qemu binary detection logic in qemudCapsInitGuest() · 7803e6f3
      Mark McLoughlin 提交于
      There's no need for the hasbase/hasaltbase confusion, just store the
      first binary path found in a variable.
      
      * src/qemu_conf.c: kill hasbase/hasaltbase logic in qemudCapsInitGuest()
      7803e6f3
  19. 24 7月, 2009 1 次提交
    • D
      Make QEMU cgroups use configurable · f4c3acdf
      Daniel P. Berrange 提交于
       * qemud/libvirtd_qemu.aug, qemud/test_libvirtd_qemu.aug,
         src/qemu.conf: Add 'cgroups_controllers' and 'cgroups_device_acl'
         parameters
       * src/qemu_conf.h, src/qemu_conf.c: Load & parse configuration params
         for cgroups
       * src/qemu_driver.c: Only use cgroups controllers that are activated,
         and use configured device whitelist instead of default, if set.
      f4c3acdf
  20. 23 7月, 2009 1 次提交
    • J
      Always add -no-kvm and -no-kqemu, for qemu domains · 7922e247
      Jim Paris 提交于
      If the qemu binary supports "-no-kvm" and/or "-no-kqemu", they should
      always be added for plain "qemu" domains.  Previously, we omitted them
      whenever the host and guest architectures implied that they would be
      disabled automatically, but that logic was flawed in some cases
      (such as i686 and x86_64).
      * src/qemu_conf.c: fix the conditions for adding "-no-kvm" and/or "-no-kqemu"
      7922e247
  21. 22 7月, 2009 5 次提交
    • M
      Basic qemu NIC hotplug support · 35153940
      Mark McLoughlin 提交于
      Implement basic NIC hotplug support using the 'host_net_add' and
      'pci_add' qemu monitor commands.
      
      For now, we don't support 'bridge' or 'network' types.
      
      Also, if pci_add fails, we currently fail to remove the backend
      which we added.
      
      Finally, NIC hot-unplug support is missing.
      
      * src/qemu_driver.c: add qemudDomainAttachNetDevice()
      
      * src/qemu_conf.[ch]: export qemuBuildNicStr(), qemuBuildHostNetStr()
        and qemuAssignNames()
      
      * src/libvirt_private.syms: export virDomainNetTypeToString()
      35153940
    • M
      Store the interface vlan number in the domain state · 30605477
      Mark McLoughlin 提交于
      Currently, an interface's vlan number corresponds to its index in
      the table of network interfaces. That is no longer true when we
      allow devices to be removed.
      
      To fix this, we store the vlan number in the domain's state XML
      so that it survives libvirtd restarts.
      
      * src/domain_conf.h: add vlan number to virDomainNetDef
      
      * src/domain_conf.c: store it in XML as <state vlan='N'/>, defaulting
        to -1 if this is state saved by a previous version of libvirt
      
      * src/qemu_conf.c: assign vlan numbers before starting qemu
      30605477
    • M
      Assign names to qemu NICs and network backends · c23dae4e
      Mark McLoughlin 提交于
      We need these so that we can remove the devices via the monitor.
      
      * src/domain_conf.h: add nic_name and hostnet_name to virDomainNetDef
      
      * src/domain_conf.c: free nic_name and hostnet_name
      
      * src/qemu_conf.c: add qemuAssignNetNames(), use it if qemu has
        support for the param and pass the names on the command line
      
      * tests/qemuxml2argv*: add a test for this
      c23dae4e
    • M
      Add checks for some NIC hotplug related features added in qemu-0.10.0 · 94889768
      Mark McLoughlin 提交于
      Add QEMUD_CMD_FLAG_NET_NAME to indicate that '-net ...,name=foo' is
      supported and QEMUD_CMD_FLAG_HOST_NET_ADD to indicate that the
      'host_net_add' monitor command is available.
      
      Set both these flags if the qemu version is greater than 0.10.0.
      Checking via the '-help' output would not work for the monitor command
      and even for the command line arg, it would be quite fragile.
      
      * src/qemu_conf.h: add new flags as aliases of QEMUD_CMD_FLAG_0_10
      
      * src/qemu_conf.c: set QEMUD_CMD_FLAG_0_10 for versions >= 0.10.0
      
      * tests/qemuhelptest.c: set QEMUD_CMD_FLAG_0_10 for the appropriate
        qemu versions
      94889768
    • M
      Factor qemuBuildHostNetStr() out from qemuBuildCommandLine() · 63e67ee0
      Mark McLoughlin 提交于
      Re-factor this code so that it can be used for NIC hotplug
      too. The awkward prefix and type_sep arguments are needed to
      allow us to do "host_net_add tap vlan=..."
      
      * src/qemu_conf.c: factor the net backend string formatting
        code into its own function
      63e67ee0