1. 20 10月, 2012 3 次提交
    • E
      storage: use enum for default driver type · 09e7fb5e
      Eric Blake 提交于
      Express the default disk type as an enum, for easier handling.
      
      * src/conf/capabilities.h (_virCaps): Store enum rather than
      string for disk type.
      * src/conf/domain_conf.c (virDomainDiskDefParseXML): Adjust
      clients.
      * src/qemu/qemu_driver.c (qemuCreateCapabilities): Likewise.
      09e7fb5e
    • E
      storage: treat 'aio' like 'raw' at parse time · 41e0edaf
      Eric Blake 提交于
      We have historically allowed 'aio' as a synonym for 'raw' for
      back-compat to xen, but since a future patch will move to using
      an enum value, we have to pick one to be our preferred output
      name.  This is a slight change in the output XML, but the sexpr
      and xm outputs should still be identical, and the input XML can
      still use either form.
      
      * src/conf/domain_conf.c (virDomainDiskDefForeachPath): Move aio
      back-compat...
      (virDomainDiskDefParseXML): ...to parse time.
      * src/xenxs/xen_sxpr.c (xenParseSxprDisks, xenFormatSxprDisk): ...and
      to output time.
      * src/xenxs/xen_xm.c (xenParseXM, xenFormatXMDisk): Likewise.
      * tests/sexpr2xmldata/sexpr2xml-*.xml: Update tests.
      41e0edaf
    • E
      storage: list more file types · f772b3d9
      Eric Blake 提交于
      When an image has no backing file, using VIR_STORAGE_FILE_AUTO
      for its type is a bit confusing.  Additionally, a future patch
      would like to reserve a default value for the case of no file
      type specified in the XML, but different from the current use
      of -1 to imply probing, since probing is not always safe.
      
      Also, a couple of file types were missing compared to supported
      code: libxl supports 'vhd', and qemu supports 'fat' for directories
      passed through as a file system.
      
      * src/util/storage_file.h (virStorageFileFormat): Add
      VIR_STORAGE_FILE_NONE, VIR_STORAGE_FILE_FAT, VIR_STORAGE_FILE_VHD.
      * src/util/storage_file.c (virStorageFileMatchesVersion): Match
      documentation when version probing not supported.
      (cowGetBackingStore, qcowXGetBackingStore, qcow1GetBackingStore)
      (qcow2GetBackingStoreFormat, qedGetBackingStore)
      (virStorageFileGetMetadataFromBuf)
      (virStorageFileGetMetadataFromFD): Take NONE into account.
      * src/conf/domain_conf.c (virDomainDiskDefForeachPath): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainGetBlockInfo): Likewise.
      * src/conf/storage_conf.c (virStorageVolumeFormatFromString): New
      function.
      (poolTypeInfo): Use it.
      f772b3d9
  2. 18 10月, 2012 3 次提交
    • M
      network: Set to NULL after virNetworkDefFree() · b7e92024
      Michal Privoznik 提交于
      which frees all allocated memory but doesn't set the passed pointer to
      NULL.  Therefore, we must do it ourselves. This is causing actual
      libvirtd crash: Basically, when doing 'virsh net-edit' the newDef should
      be dropped.  And the memory is freed, indeed. However, the pointer is
      not set to NULL but kept instead. And the next duo of calls 'virsh
      net-start' and 'virsh net-destroy' starts the disaster. The latter one
      does the same as 'virsh destroy'; it sees that newDef is nonNULL so it
      replaces def with newDef (which has been freed already as said a few
      lines above). Therefore any subsequent call accessing def will hit the ground.
      b7e92024
    • P
      conf: Add support for HyperV Enlightenment features · cc922fdd
      Peter Krempa 提交于
      Hypervisors are starting to support HyperV Enlightenment features that
      improve behavior of guests running Microsoft Windows operating systems.
      
      This patch adds support for the "relaxed" feature that improves timer
      behavior and also establishes a framework to add these features in
      future.
      cc922fdd
    • P
      conf: Make tri-state feature options more universal · 88cac66d
      Peter Krempa 提交于
      The apic-eoi feature enum and implementation can be made more universal
      to allow re-use of the enum for other features.
      88cac66d
  3. 16 10月, 2012 1 次提交
    • M
      conf: Fix crash with cleanup · 280b8c9e
      Martin Kletzander 提交于
      There was a crash possible when both <boot dev... and <boot
      order... were specified due to virDomainDefParseBootXML() erroring out
      before setting *tmp (which was free'd in cleanup).  As a fix, I
      created this cleanup that uses one pointer for all the temporary
      stored XPath strings and values, plus this pointer is correctly
      initialized to NULL.
      280b8c9e
  4. 15 10月, 2012 8 次提交
    • M
      Add support for SUSPEND_DISK event · 7ba5defb
      Martin Kletzander 提交于
      This patch adds support for SUSPEND_DISK event; both lifecycle and
      separated.  The support is added for QEMU, machines are changed to
      PMSUSPENDED, but as QEMU sends SHUTDOWN afterwards, the state changes
      to shut-off.  This and much more needs to be done in order for libvirt
      to work with transient devices, wake-ups etc.  This patch is not
      aiming for that functionality.
      7ba5defb
    • G
      Avoid straying </cpuset> · dc9d7a17
      Guido Günther 提交于
      by using the same condition as for the <cpuset>.
      
      Fixes "make check" found by
          http://honk.sigxcpu.org:8001/job/libvirt-check/160/
      dc9d7a17
    • L
      conf: virDomainDeviceInfoCopy utility function · 11c47d97
      Laine Stump 提交于
      This does a shallow copy of all the bits, then strdups the two items
      that are actually allocated separately.
      11c47d97
    • L
      conf: fix virDevicePCIAddressEqual args · 31094559
      Laine Stump 提交于
      This function really should have been taking virDevicePCIAddress*
      instead of the inefficient virDevicePCIAddress (results in copying two
      entire structs onto the stack rather than just two pointers), and
      returning a bool true/false (not matching is not necessarily a
      "failure", as a -1 return would imply, and also using "if
      (!virDevicePCIAddressEqual(x, y))" to mean "if x == y" is just a bit
      counterintuitive).
      31094559
    • O
      conf: Ignore emulatorpin if vcpu placement is auto · 5378effd
      Osier Yang 提交于
      When vcpu placement is "auto", the domain process will be pinned
      to advisory nodeset from querying numad, While emulatorpin will
      override the pinning. That means both of them are to set the
      pinning policy for domain process, but conflicts with each other.
      
      This patch ingore emulatorpin if vcpu placement is "auto", because
      <vcpu> placement can't be simply ignored for <numatune> placement
      could default to it.
      5378effd
    • O
      qemu: Initialize cpuset for hotplugged vcpu as def->cpuset · 0df1a790
      Osier Yang 提交于
      The onlined vcpu pinning policy should inherit def->cpuset if
      it's not specified explicitly, and the affinity should be set
      in this case. Oppositely, the offlined vcpu pinning policy should
      be free()'ed.
      0df1a790
    • O
      conf: Initialize the pinning policy for vcpus · 10f8a45d
      Osier Yang 提交于
      Document for <vcpu>'s "cpuset" says:
      
      Since 0.4.4, this element can contain an optional cpuset attribute,
      which is a comma-separated list of physical CPU numbers that virtual
      CPUs can be pinned to.
      
      However, it's not the truth, libvirt actually pins the domain
      process to the specified pCPUs by "cpuset" of <vcpu>. And the
      vcpu thread are pinned to all available pCPUs if no <vcpupin>
      is specified for it.
      
      This patch is to implement the codes to inherit <vcpu>'s "cpuset" for
      vcpu that doesn't have <vcpupin> specified, and <vcpupin>
      for these vcpu will be ignored when formating. Underlying
      driver implementation will make sure the vcpu thread pinned
      to correct pCPUs.
      10f8a45d
    • O
      conf: Ignore vcpupin for not onlined vcpus when parsing · 60b176c3
      Osier Yang 提交于
      Setting pinning policy for vcpu which exceeds current vcpus number
      just makes no sense, however, it could cause various problems, E.g.
      
      <vcpu current='1'>4</vcpu>
      <cputune>
        <vcpupin vcpuid='3' cpuset='4'/>
      </cputune>
      
      % virsh start linux
      error: Failed to start domain linux
      error: cannot set CPU affinity on process 32534: No such process
      
      We must have some odd codes underlying which produces the
      "on process 32534", but the point is why we not to prevent
      earlier when parsing? Note that this is only one of the
      problem it could cause.
      
      This patch is to ignore the <vcpupin> for not onlined vcpus.
      60b176c3
  5. 12 10月, 2012 2 次提交
  6. 11 10月, 2012 6 次提交
    • J
      qemu: Make save/restore with USB devices usable · bd1282d6
      Jiri Denemark 提交于
      Save/restore with passed through USB devices currently only works if the
      USB device can be found at the same USB address where it used to be
      before saving a domain. This makes sense in case a user explicitly
      configure the USB address in domain XML. However, if the device was
      found automatically by vendor/product identification, we should try to
      search for that device when restoring the domain and use any device we
      find as long as there is only one available. In other words, the USB
      device can now be removed and plugged again or the host can be rebooted
      between saving and restoring the domain.
      bd1282d6
    • J
      Add MIGRATABLE flag for virDomainGetXMLDesc · 28f8dfdc
      Jiri Denemark 提交于
      Using VIR_DOMAIN_XML_MIGRATABLE flag, one can request domain's XML
      configuration that is suitable for migration or save/restore. Such XML
      may contain extra run-time stuff internal to libvirt and some default
      configuration may be removed for better compatibility of the XML with
      older libvirt releases.
      
      This flag may serve as an easy way to get the XML that can be passed
      (after desired modifications) to APIs that accept custom XMLs, such as
      virDomainMigrate{,ToURI}2 or virDomainSaveFlags.
      28f8dfdc
    • J
      qemu: Add option to treat missing USB devices as success · 059aff6b
      Jiri Denemark 提交于
      All USB device lookup functions emit an error when they cannot find the
      requested device. With this patch, their caller can choose if a missing
      device is an error or normal condition.
      059aff6b
    • J
      conf: Add support for startupPolicy for USB devices · e658daeb
      Jiri Denemark 提交于
      USB devices can disappear without OS being mad about it, which makes
      them ideal for startupPolicy. With this attribute, USB devices can be
      configured to be mandatory (the default), requisite (will disappear
      during migration if they cannot be found), or completely optional.
      e658daeb
    • J
      conf: Add on_lockfailure event configuration · 76f5bcab
      Jiri Denemark 提交于
      Using this new element, one can configure an action that should be
      performed when resource locks are lost.
      76f5bcab
    • J
      conf: Rename life cycle actions to event actions · d0ea530b
      Jiri Denemark 提交于
      While current on_{poweroff,reboot,crash} action configuration is about
      configuring life cycle actions, they can all be considered events and
      actions that need to be done on a particular event. Let's generalize the
      code by renaming life cycle actions to event actions so that it can be
      reused later for non-lifecycle events.
      d0ea530b
  7. 27 9月, 2012 3 次提交
    • D
      Switch over to use cache for building QEMU capabilities · 494e2f5c
      Daniel P. Berrange 提交于
      When building up a virCapsPtr instance, the QEMU driver
      was copying the list of machine types across from the
      previous virCapsPtr instance, if the QEMU binary had not
      changed. Replace this ad-hoc caching of data with use
      of the new qemuCapsCache global cache.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      494e2f5c
    • D
      Use size_t instead of int for virDomainDefPtr struct · 5cbb0d37
      Daniel P. Berrange 提交于
      Many parts of virDomainDefPtr were using 'int' variables as
      array length counts. Replace all these with size_t and update
      various format strings & API signatures to adapt
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      5cbb0d37
    • L
      network: backend for virNetworkUpdate of interface list · 024879e5
      Laine Stump 提交于
      <interface> elements are location inside the <forward> element of a
      network. There is only one <forward> element in any network, but it
      might have many <interface> elements. This element only contains a
      single attribute, "dev", which is the name of a network device
      (e.g. "eth0").
      
      Since there is only a single attribute, the modify operation isn't
      supported for this "section", only add-first, add-last, and
      delete. Also, note that it's not permitted to delete an interface from
      the list while any guest is using it. We may later decide this is safe
      (because removing it from the list really only excludes it from
      consideration in future guest allocations of interfaces, but doesn't
      affect any guests currently connected), but for now this limitation
      seems prudent (of course when changing the persistent config, this
      limitation doesn't apply, because the persistent config doesn't
      support the concept of "in used").
      
      Another limitation - it is also possible for the interfraces in this
      list to be described by PCI address rather than netdev name. However,
      I noticed while writing this function that we currently don't support
      defining interfaces that way in config - the only method of getting
      interfaces specified as <adress type='pci' ..../> instead of
      <interface dev='xx'/> is to provide a <pf dev='yy'/> element under
      forward, and let the entries in the interface list be automatically
      populated with the virtual functions (VF) of the physical function
      device given in <pg>.
      
      As with the other virNetworkUpdate section backends, support for this
      section is completely contained within a single static function, no
      other changes were required, and only functions already called from
      elsewhere within the same file are used in the new content for this
      existing function (i.e., adding this code should not cause a new build
      problem on any platform).
      024879e5
  8. 26 9月, 2012 1 次提交
  9. 22 9月, 2012 2 次提交
    • L
      network: log error for unknown virNetworkUpdate command codes · 5cdcb75d
      Laine Stump 提交于
      Every level of the code for virNetworkUpdate was assuming that some
      other level was checking for validity of the "command" arg, but none
      actually were. The result was that an invalid command code would do
      nothing, but also report success.
      
      Since the command code isn't used until the very lowest level backend
      functions, that's where I put the check. I made a separate one-line
      function to log the error. The compiler would have combined the
      identical strings used by multiple calls if I'd just called
      virReportError directly in each location, but sending them all to the
      same string in the source guards against inadvertant divergence (which
      would lead to extra work for translators.)
      5cdcb75d
    • L
      network: make virNetworkObjUpdate error detection/recovery better · f59e25e0
      Laine Stump 提交于
      1) virNetworkObjUpdate should be an all or none operation, but in the
      case that we want to update both the live state and persistent config
      versions of the network, it was committing the update to the live
      state before starting to update the persistent config. If update of
      the persistent config failed, we would leave with things in an
      inconsistent state - the live state would be updated (even though an
      error was returned), but persistent config unchanged.
      
      This patch changed virNetworkObjUpdate to use a separate pointer for
      each copy of the virNetworkDef, and not commit either of them in the
      virNetworkObj until both live and config parts of the update have
      successfully completed.
      
      2) The parsers for various pieces of the virNetworkDef have all sorts
      of subtle limitations on them that may not be known by the
      Update[section] function, making it possible for one of these
      functions to make a modification directly to the object that may not
      pass the scrutiny of a subsequent parse. But normally another parse
      wouldn't be done on the data until the *next* time the object was
      updated (which could leave the network definition in an unusable
      state).
      
      Rather than fighting the losing battle of trying to duplicate all the
      checks from the parsers into the update functions as well, the more
      foolproof solution to this is to simply do an extra
      virNetworkDefCopy() operation on the updated networkdef -
      virNetworkDefCopy() does a virNetworkFormat() followed by a
      virNetworkParseString(), so it will do all the checks we need. If this
      fails, then we don't commit the changed def.
      f59e25e0
  10. 21 9月, 2012 5 次提交
    • R
      Add <seclabel> to character devices. · f8b08d0e
      Richard W.M. Jones 提交于
      This allows the user to control labelling of each character device
      separately (the default is to inherit from the VM).
      Signed-off-by: NRichard W.M. Jones <rjones@redhat.com>
      f8b08d0e
    • R
      Make virSecurityDeviceLabelDefParseXML into generic device <seclabel> parser. · db2aff6a
      Richard W.M. Jones 提交于
      This is just code motion, allowing us to reuse the same function to
      parse the <seclabel> from character devices too.
      
      However it also fixes a possible segfault in the original code if
      VIR_ALLOC_N returns an error and the cleanup code (at the error:
      label) tries to iterate over the unallocated array (thanks Michal
      Privoznik for spotting this).
      Signed-off-by: NRichard W.M. Jones <rjones@redhat.com>
      db2aff6a
    • L
      network: backend for virNetworkUpdate of portgroups · 8b6f831c
      Laine Stump 提交于
      portgroup elements are located in the toplevel of <network>
      objects. There can be multiple <portgroup> elements, and they each
      have a unique name attribute.
      
      Add, delete, and modify are all supported for portgroup. When deleting
      a portgroup, only the name must be specified in the provided xml - all
      other attributes and subelements are ignored for the purposes of
      matching and existing portgroup.
      
      The bridge driver and virsh already know about the portgroup element,
      so providing this backend should cause the entire stack to work. Note
      that in the case of portgroup, there is no external daemon based on
      the portgroup config, so nothing must be restarted.
      
      It is important to note that guests make a copy of the appropriate
      network's portgroup data when they are started, so although an updated
      portgroup's configuration will have an affect on new guests started
      after the cahange, existing guests won't magically have their
      bandwidth changed, for example. If something like that is desired, it
      will take a lot of redesign work in the way network devices are setup
      (there is currently no link from the network back to the individual
      interfaces using it, much less from a portgroup within a network back
      to the individual interfaces).
      8b6f831c
    • L
      network: backend for virNetworkUpdate of dhcp range · 1100f610
      Laine Stump 提交于
      The dhcp range element is contained in the <dhcp> element of one of a
      network's <ip> elements. There can be multiple <range>
      elements. Because there are only two attributes (start and end), and
      those are exactly what you would use to identify a particular range,
      it doesn't really make sense to modify an existing element, so
      VIR_NETWORK_UPDATE_COMMAND_MODIFY isn't supported for this section,
      only ADD_FIRST, ADD_LAST, and DELETE.
      
      Since virsh already has support for understanding all the defined
      sections, this new backend is automatically supported by virsh. You
      would use it like this:
      
        virsh net-update mynet add ip-dhcp-range \
              "<range start='1.2.3.4' end='1.2.3.20'/>" --live --config
      
      The bridge driver also already supports all sections, so it's doing
      the correct thing in this case as well - since the dhcp range is
      placed on the dnsmasq commandline, the bridge driver recreates the
      dnsmasq commandline, and re-runs dnsmasq whenever a range is
      added/deleted (and AFFECT_LIVE is specified in the flags).
      1100f610
    • E
      maint: fix up copyright notice inconsistencies · 4ecb723b
      Eric Blake 提交于
      https://www.gnu.org/licenses/gpl-howto.html recommends that
      the 'If not, see <url>.' phrase be a separate sentence.
      
      * tests/securityselinuxhelper.c: Remove doubled line.
      * tests/securityselinuxtest.c: Likewise.
      * globally: s/;  If/.  If/
      4ecb723b
  11. 20 9月, 2012 5 次提交
    • M
      Add support for limiting guest coredump · 78f3666f
      Martin Kletzander 提交于
      Sometimes when guest machine crashes, coredump can get huge due to the
      guest memory. This can be limited using madvise(2) system call and is
      being used in QEMU hypervisor. This patch adds an option for configuring
      that in the domain XML and related documentation.
      78f3666f
    • M
      Add support for reboot-timeout · c33a922f
      Martin Kletzander 提交于
      Whenever the guest machine fails to boot, new parameter (reboot-timeout)
      controls whether it should reboot and after how many ms it should do so.
      
      Docs included.
      c33a922f
    • M
      Cleanup of domain_conf sentinels · ea446266
      Martin Kletzander 提交于
      This patch removes all commas after *_LAST sentinels in the enums.
      ea446266
    • M
      qemu: Cleanup boot parameter building · 8c952908
      Martin Kletzander 提交于
      This patch cleans up building the "-boot" parameter and while on that
      fixes one inconsistency by modifying these things:
      
       - I completed the unfinished virDomainBootMenu enum by specifying
         LAST, declaring it and also declaring the TypeFromString and
         TypeToString parameters.
       - Previously mentioned TypeFromString and TypeToString are used when
         parsing the XML.
       - Last, but not least, visible change is that the "-boot" parameter
         is built and parsed properly:
          - The "order=" prefix is used only when additional parameters are
            used (menu, etc.).
          - It's rewritten in a way that other parameters can be added
            easily in the future (used in following patch).
          - The "order=" parameter is properly parsed regardless to where it
            is placed in the string (e.g. "menu=on,order=nc").
          - The "menu=" parameter (and others in the future) are created
            when they should be (i.e. even when bootindex is supported and
            used, but not when bootloader is selected).
      8c952908
    • L
      network: fix element size / length in memmove · db8760ff
      Laine Stump 提交于
      The memmove to move elements in the dhcp hosts array when inserting
      and deleting items was mistakenly basing the length of the copy on the
      size of a virNetworkDHCPHostDefPtr rather than virNetworkDHCPHostDef,
      with the expected disastrous results.
      
      The memmove to delete an entry commits two errors - along with the
      size of each element being wrong, it also omits some required
      parentheses.
      db8760ff
  12. 18 9月, 2012 1 次提交