liwya 发表于 2017-6-25 16:41:58

Running Windows 7 guest on OpenStack Icehouse

  2015年3月2日发布
  Reference: Cloud Ninja


Running Windows 7 guests on OpenStack Icehouse


  VDI environment:

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2Fsyncomm.files.wordpress.com%2F2014%2F05%2Fopenstack-vdi.png%3Fw%3D1107%26h%3D416&container=blogger&gadget=a&rewriteMime=image%2F*

  In the above example, the user requests a VDI instance. A cloud automation tool communicates with OpenStack to provision a new win7 instance, and attach the user’s persistent storage. The user then accesses the desktop through RDP, VNC, or SPICE. When they are finished, they log off and the instance is destroyed. The user’s data, living in a cinder volume, will be reattached on the next session to a new fresh image. The user gets a brand new instance, and known “perfect state” every time they log in. This could be bad news for PC support :) The BYOD movement should not be underestimated either. Employees favor it, it cuts IT costs, and arguably leads to increased productivity. With cloud VDI, you can answer one of the most important risks in BYOD — maintaining control. No more lost/stolen devices, user corrupted systems, mawlware, or viruses. Just transient desktops and data. Anytime, anywhere, any device.

  


  Today OpenStack is picking up pace in the VDI sphere. Companies are dotting the OpenStack ecosystem, like Virtual Bridges and Leostream, who are providing VDI brokering platforms. Some companies have also utilized in-house talent to write cloud automation for the VDI basics. Today we won’t get too deep into the roll out of VDI on OpenStack. Instead, we will focus on the first problem — getting a Windows 7 desktop on the cloud to begin with.

  There are some great tools like Oz which are trying to simplify the process of getting every OS into the cloud. However, there are still some bits being worked on in the Windows space there. In light of that, the road to getting a Windows 7 cloud image created and installed is a manual and somewhat tricky chore. To alleviate the pain, I’m going to walk step-by-step through the process I use to create Windows 7 guests.

  There are a few things you will need:

[*]A Windows 7 image
[*]A Windows 7 product key
[*]A Linux box running KVM
[*]The KVM Windows Drivers ISO

  Once you have those together, it’s time to start the process!

  Step 1. Install Windows 7 in KVM (with VirtIO driver)

  Step 2.Install Cloudbase-Inti

  When the instance comes back up, open a browser in the guest and navigate tohttp://www.cloudbase.it/cloud-init-for-windows-instances/ and grab the latest cloud-init for Windows and run the installer:

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2Fsyncomm.files.wordpress.com%2F2014%2F05%2Fscreenshot-from-2014-05-13-235007.png%3Fw%3D450%26h%3D417&container=blogger&gadget=a&rewriteMime=image%2F*

  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:



  1

  2

  3

  4

  5

  6

  7

  8

  9

  10

  11

  12



  

  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:

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2Fsyncomm.files.wordpress.com%2F2014%2F05%2Fscreenshot-from-2014-05-14-003024.png%3Fw%3D450%26h%3D417&container=blogger&gadget=a&rewriteMime=image%2F*


  All the connections to this server will be controlled the security groups in OpenStack. Also, we should allow RDP access:

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2Fsyncomm.files.wordpress.com%2F2014%2F05%2Fscreenshot-from-2014-05-14-003200.png%3Fw%3D450%26h%3D417&container=blogger&gadget=a&rewriteMime=image%2F*


  Now we can shutdown, by manually running sysprep again:

  C:\Windows\System32\sysprep\sysprep.exe /generalize /oobe /shutdown

  Step 3. Upload Image to OpenStack


  Now for the easy part! Let’s convert the image to a qcow2, and push it into glance:

  # qemu-img convert -c -f raw -O qcow2 /var/lib/libvirt/images/win7.img ./win7.qcow2
  # glance image-create --name="Windows 7 (x86_64)" --is-public=True --container-format=bare --disk-format=qcow2 --file=./win7.qcow2

  When the upload completes, log into Horizon and verify the image is available:

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2Fsyncomm.files.wordpress.com%2F2014%2F05%2Fscreenshot-from-2014-05-14-010608.png%3Fw%3D450%26h%3D303&container=blogger&gadget=a&rewriteMime=image%2F*

  Then try creating a new instance — and don’t forget to set the Admin password:

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2Fsyncomm.files.wordpress.com%2F2014%2F05%2Fscreenshot-from-2014-05-14-010838.png%3Fw%3D450%26h%3D303&container=blogger&gadget=a&rewriteMime=image%2F*

  It will take a bit to spin up due to the size (around 4 GB). When the task completes, head over to the instances console and verify you have Windows 7 running :

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2Fsyncomm.files.wordpress.com%2F2014%2F05%2Fscreenshot-from-2014-05-14-013328.png%3Fw%3D450%26h%3D281&container=blogger&gadget=a&rewriteMime=image%2F*

  Now you can provision a static ip and edit your OpenStack security group to add port 3389 (RDP). Now sit back, and test connecting to your instance from something fun like an iPad :)

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2Fsyncomm.files.wordpress.com%2F2014%2F05%2F2014-05-14-18-16-08.jpg%3Fw%3D450%26h%3D318&container=blogger&gadget=a&rewriteMime=image%2F*
页: [1]
查看完整版本: Running Windows 7 guest on OpenStack Icehouse