[Openstack-operators] CentOS image
Lorin Hochstein
lorin at nimbisservices.com
Tue Jul 2 18:31:32 UTC 2013
Joe:
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.
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: http://libguestfs.org/virt-sysprep.1.html
Lorin
On Tue, Jul 2, 2013 at 2:13 PM, Joe Topjian <joe.topjian at cybera.ca> wrote:
> Hi Lorin,
>
> 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.
>
> Dean Troyer has some great CentOS build scripts here<https://github.com/dtroyer/image-recipes>.
> 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.
>
> Here is my fork <https://github.com/jtopjian/image-recipes> of the
> scripts which resolves this udev issue.
>
> 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.
>
> Joe
>
>
> On Sun, Jun 30, 2013 at 12:46 PM, Lorin Hochstein <
> lorin at nimbisservices.com> wrote:
>
>> Robert:
>>
>> This script doesn't support LVM partitions, does it?
>>
>> 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.
>>
>> Lorin
>>
>>
>> On Tue, Jun 11, 2013 at 8:38 AM, Robert Plestenjak <
>> robert.plestenjak at xlab.si> wrote:
>>
>>> Almost forgot, don't forget to install 'wget' and 'openssh-clients'
>>>
>>> - Robert
>>>
>>> ----- Original Message -----
>>> From: "Robert Plestenjak" <robert.plestenjak at xlab.si>
>>> To: openstack-operators at lists.openstack.org
>>> Sent: Tuesday, June 11, 2013 11:35:01 AM
>>> Subject: Re: [Openstack-operators] CentOS image
>>>
>>> Yes, that would be great.
>>>
>>> You can also create image manually in KVM, until proper tools are ready.
>>>
>>> 1. create disk image with QCOW2 format
>>>
>>> qemu-img create -f qcow2 -o preallocation=metadata
>>> /extra/libvirt/images/centos-6-cloud.qcow2 2G
>>>
>>> 2. install centos, I recomend only one partition and no swap (in
>>> grizzly, you can set swap size in flavor)
>>>
>>> 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
>>>
>>> 3. login into your new image and modify
>>> '/etc/sysconfig/network-scripts/ifcfg-eth0' to look like this
>>>
>>> DEVICE="eth0"
>>> BOOTPROTO="dhcp"
>>> NM_CONTROLLED="no"
>>> ONBOOT="yes"
>>> TYPE="Ethernet"
>>>
>>> 4. add EPEL repository and update OS
>>>
>>> wget
>>> http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
>>> rpm -ivh epel-release-6-8.noarch.rpm
>>>
>>> 5. install cloud-utils and cloud-init
>>>
>>> yum update
>>> yum install cloud-utils, cloud-init
>>>
>>> 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.
>>>
>>> 6.1. Edit '/boot/grub/grub.conf', check if everything is OK. Also, may
>>> not be a bad idea to set timeout to 0.
>>>
>>> 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.
>>>
>>> 8. Power down your virtual Centos
>>>
>>> 9. Compress QCOW2 image with
>>>
>>> qemu-img convert -c /extra/libvirt/images/centos-6-cloud.qcow2 -O qcow2
>>> /tmp/centos.qcow2
>>>
>>>
>>> Image /tmp/centos.qcow2 is now ready for upload to Openstack
>>>
>>> - Robert
>>>
>>>
>>> On 16 May 2013 21:08, Robert Plestenjak <robert.plestenjak at xlab.si>
>>> wrote:
>>> > 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.
>>> >
>>> > https://github.com/flegmatik/centos-image-resize
>>>
>>> This would be lovely to integrate into diskimage-builder [as part of a
>>> CentOS supporting element].
>>>
>>> -Rob
>>>
>>> --
>>> Robert Collins <rbtcollins at hp.com>
>>> Distinguished Technologist
>>> HP Cloud Services
>>>
>>> _______________________________________________
>>> OpenStack-operators mailing list
>>> OpenStack-operators at lists.openstack.org
>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators
>>>
>>> _______________________________________________
>>> OpenStack-operators mailing list
>>> OpenStack-operators at lists.openstack.org
>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators
>>>
>>
>>
>>
>> --
>> Lorin Hochstein
>> Lead Architect - Cloud Services
>> Nimbis Services, Inc.
>> www.nimbisservices.com
>>
>> _______________________________________________
>> OpenStack-operators mailing list
>> OpenStack-operators at lists.openstack.org
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators
>>
>>
>
>
> --
> Joe Topjian
> Systems Architect
> Cybera Inc.
>
> www.cybera.ca
>
> Cybera is a not-for-profit organization that works to spur and support
> innovation, for the economic benefit of Alberta, through the use
> of cyberinfrastructure.
>
--
Lorin Hochstein
Lead Architect - Cloud Services
Nimbis Services, Inc.
www.nimbisservices.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-operators/attachments/20130702/5d37dae6/attachment.html>
More information about the OpenStack-operators
mailing list