1. 29 1月, 2013 1 次提交
  2. 26 1月, 2013 1 次提交
    • E
      conf: avoid NULL deref for pmsuspended domain state · e0642059
      Eric Blake 提交于
      While working with a pmsuspend vs. snapshot issue, I noticed that
      the state file in /var/run/libvirt/qemu/dom.xml contained a rather
      suspicious "(null)" string, which does not round-trip well through
      a libvirtd restart.  Had I been on a platform other than glibc
      where printf("%s",NULL) crashes instead of printing (null), we might
      have noticed the problem much sooner.
      
      And in fixing that problem, I also noticed that we had several
      missing states, because we were #defining several *_LAST names
      to a value _different_ than what they were already given as enums
      in libvirt.h.  Yuck.  I got rid of default: labels in the case
      statements, because they get in the way of gcc's -Wswitch helping
      us ensure we cover all enum values.
      
      * src/conf/domain_conf.c (virDomainStateReasonToString)
      (virDomainStateReasonFromString): Fill in missing domain states;
      rewrite case statement to let compiler enforce checking.
      (VIR_DOMAIN_NOSTATE_LAST, VIR_DOMAIN_RUNNING_LAST)
      (VIR_DOMAIN_BLOCKED_LAST, VIR_DOMAIN_PAUSED_LAST)
      (VIR_DOMAIN_SHUTDOWN_LAST, VIR_DOMAIN_SHUTOFF_LAST)
      (VIR_DOMAIN_CRASHED_LAST): Drop dead defines.
      (VIR_DOMAIN_PMSUSPENDED_LAST): Drop dead define.
      (virDomainPMSuspendedReason): Add missing enum function.
      (virDomainRunningReason, virDomainPausedReason): Add missing enum
      value.
      * src/conf/domain_conf.h (virDomainPMSuspendedReason): Declare
      missing functions.
      * src/libvirt_private.syms (domain_conf.h): Export them.
      e0642059
  3. 24 1月, 2013 1 次提交
    • V
      S390: Enhance memballoon handling for virtio-s390 · 053e813a
      Viktor Mihajlovski 提交于
      The way in that memory balloon suppression was handled for S390
      is flawed for a number or reasons.
      1. Just preventing the default balloon to be created in the case
         of VIR_ARCH_S390[X] is not sufficient. An explicit memballoon
         element in the guest definition will still be honored, resulting
         both in a -balloon option and the allocation of a PCI bus address,
         neither being supported.
      2. Prohibiting balloon for S390 altogether at a domain_conf level
         is no good solution either as there's work in progress on the QEMU
         side to implement a virtio-balloon device, although in
         conjunction with a new machine type. Suppressing the balloon
         should therefore be done at the QEMU driver level depending
         on the present capabilities.
      
      Therefore we remove the conditional suppression of the default
      balloon in domain_conf.c.
      Further, we are claiming the memballoon device for virtio-s390
      during device address assignment to prevent it from being considered
      as a PCI device.
      Finally, we suppress the generation of the balloon command line option
      if this is a virtio-s390 machine.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      053e813a
  4. 23 1月, 2013 3 次提交
    • A
      qemu: Support ram bar size for qxl devices · 55bfd020
      Alon Levy 提交于
      Adds a "ram" attribute globally to the video.model element, that changes
      the resulting qemu command line only if video.type == "qxl".
      
      <video>
        <model type='qxl' ram='65536' vram='65536' heads='1'/>
      </video>
      
      That attribute gets a default value of 64*1024. The schema is unchanged
      for other video element types.
      
      The resulting qemu command line change is the addition of
      
      -global qxl-vga.ram_size=<ram>*1024
      
      or
      
      -global qxl.ram_size=<ram>*1024
      
      For the main and secondary qxl devices respectively.
      
      The default for the qxl ram bar is 64*1024 kilobytes (the same as the
      default qxl vram bar size).
      55bfd020
    • P
      23b9502b
    • P
      conf: Check if number of vCPUs fits in the storage variable · c58e1f4d
      Peter Krempa 提交于
      The count of vCPUs for a domain is extracted as a usingned long variable
      but is stored in a unsigned short. If the actual number was too large,
      a faulty number was stored.
      c58e1f4d
  5. 22 1月, 2013 1 次提交
    • J
      selinux: Resolve resource leak using the default disk label · 05cc0351
      John Ferlan 提交于
      Commit id a994ef2d changed the mechanism to store/update the default
      security label from using disk->seclabels[0] to allocating one on the
      fly. That change allocated the label, but never saved it.  This patch
      will save the label. The new virDomainDiskDefAddSecurityLabelDef() is
      a copy of the virDomainDefAddSecurityLabelDef().
      05cc0351
  6. 18 1月, 2013 1 次提交
    • L
      conf: don't fail to parse <boot> when parsing a single device · 877dab6c
      Laine Stump 提交于
      This resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=895294
      
      The symptom was that attempts to modify a network device using
      virDomainUpdateDeviceFlags() would fail if the original device had a
      <boot> element (e.g. "<boot order='1'/>"), even if the updated device
      had the same <boot> element. Instead, the following error would be logged:
      
        cannot modify network device boot index setting
      
      It's true that it's not possible to change boot order (internally
      known as bootIndex) of a live device; qemuDomainChangeNet checks for
      that, but the problem was that the information it was checking was
      incorrect.
      
      Explanation:
      
      When a complete domain is parsed, a global (to the domain) "bootMap"
      is passed down to the parse for each device; the bootMap is used to
      make sure that devices don't have conflicting settings for their boot
      orders.
      
      When a single device is parsed by itself (as in the case of
      virDomainUpdateDeviceFlags), there is no global bootMap that would be
      appropriate to send, so NULL is sent instead. However, although the
      lowest level function that parses just the boot order *does* simply
      skip the sanity check in that case, the next higher level
      "virDomainDeviceInfoParseXML" function refuses to call down to the
      lower "virDomainDeviceBootParseXML" if bootMap is NULL. So, the boot
      order is never set in the "new" device object, and when it is compared
      to the original (which does have a boot order), they don't match.
      
      The fix is to patch virDomainDeviceInfoParseXML to not care about
      bootMap, and just always call virDomainDeviceInfoBootParseXML whenever
      there is a <boot> element. When we are only parsing a single device,
      we don't care whether or not any specified boot order is consistent
      with the rest of the domain; we will always do this check later (in
      the current case, we do it by verifying that the net bootIndex exactly
      matches the old bootIndex).
      877dab6c
  7. 17 1月, 2013 2 次提交
    • G
      Fix typo in variable name · 5c1a8251
      Guido Günther 提交于
      that broke the build like:
      
        CC     libvirt_conf_la-domain_conf.lo
        conf/domain_conf.c: In function 'virDomainVcpuPinAdd':
        conf/domain_conf.c:11920:29: error: 'vpcupin' undeclared (first use in this function)
        conf/domain_conf.c:11920:29: note: each undeclared identifier is reported only once for each function it appears in
        make[3]: *** [libvirt_conf_la-domain_conf.lo] Error 1
      5c1a8251
    • J
      conf: fix leak in virDomainVcpuPinAdd · 65aa3e34
      Ján Tomko 提交于
      Fix the leak of vcpupin on failure to allocate cpumask and the leak of
      cpumask if we fail to expand vcpupin_list.
      65aa3e34
  8. 16 1月, 2013 2 次提交
  9. 10 1月, 2013 2 次提交
    • G
      network: fix typos and docs · 29d37818
      Guannan Ren 提交于
      29d37818
    • G
      qemu: add usb-serial support · e3a04455
      Guannan Ren 提交于
      Add an optional 'type' attribute to <target> element of serial port
      device. There are two choices for its value, 'isa-serial' and
      'usb-serial'. For backward compatibility, when attribute 'type' is
      missing the 'isa-serial' will be chosen as before.
      
      Libvirt XML sample
      
          <serial type='pty'>
            <target type='usb-serial' port='0'/>
            <address type='usb' bus='0' port='1'/>
          </serial>
      
      qemu commandline:
      
      qemu ${other_vm_args}              \
          -chardev pty,id=charserial0    \
          -device usb-serial,chardev=charserial0,id=serial0,bus=usb.0,port=1
      e3a04455
  10. 08 1月, 2013 1 次提交
  11. 07 1月, 2013 1 次提交
    • O
      conf: Parse and format the new XML · 535aed56
      Osier Yang 提交于
      Like "rawio", "sgio" is only allowed for block disk of device
      type "lun".
      
      It doesn't default disk->sgio to "filtered" when parsing, as
      it won't be able to distinguish explicitly requested "filtered"
      and a default "filtered" in driver then. We have to error out for
      explicit request when the kernel doesn't support the new sysfs
      knob "unpriv_sgio", however, for defaulted "filtered", we can
      just ignore it if the kernel doesn't support "unpriv_sgio".
      535aed56
  12. 21 12月, 2012 10 次提交
  13. 19 12月, 2012 4 次提交
    • D
      Fix parsing of arch from domain XML · 1c212145
      Daniel P. Berrange 提交于
      When parsing the arch from domain XML, the result was only
      saved to a local variable, not the virDomainDefPtr
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1c212145
    • M
      conf: eliminate redundant use of VIR_ALLOC · b12a9cde
      Martin Kletzander 提交于
      We can use VIR_REALLOC_N with NULL pointer, which behaves the same way
      as VIR_ALLOC_N in that case, so no need for a condition that's
      checking if some data are allocated already.
      
      ---
      
      I tried to find other parts of the code similar to this, so I can do a
      full cleanup for the whole repository, so I used this (excuse the long
      line, but that's how I was writing it):
      
      git grep -nHC 5 -e VIR_REALLOC_N -e VIR_ALLOC_N | while read line; do if [[ "$line" == "--" ]]; then if [[ ${#tmpbuf} -gt 10 && "$REALLOC_N" == "true" && "$ALLOC_N" == "true" ]]; then echo $line; while [[ ${#tmpbuf[*]} -gt 0 ]]; do echo "${tmpbuf[0]}"; tmpbuf=( "${tmpbuf[@]:1:${#tmpbuf[*]}}" ); done; fi; unset tmpbuf REALLOC_N ALLOC_N; else if [[ "$ALLOC_N" != "true" && "${line/VIR_ALLOC_N//}" != "${line}" ]]; then ALLOC_N="true"; fi; if [[ "$REALLOC_N" != "true" && "${line/VIR_REALLOC_N//}" != "${line}" ]]; then REALLOC_N="true"; fi; tmpbuf[${#tmpbuf[*]}]="$line"; fi; done | less
      
      And reviewed the output just to find out this was the only occurrence of
      the inconsistency.
      b12a9cde
    • M
      conf: minor indentation cleanups · 7affb25b
      Martin Kletzander 提交于
      On few places there are too many levels of indentation when some of
      them can be fixed with negating the option they are in or omitting
      useless condition altogether.
      7affb25b
    • D
      Convert capabilities / domain_conf to use virArch · c25c18f7
      Daniel P. Berrange 提交于
      Convert the host capabilities and domain config structs to
      use the virArch datatype. Update the parsers and all drivers
      to take account of datatype change
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      c25c18f7
  14. 18 12月, 2012 1 次提交
    • D
      Add support for <hostdev mode="capabilities"> · aae0fc2a
      Daniel P. Berrange 提交于
      The <hostdev> device type has long had a redundant "mode"
      attribute, which has always been "subsys". This finally
      introduces a new mode "capabilities", which will be used
      by the LXC driver for device assignment. Since container
      based virtualization uses a single kernel, the idea of
      assigning physical PCI devices doesn't make sense. It is
      still reasonable to assign USB devices, but for assigning
      arbitrary nodes in /dev, the new 'capabilities' mode is
      to be used.
      
      The first capability support is 'storage', which is for
      assignment of block devices. Functionally this is really
      pretty similar to the <disk> support. The only difference
      is the device node name is identical in both host and
      container namespaces.
      
          <hostdev mode='capabilities' type='storage'>
            <source>
              <block>/dev/sdf1</block>
            </source>
          </hostdev>
      
      The second capability support is 'misc', which is for
      assignment of character devices. There is no existing
      parallel to this. Again the device node is the same
      inside & outside the container.
      
          <hostdev mode='capabilities' type='misc'>
            <source>
              <char>/dev/input/event3</char>
            </source>
          </hostdev>
      
      The reason for keeping the char & storage devices
      separate in the domain XML, is to mirror the split
      in the node device XML. NB the node device XML does
      not yet report character devices, but that's another
      new patch to come
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      aae0fc2a
  15. 17 12月, 2012 1 次提交
    • G
      conf: add optional attribte primary to video <model> element · 09938bb3
      Guannan Ren 提交于
      If there are multiple video devices
      primary = 'yes' marks this video device as the primary one.
      The rest are secondary video devices. No more than one could be
      mark as primary. If none of them has primary attribute, the first
      one will be the primary by default like what it was.
      The reason of this changing is that for qemu, only one primary video
      device is permitted which can be of any type. For secondary video
      devices, only qxl is allowd. Primary attribute removes the restriction
      that the first have to be the primary one.
      
      We always put the primary video device into the first position of
      video device structure array after parsing.
      09938bb3
  16. 12 12月, 2012 4 次提交
    • D
      Refactor virDomainHostdevFind method · 9cdd9ea2
      Daniel P. Berrange 提交于
      Move the code for matching hostdev instances out of virDomainHostdevFind
      and into virDomainHostdevMatch method, which in turn calls out to other
      helper methods depending on the type of hostdev.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      9cdd9ea2
    • D
      Slightly refactor hostdev parsing / formating · 50897ffb
      Daniel P. Berrange 提交于
      Rename virDomainHostdevPartsParse to virDomainHostdevDefParseSubsys
      to reflect the fact that it only deals with hostdevs uing the
      traditional mode=subsystem, and not mode=capabilities
      
      Rename virDomainHostSourceFormat to virDomainHostdevDefFormatSubsys
      for the same reason.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      50897ffb
    • M
      domain: Keep assigned class_id in domstatus XML · c2fbb3c6
      Michal Privoznik 提交于
      Interfaces keeps a class_id, which is an ID from which bridge
      part of QoS settings is derived. We need to store class_id
      in domain status file, so we can later pass it to
      virNetDevBandwidthUnplug.
      c2fbb3c6
    • M
      bandwidth: add new 'floor' attribute · ec6474b2
      Michal Privoznik 提交于
      This is however supported only on domain interfaces with
      type='network'. Moreover, target network needs to have at least
      inbound QoS set. This is required by hierarchical traffic shaping.
      
      From now on, the required attribute for <inbound/> is either 'average'
      (old) or 'floor' (new). This new attribute can be used just for
      interfaces type of network (<interface type='network'/>) currently.
      ec6474b2
  17. 07 12月, 2012 1 次提交
  18. 04 12月, 2012 1 次提交
    • L
      conf: fix virDomainNetGetActualDirect*() and BridgeName() · 3738cf41
      Laine Stump 提交于
      This resolves:
      
         https://bugzilla.redhat.com/show_bug.cgi?id=881480
      
      These three functions:
      
        virDomainNetGetActualBridgeName
        virDomainNetGetActualDirectDev
        virDomainNetGetActualDirectMode
      
      return attributes that are in a union whose contents are interpreted
      differently depending on the actual->type and so they should only
      return non-0 when actual->type is 'bridge' (in the first case) or
      'direct' (in the other two cases, but I had neglected to do that, so
      ...DirectDev() was returning bridge.brname (which happens to share the
      same spot in the union with direct.linkdev) if actual->type was
      'bridge', and ...BridgeName was returning direct.linkdev when
      actual->type was 'direct'.
      
      How does this involve Bug 881480 (which was about the inability to
      switch between two networks that both have "<forward mode='bridge'/>
      <bridge name='xxx'/>"? Whenever the return value of
      virDomainNetGetActualDirectDev() for the new and old network
      definitions doesn't match, qemuDomainChangeNet() requires a "complete
      reconnect" of the device, which qemu currently doesn't
      support. ...DirectDev() *should* have been returning NULL for old and
      new, but was instead returning the old and new bridge names, which
      differ.
      
      (The other two functions weren't causing any behavioral problems in
      virDomainChangeNet(), but their problem and fix was identical, so I
      included them in this same patch).
      3738cf41
  19. 29 11月, 2012 1 次提交
  20. 27 11月, 2012 1 次提交
    • H
      Add Gluster protocol as supported network disk backend · a2d2b80f
      Harsh Prateek Bora 提交于
      This patch introduces the RNG schema and updates necessary data strucutures
      to allow various hypervisors to make use of Gluster protocol as one of the
      supported network disk backend. Next patch will add support to make use of
      this feature in Qemu since it now supports Gluster protocol as one of the
      network based storage backend.
      
      Two new optional attributes for <host> element are introduced - 'transport'
      and 'socket'. Valid transport values are tcp, unix or rdma. If none specified,
      tcp is assumed. If transport is unix, socket specifies path to unix socket.
      
      This patch allows users to specify disks on gluster backends like this:
      
          <disk type='network' device='disk'>
            <driver name='qemu' type='raw'/>
            <source protocol='gluster' name='Volume1/image'>
              <host name='example.org' port='6000' transport='tcp'/>
            </source>
            <target dev='vda' bus='virtio'/>
          </disk>
      
          <disk type='network' device='disk'>
            <driver name='qemu' type='raw'/>
            <source protocol='gluster' name='Volume2/image'>
              <host transport='unix' socket='/path/to/sock'/>
            </source>
            <target dev='vdb' bus='virtio'/>
          </disk>
      Signed-off-by: NHarsh Prateek Bora <harsh@linux.vnet.ibm.com>
      a2d2b80f