1. 24 7月, 2013 22 次提交
    • R
      Fix link_addr detection · 7e120829
      Roman Bogorodskiy 提交于
      link_addr detection in configure always reports that
      link_addr is missing because it uses link_addr(NULL, NULL) in
      AC_LINK_IFELSE check with limited set of headers that doesn't
      define NULL.
      
      Fix by replacing 'NULL' with just '0'.
      7e120829
    • M
      Use qemuOpenFile in qemu_driver.c · b4a40dd9
      Martin Kletzander 提交于
      On two places, the usage of open() is replaced with qemuOpenFile as
      that is the preferred method in those cases.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=963881
      b4a40dd9
    • M
      Make qemuOpenFile aware of per-VM DAC seclabel. · 849df287
      Martin Kletzander 提交于
      Function qemuOpenFile() haven't had any idea about seclabels applied
      to VMs only, so in case the seclabel differed from the "user:group"
      from configuration, there might have been issues with opening files.
      
      Make qemuOpenFile() VM-aware, but only optionally, passing NULL
      argument means skipping VM seclabel info completely.
      
      However, all current qemuOpenFile() calls look like they should use VM
      seclabel info in case there is any, so convert these calls as well.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=869053
      849df287
    • M
      Expose ownership ID parsing · bba579b6
      Martin Kletzander 提交于
      Parsing 'user:group' is useful even outside the DAC security driver,
      so expose the most abstract function which has no DAC security driver
      bits in itself.
      bba579b6
    • L
      qemu: set/validate slot/connection type when assigning slots for PCI devices · 3ceb4c7d
      Laine Stump 提交于
      Since PCI bridges, PCIe bridges, PCIe switches, and PCIe root ports
      all share the same namespace, they are all defined as controllers of
      type='pci' in libvirt (but with a differing model attribute). Each of
      these controllers has a certain connection type upstream, allows
      certain connection types downstream, and each can either allow a
      single downstream connection at slot 0, or connections from slot 1 -
      31.
      
      Right now, we only support the pci-root and pci-bridge devices, both
      of which only allow PCI devices to connect, and both which have usable
      slots 1 - 31. In preparation for adding other types of controllers
      that have different capabilities, this patch 1) adds info to the
      qemuDomainPCIAddressBus object to indicate the capabilities, 2) sets
      those capabilities appropriately for pci-root and pci-bridge devices,
      and 3) validates that the controller being connected to is the proper
      type when allocating slots or validating that a user-selected slot is
      appropriate for a device..
      
      Having this infrastructure in place will make it much easier to add
      support for the other PCI controller types.
      
      While it would be possible to do all the necessary checking by just
      storing the controller model in the qemyuDomainPCIAddressBus, it
      greatly simplifies all the validation code to also keep a "flags",
      "minSlot" and "maxSlot" for each - that way we can just check those
      attributes rather than requiring a nearly identical switch statement
      everywhere we need to validate compatibility.
      
      You may notice many places where the flags are seemingly hard-coded to
      
        QEMU_PCI_CONNECT_HOTPLUGGABLE | QEMU_PCI_CONNECT_TYPE_PCI
      
      This is currently the correct value for all PCI devices, and in the
      future will be the default, with small bits of code added to change to
      the flags for the few devices which are the exceptions to this rule.
      
      Finally, there are a few places with "FIXME" comments. Note that these
      aren't indicating places that are broken according to the currently
      supported devices, they are places that will need fixing when support
      for new PCI controller models is added.
      
      To assure that there was no regression in the auto-allocation of PCI
      addresses or auto-creation of integrated pci-root, ide, and usb
      controllers, a new test case (pci-bridge-many-disks) has been added to
      both the qemuxml2argv and qemuxml2xml tests. This new test defines a
      domain with several dozen virtio disks but no pci-root or
      pci-bridges. The .args file of the new test case was created using
      libvirt sources from before this patch, and the test still passes
      after this patch has been applied.
      3ceb4c7d
    • L
      qemu: make QEMU_PCI_ADDRESS_(SLOT|FUNCTION)_LAST less misleading · 9adafa08
      Laine Stump 提交于
      Although these two enums are named ..._LAST, they really had the value
      of ..._SIZE. This patch changes their values so that, e.g.,
      QEMU_PCI_ADDRESS_SLOT_LAST really is the slot number of the last slot
      on a PCI bus.
      9adafa08
    • L
      qemu: only check for PIIX3-specific device addrs on pc-* machinetypes · fcbfd584
      Laine Stump 提交于
      The implicit IDE, USB, and video controllers provided by the PIIX3
      chipset in the pc-* machinetypes are not present on other
      machinetypes, so we shouldn't be doing the special checking for
      them. This patch places those validation checks into a separate
      function that is only called for machine types that have a PIIX3 chip
      (which happens to be the i440fx-based pc-* machine types).
      
      One qemuxml2argv test data file had to be changed - the
      pseries-usb-multi test had included a piix3-usb-uhci device, which was
      being placed at a specific address, and also had slot 2 auto reserved
      for a video device, but the pseries virtual machine doesn't actually
      have a PIIX3 chip, so even if there was a piix3-usb-uhci driver for
      it, the device wouldn't need to reside at slot 1 function 2. I just
      changed the .argv file to have the generic slot info for the two
      devices that results when the special PIIX3 code isn't executed.
      fcbfd584
    • L
      qemu: turn qemuDomainPCIAddressBus into a struct · 23cc5352
      Laine Stump 提交于
      qemuDomainPCIAddressBus was an array of QEMU_PCI_ADDRESS_SLOT_LAST
      uint8_t's, which worked fine as long as every PCI bus was
      identical. In the future, some PCI busses will allow connecting PCI
      devices, and some will allow PCIe devices; also some will only allow
      connection of a single device, while others will allow connecting 31
      devices.
      
      In order to keep track of that information for each bus, we need to
      turn qemuDomainPCIAddressBus into a struct, for now with just one
      member:
      
         uint8_t slots[QEMU_PCI_ADDRESS_SLOT_LAST];
      
      Additional members will come in later patches.
      
      The item in qemuDomainPCIAddresSet that contains the array of
      qemuDomainPCIAddressBus is now called "buses" to be more consistent
      with the already existing "nbuses" (and with the new "slots" array).
      23cc5352
    • E
      build: work around broken kernel headers · d12c2811
      Eric Blake 提交于
      Thanks to a lack of coordination between kernel and glibc folks,
      it has been impossible to mix code using <linux/in.h> and
      <net/in.h> for some time now (see for example commit c308a9ae).
      On at least RHEL 6, <linux/if_bridge.h> tries to use the kernel
      side, and fails due to our desire to use the glibc side elsewhere:
      
      In file included from /usr/include/linux/if_bridge.h:17,
                       from util/virnetdevbridge.c:42:
      /usr/include/linux/in6.h:31: error: redefinition of ‘struct in6_addr’
      /usr/include/linux/in6.h:48: error: redefinition of ‘struct sockaddr_in6’
      /usr/include/linux/in6.h:56: error: redefinition of ‘struct ipv6_mreq’
      
      Thankfully, the kernel layout of these structs is ABI-compatible,
      they only differ in the type system presented to the C compiler.
      While there are other versions of kernel headers that avoid the
      problem, it is easier to just work around the issue than to expect
      all developers to upgrade to working kernel headers.
      
      * src/util/virnetdevbridge.c (includes): Coerce the kernel version
      of in.h to not collide with the normal version.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d12c2811
    • E
      dbus: work with older dbus · b551d740
      Eric Blake 提交于
      dbus 1.2.24 (on RHEL 6) lacks DBUS_TYPE_UNIX_FD; but as we aren't
      trying to pass one of those anyways, we can just drop support for
      it in our wrapper.  Solves this build error introduced in commit
      834c9c94:
      
        CC     libvirt_util_la-virdbus.lo
      util/virdbus.c:242: error: 'DBUS_TYPE_UNIX_FD' undeclared here (not in a function)
      
      * src/util/virdbus.c (virDBusBasicTypes): Drop support for unix fds.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b551d740
    • J
      valgrind.supp: Add more valgrind suppression paths · e91f14cb
      John Ferlan 提交于
      Update based on recent run/failures seen
      e91f14cb
    • J
      domain_event: Resolve memory leak found by Valgrind · 33aef5db
      John Ferlan 提交于
      Commit id '4421e257' strdup'd devAlias, but didn't free
      
      Running qemuhotplugtest under valgrind resulted in the following:
      
      ==7375== 9 bytes in 1 blocks are definitely lost in loss record 11 of 70
      ==7375==    at 0x4A0887C: malloc (vg_replace_malloc.c:270)
      ==7375==    by 0x37C1085D71: strdup (strdup.c:42)
      ==7375==    by 0x4CBBD5F: virStrdup (virstring.c:554)
      ==7375==    by 0x4CFF9CB: virDomainEventDeviceRemovedNew (domain_event.c:1174)
      ==7375==    by 0x427791: qemuDomainRemoveChrDevice (qemu_hotplug.c:2508)
      ==7375==    by 0x42C65D: qemuDomainDetachChrDevice (qemu_hotplug.c:3357)
      ==7375==    by 0x41C94F: testQemuHotplug (qemuhotplugtest.c:115)
      ==7375==    by 0x41D817: virtTestRun (testutils.c:168)
      ==7375==    by 0x41C400: mymain (qemuhotplugtest.c:322)
      ==7375==    by 0x41DF3A: virtTestMain (testutils.c:764)
      ==7375==    by 0x37C1021A04: (below main) (libc-start.c:225)
      33aef5db
    • J
      lxc: Resolve Coverity warning · 8134b37d
      John Ferlan 提交于
      Commit 'c8695053' resulted in the following:
      
      Coverity error seen in the output:
          ERROR: REVERSE_INULL
          FUNCTION: lxcProcessAutoDestroy
      
      Due to the 'dom' being checked before 'dom->persistent' since 'dom'
      is already dereferenced prior to that.
      8134b37d
    • D
      Create + setup cgroups atomically for LXC process · da704c87
      Daniel P. Berrange 提交于
      Currently the LXC driver creates the VM's cgroup prior to
      forking, and then libvirt_lxc moves the child process
      into the cgroup. This won't work with systemd whose APIs
      do the creation of cgroups + attachment of processes atomically.
      
      Fortunately we simply move the entire cgroups setup into
      the libvirt_lxc child process. We make it take place before
      fork'ing into the background, so by the time virCommandRun
      returns in the LXC driver, the cgroup is guaranteed to be
      present.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      da704c87
    • D
      Create + setup cgroups atomically for QEMU process · 2049ef99
      Daniel P. Berrange 提交于
      Currently the QEMU driver creates the VM's cgroup prior to
      forking, and then uses a virCommand hook to move the child
      into the cgroup. This won't work with systemd whose APIs
      do the creation of cgroups + attachment of processes atomically.
      
      Fortunately we have a handshake taking place between the
      QEMU driver and the child process prior to QEMU being exec()d,
      which was introduced to allow setup of disk locking. By good
      fortune this synchronization point can be used to enable the
      QEMU driver to do atomic setup of cgroups removing the use
      of the hook script.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      2049ef99
    • D
      Remove obsolete cgroups creation apis · d64e852b
      Daniel P. Berrange 提交于
      The virCgroupNewDomainDriver and virCgroupNewDriver methods
      are obsolete now that we can auto-detect existing cgroup
      placement. Delete them to reduce code bloat.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d64e852b
    • D
      Auto-detect existing cgroup placement · 87b2e6fa
      Daniel P. Berrange 提交于
      Use the new virCgroupNewDetect function to determine cgroup
      placement of existing running VMs. This will allow the legacy
      cgroups creation APIs to be removed entirely
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      87b2e6fa
    • D
      Add API for checking if a cgroup is valid for a domain · e638778e
      Daniel P. Berrange 提交于
      Add virCgroupIsValidMachine API to check whether an auto
      detected cgroup is valid for a machine. This lets us
      check if a VM has just been placed into some generic
      shared cgroup, or worse, the root cgroup
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      e638778e
    • D
      Add a virCgroupNewDetect API for finding cgroup placement · 66a7f857
      Daniel P. Berrange 提交于
      Add a virCgroupNewDetect API which is used to initialize a
      cgroup object with the placement of an arbitrary process.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      66a7f857
    • D
      Add logic for handling systemd-machined non-existance · 666bff4f
      Daniel P. Berrange 提交于
      If systemd machine does not exist, return -2 instead of -1,
      so that applications don't need to repeat the tedious error
      checking code
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      666bff4f
    • D
      Fix handling of DBus errors emitted by the bus itself · c64904b7
      Daniel P. Berrange 提交于
      Current code for handling dbus errors only works for errors
      received from the remote application itself. We must also
      handle errors emitted by the bus itself, for example, when
      it fails to spawn the target service.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      c64904b7
    • J
      storage: Add connection for autostart storage pool · a873b496
      John Ferlan 提交于
      Add a privileged field to storageDriverState
      
      Use the privileged value in order to generate a connection which could
      be passed to the various storage backend drivers.
      
      In particular, the iSCSI driver will need a connect in order to perform
      pool authentication using the 'chap' secrets and the RBD driver utilizes
      the connection during pool refresh for pools using 'ceph' secrets.
      
      For now that connection will be to be to qemu driver until a mechanism
      is devised to get a connection to just the secret driver without qemu.
      a873b496
  2. 23 7月, 2013 16 次提交
    • J
      Adjust 'ceph' authentication secret usage for rbd pool. · c2257d2e
      John Ferlan 提交于
      Update virStorageBackendRBDOpenRADOSConn() to use the internal API to the
      secret driver in order to get the secret value instead of the external
      virSecretGetValue() path. Without the flag VIR_SECRET_GET_VALUE_INTERNAL_CALL
      there is no way to get the value of private secret.
      
      This also requires ensuring there is a connection which wasn't true for
      for the refreshPool() path calls from storageDriverAutostart() prior to
      adding support for the connection to a qemu driver. It seems calls to
      virSecretLookupByUUIDString() and virSecretLookupByUsage() from the
      refreshPool() path would have failed with no way to find the secret - that is
      theoretically speaking since the 'conn' was NULL the failure would have been
      "failed to find the secret".
      c2257d2e
    • J
      storage: Support "chap" authentication for iscsi pool · 249409e7
      John Ferlan 提交于
      Although the XML for CHAP authentication with plain "password"
      was introduced long ago, the function was never implemented. This
      patch replaces the login/password mechanism by following the
      'ceph' (or RBD) model of using a 'username' with a 'secret' which
      has the authentication information.
      
      This patch performs the authentication during startPool() processing
      of pools with an authType of VIR_STORAGE_POOL_AUTH_CHAP specified
      for iSCSI pools.
      
      There are two types of CHAP configurations supported for iSCSI
      authentication:
      
        * Initiator Authentication
            Forward, one-way; The initiator is authenticated by the target.
      
        * Target Authentication
            Reverse, Bi-directional, mutual, two-way; The target is authenticated
            by the initiator; This method also requires Initiator Authentication
      
      This only supports the "Initiator Authentication". (I don't have any
      enterprise iSCSI env for testing, only have a iSCSI target setup with
      tgtd, which doesn't support "Target Authentication").
      
      "Discovery authentication" is not supported by tgt yet too. So this only
      setup the session authentication by executing 3 iscsiadm commands, E.g:
      
      % iscsiadm -m node --target "iqn.2013-05.test:iscsi.foo" --name \
        "node.session.auth.authmethod" -v "CHAP" --op update
      
      % iscsiadm -m node --target "iqn.2013-05.test:iscsi.foo" --name \
        "node.session.auth.username" -v "Jim" --op update
      
      % iscsiadm -m node --target "iqn.2013-05.test:iscsi.foo" --name \
        "node.session.auth.password" -v "Jimsecret" --op update
      249409e7
    • J
      qemu_common: Create qemuBuildVolumeString() to process storage pool · 200ed39d
      John Ferlan 提交于
      Split out into its own separate routine
      200ed39d
    • J
      qemu: Create a common qemuGetSecretString · 7fa4a88a
      John Ferlan 提交于
      Make the secret fetching code common for qemuBuildRBDString() and
      qemuBuildDriveURIString() using the virDomainDiskDef.
      7fa4a88a
    • J
      qemu: Add source pool auth info to virDomainDiskDef for iSCSI · b83556d8
      John Ferlan 提交于
      During qemuTranslateDiskSourcePool() execution, if the srcpool has been
      defined with authentication information, then for iSCSI pools copy the
      authentication and host information to virDomainDiskDef.
      b83556d8
    • P
      qemu: Take error path if acquiring of job fails in qemuDomainSaveInternal · 29c2208c
      Peter Krempa 提交于
      Due to a goto statement missed when refactoring in 2771f8b7
      when acquiring of a domain job failed the error path was not taken. This
      resulted into a crash afterwards as an extra reference was removed from a
      domain object leading to it being freed. An attempt to list the domains
      leaded to a crash of the daemon afterwards.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=928672
      29c2208c
    • L
      build: fix make rpm failure · e4acc1e9
      Laine Stump 提交于
      util/virdbuspriv.h needed to be added to UTIL_SOURCES in the makefile.
      e4acc1e9
    • R
      bridge driver: use more general function names · 73cf5b96
      Roman Bogorodskiy 提交于
      Continue preparation for extracting platform-specific
      parts from bridge_driver: s/Iptables/Firewall/ for
      firewall related function names.
      73cf5b96
    • R
      Add virDBusMessage(Encode,Decode) stubs · ac26b2b0
      Roman Bogorodskiy 提交于
      Commit 834c9c94 introduced virDBusMessageEncode and
      virDBusMessageDecode functions, however corresponding stubs
      were not added to !WITH_DBUS section, therefore 'make check'
      started to fail when compiled w/out dbus support like that:
      
      Expected symbol virDBusMessageDecode is not in ELF library
      ac26b2b0
    • G
      virsh: fix change-media bug on disk block type · 7729a168
      Guannan Ren 提交于
      Resolves:https://bugzilla.redhat.com/show_bug.cgi?id=923053
      When cdrom is block type, the virsh change-media failed to insert
      source info because virsh uses "<source block='/dev/sdb'/>" while
      the correct name of the attribute for block disks is "dev".
      7729a168
    • O
      qemu: Translate the volume type disk source before cgroup setting · b6c162d3
      Osier Yang 提交于
      The translation must be done before both of cgroup and security
      setting, otherwise since the disk source is not translated yet,
      it might be skipped on cgroup and security setting.
      b6c162d3
    • O
      conf: Ignore the volume type disk if its mode is "direct" · 98584358
      Osier Yang 提交于
      virDomainDiskDefForeachPath is not only used by the security
      setting helpers, also used by cgroup setting helpers, so this
      is to ignore the volume type disk with mode="direct" for cgroup
      setting.
      98584358
    • J
      qemu: Translate the iscsi pool/volume disk source · 1b4eaa61
      John Ferlan 提交于
      The difference with already supported pool types (dir, fs, block)
      is: there are two modes for iscsi pool (or network pools in future),
      one can specify it either to use the volume target path (the path
      showed up on host) with mode='host', or to use the remote URI qemu
      supports (e.g. file=iscsi://example.org:6000/iqn.1992-01.com.example/1)
      with mode='direct'.
      
      For 'host' mode, it copies the volume target path into disk->src. For
      'direct' mode, the corresponding info in the *one* pool source host def
      is copied to disk->hosts[0].
      1b4eaa61
    • J
      conf: Introduce virDomainDiskSourceIsBlockType · 1f49b05a
      John Ferlan 提交于
      Introduce a new helper to check if the disk source is of block type
      1f49b05a
    • J
      conf: Introduce new XML tag "mode" for disk source · c00b2f0d
      John Ferlan 提交于
      There are two ways to use a iSCSI LUN as disk source for qemu.
      
       * The LUN's path as it shows up on host, e.g.
         /dev/disk/by-path/ip-$ip:3260-iscsi-$iqn-fc18:iscsi.iscsi0-lun-1
      
       * The libiscsi URI from the storage pool source element host attribute, e.g.
         iscsi://demo.org:6000/iqn.1992-01.com.example/1
      
      For a "volume" type disk, if the specified "pool" is of iscsi
      type, we should support to use the LUN in either of above 2 ways.
      That's why to introduce a new XML tag "mode" for the disk source
      (libvirt should support iscsi pool with libiscsi, but it's another
      new feature, which should be done later).
      
      The "mode" can be either of "host" or "direct". Use "host" to indicate
      use of the LUN with the path as it shows up on host. Use "direct" to
      indicate to use it with the source pool host URI (future patches may support
      to use network type libvirt storage too, e.g. Ceph)
      c00b2f0d
    • J
      storage_iscsi: Reflect the default target port · 5c62d5ea
      John Ferlan 提交于
      Make sure default iSCSI target is 3260.
      5c62d5ea
  3. 22 7月, 2013 2 次提交