<div dir="ltr"><div><div><div><div><div><div><div><br><br><br>On Fri, Mar 28, 2014 at 2:51 PM, Karanbir Singh &lt;<a href="mailto:mail-lists@karan.org">mail-lists@karan.org</a>&gt; wrote:<br>&gt;<br>&gt; On 03/28/2014 01:13 PM, Nux! wrote:<br>
&gt; &gt; On 28.03.2014 12:40, Karanbir Singh wrote:<br>&gt; &gt;&gt; hi,<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; As a part of the test suite for xen that I&#39;ve started off - I needed a<br>&gt; &gt;&gt; way to inject a ssh key into the image [1]; so have come up with this<br>
&gt; &gt;&gt; :<br>&gt; &gt;&gt; <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>&gt; &gt;&gt; ; its not pretty and it wont handle lots of use cases, but it does<br>
&gt; &gt;&gt; what<br>&gt; &gt;&gt; is needed at hand.<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; Comments ?<br>&gt; &gt;<br>&gt; &gt; I would have first looked at libguestfs suite, virt-edit maybe. It has<br>&gt; &gt; tools specifically designed to interact with VM filesystems.<br>
&gt;<br>&gt; I did, and I dont want to install 187 more rpms to get this<br>&gt; 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>&gt;<br>&gt; --<br>&gt; Karanbir Singh<br>&gt; +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>
&gt; GnuPG Key : <a href="http://www.karan.org/publickey.asc">http://www.karan.org/publickey.asc</a><br>&gt; _______________________________________________<br>&gt; CentOS-virt mailing list<br>&gt; <a href="mailto:CentOS-virt@centos.org">CentOS-virt@centos.org</a><br>
&gt; <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>