On Wed, Oct 10, Daniel P. Berrange wrote:
It depends on what instance of libvirtd you are connecting to.
- The system instance, runs as root and requirs non-root users
to auth with policykit
- The session instance, runs as the same user id as the client
app and does not require auth.
Since libguestfs passes NULL for the URI, it will be connecting
to the session instance if libguestfs is non-root and thus not
require any auth. If libguestfs is run as root it will connect
to the system instance which requires polkit auth, but root already
has that granted.
Thanks for that summary.
Today I tried it with a openSuSE 12.2 system, which is more uptodate
than a sles11sp2.
Running libguestfs-test-tool fails because root starts a kvm guest, while a
user starts a qemu guest. I think once the os type is correct for type 'qemu'
it will work.
Olaf
olaf@stein-schneider:~> libguestfs-test-tool
************************************************************
* IMPORTANT NOTICE
*
* When reporting bugs, include the COMPLETE, UNEDITED
* output below in your bug report.
*
************************************************************
===== Test starts here =====
PATH=/home/olaf/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games
library version: 1.19.49
guestfs_get_append: (null)
guestfs_get_attach_method: libvirt
guestfs_get_autosync: 1
guestfs_get_direct: 0
guestfs_get_memsize: 500
guestfs_get_network: 0
guestfs_get_path: /usr/lib64/guestfs
guestfs_get_pgroup: 0
guestfs_get_qemu: /usr/bin/qemu-kvm
guestfs_get_recovery_proc: 1
guestfs_get_selinux: 0
guestfs_get_smp: 1
guestfs_get_trace: 0
guestfs_get_verbose: 1
host_cpu: x86_64
Launching appliance, timeout set to 600 seconds.
libguestfs: libvirt version = 10002
libguestfs: [00000ms] connect to libvirt
libguestfs: [00003ms] get libvirt capabilities
libguestfs: [00048ms] build appliance
libguestfs: [00048ms] create libvirt XML
libguestfs: libvirt XML:\n<?xml version="1.0"?>\n<domain
type="qemu"
xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0">\n
<name>guestfs-fs1ubzlxkfco2kz9</name>\n <memory
unit="MiB">500</memory>\n <currentMemory
unit="MiB">500</currentMemory>\n <cpu
model="host-model"/>\n <vcpu>1</vcpu>\n <clock
offset="utc"/>\n <os>\n <type>hvm</type>\n
<kernel>/usr/lib64/guestfs/vmlinuz.x86_64</kernel>\n
<initrd>/usr/lib64/guestfs/initramfs.x86_64.img</initrd>\n
<cmdline>panic=1 console=ttyS0 udevtimeout=600 no_timer_check acpi=off printk.time=1
cgroup_disable=memory root=/dev/sdb selinux=0 guestfs_verbose=1 TERM=screen
</cmdline>\n </os>\n <on_reboot>destroy</on_reboot>\n
<devices>\n <controller type="scsi" index="0"
model="virtio-scsi"/>\n <disk device="disk"
type="file">\n <source
file="/tmp/libguestfs-test-tool-sda-7iYTxF"/>\n <target
dev="sda" bus="scsi"/>\n <driver name="qemu"
type="raw" cache="none"/>\n <address type="drive"
controller="0" bus="0" target="0" unit="0"/>\n
</disk>\n <serial type="unix">\n <source
mode="connect" path="/tmp/libguestfss1xgHv/console.sock"/>\n
<target port="0"/>\n </serial>\n <channel
type="unix">\n <source mode="connect"
path="/tmp/libguestfss1xgHv/guestfsd.sock"/>\n <target
type="virtio" name="org.libguestfs.channel.0"/>\n
</channel>\n </devices>\n <qemu:commandline/>\n</domain>\n
libguestfs: [00048ms] launch libvirt guest
libguestfs: error: could not create appliance through libvirt: unknown OS type hvm
[code=16 domain=20]
libguestfs-test-tool: failed to launch appliance
libguestfs: closing guestfs handle 0x1608ec0 (state 0)
--- root 2012-10-11 12:50:54.000000000 +0200
+++ olaf 2012-10-11 12:51:15.000000000 +0200
@@ -1,7 +1,7 @@
libguestfs: libvirt XML:
<?xml version="1.0"?>
-<domain type="kvm"
xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0">
- <name>guestfs-zftfuc2yqwc8qhyk</name>
+<domain type="qemu"
xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0">
+ <name>guestfs-fs1ubzlxkfco2kz9</name>
<memory unit="MiB">500</memory>
<currentMemory unit="MiB">500</currentMemory>
<cpu model="host-model"/>
@@ -17,17 +17,17 @@ libguestfs: libvirt XML:
<devices>
<controller type="scsi" index="0"
model="virtio-scsi"/>
<disk device="disk" type="file">
- <source file="/tmp/libguestfs-test-tool-sda-uzaB2z"/>
+ <source file="/tmp/libguestfs-test-tool-sda-7iYTxF"/>
<target dev="sda" bus="scsi"/>
<driver name="qemu" type="raw" cache="none"/>
<address type="drive" controller="0" bus="0"
target="0" unit="0"/>
</disk>
<serial type="unix">
- <source mode="connect"
path="/tmp/libguestfs3kAQMc/console.sock"/>
+ <source mode="connect"
path="/tmp/libguestfss1xgHv/console.sock"/>
<target port="0"/>
</serial>
<channel type="unix">
- <source mode="connect"
path="/tmp/libguestfs3kAQMc/guestfsd.sock"/>
+ <source mode="connect"
path="/tmp/libguestfss1xgHv/guestfsd.sock"/>
<target type="virtio" name="org.libguestfs.channel.0"/>
</channel>
</devices>