OpenStack 安装和使用(五)
INSTANCE i-00000003 ami-00000001 server-3 server-3 pending f16jeos (94d38db32a7d4107beeed36d9e98bf06, None) 0 m1.small 2012-07-17T02:13:00.000Z unknown zone
RESERVATION r-nslxocfx 94d38db32a7d4107beeed36d9e98bf06 default
INSTANCE i-00000003 ami-00000001 server-3 server-3 running f16jeos (94d38db32a7d4107beeed36d9e98bf06, cc) 0 m1.small 2012-07-17T02:13:00.000Z nova
RESERVATION r-dib7miiv 94d38db32a7d4107beeed36d9e98bf06 default
INSTANCE i-00000002 ami-00000001 f16jeos-vm f16jeos-vm running f16jeos (94d38db32a7d4107beeed36d9e98bf06, cc) 0 m1.small 2012-07-16T10:41:51.000Z nova
+————————————–+————+——–+——————-+
| ID | Name | Status | Networks |
+————————————–+————+——–+——————-+
| 93c8a5f7-a40e-459e-b329-16c4fc7d6c1d | Server 3 | ACTIVE | hanborq=10.25.1.4 |
| 9a0df00e-ba18-4fac-a877-f03abb6bd248 | f16jeos_vm | ACTIVE | hanborq=10.25.1.2 |
+————————————–+————+——–+——————-+
i-00000003
2012-07-17T02:19:18.272Z
# yum install –enablerepo=updates-testing numpy
# yum install –enablerepo=updates-testing pyparted
# yum install –enablerepo=updates-testing python-libguestfs
# yum install –enablerepo=updates-testing /usr/bin/oz-install
<name>fedora16_x86_64</name>
<description>My Fedora 16 x86_64 template</description>
<os>
<name>Fedora</name>
<version>16</version>
<arch>x86_64</arch>
<install type=’iso’>
<iso>file:///root/Fedora-16-x86_64-DVD.iso</iso>
</install>
</os>
<commands>
<command name=’setup-rc-local’>
sed -i ‘s/rhgb quiet/console=ttyS0/’ /boot/grub/grub.conf
cat >> /etc/rc.local << EOF
if [ ! -d /root/.ssh ]; then
mkdir -p /root/.ssh
chmod 700 /root/.ssh
fi
# Fetch public key using HTTP
ATTEMPTS=10
while [ ! -f /root/.ssh/authorized_keys ]; do
curl -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > /tmp/aws-key 2>/dev/null
if [ \$? -eq 0 ]; then
cat /tmp/aws-key >> /root/.ssh/authorized_keys
chmod 0600 /root/.ssh/authorized_keys
restorecon /root/.ssh/authorized_keys
rm -f /tmp/aws-key
echo “Successfully retrieved AWS public key from instance metadata”
else
FAILED=\$((\$FAILED + 1))
if [ \$FAILED -ge \$ATTEMPTS ]; then
echo “Failed to retrieve AWS public key after \$FAILED attempts, quitting”
break
fi
echo “Could not retrieve AWS public key (attempt #\$FAILED/\$ATTEMPTS), retrying in 5 seconds…”
sleep 5
fi
done
EOF
</command>
</commands>
</template>
导入glance:
# glance add name=f16-jeos-new is_public=true container_format=bare disk_format=raw < /var/lib/libvirt/images/fedora16_x86_64.dsk
+————————————–+————+——–+——————-+
| ID | Name | Status | Networks |
+————————————–+————+——–+——————-+
| 1887073b-cae2-45fa-95c5-70b3d6621f79 | Server 4 | ACTIVE | hanborq=10.25.1.5 |
| 93c8a5f7-a40e-459e-b329-16c4fc7d6c1d | Server 3 | ACTIVE | hanborq=10.25.1.4 |
| 9a0df00e-ba18-4fac-a877-f03abb6bd248 | f16jeos_vm | ACTIVE | hanborq=10.25.1.2 |
+————————————–+————+——–+——————-+
RESERVATION r-nslxocfx 94d38db32a7d4107beeed36d9e98bf06 default
INSTANCE i-00000003 ami-00000001 server-3 server-3 running f16jeos (94d38db32a7d4107beeed36d9e98bf06, cc) 0 m1.small 2012-07-17T02:13:00.000Z nova
RESERVATION r-dib7miiv 94d38db32a7d4107beeed36d9e98bf06 default
INSTANCE i-00000002 ami-00000001 f16jeos-vm f16jeos-vm running f16jeos (94d38db32a7d4107beeed36d9e98bf06, cc) 0 m1.small 2012-07-16T10:41:51.000Z nova
RESERVATION r-z852etjo 94d38db32a7d4107beeed36d9e98bf06 default
INSTANCE i-00000004 ami-00000002 server-4 server-4 running f16jeos (94d38db32a7d4107beeed36d9e98bf06, cc) 0 m1.small 2012-07-17T06:28:15.000Z nova
VOLUME vol-00000002 10 nova in-use (94d38db32a7d4107beeed36d9e98bf06, cc, i-00000004[cc], /dev/vdc) 2012-07-17T07:39:46.000Z
| ID | Status | Display Name | Size | Volume Type | Attached to |
+—-+——–+————–+——+————-+————————————–+
| 2 | in-use | None | 10 | None | 1887073b-cae2-45fa-95c5-70b3d6621f79 |
+—-+——–+————–+——+————-+————————————–+
+———————+——————————————————————————————————————–+
| Property | Value |
+———————+——————————————————————————————————————–+
| attachments | [{u’device’: u’/dev/vdc’, u’server_id’: u’1887073b-cae2-45fa-95c5-70b3d6621f79′, u’id’: u’2′, u’volume_id’: u’2′}] |
| availability_zone | nova |
| created_at | 2012-07-17 07:39:46 |
| display_description | None |
| display_name | None |
| id | 2 |
| metadata | {} |
| size | 10 |
| snapshot_id | None |
| status | in-use |
| volume_type | None |
+———————+——————————————————————————————————————–+
ACTIVE ‘/dev/vg_nova_volume/volume-00000002’ [10.00 GiB] inherit
Target 1: iqn.2010-10.org.openstack:volume-00000002
System information:
Driver: iscsi
State: ready
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 10737 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/vg_nova_volume/volume-00000002
Backing store flags:
Account information:
ACL information:
ALL
None 172.31.0.225 None nova em1
None 172.31.0.226 None nova em1
None 172.31.0.227 None nova em1
None 172.31.0.228 None nova em1
None 172.31.0.229 None nova em1
None 172.31.0.230 None nova em1
None 172.31.0.231 None nova em1
None 172.31.0.232 None nova em1
None 172.31.0.233 None nova em1
None 172.31.0.234 None nova em1
None 172.31.0.235 None nova em1
None 172.31.0.236 None nova em1
None 172.31.0.237 None nova em1
None 172.31.0.238 None nova em1
+————–+————————————–+———–+——+
| Ip | Instance Id | Fixed Ip | Pool |
+————–+————————————–+———–+——+
| 172.31.0.225 | 1887073b-cae2-45fa-95c5-70b3d6621f79 | 10.25.1.5 | nova |
+————–+————————————–+———–+——+
+————————————–+————+——–+———————————+
| ID | Name | Status | Networks |
+————————————–+————+——–+———————————+
| 1887073b-cae2-45fa-95c5-70b3d6621f79 | Server 4 | ACTIVE | hanborq=10.25.1.5, 172.31.0.225 |
| 93c8a5f7-a40e-459e-b329-16c4fc7d6c1d | Server 3 | ACTIVE | hanborq=10.25.1.4 |
| 9a0df00e-ba18-4fac-a877-f03abb6bd248 | f16jeos_vm | ACTIVE | hanborq=10.25.1.2 |
+————————————–+————+——–+———————————+
RESERVATION r-nslxocfx 94d38db32a7d4107beeed36d9e98bf06 default
INSTANCE i-00000003 ami-00000001 server-3 server-3 running f16jeos (94d38db32a7d4107beeed36d9e98bf06, cc) 0 m1.small 2012-07-17T02:13:00.000Z nova
RESERVATION r-dib7miiv 94d38db32a7d4107beeed36d9e98bf06 default
INSTANCE i-00000002 ami-00000001 f16jeos-vm f16jeos-vm running f16jeos (94d38db32a7d4107beeed36d9e98bf06, cc) 0 m1.small 2012-07-16T10:41:51.000Z nova
RESERVATION r-z852etjo 94d38db32a7d4107beeed36d9e98bf06 default
INSTANCE i-00000004 ami-00000002 172.31.0.225 server-4 running f16jeos (94d38db32a7d4107beeed36d9e98bf06, cc) 0 m1.small 2012-07-17T06:28:15.000Z nova