1. 19 11月, 2011 3 次提交
    • 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
    • D
      Fix use of uninitialized variable in QEMU driver · a7c6ce0d
      Daniel P. Berrange 提交于
      a7c6ce0d
  2. 18 11月, 2011 1 次提交
  3. 16 11月, 2011 1 次提交
    • S
      qemu/rbd: improve rbd device specification · 5745dc12
      Sage Weil 提交于
      This improves the support for qemu rbd devices by adding support for a few
      key features (e.g., authentication) and cleaning up the way in which
      rbd configuration options are passed to qemu.
      
      An <auth> member of the disk source xml specifies how librbd should
      authenticate. The username attribute is the Ceph/RBD user to authenticate as.
      The usage or uuid attributes specify which secret to use. Usage is an
      arbitrary identifier local to libvirt.
      
      The old RBD support relied on setting an environment variable to
      communicate information to qemu/librbd.  Instead, pass those options
      explicitly to qemu.  Update the qemu argument parsing and tests
      accordingly.
      Signed-off-by: NSage Weil <sage@newdream.net>
      Signed-off-by: NJosh Durgin <josh.durgin@dreamhost.com>
      5745dc12
  4. 15 11月, 2011 3 次提交
    • D
      Split src/util/network.{c,h} into 5 pieces · d3406045
      Daniel P. Berrange 提交于
      The src/util/network.c file is a dumping ground for many different
      APIs. Split it up into 5 pieces, along functional lines
      
       - src/util/virnetdevbandwidth.c: virNetDevBandwidth type & helper APIs
       - src/util/virnetdevvportprofile.c: virNetDevVPortProfile type & helper APIs
       - src/util/virsocketaddr.c: virSocketAddr and APIs
       - src/conf/netdev_bandwidth_conf.c: XML parsing / formatting
         for virNetDevBandwidth
       - src/conf/netdev_vport_profile_conf.c: XML parsing / formatting
         for virNetDevVPortProfile
      
      * src/util/network.c, src/util/network.h: Split into 5 pieces
      * src/conf/netdev_bandwidth_conf.c, src/conf/netdev_bandwidth_conf.h,
        src/conf/netdev_vport_profile_conf.c, src/conf/netdev_vport_profile_conf.h,
        src/util/virnetdevbandwidth.c, src/util/virnetdevbandwidth.h,
        src/util/virnetdevvportprofile.c, src/util/virnetdevvportprofile.h,
        src/util/virsocketaddr.c, src/util/virsocketaddr.h: New pieces
      * daemon/libvirtd.h, daemon/remote.c, src/conf/domain_conf.c,
        src/conf/domain_conf.h, src/conf/network_conf.c,
        src/conf/network_conf.h, src/conf/nwfilter_conf.h,
        src/esx/esx_util.h, src/network/bridge_driver.c,
        src/qemu/qemu_conf.c, src/rpc/virnetsocket.c,
        src/rpc/virnetsocket.h, src/util/dnsmasq.h, src/util/interface.h,
        src/util/iptables.h, src/util/macvtap.c, src/util/macvtap.h,
        src/util/virnetdev.h, src/util/virnetdevtap.c,
        tools/virsh.c: Update include files
      d3406045
    • D
      Rename virVirtualPortProfileParams & APIs · 767e01ce
      Daniel P. Berrange 提交于
      Rename the virVirtualPortProfileParams struct to be
      virNetDevVPortProfile, and rename the APIs to match
      this prefix.
      
      * src/util/network.c, src/util/network.h: Rename port profile
        APIs
      * src/conf/domain_conf.c, src/conf/domain_conf.h,
        src/conf/network_conf.c, src/conf/network_conf.h,
        src/network/bridge_driver.c, src/qemu/qemu_hotplug.c,
        src/util/macvtap.c, src/util/macvtap.h: Update for
        renamed APIs/structs
      767e01ce
    • M
      PATCH: Fix build without MACVTAP · be622a63
      Michael Wood 提交于
      Hi
      
      Commit c31d23a7 removed the "conn"
      parameter from qemuPhysIfaceConnect(), but it's still used if
      WITH_MACVTAP is false.  Also, it's still mentioned in the comment
      above the function:
      
      /**
       * qemuPhysIfaceConnect:
       * @def: the definition of the VM (needed by 802.1Qbh and audit)
       * @conn: pointer to virConnect object
       * @driver: pointer to the qemud_driver
       * @net: pointer to he VM's interface description with direct device type
       * @qemuCaps: flags for qemu
       *
       * Returns a filedescriptor on success or -1 in case of error.
       */
      int
      qemuPhysIfaceConnect(virDomainDefPtr def,
                           struct qemud_driver *driver,
                           virDomainNetDefPtr net,
                           virBitmapPtr qemuCaps,
                           enum virVMOperationType vmop)
      {
          int rc;
      #if WITH_MACVTAP
      [...]
      #else
          (void)def;
          (void)conn;
          (void)net;
          (void)qemuCaps;
          (void)driver;
          (void)vmop;
          qemuReportError(VIR_ERR_INTERNAL_ERROR,
                          "%s", _("No support for macvtap device"));
          rc = -1;
      #endif
          return rc;
      }
      
      --
      Michael Wood <esiotrot@gmail.com>
      
      From f4fc43b4111a4c099395c55902e497b8965e2b53 Mon Sep 17 00:00:00 2001
      From: Michael Wood <esiotrot@gmail.com>
      Date: Sat, 12 Nov 2011 13:37:53 +0200
      Subject: [PATCH] Fix build without MACVTAP.
      be622a63
  5. 12 11月, 2011 3 次提交
    • 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
    • E
      qemu: fix domjobabort regression · 61f2b6ba
      Eric Blake 提交于
      This reverts commit ef1065cf; see also this bug report:
      https://bugzilla.redhat.com/show_bug.cgi?id=751900
      
      In qemu 0.15.1 and earlier, during migration to file, the
      qemu_savevm_state_begin and qemu_savevm_state_iterate methods
      will both process as much migration data as possible until either
      
        1. The file descriptor returns EAGAIN
        2. The bandwidth rate limit is reached
      
      If we set the rate limit to ULONG_MAX, test 2 never becomes true. We're
      passing a plain file descriptor to QEMU and POSIX does not support EAGAIN on
      regular files / block devices, so test 1 never becomes true either.
      
      In the 'virsh save --bypass-cache' case, we pass a pipe instead of a
      regular fd, but using a pipe adds I/O overhead, so always passing a
      pipe just so qemu can see EAGAIN doesn't seem nice.
      
      The ultimate fix needs to come from qemu - background migration must
      respect asynchronous abort requests, or else periodically return
      control to the main handling loop without an EAGAIN and without
      waiting to hit an insanely large amount of data.  But until a
      version of qemu is fixed to support "unlimited" data rates while
      still allowing cancellation, the best we can do is avoid the
      automatic use of unlimited rates from within libvirt (users can
      still explicitly change the migration rates, if they are aware that
      they are giving up the ability to cancel a job).
      
      Reverting the lone use of QEMU_DOMAIN_FILE_MIG_BANDWIDTH_MAX is
      the simplest patch; this slows migration back down to a default
      32M/sec cap, but also ensures that the main qemu processing loop
      will still be responsive to cancellation requests.  Hopefully
      upstream qemu will provide us a means of safely using unlimited
      speed, including a runtime probe of that capability.
      
      * src/qemu/qemu_migration.c (qemuMigrationToFile): Revert attempt
      to use unlimited migration bandwidth when migrating to file.
      Signed-off-by: NDaniel Veillard <veillard@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      61f2b6ba
    • E
      build: drop useless dirent.h includes · e55ec69d
      Eric Blake 提交于
      * .gnulib: Update to latest, for improved syntax-check.
      * src/lxc/lxc_container.c (includes): Drop unused include.
      * src/network/bridge_driver.c: Likewise.
      * src/node_device/node_device_linux_sysfs.c: Likewise.
      * src/openvz/openvz_driver.c: Likewise.
      * src/qemu/qemu_conf.c: Likewise.
      * src/storage/storage_backend_iscsi.c: Likewise.
      * src/storage/storage_backend_mpath.c: Likewise.
      * src/uml/uml_conf.c: Likewise.
      * src/uml/uml_driver.c: Likewise.
      e55ec69d
  6. 11 11月, 2011 1 次提交
  7. 10 11月, 2011 6 次提交
    • D
      Adjust naming of network device bandwidth management APIs · 0eee075d
      Daniel P. Berrange 提交于
      Rename virBandwidth to virNetDevBandwidth, and virRate to
      virNetDevBandwidthRate.
      
      * src/util/network.c, src/util/network.h: Rename bandwidth
        structs and APIs
      * src/conf/domain_conf.c, src/conf/domain_conf.h,
        src/conf/network_conf.c, src/conf/network_conf.h,
        src/lxc/lxc_driver.c, src/network/bridge_driver.c,
        src/qemu/qemu_command.c, src/util/macvtap.c,
        src/util/macvtap.h, tools/virsh.c: Update for API changes.
      0eee075d
    • D
      Santize naming of socket address APIs · 4c544e6c
      Daniel P. Berrange 提交于
      The socket address APIs in src/util/network.h either take the
      form  virSocketAddrXXX, virSocketXXX or virSocketXXXAddr.
      
      Sanitize this so everything is virSocketAddrXXXX, and ensure
      that the virSocketAddr parameter is always the first one.
      
      * src/util/network.c, src/util/network.h: Santize socket
        address API naming
      * src/conf/domain_conf.c, src/conf/network_conf.c,
        src/conf/nwfilter_conf.c, src/network/bridge_driver.c,
        src/nwfilter/nwfilter_ebiptables_driver.c,
        src/nwfilter/nwfilter_learnipaddr.c,
        src/qemu/qemu_command.c, src/rpc/virnetsocket.c,
        src/util/dnsmasq.c, src/util/iptables.c,
        src/util/virnetdev.c, src/vbox/vbox_tmpl.c: Update for
        API renaming
      4c544e6c
    • D
      Split bridge.h into three separate files · e49c9bf2
      Daniel P. Berrange 提交于
      Following the renaming of the bridge management APIs, we can now
      split the source file into 3 corresponding pieces
      
       * src/util/virnetdev.c: APIs for any type of network interface
       * src/util/virnetdevbridge.c: APIs for bridge interfaces
       * src/util/virnetdevtap.c: APIs for TAP interfaces
      
      * src/util/virnetdev.c, src/util/virnetdev.h,
        src/util/virnetdevbridge.c, src/util/virnetdevbridge.h,
        src/util/virnetdevtap.c, src/util/virnetdevtap.h: Copied
        from bridge.{c,h}
      * src/util/bridge.c, src/util/bridge.h: Split into 3 pieces
      * src/lxc/lxc_driver.c, src/network/bridge_driver.c,
        src/openvz/openvz_driver.c, src/qemu/qemu_command.c,
        src/qemu/qemu_conf.h, src/uml/uml_conf.c, src/uml/uml_conf.h,
        src/uml/uml_driver.c: Update #include directives
      e49c9bf2
    • D
      Rename all brXXXX APIs to follow new convention · dced27c8
      Daniel P. Berrange 提交于
      The existing brXXX APIs in src/util/bridge.h are renamed to
      follow one of three different conventions
      
       - virNetDevXXX       - operations for any type of interface
       - virNetDevBridgeXXX - operations for bridge interfaces
       - virNetDevTapXXX    - operations for tap interfaces
      
      * src/util/bridge.h, src/util/bridge.c: Rename all APIs
      * src/lxc/lxc_driver.c, src/network/bridge_driver.c,
        src/qemu/qemu_command.c, src/uml/uml_conf.c,
        src/uml/uml_driver.c: Update for API renaming
      dced27c8
    • D
      Make all brXXX APIs raise errors, instead of returning errnos · 4f4fd8f7
      Daniel P. Berrange 提交于
      Currently every caller of the brXXX APIs has to store the returned
      errno value and then raise an error message. This results in
      inconsistent error messages across drivers, additional burden on
      the callers and makes the error reporting inaccurate since it is
      hard to distinguish different scenarios from 1 errno value.
      
      * src/util/bridge.c: Raise errors instead of returning errnos
      * src/lxc/lxc_driver.c, src/network/bridge_driver.c,
        src/qemu/qemu_command.c, src/uml/uml_conf.c,
        src/uml/uml_driver.c: Remove error reporting code
      4f4fd8f7
    • 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
  8. 09 11月, 2011 1 次提交
  9. 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
  10. 03 11月, 2011 4 次提交
    • D
      Fix default console type setting · 209c2880
      Daniel P. Berrange 提交于
      The default console type may vary based on the OS type. ie a Xen
      paravirt guests wants a 'xen' console, while a fullvirt guests
      wants a 'serial' console.
      
      A plain integer default console type in the capabilities does
      not suffice. Instead introduce a callback that is passed the
      OS type.
      
      * src/conf/capabilities.h: Use a callback for default console
        type
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Use callback
        for default console type. Add missing LXC/OpenVZ console types.
      * src/esx/esx_driver.c, src/libxl/libxl_conf.c,
        src/lxc/lxc_conf.c, src/openvz/openvz_conf.c,
        src/phyp/phyp_driver.c, src/qemu/qemu_capabilities.c,
        src/uml/uml_conf.c, src/vbox/vbox_tmpl.c,
        src/vmware/vmware_conf.c, src/xen/xen_hypervisor.c,
        src/xenapi/xenapi_driver.c: Set default console type callback
      209c2880
    • D
      Fix crash formatting virtio console · 5990d921
      Daniel P. Berrange 提交于
      qemuBuildVirtioSerialPortDevStr was mistakenly accessing the
      target.name field in the virDomainChrDef object for chardevs
      belonging to a console. Those chardevs only have port set,
      and if there's > 1 console, the > 1port number results in
      trying to access a target.name with address 0x1
      
      * src/qemu/qemu_command.c: Fix target.name handling and
        make code more robust wrt error reporting
      
      * src/qemu/qemu_command.c: Conditionally access target.name
      5990d921
    • 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
  11. 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
  12. 01 11月, 2011 2 次提交
  13. 31 10月, 2011 1 次提交
  14. 30 10月, 2011 1 次提交
    • O
      qemu: Restore the original states of PCI device when restarting daemon · d84b3626
      Osier Yang 提交于
      To support "managed" mode of host PCI device, we record the original
      states (unbind_from_stub, remove_slot, and reprobe) so that could
      reattach the device to host with original driver. But there is no XML
      for theses attrs, and thus after daemon is restarted, we lose the
      original states. It's easy to reproduce:
      
          1) virsh start domain
          2) virsh attach-device dom hostpci.xml (in 'managed' mode)
          3) service libvirtd restart
          4) virsh destroy domain
      
          You will see the device won't be bound to the original driver
      if there was one.
      
      This patch is to solve the problem by introducing internal XML
      (won't be dumped to user, only dumped to status XML). The XML is:
          <origstates>
            <unbind/>
            <remove_slot/>
            <reprobe/>
          </origstates>
      
      Which will be child node of <hostdev><source>...</souce></hostdev>.
      (only for PCI device).
      
      A new struct "virDomainHostdevOrigStates" is introduced for the XML,
      and the according members are updated when preparing the PCI device.
      And function "qemuUpdateActivePciHostdevs" is modified to honor
      the original states. Use of qemuGetPciHostDeviceList is removed
      in function "qemuUpdateActivePciHostdevs", and the "managed" value of
      the device config is honored by the change. This fixes another problem
      alongside:
      
          qemuGetPciHostDeviceList set the device as "managed" force
          regardless of whether the device is configured as "managed='yes'"
          or not in XML, which is not right.
      d84b3626
  15. 29 10月, 2011 3 次提交
    • R
      macvtap: Fix error return value convention/inconsistencies · 228a9ec3
      Roopa Prabhu 提交于
      - changed some return 1's to return -1
      - changed if (rc) error checks to if (rc < 0)
      - fixed some other minor convention violations
      
      I might have missed some. Can fix in another patch or can respin
      Signed-off-by: NRoopa Prabhu <roprabhu@cisco.com>
      Reported-by: NEric Blake <eblake@redhat.com>
      Reported-by: NLaine Stump <laine@laine.org>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      228a9ec3
    • X
      pci address conflict when virtio disk with drive type · 5fb0de2e
      Xu He Jie 提交于
      When using the xml as below:
      ------------------------------------------------------
      <devices>
        <emulator>/home/soulxu/data/work-code/qemu-kvm/x86_64-softmmu/qemu-system-x86_64</emulator>
          <disk type='file' device='disk'>
          <driver name='qemu' type='qcow2'/>
          <source file='/home/soulxu/data/VM/images/linux.img'/>
          <target dev='vda' bus='virtio'/>
          <address type='drive' controller='0' bus='0' unit='0'/>
        </disk>
        <input type='mouse' bus='ps2'/>
        <graphics type='vnc' port='-1' autoport='yes'/>
        <video>
          <model type='cirrus' vram='9216' heads='1'/>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
        </video>
        <memballoon model='virtio'>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
        </memballoon>
      </devices>
      ------------------------------------------------------
      
      Then can't startup qemu, the error message as below:
      virsh # start test-vm
      error: Failed to start domain test-vm
      error: internal error process exited while connecting to monitor: qemu-system-x86_64: -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3: PCI: slot 3 function 0 not available for virtio-balloon-pci, in use by virtio-blk-pci
      qemu-system-x86_64: -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3: Device 'virtio-balloon-pci' could not be initialized
      
      So adding check for bus type and address type. Only the address of pci type support by virtio bus.
      Signed-off-by: NXu He Jie <xuhj@linux.vnet.ibm.com>
      5fb0de2e
    • A
      qemu: plug memory leak · 87b7e148
      Alex Jia 提交于
      Leak introduced in commit c1bc3d89.
      Detected by valgrind:
      
      ==18462== 1,100 bytes in 1 blocks are definitely lost in loss record 183 of 184
      ==18462==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
      ==18462==    by 0x4A06167: realloc (vg_replace_malloc.c:525)
      ==18462==    by 0x4AADBB: virReallocN (memory.c:161)
      ==18462==    by 0x4A975E: virBufferGrow (buf.c:117)
      ==18462==    by 0x4A9D92: virBufferVasprintf (buf.c:290)
      ==18462==    by 0x4A9EF7: virBufferAsprintf (buf.c:263)
      ==18462==    by 0x429488: qemuBuildControllerDevStr (qemu_command.c:1993)
      ==18462==    by 0x42C4B6: qemuBuildCommandLine (qemu_command.c:3803)
      ==18462==    by 0x41A604: testCompareXMLToArgvHelper (qemuxml2argvtest.c:124)
      ==18462==    by 0x41BB81: virtTestRun (testutils.c:141)
      ==18462==    by 0x416DFF: mymain (qemuxml2argvtest.c:369)
      ==18462==    by 0x41B277: virtTestMain (testutils.c:696)
      ==18462==
      ==18462== LEAK SUMMARY:
      ==18462==    definitely lost: 1,100 bytes in 1 blocks
      ==18462==    indirectly lost: 0 bytes in 0 blocks
      
      * src/qemu/qemu_command.c (qemuBuildCommandLine): Clean up on success.
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      87b7e148
  16. 28 10月, 2011 4 次提交
    • E
      qemu: avoid leaking uninit data from hotplug to dumpxml · a4ca6e5d
      Eric Blake 提交于
      Detected by Coverity.  The fix in 2c27dfae didn't catch all bad
      instances of memcpy().  Thankfully, on further analysis, all of
      the problematic uses are only triggered by old qemu that lacks
      -device.
      
      * src/qemu/qemu_hotplug.c (qemuDomainAttachPciDiskDevice)
      (qemuDomainAttachNetDevice, qemuDomainAttachHostPciDevice): Init
      all fields since monitor only populates some of them.
      a4ca6e5d
    • 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
    • D
      Extend graphics event to include UNIX socket · 6aa27da2
      Daniel P. Berrange 提交于
      Not all VNC/SPICE servers use a TCP socket for their connections.
      It is possible to configure a UNIX socket server. The graphics
      event must thus include a UNIX socket address type.
      
      * include/libvirt/libvirt.h.in: Add UNIX socket address type
        for graphics event
      * src/qemu/qemu_monitor_json.c: Add 'unix' string to address
        type enum
      6aa27da2
    • J
      Use virXMLSaveFile when writing XML config · c0d9dfe2
      Jiri Denemark 提交于
      c0d9dfe2
  17. 27 10月, 2011 2 次提交
    • D
      Add a systemtap script for watching QEMU monitor interactions · 9b76b08a
      Daniel P. Berrange 提交于
      This change adds some systemtap/dtrace probes to the QEMU monitor
      client code. In particular it allows watching of all operations
      for a VM
      
      * examples/systemtap/qemu-monitor.stp: Watch all monitor commands
      * src/Makefile.am: Passing libdir/bindir/sbindir to dtrace2systemtap.pl
      * src/dtrace2systemtap.pl: Accept libdir/bindir/sbindir as args
        and look for '# binary:' comment to mark probes against libvirtd
        vs libvirt.so
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor_json.c,
        src/qemu/qemu_monitor_text.c: Add probes for key functions
      9b76b08a
    • 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
  18. 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