1. 22 11月, 2012 12 次提交
    • M
      conf: Report sensible error for invalid disk name · 03cd6e4a
      Martin Kletzander 提交于
      The error "... but the cause is unknown" appeared for XMLs similar to
      this:
      
       <disk type='file' device='cdrom'>
         <driver name='qemu' type='raw'/>
         <source file='/dev/zero'/>
         <target dev='sr0'/>
       </disk>
      
      Notice unsupported disk type (for the driver), but also no address
      specified. The first part is not a problem and we should not abort
      immediately because of that, but the combination with the address
      unknown was causing an unspecified error.
      
      While fixing this, I added an error to one place where this return
      value was not managed properly.
      03cd6e4a
    • N
      build: trivial fix error: implicit declaration of function 'malloc' · 89ad205f
      Natanael Copa 提交于
      Fixes this error when building with -Werror on Alpine Linux:
      
      util/processinfo.c: In function 'virProcessInfoSetAffinity':
      util/processinfo.c:52:5: error: implicit declaration of function 'malloc' [-Werror=implicit-function-declaration]
      Signed-off-by: NNatanael Copa <ncopa@alpinelinux.org>
      89ad205f
    • D
      Log an audit message with the LXC init pid · a6158336
      Daniel P. Berrange 提交于
      Currently the LXC driver logs audit messages when a container
      is started or stopped. These audit messages, however, contain
      the PID of the libvirt_lxc supervisor process. To enable
      sysadmins to correlate with audit messages generated by
      processes /inside/ the container, we need to include the
      container init process PID.
      
      We can't do this in the main 'start' audit message, since
      the init PID is not available at that point. Instead we output
      a completely new audit record, that lists both PIDs.
      
      type=VIRT_CONTROL msg=audit(1353433750.071:363): pid=20180 uid=0 auid=501 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='virt=lxc op=init vm="busy" uuid=dda7b947-0846-1759-2873-0f375df7d7eb vm-pid=20371 init-pid=20372 exe="/home/berrange/src/virt/libvirt/daemon/.libs/lt-libvirtd" hostname=? addr=? terminal=pts/6 res=success'
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      a6158336
    • D
      Use virNetServerRun instead of custom main loop · f33e43c2
      Daniel P. Berrange 提交于
      The LXC controller code currently directly invokes the
      libvirt main loop code. The problem is that this misses
      the cleanup of virNetServerClient connections that
      virNetServerRun takes care of.
      
      The result is that when libvirtd is stopped, the
      libvirt_lxc controller process gets stuck in a I/O loop.
      When libvirtd is then started again, it fails to connect
      to the controller and thus kills off the entire domain.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f33e43c2
    • O
      storage: Improve virStorageBackendFileSystemStop · 104650db
      Osier Yang 提交于
      It's actually not used for DIR pool. So removing the checking.
      104650db
    • O
      storage: Fix bug of fs pool destroying · f4ac0656
      Osier Yang 提交于
      Regression introduced by commit 258e06c8, "ret" could be set to 1
      or 0 by virStorageBackendFileSystemIsMounted before goto cleanup.
      This could mislead the callers (up to the public API
      virStoragePoolDestroy) to return success even the underlying umount
      command fails.
      f4ac0656
    • S
      qemu: fix RBD attach regression · f0e72b2f
      Scott Sullivan 提交于
      I have been testing libvirt v1.0.0 for deployment within my
      organization, and in the process discovered what appears to be a bug
      that breaks virsh attach-device, when attaching an RBD volume to an
      instance. First, here is the error presented, with v1.0.0 (this worked
      in v0.10.2):
      
      [root@host ~]# virsh attach-device W5APQ8  G84VV1.xml
      error: Failed to attach device from G84VV1.xml
      error: cannot open file 'dc3-1-test/G84VV1': No such file or directory
      
      Using git bisect, I narrowed the problem down to this as the first
      commit to break this setup:
      
      4d34c929 is the first bad commit
      f0e72b2f
    • J
      tests: update qemuhelptest data · bb2f6216
      Ján Tomko 提交于
      Both generated with
      qemu-system-x86_64 --help > qemu-1.2.0
      
      qemu-system-x86_64 \
      -device ? \
      -device pci-assign,? \
      -device virtio-blk-pci,? \
      -device virtio-net-pci,? \
      -device scsi-disk,? \
      -device PIIX4_PM,? \
      -device usb-redir,? \
      -device ide-drive,? \
      -device usb-host,? 2> qemu-1.2.0-device
      
      It seems I missed a few -device flags when doing this last time and I
      mixed up qemu and qemu-kvm.
      bb2f6216
    • J
      c5834ec1
    • J
      docs: Fix a few spaces · e628dbfb
      Ján Tomko 提交于
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      e628dbfb
    • J
      docs: boot order for host and redirected USB devices · 08c1435f
      Ján Tomko 提交于
      08c1435f
    • J
      conf: add support for booting from redirected USB devices · cc244e24
      Ján Tomko 提交于
      Commit a4c19459 only added the
      QEMU capability flag, command line option and added the boot element
      for redirdev's in the XML schema.
      
      This patch adds support for parsing and writing the XML with redirdevs
      with the boot flag. It also ignores unknown XML elements in redirdev
      instead of failing with:
      "error: An error occurred, but the cause is unknown"
      
      Bug: https://bugzilla.redhat.com/show_bug.cgi?id=805414
      cc244e24
  2. 21 11月, 2012 4 次提交
  3. 20 11月, 2012 4 次提交
    • E
      snapshot: make cloning of domain definition easier · 0b5617a6
      Eric Blake 提交于
      Upcoming patches for revert-and-clone branching of snapshots need
      to be able to copy a domain definition; make this step reusable.
      
      * src/conf/domain_conf.h (virDomainDefCopy): New prototype.
      * src/conf/domain_conf.c (virDomainObjCopyPersistentDef): Split...
      (virDomainDefCopy): ...into new function.
      (virDomainObjSetDefTransient): Use it.
      * src/libvirt_private.syms (domain_conf.h): Export it.
      * src/qemu/qemu_driver.c (qemuDomainRevertToSnapshot): Use it.
      0b5617a6
    • E
      snapshot: expose location through virsh snapshot-info · 0f9b6ee4
      Eric Blake 提交于
      Now that we can filter on this information, we should also make
      it easy to get at.
      
      * tools/virsh-snapshot.c (cmdSnapshotInfo): Add another output
      row, and switch to XPath queries rather than strstr.
      0f9b6ee4
    • E
      snapshot: implement new filter sets · 62711817
      Eric Blake 提交于
      Relatively straight-forward.  And since qemu was already using
      VIR_DOMAIN_SNAPSHOT_FILTERS_ALL, with 6 different APIs all calling
      into this common code, I've instantly added all 5 flags to 6 APIs.
      
      * src/conf/snapshot_conf.h (VIR_DOMAIN_SNAPSHOT_FILTERS_ALL):
      Enable new filters.
      * src/conf/snapshot_conf.c (virDomainSnapshotObjListGetNames):
      Prep the new flags.
      (virDomainSnapshotObjListCopyNames): Actually do the filtering.
      62711817
    • E
      snapshot: add virsh back-compat support for new filters · 1d272e8f
      Eric Blake 提交于
      Snapshot filtering based on types is useful enough to add
      back-compat support into virsh.  It is also rather easy - all
      versions of libvirt that don't understand the new filter flags
      already gave us sufficient information in a single XML field
      to reconstruct all the information we need (that is, it isn't
      until libvirt 1.0.1 that we have more interesting types of
      snapshots, such as offline external).
      
      * tools/virsh-snapshot.c (vshSnapshotFilter): New function.
      (vshSnapshotListCollect): Add fallback support.
      1d272e8f
  4. 19 11月, 2012 1 次提交
    • E
      snapshot: add two more filter sets to API · e9028f4b
      Eric Blake 提交于
      As we enable more modes of snapshot creation, it becomes more important
      to be able to quickly filter based on snapshot properties.  This patch
      introduces new filter flags; subsequent patches will introduce virsh
      back-compat filtering, as well as actual libvirt filtering.
      
      * include/libvirt/libvirt.h.in (virDomainSnapshotListFlags): Add
      five new flags in two new groups.
      * src/libvirt.c (virDomainSnapshotNum, virDomainSnapshotListNames)
      (virDomainListAllSnapshots, virDomainSnapshotNumChildren)
      (virDomainSnapshotListChildrenNames)
      (virDomainSnapshotListAllChildren): Document them.
      * src/conf/snapshot_conf.h (VIR_DOMAIN_SNAPSHOT_FILTERS_STATUS)
      (VIR_DOMAIN_SNAPSHOT_FILTERS_LOCATION): Add new convenience filter
      collection macros.
      * tools/virsh-snapshot.c (cmdSnapshotList): Add 5 new flags.
      * tools/virsh.pod (snapshot-list): Document them.
      e9028f4b
  5. 17 11月, 2012 4 次提交
    • L
      qemu: allow larger discrepency between memory & currentMemory in domain xml · 89204fca
      Laine Stump 提交于
      This resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=873134
      
      The reported problem is that an attempt to restore a saved domain that
      was configured with <currentMemory> and <memory> set to some (same for
      both) number that's not a multiple of 4096KiB results in an error like
      this:
      
        error: Failed to start domain libvirt_test_api
        error: XML error: current memory '4001792k' exceeds maximum '4000768k'
      
      (in this case, currentMemory was set to 4000000KiB).
      
      The reason for this failure is:
      
      1) a saved image contains the "live xml" of the domain at the time of
      the save.
      
      2) the live xml of a running domain gets its currentMemory
      (a.k.a. cur_balloon) directly from the qemu monitor rather than from
      the configuration of the domain.
      
      3) the value reported by qemu is (sometimes) not exactly what was
      originally given to qemu when the domain was started, but is rounded
      up to [some indeterminate granularity] - in some versions of qemu that
      granularity is apparently 1MiB, and in others it is 4MiB.
      
      4) When the XML is parsed to setup the state of the restored domain,
      the XML parser for <currentMemory> compares it to <memory> (which is
      the maximum allowed memory size for the domain) and if <currentMemory>
      is greater than the next 1024KiB boundary above <memory>, it spits out
      an error and fails.
      
      For example (from the BZ) if you start qemu on RHEL6 with both
      <currentMemory> and <memory> of 4000000 (this number is in KiB),
      libvirt's dominfo or dumpxml will report "4001792" back (rounded up to
      next 4MiB) for 10-20 seconds after the start, then revert to reporting
      "4000000". On Fedora 16 (which uses qemu-1.0), it will instead report
      "4000768" (rounded up to next 1MiB). On Fedora 17 (qemu-1.2), it seems
      to always report "4000000". ("4000000" is of course okay, and
      "4000768" is also okay since that's the next 1024KiB boundary above
      "4000000" and the parser was already allowing for that. But "4001792
      is *not* okay and produces the error message.)
      
      This patch solves the problem by changing the allowed "fudge factor"
      when parsing from 1024KiB to 4096KiB to match the maximum up-rounding
      that could be done in qemu.
      
      (I had earlier thought to fix this by up-rounding <memory> in the
      dumpxml that's put into the saved image, but that wouldn't have fixed
      the case where the save image was produced by an "unfixed"
      libvirtd.)
      89204fca
    • D
      add ppc64 and s390x to arches where qemu-kvm exists · 041b1ff2
      Dan Horák 提交于
      QEMU in Fedora >= 18 is configured with ppc64 and s390x as architectures
      where KVM is enabled.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=872545
      041b1ff2
    • E
      nodeinfo: port nodecpumap to RHEL5 · 9504ae5b
      Eric Blake 提交于
      Prior to this patch, 'virsh nodecpumap' on older kernels reported:
      error: Unable to get cpu map
      error: out of memory
      
      * src/nodeinfo.c (linuxParseCPUmax): Don't overwrite error.
      (nodeGetCPUBitmap): Provide backup implementation.
      9504ae5b
    • E
      nodeinfo: support kernels that lack socket information · 47976b48
      Eric Blake 提交于
      On RHEL 5, I was getting a segfault trying to start libvirtd,
      because we were failing virNodeParseSocket but not checking
      for errors, and then calling CPU_SET(-1, &sock_map) as a result.
      But if you don't have a topology/physical_package_id file,
      then you can just assume that the cpu belongs to socket 0.
      
      * src/nodeinfo.c (virNodeGetCpuValue): Change bool into
      default_value.
      (virNodeParseSocket): Allow for default value when file is missing,
      different from fatal error on reading file.
      (virNodeParseNode): Update call sites to fail on error.
      47976b48
  6. 16 11月, 2012 7 次提交
    • E
      Revert "virsh: add aliases 'boot', 'stop', and 'restart'" · 79caaf70
      Eric Blake 提交于
      This reverts commits 5f63a5cb
      and ff86b0c9.  After much list
      discussion, consensus was that libvirt aliases should be reserved
      to correct typos, otherwise it risks confusion.  Rather, we
      should implement a way for users to provide their own aliases
      as part of their virsh configuration preferences.
      79caaf70
    • E
      snapshot: require user to supply external memory file name · 516c1223
      Eric Blake 提交于
      For disk snapshots, the user could request an external snapshot
      but not supply a filename; later on, we would check this condition
      and generate a suitable name if possible, or gracefully error out
      when not possible (such as when the original file was a block
      device).  But unless we come up with a suitable way to generate
      external memory file names, we have no later code point that was
      checking for NULL, so we should forbid this up front.
      
      * src/conf/snapshot_conf.c (virDomainSnapshotDefParseString):
      Avoid NULL deref, since we don't generate names yet.
      516c1223
    • L
      qemu: Beautify code indent in migration codes · 63158d58
      liguang 提交于
      Signed-off-by: Nliguang <lig.fnst@cn.fujitsu.com>
      63158d58
    • M
      sanlock: Retry after EINPROGRESS · 96a02703
      Michal Privoznik 提交于
      It may take some time for sanlock to add a lockspace. And if user
      restart libvirtd service meanwhile, the fresh daemon can fail adding
      the same lockspace with EINPROGRESS. Recent sanlock has
      sanlock_inq_lockspace() function which should block until lockspace
      changes state. If we are building against older sanlock we should
      retry a few times before claiming an error. This issue can be easily
      reproduced:
      
      for i in {1..1000} ; do echo $i; service libvirtd restart; sleep 2; done
      20
      Stopping libvirtd daemon:                                  [FAILED]
      Starting libvirtd daemon:                                  [  OK  ]
      21
      Stopping libvirtd daemon:                                  [  OK  ]
      Starting libvirtd daemon:                                  [  OK  ]
      22
      Stopping libvirtd daemon:                                  [  OK  ]
      Starting libvirtd daemon:                                  [  OK  ]
      
       error : virLockManagerSanlockSetupLockspace:334 : Unable to add
       lockspace /var/lib/libvirt/sanlock/__LIBVIRT__DISKS__: Operation now in
       progress
      96a02703
    • J
    • V
      virsh: Use virNodeGetCPUMap if possible · 2bbe624e
      Viktor Mihajlovski 提交于
      Modified the places where virNodeGetInfo was used for the purpose
      of obtaining the maximum node CPU number. Transparently falling
      back to virNodeGetInfo in case of failure.
      Wrote utility function vshNodeGetCPUCount to compute node CPU
      number.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      2bbe624e
    • V
      python: Use virNodeGetCPUMap where possible · a0db6566
      Viktor Mihajlovski 提交于
      Modified the places where virNodeGetInfo was used for the purpose
      of obtaining the maximum node CPU number. Transparently falling
      back to virNodeGetInfo in case of failure.
      Wrote a utility function getPyNodeCPUCount for that purpose.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      a0db6566
  7. 15 11月, 2012 8 次提交