1. 18 1月, 2012 1 次提交
    • O
      qemu: Introduce inactive PCI device list · 6be610bf
      Osier Yang 提交于
      pciTrySecondaryBusReset checks if there is active device on the
      same bus, however, qemu driver doesn't maintain an effective
      list for the inactive devices, and it passes meaningless argument
      for parameter "inactiveDevs". e.g. (qemuPrepareHostdevPCIDevices)
      
      if (!(pcidevs = qemuGetPciHostDeviceList(hostdevs, nhostdevs)))
          return -1;
      
      ..skipped...
      
      if (pciResetDevice(dev, driver->activePciHostdevs, pcidevs) < 0)
          goto reattachdevs;
      
      NB, the "pcidevs" used above are extracted from domain def, and
      thus one won't be able to attach a device of which bus has other
      device even detached from host (nodedev-detach). To see more
      details of the problem:
      
      RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=773667
      
      This patch is to resolve the problem by introducing an inactive
      PCI device list (just like qemu_driver->activePciHostdevs), and
      the whole logic is:
      
        * Add the device to inactive list during nodedev-dettach
        * Remove the device from inactive list during nodedev-reattach
        * Remove the device from inactive list during attach-device
          (for non-managed device)
        * Add the device to inactive list after detach-device, only
          if the device is not managed
      
      With the above, we have a sufficient inactive PCI device list, and thus
      we can use it for pciResetDevice. e.g.(qemuPrepareHostdevPCIDevices)
      
      if (pciResetDevice(dev, driver->activePciHostdevs,
                         driver->inactivePciHostdevs) < 0)
          goto reattachdevs;
      6be610bf
  2. 11 1月, 2012 1 次提交
    • D
      Change security driver APIs to use virDomainDefPtr instead of virDomainObjPtr · 99be754a
      Daniel P. Berrange 提交于
      When sVirt is integrated with the LXC driver, it will be neccessary
      to invoke the security driver APIs using only a virDomainDefPtr
      since the lxc_container.c code has no virDomainObjPtr available.
      Aside from two functions which want obj->pid, every bit of the
      security driver code only touches obj->def. So we don't need to
      pass a virDomainObjPtr into the security drivers, a virDomainDefPtr
      is sufficient. Two functions also gain a 'pid_t pid' argument.
      
      * src/qemu/qemu_driver.c, src/qemu/qemu_hotplug.c,
        src/qemu/qemu_migration.c, src/qemu/qemu_process.c,
        src/security/security_apparmor.c,
        src/security/security_dac.c,
        src/security/security_driver.h,
        src/security/security_manager.c,
        src/security/security_manager.h,
        src/security/security_nop.c,
        src/security/security_selinux.c,
        src/security/security_stack.c: Change all security APIs to use a
        virDomainDefPtr instead of virDomainObjPtr
      99be754a
  3. 09 1月, 2012 1 次提交
    • L
      qemu: add new disk device='lun' for bus='virtio' & type='block' · 177db087
      Laine Stump 提交于
      In the past, generic SCSI commands issued from a guest to a virtio
      disk were always passed through to the underlying disk by qemu, and
      the kernel would also pass them on.
      
      As a result of CVE-2011-4127 (see:
      http://seclists.org/oss-sec/2011/q4/536), qemu now honors its
      scsi=on|off device option for virtio-blk-pci (which enables/disables
      passthrough of generic SCSI commands), and the kernel will only allow
      the commands for physical devices (not for partitions or logical
      volumes). The default behavior of qemu is still to allow sending
      generic SCSI commands to physical disks that are presented to a guest
      as virtio-blk-pci devices, but libvirt prefers to disable those
      commands in the standard virtio block devices, enabling it only when
      specifically requested (hopefully indicating that the requester
      understands what they're asking for). For this purpose, a new libvirt
      disk device type (device='lun') has been created.
      
      device='lun' is identical to the default device='disk', except that:
      
      1) It is only allowed if bus='virtio', type='block', and the qemu
         version is "new enough" to support it ("new enough" == qemu 0.11 or
         better), otherwise the domain will fail to start and a
         CONFIG_UNSUPPORTED error will be logged).
      
      2) The option "scsi=on" will be added to the -device arg to allow
         SG_IO commands (if device !='lun', "scsi=off" will be added to the
         -device arg so that SG_IO commands are specifically forbidden).
      
      Guests which continue to use disk device='disk' (the default) will no
      longer be able to use SG_IO commands on the disk; those that have
      their disk device changed to device='lun' will still be able to use SG_IO
      commands.
      
      *docs/formatdomain.html.in - document the new device attribute value.
      *docs/schemas/domaincommon.rng - allow it in the RNG
      *tests/* - update the args of several existing tests to add scsi=off, and
       add one new test that will test scsi=on.
      *src/conf/domain_conf.c - update domain XML parser and formatter
      
      *src/qemu/qemu_(command|driver|hotplug).c - treat
       VIR_DOMAIN_DISK_DEVICE_LUN *almost* identically to
       VIR_DOMAIN_DISK_DEVICE_DISK, except as indicated above.
      
      Note that no support for this new device value was added to any
      hypervisor drivers other than qemu, because it's unclear what it might
      mean (if anything) to those drivers.
      177db087
  4. 08 1月, 2012 1 次提交
    • L
      config: report error when script given for inappropriate interface type · 1734cdb9
      Laine Stump 提交于
      This fixes https://bugzilla.redhat.com/show_bug.cgi?id=638633
      
      Although scripts are not used by interfaces of type other than
      "ethernet" in qemu, due to the fact that the parser stores the script
      name in a union that is only valid when type is ethernet or bridge,
      there is no way for anyone except the parser itself to catch the
      problem of specifying an interface script for an inappropriate
      interface type (by the time the parsed data gets back to the code that
      called the parser, all evidence that a script was specified is
      forgotten).
      
      Since the parser itself should be agnostic to which type of interface
      allows scripts (an example of why: a script specified for an interface
      of type bridge is valid for xen domains, but not for qemu domains),
      the solution here is to move the script out of the union(s) in the
      DomainNetDef, always populate it when specified (regardless of
      interface type), and let the driver decide whether or not it is
      appropriate.
      
      Currently the qemu, xen, libxml, and uml drivers recognize the script
      parameter and do something with it (the uml driver only to report that
      it isn't supported). Those drivers have been updated to log a
      CONFIG_UNSUPPORTED error when a script is specified for an interface
      type that's inappropriate for that particular hypervisor.
      
      (NB: There was earlier discussion of solving this problem by adding a
      VALIDATE flag to all libvirt APIs that accept XML, which would cause
      the XML to be validated against the RNG files. One statement during
      that discussion was that the RNG shouldn't contain hypervisor-specific
      things, though, and a proper solution to this problem would require
      that (again, because a script for an interface of type "bridge" is
      accepted by xen, but not by qemu).
      1734cdb9
  5. 25 12月, 2011 1 次提交
  6. 16 12月, 2011 1 次提交
    • M
      qemu: Don't drop hostdev config until security label restore · 13d5a6b8
      Michal Privoznik 提交于
      Currently, on device detach, we parse given XML, find the device
      in domain object, free it and try to restore security labels.
      However, in some cases (e.g. usb hostdev) parsed XML contains
      less information than freed device. In usb case it is bus & device
      IDs. These are needed during label restoring as a symlink into
      /dev/bus is generated from them. Therefore don't drop device
      configuration until security labels are restored.
      13d5a6b8
  7. 15 12月, 2011 1 次提交
    • O
      qemu: Honor the original properties of PCI device when detaching · a0aec362
      Osier Yang 提交于
      This patch fixes two problems:
          1) The device will be reattached to host even if it's not
             managed, as there is a "pciDeviceSetManaged".
          2) The device won't be reattached to host with original
             driver properly. As it doesn't honor the device original
             properties which are maintained by driver->activePciHostdevs.
      a0aec362
  8. 10 12月, 2011 1 次提交
  9. 19 11月, 2011 3 次提交
    • D
      Rename high level macvlan creation APIs · 191090ae
      Daniel P. Berrange 提交于
      Rename virNetDevMacVLanCreate to virNetDevMacVLanCreateWithVPortProfile
      and virNetDevMacVLanDelete to virNetDevMacVLanDeleteWithVPortProfile
      
      To make way for renaming the other macvlan creation APIs in
      interface.c
      
      * util/virnetdevmacvlan.c, util/virnetdevmacvlan.h,
        qemu/qemu_command.c, qemu/qemu_hotplug.c, qemu/qemu_process.c:
        Rename APIs
      191090ae
    • 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
  10. 15 11月, 2011 1 次提交
    • 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
  11. 11 11月, 2011 1 次提交
  12. 01 11月, 2011 1 次提交
  13. 28 10月, 2011 1 次提交
    • 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
  14. 25 10月, 2011 1 次提交
    • E
      qemu: avoid leaking uninit data from hotplug to dumpxml · 2c27dfae
      Eric Blake 提交于
      Detected by Coverity.  Both text and JSON monitors set only the
      bus and unit fields, which means driveAddr.controller spends
      life as garbage on the stack, and is then memcpy()'d into the
      in-memory representation which the user can see via dumpxml.
      
      * src/qemu/qemu_hotplug.c (qemuDomainAttachSCSIDisk): Only copy
      defined fields.
      2c27dfae
  15. 15 10月, 2011 1 次提交
    • O
      qemu: Do not reattach PCI device used by other domain when shutdown · 24b8be89
      Osier Yang 提交于
      When failing on starting a domain, it tries to reattach all the PCI
      devices defined in the domain conf, regardless of whether the devices
      are still used by other domain. This will cause the devices to be deleted
      from the list qemu_driver->activePciHostdevs, thus the devices will be
      thought as usable even if it's not true. And following commands
      nodedev-{reattach,reset} will be successful.
      
      How to reproduce:
        1) Define two domains with same PCI device defined in the confs.
        2) # virsh start domain1
        3) # virsh start domain2
        4) # virsh nodedev-reattach $pci_device
      
      You will see the device will be reattached to host successfully.
      As pciDeviceReattach just check if the device is still used by
      other domain via checking if the device is in list driver->activePciHostdevs,
      however, the device is deleted from the list by step 2).
      
      This patch is to prohibit the bug by:
        1) Prohibit a domain starting or device attachment right at
           preparation period (qemuPrepareHostdevPCIDevices) if the
           device is in list driver->activePciHostdevs, which means
           it's used by other domain.
      
        2) Introduces a new field for struct _pciDevice, (const char *used_by),
           it will be set as the domain name at preparation period,
           (qemuPrepareHostdevPCIDevices). Thus we can prohibit deleting
           the device from driver->activePciHostdevs if it's still used by
           other domain when stopping the domain process.
      
      * src/pci.h (define two internal functions, pciDeviceSetUsedBy and
          pciDevceGetUsedBy)
      * src/pci.c (new field "const char *used_by" for struct _pciDevice,
          implementations for the two new functions)
      * src/libvirt_private.syms (Add the two new internal functions)
      * src/qemu_hostdev.h (Modify the definition of functions
          qemuPrepareHostdevPCIDevices, and qemuDomainReAttachHostdevDevices)
      * src/qemu_hostdev.c (Prohibit preparation and don't delete the
          device from activePciHostdevs list if it's still used by other domain)
      * src/qemu_hotplug.c (Update function usage, as the definitions are
          changed)
      Signed-off-by: NEric Blake <eblake@redhat.com>
      24b8be89
  16. 29 9月, 2011 2 次提交
  17. 06 9月, 2011 1 次提交
    • P
      link-state: qemu: Add net intf modification to virUpdateDeviceFlags · e0a07bb1
      Peter Krempa 提交于
      This patch enables modifying network device configuration using the
      virUpdateDeviceFlags API method. Matching of devices is accomplished
      using MAC addresses.
      
      While updating live configuration of a running domain, the user is
      allowed only to change link state of the interface. Additional
      modifications may be added later. For now the code checks for
      unsupported changes and thereafter changes the link state, if
      applicable.
      
      When updating persistent configuration of guest's network interface the
      whole configuration (except for the MAC address) may be modified and
      is stored for the next startup.
      
      * src/qemu/qemu_driver.c   - Add dispatching of virUpdateDevice for
                                   network devices update (live/config)
      * src/qemu/qemu_hotplug.c  - add setting of initial link state on live
                                   device addition
                                 - add function to change network device
                                   configuration. By now it supports only
                                   changing of link state
      * src/qemu/qemu_hotplug.h  - Headers to above functions
      * src/qemu/qemu_process.c  - set link states before virtual machine
                                   start. Qemu does not support setting of
                                   this on the command line.
      e0a07bb1
  18. 05 9月, 2011 1 次提交
    • E
      snapshot: make it possible to audit external snapshot · c111517a
      Eric Blake 提交于
      Snapshots alter the set of disk image files opened by qemu, so
      they must be audited.  But they don't involve a full disk definition
      structure, just the new filename.  Make the next patch easier by
      refactoring the audit routines to just operate on file name.
      
      * src/conf/domain_audit.h (virDomainAuditDisk): Update prototype.
      * src/conf/domain_audit.c (virDomainAuditDisk): Act on strings,
      not definition structures.
      (virDomainAuditStart): Update caller.
      * src/qemu/qemu_hotplug.c (qemuDomainChangeEjectableMedia)
      (qemuDomainAttachPciDiskDevice, qemuDomainAttachSCSIDisk)
      (qemuDomainAttachUsbMassstorageDevice)
      (qemuDomainDetachPciDiskDevice, qemuDomainDetachDiskDevice):
      Likewise.
      c111517a
  19. 02 9月, 2011 3 次提交
  20. 17 8月, 2011 1 次提交
  21. 01 8月, 2011 1 次提交
    • E
      qemu: fix crash when mixing sync and async monitor jobs · 193cd0f3
      Eric Blake 提交于
      Currently, we attempt to run sync job and async job at the same time. It
      means that the monitor commands for two jobs can be run in any order.
      
      In the function qemuDomainObjEnterMonitorInternal():
          if (priv->job.active == QEMU_JOB_NONE && priv->job.asyncJob) {
              if (qemuDomainObjBeginNestedJob(driver, obj) < 0)
      We check whether the caller is an async job by priv->job.active and
      priv->job.asynJob. But when an async job is running, and a sync job is
      also running at the time of the check, then priv->job.active is not
      QEMU_JOB_NONE. So we cannot check whether the caller is an async job
      in the function qemuDomainObjEnterMonitorInternal(), and must instead
      put the burden on the caller to tell us when an async command wants
      to do a nested job.
      
      Once the burden is on the caller, then only async monitor enters need
      to worry about whether the VM is still running; for sync monitor enter,
      the internal return is always 0, so lots of ignore_value can be dropped.
      
      * src/qemu/THREADS.txt: Reflect new rules.
      * src/qemu/qemu_domain.h (qemuDomainObjEnterMonitorAsync): New
      prototype.
      * src/qemu/qemu_process.h (qemuProcessStartCPUs)
      (qemuProcessStopCPUs): Add parameter.
      * src/qemu/qemu_migration.h (qemuMigrationToFile): Likewise.
      (qemuMigrationWaitForCompletion): Make static.
      * src/qemu/qemu_domain.c (qemuDomainObjEnterMonitorInternal): Add
      parameter.
      (qemuDomainObjEnterMonitorAsync): New function.
      (qemuDomainObjEnterMonitor, qemuDomainObjEnterMonitorWithDriver):
      Update callers.
      * src/qemu/qemu_driver.c (qemuDomainSaveInternal)
      (qemudDomainCoreDump, doCoreDump, processWatchdogEvent)
      (qemudDomainSuspend, qemudDomainResume, qemuDomainSaveImageStartVM)
      (qemuDomainSnapshotCreateActive, qemuDomainRevertToSnapshot):
      Likewise.
      * src/qemu/qemu_process.c (qemuProcessStopCPUs)
      (qemuProcessFakeReboot, qemuProcessRecoverMigration)
      (qemuProcessRecoverJob, qemuProcessStart): Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationToFile)
      (qemuMigrationWaitForCompletion, qemuMigrationUpdateJobStatus)
      (qemuMigrationJobStart, qemuDomainMigrateGraphicsRelocate)
      (doNativeMigrate, doTunnelMigrate, qemuMigrationPerformJob)
      (qemuMigrationPerformPhase, qemuMigrationFinish)
      (qemuMigrationConfirm): Likewise.
      * src/qemu/qemu_hotplug.c: Drop unneeded ignore_value.
      193cd0f3
  22. 29 7月, 2011 2 次提交
    • L
      qemu: support type=network in domain graphics <listen> · 99e4b30b
      Laine Stump 提交于
      The domain XML now understands the <listen> subelement of its
      <graphics> element (including when listen type='network'), and the
      network driver has an internal API that will turn a network name into
      an IP address, so the final logical step is to put the glue into the
      qemu driver so that when it is starting up a domain, if it finds
      <listen type='network' network='xyz'/> in the XML, it will call the
      network driver to get an IPv4 address associated with network xyz, and
      tell qemu to listen for vnc (or spice) on that address rather than the
      default address (localhost).
      
      The motivation for this is that a large installation may want the
      guests' VNC servers listening on physical interfaces rather than
      localhost, so that users can connect directly from the outside; this
      requires sending qemu the appropriate IP address to listen on. But
      this address will of course be different for each host, and if a guest
      might be migrated around from one host to another, it's important that
      the guest's config not have any information embedded in it that is
      specific to one particular host. <listen type='network.../> can solve
      this problem in the following manner:
      
        1) on each host, define a libvirt network of the same name,
           associated with the interface on that host that should be used
           for listening (for example, a simple macvtap network: <forward
           mode='bridge' dev='eth0'/>, or host bridge network: <forward
           mode='bridge'/> <bridge name='br0'/>
      
        2) in the <graphics> element of each guest's domain xml, tell vnc to
           listen on the network name used in step 1:
      
           <graphics type='vnc' port='5922'>
             <listen type='network'network='example-net'/>
           </graphics>
      
      (all the above also applies for graphics type='spice').
      99e4b30b
    • L
      conf: add <listen> subelement to domain <graphics> element · ef79fb5b
      Laine Stump 提交于
      Once it's plugged in, the <listen> element will be an optional
      replacement for the "listen" attribute that graphics elements already
      have. If the <listen> element is type='address', it will have an
      attribute called 'address' which will contain an IP address or dns
      name that the guest's display server should listen on. If, however,
      type='network', the <listen> element should have an attribute called
      'network' that will be set to the name of a network configuration to
      get the IP address from.
      
      * docs/schemas/domain.rng: updated to allow the <listen> element
      
      * docs/formatdomain.html.in: document the <listen> element and its
        attributes.
      
      * src/conf/domain_conf.[hc]:
      
        1) The domain parser, formatter, and data structure are modified to
           support 0 or more <listen> subelements to each <graphics>
           element. The old style "legacy" listen attribute is also still
           accepted, and will be stored internally just as if it were a
           separate <listen> element. On output (i.e. format), the address
           attribute of the first <listen> element of type 'address' will be
           duplicated in the legacy "listen" attribute of the <graphic>
           element.
      
        2) The "listenAddr" attribute has been removed from the unions in
           virDomainGRaphicsDef for graphics types vnc, rdp, and spice.
           This attribute is now in the <listen> subelement (aka
           virDomainGraphicsListenDef)
      
        3) Helper functions were written to provide simple access
           (both Get and Set) to the listen elements and their attributes.
      
      * src/libvirt_private.syms: export the listen helper functions
      
      * src/qemu/qemu_command.c, src/qemu/qemu_hotplug.c,
        src/qemu/qemu_migration.c, src/vbox/vbox_tmpl.c,
        src/vmx/vmx.c, src/xenxs/xen_sxpr.c, src/xenxs/xen_xm.c
      
        Modify all these files to use the listen helper functions rather
        than directly referencing the (now missing) listenAddr
        attribute. There can be multiple <listen> elements to a single
        <graphics>, but the drivers all currently only support one, so all
        replacements of direct access with a helper function indicate index
        "0".
      
      * tests/* - only 3 of these are new files added explicitly to test the
        new <listen> element. All the others have been modified to reflect
        the fact that any legacy "listen" attributes passed in to the domain
        parse will be saved in a <listen> element (i.e. one of the
        virDomainGraphicsListenDefs), and during the domain format function,
        both the <listen> element as well as the legacy attributes will be
        output.
      ef79fb5b
  23. 22 7月, 2011 4 次提交
    • L
      network: internal API functions to manage assignment of physdev to guest · 04711a0f
      Laine Stump 提交于
      The network driver needs to assign physical devices for use by modes
      that use macvtap, keeping track of which physical devices are in use
      (and how many instances, when the devices can be shared). Three calls
      are added:
      
      networkAllocateActualDevice - finds a physical device for use by the
      domain, and sets up the virDomainActualNetDef accordingly.
      
      networkNotifyActualDevice - assumes that the domain was already
      running, but libvirtd was restarted, and needs to be notified by each
      already-running domain about what interfaces they are using.
      
      networkReleaseActualDevice - decrements the usage count of the
      allocated physical device, and frees the virDomainActualNetDef to
      avoid later accidentally using the device.
      
      bridge_driver.[hc] - the new APIs. When WITH_NETWORK is false, these
      functions are all #defined to be "0" in the .h file (effectively
      becoming a NOP) to prevent link errors.
      
      qemu_(command|driver|hotplug|process).c - add calls to the above APIs
          in the appropriate places.
      
      tests/Makefile.am - we need to include libvirt_driver_network.la
          whenever libvirt_driver_qemu.la is linked, to avoid unreferenced
          symbols (in functions that are never called by the test
          programs...)
      04711a0f
    • L
      qemu: use virDomainNetGetActual*() functions where appropriate · 03caa988
      Laine Stump 提交于
      The qemu driver accesses fields in the virDomainNetDef directly, but
      with the advent of the virDomainActualNetDef, some pieces of
      information may be found in a different place (the ActualNetDef) if
      the network connection is of type='network' and that network is of
      forward type='bridge|private|vepa|passthrough'. The previous patch
      added functions to mask this difference from callers - they hide the
      decision making process and just pick the value from the proper place.
      
      This patch uses those functions in the qemu driver as a first step in
      making qemu work with the new network types. At this point, the
      virDomainActualNetDef is guaranteed always NULL, so the GetActualX()
      function will return exactly what the def->X that's being replaced
      would have returned (ie bisecting is not compromised).
      
      There is one place (in qemu_driver.c) where the internal details of
      the NetDef are directly manipulated by the code, so the GetActual
      functions cannot be used there without extra additional code; that
      file will be treated in a separate patch.
      03caa988
    • L
      conf: virDomainNetDef points to (rather than contains) virtPortProfile · 524655ee
      Laine Stump 提交于
      The virtPortProfile in the domain interface struct is now a separately
      allocated object *pointed to by* (rather than contained in) the main
      virDomainNetDef object. This is done to make it easier to figure out
      when a virtualPortProfile has/hasn't been specified in a particular
      config.
      524655ee
    • E
      build: rename files.h to virfile.h · 8e22e089
      Eric Blake 提交于
      In preparation for a future patch adding new virFile APIs.
      
      * src/util/files.h, src/util/files.c: Move...
      * src/util/virfile.h, src/util/virfile.c: ...here, and rename
      functions to virFile prefix.  Macro names are intentionally
      left alone.
      * *.c: All '#include "files.h"' uses changed.
      * src/Makefile.am (UTIL_SOURCES): Reflect rename.
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_close): Likewise.
      * src/libvirt_private.syms: Likewise.
      * docs/hacking.html.in: Likewise.
      * HACKING: Regenerate.
      8e22e089
  24. 13 7月, 2011 4 次提交
    • J
      qemu: Fix monitor unlocking in some error paths · a23476f0
      Jiri Denemark 提交于
      When monitor is entered with qemuDomainObjEnterMonitorWithDriver, the
      correct method for leaving and unlocking the monitor is
      qemuDomainObjExitMonitorWithDriver.
      a23476f0
    • J
      qemu: Save job type in domain status XML · ff340a84
      Jiri Denemark 提交于
      If libvirtd is restarted when a job is running, the new libvirtd process
      needs to know about that to be able to recover and rollback the
      operation.
      ff340a84
    • J
      qemu: Allow all query commands to be run during long jobs · 36184288
      Jiri Denemark 提交于
      Query commands are safe to be called during long running jobs (such as
      migration). This patch makes them all work without the need to
      special-case every single one of them.
      
      The patch introduces new job.asyncCond condition and associated
      job.asyncJob which are dedicated to asynchronous (from qemu monitor
      point of view) jobs that can take arbitrarily long time to finish while
      qemu monitor is still usable for other commands.
      
      The existing job.active (and job.cond condition) is used all other
      synchronous jobs (including the commands run during async job).
      
      Locking schema is changed to use these two conditions. While asyncJob is
      active, only allowed set of synchronous jobs is allowed (the set can be
      different according to a particular asyncJob) so any method that
      communicates to qemu monitor needs to check if it is allowed to be
      executed during current asyncJob (if any). Once the check passes, the
      method needs to normally acquire job.cond to ensure no other command is
      running. Since domain object lock is released during that time, asyncJob
      could have been started in the meantime so the method needs to recheck
      the first condition. Then, normal jobs set job.active and asynchronous
      jobs set job.asyncJob and optionally change the list of allowed job
      groups.
      
      Since asynchronous jobs only set job.asyncJob, other allowed commands
      can still be run when domain object is unlocked (when communicating to
      remote libvirtd or sleeping). To protect its own internal synchronous
      commands, the asynchronous job needs to start a special nested job
      before entering qemu monitor. The nested job doesn't check asyncJob, it
      only acquires job.cond and sets job.active to block other jobs.
      36184288
    • D
      Move qemu_audit.h helpers into shared code · b43070eb
      Daniel P. Berrange 提交于
      The LXC and UML drivers can both make use of auditing. Move
      the qemu_audit.{c,h} files to src/conf/domain_audit.{c,h}
      
      * src/conf/domain_audit.c: Rename from src/qemu/qemu_audit.c
      * src/conf/domain_audit.h: Rename from src/qemu/qemu_audit.h
      * src/Makefile.am: Remove qemu_audit.{c,h}, add domain_audit.{c,h}
      * src/qemu/qemu_audit.h, src/qemu/qemu_cgroup.c,
        src/qemu/qemu_command.c, src/qemu/qemu_driver.c,
        src/qemu/qemu_hotplug.c, src/qemu/qemu_migration.c,
        src/qemu/qemu_process.c: Update for changed audit API names
      b43070eb
  25. 08 7月, 2011 1 次提交
  26. 21 6月, 2011 1 次提交
    • D
      set and restore MAC address of a NIC when using PASSTHROUGH mode · cbd8227e
      Dirk Herrendoerfer 提交于
      The following patch addresses the problem that when a PASSTHROUGH
      mode DIRECT NIC connection is made the MAC address of the NIC is
      not automatically set and reset to the configured VM MAC and
      back again.
      
      The attached patch fixes this problem by setting and resetting the MAC
      while remembering the previous setting while the VM is running.
      This also works if libvirtd is restarted while the VM is running.
      
      the patch passes make syntax-check
      cbd8227e
  27. 15 6月, 2011 1 次提交
    • J
      qemu: Translate boot config into bootindex if possible · c3068d4d
      Jiri Denemark 提交于
      Prefer bootindex=N option for -device over the old way -boot ORDER
      possibly accompanied with boot=on option for -drive. This gives us full
      control over which device will actually be used for booting guest OS.
      Moreover, if qemu doesn't support boot=on, this is the only way to boot
      of certain disks in some configurations (such as virtio disks when used
      together IDE disks) without transforming domain XML to use per device
      boot elements.
      c3068d4d
  28. 13 6月, 2011 1 次提交