-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
guestfs does not create root directory for mounting #55349
Comments
Lines 53 to 67 in d0cad3e
One possible fix is to create the directory in place: while True:
if os.listdir(root):
# Stuff is in there, don't use it
hash_type = getattr(hashlib, __opts__.get('hash_type', 'md5'))
rand = hash_type(os.urandom(32)).hexdigest()
root = os.path.join(
tempfile.gettempdir(),
'guest',
location.lstrip(os.sep).replace('/', '.') + rand
)
os.mkdir(root)
log.debug('Establishing new root as %s', root)
else:
break
cmd = 'guestmount -i -a {0} --{1} {2}'.format(location, access, root)
__salt__['cmd.run'](cmd, python_shell=False) |
I haven't yet been able to reproduce this yet - I'm just trying to create an image and then mount it
I then downloaded the alpine mini root filesystem, extracted it, mounted my image, and copied the filesystem over. I may have had to run Then I ran
And it worked just fine. Have you tried just running |
I managed to reproduce here with master. Here is how I did:
The problem is that if the computed root folder is not empty we're looping to find a free one... but those are never created. |
closing this as #55672 was merged |
Description of Issue
salt/salt/modules/guestfs.py
Lines 53 to 67 in d0cad3e
If directory root has files in it, a new temporary root directory is computed, but not created. Some version of guestmount do not create the given root directory implicitly.
Logging:
Setup
libvirt-bash-completion-4.5.0-10.el7_6.2.x86_64
libvirt-client-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-driver-nwfilter-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-driver-lxc-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-driver-storage-disk-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-driver-storage-4.5.0-10.el7_6.2.x86_64
libvirt-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-kvm-4.5.0-10.el7_6.2.x86_64
libvirt-libs-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-driver-network-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-config-nwfilter-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-driver-qemu-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-driver-storage-gluster-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-driver-storage-scsi-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-driver-storage-logical-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-driver-storage-iscsi-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-driver-secret-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-driver-nodedev-4.5.0-10.el7_6.2.x86_64
libvirt-glib-1.0.0-1.el7.x86_64
libvirt-python-4.5.0-1.el7.x86_64
libvirt-daemon-driver-storage-core-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-config-network-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-driver-storage-mpath-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-driver-storage-rbd-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-driver-interface-4.5.0-10.el7_6.2.x86_64
qemu-kvm-common-ev-2.10.0-21.el7_5.7.1.x86_64
qemu-kvm-tools-ev-2.10.0-21.el7_5.7.1.x86_64
libvirt-daemon-kvm-4.5.0-10.el7_6.2.x86_64
libvirt-daemon-driver-qemu-4.5.0-10.el7_6.2.x86_64
qemu-kvm-ev-2.10.0-21.el7_5.7.1.x86_64
qemu-img-ev-2.10.0-21.el7_5.7.1.x86_64
ipxe-roms-qemu-20170123-1.git4e85b27.el7_4.1.noarch
libguestfs-1.38.2-12.el7.x86_64
libguestfs-tools-c-1.38.2-12.el7.x86_64
libguestfs-tools-1.38.2-12.el7.noarch
perl-Sys-Guestfs-1.38.2-12.el7.x86_64
libguestfs-bash-completion-1.38.2-12.el7.noarch
Steps to Reproduce Issue
Call is made locally on the Hypervisor (test02):
salt-call -l debug virt.init gitlab 2 4096 start=False image=/central/vm/test/openSUSE-Leap-15.1-JeOS.x86_64-15.1.0-kvm-and-xen-Snapshot9.114.qcow2
Versions Report
The text was updated successfully, but these errors were encountered: