1. 12 1月, 2012 5 次提交
  2. 11 1月, 2012 15 次提交
    • D
      Disable netcf if building without libvirtd · ba61012c
      Daniel P. Berrange 提交于
      Although the netcf interface driver can in theory be used by
      the stateless drivers, in practice none of them want to use
      it because they have different ways of dealing with interfaces.
      
      Furthermore, if you have mingw32-netcf installed, then the
      libvirt mingw32 build will fail with
      
        ../../src/interface/netcf_driver.c:644:5: error: unknown field 'close_used_without_including_unistd_h' specified in initializer
      
       * configure.ac: disable netcf if built without libvirtd
      ba61012c
    • E
      build: fix build on mingw with netcf available · 90cd1480
      Eric Blake 提交于
      The autobuilder pointed out an odd failure on mingw:
      ../../src/interface/netcf_driver.c:644:5: error: unknown field 'close_used_without_including_unistd_h' specified in initializer
      cc1: warnings being treated as errors
      
      This is because the gnulib headers #define close to different strings,
      according to which headers are included, in order to work around some
      odd mingw problems with close(), and these defines happen to also
      affect field members declared with a name of struct foo.close. As long
      as all headers are included before both the definition and use of the
      struct, the various #define doesn't matter, but the netcf file hit
      an instance where things were included in a different order.  Fix this
      for all clients that use a struct member named 'close'.
      
      * src/driver.h: Include <unistd.h> before using 'close'.
      90cd1480
    • E
      build: avoid spurious compiler warning · 18262b55
      Eric Blake 提交于
      For some weird reason, i686-pc-mingw32-gcc version 4.6.1 at -O2 complained:
      ../../src/conf/nwfilter_params.c: In function 'virNWFilterVarCombIterCreate':
      ../../src/conf/nwfilter_params.c:346:23: error: 'minValue' may be used uninitialized in this function [-Werror=uninitialized]
      ../../src/conf/nwfilter_params.c:319:28: note: 'minValue' was declared here
      ../../src/conf/nwfilter_params.c:344:23: error: 'maxValue' may be used uninitialized in this function [-Werror=uninitialized]
      ../../src/conf/nwfilter_params.c:319:18: note: 'maxValue' was declared here
      cc1: all warnings being treated as errors
      
      even though all paths of the preceding switch statement either
      assign the variables or return.
      
      * src/conf/nwfilter_params.c (virNWFilterVarCombIterAddVariable):
      Initialize variables.
      18262b55
    • S
      Add documentation new ways to access members of variables · a20cc3cc
      Stefan Berger 提交于
      This patch adds documentation about the new 'ways' that users can
      access the contents of variables in filters:
      
      - access via index: $TEST[2]
      - access via iterators $TEST[@1]
      a20cc3cc
    • S
      Add test cases for new ways to access variables in filters · 0c42e1d9
      Stefan Berger 提交于
      This patch adds a couple of XML parser / schema validator test cases
      for the new 'ways' to access variables via index or iterator.
      0c42e1d9
    • S
      Address side effects of accessing vars via index · 64484d55
      Stefan Berger 提交于
      Address side effect of accessing a variable via an index: Filters
      accessing a variable where an element is accessed that is beyond the
      size of the list (for example $TEST[10] and only 2 elements are available)
      cannot instantiate that filter. Test for this and report proper error
      to user.
      64484d55
    • S
      Add access to elements of variables via index · caa6223a
      Stefan Berger 提交于
      This patch adds access to single elements of variables via index. Example:
      
        <rule action='accept' direction='in' priority='500'>
          <tcp srcipaddr='$ADDR[1]' srcportstart='$B[2]'/>
        </rule>
      
      caa6223a
    • S
      Introduce possibility to have an iterator per variable · 80e9a5cd
      Stefan Berger 提交于
      This patch introduces the capability to use a different iterator per
      variable.
      
      The currently supported notation of variables in a filtering rule like
      
        <rule action='accept' direction='out'>
           <tcp  srcipaddr='$A' srcportstart='$B'/>
        </rule>
      
      processes the two lists 'A' and 'B' in parallel. This means that A and B
      must have the same number of 'N' elements and that 'N' rules will be 
      instantiated (assuming all tuples from A and B are unique).
      
      In this patch we now introduce the assignment of variables to different
      iterators. Therefore a rule like
      
        <rule action='accept' direction='out'>
           <tcp  srcipaddr='$A[@1]' srcportstart='$B[@2]'/>
        </rule>
      
      will now create every combination of elements in A with elements in B since
      A has been assigned to an iterator with Id '1' and B has been assigned to an
      iterator with Id '2', thus processing their value independently.
      
      The first rule has an equivalent notation of
      
        <rule action='accept' direction='out'>
           <tcp  srcipaddr='$A[@0]' srcportstart='$B[@0]'/>
        </rule>
      80e9a5cd
    • S
      Optimize the elements the iterator visits. · 134c5676
      Stefan Berger 提交于
      In this patch we introduce testing whether the iterator points to a
      unique set of entries that have not been seen before at one of the previous
      iterations. The point is to eliminate duplicates and with that unnecessary
      filtering rules by preventing identical filtering rules from being
      instantiated.
      Example with two lists:
      
      list1 = [1,2,1]
      list2 = [1,3,1]
      
      The 1st iteration would take the 1st items of each list -> 1,1
      The 2nd iteration would take the 2nd items of each list -> 2,3
      The 3rd iteration would take the 3rd items of each list -> 1,1 but
      skip them since this same pair has already been encountered in the 1st
      iteration
      
      Implementation-wise this is solved by taking the n-th element of list1 and
      comparing it against elements 1..n-1. If no equivalent is found, then there
      is no possibility of this being a duplicate. In case an equivalent element
      is found at position i, then the n-th element in the 2nd list is compared
      against the i-th element in the 2nd list and if that is not the same, then
      this is a unique pair, otherwise it is not unique and we may need to do
      the same comparison on the 3rd list.
      
      134c5676
    • J
      apparmor: Mark pid parameter as unused · d82ef7c3
      Jiri Denemark 提交于
      d82ef7c3
    • A
      virsh: improve doMigrate function docs · c41a21de
      Alex Jia 提交于
      When running virsh migrate with --xml option and actual xml file doesn't
      exist, virsh hasn't output any error information, although return value
      is 1.
      
      * tools/virsh.c: Raising a appropriate error information when operation fails.
      
      * How to reproduce?
      % virsh migrate <domain> --live qemu+ssh://<target host>/system --xml non-existent.xml
      % echo $?
      
      * Fixed result:
      error: file 'non-existent.xml' doesn't exist
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      c41a21de
    • D
      Change security driver APIs to use virDomainDefPtr instead of virDomainObjPtr · 99be754a
      Daniel P. Berrange 提交于
      When sVirt is integrated with the LXC driver, it will be neccessary
      to invoke the security driver APIs using only a virDomainDefPtr
      since the lxc_container.c code has no virDomainObjPtr available.
      Aside from two functions which want obj->pid, every bit of the
      security driver code only touches obj->def. So we don't need to
      pass a virDomainObjPtr into the security drivers, a virDomainDefPtr
      is sufficient. Two functions also gain a 'pid_t pid' argument.
      
      * src/qemu/qemu_driver.c, src/qemu/qemu_hotplug.c,
        src/qemu/qemu_migration.c, src/qemu/qemu_process.c,
        src/security/security_apparmor.c,
        src/security/security_dac.c,
        src/security/security_driver.h,
        src/security/security_manager.c,
        src/security/security_manager.h,
        src/security/security_nop.c,
        src/security/security_selinux.c,
        src/security/security_stack.c: Change all security APIs to use a
        virDomainDefPtr instead of virDomainObjPtr
      99be754a
    • E
      snapshot: allow reuse of existing files in disk snapshot · 4e9953a4
      Eric Blake 提交于
      When disk snapshots were first implemented, libvirt blindly refused
      to allow an external snapshot destination that already exists, since
      qemu will blindly overwrite the contents of that file during the
      snapshot_blkdev monitor command, and we don't like a default of
      data loss by default.  But VDSM has a scenario where NFS permissions
      are intentionally set so that the destination file can only be
      created by the management machine, and not the machine where the
      guest is running, so that libvirt will necessarily see the destination
      file already existing; adding a flag will allow VDSM to force the file
      reuse without libvirt complaining of possible data loss.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=767104
      
      * include/libvirt/libvirt.h.in (virDomainSnapshotCreateFlags): Add
      VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT.
      * src/libvirt.c (virDomainSnapshotCreateXML): Document it.  Add
      note about partial failure.
      * tools/virsh.c (cmdSnapshotCreate, cmdSnapshotCreateAs): Add new
      flag.
      * tools/virsh.pod (snapshot-create, snapshot-create-as): Document
      it.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotDiskPrepare)
      (qemuDomainSnapshotCreateXML): Implement the new flag.
      4e9953a4
    • E
      docs: standardize description of flags · 529e4a50
      Eric Blake 提交于
      We had loads of different styles in describing the @flags parameter
      for various APIs, as well as several APIs that didn't list which
      enums provided the bit values valid for the flags.
      
      The end result is one of two formats:
      @flags: bitwise-OR of vir...Flags
      @flags: extra flags; not used yet, so callers should always pass 0
      
      * src/libvirt.c: Use common sentences for flags.  Also,
      (virDomainGetBlockIoTune): Mention virTypedParameterFlags.
      (virConnectOpenAuth): Mention virConnectFlags.
      (virDomainMigrate, virDomainMigrate2, virDomainMigrateToURI)
      (virDomainMigrateToURI2): Mention virDomainMigrateFlags.
      (virDomainMemoryPeek): Mention virDomainMemoryFlags.
      (virStoragePoolBuild): Mention virStoragePoolBuildFlags.
      (virStoragePoolDelete): Mention virStoragePoolDeleteFlags.
      (virStreamNew): Mention virStreamFlags.
      (virDomainOpenGraphics): Mention virDomainOpenGraphicsFlags.
      529e4a50
    • L
      qemu: check for kvm availability before starting kvm guests · 32f63e91
      Laine Stump 提交于
      This *kind of* addresses:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=772395
      
      (it doesn't eliminate the failure to start, but causes libvirt to give
      a better idea about the cause of the failure).
      
      If a guest uses a kvm emulator (e.g. /usr/bin/qemu-kvm) and the guest
      is started when kvm isn't available (either because virtualization is
      unavailable / has been disabled in the BIOS, or the kvm modules
      haven't been loaded for some reason), a semi-cryptic error message is
      logged:
      
        libvirtError: internal error Child process (LC_ALL=C
        PATH=/sbin:/usr/sbin:/bin:/usr/bin /usr/bin/qemu-kvm -device ? -device
        pci-assign,? -device virtio-blk-pci,? -device virtio-net-pci,?) status
        unexpected: exit status 1
      
      This patch notices at process start that a guest needs kvm, and checks
      for the presence of /dev/kvm (a reasonable indicator that kvm is
      available) before trying to execute the qemu binary. If kvm isn't
      available, a more useful (too verbose??) error is logged.
      32f63e91
  3. 10 1月, 2012 3 次提交
  4. 09 1月, 2012 2 次提交
    • L
      qemu: add new disk device='lun' for bus='virtio' & type='block' · 177db087
      Laine Stump 提交于
      In the past, generic SCSI commands issued from a guest to a virtio
      disk were always passed through to the underlying disk by qemu, and
      the kernel would also pass them on.
      
      As a result of CVE-2011-4127 (see:
      http://seclists.org/oss-sec/2011/q4/536), qemu now honors its
      scsi=on|off device option for virtio-blk-pci (which enables/disables
      passthrough of generic SCSI commands), and the kernel will only allow
      the commands for physical devices (not for partitions or logical
      volumes). The default behavior of qemu is still to allow sending
      generic SCSI commands to physical disks that are presented to a guest
      as virtio-blk-pci devices, but libvirt prefers to disable those
      commands in the standard virtio block devices, enabling it only when
      specifically requested (hopefully indicating that the requester
      understands what they're asking for). For this purpose, a new libvirt
      disk device type (device='lun') has been created.
      
      device='lun' is identical to the default device='disk', except that:
      
      1) It is only allowed if bus='virtio', type='block', and the qemu
         version is "new enough" to support it ("new enough" == qemu 0.11 or
         better), otherwise the domain will fail to start and a
         CONFIG_UNSUPPORTED error will be logged).
      
      2) The option "scsi=on" will be added to the -device arg to allow
         SG_IO commands (if device !='lun', "scsi=off" will be added to the
         -device arg so that SG_IO commands are specifically forbidden).
      
      Guests which continue to use disk device='disk' (the default) will no
      longer be able to use SG_IO commands on the disk; those that have
      their disk device changed to device='lun' will still be able to use SG_IO
      commands.
      
      *docs/formatdomain.html.in - document the new device attribute value.
      *docs/schemas/domaincommon.rng - allow it in the RNG
      *tests/* - update the args of several existing tests to add scsi=off, and
       add one new test that will test scsi=on.
      *src/conf/domain_conf.c - update domain XML parser and formatter
      
      *src/qemu/qemu_(command|driver|hotplug).c - treat
       VIR_DOMAIN_DISK_DEVICE_LUN *almost* identically to
       VIR_DOMAIN_DISK_DEVICE_DISK, except as indicated above.
      
      Note that no support for this new device value was added to any
      hypervisor drivers other than qemu, because it's unclear what it might
      mean (if anything) to those drivers.
      177db087
    • L
      qemu: add capabilities flags related to SG_IO · e8daeeb1
      Laine Stump 提交于
      This patch adds two capabilities flags to deal with various aspects
      of supporting SG_IO commands on virtio-blk-pci devices:
      
        QEMU_CAPS_VIRTIO_BLK_SCSI
          set if -device virtio-blk-pci accepts the scsi="on|off" option
          When present, this is on by default, but can be set to off to disable
          SG_IO functions.
      
        QEMU_CAPS_VIRTIO_BLK_SG_IO
          set if SG_IO commands are supported in the virtio-blk-pci driver
          (present since qemu 0.11 according to a qemu developer, if I
           understood correctly)
      e8daeeb1
  5. 08 1月, 2012 1 次提交
    • L
      config: report error when script given for inappropriate interface type · 1734cdb9
      Laine Stump 提交于
      This fixes https://bugzilla.redhat.com/show_bug.cgi?id=638633
      
      Although scripts are not used by interfaces of type other than
      "ethernet" in qemu, due to the fact that the parser stores the script
      name in a union that is only valid when type is ethernet or bridge,
      there is no way for anyone except the parser itself to catch the
      problem of specifying an interface script for an inappropriate
      interface type (by the time the parsed data gets back to the code that
      called the parser, all evidence that a script was specified is
      forgotten).
      
      Since the parser itself should be agnostic to which type of interface
      allows scripts (an example of why: a script specified for an interface
      of type bridge is valid for xen domains, but not for qemu domains),
      the solution here is to move the script out of the union(s) in the
      DomainNetDef, always populate it when specified (regardless of
      interface type), and let the driver decide whether or not it is
      appropriate.
      
      Currently the qemu, xen, libxml, and uml drivers recognize the script
      parameter and do something with it (the uml driver only to report that
      it isn't supported). Those drivers have been updated to log a
      CONFIG_UNSUPPORTED error when a script is specified for an interface
      type that's inappropriate for that particular hypervisor.
      
      (NB: There was earlier discussion of solving this problem by adding a
      VALIDATE flag to all libvirt APIs that accept XML, which would cause
      the XML to be validated against the RNG files. One statement during
      that discussion was that the RNG shouldn't contain hypervisor-specific
      things, though, and a proper solution to this problem would require
      that (again, because a script for an interface of type "bridge" is
      accepted by xen, but not by qemu).
      1734cdb9
  6. 07 1月, 2012 5 次提交
    • E
      qemu: one more client to live/config helper · 13a776ca
      Eric Blake 提交于
      Commit ae523427 missed one pair of functions that could use
      the helper routine.
      
      * src/qemu/qemu_driver.c (qemuSetSchedulerParametersFlags)
      (qemuGetSchedulerParametersFlags): Simplify.
      13a776ca
    • D
      Release of libvirt-0.9.9 · 2f667b56
      Daniel Veillard 提交于
      * configure.ac docs/news.html.in libvirt.spec.in: update for the release
      * po/*.po*: updated localizations from transifex and regenerated
      2f667b56
    • E
      tests: work around pdwtags 1.9 failure · cf6d3625
      Eric Blake 提交于
      On rawhide, gcc is new enough to output new DWARF information that
      pdwtags has not yet learned, but the resulting 'make check' output
      was rather confusing:
      
      $ make -C src check
      ...
        GEN    virkeepaliveprotocol-structs
      die__process_function: DW_TAG_INVALID (0x4109) @ <0x58c> not handled!
      WARNING: your pdwtags program is too old
      WARNING: skipping the virkeepaliveprotocol-structs test
      WARNING: install dwarves-1.3 or newer
      ...
      $ pdwtags --version
      v1.9
      
      I've filed the pdwtags deficiency as
      https://bugzilla.redhat.com/show_bug.cgi?id=772358
      
      * src/Makefile.am (PDWTAGS): Don't leave -t file behind on version
      mismatch.  Soften warning message, since 1.9 is newer than 1.3.
      Don't leak stderr from broken version.
      cf6d3625
    • E
      build: fix mingw virCommand build · 03ea5673
      Eric Blake 提交于
      Commit db371a21 mistakenly added new functions inside a #ifndef WIN32
      guard, even though they are needed on all platforms.
      
      * src/util/command.c (virCommandFDSet): Move outside WIN32
      conditional.
      03ea5673
    • E
      tests: avoid test failure on rawhide gnutls · 74ff5750
      Eric Blake 提交于
      I hit a VERY weird testsuite failure on rawhide, which included
      _binary_ output to stderr, followed by a hang waiting for me
      to type something! (Here, using ^@ for NUL):
      
      $ ./commandtest
      TEST: commandtest
            WARNING: gnome-keyring:: couldn't send data: Bad file descriptor
      .WARNING: gnome-keyring:: couldn't send data: Bad file descriptor
      .WARNING: gnome-keyring:: couldn't send data: Bad file descriptor
      WARNING: gnome-keyring:: couldn't send data: Bad file descriptor
      .8^@^@^@8^@^@^@^A^@^@^@^Bay^A^@^@^@)PRIVATE-GNOME-KEYRING-PKCS11-PROTOCOL-V-1
      
      I finally traced it to the fact that gnome-keyring, called via
      gnutls_global_init which is turn called by virNetTLSInit, opens
      an internal fd that it expects to communicate to via a
      pthread_atfork handler (never mind that it violates POSIX by
      using non-async-signal-safe functions in that handler:
      https://bugzilla.redhat.com/show_bug.cgi?id=772320).
      
      Our problem stems from the fact that we pulled the rug out from
      under the library's expectations by closing an fd that it had
      just opened.  While we aren't responsible for fixing the bugs
      in that pthread_atfork handler, we can at least avoid the bugs
      by not closing the fd in the first place.
      
      * tests/commandtest.c (mymain): Avoid closing fds that were opened
      by virInitialize.
      74ff5750
  7. 06 1月, 2012 4 次提交
    • A
      qemu: Avoid memory leaks on qemuParseRBDString · b41d440e
      Alex Jia 提交于
      Detected by valgrind. Leak introduced in commit 5745dc12.
      
      * src/qemu/qemu_command.c: fix memory leak on failure and successful path.
      
      * How to reproduce?
      % valgrind -v --leak-check=full ./qemuargv2xmltest
      
      * Actual result:
      
      ==2196== 80 bytes in 1 blocks are definitely lost in loss record 3 of 4
      ==2196==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
      ==2196==    by 0x39CF07F6E1: strdup (in /lib64/libc-2.12.so)
      ==2196==    by 0x419823: qemuParseRBDString (qemu_command.c:1657)
      ==2196==    by 0x4221ED: qemuParseCommandLine (qemu_command.c:5934)
      ==2196==    by 0x422AFB: qemuParseCommandLineString (qemu_command.c:7561)
      ==2196==    by 0x416864: testCompareXMLToArgvHelper (qemuargv2xmltest.c:48)
      ==2196==    by 0x417DB1: virtTestRun (testutils.c:141)
      ==2196==    by 0x415CAF: mymain (qemuargv2xmltest.c:175)
      ==2196==    by 0x4174A7: virtTestMain (testutils.c:696)
      ==2196==    by 0x39CF01ECDC: (below main) (in /lib64/libc-2.12.so)
      ==2196==
      ==2196== LEAK SUMMARY:
      ==2196==    definitely lost: 80 bytes in 1 blocks
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      b41d440e
    • E
      build: drop check for ANSI compiler · 307f3635
      Eric Blake 提交于
      Using automake.git (will become 1.12 someday), I got this error:
      
      configure.ac:90: error: automatic de-ANSI-fication support has been removed
      /usr/local/share/aclocal-1.11a/protos.m4:13: AM_C_PROTOTYPES is expanded from...
      configure.ac:90: the top level
      autom4te: /usr/bin/m4 failed with exit status: 1
      
      In short, pre-C89 compilers are no longer a viable portability
      target.  Besides, our code base already requires C99, so worrying
      about pre-C89 seems pointless.
      
      * configure.ac (AM_C_PROTOTYPES): Drop, since newer automake no
      longer provides it.
      307f3635
    • H
      qemu: fix a bug in numatune · 6b780f74
      Hu Tao 提交于
      When setting numa nodeset for a domain which has no nodeset set
      before, libvirtd crashes by dereferencing the pointer to the old
      nodemask which is null in that case.
      6b780f74
    • E
      qemu: fix use-after-free regression · 820a2159
      Eric Blake 提交于
      Commit baade4d fixed a memory leak on failure, but in the process,
      introduced a use-after-free on success, which can be triggered with:
      
      1. set bandwidth with --live
      2. query bandwidth
      3. set bandwidth with --live
      
      * src/qemu/qemu_driver.c (qemuDomainSetInterfaceParameters): Don't
      free newBandwidth on success.
      Reported by Hu Tao.
      820a2159
  8. 05 1月, 2012 4 次提交
    • E
      seclabel: fix regression in libvirtd restart · 302fe95f
      Eric Blake 提交于
      Commit b4343293 has a logic bug: seclabel overrides don't set
      def->type, but the default value is 0 (aka static).  Restarting
      libvirtd would thus reject the XML for any domain with an
      override of <seclabel relabel='no'/> (which happens quite
      easily if a disk image lives on NFS), with a message:
      
      2012-01-04 22:29:40.949+0000: 6769: error : virSecurityLabelDefParseXMLHelper:2593 : XML error: security label is missing
      
      Fix the logic to never read from an override's def->type, and
      to allow a missing <label> subelement when relabel is no.  There's
      a lot of stupid double-negatives in the code (!norelabel) because
      of the way that we want the zero-initialized defaults to behave.
      
      * src/conf/domain_conf.c (virSecurityLabelDefParseXMLHelper): Use
      type field from correct location.
      302fe95f
    • M
      command: Discard FD_SETSIZE limit for opened files · db371a21
      Michal Privoznik 提交于
      Currently, virCommand implementation uses FD_ macros from
      sys/select.h. However, those cannot handle more opened files
      than FD_SETSIZE. Therefore switch to generalized implementation
      based on array of integers.
      db371a21
    • J
      Support Xen domctl v8 · 49d8c8bc
      Jim Fehlig 提交于
      xen-unstable c/s 23874:651aed73b39c added another member to
      xen_domctl_getdomaininfo struct and bumped domctl version to 8.
      Add a corresponding domctl v8 struct in xen hypervisor sub-driver
      and detect domctl v8 during initialization.
      49d8c8bc
    • J
      Fix xenstore serial console path for HVM guests · beeea90a
      Jim Fehlig 提交于
      The console path in xenstore is /local/domain/<id>/console/tty
      for PV guests (PV console) and /local/domain/<id>/serial/0/tty
      (serial console) for HVM guests.  Similar to Xen's in-tree console
      client, read the correct path for PV vs HVM.
      beeea90a
  9. 04 1月, 2012 1 次提交