1. 04 7月, 2011 2 次提交
    • O
      storage: Do not override the exact error of createRawFile · 49826eda
      Osier Yang 提交于
      virStorageBackendCreateRaw: createRawFile already reported the
      exact error.
      
      Before the fix:
      
      error: Failed to create vol vol-create.img
      error: cannot create path '/var/lib/libvirt/images/vol-create.img': Unknown error 18446744073709551597
      
      After the fix:
      
      error: Failed to create vol vol-create.img
      error: cannot fill file '/var/lib/libvirt/images/vol-create.img': No space left on device
      49826eda
    • E
      storage: avoid crash on parse error · 5dc404b7
      Eric Blake 提交于
      Coverity detected that we could crash on bogus input.  Meanwhile,
      strtok_r is rather heavy compared to strchr.
      
      * src/storage/storage_backend_iscsi.c (virStorageBackendIQNFound):
        Check for parse failure, and use lighter-weight functions.
      5dc404b7
  2. 23 6月, 2011 1 次提交
  3. 17 6月, 2011 1 次提交
    • D
      Fix errno return in safezero() · a8182206
      Daniel P. Berrange 提交于
      Most of the safezero() implementations return -1 on error,
      setting errno. The safezero() impl using posix_fallocate()
      though returned a positive errno value on error (due to
      the unusual API contract of posix_fallocate() compared to
      most syscall APIs).
      
      * src/util/util.c: Ensure safezero() returns -1 and sets
        errno on error.
      * src/storage/storage_backend.c: Change safezero != 0 to
        < 0 for detecting errors
      a8182206
  4. 14 6月, 2011 1 次提交
  5. 08 6月, 2011 1 次提交
  6. 03 6月, 2011 1 次提交
    • E
      storage: avoid memory leak · 9892f7bc
      Eric Blake 提交于
      Coverity detected that options was being set by strdup but never
      freed.  But why even bother with an options variable?  The options
      parameter never changes!  Leak present since commit 44948f5b (0.7.0).
      
      This function could probably be rewritten to take better advantage
      of virCommand, but that is more invasive.
      
      * src/storage/storage_backend_fs.c
      (virStorageBackendFileSystemMount): Avoid wasted strdup, and
      guarantee proper cleanup on all paths.
      9892f7bc
  7. 01 6月, 2011 1 次提交
    • C
      storage: List directory volumes for dir/fs/netfs pools · 8077d64f
      Cole Robinson 提交于
      Since directories can be used for <filesystem> passthrough, they are
      basically storage volumes.
      
      v2:
          Skip ., .., lost+found dirs
      
      v3:
          Use gnulib last_component
      
      v4:
          Use gnulib "dirname.h", not system <dirname.h>
          Don't skip lost+found
      8077d64f
  8. 24 5月, 2011 2 次提交
  9. 23 5月, 2011 1 次提交
  10. 17 5月, 2011 4 次提交
  11. 16 5月, 2011 1 次提交
  12. 14 5月, 2011 1 次提交
  13. 13 5月, 2011 1 次提交
    • M
      virFDStream: Add option for delete file after it's opening · 6a1f5f56
      Michal Privoznik 提交于
      This is needed if we want to transfer a temporary file. If the
      transfer is done with iohelper, we might run into a race condition,
      where we unlink() file before iohelper is executed.
      
      * src/fdstream.c, src/fdstream.h,
        src/util/iohelper.c: Add new option
      * src/lxc/lxc_driver.c, src/qemu/qemu_driver.c,
        src/storage/storage_driver.c, src/uml/uml_driver.c,
        src/xen/xen_driver.c: Expand existing function calls
      6a1f5f56
  14. 12 5月, 2011 2 次提交
    • E
      maint: omit translation for all VIR_INFO · cb84580a
      Eric Blake 提交于
      We were 31/73 on whether to translate; since less than 50% translated
      and since VIR_INFO is less than VIR_WARN which also doesn't translate,
      this makes sense.
      
      * cfg.mk (sc_prohibit_gettext_markup): Add VIR_INFO, since it
      falls between WARN and DEBUG.
      * daemon/libvirtd.c (qemudDispatchSignalEvent, remoteCheckAccess)
      (qemudDispatchServer): Adjust offenders.
      * daemon/remote.c (remoteDispatchAuthPolkit): Likewise.
      * src/network/bridge_driver.c (networkReloadIptablesRules)
      (networkStartNetworkDaemon, networkShutdownNetworkDaemon)
      (networkCreate, networkDefine, networkUndefine): Likewise.
      * src/qemu/qemu_driver.c (qemudDomainDefine)
      (qemudDomainUndefine): Likewise.
      * src/storage/storage_driver.c (storagePoolCreate)
      (storagePoolDefine, storagePoolUndefine, storagePoolStart)
      (storagePoolDestroy, storagePoolDelete, storageVolumeCreateXML)
      (storageVolumeCreateXMLFrom, storageVolumeDelete): Likewise.
      * src/util/bridge.c (brProbeVnetHdr): Likewise.
      * po/POTFILES.in: Drop src/util/bridge.c.
      cb84580a
    • 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
  15. 11 5月, 2011 1 次提交
    • M
      Rename internal DumpXML functions to GetXMLDesc · 9817604a
      Matthias Bolte 提交于
      This matches the public API and helps to get rid of some special
      case code in the remote generator.
      
      Rename driver API functions and XDR protocol structs.
      
      No functional change included outside of the remote generator.
      9817604a
  16. 05 5月, 2011 1 次提交
  17. 04 5月, 2011 1 次提交
    • E
      storage: use virCommand to avoid compiler warning · f72393fa
      Eric Blake 提交于
      clang didn't like the last increment to nargs.  But why even
      track nargs ourselves, when virCommand does it for us?
      
      * src/storage/storage_backend_iscsi.c
      (virStorageBackendISCSIConnection): Switch to virCommand to avoid
      a dead-store warning on nargs.
      f72393fa
  18. 17 4月, 2011 1 次提交
  19. 12 4月, 2011 1 次提交
    • E
      maint: fix grammar errors · 99fa3080
      Eric Blake 提交于
      Jim Meyering recently improved gnulib to catch various grammar
      errors during 'make syntax-check'.
      
      * .gnulib: Update to latest, for syntax-check improvements.
      * include/libvirt/libvirt.h.in (virConnectAuthCallbackPtr): Use
      cannot rather than two words.
      * src/driver.c: Likewise.
      * src/driver.h (VIR_SECRET_GET_VALUE_INTERNAL_CALL): Likewise.
      * src/remote/remote_driver.c (initialize_gnutls): Likewise.
      * src/util/pci.c (pciBindDeviceToStub): Likewise.
      * src/storage/storage_backend.c (virStorageBackendCreateQemuImg):
      Likewise.
      (virStorageBackendUpdateVolTargetInfoFD): Avoid doubled word.
      * docs/formatdomain.html.in: Likewise.
      * src/qemu/qemu_process.c (qemuProcessStart): Likewise.
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_can_not)
      (exclude_file_name_regexp--sc_prohibit_doubled_word): Exclude
      existing translation problems.
      99fa3080
  20. 05 4月, 2011 4 次提交
    • D
      Improve SCSI volume key generation · fdcd06ef
      Daniel P. Berrange 提交于
      The SCSI volumes get a better 'key' field based on the fully
      qualified volume path. All SCSI volumes have a unique serial
      available in hardware which can be obtained by sending a
      suitable SCSI command. Call out to udev's 'scsi_id' command
      to fetch this value
      
      * src/storage/storage_backend_scsi.c: Improve volume key
        field value stability and uniqueness
      fdcd06ef
    • M
    • J
      Allow relative path for qemu backing file · 33da939b
      Jesse Cook 提交于
      This patch enables the relative backing file path support provided by
      qemu-img create.
      
      If a relative path is specified for the backing file, it is converted
      to an absolute path using the storage pool path. The absolute path is
      used to verify that the backing file exists. If the backing file exists,
      the relative path is allowed and will be provided to qemu-img create.
      33da939b
    • E
      build: detect potentential uninitialized variables · 0d166c6b
      Eric Blake 提交于
      Even with -Wuninitialized (which is part of autobuild.sh
      --enable-compile-warnings=error), gcc does NOT catch this
      use of an uninitialized variable:
      
      {
        if (cond)
          goto error;
        int a = 1;
      error:
        printf("%d", a);
      }
      
      which prints 0 (supposing the stack started life wiped) if
      cond was true.  Clang will catch it, but we don't use clang
      as often.  Using gcc -Wjump-misses-init catches it, but also
      gives false positives:
      
      {
        if (cond)
          goto error;
        int a = 1;
        return a;
      error:
        return 0;
      }
      
      Here, a was never used in the scope of the error block, so
      declaring it after goto is technically fine (and clang agrees).
      However, given that our HACKING already documents a preference
      to C89 decl-before-statement, the false positive warning is
      enough of a prod to comply with HACKING.
      
      [Personally, I'd _really_ rather use C99 decl-after-statement
      to minimize scope, but until gcc can efficiently and reliably
      catch scoping and uninitialized usage bugs, I'll settle with
      the compromise of enforcing a coding standard that happens to
      reject false positives if it can also detect real bugs.]
      
      * acinclude.m4 (LIBVIRT_COMPILE_WARNINGS): Add -Wjump-misses-init.
      * src/util/util.c (__virExec): Adjust offenders.
      * src/conf/domain_conf.c (virDomainTimerDefParseXML): Likewise.
      * src/remote/remote_driver.c (doRemoteOpen): Likewise.
      * src/phyp/phyp_driver.c (phypGetLparNAME, phypGetLparProfile)
      (phypGetVIOSFreeSCSIAdapter, phypVolumeGetKey)
      (phypGetStoragePoolDevice)
      (phypVolumeGetPhysicalVolumeByStoragePool)
      (phypVolumeGetPath): Likewise.
      * src/vbox/vbox_tmpl.c (vboxNetworkUndefineDestroy)
      (vboxNetworkCreate, vboxNetworkDumpXML)
      (vboxNetworkDefineCreateXML): Likewise.
      * src/xenapi/xenapi_driver.c (getCapsObject)
      (xenapiDomainDumpXML): Likewise.
      * src/xenapi/xenapi_utils.c (createVMRecordFromXml): Likewise.
      * src/security/security_selinux.c (SELinuxGenNewContext):
      Likewise.
      * src/qemu/qemu_command.c (qemuBuildCommandLine): Likewise.
      * src/qemu/qemu_hotplug.c (qemuDomainChangeEjectableMedia):
      Likewise.
      * src/qemu/qemu_process.c (qemuProcessWaitForMonitor): Likewise.
      * src/qemu/qemu_monitor_text.c (qemuMonitorTextGetPtyPaths):
      Likewise.
      * src/qemu/qemu_driver.c (qemudDomainShutdown)
      (qemudDomainBlockStats, qemudDomainMemoryPeek): Likewise.
      * src/storage/storage_backend_iscsi.c
      (virStorageBackendCreateIfaceIQN): Likewise.
      * src/node_device/node_device_udev.c (udevProcessPCI): Likewise.
      0d166c6b
  21. 30 3月, 2011 1 次提交
    • N
      extend logging to record configuration-related changes · 343a27af
      Naoya Horiguchi 提交于
      Currently libvirt's default logging is limited and it is difficult to
      determine what was happening when a proglem occurred (especially on a
      machines where one don't know the detail.)  This patch helps to do that
      by making additional logging available for the following events:
      
        creating/defining/undefining domains
        creating/defining/undefining/starting/stopping networks
        creating/defining/undefining/starting/stopping storage pools
        creating/defining/undefining/starting/stopping storage volumes.
      
      * AUTHORS: add Naoya Horiguchi
      * src/network/bridge_driver.c src/qemu/qemu_driver.c
        src/storage/storage_driver.c: provide more VIR_INFO logging
      343a27af
  22. 29 3月, 2011 5 次提交
    • D
      Support volume data upload/download APIs in storage driver · 92563962
      Daniel P. Berrange 提交于
      Use generic FD streams to allow data upload/download to/from
      any storage volume
      
      * src/storage/storage_driver.c: Wire up upload/download APIs
      92563962
    • D
      Add public APIs for storage volume upload/download · 7300f68d
      Daniel P. Berrange 提交于
      New APIs are added allowing streaming of content to/from
      storage volumes.
      
      * include/libvirt/libvirt.h.in: Add virStorageVolUpload and
        virStorageVolDownload APIs
      * src/driver.h, src/libvirt.c, src/libvirt_public.syms: Stub
        code for new APIs
      * src/storage/storage_driver.c, src/esx/esx_storage_driver.c:
        Add dummy entries in driver table for new APIs
      7300f68d
    • E
      qemu, storage: improve type safety · 1a369dfb
      Eric Blake 提交于
      * src/storage/storage_backend.c (createRawFileOpHook): Change
      signature.
      (struct createRawFileOpHookData): Delete unused struct.
      (virStorageBackendCreateRaw): Adjust caller.
      * src/qemu/qemu_driver.c (struct fileOpHookData): Delete unused
      struct.
      (qemudDomainSaveFileOpHook): Rename...
      (qemuDomainSaveFileOpHook): ...and change signature.
      (qemudDomainSaveFlag): Adjust caller.
      1a369dfb
    • E
      util: rename virFileOperation to virFileOpenAs · 1fdd50f9
      Eric Blake 提交于
      This patch intentionally doesn't change indentation, in order to
      make it easier to review the real changes.
      
      * src/util/util.h (VIR_FILE_OP_RETURN_FD, virFileOperationHook):
      Delete.
      (virFileOperation): Rename...
      (virFileOpenAs): ...and reduce parameters.
      * src/util/util.c (virFileOperationNoFork, virFileOperation):
      Rename and simplify.
      * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Adjust caller.
      * src/storage/storage_backend.c (virStorageBackendCreateRaw):
      Likewise.
      * src/libvirt_private.syms: Reflect rename.
      1fdd50f9
    • E
      storage: simplify fd handling · fe303a42
      Eric Blake 提交于
      * src/storage/storage_backend.c (virStorageBackendCreateRaw): Use
      new virFileOperation flag.
      fe303a42
  23. 25 3月, 2011 1 次提交
    • E
      command: properly diagnose process exit via signal · 208a044a
      Eric Blake 提交于
      Child processes don't always reach _exit(); if they die from a
      signal, then any messages should still be accurate.  Most users
      either expect a 0 status (thankfully, if status==0, then
      WIFEXITED(status) is true and WEXITSTATUS(status)==0 for all
      known platforms) or were filtering on WIFEXITED before printing
      a status, but a few were missing this check.  Additionally,
      nwfilter_ebiptables_driver was making an assumption that works
      on Linux (where WEXITSTATUS shifts and WTERMSIG just masks)
      but fails on other platforms (where WEXITSTATUS just masks and
      WTERMSIG shifts).
      
      * src/util/command.h (virCommandTranslateStatus): New helper.
      * src/libvirt_private.syms (command.h): Export it.
      * src/util/command.c (virCommandTranslateStatus): New function.
      (virCommandWait): Use it to also diagnose status from signals.
      * src/security/security_apparmor.c (load_profile): Likewise.
      * src/storage/storage_backend.c
      (virStorageBackendQEMUImgBackingFormat): Likewise.
      * src/util/util.c (virExecDaemonize, virRunWithHook)
      (virFileOperation, virDirCreate): Likewise.
      * daemon/remote.c (remoteDispatchAuthPolkit): Likewise.
      * src/nwfilter/nwfilter_ebiptables_driver.c (ebiptablesExecCLI):
      Likewise.
      208a044a
  24. 15 3月, 2011 1 次提交
  25. 12 3月, 2011 1 次提交
    • P
      Ignore backing file errors in FS storage pool · 0ed445e7
      Philipp Hahn 提交于
      Currently a single storage volume with a broken backing file will disable the
      whole storage pool. This can happen when the backing file is on some
      unavailable network storage or if the backing volume is deleted, while the
      storage volumes using it remain.
      Since the storage pool can not be re-activated, re-creating the missing
      or deleting the now useless volumes using libvirt only is not possible.
      
      Fixing this is a little bit tricky:
      1. virStorageBackendProbeTarget() only detects the missing backing file,
         if the backing file format is not explicitly specified. If the
         backing file is created using
      	   kvm-img create -f qcow2 -o backing_fmt=qcow2,backing_file=... ...
         no error is detected at this stage.
         The new return code -3 signals that the backing file could not be
         opened.
      2. The backingStore.format must be >= 0, since values < 0 would break
         virStorageVolTargetDefFormat() when dumping the XML data such as
             <format type='...'/>
         Because of this the format is faked as VIR_STORAGE_FILE_RAW.
      3. virStorageBackendUpdateVolTargetInfo() always opens the backing file
         and thus always detects a missing backing file.
         Since it "only" updates the capacity, allocation, owner, group, mode
         and SELinux label, just ignore errors at this stage, print an error
         message and continue.
      4. Using vol-dump on a broken volume still doesn't work, but at least
         vol-destroy and pool-refresh do work now.
      
      To reproduce:
        dir=$(mktemp -d)
        virsh pool-create-as tmp dir '' '' '' '' "$dir"
        virsh vol-create-as --format qcow2 tmp back 1G
        virsh vol-create-as --format qcow2 --backing-vol-format qcow2 --backing-vol back tmp cow 1G
        virsh vol-delete --pool tmp back
        virsh pool-refresh tmp
      After the last step, the pool will be gone (because it was not persistent). As
      long as the now broken image stays in the directory, you will not be able to
      re-create or re-start the pool.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      0ed445e7
  26. 10 3月, 2011 2 次提交