1. 21 8月, 2012 18 次提交
    • E
      build: split driver_storage into convenience library · 1a4379cb
      Eric Blake 提交于
      Commit 1d22ba95 was complete at the time, but we have since
      reintroduced a warning that is fixed in the same manner:
      
        CCLD   storagebackendsheepdogtest
      
      *** Warning: Linking the executable storagebackendsheepdogtest against the loadable module
      *** libvirt_driver_storage.so is not portable!
      
      * src/Makefile.am (libvirt_driver_storage.la): Factor into new
      convenience library libvirt_driver_storage_impl.la.
      * tests/Makefile.am (storagebackendsheepdogtest_LDADD): Link to
      convenience library, not shared library.
      1a4379cb
    • E
      build: silence stupid gcc warning on STREQ_NULLABLE · 8d8527de
      Eric Blake 提交于
      Our existing STRNEQ_NULLABLE() triggered a warning in gcc 4.7 when
      used with a literal NULL argument:
      
      qemumonitorjsontest.c: In function 'testQemuMonitorJSONGetMachines':
      qemumonitorjsontest.c:289:5: error: null argument where non-null required (argument 1) [-Werror=nonnull]
      
      even though the strcmp is provably dead when a null argument is
      present.  Squelch the warning by refactoring things so that gcc
      never sees strcmp() called with NULL arguments (we still compare
      NULL as not equal to "", this rewrite merely aids gcc).
      
      Next, gcc has a valid warning about a literal NULLSTR(NULL):
      
      qemumonitorjsontest.c:289:5: error: invalid application of 'sizeof' to a void type [-Werror=pointer-arith]
      
      Of course, you'd never write NULLSTR(NULL) directly, but it is
      handy to use through macros.  But the entire part about verify_true()
      is unnecessary - gcc already warns about type mismatch with ?:,
      without needing to make it more complex.
      
      * src/internal.h (STREQ_NULLABLE, STRNEQ_NULLABLE): Avoid gcc 4.7
      stupidity.
      (NULLSTR): Simplify, to allow passing compile-time constants.
      8d8527de
    • D
      Fix parsing of uid/gid on Mingw32 · 7272a92c
      Daniel P. Berrange 提交于
      The DAC security driver uses the virStrToLong_ui function to
      parse the uid/gid out of the seclabel string. This works on
      Linux where 'uid_t' is an unsigned int, but on Mingw32 it is
      just an 'int'. This causes compiler warnings about signed/
      unsigned int pointer mis-match.
      
      To avoid this, use explicit 'unsigned int ouruid' local
      vars to pass into virStrToLong_ui, and then simply assign
      to the 'uid_t' type after parsing
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      7272a92c
    • P
      libssh2_transport: Use libssh2 driver code in remote driver · dfbb2d31
      Peter Krempa 提交于
      This patch adds URI options to support libssh2 transport in the remote
      driver.
      
      A new transport sceme is introduced eg. "qemu+libssh2://..." that
      utilizes the libssh2 code added in previous patches.
      
      The libssh2 code requires the authentication callback to be able to
      perform keyboard-interactive authentication or to ask t passprhases or
      add host keys to known hosts database.
      
      Added URI components:
      - known_hosts -  path to a knownHosts file in OpenSSH format to check
                       for known ssh host keys
      - known_hosts_verify - how to deal with server key verification:
                                  * "normal" (default) - ask to add new keys
                                  * "auto" - automaticaly add new keys
                                  * "ignore" - don't validate host keys
      - sshauth - authentication methods to use. Default is
                  "agent,privkey,keyboard-interactive". It's a comma separated
                  string of methods to try while authenticating. The order is
                  preserved. Some of the methods may require additional
                  parameters.
      
      Locations of the known_hosts file and private keys are set to default
      values if they're present. (~/.ssh/known_hosts, ~/.ssh/id_rsa,
                                  ~/.ssh/id_dsa)
      dfbb2d31
    • P
      libssh2_transport: Add libssh2 session support to net client code · 25f2c8b4
      Peter Krempa 提交于
      This patch adds a glue layer to enable using libssh2 code with the
      network client code.
      
      As in the original client implementation, shell code is sent to the
      server to detect correct options for netcat and connect to libvirt's
      unix socket.
      25f2c8b4
    • P
      libssh2_transport: add ssh context support to virNetSocket · 637ea542
      Peter Krempa 提交于
      This patch enables virNetSocket to be used as an ssh client when
      properly configured.
      
      This patch adds function virNetSocketNewConnectLibSSH2() that takes all
      needed parameters and creates a libssh2 session and performs steps
      needed to open the connection and then create a virNetSocket that
      seamlesly encapsulates the communication.
      637ea542
    • P
      libssh2_transport: add main libssh2 transport implementation · 1193fc5f
      Peter Krempa 提交于
      This patch adds helper functions that enable us to use libssh2 in
      conjunction with libvirt's virNetSockets for ssh transport instead of
      spawning "ssh" client process.
      
      This implemetation supports tunneled plaintext, keyboard-interactive,
      private key, ssh agent based and null authentication. Libvirt's Auth
      callback is used for interaction with the user. (Keyboard interactive
      authentication, adding of host keys, private key passphrases). This
      enables seamless integration into the application using libvirt. No
      helpers as "ssh-askpass" are needed.
      
      Reading and writing of OpenSSH style "known_hosts" files is supported.
      
      Communication is done using SSH exec channel, where the user may specify
      arbitrary command to be executed on the remote side and reads and writes
      to/from stdin/out are sent through the ssh channel. Usage of stderr is
      not (yet) supported.
      1193fc5f
    • D
      Honour current sensitivity and category ranges in SELinux label generation · 4e365df4
      Daniel P. Berrange 提交于
      Currently the dynamic label generation code will create labels
      with a sensitivity of s0, and a category pair in the range
      0-1023. This is fine when running a standard MCS policy because
      libvirtd will run with a label
      
        system_u:system_r:virtd_t:s0-s0:c0.c1023
      
      With custom policies though, it is possible for libvirtd to have
      a different sensitivity, or category range. For example
      
        system_u:system_r:virtd_t:s2-s3:c512.c1023
      
      In this case we must assign the VM a sensitivity matching the
      current lower sensitivity value, and categories in the range
      512-1023
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      4e365df4
    • D
      Fix regression generating image context · 2d9df4fc
      Daniel P. Berrange 提交于
      The code to refactor sec label handling accidentally changed the
      SELinux driver to use the 'domain_context' when generating the
      image label instead of the 'file_context'
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      2d9df4fc
    • M
      qemu: modify 3 error messages · 0c0a8c9f
      Martin Kletzander 提交于
      After the cleanup of remote display port allocation, I noticed some
      messages that didn't make a lot of sense the way they were written. So
      I rephrased them.
      0c0a8c9f
    • M
      qemu: configurable remote display port boundaries · 29226bee
      Martin Kletzander 提交于
      The defines QEMU_REMOTE_PORT_MIN and QEMU_REMOTE_PORT_MAX were used to
      find free port when starting domains. As this was hard-coded to the
      same ports as default VNC servers, there were races with these other
      programs. This patch includes the possibility to change the default
      starting port as well as the maximum port (mostly for completeness) in
      qemu config file.
      
      Support for two new config options in qemu.conf is added:
       - remote_port_min (defaults to QEMU_REMOTE_PORT_MIN and
         must be >= than this value)
       - remote_port_max (defaults to QEMU_REMOTE_PORT_MAX and
         must be <= than this value)
      29226bee
    • M
      qemu: Unify port-wise SPICE and VNC behavior · a14b4aea
      Martin Kletzander 提交于
      Port allocations for SPICE and VNC behave almost the same (with
      default ports), but there is some mess in the code. This patch clears
      these inconsistencies and makes sure the same behavior will be used
      when ports for remote displays are changed.
      
      Changes:
       - hard-coded number 5900 removed (handled elsewhere like with VNC)
       - reservedVNCPorts renamed to reservedRemotePorts (it's not just for
         VNC anymore)
       - QEMU_VNC_PORT_{MIN,MAX} renamed to QEMU_REMOTE_PORT_{MIN,MAX}
       - port allocation unified for VNC and SPICE
      a14b4aea
    • M
      Update the remote API · 2f8a09fb
      Marcelo Cerri 提交于
      This patch updates libvirt's API to allow applications to inspect the
      full list of security labels of a domain.
      Signed-off-by: NMarcelo Cerri <mhcerri@linux.vnet.ibm.com>
      2f8a09fb
    • M
      Support for multiple default security drivers in QEMU config · 6d6bff3a
      Marcelo Cerri 提交于
      This patch updates the key "security_driver" in QEMU config to suport
      both a sigle default driver or a list of default drivers. This ensures
      that it will remain compatible with older versions of the config file.
      Signed-off-by: NMarcelo Cerri <mhcerri@linux.vnet.ibm.com>
      6d6bff3a
    • M
      Update security layer to handle many security labels · a994ef2d
      Marcelo Cerri 提交于
      These changes make the security drivers able to find and handle the
      correct security label information when more than one label is
      available. They also update the DAC driver to be used as an usual
      security driver.
      Signed-off-by: NMarcelo Cerri <mhcerri@linux.vnet.ibm.com>
      a994ef2d
    • M
      Multiple security drivers in XML data · e9377dda
      Marcelo Cerri 提交于
      This patch updates the domain and capability XML parser and formatter to
      support more than one "seclabel" element for each domain and device. The
      RNG schema and the tests related to this are also updated by this patch.
      Signed-off-by: NMarcelo Cerri <mhcerri@linux.vnet.ibm.com>
      e9377dda
    • M
      Internal refactory of data structures · 6c3cf57d
      Marcelo Cerri 提交于
      This patch updates the structures that store information about each
      domain and each hypervisor to support multiple security labels and
      drivers. It also updates all the remaining code to use the new fields.
      Signed-off-by: NMarcelo Cerri <mhcerri@linux.vnet.ibm.com>
      6c3cf57d
    • V
      selinux: Fix incorrect object label generation. · b6ad2c23
      Viktor Mihajlovski 提交于
      This is a fix for the object label generation. It uses a new flag for
      virSecuritySELinuxGenNewContext that specifies whether the context is
      for an object. If so the context role remains unchanged.
      Without this fix it is not possible to start domains with image file or
      block device backed storage when selinux is enabled.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      b6ad2c23
  2. 20 8月, 2012 3 次提交
  3. 18 8月, 2012 8 次提交
  4. 17 8月, 2012 3 次提交
    • K
      network: add support for setting VLANs on Open vSwitch ports · 7d2b91b8
      Kyle Mestery 提交于
      Add the ability to support VLAN tags for Open vSwitch virtual port
      types. To accomplish this, modify virNetDevOpenvswitchAddPort and
      virNetDevTapCreateInBridgePort to take a virNetDevVlanPtr
      argument. When adding the port to the OVS bridge, setup either a
      single VLAN or a trunk port based on the configuration from the
      virNetDevVlanPtr.
      Signed-off-by: NKyle Mestery <kmestery@cisco.com>
      7d2b91b8
    • O
      qemu: Set swap_hard_limit before hard_limit · 75e5bec9
      Osier Yang 提交于
      Setting hard_limit larger than previous swap_hard_limit must fail,
      it's not that good if one wants to change the swap_hard_limit
      and hard_limit together. E.g.
      
      % virsh memtune rhel6
      hard_limit     : 1000000
      soft_limit     : 1000000
      swap_hard_limit: 1000000
      
      % virsh memtune rhel6 --hard-limit 1000020 --soft-limit 1000020 \
      --swap-hard-limit 1000020 --live
      
      This patch reorder the limits setting to set the swap_hard_limit
      first, hard_limit then, and soft_limit last if it's greater than
      current swap_hard_limit. And soft_limit first, hard_limit then,
      swap_hard_limit last, if not.
      75e5bec9
    • E
      build: ship stamp files · b44e6bef
      Eric Blake 提交于
      'make distcheck' fails because the generated ESX and HyperV files
      are (intentionally) marked read-only, but since the stamp file was
      missing, make assumes they need to be rebuilt.  Shipping the stamp
      file solves the problem.
      
      * src/Makefile.am (EXTRA_DIST): Ship stamp files.
      b44e6bef
  5. 16 8月, 2012 7 次提交
    • L
      qemu: support setting vlan tag for <interface type='hostdev'> · 3fdd85bf
      Laine Stump 提交于
      The underlying function to set the vlan tag of an SR-IOV network
      device was already in place (although an extra patch to save/restore
      the original vlan tag was needed), and recent patches added the
      ability to configure a vlan tag. This patch just ties those two
      together.
      
      An SR-IOV device doesn't support vlan trunking, so if anyone tries to
      configure more than a single tag, or set the trunk flag, and error is
      logged.
      3fdd85bf
    • L
      util: properly save/restore original vlan tag for VFs · e979226b
      Laine Stump 提交于
      When a network device that is a VF of an SR-IOV card was assigned to a
      guest using <interface type='hostdev'>, only the MAC address was being
      saved/restored, but the VLAN tag was left untouched. Up to now we
      haven't actually used vlan tags on SR-IOV devices, so the guest would
      have used whatever was set, and left it the same at the end.
      
      The patch following this one will hook up the <vlan> element from the
      interface config, so save/restore of the device state needs to also
      include the vlan tag.
      
      MAC address is being saved as a simple ASCII string in a file named
      for the device under /var/run.  The VLAN tag is now just added at the
      end of that file, after a newline. It might be nicer if the file was
      XML (in case it ever gets more complicated) but at the moment there's
      nothing else on the horizon, and this makes backward compatibility
      easier.
      e979226b
    • O
      qemu: Ensure the cpuset is formatted as expected before passing to cgroup · 29d8ed7a
      Osier Yang 提交于
      The parameter value for cpuset could be in special format like
      "0-10,^7", which is not recognized by cgroup. This patch is to
      ensure the cpuset is formatted as expected before passing it to
      cgroup. As a side effect, after the patch, it parses the cpuset
      early before cgroup setting, to avoid the rollback if cpuset
      parsing fails afterwards.
      29d8ed7a
    • D
      Move some SASL symbols into libvirt_sasl.syms · eed537c5
      Daniel P. Berrange 提交于
      Previous commit:
      
        commit 9093ab77
        Author: Daniel P. Berrange <berrange@redhat.com>
        Date:   Wed Jul 18 17:03:17 2012 +0100
      
          Add lots of internal symbols to libvirt_private.syms
      
      mistakenly put some conditional SASL symbols in libvirt_private.syms
      instead of libvirt_sasl.syms
      eed537c5
    • L
      network: make network driver vlan-aware · 4eb4c6fa
      Laine Stump 提交于
      The network driver now looks for the vlan element in network and
      portgroup objects, and logs an error at network define time if a vlan
      is requested for a network type that doesn't support it. (Currently
      vlan configuration is only supported for openvswitch networks, and
      networks used to do hostdev assignment of SR-IOV VFs.)
      
      At runtime, the three potential sources of vlan information are
      examined in this order: interface, chosen portgroup, network, and the
      first that is non-empty is used.  Another check for valid network type
      is made at this time, since the interface may have requested a vlan (a
      legal thing to have in the interface config, since it's not known
      until runtime if the chosen network will actually support it).
      
      Since we must also check for domains requesting vlans for unsupported
      connection types even if they are type='network', and since
      networkAllocateActualDevice() is being called in exactly the correct
      places, and has all of the necessary information to check, I slightly
      modified the logic of that function so that interfaces that aren't
      type='network' don't just return immediately. Instead, they also
      perform all the same validation for supported features. Because of
      this, it's not necessary to make this identical check in the other
      three places that would normally require it: 1) qemu domain startup,
      2) qemu device hotplug, 3) lxc domain startup.
      
      This can be seen as a first step in consolidating network-related
      functionality into the network driver, rather than having copies of
      the same code spread around in multiple places; this will make it
      easier to split the network parts off into a separate daemon, as we've
      discussed recently.
      4eb4c6fa
    • L
      conf: add <vlan> element to network and domain interface elements · 3f9274a5
      Laine Stump 提交于
      The following config elements now support a <vlan> subelements:
      
      within a domain: <interface>, and the <actual> subelement of <interface>
      within a network: the toplevel, as well as any <portgroup>
      
      Each vlan element must have one or more <tag id='n'/> subelements.  If
      there is more than one tag, it is assumed that vlan trunking is being
      requested. If trunking is required with only a single tag, the
      attribute "trunk='yes'" should be added to the toplevel <vlan>
      element.
      
      Some examples:
      
        <interface type='hostdev'/>
          <vlan>
            <tag id='42'/>
          </vlan>
          <mac address='52:54:00:12:34:56'/>
          ...
        </interface>
      
        <network>
          <name>vlan-net</name>
          <vlan trunk='yes'>
            <tag id='30'/>
          </vlan>
          <virtualport type='openvswitch'/>
        </network>
      
        <interface type='network'/>
          <source network='vlan-net'/>
          ...
        </interface>
      
        <network>
          <name>trunk-vlan</name>
          <vlan>
            <tag id='42'/>
            <tag id='43'/>
          </vlan>
          ...
        </network>
      
        <network>
          <name>multi</name>
          ...
          <portgroup name='production'/>
            <vlan>
              <tag id='42'/>
            </vlan>
          </portgroup>
          <portgroup name='test'/>
            <vlan>
              <tag id='666'/>
            </vlan>
          </portgroup>
        </network>
      
        <interface type='network'/>
          <source network='multi' portgroup='test'/>
          ...
        </interface>
      
      IMPORTANT NOTE: As of this patch there is no backend support for the
      vlan element for *any* network device type. When support is added in
      later patches, it will only be for those select network types that
      support setting up a vlan on the host side, without the guest's
      involvement. (For example, it will be possible to configure a vlan for
      a guest connected to an openvswitch bridge, but it won't be possible
      to do that for one that is connected to a standard Linux host bridge.)
      3f9274a5
    • L
      util: add virNetDevVlanType · cfbdd005
      Laine Stump 提交于
      To allow for the possibility of vlan "trunks", which have more than
      one vlan tag associated with them, we need a vlan struct. Since it
      will be used by multiple files in src/util, src/conf, src/network, and
      src/qemu, it must be defined in src/util. Unfortunately there isn't
      currently a common file for simple netdev data definitions, so I
      created a new file.
      cfbdd005
  6. 15 8月, 2012 1 次提交