0

Websitepanel vhdx support (English)

In the moment of writting this post Websitepanel do not have vhdx support

After source code analyzing i found, what they hardcode vhd definition in enterprise server part.

What we need:

Websitepanel v 2.0 (i do for this version, but maybe in 2.1 code not different)
It’s desirable to get source code of your WSP build.
Instruments needed: just Visual Studio 2012

Open «WebsitePanel.Server.sln»

Go to WebsitePanel.Providers.Base->Virtualization->LibraryItem.cs

After line

public string Path { get; set; }

Add

public bool Vhdx { get; set; }

Going to WebsitePanel.Providers.Virtualization.HyperV->HyperV.cs
After lines

// optional attributes

if (nodeItem.Attributes["diskSize"] != null)
item.DiskSize = Int32.Parse(nodeItem.Attributes["diskSize"].Value);

add

if (nodeItem.Attributes["Vhdx"] != null)
item.Vhdx = Boolean.Parse(nodeItem.Attributes["Vhdx"].Value);

Now open the project «WebsitePanel.EnterpriseServer.sln»

Go to Code->Virtualization->VirtualizationServerController.cs

replace lines

vm.OperatingSystemTemplatePath = Path.Combine(templatesPath, osTemplateFile + ".vhd");
vm.VirtualHardDrivePath = Path.Combine(vm.RootFolderPath, hostname + ".vhd");

to

if (osTemplate.Vhdx)
{
vm.OperatingSystemTemplatePath = Path.Combine(templatesPath, osTemplateFile + ".vhdx");
vm.VirtualHardDrivePath = Path.Combine(vm.RootFolderPath, hostname + ".vhdx");
}
else
{
vm.OperatingSystemTemplatePath = Path.Combine(templatesPath, osTemplateFile + ".vhd");
vm.VirtualHardDrivePath = Path.Combine(vm.RootFolderPath, hostname + ".vhd");
}

before compiling our projects and copying *.dll files from bin folders in production(dont forget create backup of original files)

Now, for add vhdx template in WSP add in index.xml in section «item» parameter 

Vhdx="true"

, in example

<item path="win2008"
diskSize="20"
Vhdx="true"
legacyNetworkAdapter="false"
remoteDesktop="true"
processVolume="1">

I’m not programmer by specification, post your comments or improvements here.

XpycT

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *