8. 7
COPYRIGHT FUJITSU LIMITED 2014
ーネルファイ(initrd.img-xxx-virtual、vmlinuz-xxx-virtual)のバージョンを確認し、/root/ bosh/bosh-stemcell/spec/stemcells/ubuntu_precise_spec.rbの 3行目から14行目(describe ~ end まで)に記載されている各カーネルバジョンを確認した合わせ修正す。
# ls /mnt/stemcells/null/ubuntu/work/chroot/boot
System.map-3.2.0-70-virtual config-3.2.0-70-virtual initrd.img-3.2.0-70-virtual
abi-3.2.0-70-virtual grub vmlinuz-3.2.0-70-virtual
※作成したubuntuのカーネルバジョンが「3.2.0-70」であることを確認
# vi /root/bosh/bosh-stemcell/spec/stemcells/ubuntu_precise_spec.rb
(略)
describe 'Ubuntu 12.04 stemcell', stemcell_image: true do
context 'installed by image_install_grub' do
describe file('/boot/grub/grub.conf') do
it { should be_file }
it { should contain 'default=0' }
it { should contain 'timeout=1' }
it { should contain 'title Ubuntu 12.04.5 LTS (3.2.0-68-virtual)' }
it { should contain ' root (hd0,0)' }
it { should contain ' kernel /boot/vmlinuz-3.2.0-68-virtual ro root=UUID=' }
it { should contain ' selinux=0' }
it { should contain ' initrd /boot/initrd.img-3.2.0-68-virtual' }
end
(略)
↓ 以下のように修正
(略)
describe 'Ubuntu 12.04 stemcell', stemcell_image: true do
context 'installed by image_install_grub' do
describe file('/boot/grub/grub.conf') do
it { should be_file }
it { should contain 'default=0' }
it { should contain 'timeout=1' }
it { should contain 'title Ubuntu 12.04.5 LTS (3.2.0-70-virtual)' }
it { should contain ' root (hd0,0)' }
9. 8
COPYRIGHT FUJITSU LIMITED 2014
it { should contain ' kernel /boot/vmlinuz-3.2.0-70-virtual ro root=UUID=' }
it { should contain ' selinux=0' }
it { should contain ' initrd /boot/initrd.img-3.2.0-70-virtual' }
end
(略)
(3) stemcellイメージの作成
以下のコマンドを実行し、(1)で作成したベースイメジからstemcellイメージを生成する。
# bundle exec rake stemcell:build_with_local_os_image[cloudstack,ubuntu,precise,ruby,/tmp/ubuntu_base_image.tgz]
3.1.4. Proxyサーバの非参照設定
内部のローカルアドレス(インセプショサバやから起動されるFirstboshサーバ)を Proxyサーバなしで参照するように「no_proxy」環境変数を指定する。
# export no_proxy=172.16.10.224,172.16.10.227,172.16.10.228
※管理サーバの IP、ルータVMの IPとインセプショサーバ自身のIPを除外対象に指定
3.1.5. キーペアファイルの作成
(1) スクリプトファイル作成
Cloudstackの APIを使用してSSHキーペアファイルを作成するため、以下のスクリプトる。
メモ: 公開手順にあるキーペア作成用スクリプトは正常動しなかっため、以下のを独自てキーペアファイル作成を行っいる。
# cat kick_api.sh
-----------------------------------------
#!/bin/bash
#
# kick_api.sh
#
# please set your host
address="http://172.16.10.224:8080" # Cloudstack管理サーバのURL
# please set your api key (CloudStackGUIであらかじめ作成しておく)
13. 12
COPYRIGHT FUJITSU LIMITED 2014
resources:
persistent_disk: 20512
cloud_properties:
instance_type: m1.large2
# VMタイプ(コンピューオファリグ)
cloud:
plugin: cloudstack
properties:
cloudstack:
endpoint: http://172.16.10.224:8080/client/api
# Cloudstackの管理サーバアドレスに、/client/api を付与したもの指定
api_key: QBbqiA_mGMp23w8lX1zadH_PCruxaqj55iTtQgCQst5Pd5aJ1TrXKErTX3UKIvmx4Ok5WaJZNPwY0o1Y_ORP2A
# キーペア作成時に指定したもの
secret_access_key: oN5z4NafX9OrwknE39f9sT_rhSrfdCa1CRuoCjO3iD214wzM4JGLIT2TjwmvBerWLuM9OOdnCEtyVpPy02rOkg
# キーペア作成時に指定したもの
default_key_name: cfmykey
# キーペア作成時に指定した名
private_key: /root/cfmykey # キーペア作成時に出力内容を保存したファイル名
state_timeout: 600
state_timeout_volume: 1200
stemcell_public_visibility: true
default_zone: zone01 # Zone name of your instaption server
# Only for Basic Zone
users. Delete these lines on Advanced default_security_groups: ["default"]
# TCP、UDPでの全て通信が可能なセキュリティグループ名を[""]で括って指定
registry:
endpoint: http://admin:admin@172.16.10.227:25889
# インセプショサーバのIPを指定
user: admin
password: admin
14. 13
COPYRIGHT FUJITSU LIMITED 2014
3.1.7. ソースコードの修正
(1) デバイスアタッチ処理関連
メモ: デバイス名の仕様違いから、フォルトモジューではアタッチ時にエラが発生するためソースを修正しエラが発生ないように対応
デバイスアタッチの不具合対応として、以下ソーコド修正を行っおく。
ファイル名:~/bosh/bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb
コード最下部の以分を修正
-----------------------------------------
def volume_device_name(id)
# assumes device name begins with "dev/sd" and volume_name is numeric
cloud_error("Unkown device id given") if device_id.nil?
suffix = ('a'..'z').to_a[device_id]
cloud_error("too many disks attached") if suffix.nil?
"/dev/sd#{suffix}"
end
-----------------------------------------
↓以下に修正
-----------------------------------------
def volume_device_name(id)
# assumes device name begins with "dev/sd" and volume_is numeric
cloud_error("Unkown device id given") if device_id.nil?
suffix = ('a'..'z').to_a[device_id-1]
cloud_error("too many disks attached") if suffix.nil?
"/dev/vd#{suffix}"
end
-----------------------------------------
メモ: ソースコドはvirtio前提ではないため、virtioでのディスクアタッチに合うよバイ名を取得す る部分で「-1」している
25. 24
COPYRIGHT FUJITSU LIMITED 2014
networks:
- name: default
type: dynamic
cloud_properties:
# Only for Basic Zone users
security_groups:
## - bosh # Securiy group which opens all TCP and UDP ports
- default # ●defaultで全port開けているのでそま指定●
## # Only for Advanced Zone users
## network_name: <name> # subnetwork ●
無効化# Only for Advanced Zone users
# Network with floating IP addresses
- name: floating
type: vip
cloud_properties: {}
compilation:
workers: 6
network: default
reuse_compilation_vms: true
cloud_properties:
instance_type: m1.medium # VM type
ephemeral_volume: Datadisk 40GB # Data disk
offering name of additonal update:
canaries: 1
canary_watch_time: 30000-60000
update_watch_time: 30000-60000
max_in_flight: 4
resource_pools:
- name: small
network: default
26. 25
COPYRIGHT FUJITSU LIMITED 2014
size: 8
stemcell:
name: bosh-cloudstack-kvm-ubuntu
version: latest
cloud_properties:
instance_type: m1.small # VM type
ephemeral_volume: Datadisk 40GB # Data disk
offering name of additonal - name: large
network: default
size: 1
stemcell:
name: bosh-cloudstack-kvm-ubuntu
version: latest
cloud_properties:
instance_type: m1.large # VM type
ephemeral_volume: Datadisk 40GB # Data disk
offering name of additional jobs:
- name: nats
release: cf
template:
- nats
instances: 1
resource_pool: small
networks:
- name: default
default: [dns, gateway]
- name: syslog_aggregator
release: cf
template:
- syslog_aggregator
instances: 1
resource_pool: small
persistent_disk: 65536