1. 09 4月, 2013 1 次提交
  2. 08 4月, 2013 4 次提交
    • D
      Rename virCgroupMounted to virCgroupHasController & make it more robust · dca927c8
      Daniel P. Berrange 提交于
      The virCgroupMounted method is badly named, since a controller can be
      mounted, but disabled in the current object. Rename the method to be
      virCgroupHasController. Also make it tolerant to a  NULL virCgroupPtr
      and out-of-range controller index, to avoid duplication of these
      checks in all callers
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      dca927c8
    • O
      storage: Guess the parent if it's not specified for vHBA · f5a61087
      Osier Yang 提交于
      This finds the parent for vHBA by iterating over all the HBA
      which supports vport_ops capability on the host, and return
      the first one which is online, not saturated (vports in use
      is less than max_vports).
      f5a61087
    • O
      util: Add helper to get the scsi host name by iterating over sysfs · b52fbad1
      Osier Yang 提交于
      The helper iterates over sysfs, to find out the matched scsi host
      name by comparing the wwnn,wwpn pair. It will be used by checkPool
      and refreshPool of storage scsi backend. New helper getAdapterName
      is introduced in storage_backend_scsi.c, which uses the new util
      helper virGetFCHostNameByWWN to get the fc_host adapter name.
      b52fbad1
    • O
      New XML attributes for storage pool source adapter · 9f781da6
      Osier Yang 提交于
      This introduces 4 new attributes for storage pool source adapter.
      E.g.
      
      <adapter type='fc_host' parent='scsi_host5' wwnn='20000000c9831b4b' wwpn='10000000c9831b4b'/>
      
      Attribute 'type' can be either 'scsi_host' or 'fc_host', and defaults
      to 'scsi_host' if attribute 'name' is specified. I.e. It's optional
      for 'scsi_host' adapter, for back-compat reason. However, mandatory
      for 'fc_host' adapter and any new future adapter types. Attribute
      'parent' is to specify the parent for the fc_host adapter.
      
      * docs/formatstorage.html.in:
        - Add documents for the 4 new attrs
      * docs/schemas/storagepool.rng:
        - Add RNG schema
      * src/conf/storage_conf.c:
        - Parse and format the new XMLs
      * src/conf/storage_conf.h:
        - New struct virStoragePoolSourceAdapter, replace "char *adapter" with it;
        - New enum virStoragePoolSourceAdapterType
      * src/libvirt_private.syms:
        - Export TypeToString and TypeFromString
      * src/phyp/phyp_driver.c:
        - Replace "adapter" with "adapter.data.name", which is member of the union
          of the new struct virStoragePoolSourceAdapter now. Later patch will
          add the checking, as "adapter.data.name" is only valid for "scsi_host"
          adapter.
      * src/storage/storage_backend_scsi.c:
        - Like above
      * tests/storagepoolxml2xmlin/pool-scsi-type-scsi-host.xml:
      * tests/storagepoolxml2xmlin/pool-scsi-type-fc-host.xml:
        - New test for 'fc_host' and "scsi_host" adapter
      * tests/storagepoolxml2xmlout/pool-scsi.xml:
        - Change the expected output, as the 'type' defaults to 'scsi_host' if 'name"
          specified now
      * tests/storagepoolxml2xmlout/pool-scsi-type-scsi-host.xml:
      * tests/storagepoolxml2xmlout/pool-scsi-type-fc-host.xml:
        - New test
      * tests/storagepoolxml2xmltest.c:
        - Include the test
      9f781da6
  3. 06 4月, 2013 1 次提交
  4. 05 4月, 2013 4 次提交
  5. 28 3月, 2013 2 次提交
  6. 25 3月, 2013 3 次提交
    • O
      nodedev: Abstract nodeDeviceVportCreateDelete as util function · 96d3086a
      Osier Yang 提交于
      This abstracts nodeDeviceVportCreateDelete as an util function
      virManageVport, which can be further used by later storage patches
      (to support persistent vHBA, I don't want to create the vHBA
      using the public API, which is not good).
      96d3086a
    • O
      nodedev: Refactor the helpers · 4360a098
      Osier Yang 提交于
      This adds two util functions (virIsCapableFCHost and virIsCapableVport),
      and rename helper check_fc_host_linux as detect_scsi_host_caps,
      check_capable_vport_linux is removed, as it's abstracted to the util
      function virIsCapableVport. detect_scsi_host_caps nows detect both
      the fc_host and vport_ops capabilities. "stat(2)" is replaced with
      "access(2)" for saving.
      
      * src/util/virutil.h:
        - Declare virIsCapableFCHost and virIsCapableVport
      * src/util/virutil.c:
        - Implement virIsCapableFCHost and virIsCapableVport
      * src/node_device/node_device_linux_sysfs.c:
        - Remove check_capable_vport_linux
        - Rename check_fc_host_linux as detect_scsi_host_caps, and refactor
          it a bit to detect both fc_host and vport_os capabilities
      * src/node_device/node_device_driver.h:
        - Change/remove the related declarations
      * src/node_device/node_device_udev.c: (Use detect_scsi_host_caps)
      * src/node_device/node_device_hal.c: (Likewise)
      * src/node_device/node_device_driver.c (Likewise)
      4360a098
    • O
      util: Add one helper virReadFCHost to read the value of fc_host entry · 244ce462
      Osier Yang 提交于
      "open_wwn_file" in node_device_linux_sysfs.c is redundant, on one
      hand it duplicates work of virFileReadAll, on the other hand, it's
      waste to use a function for it, as there is no other users of it.
      So I don't see why the file opening work cannot be done in
      "read_wwn_linux".
      
      "read_wwn_linux" can be abstracted as an util function. As what all
      it does is to read the sysfs entry.
      
      So this patch removes "open_wwn_file", and abstract "read_wwn_linux"
      as an util function "virReadFCHost" (a more general name, because
      after changes, it can read each of the fc_host entry now).
      
      * src/util/virutil.h: (Declare virReadFCHost)
      * src/util/virutil.c: (Implement virReadFCHost)
      * src/node_device/node_device_linux_sysfs.c: (Remove open_wwn_file,
        and read_wwn_linux)
      src/node_device/node_device_driver.h: (Remove the declaration of
        read_wwn_linux, and the related macros)
      src/libvirt_private.syms: (Export virReadFCHost)
      244ce462
  7. 22 3月, 2013 2 次提交
  8. 21 3月, 2013 1 次提交
  9. 20 3月, 2013 2 次提交
  10. 19 3月, 2013 3 次提交
  11. 14 3月, 2013 1 次提交
  12. 13 3月, 2013 4 次提交
    • D
      Use separate symbol file for GNUTLS symbols · 83d7e4e4
      Daniel P. Berrange 提交于
      A number of symbols are only present when GNUTLS is enabled.
      Thus we must use a separate libvirt_gnutls.syms file for them
      instead of libvirt_private.syms
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      83d7e4e4
    • P
      virCaps: conf: start splitting out irrelevat data · 27cf98e2
      Peter Krempa 提交于
      The virCaps structure gathered a ton of irrelevant data over time that.
      The original reason is that it was propagated to the XML parser
      functions.
      
      This patch aims to create a new data structure virDomainXMLConf that
      will contain immutable data that are used by the XML parser. This will
      allow two things we need:
      
      1) Get rid of the stuff from virCaps
      
      2) Allow us to add callbacks to check and add driver specific stuff
      after domain XML is parsed.
      
      This first attempt removes pointers to private data allocation functions
      to this new structure and update all callers and function that require
      them.
      27cf98e2
    • D
      Remove hack using existance of an 'identity' string to disable auth · be27de6e
      Daniel P. Berrange 提交于
      Currently the server determines whether authentication of clients
      is complete, by checking whether an identity is set. This patch
      removes that lame hack and replaces it with an explicit method
      for changing the client auth code
      
      * daemon/remote.c: Update for new APis
      * src/libvirt_private.syms, src/rpc/virnetserverclient.c,
        src/rpc/virnetserverclient.h: Remove virNetServerClientGetIdentity
        and virNetServerClientSetIdentity, adding a new method
        virNetServerClientSetAuth.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      be27de6e
    • D
      Add API for thread cancellation · a2997142
      Daniel P. Berrange 提交于
      Add a virThreadCancel function. This functional is inherently
      dangerous and not something we want to use in general, but
      integration with SELinux requires that we provide this stub.
      We leave out any Win32 impl to discourage further use and
      because obviously SELinux isn't enabled on Win32
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      a2997142
  13. 08 3月, 2013 1 次提交
  14. 27 2月, 2013 1 次提交
  15. 25 2月, 2013 1 次提交
  16. 21 2月, 2013 1 次提交
    • O
      qemu: Remove the shared disk entry if the operation is ejecting or updating · d0172d2b
      Osier Yang 提交于
      For both AttachDevice and UpdateDevice APIs, if the disk device
      is 'cdrom' or 'floppy', the operations could be ejecting, updating,
      and inserting. For either ejecting or updating, the shared disk
      entry of the original disk src has to be removed, because it's
      not useful anymore.
      
      And since the original disk def will be changed, new disk def passed
      as argument will be free'ed in qemuDomainChangeEjectableMedia, so
      we need to copy the orignal disk def before
      qemuDomainChangeEjectableMedia, to use it for qemuRemoveSharedDisk.
      d0172d2b
  17. 20 2月, 2013 3 次提交
    • E
      maint: enforce private symbol section sorting · 6ea7b3e8
      Eric Blake 提交于
      Automating a sorting check is the only way to ensure we don't
      regress.  Suggested by Dan Berrange.
      
      * src/check-symsorting.pl (check_sorting): Add a parameter,
      validate that groups are in order, and that files exist.
      * src/Makefile.am (check-symsorting): Adjust caller.
      * src/libvirt_private.syms: Fix typo.
      * src/libvirt_linux.syms: Fix file name.
      * src/libvirt_vmx.syms: Likewise.
      * src/libvirt_xenxs.syms: Likewise.
      * src/libvirt_sasl.syms: Likewise.
      * src/libvirt_libssh2.syms: Likewise.
      * src/libvirt_esx.syms: Mention file name.
      * src/libvirt_openvz.syms: Likewise.
      6ea7b3e8
    • E
      maint: sort private syms to reflect recent header renames · f190a636
      Eric Blake 提交于
      Purely mechanical (roughly, s/\n/~/; s/~~/\n/; sort by line;
      s/~/\n/)
      
      * src/libvirt_private.syms: Sort sections by header file name.
      f190a636
    • E
      maint: fix header file owners of private symbols · 8a256f3c
      Eric Blake 提交于
      Recent renames were not reflected into the comments of
      libvirt_private.syms; furthermore, since we mix private headers from
      several directories into this file, knowing where the file lives
      can be helpful.
      
      * src/libvirt_private.sym: Reflect recent names.
      8a256f3c
  18. 14 2月, 2013 4 次提交
    • L
      util: virSetUIDGIDWithCaps - change uid while keeping caps · e11451f4
      Laine Stump 提交于
      Normally when a process' uid is changed to non-0, all the capabilities
      bits are cleared, even those explicitly set with calls to
      capng_update()/capng_apply() made immediately before setuid. And
      *after* the process' uid has been changed, it no longer has the
      necessary privileges to add capabilities back to the process.
      
      In order to set a non-0 uid while still maintaining any capabilities
      bits, it is necessary to either call capng_change_id() (which
      unfortunately doesn't currently call initgroups to setup auxiliary
      group membership), or to perform the small amount of calisthenics
      contained in the new utility function virSetUIDGIDWithCaps().
      
      Another very important difference between the capabilities
      setting/clearing in virSetUIDGIDWithCaps() and virCommand's
      virSetCapabilities() (which it will replace in the next patch) is that
      the new function properly clears the capabilities bounding set, so it
      will not be possible for a child process to set any new
      capabilities.
      
      A short description of what is done by virSetUIDGIDWithCaps():
      
      1) clear all capabilities then set all those desired by the caller (in
      capBits) plus CAP_SETGID, CAP_SETUID, and CAP_SETPCAP (which is needed
      to change the capabilities bounding set).
      
      2) call prctl(), telling it that we want to maintain current
      capabilities across an upcoming setuid().
      
      3) switch to the new uid/gid
      
      4) again call prctl(), telling it we will no longer want capabilities
      maintained if this process does another setuid().
      
      5) clear the capabilities that we added to allow us to
      setuid/setgid/change the bounding set (unless they were also requested
      by the caller via the virCommand API).
      
      Because the modification/maintaining of capabilities is intermingled
      with setting the uid, this is necessarily done in a single function,
      rather than having two independent functions.
      
      Note that, due to the way that effective capabilities are computed (at
      time of execve) for a process that has uid != 0, the *file*
      capabilities of the binary being executed must also have the desired
      capabilities bit(s) set (see "man 7 capabilities"). This can be done
      with the "filecap" command. (e.g. "filecap /usr/bin/qemu-kvm sys_rawio").
      e11451f4
    • L
      security: add new virSecurityManagerSetChildProcessLabel API · 7bf1aa0b
      Laine Stump 提交于
      The existing virSecurityManagerSetProcessLabel() API is designed so
      that it must be called after forking the child process, but before
      exec'ing the child. Due to the way the virCommand API works, that
      means it needs to be put in a "hook" function that virCommand is told
      to call out to at that time.
      
      Setting the child process label is a basic enough need when executing
      any process that virCommand should have a method of doing that. But
      virCommand must be told what label to set, and only the security
      driver knows the answer to that question.
      
      The new virSecurityManagerSet*Child*ProcessLabel() API is the way to
      transfer the knowledge about what label to set from the security
      driver to the virCommand object. It is given a virCommandPtr, and each
      security driver calls the appropriate virCommand* API to tell
      virCommand what to do between fork and exec.
      
      1) in the case of the DAC security driver, it calls
      virCommandSetUID/GID() to set a uid and gid that must be set for the
      child process.
      
      2) for the SELinux security driver, it calls
      virCommandSetSELinuxLabel() to save a copy of the char* that will be
      sent to setexeccon_raw() *after forking the child process*.
      
      3) for the AppArmor security drivers, it calls
      virCommandSetAppArmorProfile() to save a copy of the char* that will
      be sent to aa_change_profile() *after forking the child process*.
      
      With this new API in place, we will be able to remove
      virSecurityManagerSetProcessLabel() from any virCommand pre-exec
      hooks.
      
      (Unfortunately, the LXC driver uses clone() rather than virCommand, so
      it can't take advantage of this new security driver API, meaning that
      we need to keep around the older virSecurityManagerSetProcessLabel(),
      at least for now.)
      7bf1aa0b
    • L
      util: add security label setting to virCommand · 6c3f3d0d
      Laine Stump 提交于
      virCommand gets two new APIs: virCommandSetSELinuxLabel() and
      virCommandSetAppArmorProfile(), which both save a copy of a
      null-terminated string in the virCommand. During virCommandRun, if the
      string is non-NULL and we've been compiled with AppArmor and/or
      SELinux security driver support, the appropriate security library
      function is called for the child process, using the string that was
      previously set. In the case of SELinux, setexeccon_raw() is called,
      and for AppArmor, aa_change_profile() is called.
      
      This functionality has been added so that users of virCommand can use
      the upcoming virSecurityManagerSetChildProcessLabel() prior to running
      a child process, rather than needing to setup a hook function to be
      called (and in turn call virSecurityManagerSetProcessLabel()) *during*
      the setup of the child process.
      6c3f3d0d
    • L
      util: add virCommandSetUID and virCommandSetGID · 417182b0
      Laine Stump 提交于
      If a uid and/or gid is specified for a command, it will be set just
      after the user-supplied post-fork "hook" function is called.
      
      The intent is that this can replace user hook functions that set
      uid/gid. This moves the setting of uid/gid and dropping of
      capabilities closer to each other, which is important since the two
      should really be done at the same time (libcapng provides a single
      function that does both, which we will be unable to use, but want to
      mimic as closely as possible).
      417182b0
  19. 12 2月, 2013 1 次提交
    • D
      Fix potential deadlock across fork() in QEMU driver · 61b52d2e
      Daniel P. Berrange 提交于
      The hook scripts used by virCommand must be careful wrt
      accessing any mutexes that may have been held by other
      threads in the parent process. With the recent refactoring
      there are 2 potential flaws lurking, which will become real
      deadlock bugs once the global QEMU driver lock is removed.
      
      Remove use of the QEMU driver lock from the hook function
      by passing in the 'virQEMUDriverConfigPtr' instance directly.
      
      Add functions to the virSecurityManager to be invoked before
      and after fork, to ensure the mutex is held by the current
      thread. This allows it to be safely used in the hook script
      in the child process.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      61b52d2e