Hyper-V Management
This document explains the hyper-v management features of ConVirt as well as setup instructions. Currently Windows Server 2012 and Windows Server 2012 R2 are supported.
Contents |
1.1 Hyper-V Features
The Hyper-V support includes
- Centralized web based management for Hyper-V platform without requiring SCVMM.
- ISO based template for rapid provisioning
- Intelligent placement : Pick lightly loaded Hyper-V host to provision virtual machine.
- Scheduling for VM Provisioning as well as auto-retierment for a virtual machine.
- Day to Day virtual machine operations (provision/start/stop/pause/delete,connect to console etc)
- Snapshot Management
- VM life-cycle history for each virtual machine. Answers questions like, who shutdown this virtual machine, when ?
- Historical metrics for hyper-v server as well as virtual machines presented in dashboard.
- Giving self-service Console to Hyper-V environment. (This is part of ConVirt Enterprise Cloud edition)
- Cluster configuration with CSV storage.
- Live Migration and non-shared migration.
Server Pool Dashboard | Server Dashboard | |
---|---|---|
|
|
1.2 Setup
This section explains overall topology, requirements for setting up ConVirt and hyper-v for management.
Deployment Architecture | |
---|---|
|
As you can see from the diagram, ConVirt manages hyper-v servers via a proxy machine. This can be any of Windows Server machine preferably same as the hyper-v version being managed. This server does not require hyper-v enabled. ConVirt talks to the proxy via http/https and the proxy in-turn talks to hyper-v machines using powershell.
Note: You can use one of the Hyper-V Servers (Managed Servers) as Hyper-V proxy server.
1.2.1 Preparing Hyper-V servers / Managed Servers
Install Hyper-V Role on to the server. Enable remote poweshell access. This is done by starting a powershell as Administrator and executing the following command.
Enable-PSRemoting -force Enable-WSMANCredSSP -Role Server -Force For non-domain setup, for each Hyper-V server, you need to establish trust for the proxy server. See next section for details.
1.2.2 Hyper-V Proxy Machine setup
The proxy can be setup on one of the Hyper-V host or a separate Windows machine/virtual machine. You will need to make sure that this machine has access to hyper-v hosts via PowerShell.
1.2.2.1 Installing Hyper-V Client tools
If you are using a Hyper-V serve as a proxy machine, you can skip this section. Typically the following steps can be used to install the client machine.
- Open Server Manager. (If Server Manager is not running, click Start, point to Administrative Tools, click Server Manager, and then, if prompted for permission to continue, click Continue.)
- In Server Manager, under Features Summary, click Add Features.
- On the Select Features page, expand Remote Server Administration Tools, and then expand Remote Administration Tools.
- Click Hyper-V Tools, and then proceed through the rest of the wizard.
If you are running non-server platform, visit [RSAT Hyper-V Client Installation] page.
- Enable CredSSP Client role.
Enable-WSMANCredSSP -Role Client -DelegateComputer <comma separated list of hyper-v computers> -Force
- Additional Credential delegation
- Run c:\Windows\System32\gpedit.exe
- Traverse to Local Computer Policy--> Computer Configuration->Administrative Templates -> System -> Credentials Delegation
- Make sure that the following are enabled.
- Allow delegating fresh credentials
- Allow delegating fresh credentials with NTLM-Only Server Authetication
- For EACH of the options above, #::: click to show details
- In "Options" section, Click the show button next to "Add servers to list".
- Add separate item for EACH hypervisor server with wsman/ prefix. For example: wsman/hv-01
1.2.2.2 Setting up PoSH Server
ConVirt uses PoSH server, an http server written in PowerShell.
- Download and install PoSH server from http://www.poshserver.net/ using an Administrator account. Follow the instructions given here to start the PoshServer with the -HomeDirectory parameter.
- Create a directory c:\hyperv-scripts to be accessed by Administrator only.
- Copy the content of src/convirt/core/platforms/hyperv-scripts/* from ConVirt tarball from CMS server host in to that directory.
- Set Permissions: The following allows ConVirt scripts to be executed. Need to be executed once.
Set-ExecutionPolicy Unrestricted gci c:\hyperv-scripts | unblock-file
- For setup where the Hyper-V servers and the Hyper-V Proxy machines are not in domain, you need to establish trust.
Execute the following on the Hyper-V proxy server.
winrm set winrm/config/client @{TrustedHosts="Hyper-V-Host1,Hyper-V-Host2,Hyper-V-Host3"}
- Start the PoSHServer
Start-PoSHServer -HomeDirectory "c:\hyperv-scripts"
By default the PoSHServer listens on port 8080. You can change this by changing the port information in the config.ps1 under C:\Program Files\PoSHServer\modules\PoSHServer\modules directory.
- Change the firewall to allow tcp connection on port 8080 (or custom port chosen by you above).
- Test the Hyper-V proxy setup :
Visit http://host:port/convirt_config.ps1.sample in the browser. You will see the content as follows. Note : The exact content is not important, but you should find some content and not 404 Error.
'# Copy this file to PoSHServer/modules directory ....... '
In case you get 404 error, make sure that you have started the PoshServer with correct -HomeDirectory location.
1.2.3 Configure ConVirt To Use The Proxy
Open the src/convirt/web/conivrt/development.ini and change the poshserver_url to point to Hyper-V proxy set up above.
e.g. poshserver_url = http://proxyserver:8080
Restart ConVirt
-
./convirt-ctl stop
-
./convirt-ctl start
-
1.3 Quick Start
This section gives you a quick start on discovering and creating a Hyper-V virtual machine via ConVirt.
1.3.1 Add Server
To Add a Server, you need to create a typed Server Pool. Here are the steps
- Click Data Server -> Right Click -> Add Server Pool
- Pick HyperV from the drop down and Give it a name (say HVPool-01), if this is a cluster setup, then name of the pool should be same as name of the cluster, and check the checkbox to indicate that it is a cluster setup.
This will show a up a new server pool on the left navigation pane.
Now to add/discover a server in ConVirt,
- Select the server pool created above.
- Right Click to get context menu and select Add Server.
- Select HyperV from the drop down. This will bring up a Add Server dialog.
- Enter the name of the Hyper-V host, Username and Password.
- The user can be Administrator or a user in HyperV Administrator group on that server.
- The user can be a local user or domain user. To enter domain user use the domain\user syntax. e.g. WIN\hv-admin
- Press ok.
You will see you server appearing in left navigation, and shortly all virtual machines on that server. Select the server and virtual machines and you will see all the rich information collected by ConVirt.
1.3.2 Customize Out of the box template
To simplify matters, ConVirt ships with an out-of-box template. This template is geared towards doing an ISO install and can be easily customize to your organizational needs.
First, lets create a template for our use.
- Select Template Library
- Select HyperV Templates group
- Select HyperV Template, Right Click and select "Create Like" menu.
- Enter a new name of the template. e.g. u1204
- On the main page, change the memory and vcpu to required values.
- At bottom select the Linux and Ubuntu from the drop downs for Category, Guest OS drop down and give a version number as 12.04
- Now get to Network tab, and select the Default Network. Select Edit. Enter the name of the switch you want to connect the virtual machine to. e.g. hv-switch0
- In the Template parameters tab. Adjust the following values.
ISO_STORE : c:\point\to\your\iso\directory ISO_NAME : name_of_the_iso_file.iso
Press ok. We just created a template that is suitable for provisioning multiple virtual machines in your environment.
1.3.3 Provision Virtual Machine
To provision a new virtual machine, either you can select a server pool, server or a template as a starting point. Here we will start with the template.
- Navigate to Template Library -> HyperV Templates -> u1204 (one created in step above)
- Right click and select Provision, you will be presented with a list of all server pools and server.
- Now you have two options
- Select a Hyper-V server pool, and let ConVirt pick a server for provisioning using Initial Placement feature.
- Select a Hper-V server where you want to create the virtual machine.
- Once selected, you will get a dialog that is similar to the template, but few values filled it. Enter the name of the Virtual machine.
- Navigate to storage area to validate the disk location and iso location etc.
- Press OK.
You will see a task submitted in the bottom task pane and shortly a new virtual machine in the left navigation.
1.3.4 Start and Connect to Virtual Machine
To start a virtual machine, simply select and pick Start from the context menu.
- Select the virtual machine
- Right Click -> Select Start
You will see a new task submitted a the bottom and shortly the virtual machine will change state to green.
To connect to the virtual machine Console ConVirt uses applet to invoke vmconnect utility, for this to work the following prerequisites should be met.
Prerequisites :
- java installed on your client machine.
- vmconnect utility (part of hyper-v or RSAT tools for hyper-v management) is present and is in PATH (other than windows/system32 see below)
- cmd /c
- dir /s vmconnect.exe
- Pick c path that has WinSxS and add it to PATH variable. (Select Computer from File Explorer, select properties and select "Advanced System Settings" link.
- This will bring up a new dialog, select Environments button and in the system variables, select PATH variable. Press the Edit.. button.
- Append the path for vmconnect.exe (the one containing WinSxS ) at the end. To do so, scroll to end, add a semi-colon (;) and the path. Press ok/apply to save the changes.
- To test, open a command windows or say cmd /c from powershell
- echo %PATH% and make sure that the path you appended shows up.
- Restart the browser(s)
To connect,
- Select the virtual machine
- Right Click -> View Console
- You will be prompted to accept self-signed certificate for the applet. Select yes to the security warning.
A vmconnect window will appear showing the Console.
Caveats :
If you still dont see vmconnect window,
* For connecting to Virtual machines in collapse environment, you need to start the browser as administrator. This is required in collapse environment. * You must be logged in as a member of HyperV-Administrator or Administrator user.
1.4 Snapshot Management
ConVirt allows you to take snapshots of hyper-v virtual machines. You can use the Snapshot management menuitem for a virtual machine to bring up existing snapshots and revert a virtual machine to a particular snapshot.
The Snapshot and Revert to recent snapshot allows you to quickly snapshot a virtual machine to revert it to its most-recent snapshot.
1.5 Virtual Machine Migration
ConVirt allows you migrate virtual machines from one hyper-v node to another. Simply drag and drop the virtual machines to perform Live Migration with shared storage. For migrating with storage, add 'migrate_with_storage' property with value 1 in Virtual machines Miscellaneous tab, then simply perform the migration using drag and drop. You can do this setup in a template that uses non-shared (local) storage.
1.6 Self Service Console
With the cloud version of the product, you can take your hyper-v virtualization environment in ConVirt and turn it into a self serving environment. To do this, refer to our Virtualized to Cloud conversion in ConVirt Enterprise Cloud Edition documentation.
Here is a good place to start : Virtualized to Cloud Conversion
1.7 Advanced Hyper-V Proxy Setup
ConVirt sends credentials to Hyper-V proxy node to get work done. It is recommended to use SSL and basic auth setup for production.
1.7.1 Configure Basic Auth
On Hyper-V Proxy host, navigate to config.ps1 under C:\Program Files\PoSHServer\modules\PoSHServer\modules directory and set
# Basic Authentication # Options: On, Off $BasicAuthentication = "On"
Copy c:\hyperv-scritps\convirt_config.ps1.sample to C:\Program Files\PoSHServer\modules\PoSHServer\modules directory as convirt_config.ps1.
On the ConVirt side, set posh_auth_user and posh_auth_pass variables in src/convirt/web/convirt/development.ini and restart ConVirt.
1.7.2 SSL Setup
To use self signed certificate, simply start the server with following command line and make sure 8443 is opened in firewall on Hyper-V proxy server.
Start-PoSHServer -HomeDirectory "c:\hyperv-scripts" -SSL -SSLIP "192.168.12.228" -SSLPort 8443
1.7.3 Hyper-V proxy as Service
To start the proxy as a service. start with -AsJob at the end.
Start-PoSHServer -HomeDirectory "c:\hyperv-scripts" -SSL -SSLIP "192.168.12.228" -SSLPort 8443 -AsJob
NOTE : Refer to PoSHServer documentation for more details about these topics.
Comments