[Openstack-operators] CentOS image

Robert Plestenjak robert.plestenjak at xlab.si
Mon Jul 22 07:19:53 UTC 2013


1. It should work with LVM.

2. Yes, /boot does mess things up. Script is working under assumption that boot is under /.

- Robert

----- Original Message -----
From: "Lorin Hochstein" <lorin at nimbisservices.com>
To: "Robert Plestenjak" <robert.plestenjak at xlab.si>
Cc: openstack-operators at lists.openstack.org
Sent: Sunday, June 30, 2013 8:46:26 PM
Subject: Re: [Openstack-operators] CentOS image


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 



More information about the OpenStack-operators mailing list