1. 23 5月, 2013 1 次提交
  2. 21 5月, 2013 1 次提交
  3. 02 5月, 2013 1 次提交
    • M
      virutil: Move string related functions to virstring.c · 7c9a2d88
      Michal Privoznik 提交于
      The source code base needs to be adapted as well. Some files
      include virutil.h just for the string related functions (here,
      the include is substituted to match the new file), some include
      virutil.h without any need (here, the include is removed), and
      some require both.
      7c9a2d88
  4. 26 4月, 2013 1 次提交
    • L
      conf: put hostdev pci address in a struct · 9f80fc1b
      Laine Stump 提交于
      There will soon be other items related to pci hostdevs that need to be
      in the same part of the hostdevsubsys union as the pci address (which
      is currently a single member called "pci". This patch replaces the
      single member named pci with a struct named pci that contains a single
      member named "addr".
      9f80fc1b
  5. 13 4月, 2013 1 次提交
  6. 11 4月, 2013 3 次提交
  7. 02 4月, 2013 1 次提交
  8. 21 12月, 2012 6 次提交
  9. 19 12月, 2012 1 次提交
  10. 02 11月, 2012 1 次提交
  11. 20 10月, 2012 2 次提交
    • E
      storage: use enum for disk driver type · e5e8d5d0
      Eric Blake 提交于
      Actually use the enum in the domain conf structure.
      
      * src/conf/domain_conf.h (_virDomainDiskDef): Store enum rather
      than string for disk type.
      * src/conf/domain_conf.c (virDomainDiskDefFree)
      (virDomainDiskDefParseXML, virDomainDiskDefFormat)
      (virDomainDiskDefForeachPath): Adjust users.
      * src/xenxs/xen_sxpr.c (xenParseSxprDisks, xenFormatSxprDisk):
      Likewise.
      * src/xenxs/xen_xm.c (xenParseXM, xenFormatXMDisk): Likewise.
      * src/vbox/vbox_tmpl.c (vboxAttachDrives): Likewise.
      * src/libxl/libxl_conf.c (libxlMakeDisk): Likewise.
      e5e8d5d0
    • 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
  12. 21 9月, 2012 1 次提交
  13. 18 9月, 2012 1 次提交
  14. 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
  15. 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
  16. 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
  17. 20 7月, 2012 1 次提交
  18. 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
  19. 28 5月, 2012 1 次提交
  20. 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
  21. 06 4月, 2012 1 次提交
  22. 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
  23. 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
  24. 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
  25. 06 3月, 2012 1 次提交
    • 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
  26. 02 2月, 2012 1 次提交
  27. 28 1月, 2012 1 次提交
  28. 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
  29. 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
  30. 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
  31. 11 10月, 2011 1 次提交
    • 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
  32. 07 10月, 2011 1 次提交