1. 13 9月, 2012 2 次提交
    • G
      qemu: define and parse USB redirection filter XML · 5b35cc53
      Guannan Ren 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=795929
      http://git.qemu.org/?p=qemu.git;a=commitdiff;h=6af165892cf900291046f1d25f95416f379504c2
      
      This patch define and parse the input XML of USB redirection filter.
      <devices>
      ...
        <redirdev bus='usb' type='spicevmc'>
          <address type='usb' bus='0' port='4'/>
        </redirdev>
        <redirfilter>
          <usbdev class='0x08' vendor='0x1234' product='0xbeef' \
                  version='2.00' allow='yes'/>
          <usbdev allow='no'/>
        </redirfilter>
      ...
      </devices>
      
      There is no 1:1 mapping between ports and redirected devices and
      qemu and spicy client couldn't decide into which usbredir ports
      the client can 'plug' redirected devices. So it make sense to apply
      all of filter rules global to all existing usb redirection devices.
      class attribute is USB Class codes. version is bcdDevice value
      of USB device. vendor and product is USB vendorId and productId.
      -1 can be used to allow any value for a field. Except allow attribute
      the other four are optional, default value is -1.
      5b35cc53
    • E
      maint: fix missing spaces in message · 2387aa26
      Eric Blake 提交于
      I got an off-list report about a bad diagnostic:
      Target network card mac 52:54:00:49:07:ccdoes not match source 52:54:00:49:07:b8
      
      True to form, I've added a syntax check rule to prevent it
      from recurring, and found several other offenders.
      
      * cfg.mk (sc_require_whitespace_in_translation): New rule.
      * src/conf/domain_conf.c (virDomainNetDefCheckABIStability): Add
      space.
      * src/esx/esx_util.c (esxUtil_ParseUri): Likewise.
      * src/qemu/qemu_command.c (qemuCollectPCIAddress): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainSetMetadata)
      (qemuDomainGetMetadata): Likewise.
      * src/qemu/qemu_hotplug.c (qemuDomainChangeNetBridge): Likewise.
      * src/rpc/virnettlscontext.c
      (virNetTLSContextCheckCertDNWhitelist): Likewise.
      * src/vmware/vmware_driver.c (vmwareDomainResume): Likewise.
      * src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc, vboxAttachDrives):
      Avoid false negatives.
      * tools/virsh-domain.c (info_save_image_dumpxml): Reword.
      Based on a report by Luwen Su.
      2387aa26
  2. 12 9月, 2012 1 次提交
    • L
      Backcompt for console devices in virDomainDeviceInfoIterate · babe7dad
      Li Zhang 提交于
      Historically, the first <console> element is treated as the
      alias of a <serial> device. In the virDomainDeviceInfoIterate,
      This situation is not considered. It still handles the first <console>
      element as another devices, which means that for console[0] with
      serial targetType, it calls callback function another time.
      It will cause the problem of address conflicts when assigning
      spapr-vio address for serial device on pSeries guest.
      
      For pSeries guest, the serial configuration in the xml file
      is as the following:
               <serial type='pty'>
                     <target port='0'/>
                     <address type='spapr-vio'/>
                </serial>
      
      Console configuration is default, the dumped xml file is as the following:
         <serial type='pty'>
            <source path='/dev/pts/5'/>
            <target port='0'/>
            <alias name='serial0'/>
            <address type='spapr-vio' reg='0x30000000'/>
          </serial>
          <console type='pty' tty='/dev/pts/5'>
            <source path='/dev/pts/5'/>
            <target type='serial' port='0'/>
            <alias name='serial0'/>
            <address type='spapr-vio' reg='0x30000000'/>
          </console>
      
      It shows that the <console> device is the alias of serial device.
      So its address is the same as the serial device. When detecting
      the conflicts in the qemuAssignSpaprVIOAddress the first console
      and the serial device conflicts because virDomainDeviceInfoIterate()
      still handle these as two different devices, and in the qemuAssignSpaprVIOAddress(),
      it will compare these two devices' addressed. If they have same address,
      it will report address conflict error.
      
      So this patch is to handle the first console which targetType is serial
      as the alias of serial device to avoid address conflicts error reported.
      Signed-off-by: NLi Zhang <zhlcindy@linux.vnet.ibm.com>
      babe7dad
  3. 11 9月, 2012 1 次提交
    • O
      list: Add helpers to list network objects · d3c6cabb
      Osier Yang 提交于
      src/conf/network_conf.c: Add virNetworkMatch to filter the networks;
      and virNetworkList to iterate over all the networks with the filter.
      
      src/conf/network_conf.h: Declare virNetworkList and define the macros
      for filters.
      
      src/libvirt_private.syms: Export virNetworkList.
      d3c6cabb
  4. 07 9月, 2012 1 次提交
    • C
      events: Fix domain event race on client disconnect · defa8b85
      Christophe Fergeau 提交于
      GNOME Boxes sometimes stops getting domain events from libvirtd, even
      after restarting it. Further investigation in libvirtd shows that
      events are properly queued with virDomainEventStateQueue, but the
      timer virDomainEventTimer which flushes the events and sends them to
      the clients never gets called. Looking at the event queue in gdb
      shows that it's non-empty and that its size increases with each new
      events.
      
      virDomainEventTimer is set up in virDomainEventStateRegister[ID]
      when going from 0 client connecte to 1 client connected, but is
      initially disabled. The timer is removed in
      virDomainEventStateRegister[ID] when the last client is disconnected
      (going from 1 client connected to 0).
      
      This timer (which handles sending the events to the clients) is
      enabled in virDomainEventStateQueue when queueing an event on an
      empty queue (queue containing 0 events). It's disabled in
      virDomainEventStateFlush after flushing the queue (ie removing all
      the elements from it). This way, no extra work is done when the queue
      is empty, and when the next event comes up, the timer will get
      reenabled because the queue will go from 0 event to 1 event, which
      triggers enabling the timer.
      
      However, with this Boxes bug, we have a client connected (Boxes), a
      non-empty queue (there are events waiting to be sent), but a disabled
      timer, so something went wrong.
      
      When Boxes connects (it's the only client connecting to the libvirtd
      instance I used for debugging), the event timer is not set as expected
      (state->timer == -1 when virDomainEventStateRegisterID is called),
      but at the same time the event queue is not empty. In other words,
      we had no clients connected, but pending events. This also explains
      why the timer never gets enabled as this is only done when an event
      is queued on an empty queue.
      
      I think this can happen if an event gets queued using
      virDomainEventStateQueue and the client disconnection happens before
      the event timer virDomainEventTimer gets a chance to run and flush
      the event. In this situation, virDomainEventStateDeregister[ID] will
      get called with a non-empty event queue, the timer will be destroyed
      if this was the only client connected. Then, when other clients connect
      at a later time, they will never get notified about domain events as
      the event timer will never get enabled because the timer is only
      enabled if the event queue is empty when virDomainEventStateRegister[ID]
      gets called, which will is no longer the case.
      
      To avoid this issue, this commit makes sure to remove all events from
      the event queue when the last client in unregistered. As there is
      no longer anyone interested in receiving these events, these events
      are stale so there is no need to keep them around. A client connecting
      later will have no interest in getting events that happened before it
      got connected.
      defa8b85
  5. 06 9月, 2012 1 次提交
    • O
      list: Add helpers for listing storage pool objects · 84208a4a
      Osier Yang 提交于
      src/conf/storage_conf.c: Add virStoragePoolMatch to filter the
      pools; Add virStoragePoolList to iterate over the pool objects
      with filter.
      
      src/conf/storage_conf.h: Declare virStoragePoolMatch,
      virStoragePoolList, and the macros for filters.
      
      src/libvirt_private.syms: Export helper virStoragePoolList.
      84208a4a
  6. 04 9月, 2012 1 次提交
    • V
      Rename iolimit to blockio. · 72f1f220
      Viktor Mihajlovski 提交于
      After discussion with DB we decided to rename the new iolimit
      element as it creates the impression it would be there to
      limit (i.e. throttle) I/O instead of specifying immutable
      characteristics of a block device.
      This is also backed by the fact that the term I/O Limits has
      vanished from newer storage admin documentation.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      72f1f220
  7. 03 9月, 2012 1 次提交
    • M
      Add per-guest S3/S4 state configuration · 09cd8f2d
      Martin Kletzander 提交于
      There is a new <pm/> element implemented that can control what ACPI
      sleeping states will be advertised by BIOS and allowed to be switched
      to by libvirt. The default keeps defaults on hypervisor, otherwise
      forces chosen setting.
      The documentation of the pm element is added as well.
      09cd8f2d
  8. 01 9月, 2012 1 次提交
  9. 31 8月, 2012 2 次提交
  10. 30 8月, 2012 2 次提交
    • P
      vcpupin: Fix returning of arrays from virDomainVcpuPinAdd · 077e7bf5
      Peter Krempa 提交于
      virDomainVcpuPinAdd does a realloc on vcpupin_list if the new vcpu pin
      definition doesn't fit into the array. The list is an array of pointers
      but the function definition didn't support returning the changed pointer
      to the caller if it was realloced. This caused segfaults if realloc
      would change the base pointer.
      077e7bf5
    • P
      qemu: Fix possible infinite loop and segfault on error path. · 40dfb525
      Peter Krempa 提交于
      virDomainVcpuPinDefCopy when the control flow reaches out of memory
      cleanup code, the flow would end in a infinite loop as the loop variable
      wasn't decremented.
      
      Also a dereference of NULL pointers was possible if allocation of the
      Vcpu pinning definiton structure failed.
      40dfb525
  11. 28 8月, 2012 1 次提交
  12. 27 8月, 2012 1 次提交
  13. 24 8月, 2012 4 次提交
    • E
      snapshot: rename an enum · 1385c9cd
      Eric Blake 提交于
      The name 'virDomainDiskSnapshot' didn't fit in with our normal
      conventions of using a prefix hinting that it is related to a
      virDomainSnapshotPtr.  Also, a future patch will reuse the
      enum for declaring where the VM memory is stored.
      
      * src/conf/snapshot_conf.h (virDomainDiskSnapshot): Rename...
      (virDomainSnapshotLocation): ...to this.
      (_virDomainSnapshotDiskDef): Update clients.
      * src/conf/domain_conf.h (_virDomainDiskDef): Likewise.
      * src/libvirt_private.syms (domain_conf.h): Likewise.
      * src/conf/domain_conf.c (virDomainDiskDefParseXML)
      (virDomainDiskDefFormat): Likewise.
      * src/conf/snapshot_conf.c: (virDomainSnapshotDiskDefParseXML)
      (virDomainSnapshotAlignDisks, virDomainSnapshotDefFormat):
      Likewise.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotDiskPrepare)
      (qemuDomainSnapshotCreateSingleDiskActive)
      (qemuDomainSnapshotCreateDiskActive, qemuDomainSnapshotCreateXML):
      Likewise.
      1385c9cd
    • E
      snapshot: split snapshot conf code into own file · 6478ec16
      Eric Blake 提交于
      This has several benefits:
      1. Future snapshot-related code has a definite place to go (and I
      _will_ be adding some)
      2. Snapshot errors now use the VIR_FROM_DOMAIN_SNAPSHOT error
      classification, which has been underutilized (previously only in
      libvirt.c)
      
      * src/conf/domain_conf.h, domain_conf.c: Split...
      * src/conf/snapshot_conf.h, snapshot_conf.c: ...into new files.
      * src/Makefile.am (DOMAIN_CONF_SOURCES): Build new files.
      * po/POTFILES.in: Mark new file for translation.
      * src/vbox/vbox_tmpl.c: Update caller.
      * src/esx/esx_driver.c: Likewise.
      * src/qemu/qemu_command.c: Likewise.
      * src/qemu/qemu_domain.h: Likewise.
      6478ec16
    • E
      snapshot: make virDomainSnapshotObjList opaque · 3211deba
      Eric Blake 提交于
      We were failing to react to allocation failure when initializing
      a snapshot object list.  Changing things to store a pointer
      instead of a complete object adds one more possible point of
      allocation failure, but at the same time, will make it easier to
      react to failure now, as well as making it easier for a future
      patch to split all virDomainSnapshotPtr handling into a separate
      file, as I continue to add even more snapshot code.
      
      Luckily, there was only one client outside of domain_conf.c that
      was actually peeking inside the object, and a new wrapper function
      was easy.
      
      * src/conf/domain_conf.h (_virDomainObj): Use a pointer.
      (virDomainSnapshotObjListInit): Rename.
      (virDomainSnapshotObjListFree, virDomainSnapshotForEach): New
      declarations.
      (_virDomainSnapshotObjList): Move definitions...
      * src/conf/domain_conf.c: ...here.
      (virDomainSnapshotObjListInit, virDomainSnapshotObjListDeinit):
      Rename...
      (virDomainSnapshotObjListNew, virDomainSnapshotObjListFree): ...to
      these.
      (virDomainSnapshotForEach): New function.
      (virDomainObjDispose, virDomainListPopulate): Adjust callers.
      * src/qemu/qemu_domain.c (qemuDomainSnapshotDiscard)
      (qemuDomainSnapshotDiscardAllMetadata): Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationIsAllowed): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotLoad)
      (qemuDomainUndefineFlags, qemuDomainSnapshotCreateXML)
      (qemuDomainSnapshotListNames, qemuDomainSnapshotNum)
      (qemuDomainListAllSnapshots)
      (qemuDomainSnapshotListChildrenNames)
      (qemuDomainSnapshotNumChildren)
      (qemuDomainSnapshotListAllChildren)
      (qemuDomainSnapshotLookupByName, qemuDomainSnapshotGetParent)
      (qemuDomainSnapshotGetXMLDesc, qemuDomainSnapshotIsCurrent)
      (qemuDomainSnapshotHasMetadata, qemuDomainRevertToSnapshot)
      (qemuDomainSnapshotDelete): Likewise.
      * src/libvirt_private.syms (domain_conf.h): Export new function.
      3211deba
    • M
      conf: Don't always require security/@model · 0ee655f5
      Michal Privoznik 提交于
      Only parse model, if static labelling, or
      a base label is set, or doing active XML.
      0ee655f5
  14. 23 8月, 2012 1 次提交
  15. 22 8月, 2012 9 次提交
  16. 21 8月, 2012 3 次提交
    • M
      qemu: Unify port-wise SPICE and VNC behavior · a14b4aea
      Martin Kletzander 提交于
      Port allocations for SPICE and VNC behave almost the same (with
      default ports), but there is some mess in the code. This patch clears
      these inconsistencies and makes sure the same behavior will be used
      when ports for remote displays are changed.
      
      Changes:
       - hard-coded number 5900 removed (handled elsewhere like with VNC)
       - reservedVNCPorts renamed to reservedRemotePorts (it's not just for
         VNC anymore)
       - QEMU_VNC_PORT_{MIN,MAX} renamed to QEMU_REMOTE_PORT_{MIN,MAX}
       - port allocation unified for VNC and SPICE
      a14b4aea
    • M
      Multiple security drivers in XML data · e9377dda
      Marcelo Cerri 提交于
      This patch updates the domain and capability XML parser and formatter to
      support more than one "seclabel" element for each domain and device. The
      RNG schema and the tests related to this are also updated by this patch.
      Signed-off-by: NMarcelo Cerri <mhcerri@linux.vnet.ibm.com>
      e9377dda
    • M
      Internal refactory of data structures · 6c3cf57d
      Marcelo Cerri 提交于
      This patch updates the structures that store information about each
      domain and each hypervisor to support multiple security labels and
      drivers. It also updates all the remaining code to use the new fields.
      Signed-off-by: NMarcelo Cerri <mhcerri@linux.vnet.ibm.com>
      6c3cf57d
  17. 18 8月, 2012 4 次提交
  18. 16 8月, 2012 1 次提交
    • L
      conf: add <vlan> element to network and domain interface elements · 3f9274a5
      Laine Stump 提交于
      The following config elements now support a <vlan> subelements:
      
      within a domain: <interface>, and the <actual> subelement of <interface>
      within a network: the toplevel, as well as any <portgroup>
      
      Each vlan element must have one or more <tag id='n'/> subelements.  If
      there is more than one tag, it is assumed that vlan trunking is being
      requested. If trunking is required with only a single tag, the
      attribute "trunk='yes'" should be added to the toplevel <vlan>
      element.
      
      Some examples:
      
        <interface type='hostdev'/>
          <vlan>
            <tag id='42'/>
          </vlan>
          <mac address='52:54:00:12:34:56'/>
          ...
        </interface>
      
        <network>
          <name>vlan-net</name>
          <vlan trunk='yes'>
            <tag id='30'/>
          </vlan>
          <virtualport type='openvswitch'/>
        </network>
      
        <interface type='network'/>
          <source network='vlan-net'/>
          ...
        </interface>
      
        <network>
          <name>trunk-vlan</name>
          <vlan>
            <tag id='42'/>
            <tag id='43'/>
          </vlan>
          ...
        </network>
      
        <network>
          <name>multi</name>
          ...
          <portgroup name='production'/>
            <vlan>
              <tag id='42'/>
            </vlan>
          </portgroup>
          <portgroup name='test'/>
            <vlan>
              <tag id='666'/>
            </vlan>
          </portgroup>
        </network>
      
        <interface type='network'/>
          <source network='multi' portgroup='test'/>
          ...
        </interface>
      
      IMPORTANT NOTE: As of this patch there is no backend support for the
      vlan element for *any* network device type. When support is added in
      later patches, it will only be for those select network types that
      support setting up a vlan on the host side, without the guest's
      involvement. (For example, it will be possible to configure a vlan for
      a guest connected to an openvswitch bridge, but it won't be possible
      to do that for one that is connected to a standard Linux host bridge.)
      3f9274a5
  19. 15 8月, 2012 3 次提交
    • L
      conf: log error when encountering multiple filterrefs in interface · 1f7a291c
      Laine Stump 提交于
      Each interface has a single pointer to a filterref object. That
      filterref can itself point to multiple other filterrefs, but at the
      toplevel there is only one.
      
      The parser had previously just silently overwritten earlier filterrefs
      when a new one was encountered, so the interface was left with
      whichever was the last filterref in the xml, ignoring all the
      others. This patch logs an error when it sees more than one filterref.
      1f7a291c
    • L
      network: add connections counter to networks · 300bcdb6
      Laine Stump 提交于
      Just as each physical device used by a network has a connections
      counter, now each network has a connections counter which is
      incremented once for each guest interface that connects using this
      network.
      
      The count is output in the live network XML, like this:
      
         <network connections='20'>
         ...
         </network>
      
      It is read-only, and for informational purposes only - it isn't used
      internally anywhere by libvirt.
      300bcdb6
    • L
      conf: output forward device connections count in network XML · 92a83040
      Laine Stump 提交于
      It may be useful for management applications to know which physical
      network devices are in use by guests. This information is already
      available in the network objects, but wasn't output in the XML. This
      patch outputs it when the INACTIVE flag isn't set (and if it's non-0).
      92a83040