1. 27 10月, 2011 9 次提交
    • D
      Fix typo in virFileAccessibleAs · 838d8c1b
      Daniel P. Berrange 提交于
      * src/util/util.c: s/git_t/gid_t/ in parameter list of virFileAccessibleAs
      838d8c1b
    • A
      lxc: avoid null deref on lxcSetupLoopDevices failure · 3fd2b1e9
      Alex Jia 提交于
      If the function lxcSetupLoopDevices(def, &nloopDevs, &loopDevs) failed,
      the variable loopDevs will keep a initial NULL value, however, the
      function VIR_FORCE_CLOSE(loopDevs[i]) will directly deref it.
      
      This patch also fixes returning a bogous number of devices from
      lxcSetupLoopDevices on an error path.
      
      * rc/lxc/lxc_controller.c: fixed a null pointer dereference.
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      3fd2b1e9
    • A
      lxc: avoid missing '{' in the function · d2dff425
      Alex Jia 提交于
      Cppcheck detected a syntaxError on lxcDomainInterfaceStats.
      
      * src/lxc/lxc_driver.c: fixed missing '{' in the function lxcDomainInterfaceStats.
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      d2dff425
    • E
      qemu: simplify use of HAVE_YAJL · 6889f33e
      Eric Blake 提交于
      Rather than making all clients of monitor commands that are JSON-only
      check whether yajl support was compiled in, it is simpler to just
      avoid setting the capability bit up front if we can't use the capability.
      
      * src/qemu/qemu_capabilities.c (qemuCapsComputeCmdFlags): Only set
      capability bit if we also have yajl library to use it.
      * src/qemu/qemu_driver.c (qemuDomainReboot): Drop #ifdefs.
      * src/qemu/qemu_process.c (qemuProcessStart): Likewise.
      * tests/qemuhelptest.c (testHelpStrParsing): Pass test even
      without yajl.
      * tests/qemuxml2argvtest.c (mymain): Simplify use of json flag.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-*.args:
      Update expected results to match.
      6889f33e
    • E
      snapshot: minor cleanups from reviewing indentation · cfa61a95
      Eric Blake 提交于
      Break some long lines, and use more efficient functions when possible,
      such as relying on virBufferEscapeString to skip output on a NULL arg.
      Ensure that output does not embed newlines, since auto-indent won't
      work in those situations.
      
      * src/conf/domain_conf.c (virDomainTimerDefFormat): Break output lines.
      (virDomainDefFormatInternal, virDomainDiskDefFormat)
      (virDomainActualNetDefFormat, virDomainNetDefFormat)
      (virDomainHostdevDefFormat): Minor cleanups.
      cfa61a95
    • E
      snapshot: simplify indentation of disk encryption xml · 4d8e20f6
      Eric Blake 提交于
      Use auto-indent in more places.
      
      * src/conf/storage_encryption_conf.h (virStorageEncryptionFormat):
      Drop parameter.
      * src/conf/storage_encryption_conf.c (virStorageEncryptionFormat)
      (virStorageEncryptionSecretFormat): Simplify with auto-indent.
      * src/conf/domain_conf.c (virDomainDiskDefFormat): Adjust caller.
      * src/conf/storage_conf.c (virStorageVolTargetDefFormat): Likewise.
      4d8e20f6
    • E
      snapshot: simplify indentation of nwfilter · 46e1a426
      Eric Blake 提交于
      Fixing this involved some refactoring of common code out of
      domain_conf and nwfilter_conf into nwfilter_params.
      
      * src/conf/nwfilter_params.h (virNWFilterFormatParamAttributes):
      Adjust signature.
      * src/conf/nwfilter_params.c (_formatParameterAttrs)
      (virNWFilterFormatParamAttributes): Adjust indentation handling,
      and handle filterref here.
      (formatterParam): Delete unused struct.
      * src/conf/domain_conf.c (virDomainNetDefFormat): Adjust caller.
      * src/conf/nwfilter_conf.c (virNWFilterIncludeDefFormat): Likewise.
      46e1a426
    • E
      storage: avoid null deref on qemu-img failure · c04beb5d
      Eric Blake 提交于
      Detected by Coverity.  Only possible if qemu-img gives bogus output,
      but we might as well be robust.
      
      * src/storage/storage_backend.c
      (virStorageBackendQEMUImgBackingFormat): Check for strstr failure.
      c04beb5d
    • E
      build: avoid RHEL 5 build failure on LXC · 2dee8965
      Eric Blake 提交于
      Per the discussion here, LXC on RHEL 5 makes no sense.
      https://www.redhat.com/archives/libvir-list/2011-September/msg01169.html
      
      * configure.ac (with_lxc): Reject RHEL 5.x LXC as too old.
      2dee8965
  2. 25 10月, 2011 13 次提交
    • E
      build: use gnulib fdatasync · 9cf70dad
      Eric Blake 提交于
      Commit 1726a736 hacked around MacOS' lack of fdatasync, since
      gnulib did not have it at the time.  But now that we use newer
      gnulib, we can avoid the hack.
      
      * bootstrap.conf (gnulib_modules): Add fdatasync.
      * configure.ac (AC_CHECK_FUNCS_ONCE): Drop our own check.
      9cf70dad
    • D
      Add REMOTE_PROC_DOMAIN_EVENT_DISK_CHANGE to remote_protocol-structs · 806d4d81
      Daniel P. Berrange 提交于
      * src/remote_protocol-structs: Add new event
      806d4d81
    • S
      nwfilter: extend schema to support new targets · 552fe4cc
      Stefan Berger 提交于
      Extend the nwfilter schema to support the continue and return targets.
      552fe4cc
    • M
      util: Add virFileAccessibleAs to private symbols · a877575a
      Michal Privoznik 提交于
      Commit 458b7099 introduced this
      function. However it was not added into libvirt_private.syms so
      the compilation may not succeed on some hosts.
      a877575a
    • M
      startupPolicy: Emit event on disk source dropping · baf2ff7e
      Michal Privoznik 提交于
      If a disk source gets dropped because it is not accessible,
      mgmt application might want to be informed about this. Therefore
      we need to emit an event. The event presented in this patch
      is however a bit superset of what written above. The reason is simple:
      an intention to be easily expanded, e.g. on 'user ejected disk
      in guest' events. Therefore, callback gets source string and disk alias
      (which should be unique among a domain) and reason (an integer);
      baf2ff7e
    • M
      qemu: implement startupPolicy · 12ba4322
      Michal Privoznik 提交于
      This patch implements on_missing feature in qemu driver.
      Upon qemu startup process an accessibility of CDROMs
      and floppy disks is checked. The source might get dropped
      if unavailable and on_missing is set accordingly.
      No event is emit thought. Look for follow up patch.
      12ba4322
    • M
      qemu: Move device alias assigning before command line construction · b8fbe5d5
      Michal Privoznik 提交于
      This patch is rather cosmetic as it only moves device alias
      assignation from command line construction just before that.
      However, it is needed in connotation of previous and next patch.
      b8fbe5d5
    • M
      util: Create virFileAccessibleAs function · 458b7099
      Michal Privoznik 提交于
      This function checks if a given path is accessible under
      given uid and gid.
      458b7099
    • M
      conf: Introduce optional startupPolicy attribute for cdrom and floppy · e5a84d74
      Michal Privoznik 提交于
      This attribute says what to do with cdrom (or floppy) if
      the source is missing. It accepts:
      - mandatory - fail if missing for any reason (the default)
      - requisite - fail if missing on boot up, drop if missing on
                    migrate/restore/revert
      - optional  - drop if missing at any start attempt.
      
      However, this patch introduces only XML part of this new
      functionality.
      e5a84d74
    • E
      storage: make previous leak less likely to regress · b1836a25
      Eric Blake 提交于
      Splitting into two functions allows the user to call the right
      function, rather than having to remember that a *Free function is
      an exception to the rule.
      
      * src/conf/storage_conf.h (virStoragePoolSourceClear): New function.
      * src/libvirt_private.syms (storage_conf.h): Export it.
      * src/conf/storage_conf.c (virStoragePoolSourceFree): Split...
      (virStoragePoolSourceClear): ...into new function.
      (virStoragePoolDefFree, virStoragePoolDefParseSourceString):
      Update callers.
      * src/test/test_driver.c (testStorageFindPoolSources): Likewise.
      * src/storage/storage_backend_fs.c
      (virStorageBackendFileSystemNetFindPoolSourcesFunc)
      (virStorageBackendFileSystemNetFindPoolSources): Likewise.
      * src/storage/storage_backend_iscsi.c
      (virStorageBackendISCSIFindPoolSources): Likewise.
      * src/storage/storage_backend_logical.c
      (virStorageBackendLogicalFindPoolSources): Likewise.
      b1836a25
    • E
      storage: plug iscsi memory leak · 79052a76
      Eric Blake 提交于
      Detected by Coverity.  virStoragePoolSourceFree does not free the
      actual passed-in pointer.  A bigger patch would be to rename it
      virStoragePoolSourceClear to match behavior, or even split it into
      two functions depending on needed behavior; but this is the minimal
      fix to the one location out of eight that leaked memory.
      
      * src/storage/storage_backend_iscsi.c
      (virStorageBackendISCSIFindPoolSources): Free memory.
      79052a76
    • E
      waitpid: improve safety · 69d044c0
      Eric Blake 提交于
      Based on a report by Coverity.  waitpid() can leak resources if it
      fails with EINTR, so it should never be used without checking return
      status.  But we already have a helper function that does that, so
      use it in more places.
      
      * src/lxc/lxc_container.c (lxcContainerAvailable): Use safer
      virWaitPid.
      * daemon/libvirtd.c (daemonForkIntoBackground): Likewise.
      * tests/testutils.c (virtTestCaptureProgramOutput, virtTestMain):
      Likewise.
      * src/libvirt.c (virConnectAuthGainPolkit): Simplify with virCommand.
      69d044c0
    • E
      qemu: avoid leaking uninit data from hotplug to dumpxml · 2c27dfae
      Eric Blake 提交于
      Detected by Coverity.  Both text and JSON monitors set only the
      bus and unit fields, which means driveAddr.controller spends
      life as garbage on the stack, and is then memcpy()'d into the
      in-memory representation which the user can see via dumpxml.
      
      * src/qemu/qemu_hotplug.c (qemuDomainAttachSCSIDisk): Only copy
      defined fields.
      2c27dfae
  3. 24 10月, 2011 1 次提交
    • R
      virsh: Fix vol-info's 'Type' output · 9981fc58
      Ryota Ozaki 提交于
      We have a new vol type "dir" in addition to "file" and "block", but
      virsh doesn't know it. Fix it.
      
      Additionally, the patch lets virsh output "unknown" if not matched
      any of them.
      9981fc58
  4. 21 10月, 2011 14 次提交
    • R
      docs: Document filesystem type='block' for LXC · 390645b3
      Ryota Ozaki 提交于
      Commit 77791dc0 allows LXC to use a host block device as a guest
      filesystem, but it isn't documented yet.
      390645b3
    • D
      support continue/return targets in nwfilter · a61e9ff6
      David L Stevens 提交于
      	This patch adds support for "continue" and "return" actions
      in filter rules.
      Signed-off-by: NDavid L Stevens <dlstevens@us.ibm.com>
      a61e9ff6
    • E
      snapshot: simplify indentation of network xml · e36da1bd
      Eric Blake 提交于
      More simplifications possible due to auto-indent.  Also,
      <bandwidth> within <actual> was only using 6 instead of 8 spaces.
      
      * src/util/network.h (virVirtualPortProfileFormat)
      (virBandwidthDefFormat): Alter signature.
      * src/util/network.c (virVirtualPortProfileFormat)
      (virBandwidthDefFormat): Alter indentation.
      (virBandwidthChildDefFormat): Tweak to make use easier.
      * src/conf/network_conf.c (virPortGroupDefFormat)
      (virNetworkDefFormat): Adjust callers.
      * src/conf/domain_conf.c (virDomainNetDefFormat): Likewise.
      (virDomainActualNetDefFormat): Likewise, and fix bandwidth
      indentation.
      e36da1bd
    • E
      snapshot: simplify indentation of cpu features · 4eedfd07
      Eric Blake 提交于
      Auto-indent makes life a bit easier; this patch also drops unused
      arguments and replaces a misspelled flag name with two entry points
      instead, so that callers don't have to worry about how much spacing
      is present when embedding cpu elements.
      
      * src/conf/cpu_conf.h (virCPUFormatFlags): Delete.
      (virCPUDefFormat): Drop unused argument.
      (virCPUDefFormatBuf): Alter signature.
      (virCPUDefFormatBufFull): New prototype.
      * src/conf/cpu_conf.c (virCPUDefFormatBuf): Split...
      (virCPUDefFormatBufFull): ...into new function.
      (virCPUDefFormat): Adjust caller.
      * src/conf/domain_conf.c (virDomainDefFormatInternal): Likewise.
      * src/conf/capabilities.c (virCapabilitiesFormatXML): Likewise.
      * src/cpu/cpu.c (cpuBaselineXML): Likewise.
      * tests/cputest.c (cpuTestCompareXML): Likewise.
      4eedfd07
    • E
      snapshot: simplify indentation of sysinfo · 9a220665
      Eric Blake 提交于
      The improvements to virBuffer, along with a paradigm shift to pass
      the original buffer through rather than creating a second buffer,
      allow us to shave off quite a few lines of code.
      
      * src/util/sysinfo.h (virSysinfoFormat): Alter signature.
      * src/util/sysinfo.c (virSysinfoFormat, virSysinfoBIOSFormat)
      (virSysinfoSystemFormat, virSysinfoProcessorFormat)
      (virSysinfoMemoryFormat): Change indentation parameter.
      * src/conf/domain_conf.c (virDomainSysinfoDefFormat): Adjust
      caller.
      * src/qemu/qemu_driver.c (qemuGetSysinfo): Likewise.
      9a220665
    • E
      snapshot: test domainsnapshot indentation · 27b3b303
      Eric Blake 提交于
      Add a test for the simple parts of my indentation changes, and
      fix the fallout.
      
      * tests/domainsnapshotxml2xmltest.c: New test.
      * tests/Makefile.am (domainsnapshotxml2xmltest_SOURCES): Build it.
      * src/conf/domain_conf.c (virDomainSnapshotDefFormat): Avoid NULL
      deref, match documented order.
      * src/conf/domain_conf.h (virDomainSnapshotDefFormat): Add const.
      * tests/domainsnapshotxml2xmlout/all_parameters.xml: Tweak output.
      * tests/domainsnapshotxml2xmlout/disk_snapshot.xml: Likewise.
      * tests/domainsnapshotxml2xmlout/full_domain.xml: Likewise.
      * .gitignore: Exempt new binary.
      27b3b303
    • E
      snapshot: indent domain xml when nesting · 9cba3927
      Eric Blake 提交于
      <domainsnapshot> is the first public instance of <domain> being
      used as a sub-element, although we have two other private uses
      (runtime state, and migration cookie).  Although indentation has
      no effect on XML parsing, using it makes the output more consistent.
      
      This uses virBuffer auto-indentation to obtain the effect, for all
      but the portions of <domain> that are not generated a line at a
      time into the same virBuffer.  Further patches will clean up the
      remaining problems.
      
      * src/conf/domain_conf.h (virDomainDefFormatInternal): New prototype.
      * src/conf/domain_conf.c (virDomainDefFormatInternal): Export.
      (virDomainObjFormat, virDomainSnapshotDefFormat): Update callers.
      * src/libvirt_private.syms (domain_conf.h): Add new export.
      * src/qemu/qemu_migration.c (qemuMigrationCookieXMLFormat): Use
      new function.
      (qemuMigrationCookieXMLFormatStr): Update caller.
      9cba3927
    • E
      virbuf: add auto-indentation support · fd9c052e
      Eric Blake 提交于
      Rather than having to adjust all callers in a chain to deal with
      indentation, it is nicer to have virBuffer do auto-indentation.
      
      * src/util/buf.h (_virBuffer): Increase size.
      (virBufferAdjustIndent, virBufferGetIndent): New prototypes.
      * src/libvirt_private.syms (buf.h): Export new functions.
      * src/util/buf.c (virBufferAdjustIndent, virBufferGetIndent): New
      functions.
      (virBufferSetError, virBufferAdd, virBufferAddChar)
      (virBufferVasprintf, virBufferStrcat, virBufferURIEncodeString):
      Implement auto-indentation.
      * tests/virbuftest.c (testBufAutoIndent): Test it.
      (testBufInfiniteLoop): Don't rely on internals.
      Idea by Daniel P. Berrange.
      fd9c052e
    • E
      virbuf: more detailed error reporting · 818a9665
      Eric Blake 提交于
      The next patch wants to add some sanity checking, which would
      be a different error than ENOMEM.  Many existing callers blindly
      report OOM failure if virBuf reports an error, and this will be
      wrong in the (unlikely) case that they actually had a usage error
      instead; but since the most common error really is ENOMEM, I'm
      not going to fix all callers.  Meanwhile, new discriminating
      callers can react differently depending on what failure happened.
      
      * src/util/buf.c (virBufferSetError): Add parameter.
      (virBufferGrow, virBufferVasprintf, virBufferEscapeString)
      (virBufferEscapeSexpr, virBufferEscapeShell): Adjust callers.
      818a9665
    • E
      virbuf: improve testsuite reporting · ef696300
      Eric Blake 提交于
      I had some temporary test failures while working on virbuf
      improvements in later patches, with output that looked like:
      
      Expected [<]
      Actual [  <]
      
      which is pretty hard to figure out.  Adding an Offset designation
      made it much easier to find which particular '<' was at the
      wrong indentation, to fix the right part of the code.
      
      * tests/testutils.c (virtTestDifference): Make it easier to
      diagnose test failures.
      ef696300
    • E
      virbuf: fix const-correctness · 5c09b81b
      Eric Blake 提交于
      Although the compiler wasn't complaining (since it was the pointer,
      rather than what was being pointed to, that was actually const), it
      looks quite suspicious to call a function with an argument labeled
      const when the nature of the pointer (virBufferPtr) is hidden behind
      a typedef.  Dropping const makes the function declarations easier
      to read.
      
      * src/util/buf.h: Drop const from all functions that modify buffer
      argument.
      * src/util/buf.c (virBufferSetError, virBufferAdd)
      (virBufferContentAndReset, virBufferFreeAndReset)
      (virBufferAsprintf, virBufferVasprintf, virBufferEscapeString)
      (virBufferEscapeSexpr, virBufferEscape): Fix fallout.
      5c09b81b
    • L
      docs: fix incorrect info about routed networks · 52e3b3d1
      Laine Stump 提交于
      In a recent expansion of the documentation on network forward modes, I
      incorrectly stated that incoming sessions to guests on routed networks
      were blocked. This is true for guests on NATed networks, but not
      routed. This patch corrects that error, and adds a pointer to the
      nwfilter page for those who do want to restrict incoming sessions to
      hosts on routed networks.
      52e3b3d1
    • T
      qemu: allow json in domxml-to-native · 755a09b5
      tangchen 提交于
      There is a little difference between the output of domxml-to-native and the actual commandline.
      No matter qemu is in control or readline mode, domxml-to-native always converts it to readline mode.
      
      That is because the parameter "monitor_json" for qemuBuildCommandLine() is always set to false
      in qemuDomainXMLToNative().
      Signed-off-by: Ntangchen <tangchen@cn.fujitsu.com>
      755a09b5
    • E
      docs: document managed=yes of hostdev passthrough · 10d3272e
      Eric Blake 提交于
      Clarify some of the effects of managed passthrough <hostdev> devices;
      with recent changes (commit d0935478), a nodedev-reattach is only needed
      to pair up to an explicit nodedev-dettach (but beware that older
      virt-manager has a bug where it uses explicit nodedev-dettach under the
      hood when using the gui to hotplug a hostdev device).
      
      * docs/formatdomain.html.in: Mention reattach.
      * tools/virsh.pod (nodedev): Mention managed mode.
      10d3272e
  5. 20 10月, 2011 3 次提交