Create Windows7 VM on OpenStack Havana (CentOS 6.5)
2015年3月15日发布Reference: http://cloud-ninja.org/2014/05/14/running-windows-7-guests-on-openstack-icehouse/
Contents:
[*]Requirements
[*]Install OpenStack(Havana) Compute node
[*]Create Windows 7 image for OpenStack
[*]Deploy VM on OpenStack
[*]Issue on assigning GPUs to VM which is on OpenStack
1. Requirements
[*]A windows 7 images download link
[*]VirtIO driver for KVM guest windows download link (Here I used virtio-win-0.1.74 version, latest version may not work with Havana version)
[*]Cloudbase-init download link
[*]CentOS 6.5 Linux Machine with kernel 2.6.x (with 3.x version, havana does not work well)
2. Install OpenStack(Havana) Compute node
2.1 Basic OS Configuration
service NetworkManager stop
service network start
chkconfig NetworkManager off
chkconfig network on
vi /etc/hosts
127.0.0.1 localhost
xxx.xxx.x.x controller
xxx.xxx.x.x compute1
Install the ntp package on each system running OpenStack services.
yum install ntp
service ntpd start
chkconfig ntpd on
yum install http://repos.fedorapeople.org/repos/openstack/openstack-havana/rdo-release-havana-7.noarch.rpm
yum install openstack-utils
yum install openstack-selinux
yum upgrade
reboot (kernel version is 2.6.32-504.8.1.el6.x86_64)
2.2 Network is configured with Neutron Network
Before following process, make sure that turn off all firewall and then restart
service iptables stop
service iptables start
(OpenStack 설치 시 방화벽 자동 설정해줌. 아니면 compute service가 실행되지 않음)
Disable packet destination filtering
vi /etc/sysctl.conf
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
sysctl -p
Install and Neutron Plug-ins on a dedicated compute node
Install Open vSwitch plug-in
------------------------------------------------------------
yum install openstack-neutron-openvswitch
service openvswitch start
chkconfig openvswitch on
ovs-vsctl add-br br-int
vi /etc/neutron/neutron.conf
core-plugin=neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2
api_paste_config=/etc/neutron/api-paste.ini
rpc_backend=neutron.openstack.common.rpc.impl_qpid
vi /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
firewall_driver=neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
chkconfig neutron-openvswitch-agent on
For GRE tunneling
vi /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
tenant_network_type=gre
tunnel_id_ranges=1:1000
enable_tunneling=True
integration_bridge=br-int
tunnel_bridge=br-tun
local_ip=DATA_INTERNET_IP
For VLANs
vi /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
tenant_network_type = vlan
network_vlan_ranges = physnet1:1:4094
bridge_mappings = physnet1:br-DATA_INTERFACE
Create the bridge for DATA_INTERFACE and add DATA_INTERFACE to it:
ovs-vsctl add-br br-DATA_InTERFACE
ovs-vsctl add-port br-DATA_INTERFACE DATA_INTERFACE
-------------------------------------------------------------
Install and Configure Neutron Network
vi /etc/neutron/neutron.conf
auth_host = controller
admin_tenant_name = service
admin_user = neutron
admin_password = NEUTRON_PASS
auth_url = http://controller:35357/v2.0
auth_strategy = keystone
rpc_backend = neutron.openstack.common.rpc.impl_qpid
qpid_hostname = controller
vi /etc/neutron/neutron.conf
...
root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf
connection = mysql://neutron: NEUTRON_DBPASS@controller/neutron
vi /etc/neutron/api-paste.ini
paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
auth_host = controller
admin_tenant_name = service
admin_user = neutron
admin_password = NEUTRON_PASS
vi /etc/nova/nova.conf
network_api_class=nova.network.neutronv2.api.API
neutron_url=http://controller:9696
neutron_auth_strategy=keystone
neutron_admin_tenant_name=service
neutron_admin_username=neutron
neutron_admin_password=NEUTRON_PASS
neutron_admin_auth_url=http://controller:35357/v2.0
linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver
firewall_driver=nova.virt.firewall.NoopFirewallDriver
security_group_api=neutron
service openstack-nova-compute restart
service neutron-openvswitch-agent restart
3. Create Windows7 image for OpenStack
virt-manager
New VM -> Name: vm_windows& -> Choose "Local install media(ISO image or CDROM)"
https://4.bp.blogspot.com/-aOsHiWQxKyM/U03wa8kIg1I/AAAAAAAAAXQ/1G95taoTY-Q/s1600/new%2Bvm.png
Use ISI image:
/root/openstack-images/X17-24329.iso
OS type:
Windows 7
https://2.bp.blogspot.com/-h0o-e15Bw6k/U04CuLzFlWI/AAAAAAAAAXg/10Bf5xRV1h4/s1600/use%2Biso%2Bimage.png
Memory 2048MB
CPUs 2
https://4.bp.blogspot.com/-ucYnC5JiWn4/U04DU0ZqZrI/AAAAAAAAAXo/bK91Sn-EcEc/s1600/memory%2Band%2Bcpu.png
Select managed or other existing storage ( This is for adding virtual CD of installing VirtIO Driver)
New volume Name: vm_windows7.img
Format: qcow2
Max Capacity: 20000MB(20GB)
Allocation: 20000MB(20GB)
https://2.bp.blogspot.com/-XEXYeArmLw4/U04GM2KALVI/AAAAAAAAAYA/j78zKJrRTlg/s1600/volume%2Bstorage.png
Forward
click customize configuration before install (This is for adding new hardware)
Finish
Add Hardware
https://3.bp.blogspot.com/-YSmV86SKEXc/U04HFKAkYUI/AAAAAAAAAYI/sSbw7oLBTPY/s1600/add%2Bnew%2Bhardware.png
select managed or other existing storage
Browse: /root/openstack-images/virtio-win-0.1-74.iso
Device type: IDE cdrom
https://3.bp.blogspot.com/-8RwHpgQnnkY/U04Hch7RgYI/AAAAAAAAAYQ/EIuNFHqAf_c/s1600/set%2BvirtIO%2Bas%2BIDE%2Bcdrom.png
Switch the network and disk to use virtio as shown
https://3.bp.blogspot.com/-kWzXQq3cvfQ/VQYxN99a6GI/AAAAAAAAA6c/OZ4xQ_huBBs/s1600/2.PNG
https://1.bp.blogspot.com/-jtkfmQHEdR0/VQYxdyECvEI/AAAAAAAAA6k/zQn4GAd89tM/s1600/3.PNG
Click Begin Installation
https://2.bp.blogspot.com/-YcBBCZegcUg/U04H98HexcI/AAAAAAAAAYY/uSN08RHTyeY/s1600/install%2Bwindows.png
Click “Load drivers” and browse to E:\WIN7\AMD64:
Click “OK” and select the “Red Hat VirtIO SCSI controller”. Your 20 GB partition should now appear. Click next, and go grab some coffee while Windows does its thing.
Open the windows device manager.
Right click the ethernet controller and navigate to the drivers in E:\WIN7\AMD64\. It should auto-detect your device after hitting ok.
Repeat this process for the other two broken devices. Finally verify the system can reach the Internet. If everything looks okay, then shutdown the guest OS and open the info panel:
Remove both cdroms, and restart the Windows guest.
Install Cloudbase-init
http://www.cloudbase.it/cloud-init-for-windows-instances/
For now, accept the defaults and continue the install. When everything finishes don’t let the installer run sysprep. Also, before you shutdown, edit the C:\Program Files (x86)\Cloudbase Solutions\Cloudbase-Init\conf and make it look something like this:
username=Admin
groups=Administrators
inject_user_password=true
plugins=cloudbaseinit.plugins.windows.sethostname.SetHostNamePlugin,cloudbaseinit.plugins.windows.createuser.CreateUserPlugin,cloudbaseinit.plugins.windows.networkconfig.NetworkConfigPlugin,cloudbaseinit.plugins.windows.sshpublickeys.SetUserSSHPublicKeysPlugin,cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin,cloudbaseinit.plugins.windows.userdata.UserDataPlugin
network_adapter=
config_drive_raw_hhd=true
config_drive_cdrom=true
bsdtarpath=C:Program Files (x86)Cloudbase SolutionsCloudbase-Initbinbsdtar.exe
verbose=true
logdir=C:Program Files (x86)Cloudbase SolutionsCloudbase-Initlog
logfile=cloudbase-init.log
Now disable the Windows firewall:
All the connections to this server will be controlled the security groups in OpenStack. Also, we should allow RDP access:
https://4.bp.blogspot.com/-NjX43Q5lV8I/VQYyoKF63yI/AAAAAAAAA6w/gKwtWqX0yXg/s1600/4.PNG
Now we can shutdown, by manually running sysprep again:
C:\Windows\System32\sysprep\sysprep.exe /generalize /oobe /shutdown
4. Deploy VM on OpenStack
image convert
qemu-img convert -c -f raw -O qcow2 /var/lib/libvirt/images/win7.img ./win7.qcow2
upload image on OpenStack
glance image-create --name="Windows 7 (x86_64)" --is-public=True --container-format=bare --disk-format=qcow2 --file=./win7.qcow2
deploy instance
nava boot --flavor flavor name --image imageID --nicnet-id=netID --availability-zonenova:hostname vmName
http://xxx.xx.xx.x/dashbaord/
https://1.bp.blogspot.com/-Td8YB-Da13Y/VQY0zD3x7xI/AAAAAAAAA68/UwN801W6HQM/s1600/5.PNG
https://3.bp.blogspot.com/-46GyBO22kGo/VQY1WQiUe6I/AAAAAAAAA7E/_vjfo_nRPD4/s1600/6.PNG
5. Issue on assigning GPUs to VM which is on OpenStack
Kernel compile to 3.17.2 version and modify kernel options.
See this article: http://heavenkong.blogspot.kr/2015/01/gpu-pass-through-on-kvm-with-windows-7.html
页:
[1]