1. 04 3月, 2015 5 次提交
  2. 03 3月, 2015 2 次提交
    • M
      conf: De-duplicate scheduling policy enums · 2fd5880b
      Martin Kletzander 提交于
      Since adding the support for scheduler policy settings in commit
      8680ea97, there are two enums with the same information.  That was
      caused by rewriting the patch since first draft.
      
      Find out thanks to clang, but there was no impact whatsoever.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      2fd5880b
    • J
      disk: Disallow duplicated target 'dev' values · e0e29055
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1142631
      
      This patch resolves a situation where the same "<target dev='$name'...>"
      can be used for multiple disks in the domain.
      
      While the $name is "mostly" advisory regarding the expected order that
      the disk is added to the domain and not guaranteed to map to the device
      name in the guest OS, it still should be unique enough such that other
      domblk* type operations can be performed.
      
      Without the patch, the domblklist will list the same Target twice:
      
      $ virsh domblklist $dom
      Target     Source
      ------------------------------------------------
      sda        /var/lib/libvirt/images/file.qcow2
      sda        /var/lib/libvirt/images/file.img
      
      Additionally, getting domblkstat, domblkerror, domblkinfo, and other block*
      type calls will not be able to reference the second target.
      
      Fortunately, hotplug disallows adding a "third" sda value:
      
      $ qemu-img create -f raw /var/lib/libvirt/images/file2.img 10M
      $ virsh attach-disk $dom /var/lib/libvirt/images/file2.img sda
      error: Failed to attach disk
      error: operation failed: target sda already exists
      
      $
      
      BUT, it since 'sdb' doesn't exist one would get the following on the same
      hotplug attempt, but changing to use 'sdb' instead of 'sda'
      
      $ virsh attach-disk $dom /var/lib/libvirt/images/file2.img sdb
      error: Failed to attach disk
      error: internal error: unable to execute QEMU command 'device_add': Duplicate ID 'scsi0-0-1' for device
      
      $
      
      Since we cannot fix this issue at parsing time, the best that can be done so
      as to not "lose" a domain is to make the check prior to starting the guest
      with the results as follows:
      
      $ virsh start $dom
      error: Failed to start domain $dom
      error: XML error: target 'sda' duplicated for disk sources '/var/lib/libvirt/images/file.qcow2' and '/var/lib/libvirt/images/file.img'
      
      $
      
      Running 'make check' found a few more instances in the tests where this
      duplicated target dev value was being used. These also exhibited some
      duplicated 'id=' values (negating the uniqueness argument of aliases) in
      the corresponding .args file and of course the *xmlout version of a few
      input XML files.
      e0e29055
  3. 02 3月, 2015 5 次提交
  4. 27 2月, 2015 1 次提交
    • J
      Ignore listen attribute of <graphics> for type network listens · 8c45e8be
      Ján Tomko 提交于
      Commit 69929941 started filling the listen attribute
      of the parent <graphics> elements from type='network' listens.
      
      When this XML is passed to UpdateDevice, parsing fails:
      XML error: graphics listen attribute 10.20.30.40 must match
      address attribute of first listen element (found none)
      
      Ignore the address in the parent <graphics> attribute
      when no type='address' listens are found,
      the same we ignore the address for the <listen> subelements
      when parsing inactive XML.
      8c45e8be
  5. 26 2月, 2015 3 次提交
    • J
      conf: error out on missing dhcp host attributes · b15b21f3
      Ján Tomko 提交于
      In virNetworkDHCPHostDefParseXML an error is reported
      when partialOkay == true, and none of ip, mac, name
      were supplied.
      
      Add the missing goto and error out in this case.
      b15b21f3
    • L
      conf: error out on invalid host id · 719cd218
      Luyao Huang 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1196503
      
      We already check whether the host id is valid or not, add a jump
      to forbid invalid host id.
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      Signed-off-by: NJán Tomko <jtomko@redhat.com>
      719cd218
    • L
      network: only clear bandwidth if it has been set · 118b2408
      Laine Stump 提交于
      libvirt was unconditionally calling virNetDevBandwidthClear() for
      every interface (and network bridge) of a type that supported
      bandwidth, whether it actually had anything set or not. This doesn't
      hurt anything (unless ifname == NULL!), but is wasteful.
      
      This patch makes sure that all calls to virNetDevBandwidthClear() are
      qualified by checking that the interface really had some bandwidth
      setup done, and checks for a null ifname inside
      virNetDevBandwidthClear(), silently returning success if it is null
      (as well as removing the ATTRIBUTE_NONNULL from that function's
      prototype, since we can't guarantee that it is never null,
      e.g. sometimes a type='ethernet' interface has no ifname as it is
      provided on the fly by qemu).
      118b2408
  6. 25 2月, 2015 2 次提交
  7. 24 2月, 2015 1 次提交
    • M
      network_conf: Forbid commas in DNS TXT · 39df9d2f
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1151942
      
      While the restriction doesn't have origin in any RFC, it matters
      to us while constructing the dnsmasq config file (or command line
      previously). For better picture, this is how the corresponding
      part of network XML look like:
      
        <dns>
          <forwarder addr='8.8.4.4'/>
          <txt name='example' value='example value'/>
        </dns>
      
      And this is how the config file looks like then:
      
        server=8.8.4.4
        txt-record=example,example value
      
      Now we can see why there can't be any commas in the TXT name.
      They are used by dnsmasq to separate @name and @value.
      
      Funny, we have it in the documentation, but the code (which was
      pushed back in 2011) didn't reflect that.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      39df9d2f
  8. 21 2月, 2015 21 次提交
    • M
      conf: support backend domain name in disk and network devices · c374353c
      Marek Marczykowski 提交于
      At least Xen supports backend drivers in another domain (aka "driver
      domain"). This patch introduces an XML config option for specifying the
      backend domain name for <disk> and <interface> devices.  E.g.
      
        <disk>
          <backenddomain name='diskvm'/>
          ...
        </disk>
        <interface type='bridge'>
          <backenddomain name='netvm'/>
          ...
        </interface>
      
      In the future, same option will be needed for USB devices (hostdev
      objects), but for now libxl doesn't have support for PVUSB.
      Signed-off-by: NMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
      c374353c
    • L
      network: allow <pf> together with <interface>/<address> in network status · 8f8e581a
      Laine Stump 提交于
      The function that parses the <forward> subelement of a network used to
      fail/log an error if the network definition contained both a <pf>
      element as well as at least one <interface> or <address> element. That
      check was present because the configuration of a network should have
      either one <pf>, one or more <interface>, or one or more <address>,
      but never combinations of multiple kinds.
      
      This caused a problem when libvirtd was restarted with a network
      already active - when a network with a <pf> element is started, the
      referenced PF (Physical Function of an SRIOV-capable network card) is
      checked for VFs (Virtual Functions), and the <forward> is filled in
      with a list of all VFs for that PF either in the form of their PCI
      addresses (a list of <address>) or their netdev names (a list of
      <interface>); the <pf> element is not removed though. When libvirtd is
      restarted, it parses the network status and finds both the original
      <pf> from the config, as well as the list of either <address> or
      <interface>, fails the parse, and the network is not added to the
      active list. This failure is often obscured because the network is
      marked as autostart so libvirt immediately restarts it.
      
      It seems odd to me that <interface> and <address> are stored in the
      same array rather than keeping two separate arrays, and having
      separate arrays would have made the check much simpler. However,
      changing to use two separate arrays would have required changes in
      more places, potentially creating more conflicts and (more
      importantly) more possible regressions in the event of a backport, so
      I chose to keep the existing data structure in order to localize the
      change.
      
      It appears that this problem has been in the code ever since support
      for <pf> was added (0.9.10), but until commit
      34cc3b2f (first in libvirt 1.2.4)
      networks with interface pools were not properly marked as active on
      restart anyway, so there is no point in backporting this patch any
      further than that.
      8f8e581a
    • P
      conf: Hoist validation of memory size into the post parse callback · e5c7864c
      Peter Krempa 提交于
      Later patches will need to access the full definition to do check the
      memory size and thus the checking needs to be done after the whole
      definition including devices is known.
      e5c7864c
    • P
      conf: numa: Check ABI stability of NUMA configuration · b98596a7
      Peter Krempa 提交于
      Add helper to compare initial sizes of indivitual NUMA nodes and the map
      of belonging vCPUs. Other configuration is not ABI.
      b98596a7
    • P
      conf: ABI: Hugepage backing definition is not guest ABI · e431c3c0
      Peter Krempa 提交于
      The backing of the vm's memory isn't influencing the guest ABI thus
      shouldn't be checked.
      e431c3c0
    • P
      conf: Move all NUMA configuration to virDomainNuma · 181742d4
      Peter Krempa 提交于
      For historical reasons data regarding NUMA configuration were split
      between the CPU definition and numatune. We cannot do anything about the
      XML still being split, but we certainly can at least store the relevant
      data in one place.
      
      This patch moves the NUMA stuff to the right place.
      181742d4
    • P
      conf: numa: Add setter/getter for NUMA node memory size · b9ddb258
      Peter Krempa 提交于
      Add the helpers and refactor places where the value is accessed without
      them.
      b9ddb258
    • P
      7800d473
    • P
      conf: numa: Add accessor for the NUMA node cpu mask · d9a779a3
      Peter Krempa 提交于
      Add virDomainNumaGetNodeCpumask() and refactor a few places that would
      get the cpu mask without the helper.
      d9a779a3
    • P
      conf: numa: Add helper to get guest NUMA node count and refactor users · be22d073
      Peter Krempa 提交于
      Add an accessor so that a later refactor is simpler.
      be22d073
    • P
      conf: numa: Don't pass double pointer to virDomainNumatuneParseXML · b83543c5
      Peter Krempa 提交于
      virDomainNumatuneParseXML now doesn't allocate the def->numa object any
      longer so we don't need to pass a double pointer.
      b83543c5
    • P
      numa: conf: Tweak parameters of virDomainNumatuneSet · fa993072
      Peter Krempa 提交于
      As virDomainNumatuneSet now doesn't allocate the virDomainNuma object
      any longer it's not necessary to pass the pointer to a pointer to store
      the object as it will not change any longer.
      
      While touching the parameter definitions I've also changed the name of
      the parameter to "numa".
      fa993072
    • P
      conf: numa: Always allocate the NUMA config · 21008c01
      Peter Krempa 提交于
      Since our formatter now handles well if the config is allocated and not
      filled we can safely always-allocate the NUMA config and remove the
      ad-hoc allocation code.
      
      This will help in later patches as the parser will be refactored to just
      fill the data.
      21008c01
    • P
      conf: Allocate domain definition with the new helper · c0341119
      Peter Krempa 提交于
      Use the virDomainDefNew() helper to allocate the definition instead of
      doing it via VIR_ALLOC.
      c0341119
    • P
      conf: Separate helper for creating domain objects · 61e43ce9
      Peter Krempa 提交于
      Move the existing virDomainDefNew to virDomainDefNewFull as it's setting
      a few things in the conf and re-introduce virDomainDefNew as a function
      without parameters for common use.
      61e43ce9
    • P
      conf: numa: Format <numatune> XML only if necessary · 121cde47
      Peter Krempa 提交于
      Do a content-aware check if formatting of the <numatune> element is
      necessary. Later on the def->numa structure will be always present so we
      cannot decide only on the basis whether it's allocated.
      121cde47
    • P
      conf: numa: Refactor logic in virDomainNumatuneParseXML · 638e3d27
      Peter Krempa 提交于
      Shuffling around the logic will allow to simplify the code quite a bit.
      As an additional bonus the change in the logic now reports an error if
      automatic placement is selected and individual placement is configured.
      638e3d27
    • P
      conf: numa: Reformat virDomainNumatuneParseXML · 67bd807c
      Peter Krempa 提交于
      Collapse few of the conditions so that the program flow is more clear.
      67bd807c
    • P
      conf: numa: Improve error message in case a numa node doesn't have cpus · 60a2ce49
      Peter Krempa 提交于
      Currently the code would exit without reporting an error as
      virBitmapParse reports one only if it fails to parse the bitmap, whereas
      the code was jumping to the error label even in case 0 cpus were
      correctly parsed in the map.
      60a2ce49
    • P
      conf: numa: Recalculate rather than remember total NUMA cpu count · 6b616632
      Peter Krempa 提交于
      It's easier to recalculate the number in the one place it's used as
      having a separate variable to track it. It will also help with moving
      the NUMA code to the separate module.
      6b616632
    • P
      conf: Move enum virMemAccess to the NUMA code and rename it · a3673b22
      Peter Krempa 提交于
      Name it virNumaMemAccess and add it to conf/numa_conf.[ch]
      
      Note that to avoid a circular dependency the type of the NUMA cell
      memAccess variable was changed to int. It will be turned back later
      after the circular dependency will not exist.
      a3673b22