1. 01 10月, 2011 2 次提交
    • L
      conf: remove unused VIR_ENUM_DECL · be7bc4d5
      Laine Stump 提交于
      While adding a new enum, I noticed a VIR_ENUM_DECL for a type that
      doesn't exist. There is also of course no matching VIR_ENUM_IMPL for
      it.
      be7bc4d5
    • S
      lvm storage backend: handle command_names=1 in lvm.conf · 30f555c6
      Serge E. Hallyn 提交于
      If the regexes supported (?:pvs)?, then we could handle this by
      optionally matching but not returning the initial command name.  But it
      doesn't.  So add a new char* argument to
      virStorageBackendRunProgRegex().  If that argument is NULL then we act
      as usual.  Otherwise, if the string at that argument is found at the
      start of a returned line, we drop that before running the regex.
      
      With this patch, virt-manager shows me lvs with command_names 1 or 0.
      
      The definitions of PVS_BASE etc may want to be moved into the configure
      scripts (though given how PVS is found, IIUC that could only happen if
      pvs was a link to pvs_real), but in any case no sense dealing with that
      until we're sure this is an ok way to handle it.
      Signed-off-by: NSerge Hallyn <serge.hallyn@canonical.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      30f555c6
  2. 30 9月, 2011 1 次提交
    • M
      qemu: Check for outstanding async job too · a111b9e2
      Michal Privoznik 提交于
      Currently, qemuDomainGetXMLDesc and qemudDomainGetInfo check for
      outstanding synchronous job before (eventual) monitor entering.
      However, there can be already async job set, e.g. migration.
      a111b9e2
  3. 29 9月, 2011 10 次提交
  4. 28 9月, 2011 9 次提交
    • E
      snapshot: implement getparent in qemu · 4ee8092d
      Eric Blake 提交于
      First hypervisor implementation of the new API.
      Allows 'virsh snapshot-list --tree' to be more efficient.
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotGetParent): New
      function.
      4ee8092d
    • E
      snapshot: remote protocol for getparent · 3ca4296f
      Eric Blake 提交于
      Mostly straight-forward, although this is the first API that
      returns a new snapshot based on a snapshot rather than a domain.
      
      * src/remote/remote_protocol.x
      (REMOTE_PROC_DOMAIN_SNAPSHOT_GET_PARENT): New rpc.
      (remote_domain_snapshot_get_parent_args)
      (remote_domain_snapshot_get_parent_ret): New structs.
      * src/rpc/gendispatch.pl: Adjust generator.
      * src/remote/remote_driver.c (remote_driver): Use it.
      * src/remote_protocol-structs: Update.
      3ca4296f
    • E
      snapshot: new virDomainSnapshotGetParent API · a2f706de
      Eric Blake 提交于
      Although a client can already obtain a snapshot's parent by
      dumping and parsing the xml, then doing a snapshot lookup by
      name, it is more efficient to get the parent in one step, which
      in turn will make operations that must traverse a snapshot
      hierarchy easier to perform.
      
      * include/libvirt/libvirt.h.in (virDomainSnapshotGetParent):
      Declare.
      * src/libvirt.c (virDomainSnapshotGetParent): New function.
      * src/libvirt_public.syms: Export it.
      * src/driver.h (virDrvDomainSnapshotGetParent): New callback.
      a2f706de
    • L
      security: properly chown/label bidirectional and unidirectional fifos · 46e8dc71
      Laine Stump 提交于
      This patch fixes the regression with using named pipes for qemu serial
      devices noted in:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=740478
      
      The problem was that, while new code in libvirt looks for a single
      bidirectional fifo of the name given in the config, then relabels that
      and continues without looking for / relabelling the two unidirectional
      fifos named ${name}.in and ${name}.out, qemu looks in the opposite
      order. So if the user had naively created all three fifos, libvirt
      would relabel the bidirectional fifo to allow qemu access, but qemu
      would attempt to use the two unidirectional fifos and fail (because it
      didn't have proper permissions/rights).
      
      This patch changes the order that libvirt looks for the fifos to match
      what qemu does - first it looks for the dual fifos, then it looks for
      the single bidirectional fifo. If it finds the dual unidirectional
      fifos first, it labels/chowns them and ignores any possible
      bidirectional fifo.
      
      (Note commit d37c6a3a (which first appeared in libvirt-0.9.2) added
      the code that checked for a bidirectional fifo. Prior to that commit,
      bidirectional fifos for serial devices didn't work because libvirt
      always required the ${name}.(in|out) fifos to exist, and qemu would
      always prefer those.
      46e8dc71
    • J
      qemu: Preserve fakeReboot flag in domain status · bd83b2a3
      Jiri Denemark 提交于
      Thus, when libvirtd is restarted, it will know if a domain is supposed
      to be killed or reset when it shuts down.
      bd83b2a3
    • J
      qemu: Finish domain shutdown on reconnect · cc0e4e8d
      Jiri Denemark 提交于
      If a domain started with -no-shutdown shuts down while libvirtd is not
      running, it will be seen as paused when libvirtd reconnects to it. Use
      the paused reason to detect if a domain was stopped because of shutdown
      and finish the process just as if a SHUTDOWN event is delivered from
      qemu.
      cc0e4e8d
    • J
      qemu: Check domain status details when reconnecting monitor · c20b7c98
      Jiri Denemark 提交于
      Current qemu is able to give us detailed domain status (not just if it
      is running or not) which we can translate into a status reason.
      c20b7c98
    • J
      qemu: Always remove domain object if MigratePrepare fails · 1cb031a2
      Jiri Denemark 提交于
      If migration failed in Prepare phase after virDomainAssignDef and before
      a job was started, the domain object was not properly removed.
      1cb031a2
    • J
      fix AppArmor driver for pipe character devices · 03d89991
      Jamie Strandboge 提交于
      The AppArmor security driver adds only the path specified in the domain
      XML for character devices of type 'pipe'. It should be using <path>.in
      and <path>.out. We do this by creating a new vah_add_file_chardev() and
      use it for char devices instead of vah_add_file(). Also adjust
      valid_path() to accept S_FIFO (since qemu chardevs of type 'pipe' use
      fifos). This is https://launchpad.net/bugs/832507
      03d89991
  5. 27 9月, 2011 5 次提交
    • L
      qemu: add ability to set PCI device "rombar" on or off · dc79852a
      Laine Stump 提交于
      This patch was made in response to:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=738095
      
      In short, qemu's default for the rombar setting (which makes the
      firmware ROM of a PCI device visible/not on the guest) was previously
      0 (not visible), but they recently changed the default to 1
      (visible). Unfortunately, there are some PCI devices that fail in the
      guest when rombar is 1, so the setting must be exposed in libvirt to
      prevent a regression in behavior (it will still require explicitly
      setting <rom bar='off'/> in the guest XML).
      
      rombar is forced on/off by adding:
      
        <rom bar='on|off'/>
      
      inside a <hostdev> element that defines a PCI device. It is currently
      ignored for all other types of devices.
      
      At the moment there is no clean method to determine whether or not the
      rombar option is supported by QEMU - this patch uses the advice of a
      QEMU developer to assume support for qemu-0.12+. There is currently a
      patch in the works to put this information in the output of "qemu-kvm
      -device pci-assign,?", but of course if we switch to keying off that,
      we would lose support for setting rombar on all the versions of qemu
      between 0.12 and whatever version gets that patch.
      dc79852a
    • J
      qemu: Relax -no-shutdown check to [0.14.0, 0.15.50) · 75e31492
      Jiri Denemark 提交于
      SIGTERM handling for -no-shutdown is already fixed in qemu git and
      libvirt can safely use it. The downside is that 0.15.50 version of qemu
      can be any qemu compiled from git, even that without the fix for
      SIGTERM. However, I think this patch is worth it since excluding 0.15.50
      from the check makes testing current qemu with libvirt much easier and
      someone running qemu from git should be able to rebuild fixed qemu from
      git if they hit the problem with a hang on shutdown.
      75e31492
    • M
      virLockManagerNopInit: Rename flags to unused_flags · 62cb8ad7
      Michal Privoznik 提交于
      As these might be not used and make syntax-check complains about checking
      them via virCheckFlags.
      62cb8ad7
    • M
      debug: Annotate some variables as unused · 45ad3d69
      Michal Privoznik 提交于
      as they are not used with debugging turned off.
      45ad3d69
    • O
      storage: Do not break the whole vol lookup process in the middle · 05e2fc51
      Osier Yang 提交于
      * src/storage/storage_driver.c: As virStorageVolLookupByPath lookups
      all the pool objs of the drivers, breaking when failing on getting
      the stable path of the pool will just breaks the whole lookup process,
      it can cause the API fails even if the vol exists indeed. It won't get
      any benefit. This patch is to fix it.
      05e2fc51
  6. 23 9月, 2011 3 次提交
    • O
      Add unsafe cache mode support for disk driver · f887334d
      Oskari Saarenmaa 提交于
      QEMU 0.13 introduced cache=unsafe for -drive, this patch exposes
      it in the libvirt layer.
      
        * Introduced a new QEMU capability flag ($prefix_CACHE_UNSAFE),
          as even if $prefix_CACHE_V2 is set, we can't know if unsafe
          is supported.
      
        * Improved the reliability of qemu cache type detection.
      f887334d
    • D
      Fix synchronous reading of stream data · cb610092
      Daniel P. Berrange 提交于
      commit 984840a2 removed the
      notification of waiting calls when VIR_NET_CONTINUE messages
      arrive. This was to fix the case of a virStreamAbort() call
      being prematurely notified of completion.
      
      The problem is that sometimes there are dummy calls from a
      virStreamRecv() call waiting that *do* need to be notified.
      
      These dummy calls should have a status VIR_NET_CONTINUE. So
      re-add the notification upon VIR_NET_CONTINUE, but only if
      the waiter also has a status of VIR_NET_CONTINUE.
      
      * src/rpc/virnetclient.c: Notify waiting call if stream data
        arrives
      * src/rpc/virnetclientstream.c:  Mark dummy stream read packet
        with status VIR_NET_CONTINUE
      cb610092
    • M
      selinux: Correctly report warning if virt_use_nfs not set · 1888363d
      Michal Privoznik 提交于
      Previous patch c9b37fee tried to deal with virt_use_nfs. But
      setfilecon() returns EOPNOTSUPP on NFS so we need to move the
      warning to else branch.
      1888363d
  7. 22 9月, 2011 8 次提交
    • M
      qemu: Transfer inactive XML among cookie · c42e1c39
      Michal Privoznik 提交于
      If a domain has inactive XML we want to transfer it to destination
      when migrating with VIR_MIGRATE_PERSIST_DEST. In order to harm
      the migration protocol as least as possible, a optional cookie was
      chosen.
      c42e1c39
    • E
      snapshot: also delete empty directory · 61dbee0e
      Eric Blake 提交于
      The previous patch removed all snapshots, but not the directory
      where the snapshots lived, which is still a form of stale data.
      
      * src/qemu/qemu_domain.c (qemuDomainRemoveInactive): Wipe any
      snapshot directory.
      61dbee0e
    • E
      snapshot: remove snapshot metadata on transient exit · e485dcc9
      Eric Blake 提交于
      Commit 282fe1f0 documented that transient domains will auto-delete
      any snapshot metadata when the last reference to the domain is
      removed, and that management apps are in charge of grabbing any
      snapshot metadata prior to that point.  However, this was not
      actually implemented for qemu until now.
      
      * src/qemu/qemu_driver.c (qemudDomainCreate)
      (qemuDomainDestroyFlags, qemuDomainSaveInternal)
      (qemudDomainCoreDump, qemuDomainRestoreFlags, qemudDomainDefine)
      (qemuDomainUndefineFlags, qemuDomainMigrateConfirm3)
      (qemuDomainRevertToSnapshot): Clean up snapshot metadata.
      * src/qemu/qemu_migration.c (qemuMigrationPrepareAny)
      (qemuMigrationPerformJob, qemuMigrationPerformPhase)
      (qemuMigrationFinish): Likewise.
      * src/qemu/qemu_process.c (qemuProcessHandleMonitorEOF)
      (qemuProcessReconnect, qemuProcessReconnectHelper)
      (qemuProcessAutoDestroyDom): Likewise.
      e485dcc9
    • E
      snapshot: prepare to remove transient snapshot metadata · bcf974b9
      Eric Blake 提交于
      This patch is mostly code motion - moving some functions out
      of qemu_driver and into qemu_domain so they can be reused by
      multiple qemu_* files (since qemu_driver.h must not grow).
      It also adds a new helper function, qemuDomainRemoveInactive,
      which will be used in the next patch.
      
      * src/qemu/qemu_domain.h (qemuFindQemuImgBinary)
      (qemuDomainSnapshotWriteMetadata, qemuDomainSnapshotForEachQcow2)
      (qemuDomainSnapshotDiscard, qemuDomainSnapshotDiscardAll)
      (qemuDomainRemoveInactive): New prototypes.
      (struct qemu_snap_remove): New struct.
      * src/qemu/qemu_domain.c (qemuDomainRemoveInactive)
      (qemuDomainSnapshotDiscardAllMetadata): New functions.
      (qemuFindQemuImgBinary, qemuDomainSnapshotWriteMetadata)
      (qemuDomainSnapshotForEachQcow2, qemuDomainSnapshotDiscard)
      (qemuDomainSnapshotDiscardAll): Move here...
      * src/qemu/qemu_driver.c (qemuFindQemuImgBinary)
      (qemuDomainSnapshotWriteMetadata, qemuDomainSnapshotForEachQcow2)
      (qemuDomainSnapshotDiscard, qemuDomainSnapshotDiscardAll): ...from
      here.
      (qemuDomainUndefineFlags): Update caller.
      * src/conf/domain_conf.c (virDomainRemoveInactive): Doc fixes.
      bcf974b9
    • E
      snapshot: fix logic bug in qemu undefine · e6966fa7
      Eric Blake 提交于
      Commit 19f8c980 introduced VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA,
      with the intent that omitting the flag makes undefine fail, and
      including the flag deletes metadata.  But it used the wrong logic.
      Also, hoist the transient domain sooner, so that we don't
      accidentally remove metadata of a transient domain.
      
      * src/qemu/qemu_driver.c (qemuDomainUndefineFlags): Check correct
      flag value.
      e6966fa7
    • E
      sanlock: fix memory leak · a55f1892
      Eric Blake 提交于
      Detected by Coverity.  The only way to get to error_unlink is if
      path was successfully assigned, so the if was useless.  Meanwhile,
      there was a return statement that did not free path.
      
      * src/locking/lock_driver_sanlock.c
      (virLockManagerSanlockSetupLockspace): Fix mem-leak, and drop
      useless if.
      a55f1892
    • O
      storage: Wait udev events are handled before removing lvm vol · bc4e5b43
      Osier Yang 提交于
      Related #BZ: https://bugzilla.redhat.com/show_bug.cgi?id=702260.
      
      There are two problems described in the BZ:
      1) "Can't remove open logical volume".
      2) "Unable to deactivate logical volume "foo""
      
      This patch just intends to fix 2), as 1) is expected if the vol
      is still used by something, and you never known if "lvchange -an"
      will fail or not either (sometime, it will succeed, sometimes not).
      We'd better not look for trouble, :-)
      
      For 2), that's caused by race between lvremove and udev event handling,
      the only workable way now is to wait the events handling are finished,
      though it might introduce latencies, as "udevadmin settle" exits
      after *all* events are handled, it's the only way we can fix
      the racing in libvirt layer.
      
      See https://bugzilla.redhat.com/show_bug.cgi?id=570359 for more
      details.
      bc4e5b43
    • A
      qemu: avoid dereferencing a NULL pointer · d93a08eb
      Alex Jia 提交于
      * src/qemu/qemu_process.c: Taking if (qemuDomainObjEndJob(driver, obj) == 0)
        true branch then 'obj' is NULL, virDomainObjIsActive(obj) and
        virDomainObjUnref(obj) will dereference NULL pointer.
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      d93a08eb
  8. 21 9月, 2011 2 次提交
    • J
      qemu: Avoid loop of fake reboots · 3abadf82
      Jiri Denemark 提交于
      Once virDomainReboot is called for a domain, guest OS initiated shutdown
      would always result in reboot instead of shutdown. Only
      virDomainShutdown would actually shutd such domain down. That's because
      we forgot to reset fakeReboot flag once we asked the domain to reboot.
      3abadf82
    • J
      qemu: Fix shutdown regression with buggy qemu · f84aedad
      Jiri Denemark 提交于
      The commit that prevents disk corruption on domain shutdown
      (96fc4784) causes regression with QEMU
      0.14.* and 0.15.* because of a regression bug in QEMU that was fixed
      only recently in QEMU git. The affected versions of QEMU do not quit on
      SIGTERM if started with -no-shutdown, which we use to implement fake
      reboot. Since -no-shutdown tells QEMU not to quit automatically on guest
      shutdown, domains started using the affected QEMU cannot be shutdown
      properly and stay in a paused state.
      
      This patch disables fake reboot feature on such QEMU by not using
      -no-shutdown, which makes shutdown work as expected. However,
      virDomainReboot will not work in this case and it will report "Requested
      operation is not valid: Reboot is not supported with this QEMU binary".
      f84aedad