1. 05 5月, 2015 5 次提交
    • C
      polkit: Allow password-less access for 'libvirt' group · e94979e9
      Cole Robinson 提交于
      Many users, who admin their own machines, want to be able to access
      system libvirtd via tools like virt-manager without having to enter
      a root password. Just google 'virt-manager without password' and
      you'll find many hits. I've read at least 5 blog posts over the years
      describing slightly different ways of achieving this goal.
      
      Let's finally add official support for this.
      
      Install a polkit-1 rules file granting password-less auth for any user
      in the new 'libvirt' group. Create the group on RPM install
      
      https://bugzilla.redhat.com/show_bug.cgi?id=957300
      e94979e9
    • C
      storage: fs: Don't try to chown directory unless user requested · 28c547ed
      Cole Robinson 提交于
      Currently we try to chown any directory passed to virDirCreate,
      even if the user didn't request any explicit owner/group via the
      pool/vol XML.
      
      This causes issues with qemu:///session: try to build a pool of
      a root owned directory like /tmp, and it fails trying to chown the
      directory to the session user. Instead it should just leave things
      as they are, unless the user requests changing permissions via
      the pool XML.
      
      Similarly this is annoying if creating a storage pool via system
      libvirtd of an existing directory in user $HOME, it's now owned
      by root.
      
      The virDirCreate function is pretty convoluted, since it needs to
      fork off in certain specific cases. Try to document that, to make
      it clear where exactly we are changing behavior.
      28c547ed
    • C
      storage: fs: Don't attempt directory creation if it already exists · 262b3c05
      Cole Robinson 提交于
      The current code attempts to handle this, but it only catches mkdir
      failing with EEXIST. However if say trying to build /tmp for an
      unprivileged qemu:///session, mkdir will fail with EPERM.
      
      Rather than catch any errors, just don't attempt mkdir if the directory
      already exists.
      262b3c05
    • C
      storage: fs: Fill in permissions on pool refresh · d6f8b35d
      Cole Robinson 提交于
      This means pool XML actually reports accurate user/group/mode/label.
      
      This uses UpdateVolTargetInfoFD in a bit of a hackish way, but it works
      d6f8b35d
    • C
      storage: fs: Don't overwrite virDirCreate error · 27a4c492
      Cole Robinson 提交于
      virDirCreate will give us fine grained details about what actually failed.
      27a4c492
  2. 04 5月, 2015 20 次提交
  3. 01 5月, 2015 2 次提交
  4. 30 4月, 2015 6 次提交
  5. 29 4月, 2015 7 次提交
    • C
      domain: conf: Drop unused OSTYPE_AIX · 066f7c7c
      Cole Robinson 提交于
      The phyp driver stuffed it into a DomainDefPtr during its attachdevice
      routine, but the value is never advertised via capabilities so it should
      be safe to drop.
      
      Have the phyp driver use OSTYPE_LINUX, which is what it advertises via
      capabilities.
      066f7c7c
    • M
      qemu: migration: use sync block job helpers · 99725f94
      Michael Chapman 提交于
      In qemuMigrationDriveMirror we can start all disk mirrors in parallel.
      We wait until they are all ready, or one of them aborts.
      
      In qemuMigrationCancelDriveMirror, we wait until all mirrors are
      properly stopped. This is necessary to ensure that destination VM is
      fully in sync with the (paused) source VM.
      
      If a drive mirror can not be cancelled, then the destination is not in a
      consistent state. In this case it is not safe to continue with the
      migration.
      Signed-off-by: NMichael Chapman <mike@very.puzzling.org>
      99725f94
    • M
      qemuDomainBlockJobAbort: use sync block job helpers · 1e106fee
      Michael Chapman 提交于
      The !modern code path needs to call qemuBlockJobEventProcess directly.
      the modern code path will call it via qemuBlockJobSyncWait.
      Signed-off-by: NMichael Chapman <mike@very.puzzling.org>
      1e106fee
    • M
      qemuProcessStop: wake up pending sync block jobs · 1ec03c87
      Michael Chapman 提交于
      Other threads may be blocked in qemuBlockJobSyncWait. Ensure that
      they're woken up when the domain is stopped.
      Signed-off-by: NMichael Chapman <mike@very.puzzling.org>
      1ec03c87
    • M
      qemuBlockJobSync*: introduce sync block job helpers · 89a5e25d
      Michael Chapman 提交于
      qemuBlockJobSyncBegin and qemuBlockJobSyncEnd delimit a region of code
      where block job events are processed "synchronously".
      qemuBlockJobSyncWait and qemuBlockJobSyncWaitWithTimeout wait for an
      event generated by a block job.
      
      The Wait* functions may be called multiple times while the synchronous
      block job is active. Any pending block job event will be processed by
      only when Wait* or End is called.  disk->blockJobStatus is reset by
      these functions, so if it is needed a pointer to a
      virConnectDomainEventBlockJobStatus variable should be passed as the
      last argument. It is safe to pass NULL if you do not care about the
      block job status.
      
      All functions assume the VM object is locked. The Wait* functions will
      unlock the object for as long as they are waiting. They will return -1
      and report an error if the domain exits before an event is received.
      
      Typical use is as follows:
      
        virQEMUDriverPtr driver;
        virDomainObjPtr vm; /* locked */
        virDomainDiskDefPtr disk;
        virConnectDomainEventBlockJobStatus status;
      
        qemuBlockJobSyncBegin(disk);
      
        ... start block job ...
      
        if (qemuBlockJobSyncWait(driver, vm, disk, &status) < 0) {
            /* domain died while waiting for event */
            ret = -1;
            goto error;
        }
      
        ... possibly start other block jobs
            or wait for further events ...
      
        qemuBlockJobSyncEnd(driver, vm, disk, NULL);
      
      To perform other tasks periodically while waiting for an event:
      
        virQEMUDriverPtr driver;
        virDomainObjPtr vm; /* locked */
        virDomainDiskDefPtr disk;
        virConnectDomainEventBlockJobStatus status;
        unsigned long long timeout = 500 * 1000ull; /* milliseconds */
      
        qemuBlockJobSyncBegin(disk);
      
        ... start block job ...
      
        do {
            ... do other task ...
      
            if (qemuBlockJobSyncWaitWithTimeout(driver, vm, disk,
                                                timeout, &status) < 0) {
                /* domain died while waiting for event */
                ret = -1;
                goto error;
            }
        } while (status == -1);
      
        qemuBlockJobSyncEnd(driver, vm, disk, NULL);
      Signed-off-by: NMichael Chapman <mike@very.puzzling.org>
      89a5e25d
    • M
      qemuBlockJobEventProcess: move to new source file · 206dbf3f
      Michael Chapman 提交于
      We will want to use synchronous block jobs from qemu_migration as well,
      so split this function out into a new source file.
      Signed-off-by: NMichael Chapman <mike@very.puzzling.org>
      206dbf3f
    • P
      qemu: Validate available slot count for memory devices · a83b2e25
      Peter Krempa 提交于
      While qemu would reject the configuration we can check whether it makes
      sense to plug the device upfront.
      a83b2e25