<div dir="ltr"><span id="gmail-docs-internal-guid-60e76e34-2463-0d85-2300-1bd085d6139c"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Hi everyone!</span></p><br><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">I am Radostin, a student involved with Libvirt in the </span><a href="https://wiki.libvirt.org/page/Google_Summer_of_Code_Ideas#Ease_creation_of_containers" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,128);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">Ease creation of containers</span></a><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> Google Summer of Code (GSoC) Project. The idea of this project was to provide a simple way to setup root file system for the Libvirt LXC driver. </span><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Here I present the complete work I did during the GSoC term and also explanations for the same.</span></p><br><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">This summer I mostly worked on 2 things:</span></p><br><ul style="margin-top:0pt;margin-bottom:0pt"><li dir="ltr" style="list-style-type:disc;font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline"><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:7pt"><span style="font-size:12pt;font-family:"Liberation Serif";background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Adding new features to </span><a href="https://github.com/virt-manager/virt-bootstrap" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">virt-bootstrap</span></a></p></li><li dir="ltr" style="list-style-type:disc;font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline"><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:7pt"><span style="font-size:12pt;font-family:"Liberation Serif";background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Integration of virt-bootstrap with </span><a href="https://github.com/virt-manager/virt-manager" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">virt-manager</span></a><span style="font-size:12pt;font-family:"Liberation Serif";background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> for smooth user experience.</span></p></li></ul><br><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:7pt"><span style="font-size:13pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;font-weight:700;vertical-align:baseline;white-space:pre-wrap">What has been done?</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">At the beginning of the project I </span><a href="https://www.redhat.com/archives/virt-tools-list/2017-April/msg00053.html" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">shared my idea</span></a><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> for extending the user interface of virt-manager on the virt-tools mailing list. The received feedback gave me ideas for adjustments to work towards but mainly this was to show the progress of virt-bootstrap in virt-manager.</span></p><br><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:7pt"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Before the integration with virt-manager some improvements for virt-bootstrap were required to ensure that the installation process is simple and the progress information is tracked in accessible for virt-manager way.</span></p><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:7pt"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">In addition to that, conversion of Docker image layers to qemu copy-on-write images using backing chains was enabled.</span></p><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/0b998e5c230cdf458a390d0d9c28c85f21b9fbd2" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,128);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Cache downloaded container images</span></a></p><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/9ebc936407911ee29570e05565255b8b7aaa38b2" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,128);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Extract tar archives safely using virt-sandbox</span></a></p><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/8a3e52019315a00f8fee222ecdc803a914608068" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,128);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Add support for layer extraction in qcow2 images</span></a><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/31e38232b7857bbf190a1234976e93f521fbffe0" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,128);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Move source files in src/virtBootstrap</span></a><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/6f80e1a8182acdbd1d49e21a4451850d6df4f05c" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,128);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Use setuptools (setup.py) for installation</span></a><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/4ca83f7b40bc147b9d59cc38de0e5bea44abdbda" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,128);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Log executed process calls</span></a><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/dfbfc0f2613bf746948da871e3aa0ec054f6bd4f" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,128);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Add "debug" and "quiet" flags</span></a><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/3001ebf7249de17ab733b1e6978b1ff372219a56" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,128);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Show error if destination path is not folder</span></a></p><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/1be26027e7b42cd65937ca185a106ce9139ba4c1" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,128);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Improve logging of executed processes</span></a></p><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/34a25916646108454fac8dd490ae5d70eb7ce6bd" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,128);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Raise exception if file source is invalid</span></a></p><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/6903f23563549f8d81fa911103594f9f472ab3c7" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,128);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Improve logging of virt-sandbox</span></a></p><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/8306c37832613c2c0d4d75806c6763e6678c5edd" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,128);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Refactor info messages</span></a><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/bb5932eea5e0f9c32bb782ca70e2c9d0af0e0940" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Auto-correct docker source URI</span></a><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/96109db4bd08ffc1e1dcca6f87994761642ce413" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Check for write permissions on destination path</span></a></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/1dd194f36079fd822f667419e030fbd07a8480b9" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Set logger name/format/level</span></a></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/65ef323df230b770c56217367e9c019cffcb0a7d" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Expose bootstrap method from virtBootstrap module</span></a></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/970b4247bd9a39d36ade980967371e4d1bc3f893" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] bootstrap: Use explicit arguments</span></a></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/7daf37d2a5155e742b3c4daea24923e4a7b7d855" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Improve URI parse of DockerSource</span></a></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/7bb698af895af30007f2034e554a3d999090dd2a" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] DockerSource: Use getter for image directory</span></a></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/78a5313c1076580c4a7308294765c26caa2da127" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] DockerSource: Retrieve manifest before download</span></a></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/847886deea03e95d35afec925a598a498d68265c" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Log the size of layers when extracting</span></a></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/c1cdbeee437c5c82d9928e73211f6bac91259dcc" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Compact layers' details passed to extract methods</span></a><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/04dfccb8acda9d79a3a7dccb16a5670fb3f279e7" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] DockerSource: Encapsulate skopeo copy in a method</span></a></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/64ef61bd999ab669dcb21424528894f8fad97e0f" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] DockerSource: Use downloaded layers</span></a></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/a1ba3edb9a76fa89001f0a069e5c8eada876fb40" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Remove redundant checksum verification</span></a></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/9d1bc151c7eb72c1281d6a22476a9082fef8374e" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] checksum: Log failures</span></a></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/b8b69f2f41802bf87e119845a6f532d4970d2481" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Add new module to store the progress</span></a><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/08d036a433b830319c931976b7a4e17574934720" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Add --status-only flag</span></a><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/c7a25202019cad8a6a9302ab81cc80d547da0ec9" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Detect and log download progress of layers</span></a><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/0095aca7457911d8515967fd03cd53f76abd465e" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] get_image_details: Use connection options</span></a></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/971313ccb67068035622b3f5bbcf8737e9aeee80" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Gather common utility functions in "utils" module</span></a></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/f23d759eda69738917985feb9af727f792d1145e" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] DockerSource: Ignore short lines from skopeo</span></a><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/5afb6c9b0728c7f5f0edd14a44e62ae91959194d" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] utils: size_to_bytes convert from int</span></a></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/4a0152f73fcf94c739836e4b8bbe969b56daddba" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] utils: bytes_to_size remove trailing space</span></a></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/3e7cbbdcc953b5249b9b462a97acff0176dfcbfd" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] DockerSource: Encapsulate layers' info retrieval</span></a></p><br><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">The integration of virt-bootstrap with virt-manager was achieved by extending the UI and importing the virtBootstrap python module. Creation of the root file system tree is done using the bootstrap() method which is called asynchronously in a thread. [</span><a href="https://www.youtube.com/watch?v=CDeDobeyU0I" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">Demo video</span></a><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">]</span></p><br><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://www.redhat.com/archives/virt-tools-list/2017-July/msg00005.html" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Times New Roman";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-manager] create: Add support for OS tree creation</span></a><span style="font-size:12pt;font-family:"Times New Roman";color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://www.redhat.com/archives/virt-tools-list/2017-July/msg00006.html" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Times New Roman";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-manager] create: Validate input on container bootstrap</span></a><span style="font-size:12pt;font-family:"Times New Roman";color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://www.redhat.com/archives/virt-tools-list/2017-July/msg00010.html" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Times New Roman";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-manager] gschema: Populate/Store previous container URLs</span></a><span style="font-size:12pt;font-family:"Times New Roman";color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://www.redhat.com/archives/virt-tools-list/2017-July/msg00030.html" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Times New Roman";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-manager] create: Show progress of container bootstrap</span></a><span style="font-size:12pt;font-family:"Times New Roman";color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://www.redhat.com/archives/virt-tools-list/2017-July/msg00029.html" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Times New Roman";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-manager] create: Call virt-bootstrap asynchronously</span></a><span style="font-size:12pt;font-family:"Times New Roman";color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://www.redhat.com/archives/virt-tools-list/2017-July/msg00031.html" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Times New Roman";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-manager] create: Show details of container bootstrap</span></a><span style="font-size:12pt;font-family:"Times New Roman";color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://www.redhat.com/archives/virt-tools-list/2017-July/msg00032.html" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Times New Roman";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-manager] asyncjob: Add enable/update details methods</span></a><span style="font-size:12pt;font-family:"Times New Roman";color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><br><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Another feature added to virt-bootstrap was the UID/GID mapping which can be used to create Libvirt LXC container with enabled user namespace. In such container the owner/group of files must be mapped to UID/GID of users inside the container. </span></p><br><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commit/e92b724289120c262c635e6005703477ebaa3fe0" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">[virt-bootstrap] Add remapping ownership of files in rootfs</span></a><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><br><br><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;font-weight:700;vertical-align:baseline;white-space:pre-wrap">What code was merged?</span></p><br><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-bootstrap/commits?author=rst0git" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">Merged commits for virt-bootstrap</span></a></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://github.com/virt-manager/virt-manager/commits?author=rst0git" style="text-decoration-line:none"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,255);background-color:transparent;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">Merged commits for virt-manager</span></a></p><br><br><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;font-weight:700;vertical-align:baseline;white-space:pre-wrap">How to use virt-bootstrap?</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">The command line tool virt-bootstrap provides an easy way to setup root file system from various sources such as a tar archive containing the file system, container image from Docker registry or VM disk image created with virt-builder. </span></p><br><ul style="margin-top:0pt;margin-bottom:0pt"><li dir="ltr" style="list-style-type:disc;font-size:14pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14pt;background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Extract root file system from a tar archive.</span></p></li></ul><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:10pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">$ virt-bootstrap /home/user/rootfs.tar /var/lib/Libvirt/filesystems/container1</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">This will extract securely the root file system from </span><span style="font-size:12pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">rootfs.tar</span><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> to </span><span style="font-size:12pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">/var/lib/Libvirt/filesystems/container1</span><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> using LXC container if the user is with effective UID 0 or kvm instance (qemu:///session) otherwise.</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Optionally to apply adjustments can be the flags:</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="background-color:transparent;font-size:12pt;vertical-align:baseline">--fmt </span><span style="background-color:transparent;font-size:12pt;font-family:Arial;vertical-align:baseline">        Specify the output format. Possible values are “dir” and “qcow2”</span></span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">--idmap</span><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">   </span><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span class="gmail-Apple-tab-span" style="white-space:pre">      </span></span><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Apply map for owner and group of entries</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">--uidmap</span><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span></span><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Apply map for owner of entries</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">--gidmap</span><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">    Apply map for group of entries</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="background-color:transparent;font-size:12pt;font-family:"Courier New";vertical-align:baseline">--root-password</span><span style="background-color:transparent;font-size:12pt;vertical-align:baseline">        </span><span style="background-color:transparent;font-size:12pt;vertical-align:baseline"><span class="gmail-Apple-tab-span" style="white-space:pre">   </span></span><span style="background-color:transparent;font-size:12pt;vertical-align:baseline">Set password for root</span><br></span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><br></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><ul style="margin-top:0pt;margin-bottom:0pt"><li dir="ltr" style="list-style-type:disc;font-size:14pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14pt;background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Extract root file system from Docker image</span></p></li></ul><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Container images might have multiple layers where each layer store only the changes made. To extract root file system from them we have to extract the layers in order starting from base layer. This is what you can do with virt-bootstrap in the following example:</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:10pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">$ virt-bootstrap docker://ubuntu /var/lib/Libvirt/filesystems/ct1</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">The root file system extracted in </span><span style="font-size:10pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">/var/lib/Libvirt/filesystems/ct1 </span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">can be used by Libvirt to start LXC container.</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Alternatively the layers of container image can be preserved using qcow2 image with backing chains:</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:10pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">$ virt-bootstrap docker://ubuntu /var/lib/Libvirt/filesystems/ct1 \</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:10pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> –-format qcow2</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">This example will create qcow2 image with single partition and ext3 file system which contains the base layer of the latest Ubuntu container image available on <i><a href="http://docker.io">docker.io</a></i>. Then it will create qcow2 image with backing file for each layer of the container image and store only the changes applied within this layer. This is implemented using libguestfs and does not require root privileges.</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><br></span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Optionally the flags for UID/GID mapping or root password can be used as well.</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><ul style="margin-top:0pt;margin-bottom:0pt"><li dir="ltr" style="list-style-type:disc;font-size:14pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14pt;background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Extract root file system from VM image build with virt-builder</span></p></li></ul><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">The tool virt-builder can be used to build disk image for virtual machine from template. To create container from such VM image we have to extract the root file system. The example below demonstrates how this can be achieved with virt-bootstrap:</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:10pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">$ virt-bootstrap virt-builder://fedora-25 /var/lib/Libvirt/filesystems/ct1</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">This command will build VM image from </span><span style="color:rgb(0,0,10);font-family:"Courier New";font-size:13.3333px;white-space:pre-wrap">fedora-25 </span><span style="background-color:transparent;color:rgb(0,0,10);font-family:Arial;font-size:12pt;white-space:pre-wrap">in temporary file and extract the root file system to </span><span style="background-color:transparent;font-size:10pt;font-family:"Courier New";color:rgb(0,0,10);vertical-align:baseline;white-space:pre-wrap">/var/lib/Libvirt/filesystems/ct1 </span><span style="background-color:transparent;font-size:12pt;font-family:Arial;color:rgb(0,0,10);vertical-align:baseline;white-space:pre-wrap">which can be used with Libvirt to create LXC container. Optionally the flags for UID/GID mapping or setting root password can be used as well.</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><ul style="margin-top:0pt;margin-bottom:0pt"><li dir="ltr" style="list-style-type:disc;font-size:14pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14pt;background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Apply UID/GID mapping</span></p></li></ul><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">The flags --idmap, --uidmap and --gidmap can be used to map the owner and group of members in the created root file system. Each of these flags can be used multiple times and take input with format: </span><span style="font-size:12pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><start>:<target>:<count></span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Where </span><span style="font-size:12pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><start></span><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> is the UID/GID on the host, <target> is the UID/GID inside the container and </span><span style="font-size:12pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><count></span><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> is the number of UID/GIDs to be mapped (range).</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Example:</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:10pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">$ virt-bootstrap docker://fedora /var/lib/Libvirt/filesystems/ct1 \</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:10pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> --idmap 0:1000:10 \</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:10pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> -–idmap 500:1500:10</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">This will apply the UID/GID map:</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:10pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">0, 1, 2 … 9     </span><span style="font-size:10pt;font-family:"Courier New";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">to    1000, 1001, … 1009</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent;font-size:10pt;font-family:"Courier New";color:rgb(0,0,10);vertical-align:baseline;white-space:pre-wrap">500, 501 … 509  </span><span style="background-color:transparent;font-size:10pt;font-family:"Courier New";color:rgb(0,0,10);vertical-align:baseline;white-space:pre-wrap">to    </span><span style="background-color:transparent;font-size:10pt;font-family:"Courier New";color:rgb(0,0,10);vertical-align:baseline;white-space:pre-wrap">1500, 1501 … 1509</span></p><br><br><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;font-weight:700;vertical-align:baseline;white-space:pre-wrap">Limitations and known bugs</span></p><br><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">You do not necessarily need to be root to use virt-bootstrap, however there are some limitations for unprivileged users when </span><span style="background-color:transparent;color:rgb(0,0,10);font-family:"Liberation Serif";font-size:12pt;white-space:pre-wrap">used with output format “dir”. In such case all members of the extracted root file system will be owned by the same unprivileged and UID/GID mapping cannot be applied.</span></p><br><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">When the output format is qcow2 all functionalities are available for unprivileged users, however at the time of writing this post Libvirt has a bug which does not allow to  start LXC container from qcow2 image with enabled </span><span style="color:rgb(0,0,10);font-family:"Liberation Serif";font-size:16px;white-space:pre-wrap">user namespace </span><span style="background-color:transparent;font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);vertical-align:baseline;white-space:pre-wrap">. This bug has been reported here </span><span style="text-decoration-line:underline;font-size:12pt;font-family:"Liberation Serif";background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><a href="https://bugzilla.redhat.com/show_bug.cgi?id=1328946" style="text-decoration-line:none">https://bugzilla.redhat.com/show_bug.cgi?id=1328946</a></span><span style="color:rgb(0,0,10);font-family:"Liberation Serif";font-size:16px;white-space:pre-wrap"> </span><span style="background-color:transparent;color:rgb(0,0,10);font-family:"Liberation Serif";font-size:12pt;white-space:pre-wrap">and the work around is to mount the qcow2 image and start LXC container from the mounted directory with enabled user namespaces.</span></p><br><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;font-weight:700;vertical-align:baseline;white-space:pre-wrap">Acknowledgements</span></p><br><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">I would like to thanks all members of Libvirt and virt-tools communities and particularly </span><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);vertical-align:baseline;white-space:pre-wrap">Cédric Bosdonnat, Cole Robinson and Pavel Hrdina for all commit reviews and suggestions.</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);vertical-align:baseline;white-space:pre-wrap">I would also like to thanks Daniel P. Berrange for the help in resolving issues.</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);vertical-align:baseline;white-space:pre-wrap">And of course, many thanks to the staff of GSoC for running the programme.</span></p><div><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);vertical-align:baseline;white-space:pre-wrap"><br></span></div><div><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);vertical-align:baseline;white-space:pre-wrap">Kind Regards,</span></div><div><span style="font-size:12pt;font-family:"Liberation Serif";color:rgb(0,0,10);vertical-align:baseline;white-space:pre-wrap">Radostin</span></div></span></div>