<div dir="ltr">Hi Lorin,<div><br></div><div style>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 style><br></div><div style>Dean Troyer has some great CentOS build scripts <a href="https://github.com/dtroyer/image-recipes">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 style><br></div><div style>Here is my <a href="https://github.com/jtopjian/image-recipes">fork</a> of the scripts which resolves this udev issue. </div><div style><br></div><div style>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>
<div style><br></div><div style>Joe</div></div><div class="gmail_extra"><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><div class="h5"><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><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></div></blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><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">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 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>