<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Are you guys following Disk Image Builder project?<div><a href="https://github.com/stackforge/diskimage-builder">https://github.com/stackforge/diskimage-builder</a></div><div>I saw a bug related to udev rules for Fedora.</div><div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px; "><div><div style="font-size: 12px; ">-------------------------------------------------</div><div style="font-size: 12px; ">Brian Schott, CTO</div><div style="font-size: 12px; ">Nimbis Services, Inc.</div><div style="font-size: 12px; "><a href="mailto:brian.schott@nimbisservices.com">brian.schott@nimbisservices.com</a></div><div style="font-size: 12px; ">ph: 443-274-6064  fx: 443-274-6060</div></div><div><br></div></span><br class="Apple-interchange-newline">
</div>
<br><div><div>On Jul 2, 2013, at 3:15 PM, Lorin Hochstein <<a href="mailto:lorin@nimbisservices.com">lorin@nimbisservices.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hi Joe:<div><br></div><div>Ah, gotcha. No, you couldn't use virt-sysprep from inside of the instance. It only works on VMs that are shutdown.</div><div><br></div><div>It's a shame that virt-sysprep doesn't completely remove the relevant udev rules generator entirely. <br>
</div><div><br></div><div>Lorin</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 2, 2013 at 3:06 PM, Joe Topjian <span dir="ltr"><<a href="mailto:joe.topjian@cybera.ca" target="_blank">joe.topjian@cybera.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Lorin,<div><br></div><div>Right, virt-sysprep is used in Dean's build script to create the initial image. The issue I see is when an instance is created from the image and then a snapshot is created -- unless the udev rules are manually removed prior to snapshot creation, they will still exist for each instance based off of the snapshot and so the virtual NICs won't get named properly.</div>

<div><br></div><div>Maybe virt-sysprep can be run from inside the instance? If so, it still requires all users to manually run it prior to snapshotting. This is why I've gone and just disabled udev rule entries for all NICs (based on a KVM-based MAC address).</div>
<span class="HOEnZb"><font color="#888888">
<div><br></div><div>Joe</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 2, 2013 at 12:31 PM, Lorin Hochstein <span dir="ltr"><<a href="mailto:lorin@nimbisservices.com" target="_blank">lorin@nimbisservices.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Joe:<div><br></div><div>That's great news, I'd like to update the image guide with info on how to do a fully scripted creation of CentOS images that resize properly.</div>

<div><br></div><div>
For udev, there's a great tool called "virt-sysprep" from libguestfs project. It will remove the MAC address from udev as well as clean up various other things: <a href="http://libguestfs.org/virt-sysprep.1.html" target="_blank">http://libguestfs.org/virt-sysprep.1.html</a></div>

<span><font color="#888888">
<div><br></div><div>Lorin</div></font></span></div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 2, 2013 at 2:13 PM, Joe Topjian <span dir="ltr"><<a href="mailto:joe.topjian@cybera.ca" target="_blank">joe.topjian@cybera.ca</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Lorin,<div><br></div><div>I was working on this the week before last and ran into the same problems you've described. I was on vacation last week, but before I left, I had a solution that I'm 99% happy with -- I just need to do some final testing.</div>



<div><br></div><div>Dean Troyer has some great CentOS build scripts <a href="https://github.com/dtroyer/image-recipes" target="_blank">here</a>. These scripts will build a CentOS image on the fly from start to finish. The only issue I ran into was with udev: On first boot, udev will record the MAC addresses of the virtual NIC(s) in the instance. If you create a snapshot, these records are not removed and so udev renames the interfaces to something else.</div>



<div><br></div><div>Here is my <a href="https://github.com/jtopjian/image-recipes" target="_blank">fork</a> of the scripts which resolves this udev issue. </div><div><br></div><div>If you use these scripts, let me know if you run into any issues. I hope to finish up my testing either this week or next week and finally have a good (on par with Ubuntu) CentOS cloud image -- even better that it can be generated on the fly and receive all current updates.</div>


<span><font color="#888888">
<div><br></div><div>Joe</div></font></span></div><div class="gmail_extra"><div><br><br><div class="gmail_quote">On Sun, Jun 30, 2013 at 12:46 PM, Lorin Hochstein <span dir="ltr"><<a href="mailto:lorin@nimbisservices.com" target="_blank">lorin@nimbisservices.com</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Robert:<div><br></div><div>This script doesn't support LVM partitions, does it?</div><div><br></div>



<div>Also, I've discovered that it breaks if there's a /boot partition. Apparently, if a boot partition is present then grub prepends a "/boot" to the paths for the kernel and ramdisk, and this script also prepends /boot.</div>




<div><br></div><div>Lorin</div></div><div class="gmail_extra"><div><br><br><div class="gmail_quote">On Tue, Jun 11, 2013 at 8:38 AM, Robert Plestenjak <span dir="ltr"><<a href="mailto:robert.plestenjak@xlab.si" target="_blank">robert.plestenjak@xlab.si</a>></span> wrote:<br>




