1. 19 4月, 2011 2 次提交
    • M
      Update and sort msg_gen_function list and mark unmarked messages · 78ef49ea
      Matthias Bolte 提交于
      Inspired by Eric Blake
      78ef49ea
    • E
      phyp: another simplification · a35af32c
      Eric Blake 提交于
      Rather than copying and pasting lots of code, factor it into a
      single helper function.
      
      This commit adds a warning if tighter integer parsing would fail
      due to any stray bytes after the number, but should not change
      any behavior other than the bug fix for phypNumDomainsGeneric
      looking only at numeric lines.
      
      * src/phyp/phyp_driver.c (phypExecInt): New function.
      (phypGetVIOSPartitionID, phypNumDomainsGeneric, phypGetLparID)
      (phypGetLparMem, phypGetLparCPUGeneric, phypGetRemoteSlot)
      (phypGetVIOSNextSlotNumber, phypAttachDevice)
      (phypGetStoragePoolSize, phypStoragePoolNumOfVolumes)
      (phypNumOfStoragePools, phypInterfaceDestroy)
      (phypInterfaceDefineXML, phypInterfaceLookupByName)
      (phypInterfaceIsActive, phypNumOfInterfaces): Use it.
      (phypNumDomainsGeneric): Correctly find numeric line.
      a35af32c
  2. 18 4月, 2011 10 次提交
    • E
      maint: ignore built file · d80740b3
      Eric Blake 提交于
      * .gitignore: Add exemption for hashtest.
      d80740b3
    • D
      build: fix qemu build failure in previous patch · ce3ae1b0
      Daniel P. Berrange 提交于
      This last minute addition caused a build failure
      
      cc1: warnings being treated as errors
      qemu/qemu_process.c: In function 'qemuProcessHandleWatchdog':
      qemu/qemu_process.c:436:34: error: ignoring return value of 'virDomainObjUnref', declared with attribute warn_unused_result [-Wunused-result]
      make[3]: *** [libvirt_driver_qemu_la-qemu_process.lo] Error 1
      ce3ae1b0
    • D
      Change some variable names to follow standard in daemon dispatcher · bf4883ca
      Daniel P. Berrange 提交于
      Replace some occurrances of
      
        virDomainPtr domain;
        virNetworkPtr network;
      
      With
      
        virDomainPtr dom;
        virNetworkPtr net;
      
      * daemon/remote.c: Fix variable naming to follow standard
      bf4883ca
    • D
      Write error check conditionals in more compact form for dispatcher · 05a6283c
      Daniel P. Berrange 提交于
      Replace cases of
      
           type = virConnectGetType(conn);
           if (type == NULL)
               goto cleanup;
      
      With
      
           if (!(type = virConnectGetType(conn)))
               goto cleanup;
      
      * daemon/remote.c: Write error checks in compat form
      05a6283c
    • D
      Remove curly braces on all single-line conditional jumps in dispatcher · 55c71a26
      Daniel P. Berrange 提交于
      Replace all occurrances of
      
         if (....) {
            goto cleanup;
         }
      
      With
      
         if (.....)
            goto cleanup;
      
      to save one line of code
      
      * daemon/remote.c: Remove curly braces on single line conditionals
      55c71a26
    • D
      Fix checking of return codes in dispatcher · c19295e5
      Daniel P. Berrange 提交于
      The libvirt APIs reserve any negative value for indicating an
      error. Thus checks
      
          if (virXXXX() == -1)
      
      Should instead be
      
          if (virXXXX() < 0)
      
      * daemon/remote.c: s/ == -1/ < 0/
      c19295e5
    • D
      Merge all returns paths from dispatcher into single path · 158ba873
      Daniel P. Berrange 提交于
      The dispatcher functions have numerous places where they
      return to the caller. This leads to duplicated cleanup
      code, often resulting in memory leaks. It makes it harder
      to ensure that errors are dispatched before freeing objects,
      which may overwrite the original error.
      
      The standard pattern is now
      
          remoteDispatchXXX(...) {
              int rv = -1;
      
              ....
              if (XXX < 0)
                goto cleanup;
              ...
              if (XXXX < 0)
                goto cleanup;
              ...
      
              rv = 0;
          cleanup:
              if (rv < 0)
                 remoteDispatchError(rerr);
              ...free all other stuff..
              return rv;
          }
      
      * daemon/remote.c: Centralize all cleanup paths
      * daemon/stream.c: s/remoteDispatchConnError/remoteDispatchError/
      * daemon/dispatch.c, daemon/dispatch.h: Replace
        remoteDispatchConnError with remoteDispatchError
        removing unused virConnectPtr
      158ba873
    • A
      Experimental libvirtd upstart job · 16d6b0d8
      Alan Pevec 提交于
      To install it, disable libvirtd sysv initscript:
          chkconfig libvirtd off
          service libvirtd stop
      
      and enable libvirtd upstart job:
          cp  /usr/share/doc/libvirt-*/libvirtd.upstart \
              /etc/init/libvirtd.conf
          initctl reload-configuration
          initctl start libvirtd
      
      Test:
          initctl status libvirtd
      libvirtd start/running, process 3929
          killall -9 libvirtd
          initctl status libvirtd
      libvirtd start/running, process 4047
      
      I looked into the possibility to use the upstart script from Ubuntu or
      at least getting inspiration from it but that's not possible. "expect
      daemon" is a nice thing but it only works if the process is defined with
      exec stanza instead of script ... no script. Unfortunately, with exec
      stanza environment variables can only be set within upstart script
      (i.e., configuration in /etc/sysconfig/libvirtd can't work). Hence, we
      need to use script stanza, source sysconfig, and execute libvirtd
      without --daemon. For similar reasons we can't use limit stanza and need
      to handle DAEMON_COREFILE_LIMIT in job's script.
      16d6b0d8
    • W
      enhance processWatchdogEvent() · b060d2e5
      Wen Congyang 提交于
      This patch does the following two things:
      1. hold an extra reference while handling watchdog event
         If the domain is not persistent, and qemu quits unexpectedly before
         calling processWatchdogEvent(), vm will be freed and the function
         processWatchdogEvent() will be dangerous.
      
      2. unlock qemu driver and vm before returning from processWatchdogEvent()
         When the function processWatchdogEvent() failed, we only free wdEvent,
         but forget to unlock qemu driver and vm, free dumpfile.
      b060d2e5
    • W
      qemu: avoid qemu_driver being unlocked twice when virThreadPoolNew() failed · 847efb32
      Wen Congyang 提交于
      We do not lock qemu_driver when calling virThreadPoolNew(). If it failed,
      we will unlock qemu_driver. It is dangerous.
      
      We may use this pool during auto starting domains. So we must create it before
      calling qemuAutostartDomains(). Otherwise, libvirtd will crash.
      847efb32
  3. 17 4月, 2011 3 次提交
  4. 16 4月, 2011 15 次提交
    • J
      tests: Unit tests for internal hash APIs · b0d28307
      Jiri Denemark 提交于
      This is a basic set of tests for testing removals of hash entries during
      iteration.
      b0d28307
    • W
      build: include esx_vi.generated.* into dist file · ffbdf3e1
      Wen Congyang 提交于
      commit d4601696 introduces two more generated files: esx_vi.generated.h
      and esx_vi.generated.h. But we do not include them into dist file.
      It will break building if using dist file to build.
      ffbdf3e1
    • E
      tests: test recent virsh option parsing changes · c2d92f6a
      Eric Blake 提交于
      * tests/virsh-optparse: New file.
      * tests/Makefile.am (test_scripts): Use it.
      c2d92f6a
    • E
      virsh: fix regression in parsing optional integer · b9973f52
      Eric Blake 提交于
      Regression introduced in 0.8.5, commit c1564268.  The command
      'virsh freecell 0' quit working when it changed from an optional
      string to an optional integer.
      
      This patch introduces a slight change that specifying an option
      twice is now detected as an error.  It also changes things so
      that a command that has more than 1 required option will not
      complain about missing options if one but not all of the options
      were given in long format, as in 'virsh vol-create --pool p file',
      as well as making positional parsing work for all optional
      options (each positional argument is associated with the earliest
      option that has not yet been seen by name).
      
      Optional boolean options can appear before required argument
      options, because they don't affect positional argument parsing,
      and obviously a required boolean option makes no sense.
      
      Technically, this patch renders VSH_OT_STRING and VSH_OT_DATA
      redundant; but cleaning that up can be a separate patch.
      
      No command should ever need more than 32 options, right? :)
      
      * tools/virsh.c (vshCmddefGetData, vshCmddefGetOption)
      (vshCommandCheckOpts): Alter parameters to use bitmaps.
      (vshCmddefOptParse): New function.
      (vshCommandParse): Update for better handling of positional
      arguments.
      (vshCmddefHelp): Allow unit tests to validate options.
      b9973f52
    • E
      virsh: list required options first · 6b75a1a5
      Eric Blake 提交于
      The current state of virsh parsing is that:
      
      $ virsh vol-info /path/to/image
      $ virsh vol-info --pool default /path/to/image
      $ virsh vol-info --pool default --vol /path/to/image
      
      all lookup the volume by path (technically, the last two also attempt
      a name lookup within a pool, whereas the first skips that step, but
      the end result is the same); meanwhile:
      
      $ virsh vol-info default /path/to/image
      
      complains about unexpected data.  Why?  Because the --pool option is
      optional, so default was parsed as the --vol argument, and
      /path/to/image.img doesn't match up with any remaining options that
      require an argument.  For proof, note that:
      
      $ virsh vol-info default --vol /path/to/image
      
      complains about looking up 'default' - the parser mis-associated both
      arguments with --vol.  Given the above, the only way to specify pool
      is with an explicit "--pool" argument (you can't specify it
      positionally).  However, named arguments can appear in any order, so:
      
      $ virsh vol-info /path/to/image --pool default
      $ virsh vol-info --vol /path/to/image --pool default
      
      have also always worked.  Therefore, this patch has no functional
      change on vol-info option parsing, but only on 'virsh help vol-info'
      synopsis layout.  However, it also allows the next patch to 1) enforce
      that required options are always first (without this patch, the next
      patch would fail the testsuite), and 2) allow the user to omit the
      "--pool" argument.  That is, the next patch makes it possible to do:
      
      $ virsh vol-info /path/to/image default
      
      which to date was not possible.
      
      * tools/virsh.c (opts_vol_create_from, opts_vol_clone)
      (opts_vol_upload, opts_vol_download, opts_vol_delete)
      (opts_vol_wipe, opts_vol_info, opts_vol_dumpxml, opts_vol_key)
      (opts_vol_path): List optional pool parameter after required
      arguments.
      6b75a1a5
    • E
      phyp: avoid memory leaks in command values · 0bd34a9d
      Eric Blake 提交于
      * src/phyp/phyp_driver.c (phypExecBuffer): New function. Use it
      throughout file for less code, and for plugging a few leaks.
      0bd34a9d
    • E
      phyp: use consistent return string handling · a1b46e71
      Eric Blake 提交于
      Use the name 'ret' for all phypExec results, to make it easier
      to wrap phypExec.  Don't allow a possibly NULL ret through printf.
      
      * src/phyp/phyp_driver.c (phypBuildVolume, phypDestroyStoragePool)
      (phypBuildStoragePool, phypBuildLpar): Avoid NULL dereference.
      (phypInterfaceDestroy): Avoid redundant free.
      (phypVolumeLookupByPath, phypVolumeGetPath): Use consistent
      naming.
      a1b46e71
    • E
      phyp: prefer memcpy over memmove when legal · e00c892f
      Eric Blake 提交于
      * src/phyp/phyp_driver.c (phypUUIDTable_AddLpar)
      (phypGetLparUUID, phypGetStoragePoolUUID, phypVolumeGetXMLDesc)
      (phypGetStoragePoolXMLDesc): Use faster method.
      e00c892f
    • E
      phyp: use consistent style for labels · f6178522
      Eric Blake 提交于
      * src/phyp/phyp_driver.c: Match label style of rest of project.
      (phypExec, phypUUIDTable_Pull): Drop an extra label.
      f6178522
    • E
      phyp: more return handling cleanup · 444306d5
      Eric Blake 提交于
      * src/phyp/phyp_driver.c (phypInterfaceDestroy)
      (phypInterfaceDefineXML, phypInterfaceLookupByName)
      (phypInterfaceIsActive, phypListInterfaces, phypNumOfInterfaces):
      Clean up return handling of recent additions.
      444306d5
    • E
      phyp: avoid memory leak on failure · 8f03c6e8
      Eric Blake 提交于
      * src/phyp/phyp_driver.c (phypUUIDTable_Init): Avoid memory leak
      on error.
      8f03c6e8
    • E
      phyp: avoid a logic bug · ef6147c4
      Eric Blake 提交于
      Ever since commit ebc46f, the destroy function built two command
      variants but only used one.  I went with the variant that matches
      the idiom used in the counterpart of phypBuildStoragePool.
      
      * src/phyp/phyp_driver.c (phypDestroyStoragePool): Avoid
      clobbering cmd.  Fix error message typo.
      ef6147c4
    • E
      maint: use lighter-weight function for straight appends · dbe3bad9
      Eric Blake 提交于
      It costs quite a few processor cycles to go through printf parsing
      just to determine that we only meant to append.
      
      * src/xen/xend_internal.c (xend_op_ext): Consolidate multiple
      printfs into one.
      * src/qemu/qemu_command.c (qemuBuildWatchdogDevStr)
      (qemuBuildUSBInputDevStr, qemuBuildSoundDevStr)
      (qemuBuildSoundCodecStr, qemuBuildVideoDevStr): Likewise.
      (qemuBuildCpuArgStr, qemuBuildCommandLine): Prefer virBufferAdd
      over virBufferVsprintf for trivial appends.
      * src/phyp/phyp_driver.c (phypExec, phypUUIDTable_Push)
      (phypUUIDTable_Pull): Likewise.
      * src/conf/nwfilter_conf.c (macProtocolIDFormatter)
      (arpOpcodeFormatter, formatIPProtocolID, printStringItems)
      (virNWFilterPrintStateMatchFlags, virNWIPAddressFormat)
      (virNWFilterDefFormat): Likewise.
      * src/security/virt-aa-helper.c (main): Likewise.
      * src/util/sexpr.c (sexpr2string): Likewise.
      * src/xenxs/xen_sxpr.c (xenFormatSxprChr): Likewise.
      * src/xenxs/xen_xm.c (xenFormatXMDisk): Likewise.
      dbe3bad9
    • M
      esx: Fix gcc 4.6 warning about initialized but unused variables · 1afaafe3
      Matthias Bolte 提交于
      This warnings come from partly generated code. Therefore, the best
      solution is to mark them as potentially being unused using the
      ATTRIBUTE_UNUSED macro. This is suggested by the gcc documentation.
      
      Reported by Christophe Fergeau
      1afaafe3
    • A
      libvirt-guests: implement START_DELAY · d934bd0a
      Alexander Todorov 提交于
      Allow libvirt-guests to stage a delay between guest startups,
      to avoid system load caused by back-to-back startup.
      d934bd0a
  5. 15 4月, 2011 8 次提交
    • E
      maint: silence cppi warnings · e6923526
      Eric Blake 提交于
      * src/nodeinfo.c (linuxNodeInfoCPUPopulate): Fix indentation of
      last patch.
      e6923526
    • L
      network: truncate bridges' dummy tap device names to IFNAMSIZ (15) chars · 020ad8d1
      Laine Stump 提交于
      This patch addresses:
      
         https://bugzilla.redhat.com/show_bug.cgi?id=694382
      
      In order to give each libvirt-created bridge a fixed MAC address,
      commit 5754dbd5, added code to create
      a dummy tap device with guaranteed lowest MAC address and attach it to
      the bridge. This tap device was given the name "${bridgename}-nic".
      However, an interface device name must be IFNAMSIZ (15) characters or
      less, so a valid ${bridgename} such as "verylongname123" (15
      characters) would lead to an invalid tap device name
      ("verylongname123-nic" - 19 characters), and that in turn led to a
      failure to bring up the network.
      
      The solution is to shorten the part of the original name used to
      generate the tap device name. However, simply truncating it is
      insufficient, because the last few characters of an interface name are
      often a number used to indicate one of a list of several similar
      devices (for example, "verylongname123", "verylongname124", etc) and
      simple truncation would lead to duplicate names (eg "verlongnam-nic"
      and "verylongnam-nic"). So instead we take the first 8 characters of
      $bridgename ("verylong" in the example), add on the final 3 bytes
      ("123"), then add "-nic" (so "verylong123-nic").  Not pretty, but it
      is much more likely to generate a unique name, and is reproducible
      (unlike, say, a random number).
      020ad8d1
    • S
      ppc: Enable starting of Qemu VMs on ppc host · d21f9d5a
      Stefan Berger 提交于
      Due to differences in /proc/cpuinfo the parsing of the cpu data is
      different between architectures. On PPC /proc/cpuinfo looks like this:
      
      [original formatting with tabs]
      
      processor    : 0
      cpu          : PPC970MP, altivec supported
      clock        : 2297.700000MHz
      revision     : 1.1 (pvr 0044 0101)
      
      processor    : 1
      cpu          : PPC970MP, altivec supported
      clock        : 2297.700000MHz
      revision     : 1.1 (pvr 0044 0101)
      
      [..]
      
      timebase     : 14318000
      platform     : pSeries
      model        : IBM,8844-AC1
      machine      : CHRP IBM,8844-AC1
      
      The patch adapts the parsing of the data found in /proc/cpuinfo.
      
      /sys/devices/system/cpu/cpuX/topology/physical_package_id also
      always returns -1. Check for it on ppc and make it '0' if found negative.
      d21f9d5a
    • S
      Migrate VMs between different-endianess hosts · cf2145d5
      Stefan Berger 提交于
      This patch enables the migration of Qemu VMs between hosts of different endianess. I tested this by migrating a i686 VM between a x86 and ppc64 host.
      
      I am converting the 'int's in the VM's state header to uint32_t assuming this doesn't break compatibility with existing deployments other than Linux.
      cf2145d5
    • C
      Fix gcc 4.6 warnings in vbox_tmpl.c · c59f3d8d
      Christophe Fergeau 提交于
      c59f3d8d
    • C
      Fix gcc 4.6 warnings · 454e50be
      Christophe Fergeau 提交于
      gcc 4.6 warns when a variable is initialized but isn't used afterwards:
      
      vmware/vmware_driver.c:449:18: warning: variable 'vmxPath' set but not used [-Wunused-but-set-variable]
      
      This patch fixes these warnings. There are still 2 offending files:
      
      - vbox_tmpl.c: the variable is used inside an #ifdef and is assigned several
        times outside of #ifdef. Fixing the warning would have required wrapping
        all the assignment inside #ifdef which hurts readability.
      
      vbox/vbox_tmpl.c: In function 'vboxAttachDrives':
      vbox/vbox_tmpl.c:3918:22: warning: variable 'accessMode' set but not used [-Wunused-but-set-variable]
      
      - esx_vi_types.generated.c: the name implies it's generated code and I
        didn't want to dive into the code generator
      
      esx/esx_vi_types.generated.c: In function 'esxVI_FileQueryFlags_Free':
      esx/esx_vi_types.generated.c:1203:3: warning: variable 'item' set but not used [-Wunused-but-set-variable]
      454e50be
    • M
      Introduce virDomainChrDefNew() · 2ac455c4
      Michal Novotny 提交于
      Make: passed
      Make check: passed
      Make syntax-check: passed
      
      this is the commit to introduce the function to create new character
      device definition for the domain as advised by Cole Robinson
      <crobinso@redhat.com>.
      
      The function is used on the relevant places and also new tests has
      been added.
      Signed-off-by: NMichal Novotny <minovotn@redhat.com>
      2ac455c4
    • M
      Spice: support audio, images and stream compression · abb1570e
      Michal Privoznik 提交于
      This extends the SPICE XML to allow variable compression settings for audio,
      images and streaming:
          <graphics type='spice' port='5901' tlsPort='-1' autoport='yes'>
              <image compression='auto_glz'/>
              <jpeg compression='auto'/>
              <zlib compression='auto'/>
              <playback compression='on'/>
          </graphics>
      
      All new elements are optional.
      abb1570e
  6. 14 4月, 2011 2 次提交