1. 20 4月, 2016 2 次提交
    • C
      storage: remove support for /usr/bin/kvm-img · 487d211d
      Cole Robinson 提交于
      This an ubuntu/debian packaging convention. At one point it may have
      been an actually different binary, but at least as of ubuntu precise
      (the oldest supported ubuntu distro, released april 2012) kvm-img is
      just a symlink to qemu-img for back compat.
      
      I think it's safe to drop support for it
      487d211d
    • C
      storage: remove support for /usr/bin/qcow-create · 1196fed2
      Cole Robinson 提交于
      qcow-create was a crippled qemu-img impl that shipped with xen. I
      think supporting this was only relevant for really old distros
      that didn't have a proper qemu package, like early RHEL5. I think
      it's fair to drop support
      1196fed2
  2. 15 4月, 2016 5 次提交
  3. 16 12月, 2015 3 次提交
  4. 12 12月, 2015 1 次提交
    • E
      CVE-2015-5313: storage: don't allow '/' in filesystem volume names · 034e47c3
      Eric Blake 提交于
      The libvirt file system storage driver determines what file to
      act on by concatenating the pool location with the volume name.
      If a user is able to pick names like "../../../etc/passwd", then
      they can escape the bounds of the pool.  For that matter,
      virStoragePoolListVolumes() doesn't descend into subdirectories,
      so a user really shouldn't use a name with a slash.
      
      Normally, only privileged users can coerce libvirt into creating
      or opening existing files using the virStorageVol APIs; and such
      users already have full privilege to create any domain XML (so it
      is not an escalation of privilege).  But in the case of
      fine-grained ACLs, it is feasible that a user can be granted
      storage_vol:create but not domain:write, and it violates
      assumptions if such a user can abuse libvirt to access files
      outside of the storage pool.
      
      Therefore, prevent all use of volume names that contain "/",
      whether or not such a name is actually attempting to escape the
      pool.
      
      This changes things from:
      
      $ virsh vol-create-as default ../../../../../../etc/haha --capacity 128
      Vol ../../../../../../etc/haha created
      $ rm /etc/haha
      
      to:
      
      $ virsh vol-create-as default ../../../../../../etc/haha --capacity 128
      error: Failed to create vol ../../../../../../etc/haha
      error: Requested operation is not valid: volume name '../../../../../../etc/haha' cannot contain '/'
      Signed-off-by: NEric Blake <eblake@redhat.com>
      034e47c3
  5. 10 12月, 2015 1 次提交
  6. 21 9月, 2015 1 次提交
    • J
      virfile: Rename virFileUnlink to virFileRemove · 1b046a68
      John Ferlan 提交于
      Similar to commit id '35847860', it's possible to attempt to create
      a 'netfs' directory in an NFS root-squash environment which will cause
      the 'vol-delete' command to fail.  It's also possible error paths from
      the 'vol-create' would result in an error to remove a created directory
      if the permissions were incorrect (and disallowed root access).
      
      Thus rename the virFileUnlink to be virFileRemove to match the C API
      functionality, adjust the code to following using rmdir or unlink
      depending on the path type, and then use/call it for the VIR_STORAGE_VOL_DIR
      1b046a68
  7. 02 9月, 2015 1 次提交
    • J
      virfile: Introduce virFileUnlink · 35847860
      John Ferlan 提交于
      In an NFS root-squashed environment the 'vol-delete' command will fail to
      'unlink' the target volume since it was created under a different uid:gid.
      
      This code continues the concepts introduced in virFileOpenForked and
      virDirCreate[NoFork] with respect to running the unlink command under
      the uid/gid of the child. Unlike the other two, don't retry on EACCES
      (that's why we're here doing this now).
      35847860
  8. 17 7月, 2015 1 次提交
  9. 30 6月, 2015 1 次提交
  10. 16 6月, 2015 2 次提交
    • J
      storage: Generate correct parameters for CIFS · 29230951
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1186969
      
      When generating the path to the dir for a CIFS/Samba driver, the code
      would generate a source path for the mount using "%s:%s" while the
      mount.cifs expects to see "//%s/%s". So check for the cifsfs and
      format the source path appropriately.
      
      Additionally, since there is no means to authenticate, the mount
      needs a "-o guest" on the command line in order to anonymously mount
      the Samba directory.
      29230951
    • J
      storage: Adjust command arglist for gluster · 257250f7
      John Ferlan 提交于
      In order for the glusterfs boolean to be set, the pool->def->type must be
      VIR_STORAGE_POOL_NETFS, thus the check within virCommandNewArgList whether
      pool->def->type is VIR_STORAGE_POOL_FS will never be true, so remove it
      257250f7
  11. 05 6月, 2015 4 次提交
    • J
      storage: Add check for valid FS types in checkPool callback · 94a1579b
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1181087
      
      The virStorageBackendFileSystemIsMounted is called from three source paths
      checkPool, startPool, and stopPool. Both start and stop validate the FS
      fields before calling *IsMounted; however the check path there is no call.
      This could lead the code into returning a true in "isActive" if for some
      reason the target path for the pool was mounted. The assumption being
      that if it was mounted, then we believe we started/mounted it.
      
      It's also of note that commit id '81165294' added an error message for
      the start/mount path regarding that the target is already mounted so
      fail the start. That check was adjusted by commit id '13fde7ce' to
      only message if actually mounted.
      
      At one time this led to the libvirtd restart autostart code to declare
      that the pool was active even though the startPool would inhibit startup
      and the stopPool would inhibit shutdown. The autostart path changed as
      of commit id '2a31c5f0' as part of the keep storage pools started between
      libvirtd restarts.
      
      This patch adds the same check made prior to start/mount and stop/unmount
      to ensure we have a valid configuration before attempting to see if the
      target is already mounted to declare "isActive" or not. Finding an improper
      configuration will now cause an error at checkPool, which should make it
      so we can no longer be left in a situation where the pool was started and
      we have no way to stop it.
      94a1579b
    • J
      storage: FS backend adjust error message on error path · fcf0fd52
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1181087
      
      Currently the assumption on the error message is that there are
      no source device paths defined when the number of devices check
      fails, but in reality the XML could have had none or it could have
      had more than the value supported. Adjust the error message accordingly
      to make it clearer what the error really is.
      fcf0fd52
    • J
      storage: Refactor storage pool type checks · 5a8c98db
      John Ferlan 提交于
      Refactor the code for both startPool (*Mount) and stopPool (*Unmount) code
      paths by introducing virStorageBackendFileSystemIsValid.
      5a8c98db
    • J
      storage: Remove extraneous @conn from function comments · 325a8134
      John Ferlan 提交于
      Over time the parameters changed, but the comment wasn't updated
      325a8134
  12. 27 5月, 2015 1 次提交
  13. 26 5月, 2015 2 次提交
    • C
      storage: fs: Only force directory permissions if required · db1140f1
      Cole Robinson 提交于
      Only set directory permissions at pool build time, if:
      
      - User explicitly requested a mode via the XML
      - The directory needs to be created
      - We need to do the crazy NFS root-squash workaround
      
      This allows qemu:///session to call build on an existing directory
      like /tmp.
      db1140f1
    • C
      storage: conf: Don't set any default <mode> in the XML · 7c2d65dd
      Cole Robinson 提交于
      The XML parser sets a default <mode> if none is explicitly passed in.
      This is then used at pool/vol creation time, and unconditionally reported
      in the XML.
      
      The problem with this approach is that it's impossible for other code
      to determine if the user explicitly requested a storage mode. There
      are some cases where we want to make this distinction, but we currently
      can't.
      
      Handle <mode> parsing like we handle <owner>/<group>: if no value is
      passed in, set it to -1, and adjust the internal consumers to handle
      it.
      7c2d65dd
  14. 20 5月, 2015 1 次提交
  15. 05 5月, 2015 2 次提交
  16. 04 5月, 2015 1 次提交
  17. 16 4月, 2015 1 次提交
  18. 02 4月, 2015 1 次提交
  19. 02 3月, 2015 2 次提交
  20. 12 2月, 2015 1 次提交
    • D
      Allow shrinking of file based volumes · aa9aa6a9
      Daniel P. Berrange 提交于
      While the main storage driver code allows the flag
      VIR_STORAGE_VOL_RESIZE_SHRINK to be set, none of the backend
      drivers are supporting it. At the very least this can work
      for plain file based volumes since we just ftruncate() them
      to the new size. It does not work with qcow2 volumes, but we
      can arguably delegate to qemu-img for error reporting for that
      instead of second guessing this for ourselves:
      
      $ virsh vol-resize --shrink /home/berrange/VirtualMachines/demo.qcow2 2G
      error: Failed to change size of volume 'demo.qcow2' to 2G
      
      error: internal error: Child process (/usr/bin/qemu-img resize /home/berrange/VirtualMachines/demo.qcow2 2147483648) unexpected exit status 1: qemu-img: qcow2 doesn't support shrinking images yet
      qemu-img: This image does not support resize
      
      See also https://bugzilla.redhat.com/show_bug.cgi?id=1021802
      aa9aa6a9
  21. 27 1月, 2015 1 次提交
  22. 05 12月, 2014 1 次提交
  23. 03 12月, 2014 1 次提交
    • J
      Replace virSecretFree with virObjectUnref · a0b13d35
      John Ferlan 提交于
      Since virSecretFree will call virObjectUnref anyway, let's just use that
      directly so as to avoid the possibility that we inadvertently clear out
      a pending error message when using the public API.
      a0b13d35
  24. 15 11月, 2014 1 次提交
  25. 11 9月, 2014 1 次提交
  26. 29 7月, 2014 1 次提交
    • P
      storage: create: Create files with correct mode · f8cf4962
      Peter Krempa 提交于
      Use correct mode when pre-creating files (for snapshots). The refactor
      changing to storage driver usage caused a regression as some systems
      created the file with 000 permissions forbidding qemu to write the file.
      
      Pass mode to the creating functions to avoid the problem.
      
      Regression since 185e07a5.
      f8cf4962