1. 10 8月, 2012 1 次提交
    • E
      build: fix PROBE() usage of intptr_t · 51ee43aa
      Eric Blake 提交于
      Otherwise, in locations like virobject.c where PROBE is used,
      for certain configure options, the compiler warns:
      
      util/virobject.c:110:1: error: 'intptr_t' undeclared (first use in this function)
      
      As long as we are making this header always available, we can
      clean up several other files.
      
      * src/internal.h (includes): Pull in <stdint.h>.
      * src/conf/nwfilter_conf.h: Rely on internal.h.
      * src/storage/storage_backend.c: Likewise.
      * src/storage/storage_backend.h: Likewise.
      * src/util/cgroup.c: Likewise.
      * src/util/sexpr.h: Likewise.
      * src/util/virhashcode.h: Likewise.
      * src/util/virnetdevvportprofile.h: Likewise.
      * src/util/virnetlink.h: Likewise.
      * src/util/virrandom.h: Likewise.
      * src/vbox/vbox_driver.c: Likewise.
      * src/xenapi/xenapi_driver.c: Likewise.
      * src/xenapi/xenapi_utils.c: Likewise.
      * src/xenapi/xenapi_utils.h: Likewise.
      * src/xenxs/xenxs_private.h: Likewise.
      * tests/storagebackendsheepdogtest.c: Likewise.
      51ee43aa
  2. 04 8月, 2012 1 次提交
    • J
      xen-xm: Generate UUID if not specified · 1fbdfc53
      Jim Fehlig 提交于
      Parsing xen-xm format configuration will fail if UUID is not
      specified, e.g.
      
      virsh domxml-from-native xen-xm some-config-without-uuid
      error: internal error parsing xm config failed
      
      Initially I thought to skip parsing the UUID in xenParseXM() when
      not present in the configuration, but this results in a UUID of
      all zeros since it is never set
      
      virsh domxml-from-native xen-xm /tmp/jim/bug-773621_pierre-test
      <domain type='xen'>
        <name>test</name>
        <uuid>00000000-0000-0000-0000-000000000000</uuid>
        ...
      
      which certainly can't be correct since this is the UUID the xen
      tools use for dom0.
      
      This patch takes the approach of generating a UUID when it is not
      specified in the configuration.
      1fbdfc53
  3. 27 7月, 2012 1 次提交
    • E
      maint: don't permit format strings without % · 768007ae
      Eric Blake 提交于
      Any time we have a string with no % passed through gettext, a
      translator can inject a % to cause a stack overread.  When there
      is nothing to format, it's easier to ask for a string that cannot
      be used as a formatter, by using a trivial "%s" format instead.
      
      In the past, we have used --disable-nls to catch some of the
      offenders, but that doesn't get run very often, and many more
      uses have crept in.  Syntax check to the rescue!
      
      The syntax check can catch uses such as
      virReportError(code,
                     _("split "
                       "string"));
      by using a sed script to fold context lines into one pattern
      space before checking for a string without %.
      
      This patch is just mechanical insertion of %s; there are probably
      several messages touched by this patch where we would be better
      off giving the user more information than a fixed string.
      
      * cfg.mk (sc_prohibit_diagnostic_without_format): New rule.
      * src/datatypes.c (virUnrefConnect, virGetDomain)
      (virUnrefDomain, virGetNetwork, virUnrefNetwork, virGetInterface)
      (virUnrefInterface, virGetStoragePool, virUnrefStoragePool)
      (virGetStorageVol, virUnrefStorageVol, virGetNodeDevice)
      (virGetSecret, virUnrefSecret, virGetNWFilter, virUnrefNWFilter)
      (virGetDomainSnapshot, virUnrefDomainSnapshot): Add %s wrapper.
      * src/lxc/lxc_driver.c (lxcDomainSetBlkioParameters)
      (lxcDomainGetBlkioParameters): Likewise.
      * src/conf/domain_conf.c (virSecurityDeviceLabelDefParseXML)
      (virDomainDiskDefParseXML, virDomainGraphicsDefParseXML):
      Likewise.
      * src/conf/network_conf.c (virNetworkDNSHostsDefParseXML)
      (virNetworkDefParseXML): Likewise.
      * src/conf/nwfilter_conf.c (virNWFilterIsValidChainName):
      Likewise.
      * src/conf/nwfilter_params.c (virNWFilterVarValueCreateSimple)
      (virNWFilterVarAccessParse): Likewise.
      * src/libvirt.c (virDomainSave, virDomainSaveFlags)
      (virDomainRestore, virDomainRestoreFlags)
      (virDomainSaveImageGetXMLDesc, virDomainSaveImageDefineXML)
      (virDomainCoreDump, virDomainGetXMLDesc)
      (virDomainMigrateVersion1, virDomainMigrateVersion2)
      (virDomainMigrateVersion3, virDomainMigrate, virDomainMigrate2)
      (virStreamSendAll, virStreamRecvAll)
      (virDomainSnapshotGetXMLDesc): Likewise.
      * src/nwfilter/nwfilter_dhcpsnoop.c (virNWFilterSnoopReqLeaseDel)
      (virNWFilterDHCPSnoopReq): Likewise.
      * src/openvz/openvz_driver.c (openvzUpdateDevice): Likewise.
      * src/openvz/openvz_util.c (openvzKBPerPages): Likewise.
      * src/qemu/qemu_cgroup.c (qemuSetupCgroup): Likewise.
      * src/qemu/qemu_command.c (qemuBuildHubDevStr, qemuBuildChrChardevStr)
      (qemuBuildCommandLine): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainGetPercpuStats): Likewise.
      * src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
      * src/rpc/virnetsaslcontext.c (virNetSASLSessionGetIdentity):
      Likewise.
      * src/rpc/virnetsocket.c (virNetSocketNewConnectUNIX)
      (virNetSocketSendFD, virNetSocketRecvFD): Likewise.
      * src/storage/storage_backend_disk.c
      (virStorageBackendDiskBuildPool): Likewise.
      * src/storage/storage_backend_fs.c
      (virStorageBackendFileSystemProbe)
      (virStorageBackendFileSystemBuild): Likewise.
      * src/storage/storage_backend_rbd.c
      (virStorageBackendRBDOpenRADOSConn): Likewise.
      * src/storage/storage_driver.c (storageVolumeResize): Likewise.
      * src/test/test_driver.c (testInterfaceChangeBegin)
      (testInterfaceChangeCommit, testInterfaceChangeRollback):
      Likewise.
      * src/vbox/vbox_tmpl.c (vboxListAllDomains): Likewise.
      * src/xenxs/xen_sxpr.c (xenFormatSxprDisk, xenFormatSxpr):
      Likewise.
      * src/xenxs/xen_xm.c (xenXMConfigGetUUID, xenFormatXMDisk)
      (xenFormatXM): Likewise.
      768007ae
  4. 23 7月, 2012 1 次提交
    • O
      Desert the FSF address in copyright · f9ce7dad
      Osier Yang 提交于
      Per the FSF address could be changed from time to time, and GNU
      recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html)
      
        You should have received a copy of the GNU General Public License
        along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
      
      This patch removes the explicit FSF address, and uses above instead
      (of course, with inserting 'Lesser' before 'General').
      
      Except a bunch of files for security driver, all others are changed
      automatically, the copyright for securify files are not complete,
      that's why to do it manually:
      
        src/security/security_selinux.h
        src/security/security_driver.h
        src/security/security_selinux.c
        src/security/security_apparmor.h
        src/security/security_apparmor.c
        src/security/security_driver.c
      f9ce7dad
  5. 20 7月, 2012 1 次提交
  6. 17 7月, 2012 1 次提交
    • S
      Convert 'raw MAC address' usages to use virMacAddr · 387117ad
      Stefan Berger 提交于
      Introduce new members in the virMacAddr 'class'
      - virMacAddrSet: set virMacAddr from a virMacAddr
      - virMacAddrSetRaw: setting virMacAddr from raw 6 byte MAC address buffer
      - virMacAddrGetRaw: writing virMacAddr into raw 6 byte MAC address buffer
      - virMacAddrCmp: comparing two virMacAddr
      - virMacAddrCmpRaw: comparing a virMacAddr with a raw 6 byte MAC address buffer
      
      then replace raw MAC addresses by replacing
      
      - 'unsigned char *' with virMacAddrPtr
      - 'unsigned char ... [VIR_MAC_BUFLEN]' with virMacAddr
      
      and introduce usage of above functions where necessary.
      387117ad
  7. 28 5月, 2012 1 次提交
  8. 17 4月, 2012 1 次提交
    • S
      xen: do not use ioemu type for any emulated NIC · 10c31135
      Stefan Bader 提交于
      When using the xm/xend stack to manage instances there is a bug
      that causes the emulated interfaces to be unusable when the vif
      config contains type=ioemu.
      
      The current code already has a special quirk to not use this
      keyword if no specific model is given for the emulated NIC
      (defaulting to rtl8139).
      Essentially it works because regardless of the type argument,i
      the Xen stack always creates emulated and paravirt interfaces and
      lets the guest decide which one to use. So neither xl nor xm stack
      actually require the type keyword for emulated NICs.
      Signed-off-by: NStefan Bader <stefan.bader@canonical.com>
      10c31135
  9. 06 4月, 2012 1 次提交
  10. 02 4月, 2012 1 次提交
    • P
      Xen: Fix <clock> handling · 11ec6bd8
      Philipp Hahn 提交于
      XenD-3.1 introduced managed domains. HV-domains have rtc_timeoffset
      (hgd24f37b31030 from 2007-04-03), which tracks the offset between the
      hypervisors clock and the domains RTC, and is persisted by XenD.
      In combination with localtime=1 this had a bug until XenD-3.4
      (hg5d701be7c37b from 2009-04-01) (I'm not 100% sure how that bug
      manifests, but at least for me in TZ=Europe/Berlin I see the previous
      offset relative to utc being applied to localtime again, which manifests
      in an extra hour being added)
      
      XenD implements the following variants for clock/@offset:
      - PV domains don't have a RTC → 'localtime' | 'utc'
      - <3.1: no managed domains → 'localtime' | 'utc'
      - ≥3.1: the offset is tracked for HV → 'variable'
              due to the localtime=1 bug → 'localtime' | 'utc'
      - ≥3.4: the offset is tracked for HV → 'variable'
      
      Current libvirtd still thinks XenD only implements <clock offset='utc'/>
      and <clock offset='localtime'/>, which is wrong, since the semantic of
      'utc' and 'localtime' specifies, that the offset will be reset on
      domain-restart, while with 'variable' the offset is kept. (keeping the
      offset over "virsh edit" is important, since otherwise the clock might
      jump, which confuses certain guest OSs)
      
      xendConfigVersion was last incremented to 4 by the xen-folks for
      xen-3.1.0. I know of no way to reliably detect the version of XenD
      (user space tools), which may be different from the version of the
      hypervisor (kernel) version! Because of this only the change from
      'utc'/'localtime' to 'variable' in XenD-3.1 is handled, not the buggy
      behaviour of XenD-3.1 until XenD-3.4.
      
      For backward compatibility with previous versions of libvirt Xen-HV
      still accepts 'utc' and 'localtime', but they are returned as 'variable'
      on the next read-back from Xend to libvirt, since this is what XenD
      implements: The RTC is NOT reset back to the specified time on next
      restart, but the previous offset is kept.
      This behaviour can be turned off by adding the additional attribute
      adjustment='reset', in which case libvirt will report an error instead
      of doing the conversion. The attribute can also be used as a shortcut to
      offset='variable' with basis='...'.
      
      With these changes, it is also necessary to adjust the xen tests:
      
      "localtime = 0" is always inserted, because otherwise on updates the
      value is not changed within XenD.
      
      adjustment='reset' is inserted for all cases, since they're all <
      XEND_CONFIG_VERSION_3_1_0, only 3.1 introduced persistent
      rtc_timeoffset.
      
      Some statements change their order because code was moved around.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      11ec6bd8
  11. 27 3月, 2012 1 次提交
    • M
      Cleanup for a return statement in source files · 9943276f
      Martin Kletzander 提交于
      Return statements with parameter enclosed in parentheses were modified
      and parentheses were removed. The whole change was scripted, here is how:
      
      List of files was obtained using this command:
      git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' |             \
      grep -e '\.[ch]$' -e '\.py$'
      
      Found files were modified with this command:
      sed -i -e                                                                 \
      's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \
      -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'
      
      Then checked for nonsense.
      
      The whole command looks like this:
      git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' |             \
      grep -e '\.[ch]$' -e '\.py$' | xargs sed -i -e                            \
      's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \
      -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'
      9943276f
  12. 08 3月, 2012 1 次提交
    • E
      xml: use better types for memory values · 4888f0fb
      Eric Blake 提交于
      Using 'unsigned long' for memory values is risky on 32-bit platforms,
      as a PAE guest can have more than 4GiB memory.  Our API is
      (unfortunately) locked at 'unsigned long' and a scale of 1024, but
      the rest of our system should consistently use 64-bit values,
      especially since the previous patch centralized overflow checking.
      
      * src/conf/domain_conf.h (_virDomainDef): Always use 64-bit values
      for memory.  Change hugepage_backed to a bool.
      * src/conf/domain_conf.c (virDomainDefParseXML)
      (virDomainDefCheckABIStability, virDomainDefFormatInternal): Fix
      clients.
      * src/vmx/vmx.c (virVMXFormatConfig): Likewise.
      * src/xenxs/xen_sxpr.c (xenParseSxpr, xenFormatSxpr): Likewise.
      * src/xenxs/xen_xm.c (xenXMConfigGetULongLong): New function.
      (xenXMConfigGetULong, xenXMConfigSetInt): Avoid truncation.
      (xenParseXM, xenFormatXM): Fix clients.
      * src/phyp/phyp_driver.c (phypBuildLpar): Likewise.
      * src/openvz/openvz_driver.c (openvzDomainSetMemoryInternal):
      Likewise.
      * src/vbox/vbox_tmpl.c (vboxDomainDefineXML): Likewise.
      * src/qemu/qemu_command.c (qemuBuildCommandLine): Likewise.
      * src/qemu/qemu_process.c (qemuProcessStart): Likewise.
      * src/qemu/qemu_monitor.h (qemuMonitorGetBalloonInfo): Likewise.
      * src/qemu/qemu_monitor_text.h (qemuMonitorTextGetBalloonInfo):
      Likewise.
      * src/qemu/qemu_monitor_text.c (qemuMonitorTextGetBalloonInfo):
      Likewise.
      * src/qemu/qemu_monitor_json.h (qemuMonitorJSONGetBalloonInfo):
      Likewise.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONGetBalloonInfo):
      Likewise.
      * src/qemu/qemu_driver.c (qemudDomainGetInfo)
      (qemuDomainGetXMLDesc): Likewise.
      * src/uml/uml_conf.c (umlBuildCommandLine): Likewise.
      4888f0fb
  13. 06 3月, 2012 2 次提交
    • L
      conf: parse/format type='hostdev' network interfaces · 3b1c191f
      Laine Stump 提交于
      This is the new interface type that sets up an SR-IOV PCI network
      device to be assigned to the guest with PCI passthrough after
      initializing some network device-specific things from the config
      (e.g. MAC address, virtualport profile parameters). Here is an example
      of the syntax:
      
        <interface type='hostdev' managed='yes'>
          <source>
            <address type='pci' domain='0' bus='0' slot='4' function='3'/>
          </source>
          <mac address='00:11:22:33:44:55'/>
          <address type='pci' domain='0' bus='0' slot='7' function='0'/>
        </interface>
      
      This would assign the PCI card from bus 0 slot 4 function 3 on the
      host, to bus 0 slot 7 function 0 on the guest, but would first set the
      MAC address of the card to 00:11:22:33:44:55.
      
      NB: The parser and formatter don't care if the PCI card being
      specified is a standard single function network adapter, or a virtual
      function (VF) of an SR-IOV capable network adapter, but the upcoming
      code that implements the back end of this config will work *only* with
      SR-IOV VFs. This is because modifying the mac address of a standard
      network adapter prior to assigning it to a guest is pointless - part
      of the device reset that occurs during that process will reset the MAC
      address to the value programmed into the card's firmware.
      
      Although it's not supported by any of libvirt's hypervisor drivers,
      usb network hostdevs are also supported in the parser and formatter
      for completeness and consistency. <source> syntax is identical to that
      for plain <hostdev> devices, except that the <address> element should
      have "type='usb'" added if bus/device are specified:
      
        <interface type='hostdev'>
          <source>
            <address type='usb' bus='0' device='4'/>
          </source>
          <mac address='00:11:22:33:44:55'/>
        </interface>
      
      If the vendor/product form of usb specification is used, type='usb'
      is implied:
      
        <interface type='hostdev'>
          <source>
            <vendor id='0x0012'/>
            <product id='0x24dd'/>
          </source>
          <mac address='00:11:22:33:44:55'/>
        </interface>
      
      Again, the upcoming patch to fill in the backend of this functionality
      will log an error and fail with "Unsupported Config" if you actually
      try to assign a USB network adapter to a guest using <interface
      type='hostdev'> - just use a standard <hostdev> entry in that case
      (and also for single-port PCI adapters).
      3b1c191f
    • L
      conf: make hostdev info a separate object · 29293930
      Laine Stump 提交于
      In order to allow for a virDomainHostdevDef that uses the
      virDomainDeviceInfo of a "higher level" device (such as a
      virDomainNetDef), this patch changes the virDomainDeviceInfo in the
      HostdevDef into a virDomainDeviceInfoPtr. Rather than adding checks
      all over the code to check for a null info, we just guarantee that it
      is always valid. The new function virDomainHostdevDefAlloc() allocates
      a virDomainDeviceInfo and plugs it in, and virDomainHostdevDefFree()
      makes sure it is freed.
      
      There were 4 places allocating virDomainHostdevDefs, all of them
      parsers of one sort or another, and those have all had their
      VIR_ALLOC(hostdev) changed to virDomainHostdevDefAlloc(). Other than
      that, and the new functions, all the rest of the changes are just
      mechanical removals of "&" or changing "." to "->".
      29293930
  14. 04 2月, 2012 1 次提交
  15. 02 2月, 2012 1 次提交
  16. 31 1月, 2012 1 次提交
  17. 30 1月, 2012 1 次提交
  18. 28 1月, 2012 1 次提交
  19. 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
  20. 22 11月, 2011 1 次提交
    • E
      conf: don't modify cpu set string during parsing · 693d22d4
      Eric Blake 提交于
      None of the callers cared if str was updated to point to the next
      byte after the parsed cpuset; simplifying this results in quite
      a few code simplifications.  Additionally, virCPUDefParseXML was
      strdup()'ing a malloc()'d string; avoiding a memory copy resulted
      in less code.
      
      * src/conf/domain_conf.h (virDomainCpuSetParse): Alter signature.
      * src/conf/domain_conf.c (virDomainCpuSetParse): Don't modify str.
      (virDomainVcpuPinDefParseXML, virDomainDefParseXML): Adjust
      callers.
      * src/conf/cpu_conf.c (virCPUDefParseXML): Likewise.
      * src/xen/xend_internal.c (sexpr_to_xend_topology): Likewise.
      * src/xen/xm_internal.c (xenXMDomainPinVcpu): Likewise.
      * src/xenxs/xen_sxpr.c (xenParseSxpr): Likewise.
      * src/xenxs/xen_xm.c (xenParseXM): Likewise.
      693d22d4
  21. 03 11月, 2011 1 次提交
    • D
      Allow multiple consoles per virtual guest · 0873b688
      Daniel P. Berrange 提交于
      While Xen only has a single paravirt console, UML, and
      QEMU both support multiple paravirt consoles. The LXC
      driver can also be trivially made to support multiple
      consoles. This patch extends the XML to allow multiple
      <console> elements in the XML. It also makes the UML
      and QEMU drivers support this config.
      
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Allow
        multiple <console> devices
      * src/lxc/lxc_driver.c, src/xen/xen_driver.c,
        src/xenxs/xen_sxpr.c, src/xenxs/xen_xm.c: Update for
        internal API changes
      * src/security/security_selinux.c, src/security/virt-aa-helper.c:
        Only label consoles that aren't a copy of the serial device
      * src/qemu/qemu_command.c, src/qemu/qemu_driver.c,
        src/qemu/qemu_process.c, src/uml/uml_conf.c,
        src/uml/uml_driver.c: Support multiple console devices
      * tests/qemuxml2xmltest.c, tests/qemuxml2argvtest.c: Extra
        tests for multiple virtio consoles. Set QEMU_CAPS_CHARDEV
        for all console /channel tests
      * tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-auto.args,
        tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.args
        tests/qemuxml2argvdata/qemuxml2argv-console-virtio.args: Update
        for correct chardev syntax
      * tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.args,
        tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.xml: New
        test file
      0873b688
  22. 14 10月, 2011 1 次提交
    • E
      build: add compiler attributes to virUUIDParse · 430156cf
      Eric Blake 提交于
      Coverity complained that most, but not all, clients of virUUIDParse
      were checking for errors.  Silence those coverity warnings by
      explicitly marking the cases where we trust the input, and fixing
      one instance that really should have been checking.  In particular,
      this silences a rather large percentage of the warnings I saw on my
      most recent Coverity analysis run.
      
      * src/util/uuid.h (virUUIDParse): Enforce rules.
      * src/util/uuid.c (virUUIDParse): Drop impossible check; at least
      Coverity will detect if we break rules and pass NULL.
      * src/xenapi/xenapi_driver.c (xenapiDomainCreateXML)
      (xenapiDomainLookupByID, xenapiDomainLookupByName)
      (xenapiDomainDefineXML): Ignore return when we trust data source.
      * src/vbox/vbox_tmpl.c (nsIDtoChar, vboxIIDToUUID_v3_x)
      (vboxCallbackOnMachineStateChange)
      (vboxCallbackOnMachineRegistered, vboxStoragePoolLookupByName):
      Likewise.
      * src/node_device/node_device_hal.c (gather_system_cap): Likewise.
      * src/xenxs/xen_sxpr.c (xenParseSxpr): Check for errors.
      430156cf
  23. 13 10月, 2011 2 次提交
    • P
      xen: Return tap2 for tap2 disks · c490b469
      Philipp Hahn 提交于
      For some versions of Xen the difference between "tap" and "tap2" is
      important. When converting back from xen-sxpr to libvirt-xml, that
      information is lost, which breaks re-defining the domain using that
      data.
      
      Explicitly return "tap2" for disks defined as "device/tap2".
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      c490b469
    • P
      xen: fix PyGrub boot device order · c2969ec7
      Philipp Hahn 提交于
      When PyGrub is used as the bootloader in Xen, it gets passed the first
      bootable disk. Xend supports a "bootable"-flag for this, which isn't
      explicitly supported by libvirt.
      When converting libvirt-xml to xen-sxpr the "bootable"-flag gets
      implicitly set by xen.xend.XenConfig.device_add() for the first disk
      (marked as "Compat hack -- mark first disk bootable").
      When converting back xen-sxpr to libvirt-xml, the disks are returned in
      the internal order used by Xend ignoring the "bootable"-flag, which
      loses the original order. When the domain is then re-defined, the order
      of disks is changed, which breaks PyGrub, since a different disk gets
      passed.
      
      When converting xen-sxpr to libvirt-xml, use the "bootable"-flag to
      determine the first disk.
      
      This isn't perfect, since several disks can be marked as bootable using
      the Xend-API, but that is not supported by libvirt. In all known cases
      relevant to libvirt exactly one disk is marked as bootable.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      c2969ec7
  24. 11 10月, 2011 2 次提交
    • G
      xen_xs: Guard against set but empty kernel argument · dca1a6b4
      Guido Günther 提交于
      On xen 4.1 I observed configurations that look like:
      
      (image
          (hvm
              (kernel '')
              (loader '/foo/bar')
      ))
      
      The kernel element is there but unset. This leads to an empty <kernel/>
      element in the XML and even worse makes us skip the boot order parsing
      and therefore not emit a <boot device='$dev>'/> element which breaks CD
      booting.
      dca1a6b4
    • G
      xen: add error handling to UUID parsing · c5d2984c
      Guido Günther 提交于
      otherwise a missing UUID in a domain config just shows:
      
      error: An error occurred, but the cause is unknown
      
      Now we have:
      
      error: configuration file syntax error: config value uuid was missing
      c5d2984c
  25. 07 10月, 2011 1 次提交
  26. 05 9月, 2011 2 次提交
    • E
      snapshot: reject transient disks where code is not ready · e91d27ee
      Eric Blake 提交于
      The previous patch introduced new config, but if a hypervisor does
      not support that new config, someone can write XML that does not
      behave as documented.  This prevents some of those cases by
      explicitly rejecting transient disks for several hypervisors.
      
      Disk snapshots will require a new flag to actually affect a snapshot
      creation, so there's not much to reject there.
      
      * src/qemu/qemu_command.c (qemuBuildDriveStr): Reject transient
      disks for now.
      * src/libxl/libxl_conf.c (libxlMakeDisk): Likewise.
      * src/xenxs/xen_sxpr.c (xenFormatSxprDisk): Likewise.
      * src/xenxs/xen_xm.c (xenFormatXMDisk): Likewise.
      e91d27ee
    • P
      Fix localtime handling for Xen-PV domains · 8be115ff
      Philipp Hahn 提交于
      At least Xen-3.4.3 translates the /vm/localtime SXPR value to
      /domain/platform/localtime and /domain/image/{linux,hvm}/localtime when
      the domain is defined.  When reading back that information libvirt only
      handles HVM domains, but not PV domains: This results in libvirtd always
      returning
          <clock offset="utc"/>
      while Xend used (localtime 1).
      
      For PV domains use /domain/image/linux/localtime.
      8be115ff
  27. 24 8月, 2011 1 次提交
    • E
      maint: fix comment typos · 3a52b864
      Eric Blake 提交于
      * src/qemu/qemu_driver.c (qemuDomainSaveInternal): Fix typo.
      * src/conf/domain_event.c (virDomainEventDispatchMatchCallback):
      Likewise.
      * daemon/libvirtd.c (daemonRunStateInit): Likewise.
      * src/lxc/lxc_container.c (lxcContainerChildMountSort): Likewise.
      * src/util/virterror.c (virCopyError, virRaiseErrorFull): Likewise.
      * src/xenxs/xen_sxpr.c (xenParseSxprSound): Likewise.
      3a52b864
  28. 23 8月, 2011 1 次提交
  29. 29 7月, 2011 1 次提交
    • 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
  30. 14 7月, 2011 1 次提交
    • E
      build: avoid ATTRIBUTE_UNUSED in headers · 088473b2
      Eric Blake 提交于
      The compiler might optimize based on our declaration that something
      is unused.  Putting that declaration in the header risks getting
      out of sync with the actual implementation, so it belongs better
      only in the .c files.  We were mostly compliant, and a new syntax
      check will help us in the future.
      
      * cfg.mk (sc_avoid_attribute_unused_in_header): New syntax check.
      * src/nodeinfo.h (nodeGetCPUStats, nodeGetMemoryStats): Delete
      attribute already present in .c file.
      * src/qemu/qemu_domain.h (qemuDomainEventFlush): Likewise.
      * src/util/virterror_internal.h (virReportErrorHelper): Parameters
      are actually used by .c file.
      * src/xenxs/xen_sxpr.h (xenFormatSxprDisk): Adjust prototype.
      * src/xenxs/xen_sxpr.c (xenFormatSxprDisk): Delete unused argument.
      (xenFormatSxpr): Adjust caller.
      * src/xen/xend_internal.c (xenDaemonAttachDeviceFlags)
      (xenDaemonUpdateDeviceFlags): Likewise.
      Suggested by Daniel Veillard.
      088473b2
  31. 11 7月, 2011 1 次提交
    • J
      Do not drop kernel cmdline for xen pv domains · eb314315
      Jim Fehlig 提交于
      Kernel cmdline args can be passed to xen pv domains even when a
      bootloader is specified.  The current config-to-sxpr mapping
      ignores cmdline when bootloader is present.
      
      Since the xend sub-driver is used with many xen toolstack versions,
      this patch takes conservative approach of adding an else block to
      existing !def->os.bootloader, and only appends sxpr if def->os.cmdline
      is non-NULL.
      
      V2: Fix existing testcase broken by this patch and add new testcases
      eb314315
  32. 24 6月, 2011 1 次提交
    • E
      maint: typo fixes · acb31cf5
      Eric Blake 提交于
      * src/xenxs/xen_sxpr.c (xenParseSxprPCI): Comment fix.
      * tests/object-locking.ml (driverTables): Likewise.
      * tests/testutils.c (virtTestDifferenceBin): Likewise.
      acb31cf5
  33. 15 6月, 2011 1 次提交
    • D
      support for Xen HVM Viridian (Hyper-V) enlightenment interface · c4bd6d96
      Daniel Gollub 提交于
      Introduce libvirt support for Xen HVM Viridian (Hyper-V) enlightenment
      interface guest feature.
      
       src/conf/domain_conf.c     |    3 ++-
       src/conf/domain_conf.h     |    1 +
       src/xen/xen_hypervisor.c   |   11 +++++++++++
       src/xenapi/xenapi_driver.c |    2 ++
       src/xenapi/xenapi_utils.c  |    2 ++
       src/xenxs/xen_sxpr.c       |    4 ++++
       src/xenxs/xen_xm.c         |   12 +++++++++++-
       7 files changed, 33 insertions(+), 2 deletions(-)
      c4bd6d96
  34. 12 5月, 2011 1 次提交
    • L
      libvirt,logging: cleanup VIR_XXX0() · b65f37a4
      Lai Jiangshan 提交于
      These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead.
      
      How do these coversions works? The magic is using the gcc extension of ##.
      When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to
      avoid compile error.
      
      example: origin				after CPP
      	high_level_api("%d", a_int)	low_level_api("%d", a_int)
      	high_level_api("a  string")	low_level_api("a  string")
      
      About 400 conversions.
      
      8 special conversions:
      VIR_XXXX0("") -> VIR_XXXX("msg") (avoid empty format) 2 conversions
      VIR_XXXX0(string_literal_with_%) -> VIR_XXXX(%->%%) 0 conversions
      VIR_XXXX0(non_string_literal) -> VIR_XXXX("%s", non_string_literal)
        (for security) 6 conversions
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      b65f37a4
  35. 11 5月, 2011 1 次提交
    • P
      xen: parse and generate hpet item in sxpr · e547e44c
      Paolo Bonzini 提交于
      Recent versions of Xen disable the virtual HPET by default.  This is
      usually more precise because tick policies are not implemented for
      the HPET in Xen.  However, there may be several reasons to control
      the HPET manually: 1) to test the emulation; 2) because distros may
      provide the knob while leaving the default to "enabled" for compatibility
      reasons.
      
      This patch provides support for the hpet item in both sexpr and xm
      formats, and translates it to a <timer> element.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e547e44c
  36. 06 5月, 2011 1 次提交
    • E
      maint: rename virBufferVSprintf to virBufferAsprintf · 68ea80cf
      Eric Blake 提交于
      We already have virAsprintf, so picking a similar name helps for
      seeing a similar purpose.  Furthermore, the prefix V before printf
      generally implies 'va_list', even though this variant was '...', and
      the old name got in the way of adding a new va_list version.
      
      global rename performed with:
      
      $ git grep -l virBufferVSprintf \
        | xargs -L1 sed -i 's/virBufferVSprintf/virBufferAsprintf/g'
      
      then revert the changes in ChangeLog-old.
      68ea80cf