<div dir="ltr"><div><div><div><div><div><div><div><br><br><br>On Fri, Mar 28, 2014 at 2:51 PM, Karanbir Singh <<a href="mailto:mail-lists@karan.org">mail-lists@karan.org</a>> wrote:<br>><br>> On 03/28/2014 01:13 PM, Nux! wrote:<br>
> > On 28.03.2014 12:40, Karanbir Singh wrote:<br>> >> hi,<br>> >><br>> >> As a part of the test suite for xen that I've started off - I needed a<br>> >> way to inject a ssh key into the image [1]; so have come up with this<br>
> >> :<br>> >> <a href="https://github.com/CentOS/sig-virt-t_xen/blob/master/scripts/inject_ssh.sh">https://github.com/CentOS/sig-virt-t_xen/blob/master/scripts/inject_ssh.sh</a><br>> >> ; its not pretty and it wont handle lots of use cases, but it does<br>
> >> what<br>> >> is needed at hand.<br>> >><br>> >> Comments ?<br>> ><br>> > I would have first looked at libguestfs suite, virt-edit maybe. It has<br>> > tools specifically designed to interact with VM filesystems.<br>
><br>> I did, and I dont want to install 187 more rpms to get this<br>> functionality ( which is the size of that dep tree )<br><br></div>Why is that relevant for a test environment?<br><br></div>QEMU NBD has lots of potential issues:<br>
- Security implications (the guest image can attack the host via symlinks)<br></div>- Needs root privileges<br></div>- Multiple files can be attached to the same NBD device<br></div>- Files can be detached even if the NBD device is still mounted<br>
</div>and possibly lots of others.<br><br></div>Nova used to use QEMU NBD exclusively and we ran into several of the above issues. IMHO the clean way is to use libguestfs. Take a look at <br><div><div><div><div><div><div>
<div><a href="https://git.openstack.org/cgit/openstack/nova/tree/nova/virt/disk/mount/nbd.py">https://git.openstack.org/cgit/openstack/nova/tree/nova/virt/disk/mount/nbd.py</a> for the Nova implementation (as a potential starting point).<br>
<br></div><div>...Juerg<br><br></div><div><br><div><div>><br>> --<br>> Karanbir Singh<br>> +44-207-0999389 | <a href="http://www.karan.org/">http://www.karan.org/</a> | <a href="http://twitter.com/kbsingh">twitter.com/kbsingh</a><br>
> GnuPG Key : <a href="http://www.karan.org/publickey.asc">http://www.karan.org/publickey.asc</a><br>> _______________________________________________<br>> CentOS-virt mailing list<br>> <a href="mailto:CentOS-virt@centos.org">CentOS-virt@centos.org</a><br>
> <a href="http://lists.centos.org/mailman/listinfo/centos-virt">http://lists.centos.org/mailman/listinfo/centos-virt</a><br><br></div></div></div></div></div></div></div></div></div></div>