Description of problem: Version-Release number of selected component (if applicable): virt-sysprep 1.36.13 How reproducible: Run the command: virt-sysprep -v -x -c qemu+ssh://user@IPADDRESS/system -d REMOTEVM --hostname REMOTEVM --root-password password:123456 --upload /home/www/interfaces:/etc/network/interfaces Actual results: virt-sysprep -v -x -c qemu+ssh://user@ipaddress/system -d REMOTEVM --hostname REMOTEVM --root-password password:123456 --upload /home/www/interfaces:/etc/network/interfaces [ 0.0] Examining the guest ... libguestfs: trace: set_verbose true libguestfs: trace: set_verbose = 0 libguestfs: trace: set_network false libguestfs: trace: set_network = 0 libguestfs: trace: add_domain "REMOTEVM" "libvirturi:qemu+ssh://user@ipaddress/system" "readonly:false" "allowuuid:true" "readonlydisk:ignore" "discard:besteffort" libguestfs: opening libvirt handle: URI = qemu+ssh://user@ipaddress/system, auth = default+wrapper, flags = 0 libguestfs: successfully opened libvirt handle: conn = 0x55d71ad4a520 libguestfs: trace: add_libvirt_dom (virDomainPtr)0x55d71ad4e9d0 "readonlydisk:ignore" "discard:besteffort" libguestfs: original domain XML:\n<domain type='kvm'>\n <name>REMOTEVM</name>\n <uuid>c23b6f17-50f4-43e2-9003-463366951382</uuid>\n <memory unit='KiB'>1048576</memory>\n <currentMemory unit='KiB'>1048576</currentMemory>\n <vcpu placement='static'>1</vcpu>\n <os>\n <type arch='x86_64' machine='pc-i440fx-xenial'>hvm</type>\n <boot dev='hd'/>\n </os>\n <features>\n <acpi/>\n <apic/>\n <vmport state='off'/>\n </features>\n <cpu mode='custom' match='exact'>\n <model fallback='allow'>IvyBridge</model>\n </cpu>\n <clock offset='utc'>\n <timer name='rtc' tickpolicy='catchup'/>\n <timer name='pit' tickpolicy='delay'/>\n <timer name='hpet' present='no'/>\n </clock>\n <on_poweroff>destroy</on_poweroff>\n <on_reboot>restart</on_reboot>\n <on_crash>destroy</on_crash>\n <pm>\n <suspend-to-mem enabled='no'/>\n <suspend-to-disk enabled='no'/>\n </pm>\n <devices>\n <emulator>/usr/bin/kvm-spice</emulator>\n <disk type='file' device='disk'>\n <driver name='qemu' type='qcow2'/>\n <source file='/var/lib/libvirt/images/REMOTEVM.qcow2'/>\n <target dev='vda' bus='virtio'/>\n <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>\n </disk>\n <controller type='usb' index='0' model='ich9-ehci1'>\n <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x7'/>\n </controller>\n <controller type='usb' index='0' model='ich9-uhci1'>\n <master startport='0'/>\n <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0' multifunction='on'/>\n </controller>\n <controller type='usb' index='0' model='ich9-uhci2'>\n <master startport='2'/>\n <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x1'/>\n </controller>\n <controller type='usb' index='0' model='ich9-uhci3'>\n <master startport='4'/>\n <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x2'/>\n </controller>\n <controller type='pci' index='0' model='pci-root'/>\n <controller type='virtio-serial' index='0'>\n <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>\n </controller>\n <interface type='bridge'>\n <mac address='52:54:00:83:b3:b0'/>\n <source bridge='br0'/>\n <model type='virtio'/>\n <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>\n </interface>\n <serial type='pty'>\n <target port='0'/>\n </serial>\n <console type='pty'>\n <target type='serial' port='0'/>\n </console>\n <channel type='spicevmc'>\n <target type='virtio' name='com.redhat.spice.0'/>\n <address type='virtio-serial' controller='0' bus='0' port='1'/>\n </channel>\n <input type='tablet' bus='usb'/>\n <input type='mouse' bus='ps2'/>\n <input type='keyboard' bus='ps2'/>\n <graphics type='spice' autoport='yes'/>\n <sound model='ich6'>\n <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>\n </sound>\n <video>\n <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1'/>\n <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>\n </video>\n <redirdev bus='usb' type='spicevmc'>\n </redirdev>\n <redirdev bus='usb' type='spicevmc'>\n </redirdev>\n <memballoon model='virtio'>\n <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>\n </memballoon>\n </devices>\n</domain>\n libguestfs: trace: clear_backend_setting "internal_libvirt_norelabel_disks" libguestfs: trace: clear_backend_setting = 0 libguestfs: disk[0]: filename: /var/lib/libvirt/images/REMOTEVM.qcow2 libguestfs: trace: add_drive "/var/lib/libvirt/images/REMOTEVM.qcow2" "readonly:false" "format:qcow2" "discard:besteffort" libguestfs: trace: add_drive = -1 (error) libguestfs: trace: add_libvirt_dom = -1 (error) libguestfs: trace: add_domain = -1 (error) virt-sysprep: error: libguestfs error: /var/lib/libvirt/images/REMOTEVM.qcow2: No such file or directory libguestfs: trace: close libguestfs: closing guestfs handle 0x55d71ad48a00 (state 0) Expected results: This works if I run it on the host machine where the remote VM works without the -c URI Additional info: I'm trying to run virt-sysprep on a remote host that has a vm, but the command only works if I run it on the host without -c, if I run it from any other OS it errors out saying it can't find the qcow2
Unfortunately libvirt doesn't provide a way for us to access disks remotely, so if you connect to a remote libvirt it still tries to load the disk as if it was a local file. This is basically a design problem with libvirt, try for example simply doing: virsh -c qemu+ssh://user@ipaddress/system dumpxml REMOTEVM and look at the disk paths returned. (It's actually a bit worse than that because there's no way for us to detect if the libvirt connection is local or remote, so eg. @localhost would work). I'm afraid if you want to sysprep a remote disk you're going to have to find a way to mount the filesystem with the disk locally (eg. share /var/lib/libvirt/images over NFS) or find another way to export the filesystem (eg. NBD) or just run virt-sysprep on the remote box instead.