<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Almost forgot, don't forget to install 'wget' and 'openssh-clients'<br>
<div><br>
- Robert<br>
<br>
----- Original Message -----<br>
</div><div>From: "Robert Plestenjak" <<a href="mailto:robert.plestenjak@xlab.si" target="_blank">robert.plestenjak@xlab.si</a>><br>
To: <a href="mailto:openstack-operators@lists.openstack.org" target="_blank">openstack-operators@lists.openstack.org</a><br>
Sent: Tuesday, June 11, 2013 11:35:01 AM<br>
Subject: Re: [Openstack-operators] CentOS image<br>
<br>
</div><div>Yes, that would be great.<br>
<br>
You can also create image manually in KVM, until proper tools are ready.<br>
<br>
1. create disk image with QCOW2 format<br>
<br>
qemu-img create -f qcow2 -o preallocation=metadata /extra/libvirt/images/centos-6-cloud.qcow2 2G<br>
<br>
2. install centos, I recomend only one partition and no swap (in grizzly, you can set swap size in flavor)<br>
<br>
virt-install --name=centos-6-cloud --disk path=/extra/libvirt/images/centos-6-cloud.qcow2,format=qcow2 -r 1024 --vcpus=1 --hvm -c /extra/iso/CentOS-6.3-x86_64-minimal.iso<br>
<br>
3. login into your new image and modify '/etc/sysconfig/network-scripts/ifcfg-eth0' to look like this<br>
<br>
DEVICE="eth0"<br>
BOOTPROTO="dhcp"<br>
NM_CONTROLLED="no"<br>
ONBOOT="yes"<br>
TYPE="Ethernet"<br>
<br>
4. add EPEL repository and update OS<br>
<br>
wget <a href="http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm" target="_blank">http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm</a><br>
rpm -ivh epel-release-6-8.noarch.rpm<br>
<br>
5. install cloud-utils and cloud-init<br>
<br>
yum update<br>
yum install cloud-utils, cloud-init<br>
<br>
6. Download 'centos-image-mod.sh' and 'init-part' together in same directory, run 'centos-image-mod.sh'. This will modify initrd and grub.conf.<br>
<br>
6.1. Edit '/boot/grub/grub.conf', check if everything is OK. Also, may not be a bad idea to set timeout to 0.<br>
<br>
7. Delete '/etc/udev/rules.d/70-persistent-net.rules', this will be auto created during boot. Don't forget this, since you won't have functional network when you bring this image up on Openstack.<br>
<br>
8. Power down your virtual Centos<br>
<br>
9. Compress QCOW2 image with<br>
<br>
qemu-img convert -c /extra/libvirt/images/centos-6-cloud.qcow2 -O qcow2 /tmp/centos.qcow2<br>
<br>
<br>
Image /tmp/centos.qcow2 is now ready for upload to Openstack<br>
<br>
- Robert<br>
<br>
<br>
On 16 May 2013 21:08, Robert Plestenjak <<a href="mailto:robert.plestenjak@xlab.si" target="_blank">robert.plestenjak@xlab.si</a>> wrote:<br>
> This script will modify initrd for image resize during boot, redirect boot log messages to ttyS0 and set NOOP sceduler. Tested on CentOS 6.3 and 6.4.<br>
><br>
> <a href="https://github.com/flegmatik/centos-image-resize" target="_blank">https://github.com/flegmatik/centos-image-resize</a><br>
<br>
This would be lovely to integrate into diskimage-builder [as part of a<br>
CentOS supporting element].<br>
<br>
-Rob<br>
<br>
--<br>
Robert Collins <<a href="mailto:rbtcollins@hp.com" target="_blank">rbtcollins@hp.com</a>><br>
Distinguished Technologist<br>
HP Cloud Services<br>
<br>
_______________________________________________<br>
OpenStack-operators mailing list<br>
<a href="mailto:OpenStack-operators@lists.openstack.org" target="_blank">OpenStack-operators@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators</a><br>
<br>
_______________________________________________<br>
OpenStack-operators mailing list<br>
<a href="mailto:OpenStack-operators@lists.openstack.org" target="_blank">OpenStack-operators@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators</a><br>
</div></blockquote></div><br><br clear="all"><div><br></div></div><span><font color="#888888">-- <br><div dir="ltr">Lorin Hochstein<br><div>Lead Architect - Cloud Services</div><div>Nimbis Services, Inc.</div>



<div><a href="http://www.nimbisservices.com/" target="_blank">www.nimbisservices.com</a></div>
</div>
</font></span></div>
<br>_______________________________________________<br>
OpenStack-operators mailing list<br>
<a href="mailto:OpenStack-operators@lists.openstack.org" target="_blank">OpenStack-operators@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br></div><div><div dir="ltr">Joe Topjian<div>Systems Architect</div><div>Cybera Inc.</div><div><br></div><div><a href="http://www.cybera.ca/" target="_blank">www.cybera.ca</a></div>



<div><br></div><div><font color="#666666"><span>Cybera</span><span> is a not-for-profit organization that works to spur and support innovation, for the economic benefit of Alberta, through the use of cyberinfrastructure.</span></font></div>



</div>
</div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Lorin Hochstein<br><div>Lead Architect - Cloud Services</div><div>Nimbis Services, Inc.</div><div><a href="http://www.nimbisservices.com/" target="_blank">www.nimbisservices.com</a></div>


</div>
</div>
</div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Joe Topjian<div>Systems Architect</div><div>Cybera Inc.</div><div><br></div><div><a href="http://www.cybera.ca/" target="_blank">www.cybera.ca</a></div>

<div><br></div><div><font color="#666666"><span>Cybera</span><span> is a not-for-profit organization that works to spur and support innovation, for the economic benefit of Alberta, through the use of cyberinfrastructure.</span></font></div>

</div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Lorin Hochstein<br><div>Lead Architect - Cloud Services</div><div>Nimbis Services, Inc.</div><div><a href="http://www.nimbisservices.com/" target="_blank">www.nimbisservices.com</a></div>
</div>
</div>
_______________________________________________<br>OpenStack-operators mailing list<br><a href="mailto:OpenStack-operators@lists.openstack.org">OpenStack-operators@lists.openstack.org</a><br>http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators<br></blockquote></div><br></div></body></html>