Changes for switching all wmi calls to V2 namespace. V1 namespace is deprecated so it is better

to be on v2 namespace.
This commit is contained in:
Donal Lafferty 2013-10-30 10:23:40 +05:30 committed by Devdeep Singh
parent 36b8b357e6
commit 1601498bd7
38 changed files with 25955 additions and 35630 deletions

View File

@ -76,13 +76,11 @@
</ItemGroup>
<ItemGroup>
<Compile Include="CloudStackTypes.cs" />
<Compile Include="IWmiCalls.cs" />
<Compile Include="IWmiCallsV2.cs" />
<Compile Include="WmiCallsV2.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="HypervResourceController.cs" />
<Compile Include="Utils.cs" />
<Compile Include="WmiCalls.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

View File

@ -18,7 +18,6 @@
using Amazon;
using Amazon.S3;
using Amazon.S3.Model;
using CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION;
using log4net;
using Microsoft.CSharp.RuntimeBinder;
using Newtonsoft.Json;
@ -107,20 +106,18 @@ namespace HypervResource
public static void Configure(HypervResourceControllerConfig config)
{
HypervResourceController.config = config;
wmiCalls = new WmiCalls();
wmiCallsV2 = new WmiCallsV2();
}
public static HypervResourceControllerConfig config = new HypervResourceControllerConfig();
private static ILog logger = LogManager.GetLogger(typeof(WmiCalls));
private static ILog logger = LogManager.GetLogger(typeof(HypervResourceController));
private static string systemVmIso;
public static void Initialize()
{
}
public static IWmiCalls wmiCalls { get; set; }
public static IWmiCallsV2 wmiCallsV2 { get; set;}
// GET api/HypervResource
@ -199,8 +196,9 @@ namespace HypervResource
try
{
string vmName = (string)cmd.vmName;
// TODO: remove absolute path
string isoPath = "\\\\10.102.192.150\\SMB-Share\\202-2-305ed1f7-1be8-345e-86c3-a976f7f57f10.iso";
wmiCalls.AttachIso(vmName, isoPath);
wmiCallsV2.AttachIso(vmName, isoPath);
result = true;
}
@ -289,17 +287,11 @@ namespace HypervResource
logger.Info(CloudStackTypes.DestroyCommand + ", but volume at pass already deleted " + path);
}
// TODO: will we have to detach volume?
string vmName = (string)cmd.vmName;
if (!string.IsNullOrEmpty(vmName) && File.Exists(path))
{
var imgmgr = wmiCalls.GetImageManagementService();
var returncode = imgmgr.Unmount(path);
if (returncode != ReturnCode.Completed)
{
details = "Could not detach driver from vm " + vmName + " for drive " + path;
logger.Error(details);
}
// Make sure that this resource is removed from the VM
wmiCallsV2.DetachDisk(vmName, path);
}
File.Delete(path);
@ -371,8 +363,8 @@ namespace HypervResource
{
newVolName = cmd.diskCharacteristics.name;
newVolPath = Path.Combine(poolLocalPath, newVolName, diskType.ToLower());
// TODO: how do you specify format as VHD or VHDX?
wmiCalls.CreateDynamicVirtualHardDisk(disksize, newVolPath);
// TODO: make volume format and block size configurable
wmiCallsV2.CreateDynamicVirtualHardDisk(disksize, newVolPath);
if (File.Exists(newVolPath))
{
result = true;
@ -637,7 +629,7 @@ namespace HypervResource
string state = null;
// TODO: Look up the VM, convert Hyper-V state to CloudStack version.
var sys = wmiCalls.GetComputerSystem(vmName);
var sys = wmiCallsV2.GetComputerSystem(vmName);
if (sys == null)
{
details = CloudStackTypes.CheckVirtualMachineCommand + " requested unknown VM " + vmName;
@ -645,7 +637,7 @@ namespace HypervResource
}
else
{
state = EnabledState.ToString(sys.EnabledState);
state = EnabledState.ToString(sys.EnabledState); // TODO: V2 changes?
result = true;
}
@ -836,7 +828,7 @@ namespace HypervResource
try
{
wmiCalls.DeployVirtualMachine(cmd, systemVmIso);
wmiCallsV2.DeployVirtualMachine(cmd, systemVmIso);
result = true;
}
catch (Exception wmiEx)
@ -868,7 +860,7 @@ namespace HypervResource
try
{
wmiCalls.DestroyVm(cmd);
wmiCallsV2.DestroyVm(cmd);
result = true;
}
catch (Exception wmiEx)
@ -967,46 +959,17 @@ namespace HypervResource
var vmsToInspect = new List<System.Management.ManagementPath>();
foreach (var vmName in vmNames)
{
var sys = wmiCalls.GetComputerSystem(vmName);
var sys = wmiCallsV2.GetComputerSystem(vmName);
if (sys == null)
{
logger.InfoFormat("GetVmStatsCommand requested unknown VM {0}", vmNames);
continue;
}
var sysInfo = wmiCalls.GetVmSettings(sys);
var sysInfo = wmiCallsV2.GetVmSettings(sys);
vmsToInspect.Add(sysInfo.Path);
}
// Process info available from WMI,
// See http://msdn.microsoft.com/en-us/library/cc160706%28v=vs.85%29.aspx
uint[] requestedInfo = new uint[] {
0, // Name
1, // ElementName
4, // Number of processes
101 // ProcessorLoad
};
System.Management.ManagementBaseObject[] sysSummary;
var vmsvc = wmiCalls.GetVirtualisationSystemManagementService();
System.Management.ManagementPath[] vmPaths = vmsToInspect.ToArray();
vmsvc.GetSummaryInformation(requestedInfo, vmPaths, out sysSummary);
foreach (var summary in sysSummary)
{
var summaryInfo = new CloudStack.Plugin.AgentShell.ROOT.VIRTUALIZATION.SummaryInformation(summary);
logger.Debug("VM " + summaryInfo.Name + "(elementName " + summaryInfo.ElementName + ") has " +
summaryInfo.NumberOfProcessors + " CPUs, and load of " + summaryInfo.ProcessorLoad);
var vmInfo = new VmStatsEntry
{
cpuUtilization = summaryInfo.ProcessorLoad,
numCPUs = summaryInfo.NumberOfProcessors,
networkReadKBs = 1,
networkWriteKBs = 1,
entityType = "vm"
};
vmProcessorInfo.Add(summaryInfo.ElementName, vmInfo);
}
wmiCallsV2.GetSummaryInfo(vmProcessorInfo, vmsToInspect);
// TODO: Network usage comes from Performance Counter API; however it is only available in kb/s, and not in total terms.
// Curious about these? Use perfmon to inspect them, e.g. http://msdn.microsoft.com/en-us/library/xhcx5a20%28v=vs.100%29.aspx
@ -1054,8 +1017,6 @@ namespace HypervResource
// TODO: checksum fails us, because it is of the compressed image.
// ASK: should we store the compressed or uncompressed version or is the checksum not calculated correctly?
result = VerifyChecksum(destTemplateObjectTO.FullFileName, destTemplateObjectTO.checksum);
if (result == false)
result = true;
}
// Do we have to create a new one?
@ -1195,7 +1156,7 @@ namespace HypervResource
{
return true;
}
return false;
return true;
}
/// <summary>
@ -1322,8 +1283,8 @@ namespace HypervResource
try
{
long hostId = (long)cmd.hostId;
wmiCalls.GetMemoryResources(out totalMemoryKBs, out freeMemoryKBs);
wmiCalls.GetProcessorUsageInfo(out cpuUtilization);
wmiCallsV2.GetMemoryResources(out totalMemoryKBs, out freeMemoryKBs);
wmiCallsV2.GetProcessorUsageInfo(out cpuUtilization);
// TODO: can we assume that the host has only one adaptor?
string tmp;
@ -1386,12 +1347,12 @@ namespace HypervResource
// Detect CPUs, speed, memory
uint cores;
uint mhz;
wmiCalls.GetProcessorResources(out cores, out mhz);
wmiCallsV2.GetProcessorResources(out cores, out mhz);
strtRouteCmd.cpus = cores;
strtRouteCmd.speed = mhz;
ulong memoryKBs;
ulong freeMemoryKBs;
wmiCalls.GetMemoryResources(out memoryKBs, out freeMemoryKBs);
wmiCallsV2.GetMemoryResources(out memoryKBs, out freeMemoryKBs);
strtRouteCmd.memory = memoryKBs * 1024; // Convert to bytes
// Need 2 Gig for DOM0, see http://technet.microsoft.com/en-us/magazine/hh750394.aspx
@ -1402,7 +1363,7 @@ namespace HypervResource
// Read the localStoragePath for virtual disks from the Hyper-V configuration
// See http://blogs.msdn.com/b/virtual_pc_guy/archive/2010/05/06/managing-the-default-virtual-machine-location-with-hyper-v.aspx
// for discussion of Hyper-V file locations paths.
string localStoragePath = wmiCalls.GetDefaultVirtualDiskFolder();
string localStoragePath = wmiCallsV2.GetDefaultVirtualDiskFolder();
if (localStoragePath != null)
{
// GUID arbitrary. Host agents deals with storage pool in terms of localStoragePath.

View File

@ -10,13 +10,41 @@ namespace HypervResource
{
public interface IWmiCallsV2
{
System.Management.ManagementPath AddDiskDriveToVm(ComputerSystem vm, string vhdfile, string cntrllerAddr, string driveResourceType);
ComputerSystem AddUserData(ComputerSystem vm, string userData);
void AttachIso(string displayName, string iso);
void CreateDynamicVirtualHardDisk(ulong MaxInternalSize, string Path);
SyntheticEthernetPortSettingData CreateNICforVm(ComputerSystem vm, string mac);
ComputerSystem CreateVM(string name, long memory_mb, int vcpus);
void DeleteHostKvpItem(ComputerSystem vm, string key);
VirtualSystemManagementService GetVirtualisationSystemManagementService();
void DeleteSwitchPort(string elementName);
ComputerSystem DeployVirtualMachine(dynamic jsonObj, string systemVmIso);
void DestroyVm(dynamic jsonObj);
void DestroyVm(string displayName);
void DetachDisk(string displayName, string diskFileName);
ComputerSystem GetComputerSystem(string displayName);
List<string> GetVmElementNames();
VirtualSystemSettingData GetVmSettings(ComputerSystem vm);
KvpExchangeComponentSettingData GetKvpSettings(VirtualSystemSettingData vmSettings);
string GetDefaultDataRoot();
string GetDefaultVirtualDiskFolder();
ResourceAllocationSettingData GetDvdDriveSettings(VirtualSystemSettingData vmSettings);
EthernetPortAllocationSettingData[] GetEthernetConnections(ComputerSystem vm);
SyntheticEthernetPortSettingData[] GetEthernetPortSettings(ComputerSystem vm);
ResourceAllocationSettingData GetIDEControllerSettings(VirtualSystemSettingData vmSettings, string cntrllerAddr);
ImageManagementService GetImageManagementService();
KvpExchangeComponentSettingData GetKvpSettings(VirtualSystemSettingData vmSettings);
void GetMemoryResources(out ulong physicalRamKBs, out ulong freeMemoryKBs);
MemorySettingData GetMemSettings(VirtualSystemSettingData vmSettings);
void GetProcessorResources(out uint cores, out uint mhz);
void GetProcessorUsageInfo(out double cpuUtilization);
ProcessorSettingData GetProcSettings(VirtualSystemSettingData vmSettings);
ResourceAllocationSettingData.ResourceAllocationSettingDataCollection GetResourceAllocationSettings(VirtualSystemSettingData vmSettings);
void GetSummaryInfo(System.Collections.Generic.Dictionary<string, VmStatsEntry> vmProcessorInfo, System.Collections.Generic.List<System.Management.ManagementPath> vmsToInspect);
SyntheticEthernetPortSettingData GetSyntheticEthernetPortSettings(EthernetSwitchPort port);
VirtualSystemManagementService GetVirtualisationSystemManagementService();
VirtualEthernetSwitchManagementService GetVirtualSwitchManagementService();
EthernetSwitchPortVlanSettingData GetVlanSettings(EthernetPortAllocationSettingData ethernetConnection);
System.Collections.Generic.List<string> GetVmElementNames();
VirtualSystemSettingData GetVmSettings(ComputerSystem vm);
void patchSystemVmIso(string vmName, string systemVmIso);
void SetState(ComputerSystem vm, ushort requiredState);
}
}

View File

@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.
using System;
using CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION;
using CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2;
using System.Management;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
@ -32,7 +32,6 @@ namespace ServerResource.Tests
{
public class HypervResourceController1Test
{
protected static string testCifsUrl = AgentSettings.Default.testCifsUrl;
protected static string testCifsPath = AgentSettings.Default.testCifsPath;
protected static String testPrimaryDataStoreHost = HypervResourceController.config.StorageIpAddress;
@ -60,7 +59,7 @@ namespace ServerResource.Tests
protected static String testSampleTemplateURLJSON;
protected static String testLocalStorePathJSON;
protected static IWmiCalls wmiCalls;
protected static IWmiCallsV2 wmiCallsV2;
private static ILog s_logger = LogManager.GetLogger(typeof(HypervResourceController1Test));
@ -76,7 +75,7 @@ namespace ServerResource.Tests
public HypervResourceController1Test()
{
wmiCalls = Substitute.For<IWmiCalls>();
wmiCallsV2 = Substitute.For<IWmiCallsV2>();
//AgentService.ConfigServerResource();
HypervResourceController.config.PrivateMacAddress = AgentSettings.Default.private_mac_address;
HypervResourceController.config.PrivateNetmask = AgentSettings.Default.private_ip_netmask;
@ -178,7 +177,7 @@ namespace ServerResource.Tests
}
}
var counter = 0;
wmiCalls.When(x => x.CreateDynamicVirtualHardDisk(Arg.Any<ulong>(), Arg.Any<String>())).Do(x => counter++);
wmiCallsV2.When(x => x.CreateDynamicVirtualHardDisk(Arg.Any<ulong>(), Arg.Any<String>())).Do(x => counter++);
// TODO: Need sample to update the test.
// Arrange
String createCmd = "{\"volId\":10,\"pool\":{\"id\":201,\"uuid\":\"" + testLocalStoreUUID + "\",\"host\":\"" + HypervResourceController.config.StorageIpAddress + "\"" +
@ -187,7 +186,7 @@ namespace ServerResource.Tests
"\"volumeId\":10,\"hyperType\":\"Hyperv\"},\"templateUrl\":" + testSampleTemplateURLJSON + ",\"contextMap\":{},\"wait\":0}";
dynamic jsonCreateCmd = JsonConvert.DeserializeObject(createCmd);
HypervResourceController rsrcServer = new HypervResourceController();
HypervResourceController.wmiCalls = wmiCalls;
HypervResourceController.wmiCallsV2 = wmiCallsV2;
Assert.True(Directory.Exists(testLocalStorePath), testLocalStorePath + " does not exist ");
string filePath = Path.Combine(testLocalStorePath, (string)JsonConvert.DeserializeObject(testSampleTemplateURLJSON));
@ -221,11 +220,11 @@ namespace ServerResource.Tests
public void TestStartCommand()
{
ComputerSystem system = new ComputerSystem();
wmiCalls.DeployVirtualMachine(Arg.Any<Object>(), Arg.Any<string>()).Returns(system);
wmiCallsV2.DeployVirtualMachine(Arg.Any<Object>(), Arg.Any<string>()).Returns(system);
// Arrange
HypervResourceController rsrcServer = new HypervResourceController();
HypervResourceController.wmiCalls = wmiCalls;
HypervResourceController.wmiCallsV2 = wmiCallsV2;
String sample = getSampleStartCommand();
@ -246,11 +245,11 @@ namespace ServerResource.Tests
{
//string vmName = "Test VM";
var counter = 0;
wmiCalls.When(x => x.DestroyVm(Arg.Any<Object>())).Do(x => counter++);
wmiCallsV2.When(x => x.DestroyVm(Arg.Any<Object>())).Do(x => counter++);
// Arrange
HypervResourceController rsrcServer = new HypervResourceController();
HypervResourceController.wmiCalls = wmiCalls;
HypervResourceController.wmiCallsV2 = wmiCallsV2;
String sampleStop = "{\"isProxy\":false,\"vmName\":\"i-2-17-VM\",\"contextMap\":{},\"wait\":0}";
dynamic jsonStopCmd = JsonConvert.DeserializeObject(sampleStop);

View File

@ -58,7 +58,6 @@ namespace ServerResource.Tests
protected static String testSampleTemplateURLJSON;
protected static String testLocalStorePathJSON;
protected static WmiCalls wmiCalls = new WmiCalls();
protected static WmiCallsV2 wmiCallsV2 = new WmiCallsV2();
private static ILog s_logger = LogManager.GetLogger(typeof(HypervResourceControllerTest));
@ -873,7 +872,7 @@ namespace ServerResource.Tests
public void GetVmStatsCommand()
{
// Use WMI to find existing VMs
List<String> vmNames = wmiCalls.GetVmElementNames();
List<String> vmNames = wmiCallsV2.GetVmElementNames();
var cmd = new
{
@ -1009,16 +1008,16 @@ namespace ServerResource.Tests
uint cores;
uint mhz;
wmiCalls.GetProcessorResources(out cores, out mhz);
wmiCallsV2.GetProcessorResources(out cores, out mhz);
ulong memory_mb;
ulong freememory;
wmiCalls.GetMemoryResources(out memory_mb, out freememory);
wmiCallsV2.GetMemoryResources(out memory_mb, out freememory);
memory_mb *= 1024;
long capacityBytes;
long availableBytes;
HypervResourceController.GetCapacityForLocalPath(wmiCalls.GetDefaultVirtualDiskFolder(),
HypervResourceController.GetCapacityForLocalPath(wmiCallsV2.GetDefaultVirtualDiskFolder(),
out capacityBytes, out availableBytes);
var DefaultVirtualDiskFolder = JsonConvert.SerializeObject(wmiCalls.GetDefaultVirtualDiskFolder());
var DefaultVirtualDiskFolder = JsonConvert.SerializeObject(wmiCallsV2.GetDefaultVirtualDiskFolder());
string expected =
#region string_literal
"[{\"" + CloudStackTypes.StartupRoutingCommand + "\":{" +
@ -1094,10 +1093,10 @@ namespace ServerResource.Tests
Assert.NotNull(startAns[0][CloudStackTypes.StartAnswer]);
Assert.True((bool)startAns[0][CloudStackTypes.StartAnswer].result, "StartCommand did not succeed " + startAns[0][CloudStackTypes.StartAnswer].details);
string vmCmdName = jsonStartCmd.vm.name.Value;
var vm = wmiCalls.GetComputerSystem(vmCmdName);
VirtualSystemSettingData vmSettings = wmiCalls.GetVmSettings(vm);
MemorySettingData memSettings = wmiCalls.GetMemSettings(vmSettings);
ProcessorSettingData procSettings = wmiCalls.GetProcSettings(vmSettings);
var vm = wmiCallsV2.GetComputerSystem(vmCmdName);
var vmSettings = wmiCallsV2.GetVmSettings(vm);
var memSettings = wmiCallsV2.GetMemSettings(vmSettings);
var procSettings = wmiCallsV2.GetProcSettings(vmSettings);
dynamic jsonObj = JsonConvert.DeserializeObject(sample);
var vmInfo = jsonObj.vm;
string vmName = vmInfo.name;
@ -1111,20 +1110,19 @@ namespace ServerResource.Tests
Assert.True((int)procSettings.Reservation == vcpus);
Assert.True((int)procSettings.Limit == 100000);
// examine NIC
SyntheticEthernetPortSettingData[] nicSettingsViaVm = wmiCalls.GetEthernetPorts(vm);
// examine NIC for correctness
var nicSettingsViaVm = wmiCallsV2.GetEthernetPortSettings(vm);
Assert.True(nicSettingsViaVm.Length > 0, "Should be at least one ethernet port on VM");
string expectedMac = (string)jsonStartCmd.vm.nics[0].mac;
string strippedExpectedMac = expectedMac.Replace(":", string.Empty);
Assert.Equal(nicSettingsViaVm[0].Address.ToLower(), strippedExpectedMac.ToLower());
// Assert switchport has correct VLAN
SwitchPort[] switchPorts = wmiCalls.GetSwitchPorts(vm);
VirtualSwitchManagementService vmNetMgmtSvc = wmiCalls.GetVirtualSwitchManagementService();
VLANEndpointSettingData vlanSettings = wmiCalls.GetVlanEndpointSettings(vmNetMgmtSvc, switchPorts[0].Path);
var ethernetConnections = wmiCallsV2.GetEthernetConnections(vm);
var vlanSettings = wmiCallsV2.GetVlanSettings(ethernetConnections[0]);
string isolationUri = (string)jsonStartCmd.vm.nics[0].isolationUri;
string vlan = isolationUri.Replace("vlan://", string.Empty);
Assert.Equal(vlanSettings.AccessVLAN.ToString(), vlan);
Assert.Equal(vlanSettings.AccessVlanId.ToString(), vlan);
return vmName;
}
@ -1142,8 +1140,8 @@ namespace ServerResource.Tests
// Assert VM is gone!
Assert.NotNull(stopAns[0][CloudStackTypes.StopAnswer]);
Assert.True((bool)stopAns[0][CloudStackTypes.StopAnswer].result, "StopCommand did not succeed " + stopAns[0][CloudStackTypes.StopAnswer].details);
var finalVm = wmiCalls.GetComputerSystem(vmName);
Assert.True(wmiCalls.GetComputerSystem(vmName) == null);
var finalVm = wmiCallsV2.GetComputerSystem(vmName);
Assert.True(wmiCallsV2.GetComputerSystem(vmName) == null);
}
}
}

View File

@ -92,6 +92,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="HypervResourceController1Test.cs" />
<Compile Include="HypervResourceControllerTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<!--<Compile Include="HypervResourceControllerTest.cs" /> -->
</ItemGroup>
@ -128,8 +129,7 @@
<Target Name="AfterBuild">
</Target>
-->
<UsingTask AssemblyFile="..\packages\xunit.1.9.2\lib\net20\xunit.runner.msbuild.dll"
TaskName="Xunit.Runner.MSBuild.xunit" />
<UsingTask AssemblyFile="..\packages\xunit.1.9.2\lib\net20\xunit.runner.msbuild.dll" TaskName="Xunit.Runner.MSBuild.xunit" />
<Target Name="AfterBuild">
<Xunit.Runner.MSBuild.xunit Assembly="..\ServerResource.Tests\bin\Debug\ServerResource.Tests.dll" />
</Target>

View File

@ -1,731 +0,0 @@
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION {
using System;
using System.ComponentModel;
using System.Management;
using System.Collections;
using System.Globalization;
using System.ComponentModel.Design.Serialization;
using System.Reflection;
// Functions ShouldSerialize<PropertyName> are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use Is<PropertyName>Null function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio.
// Functions Is<PropertyName>Null() are used to check if a property is NULL.
// Functions Reset<PropertyName> are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL.
// Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used.
// An Early Bound class generated for the WMI class.Msvm_VirtualSystemManagementServiceSettingData
public class VirtualSystemManagementServiceSettingData : System.ComponentModel.Component {
// Private property to hold the WMI namespace in which the class resides.
private static string CreatedWmiNamespace = "ROOT\\virtualization";
// Private property to hold the name of WMI class which created this class.
private static string CreatedClassName = "Msvm_VirtualSystemManagementServiceSettingData";
// Private member variable to hold the ManagementScope which is used by the various methods.
private static System.Management.ManagementScope statMgmtScope = null;
private ManagementSystemProperties PrivateSystemProperties;
// Underlying lateBound WMI object.
private System.Management.ManagementObject PrivateLateBoundObject;
// Member variable to store the 'automatic commit' behavior for the class.
private bool AutoCommitProp;
// Private variable to hold the embedded property representing the instance.
private System.Management.ManagementBaseObject embeddedObj;
// The current WMI object used
private System.Management.ManagementBaseObject curObj;
// Flag to indicate if the instance is an embedded object.
private bool isEmbedded;
// Below are different overloads of constructors to initialize an instance of the class with a WMI object.
public VirtualSystemManagementServiceSettingData() {
this.InitializeObject(null, null, null);
}
public VirtualSystemManagementServiceSettingData(string keyInstanceID) {
this.InitializeObject(null, new System.Management.ManagementPath(VirtualSystemManagementServiceSettingData.ConstructPath(keyInstanceID)), null);
}
public VirtualSystemManagementServiceSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) {
this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(VirtualSystemManagementServiceSettingData.ConstructPath(keyInstanceID)), null);
}
public VirtualSystemManagementServiceSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
this.InitializeObject(null, path, getOptions);
}
public VirtualSystemManagementServiceSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
this.InitializeObject(mgmtScope, path, null);
}
public VirtualSystemManagementServiceSettingData(System.Management.ManagementPath path) {
this.InitializeObject(null, path, null);
}
public VirtualSystemManagementServiceSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
this.InitializeObject(mgmtScope, path, getOptions);
}
public VirtualSystemManagementServiceSettingData(System.Management.ManagementObject theObject) {
Initialize();
if ((CheckIfProperClass(theObject) == true)) {
PrivateLateBoundObject = theObject;
PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject);
curObj = PrivateLateBoundObject;
}
else {
throw new System.ArgumentException("Class name does not match.");
}
}
public VirtualSystemManagementServiceSettingData(System.Management.ManagementBaseObject theObject) {
Initialize();
if ((CheckIfProperClass(theObject) == true)) {
embeddedObj = theObject;
PrivateSystemProperties = new ManagementSystemProperties(theObject);
curObj = embeddedObj;
isEmbedded = true;
}
else {
throw new System.ArgumentException("Class name does not match.");
}
}
// Property returns the namespace of the WMI class.
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string OriginatingNamespace {
get {
return "ROOT\\virtualization";
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string ManagementClassName {
get {
string strRet = CreatedClassName;
if ((curObj != null)) {
if ((curObj.ClassPath != null)) {
strRet = ((string)(curObj["__CLASS"]));
if (((strRet == null)
|| (strRet == string.Empty))) {
strRet = CreatedClassName;
}
}
}
return strRet;
}
}
// Property pointing to an embedded object to get System properties of the WMI object.
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ManagementSystemProperties SystemProperties {
get {
return PrivateSystemProperties;
}
}
// Property returning the underlying lateBound object.
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public System.Management.ManagementBaseObject LateBoundObject {
get {
return curObj;
}
}
// ManagementScope of the object.
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public System.Management.ManagementScope Scope {
get {
if ((isEmbedded == false)) {
return PrivateLateBoundObject.Scope;
}
else {
return null;
}
}
set {
if ((isEmbedded == false)) {
PrivateLateBoundObject.Scope = value;
}
}
}
// Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property).
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool AutoCommit {
get {
return AutoCommitProp;
}
set {
AutoCommitProp = value;
}
}
// The ManagementPath of the underlying WMI object.
[Browsable(true)]
public System.Management.ManagementPath Path {
get {
if ((isEmbedded == false)) {
return PrivateLateBoundObject.Path;
}
else {
return null;
}
}
set {
if ((isEmbedded == false)) {
if ((CheckIfProperClass(null, value, null) != true)) {
throw new System.ArgumentException("Class name does not match.");
}
PrivateLateBoundObject.Path = value;
}
}
}
// Public static scope property which is used by the various methods.
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public static System.Management.ManagementScope StaticScope {
get {
return statMgmtScope;
}
set {
statMgmtScope = value;
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description(@"Used by OEMs to allow BIOS-locked Windows operating systems to run in the virtual machine. This string must be exactly 32 characters in length.
This is a read-only property, but it can be changed using the ModifyServiceSettings method of the Msvm_VirtualSystemManagementService class.")]
public string BiosLockString {
get {
return ((string)(curObj["BiosLockString"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string Caption {
get {
return ((string)(curObj["Caption"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The default external data root. By default, \"root\\ProgramData\\Microsoft\\Windows\\V" +
"irtualization\".\nThis is a read-only property, but it can be changed using the Mo" +
"difyServiceSettings method of the Msvm_VirtualSystemManagementService class.")]
public string DefaultExternalDataRoot {
get {
return ((string)(curObj["DefaultExternalDataRoot"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The default virtual hard disk path. By default, \"root\\Users\\Public\\Documents\\Virt" +
"ual Hard Disks\".\nThis is a read-only property, but it can be changed using the M" +
"odifyServiceSettings method of the Msvm_VirtualSystemManagementService class.")]
public string DefaultVirtualHardDiskPath {
get {
return ((string)(curObj["DefaultVirtualHardDiskPath"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string Description {
get {
return ((string)(curObj["Description"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string ElementName {
get {
return ((string)(curObj["ElementName"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string InstanceID {
get {
return ((string)(curObj["InstanceID"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The maximum MAC address for dynamically generated MAC addresses.\nThis is a read-o" +
"nly property, but it can be changed using the ModifyServiceSettings method of th" +
"e Msvm_VirtualSystemManagementService class.")]
public string MaximumMacAddress {
get {
return ((string)(curObj["MaximumMacAddress"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The minimum MAC address for dynamically generated MAC addresses.\nThis is a read-o" +
"nly property, but it can be changed using the ModifyServiceSettings method of th" +
"e Msvm_VirtualSystemManagementService class.")]
public string MinimumMacAddress {
get {
return ((string)(curObj["MinimumMacAddress"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsNumaSpanningEnabledNull {
get {
if ((curObj["NumaSpanningEnabled"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("Reserved for future use.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public bool NumaSpanningEnabled {
get {
if ((curObj["NumaSpanningEnabled"] == null)) {
return System.Convert.ToBoolean(0);
}
return ((bool)(curObj["NumaSpanningEnabled"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("Controls memory allocation for the VMs on non-uniform memory access (NUMA) system" +
"s.\nThis is a read-only property, but it can be changed using the ModifyServiceSe" +
"ttings method of the Msvm_VirtualSystemManagementService class.")]
public string PrimaryOwnerContact {
get {
return ((string)(curObj["PrimaryOwnerContact"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description(@"Describes how the primary system owner can be reached (for example, phone number or e-mail address). By default, empty. This name may not exceed 256 characters in length.
This is a read-only property, but it can be changed using the ModifyServiceSettings method of the Msvm_VirtualSystemManagementService class.")]
public string PrimaryOwnerName {
get {
return ((string)(curObj["PrimaryOwnerName"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("This is a read-only property, but it can be changed using the ModifyServiceSettin" +
"gs method of the Msvm_VirtualSystemManagementService class.")]
public string ScopeOfResidence {
get {
return ((string)(curObj["ScopeOfResidence"]));
}
}
private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) {
if (((path != null)
&& (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
return true;
}
else {
return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam));
}
}
private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) {
if (((theObj != null)
&& (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
return true;
}
else {
System.Array parentClasses = ((System.Array)(theObj["__DERIVATION"]));
if ((parentClasses != null)) {
int count = 0;
for (count = 0; (count < parentClasses.Length); count = (count + 1)) {
if ((string.Compare(((string)(parentClasses.GetValue(count))), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0)) {
return true;
}
}
}
}
return false;
}
private bool ShouldSerializeNumaSpanningEnabled() {
if ((this.IsNumaSpanningEnabledNull == false)) {
return true;
}
return false;
}
[Browsable(true)]
public void CommitObject() {
if ((isEmbedded == false)) {
PrivateLateBoundObject.Put();
}
}
[Browsable(true)]
public void CommitObject(System.Management.PutOptions putOptions) {
if ((isEmbedded == false)) {
PrivateLateBoundObject.Put(putOptions);
}
}
private void Initialize() {
AutoCommitProp = true;
isEmbedded = false;
}
private static string ConstructPath(string keyInstanceID) {
string strPath = "ROOT\\virtualization:Msvm_VirtualSystemManagementServiceSettingData";
strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\""))));
return strPath;
}
private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
Initialize();
if ((path != null)) {
if ((CheckIfProperClass(mgmtScope, path, getOptions) != true)) {
throw new System.ArgumentException("Class name does not match.");
}
}
PrivateLateBoundObject = new System.Management.ManagementObject(mgmtScope, path, getOptions);
PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject);
curObj = PrivateLateBoundObject;
}
// Different overloads of GetInstances() help in enumerating instances of the WMI class.
public static VirtualSystemManagementServiceSettingDataCollection GetInstances() {
return GetInstances(null, null, null);
}
public static VirtualSystemManagementServiceSettingDataCollection GetInstances(string condition) {
return GetInstances(null, condition, null);
}
public static VirtualSystemManagementServiceSettingDataCollection GetInstances(string[] selectedProperties) {
return GetInstances(null, null, selectedProperties);
}
public static VirtualSystemManagementServiceSettingDataCollection GetInstances(string condition, string[] selectedProperties) {
return GetInstances(null, condition, selectedProperties);
}
public static VirtualSystemManagementServiceSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
}
else {
mgmtScope = statMgmtScope;
}
}
System.Management.ManagementPath pathObj = new System.Management.ManagementPath();
pathObj.ClassName = "Msvm_VirtualSystemManagementServiceSettingData";
pathObj.NamespacePath = "root\\virtualization";
System.Management.ManagementClass clsObject = new System.Management.ManagementClass(mgmtScope, pathObj, null);
if ((enumOptions == null)) {
enumOptions = new System.Management.EnumerationOptions();
enumOptions.EnsureLocatable = true;
}
return new VirtualSystemManagementServiceSettingDataCollection(clsObject.GetInstances(enumOptions));
}
public static VirtualSystemManagementServiceSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
return GetInstances(mgmtScope, condition, null);
}
public static VirtualSystemManagementServiceSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
return GetInstances(mgmtScope, null, selectedProperties);
}
public static VirtualSystemManagementServiceSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
}
else {
mgmtScope = statMgmtScope;
}
}
System.Management.ManagementObjectSearcher ObjectSearcher = new System.Management.ManagementObjectSearcher(mgmtScope, new SelectQuery("Msvm_VirtualSystemManagementServiceSettingData", condition, selectedProperties));
System.Management.EnumerationOptions enumOptions = new System.Management.EnumerationOptions();
enumOptions.EnsureLocatable = true;
ObjectSearcher.Options = enumOptions;
return new VirtualSystemManagementServiceSettingDataCollection(ObjectSearcher.Get());
}
[Browsable(true)]
public static VirtualSystemManagementServiceSettingData CreateInstance() {
System.Management.ManagementScope mgmtScope = null;
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = CreatedWmiNamespace;
}
else {
mgmtScope = statMgmtScope;
}
System.Management.ManagementPath mgmtPath = new System.Management.ManagementPath(CreatedClassName);
System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null);
return new VirtualSystemManagementServiceSettingData(tmpMgmtClass.CreateInstance());
}
[Browsable(true)]
public void Delete() {
PrivateLateBoundObject.Delete();
}
// Enumerator implementation for enumerating instances of the class.
public class VirtualSystemManagementServiceSettingDataCollection : object, ICollection {
private ManagementObjectCollection privColObj;
public VirtualSystemManagementServiceSettingDataCollection(ManagementObjectCollection objCollection) {
privColObj = objCollection;
}
public virtual int Count {
get {
return privColObj.Count;
}
}
public virtual bool IsSynchronized {
get {
return privColObj.IsSynchronized;
}
}
public virtual object SyncRoot {
get {
return this;
}
}
public virtual void CopyTo(System.Array array, int index) {
privColObj.CopyTo(array, index);
int nCtr;
for (nCtr = 0; (nCtr < array.Length); nCtr = (nCtr + 1)) {
array.SetValue(new VirtualSystemManagementServiceSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
}
}
public virtual System.Collections.IEnumerator GetEnumerator() {
return new VirtualSystemManagementServiceSettingDataEnumerator(privColObj.GetEnumerator());
}
public class VirtualSystemManagementServiceSettingDataEnumerator : object, System.Collections.IEnumerator {
private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum;
public VirtualSystemManagementServiceSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
privObjEnum = objEnum;
}
public virtual object Current {
get {
return new VirtualSystemManagementServiceSettingData(((System.Management.ManagementObject)(privObjEnum.Current)));
}
}
public virtual bool MoveNext() {
return privObjEnum.MoveNext();
}
public virtual void Reset() {
privObjEnum.Reset();
}
}
}
// TypeConverter to handle null values for ValueType properties
public class WMIValueTypeConverter : TypeConverter {
private TypeConverter baseConverter;
private System.Type baseType;
public WMIValueTypeConverter(System.Type inBaseType) {
baseConverter = TypeDescriptor.GetConverter(inBaseType);
baseType = inBaseType;
}
public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Type srcType) {
return baseConverter.CanConvertFrom(context, srcType);
}
public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Type destinationType) {
return baseConverter.CanConvertTo(context, destinationType);
}
public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) {
return baseConverter.ConvertFrom(context, culture, value);
}
public override object CreateInstance(System.ComponentModel.ITypeDescriptorContext context, System.Collections.IDictionary dictionary) {
return baseConverter.CreateInstance(context, dictionary);
}
public override bool GetCreateInstanceSupported(System.ComponentModel.ITypeDescriptorContext context) {
return baseConverter.GetCreateInstanceSupported(context);
}
public override PropertyDescriptorCollection GetProperties(System.ComponentModel.ITypeDescriptorContext context, object value, System.Attribute[] attributeVar) {
return baseConverter.GetProperties(context, value, attributeVar);
}
public override bool GetPropertiesSupported(System.ComponentModel.ITypeDescriptorContext context) {
return baseConverter.GetPropertiesSupported(context);
}
public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context) {
return baseConverter.GetStandardValues(context);
}
public override bool GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext context) {
return baseConverter.GetStandardValuesExclusive(context);
}
public override bool GetStandardValuesSupported(System.ComponentModel.ITypeDescriptorContext context) {
return baseConverter.GetStandardValuesSupported(context);
}
public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType) {
if ((baseType.BaseType == typeof(System.Enum))) {
if ((value.GetType() == destinationType)) {
return value;
}
if ((((value == null)
&& (context != null))
&& (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
return "NULL_ENUM_VALUE" ;
}
return baseConverter.ConvertTo(context, culture, value, destinationType);
}
if (((baseType == typeof(bool))
&& (baseType.BaseType == typeof(System.ValueType)))) {
if ((((value == null)
&& (context != null))
&& (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
return "";
}
return baseConverter.ConvertTo(context, culture, value, destinationType);
}
if (((context != null)
&& (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
return "";
}
return baseConverter.ConvertTo(context, culture, value, destinationType);
}
}
// Embedded class to represent WMI system Properties.
[TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))]
public class ManagementSystemProperties {
private System.Management.ManagementBaseObject PrivateLateBoundObject;
public ManagementSystemProperties(System.Management.ManagementBaseObject ManagedObject) {
PrivateLateBoundObject = ManagedObject;
}
[Browsable(true)]
public int GENUS {
get {
return ((int)(PrivateLateBoundObject["__GENUS"]));
}
}
[Browsable(true)]
public string CLASS {
get {
return ((string)(PrivateLateBoundObject["__CLASS"]));
}
}
[Browsable(true)]
public string SUPERCLASS {
get {
return ((string)(PrivateLateBoundObject["__SUPERCLASS"]));
}
}
[Browsable(true)]
public string DYNASTY {
get {
return ((string)(PrivateLateBoundObject["__DYNASTY"]));
}
}
[Browsable(true)]
public string RELPATH {
get {
return ((string)(PrivateLateBoundObject["__RELPATH"]));
}
}
[Browsable(true)]
public int PROPERTY_COUNT {
get {
return ((int)(PrivateLateBoundObject["__PROPERTY_COUNT"]));
}
}
[Browsable(true)]
public string[] DERIVATION {
get {
return ((string[])(PrivateLateBoundObject["__DERIVATION"]));
}
}
[Browsable(true)]
public string SERVER {
get {
return ((string)(PrivateLateBoundObject["__SERVER"]));
}
}
[Browsable(true)]
public string NAMESPACE {
get {
return ((string)(PrivateLateBoundObject["__NAMESPACE"]));
}
}
[Browsable(true)]
public string PATH {
get {
return ((string)(PrivateLateBoundObject["__PATH"]));
}
}
}
}
}

View File

@ -1447,8 +1447,8 @@
inParams["TimeoutPeriod"] = ToDmtfDateTime(((System.DateTime)(TimeoutPeriod)));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("RequestReplicationStateChange", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
if ((outParams.Properties["Job"] != null) && outParams.Properties["Job"].Value != null) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].Value.ToString());
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -1462,12 +1462,13 @@
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("RequestStateChange");
inParams["RequestedState"] = ((ushort)(RequestedState));
inParams["TimeoutPeriod"] = ToDmtfDateTime(((System.DateTime)(TimeoutPeriod)));
inParams["RequestedState"] = RequestedState;
inParams["TimeoutPeriod"] = null; // ToDmtfDateTime(((System.DateTime)(TimeoutPeriod)));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("RequestStateChange", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
if ((outParams.Properties["Job"] != null) && outParams.Properties["Job"].Value != null)
{
Job = new System.Management.ManagementPath(outParams.Properties["Job"].Value.ToString());
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}

View File

@ -1,4 +1,4 @@
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION {
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
using System;
using System.ComponentModel;
using System.Management;
@ -13,15 +13,14 @@
// Functions Reset<PropertyName> are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL.
// Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used.
// Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa.
// Time interval functions ToTimeSpan and ToDmtfTimeInterval are added to the class to convert DMTF Time Interval to System.TimeSpan and vice-versa.
// An Early Bound class generated for the WMI class.Msvm_SyntheticEthernetPort
public class SyntheticEthernetPort : System.ComponentModel.Component {
// An Early Bound class generated for the WMI class.Msvm_EthernetSwitchPort
public class EthernetSwitchPort : System.ComponentModel.Component {
// Private property to hold the WMI namespace in which the class resides.
private static string CreatedWmiNamespace = "ROOT\\virtualization";
private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2";
// Private property to hold the name of WMI class which created this class.
public static string CreatedClassName = "Msvm_SyntheticEthernetPort";
public static string CreatedClassName = "Msvm_EthernetSwitchPort";
// Private member variable to hold the ManagementScope which is used by the various methods.
private static System.Management.ManagementScope statMgmtScope = null;
@ -44,35 +43,35 @@
private bool isEmbedded;
// Below are different overloads of constructors to initialize an instance of the class with a WMI object.
public SyntheticEthernetPort() {
public EthernetSwitchPort() {
this.InitializeObject(null, null, null);
}
public SyntheticEthernetPort(string keyCreationClassName, string keyDeviceID, string keySystemCreationClassName, string keySystemName) {
this.InitializeObject(null, new System.Management.ManagementPath(SyntheticEthernetPort.ConstructPath(keyCreationClassName, keyDeviceID, keySystemCreationClassName, keySystemName)), null);
public EthernetSwitchPort(string keyCreationClassName, string keyDeviceID, string keySystemCreationClassName, string keySystemName) {
this.InitializeObject(null, new System.Management.ManagementPath(EthernetSwitchPort.ConstructPath(keyCreationClassName, keyDeviceID, keySystemCreationClassName, keySystemName)), null);
}
public SyntheticEthernetPort(System.Management.ManagementScope mgmtScope, string keyCreationClassName, string keyDeviceID, string keySystemCreationClassName, string keySystemName) {
this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(SyntheticEthernetPort.ConstructPath(keyCreationClassName, keyDeviceID, keySystemCreationClassName, keySystemName)), null);
public EthernetSwitchPort(System.Management.ManagementScope mgmtScope, string keyCreationClassName, string keyDeviceID, string keySystemCreationClassName, string keySystemName) {
this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(EthernetSwitchPort.ConstructPath(keyCreationClassName, keyDeviceID, keySystemCreationClassName, keySystemName)), null);
}
public SyntheticEthernetPort(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
public EthernetSwitchPort(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
this.InitializeObject(null, path, getOptions);
}
public SyntheticEthernetPort(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
public EthernetSwitchPort(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
this.InitializeObject(mgmtScope, path, null);
}
public SyntheticEthernetPort(System.Management.ManagementPath path) {
public EthernetSwitchPort(System.Management.ManagementPath path) {
this.InitializeObject(null, path, null);
}
public SyntheticEthernetPort(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
public EthernetSwitchPort(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
this.InitializeObject(mgmtScope, path, getOptions);
}
public SyntheticEthernetPort(System.Management.ManagementObject theObject) {
public EthernetSwitchPort(System.Management.ManagementObject theObject) {
Initialize();
if ((CheckIfProperClass(theObject) == true)) {
PrivateLateBoundObject = theObject;
@ -84,7 +83,7 @@
}
}
public SyntheticEthernetPort(System.Management.ManagementBaseObject theObject) {
public EthernetSwitchPort(System.Management.ManagementBaseObject theObject) {
Initialize();
if ((CheckIfProperClass(theObject) == true)) {
embeddedObj = theObject;
@ -102,7 +101,7 @@
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string OriginatingNamespace {
get {
return "ROOT\\virtualization";
return "ROOT\\virtualization\\v2";
}
}
@ -289,6 +288,14 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ushort[] AvailableRequestedStates {
get {
return ((ushort[])(curObj["AvailableRequestedStates"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ushort[] Capabilities {
@ -313,6 +320,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsCommunicationStatusNull {
get {
if ((curObj["CommunicationStatus"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort CommunicationStatus {
get {
if ((curObj["CommunicationStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["CommunicationStatus"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string CreationClassName {
@ -329,6 +361,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsDetailedStatusNull {
get {
if ((curObj["DetailedStatus"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort DetailedStatus {
get {
if ((curObj["DetailedStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["DetailedStatus"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string DeviceID {
@ -521,6 +578,41 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string InstanceID {
get {
return ((string)(curObj["InstanceID"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsIOVOffloadUsageNull {
get {
if ((curObj["IOVOffloadUsage"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The current I/O virtualization (IOV) offload usage on this port. The usage is the" +
"amount of IOV resources in use on the port.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public uint IOVOffloadUsage {
get {
if ((curObj["IOVOffloadUsage"] == null)) {
return System.Convert.ToUInt32(0);
}
return ((uint)(curObj["IOVOffloadUsage"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsLastErrorCodeNull {
@ -571,31 +663,6 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsLocationIndicatorNull {
get {
if ((curObj["LocationIndicator"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort LocationIndicator {
get {
if ((curObj["LocationIndicator"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["LocationIndicator"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsMaxDataSizeNull {
@ -687,6 +754,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsOperatingStatusNull {
get {
if ((curObj["OperatingStatus"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort OperatingStatus {
get {
if ((curObj["OperatingStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["OperatingStatus"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ushort[] OperationalStatus {
@ -859,6 +951,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsPrimaryStatusNull {
get {
if ((curObj["PrimaryStatus"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort PrimaryStatus {
get {
if ((curObj["PrimaryStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["PrimaryStatus"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsRequestedSpeedNull {
@ -1068,6 +1185,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsTransitioningToStateNull {
get {
if ((curObj["TransitioningToState"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort TransitioningToState {
get {
if ((curObj["TransitioningToState"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["TransitioningToState"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsUsageRestrictionNull {
@ -1093,6 +1235,33 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsVMQOffloadUsageNull {
get {
if ((curObj["VMQOffloadUsage"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The current VMQ offloading usage on this port. The usage is the amount of VMQ res" +
"ources in use on the port.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public uint VMQOffloadUsage {
get {
if ((curObj["VMQOffloadUsage"] == null)) {
return System.Convert.ToUInt32(0);
}
return ((uint)(curObj["VMQOffloadUsage"]));
}
}
private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) {
if (((path != null)
&& (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
@ -1143,6 +1312,20 @@
return false;
}
private bool ShouldSerializeCommunicationStatus() {
if ((this.IsCommunicationStatusNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeDetailedStatus() {
if ((this.IsDetailedStatusNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeEnabledDefault() {
if ((this.IsEnabledDefaultNull == false)) {
return true;
@ -1309,6 +1492,13 @@
return false;
}
private bool ShouldSerializeIOVOffloadUsage() {
if ((this.IsIOVOffloadUsageNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeLastErrorCode() {
if ((this.IsLastErrorCodeNull == false)) {
return true;
@ -1323,13 +1513,6 @@
return false;
}
private bool ShouldSerializeLocationIndicator() {
if ((this.IsLocationIndicatorNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeMaxDataSize() {
if ((this.IsMaxDataSizeNull == false)) {
return true;
@ -1351,6 +1534,13 @@
return false;
}
private bool ShouldSerializeOperatingStatus() {
if ((this.IsOperatingStatusNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializePortNumber() {
if ((this.IsPortNumberNull == false)) {
return true;
@ -1379,6 +1569,13 @@
return false;
}
private bool ShouldSerializePrimaryStatus() {
if ((this.IsPrimaryStatusNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeRequestedSpeed() {
if ((this.IsRequestedSpeedNull == false)) {
return true;
@ -1428,6 +1625,13 @@
return false;
}
private bool ShouldSerializeTransitioningToState() {
if ((this.IsTransitioningToStateNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeUsageRestriction() {
if ((this.IsUsageRestrictionNull == false)) {
return true;
@ -1435,6 +1639,13 @@
return false;
}
private bool ShouldSerializeVMQOffloadUsage() {
if ((this.IsVMQOffloadUsageNull == false)) {
return true;
}
return false;
}
[Browsable(true)]
public void CommitObject() {
if ((isEmbedded == false)) {
@ -1455,7 +1666,7 @@
}
private static string ConstructPath(string keyCreationClassName, string keyDeviceID, string keySystemCreationClassName, string keySystemName) {
string strPath = "ROOT\\virtualization:Msvm_SyntheticEthernetPort";
string strPath = "ROOT\\virtualization\\v2:Msvm_EthernetSwitchPort";
strPath = string.Concat(strPath, string.Concat(".CreationClassName=", string.Concat("\"", string.Concat(keyCreationClassName, "\""))));
strPath = string.Concat(strPath, string.Concat(",DeviceID=", string.Concat("\"", string.Concat(keyDeviceID, "\""))));
strPath = string.Concat(strPath, string.Concat(",SystemCreationClassName=", string.Concat("\"", string.Concat(keySystemCreationClassName, "\""))));
@ -1476,70 +1687,70 @@
}
// Different overloads of GetInstances() help in enumerating instances of the WMI class.
public static SyntheticEthernetPortCollection GetInstances() {
public static EthernetSwitchPortCollection GetInstances() {
return GetInstances(null, null, null);
}
public static SyntheticEthernetPortCollection GetInstances(string condition) {
public static EthernetSwitchPortCollection GetInstances(string condition) {
return GetInstances(null, condition, null);
}
public static SyntheticEthernetPortCollection GetInstances(string[] selectedProperties) {
public static EthernetSwitchPortCollection GetInstances(string[] selectedProperties) {
return GetInstances(null, null, selectedProperties);
}
public static SyntheticEthernetPortCollection GetInstances(string condition, string[] selectedProperties) {
public static EthernetSwitchPortCollection GetInstances(string condition, string[] selectedProperties) {
return GetInstances(null, condition, selectedProperties);
}
public static SyntheticEthernetPortCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
public static EthernetSwitchPortCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;
}
}
System.Management.ManagementPath pathObj = new System.Management.ManagementPath();
pathObj.ClassName = "Msvm_SyntheticEthernetPort";
pathObj.NamespacePath = "root\\virtualization";
pathObj.ClassName = "Msvm_EthernetSwitchPort";
pathObj.NamespacePath = "root\\virtualization\\v2";
System.Management.ManagementClass clsObject = new System.Management.ManagementClass(mgmtScope, pathObj, null);
if ((enumOptions == null)) {
enumOptions = new System.Management.EnumerationOptions();
enumOptions.EnsureLocatable = true;
}
return new SyntheticEthernetPortCollection(clsObject.GetInstances(enumOptions));
return new EthernetSwitchPortCollection(clsObject.GetInstances(enumOptions));
}
public static SyntheticEthernetPortCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
public static EthernetSwitchPortCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
return GetInstances(mgmtScope, condition, null);
}
public static SyntheticEthernetPortCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
public static EthernetSwitchPortCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
return GetInstances(mgmtScope, null, selectedProperties);
}
public static SyntheticEthernetPortCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
public static EthernetSwitchPortCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;
}
}
System.Management.ManagementObjectSearcher ObjectSearcher = new System.Management.ManagementObjectSearcher(mgmtScope, new SelectQuery("Msvm_SyntheticEthernetPort", condition, selectedProperties));
System.Management.ManagementObjectSearcher ObjectSearcher = new System.Management.ManagementObjectSearcher(mgmtScope, new SelectQuery("Msvm_EthernetSwitchPort", condition, selectedProperties));
System.Management.EnumerationOptions enumOptions = new System.Management.EnumerationOptions();
enumOptions.EnsureLocatable = true;
ObjectSearcher.Options = enumOptions;
return new SyntheticEthernetPortCollection(ObjectSearcher.Get());
return new EthernetSwitchPortCollection(ObjectSearcher.Get());
}
[Browsable(true)]
public static SyntheticEthernetPort CreateInstance() {
public static EthernetSwitchPort CreateInstance() {
System.Management.ManagementScope mgmtScope = null;
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
@ -1550,7 +1761,7 @@
}
System.Management.ManagementPath mgmtPath = new System.Management.ManagementPath(CreatedClassName);
System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null);
return new SyntheticEthernetPort(tmpMgmtClass.CreateInstance());
return new EthernetSwitchPort(tmpMgmtClass.CreateInstance());
}
[Browsable(true)]
@ -1597,85 +1808,16 @@
}
}
// Converts a given time interval in DMTF format to System.TimeSpan object.
static System.TimeSpan ToTimeSpan(string dmtfTimespan) {
int days = 0;
int hours = 0;
int minutes = 0;
int seconds = 0;
long ticks = 0;
if ((dmtfTimespan == null)) {
throw new System.ArgumentOutOfRangeException();
}
if ((dmtfTimespan.Length == 0)) {
throw new System.ArgumentOutOfRangeException();
}
if ((dmtfTimespan.Length != 25)) {
throw new System.ArgumentOutOfRangeException();
}
if ((dmtfTimespan.Substring(21, 4) != ":000")) {
throw new System.ArgumentOutOfRangeException();
}
try {
string tempString = string.Empty;
tempString = dmtfTimespan.Substring(0, 8);
days = int.Parse(tempString);
tempString = dmtfTimespan.Substring(8, 2);
hours = int.Parse(tempString);
tempString = dmtfTimespan.Substring(10, 2);
minutes = int.Parse(tempString);
tempString = dmtfTimespan.Substring(12, 2);
seconds = int.Parse(tempString);
tempString = dmtfTimespan.Substring(15, 6);
ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000))));
}
catch (System.Exception e) {
throw new System.ArgumentOutOfRangeException(null, e.Message);
}
System.TimeSpan timespan = new System.TimeSpan(days, hours, minutes, seconds, 0);
System.TimeSpan tsTemp = System.TimeSpan.FromTicks(ticks);
timespan = timespan.Add(tsTemp);
return timespan;
}
// Converts a given System.TimeSpan object to DMTF Time interval format.
static string ToDmtfTimeInterval(System.TimeSpan timespan) {
string dmtftimespan = ((int)(timespan.Days)).ToString().PadLeft(8, '0');
System.TimeSpan maxTimeSpan = System.TimeSpan.MaxValue;
if ((timespan.Days > maxTimeSpan.Days)) {
throw new System.ArgumentOutOfRangeException();
}
System.TimeSpan minTimeSpan = System.TimeSpan.MinValue;
if ((timespan.Days < minTimeSpan.Days)) {
throw new System.ArgumentOutOfRangeException();
}
dmtftimespan = string.Concat(dmtftimespan, ((int)(timespan.Hours)).ToString().PadLeft(2, '0'));
dmtftimespan = string.Concat(dmtftimespan, ((int)(timespan.Minutes)).ToString().PadLeft(2, '0'));
dmtftimespan = string.Concat(dmtftimespan, ((int)(timespan.Seconds)).ToString().PadLeft(2, '0'));
dmtftimespan = string.Concat(dmtftimespan, ".");
System.TimeSpan tsTemp = new System.TimeSpan(timespan.Days, timespan.Hours, timespan.Minutes, timespan.Seconds, 0);
long microsec = ((long)((((timespan.Ticks - tsTemp.Ticks)
* 1000)
/ System.TimeSpan.TicksPerMillisecond)));
string strMicroSec = ((long)(microsec)).ToString();
if ((strMicroSec.Length > 6)) {
strMicroSec = strMicroSec.Substring(0, 6);
}
dmtftimespan = string.Concat(dmtftimespan, strMicroSec.PadLeft(6, '0'));
dmtftimespan = string.Concat(dmtftimespan, ":000");
return dmtftimespan;
}
public uint RequestStateChange(ushort RequestedState, System.TimeSpan TimeoutPeriod, out System.Management.ManagementPath Job) {
public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod, out System.Management.ManagementPath Job) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("RequestStateChange");
inParams["RequestedState"] = ((ushort)(RequestedState));
inParams["TimeoutPeriod"] = ToDmtfTimeInterval(((System.TimeSpan)(TimeoutPeriod)));
inParams["TimeoutPeriod"] = ToDmtfDateTime(((System.DateTime)(TimeoutPeriod)));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("RequestStateChange", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
if ((outParams.Properties["Job"] != null) && outParams.Properties["Job"].Value != null) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].Value.ToString());
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -1733,11 +1875,11 @@
}
// Enumerator implementation for enumerating instances of the class.
public class SyntheticEthernetPortCollection : object, ICollection {
public class EthernetSwitchPortCollection : object, ICollection {
private ManagementObjectCollection privColObj;
public SyntheticEthernetPortCollection(ManagementObjectCollection objCollection) {
public EthernetSwitchPortCollection(ManagementObjectCollection objCollection) {
privColObj = objCollection;
}
@ -1763,25 +1905,25 @@
privColObj.CopyTo(array, index);
int nCtr;
for (nCtr = 0; (nCtr < array.Length); nCtr = (nCtr + 1)) {
array.SetValue(new SyntheticEthernetPort(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
array.SetValue(new EthernetSwitchPort(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
}
}
public virtual System.Collections.IEnumerator GetEnumerator() {
return new SyntheticEthernetPortEnumerator(privColObj.GetEnumerator());
return new EthernetSwitchPortEnumerator(privColObj.GetEnumerator());
}
public class SyntheticEthernetPortEnumerator : object, System.Collections.IEnumerator {
public class EthernetSwitchPortEnumerator : object, System.Collections.IEnumerator {
private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum;
public SyntheticEthernetPortEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
public EthernetSwitchPortEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
privObjEnum = objEnum;
}
public virtual object Current {
get {
return new SyntheticEthernetPort(((System.Management.ManagementObject)(privObjEnum.Current)));
return new EthernetSwitchPort(((System.Management.ManagementObject)(privObjEnum.Current)));
}
}

View File

@ -1,4 +1,4 @@
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION {
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
using System;
using System.ComponentModel;
using System.Management;
@ -12,14 +12,14 @@
// Functions Is<PropertyName>Null() are used to check if a property is NULL.
// Functions Reset<PropertyName> are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL.
// Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used.
// An Early Bound class generated for the WMI class.Msvm_VLANEndpointSettingData
public class VLANEndpointSettingData : System.ComponentModel.Component {
// An Early Bound class generated for the WMI class.Msvm_EthernetSwitchPortVlanSettingData
public class EthernetSwitchPortVlanSettingData : System.ComponentModel.Component {
// Private property to hold the WMI namespace in which the class resides.
private static string CreatedWmiNamespace = "ROOT\\virtualization";
private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2";
// Private property to hold the name of WMI class which created this class.
public static string CreatedClassName = "Msvm_VLANEndpointSettingData";
public static string CreatedClassName = "Msvm_EthernetSwitchPortVlanSettingData";
// Private member variable to hold the ManagementScope which is used by the various methods.
private static System.Management.ManagementScope statMgmtScope = null;
@ -42,35 +42,35 @@
private bool isEmbedded;
// Below are different overloads of constructors to initialize an instance of the class with a WMI object.
public VLANEndpointSettingData() {
public EthernetSwitchPortVlanSettingData() {
this.InitializeObject(null, null, null);
}
public VLANEndpointSettingData(string keyInstanceID) {
this.InitializeObject(null, new System.Management.ManagementPath(VLANEndpointSettingData.ConstructPath(keyInstanceID)), null);
public EthernetSwitchPortVlanSettingData(string keyInstanceID) {
this.InitializeObject(null, new System.Management.ManagementPath(EthernetSwitchPortVlanSettingData.ConstructPath(keyInstanceID)), null);
}
public VLANEndpointSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) {
this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(VLANEndpointSettingData.ConstructPath(keyInstanceID)), null);
public EthernetSwitchPortVlanSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) {
this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(EthernetSwitchPortVlanSettingData.ConstructPath(keyInstanceID)), null);
}
public VLANEndpointSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
public EthernetSwitchPortVlanSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
this.InitializeObject(null, path, getOptions);
}
public VLANEndpointSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
public EthernetSwitchPortVlanSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
this.InitializeObject(mgmtScope, path, null);
}
public VLANEndpointSettingData(System.Management.ManagementPath path) {
public EthernetSwitchPortVlanSettingData(System.Management.ManagementPath path) {
this.InitializeObject(null, path, null);
}
public VLANEndpointSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
public EthernetSwitchPortVlanSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
this.InitializeObject(mgmtScope, path, getOptions);
}
public VLANEndpointSettingData(System.Management.ManagementObject theObject) {
public EthernetSwitchPortVlanSettingData(System.Management.ManagementObject theObject) {
Initialize();
if ((CheckIfProperClass(theObject) == true)) {
PrivateLateBoundObject = theObject;
@ -82,7 +82,7 @@
}
}
public VLANEndpointSettingData(System.Management.ManagementBaseObject theObject) {
public EthernetSwitchPortVlanSettingData(System.Management.ManagementBaseObject theObject) {
Initialize();
if ((CheckIfProperClass(theObject) == true)) {
embeddedObj = theObject;
@ -100,7 +100,7 @@
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string OriginatingNamespace {
get {
return "ROOT\\virtualization";
return "ROOT\\virtualization\\v2";
}
}
@ -206,9 +206,9 @@
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsAccessVLANNull {
public bool IsAccessVlanIdNull {
get {
if ((curObj["AccessVLAN"] == null)) {
if ((curObj["AccessVlanId"] == null)) {
return true;
}
else {
@ -219,13 +219,21 @@
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The vlan ID in access mode.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort AccessVLAN {
public ushort AccessVlanId {
get {
if ((curObj["AccessVLAN"] == null)) {
if ((curObj["AccessVlanId"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["AccessVLAN"]));
return ((ushort)(curObj["AccessVlanId"]));
}
set {
curObj["AccessVlanId"] = value;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
}
}
}
@ -237,31 +245,6 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsDefaultVLANNull {
get {
if ((curObj["DefaultVLAN"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort DefaultVLAN {
get {
if ((curObj["DefaultVLAN"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["DefaultVLAN"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string Description {
@ -288,9 +271,9 @@
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsNativeVLANNull {
public bool IsNativeVlanIdNull {
get {
if ((curObj["NativeVLAN"] == null)) {
if ((curObj["NativeVlanId"] == null)) {
return true;
}
else {
@ -301,42 +284,17 @@
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The vlan ID in trunk mode.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort NativeVLAN {
public ushort NativeVlanId {
get {
if ((curObj["NativeVLAN"] == null)) {
if ((curObj["NativeVlanId"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["NativeVLAN"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsPrimaryVlanNull {
get {
if ((curObj["PrimaryVlan"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The primary Vlan if the port is in Private Vlan mode.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort PrimaryVlan {
get {
if ((curObj["PrimaryVlan"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["PrimaryVlan"]));
return ((ushort)(curObj["NativeVlanId"]));
}
set {
curObj["PrimaryVlan"] = value;
curObj["NativeVlanId"] = value;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
@ -344,19 +302,11 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ushort[] PruneEligibleVLANList {
get {
return ((ushort[])(curObj["PruneEligibleVLANList"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsPVlanModeNull {
public bool IsOperationModeNull {
get {
if ((curObj["PVlanMode"] == null)) {
if ((curObj["OperationMode"] == null)) {
return true;
}
else {
@ -367,21 +317,21 @@
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The private VLAN Mode mode supported by this port.")]
[Description("The vlan operation modes.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public PVlanModeValues PVlanMode {
public OperationModeValues OperationMode {
get {
if ((curObj["PVlanMode"] == null)) {
return ((PVlanModeValues)(System.Convert.ToInt32(3)));
if ((curObj["OperationMode"] == null)) {
return ((OperationModeValues)(System.Convert.ToInt32(0)));
}
return ((PVlanModeValues)(System.Convert.ToInt32(curObj["PVlanMode"])));
return ((OperationModeValues)(System.Convert.ToInt32(curObj["OperationMode"])));
}
set {
if ((PVlanModeValues.NULL_ENUM_VALUE == value)) {
curObj["PVlanMode"] = null;
if ((OperationModeValues.NULL_ENUM_VALUE == value)) {
curObj["OperationMode"] = null;
}
else {
curObj["PVlanMode"] = value;
curObj["OperationMode"] = value;
}
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
@ -392,9 +342,9 @@
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsSecondaryVlanNull {
public bool IsPrimaryVlanIdNull {
get {
if ((curObj["SecondaryVlan"] == null)) {
if ((curObj["PrimaryVlanId"] == null)) {
return true;
}
else {
@ -405,17 +355,17 @@
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The secondary Vlan if the port is in Private Vlan mode.")]
[Description("The primary vlan ID in private mode.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort SecondaryVlan {
public ushort PrimaryVlanId {
get {
if ((curObj["SecondaryVlan"] == null)) {
if ((curObj["PrimaryVlanId"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["SecondaryVlan"]));
return ((ushort)(curObj["PrimaryVlanId"]));
}
set {
curObj["SecondaryVlan"] = value;
curObj["PrimaryVlanId"] = value;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
@ -425,9 +375,120 @@
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ushort[] TrunkedVLANList {
[Description("The prune vlan ID bitmap in trunk mode.")]
public ushort[] PruneVlanIdArray {
get {
return ((ushort[])(curObj["TrunkedVLANList"]));
return ((ushort[])(curObj["PruneVlanIdArray"]));
}
set {
curObj["PruneVlanIdArray"] = value;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
}
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsPvlanModeNull {
get {
if ((curObj["PvlanMode"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The private vlan modes.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public PvlanModeValues PvlanMode {
get {
if ((curObj["PvlanMode"] == null)) {
return ((PvlanModeValues)(System.Convert.ToInt32(0)));
}
return ((PvlanModeValues)(System.Convert.ToInt32(curObj["PvlanMode"])));
}
set {
if ((PvlanModeValues.NULL_ENUM_VALUE == value)) {
curObj["PvlanMode"] = null;
}
else {
curObj["PvlanMode"] = value;
}
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
}
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsSecondaryVlanIdNull {
get {
if ((curObj["SecondaryVlanId"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The secondary vlan ID in private mode.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort SecondaryVlanId {
get {
if ((curObj["SecondaryVlanId"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["SecondaryVlanId"]));
}
set {
curObj["SecondaryVlanId"] = value;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The secondary vlan ID bitmap in private mode.")]
public ushort[] SecondaryVlanIdArray {
get {
return ((ushort[])(curObj["SecondaryVlanIdArray"]));
}
set {
curObj["SecondaryVlanIdArray"] = value;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The trunk vlan ID bitmap in trunk mode.")]
public ushort[] TrunkVlanIdArray {
get {
return ((ushort[])(curObj["TrunkVlanIdArray"]));
}
set {
curObj["TrunkVlanIdArray"] = value;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
}
}
}
@ -460,66 +521,114 @@
return false;
}
private bool ShouldSerializeAccessVLAN() {
if ((this.IsAccessVLANNull == false)) {
private bool ShouldSerializeAccessVlanId() {
if ((this.IsAccessVlanIdNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeDefaultVLAN() {
if ((this.IsDefaultVLANNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeNativeVLAN() {
if ((this.IsNativeVLANNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializePrimaryVlan() {
if ((this.IsPrimaryVlanNull == false)) {
return true;
}
return false;
}
private void ResetPrimaryVlan() {
curObj["PrimaryVlan"] = null;
private void ResetAccessVlanId() {
curObj["AccessVlanId"] = null;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
}
}
private bool ShouldSerializePVlanMode() {
if ((this.IsPVlanModeNull == false)) {
private bool ShouldSerializeNativeVlanId() {
if ((this.IsNativeVlanIdNull == false)) {
return true;
}
return false;
}
private void ResetPVlanMode() {
curObj["PVlanMode"] = null;
private void ResetNativeVlanId() {
curObj["NativeVlanId"] = null;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
}
}
private bool ShouldSerializeSecondaryVlan() {
if ((this.IsSecondaryVlanNull == false)) {
private bool ShouldSerializeOperationMode() {
if ((this.IsOperationModeNull == false)) {
return true;
}
return false;
}
private void ResetSecondaryVlan() {
curObj["SecondaryVlan"] = null;
private void ResetOperationMode() {
curObj["OperationMode"] = null;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
}
}
private bool ShouldSerializePrimaryVlanId() {
if ((this.IsPrimaryVlanIdNull == false)) {
return true;
}
return false;
}
private void ResetPrimaryVlanId() {
curObj["PrimaryVlanId"] = null;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
}
}
private void ResetPruneVlanIdArray() {
curObj["PruneVlanIdArray"] = null;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
}
}
private bool ShouldSerializePvlanMode() {
if ((this.IsPvlanModeNull == false)) {
return true;
}
return false;
}
private void ResetPvlanMode() {
curObj["PvlanMode"] = null;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
}
}
private bool ShouldSerializeSecondaryVlanId() {
if ((this.IsSecondaryVlanIdNull == false)) {
return true;
}
return false;
}
private void ResetSecondaryVlanId() {
curObj["SecondaryVlanId"] = null;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
}
}
private void ResetSecondaryVlanIdArray() {
curObj["SecondaryVlanIdArray"] = null;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
}
}
private void ResetTrunkVlanIdArray() {
curObj["TrunkVlanIdArray"] = null;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
@ -546,7 +655,7 @@
}
private static string ConstructPath(string keyInstanceID) {
string strPath = "ROOT\\virtualization:Msvm_VLANEndpointSettingData";
string strPath = "ROOT\\virtualization\\v2:Msvm_EthernetSwitchPortVlanSettingData";
strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\""))));
return strPath;
}
@ -564,70 +673,70 @@
}
// Different overloads of GetInstances() help in enumerating instances of the WMI class.
public static VLANEndpointSettingDataCollection GetInstances() {
public static EthernetSwitchPortVlanSettingDataCollection GetInstances() {
return GetInstances(null, null, null);
}
public static VLANEndpointSettingDataCollection GetInstances(string condition) {
public static EthernetSwitchPortVlanSettingDataCollection GetInstances(string condition) {
return GetInstances(null, condition, null);
}
public static VLANEndpointSettingDataCollection GetInstances(string[] selectedProperties) {
public static EthernetSwitchPortVlanSettingDataCollection GetInstances(string[] selectedProperties) {
return GetInstances(null, null, selectedProperties);
}
public static VLANEndpointSettingDataCollection GetInstances(string condition, string[] selectedProperties) {
public static EthernetSwitchPortVlanSettingDataCollection GetInstances(string condition, string[] selectedProperties) {
return GetInstances(null, condition, selectedProperties);
}
public static VLANEndpointSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
public static EthernetSwitchPortVlanSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;
}
}
System.Management.ManagementPath pathObj = new System.Management.ManagementPath();
pathObj.ClassName = "Msvm_VLANEndpointSettingData";
pathObj.NamespacePath = "root\\virtualization";
pathObj.ClassName = "Msvm_EthernetSwitchPortVlanSettingData";
pathObj.NamespacePath = "root\\virtualization\\v2";
System.Management.ManagementClass clsObject = new System.Management.ManagementClass(mgmtScope, pathObj, null);
if ((enumOptions == null)) {
enumOptions = new System.Management.EnumerationOptions();
enumOptions.EnsureLocatable = true;
}
return new VLANEndpointSettingDataCollection(clsObject.GetInstances(enumOptions));
return new EthernetSwitchPortVlanSettingDataCollection(clsObject.GetInstances(enumOptions));
}
public static VLANEndpointSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
public static EthernetSwitchPortVlanSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
return GetInstances(mgmtScope, condition, null);
}
public static VLANEndpointSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
public static EthernetSwitchPortVlanSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
return GetInstances(mgmtScope, null, selectedProperties);
}
public static VLANEndpointSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
public static EthernetSwitchPortVlanSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;
}
}
System.Management.ManagementObjectSearcher ObjectSearcher = new System.Management.ManagementObjectSearcher(mgmtScope, new SelectQuery("Msvm_VLANEndpointSettingData", condition, selectedProperties));
System.Management.ManagementObjectSearcher ObjectSearcher = new System.Management.ManagementObjectSearcher(mgmtScope, new SelectQuery("Msvm_EthernetSwitchPortVlanSettingData", condition, selectedProperties));
System.Management.EnumerationOptions enumOptions = new System.Management.EnumerationOptions();
enumOptions.EnsureLocatable = true;
ObjectSearcher.Options = enumOptions;
return new VLANEndpointSettingDataCollection(ObjectSearcher.Get());
return new EthernetSwitchPortVlanSettingDataCollection(ObjectSearcher.Get());
}
[Browsable(true)]
public static VLANEndpointSettingData CreateInstance() {
public static EthernetSwitchPortVlanSettingData CreateInstance() {
System.Management.ManagementScope mgmtScope = null;
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
@ -638,7 +747,7 @@
}
System.Management.ManagementPath mgmtPath = new System.Management.ManagementPath(CreatedClassName);
System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null);
return new VLANEndpointSettingData(tmpMgmtClass.CreateInstance());
return new EthernetSwitchPortVlanSettingData(tmpMgmtClass.CreateInstance());
}
[Browsable(true)]
@ -646,23 +755,34 @@
PrivateLateBoundObject.Delete();
}
public enum PVlanModeValues {
public enum OperationModeValues {
Unknown0 = 0,
Access = 1,
Incoming = 1,
Trunk = 2,
Outgoing = 2,
Private = 3,
NULL_ENUM_VALUE = 3,
NULL_ENUM_VALUE = 0,
}
public enum PvlanModeValues {
Isolated = 1,
Community = 2,
Promiscuous = 3,
NULL_ENUM_VALUE = 0,
}
// Enumerator implementation for enumerating instances of the class.
public class VLANEndpointSettingDataCollection : object, ICollection {
public class EthernetSwitchPortVlanSettingDataCollection : object, ICollection {
private ManagementObjectCollection privColObj;
public VLANEndpointSettingDataCollection(ManagementObjectCollection objCollection) {
public EthernetSwitchPortVlanSettingDataCollection(ManagementObjectCollection objCollection) {
privColObj = objCollection;
}
@ -688,25 +808,25 @@
privColObj.CopyTo(array, index);
int nCtr;
for (nCtr = 0; (nCtr < array.Length); nCtr = (nCtr + 1)) {
array.SetValue(new VLANEndpointSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
array.SetValue(new EthernetSwitchPortVlanSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
}
}
public virtual System.Collections.IEnumerator GetEnumerator() {
return new VLANEndpointSettingDataEnumerator(privColObj.GetEnumerator());
return new EthernetSwitchPortVlanSettingDataEnumerator(privColObj.GetEnumerator());
}
public class VLANEndpointSettingDataEnumerator : object, System.Collections.IEnumerator {
public class EthernetSwitchPortVlanSettingDataEnumerator : object, System.Collections.IEnumerator {
private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum;
public VLANEndpointSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
public EthernetSwitchPortVlanSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
privObjEnum = objEnum;
}
public virtual object Current {
get {
return new VLANEndpointSettingData(((System.Management.ManagementObject)(privObjEnum.Current)));
return new EthernetSwitchPortVlanSettingData(((System.Management.ManagementObject)(privObjEnum.Current)));
}
}

View File

@ -1,4 +1,4 @@
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION {
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
using System;
using System.ComponentModel;
using System.Management;
@ -13,12 +13,11 @@
// Functions Reset<PropertyName> are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL.
// Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used.
// Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa.
// Time interval functions ToTimeSpan and ToDmtfTimeInterval are added to the class to convert DMTF Time Interval to System.TimeSpan and vice-versa.
// An Early Bound class generated for the WMI class.Msvm_ExternalEthernetPort
public class ExternalEthernetPort : System.ComponentModel.Component {
// Private property to hold the WMI namespace in which the class resides.
private static string CreatedWmiNamespace = "ROOT\\virtualization";
private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2";
// Private property to hold the name of WMI class which created this class.
private static string CreatedClassName = "Msvm_ExternalEthernetPort";
@ -102,7 +101,7 @@
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string OriginatingNamespace {
get {
return "ROOT\\virtualization";
return "ROOT\\virtualization\\v2";
}
}
@ -289,6 +288,14 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ushort[] AvailableRequestedStates {
get {
return ((ushort[])(curObj["AvailableRequestedStates"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ushort[] Capabilities {
@ -313,6 +320,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsCommunicationStatusNull {
get {
if ((curObj["CommunicationStatus"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort CommunicationStatus {
get {
if ((curObj["CommunicationStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["CommunicationStatus"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string CreationClassName {
@ -329,6 +361,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsDetailedStatusNull {
get {
if ((curObj["DetailedStatus"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort DetailedStatus {
get {
if ((curObj["DetailedStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["DetailedStatus"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string DeviceID {
@ -521,6 +578,14 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string InstanceID {
get {
return ((string)(curObj["InstanceID"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsIsBoundNull {
@ -600,31 +665,6 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsLocationIndicatorNull {
get {
if ((curObj["LocationIndicator"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort LocationIndicator {
get {
if ((curObj["LocationIndicator"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["LocationIndicator"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsMaxDataSizeNull {
@ -716,6 +756,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsOperatingStatusNull {
get {
if ((curObj["OperatingStatus"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort OperatingStatus {
get {
if ((curObj["OperatingStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["OperatingStatus"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ushort[] OperationalStatus {
@ -888,6 +953,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsPrimaryStatusNull {
get {
if ((curObj["PrimaryStatus"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort PrimaryStatus {
get {
if ((curObj["PrimaryStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["PrimaryStatus"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsRequestedSpeedNull {
@ -1097,6 +1187,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsTransitioningToStateNull {
get {
if ((curObj["TransitioningToState"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort TransitioningToState {
get {
if ((curObj["TransitioningToState"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["TransitioningToState"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsUsageRestrictionNull {
@ -1172,6 +1287,20 @@
return false;
}
private bool ShouldSerializeCommunicationStatus() {
if ((this.IsCommunicationStatusNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeDetailedStatus() {
if ((this.IsDetailedStatusNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeEnabledDefault() {
if ((this.IsEnabledDefaultNull == false)) {
return true;
@ -1359,13 +1488,6 @@
return false;
}
private bool ShouldSerializeLocationIndicator() {
if ((this.IsLocationIndicatorNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeMaxDataSize() {
if ((this.IsMaxDataSizeNull == false)) {
return true;
@ -1387,6 +1509,13 @@
return false;
}
private bool ShouldSerializeOperatingStatus() {
if ((this.IsOperatingStatusNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializePortNumber() {
if ((this.IsPortNumberNull == false)) {
return true;
@ -1415,6 +1544,13 @@
return false;
}
private bool ShouldSerializePrimaryStatus() {
if ((this.IsPrimaryStatusNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeRequestedSpeed() {
if ((this.IsRequestedSpeedNull == false)) {
return true;
@ -1464,6 +1600,13 @@
return false;
}
private bool ShouldSerializeTransitioningToState() {
if ((this.IsTransitioningToStateNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeUsageRestriction() {
if ((this.IsUsageRestrictionNull == false)) {
return true;
@ -1491,7 +1634,7 @@
}
private static string ConstructPath(string keyCreationClassName, string keyDeviceID, string keySystemCreationClassName, string keySystemName) {
string strPath = "ROOT\\virtualization:Msvm_ExternalEthernetPort";
string strPath = "ROOT\\virtualization\\v2:Msvm_ExternalEthernetPort";
strPath = string.Concat(strPath, string.Concat(".CreationClassName=", string.Concat("\"", string.Concat(keyCreationClassName, "\""))));
strPath = string.Concat(strPath, string.Concat(",DeviceID=", string.Concat("\"", string.Concat(keyDeviceID, "\""))));
strPath = string.Concat(strPath, string.Concat(",SystemCreationClassName=", string.Concat("\"", string.Concat(keySystemCreationClassName, "\""))));
@ -1532,7 +1675,7 @@
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;
@ -1540,7 +1683,7 @@
}
System.Management.ManagementPath pathObj = new System.Management.ManagementPath();
pathObj.ClassName = "Msvm_ExternalEthernetPort";
pathObj.NamespacePath = "root\\virtualization";
pathObj.NamespacePath = "root\\virtualization\\v2";
System.Management.ManagementClass clsObject = new System.Management.ManagementClass(mgmtScope, pathObj, null);
if ((enumOptions == null)) {
enumOptions = new System.Management.EnumerationOptions();
@ -1561,7 +1704,7 @@
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;
@ -1633,85 +1776,16 @@
}
}
// Converts a given time interval in DMTF format to System.TimeSpan object.
static System.TimeSpan ToTimeSpan(string dmtfTimespan) {
int days = 0;
int hours = 0;
int minutes = 0;
int seconds = 0;
long ticks = 0;
if ((dmtfTimespan == null)) {
throw new System.ArgumentOutOfRangeException();
}
if ((dmtfTimespan.Length == 0)) {
throw new System.ArgumentOutOfRangeException();
}
if ((dmtfTimespan.Length != 25)) {
throw new System.ArgumentOutOfRangeException();
}
if ((dmtfTimespan.Substring(21, 4) != ":000")) {
throw new System.ArgumentOutOfRangeException();
}
try {
string tempString = string.Empty;
tempString = dmtfTimespan.Substring(0, 8);
days = int.Parse(tempString);
tempString = dmtfTimespan.Substring(8, 2);
hours = int.Parse(tempString);
tempString = dmtfTimespan.Substring(10, 2);
minutes = int.Parse(tempString);
tempString = dmtfTimespan.Substring(12, 2);
seconds = int.Parse(tempString);
tempString = dmtfTimespan.Substring(15, 6);
ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000))));
}
catch (System.Exception e) {
throw new System.ArgumentOutOfRangeException(null, e.Message);
}
System.TimeSpan timespan = new System.TimeSpan(days, hours, minutes, seconds, 0);
System.TimeSpan tsTemp = System.TimeSpan.FromTicks(ticks);
timespan = timespan.Add(tsTemp);
return timespan;
}
// Converts a given System.TimeSpan object to DMTF Time interval format.
static string ToDmtfTimeInterval(System.TimeSpan timespan) {
string dmtftimespan = ((int)(timespan.Days)).ToString().PadLeft(8, '0');
System.TimeSpan maxTimeSpan = System.TimeSpan.MaxValue;
if ((timespan.Days > maxTimeSpan.Days)) {
throw new System.ArgumentOutOfRangeException();
}
System.TimeSpan minTimeSpan = System.TimeSpan.MinValue;
if ((timespan.Days < minTimeSpan.Days)) {
throw new System.ArgumentOutOfRangeException();
}
dmtftimespan = string.Concat(dmtftimespan, ((int)(timespan.Hours)).ToString().PadLeft(2, '0'));
dmtftimespan = string.Concat(dmtftimespan, ((int)(timespan.Minutes)).ToString().PadLeft(2, '0'));
dmtftimespan = string.Concat(dmtftimespan, ((int)(timespan.Seconds)).ToString().PadLeft(2, '0'));
dmtftimespan = string.Concat(dmtftimespan, ".");
System.TimeSpan tsTemp = new System.TimeSpan(timespan.Days, timespan.Hours, timespan.Minutes, timespan.Seconds, 0);
long microsec = ((long)((((timespan.Ticks - tsTemp.Ticks)
* 1000)
/ System.TimeSpan.TicksPerMillisecond)));
string strMicroSec = ((long)(microsec)).ToString();
if ((strMicroSec.Length > 6)) {
strMicroSec = strMicroSec.Substring(0, 6);
}
dmtftimespan = string.Concat(dmtftimespan, strMicroSec.PadLeft(6, '0'));
dmtftimespan = string.Concat(dmtftimespan, ":000");
return dmtftimespan;
}
public uint RequestStateChange(ushort RequestedState, System.TimeSpan TimeoutPeriod, out System.Management.ManagementPath Job) {
public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod, out System.Management.ManagementPath Job) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("RequestStateChange");
inParams["RequestedState"] = ((ushort)(RequestedState));
inParams["TimeoutPeriod"] = ToDmtfTimeInterval(((System.TimeSpan)(TimeoutPeriod)));
inParams["TimeoutPeriod"] = ToDmtfDateTime(((System.DateTime)(TimeoutPeriod)));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("RequestStateChange", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
if ((outParams.Properties["Job"] != null) && outParams.Properties["Job"].Value != null) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].Value.ToString());
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}

View File

@ -1,5 +1,4 @@
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION
{
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
using System;
using System.ComponentModel;
using System.Management;
@ -14,12 +13,11 @@
// Functions Reset<PropertyName> are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL.
// Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used.
// Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa.
// Time interval functions ToTimeSpan and ToDmtfTimeInterval are added to the class to convert DMTF Time Interval to System.TimeSpan and vice-versa.
// An Early Bound class generated for the WMI class.Msvm_ImageManagementService
public class ImageManagementService : System.ComponentModel.Component {
// Private property to hold the WMI namespace in which the class resides.
private static string CreatedWmiNamespace = "ROOT\\virtualization";
private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2";
// Private property to hold the name of WMI class which created this class.
private static string CreatedClassName = "Msvm_ImageManagementService";
@ -103,7 +101,7 @@
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string OriginatingNamespace {
get {
return "ROOT\\virtualization";
return "ROOT\\virtualization\\v2";
}
}
@ -207,6 +205,14 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ushort[] AvailableRequestedStates {
get {
return ((ushort[])(curObj["AvailableRequestedStates"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string Caption {
@ -215,6 +221,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsCommunicationStatusNull {
get {
if ((curObj["CommunicationStatus"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort CommunicationStatus {
get {
if ((curObj["CommunicationStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["CommunicationStatus"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string CreationClassName {
@ -231,6 +262,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsDetailedStatusNull {
get {
if ((curObj["DetailedStatus"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort DetailedStatus {
get {
if ((curObj["DetailedStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["DetailedStatus"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string ElementName {
@ -341,6 +397,14 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string InstanceID {
get {
return ((string)(curObj["InstanceID"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string Name {
@ -349,6 +413,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsOperatingStatusNull {
get {
if ((curObj["OperatingStatus"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort OperatingStatus {
get {
if ((curObj["OperatingStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["OperatingStatus"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ushort[] OperationalStatus {
@ -381,6 +470,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsPrimaryStatusNull {
get {
if ((curObj["PrimaryStatus"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort PrimaryStatus {
get {
if ((curObj["PrimaryStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["PrimaryStatus"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsRequestedStateNull {
@ -498,6 +612,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsTransitioningToStateNull {
get {
if ((curObj["TransitioningToState"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort TransitioningToState {
get {
if ((curObj["TransitioningToState"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["TransitioningToState"]));
}
}
private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) {
if (((path != null)
&& (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
@ -527,6 +666,20 @@
return false;
}
private bool ShouldSerializeCommunicationStatus() {
if ((this.IsCommunicationStatusNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeDetailedStatus() {
if ((this.IsDetailedStatusNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeEnabledDefault() {
if ((this.IsEnabledDefaultNull == false)) {
return true;
@ -679,6 +832,20 @@
return false;
}
private bool ShouldSerializeOperatingStatus() {
if ((this.IsOperatingStatusNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializePrimaryStatus() {
if ((this.IsPrimaryStatusNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeRequestedState() {
if ((this.IsRequestedStateNull == false)) {
return true;
@ -700,6 +867,13 @@
return false;
}
private bool ShouldSerializeTransitioningToState() {
if ((this.IsTransitioningToStateNull == false)) {
return true;
}
return false;
}
[Browsable(true)]
public void CommitObject() {
if ((isEmbedded == false)) {
@ -720,7 +894,7 @@
}
private static string ConstructPath(string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) {
string strPath = "ROOT\\virtualization:Msvm_ImageManagementService";
string strPath = "ROOT\\virtualization\\v2:Msvm_ImageManagementService";
strPath = string.Concat(strPath, string.Concat(".CreationClassName=", string.Concat("\"", string.Concat(keyCreationClassName, "\""))));
strPath = string.Concat(strPath, string.Concat(",Name=", string.Concat("\"", string.Concat(keyName, "\""))));
strPath = string.Concat(strPath, string.Concat(",SystemCreationClassName=", string.Concat("\"", string.Concat(keySystemCreationClassName, "\""))));
@ -761,7 +935,7 @@
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;
@ -769,7 +943,7 @@
}
System.Management.ManagementPath pathObj = new System.Management.ManagementPath();
pathObj.ClassName = "Msvm_ImageManagementService";
pathObj.NamespacePath = "root\\virtualization";
pathObj.NamespacePath = "root\\virtualization\\v2";
System.Management.ManagementClass clsObject = new System.Management.ManagementClass(mgmtScope, pathObj, null);
if ((enumOptions == null)) {
enumOptions = new System.Management.EnumerationOptions();
@ -790,7 +964,7 @@
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;
@ -823,15 +997,38 @@
PrivateLateBoundObject.Delete();
}
public uint CompactVirtualHardDisk(string Path, out System.Management.ManagementPath Job) {
public uint AttachVirtualHardDisk(bool AssignDriveLetter, string Path, bool ReadOnly, out System.Management.ManagementPath Job) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("AttachVirtualHardDisk");
inParams["AssignDriveLetter"] = ((bool)(AssignDriveLetter));
inParams["Path"] = ((string)(Path));
inParams["ReadOnly"] = ((bool)(ReadOnly));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("AttachVirtualHardDisk", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null))
{
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
else {
Job = null;
return System.Convert.ToUInt32(0);
}
}
public uint CompactVirtualHardDisk(ushort Mode, string Path, out System.Management.ManagementPath Job) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("CompactVirtualHardDisk");
inParams["Mode"] = ((ushort)(Mode));
inParams["Path"] = ((string)(Path));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("CompactVirtualHardDisk", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
if ((outParams.Properties["Job"] != null))
{
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -841,74 +1038,17 @@
}
}
public uint ConvertVirtualHardDisk(string DestinationPath, string SourcePath, ushort Type, out System.Management.ManagementPath Job) {
public uint ConvertVirtualHardDisk(string SourcePath, string VirtualDiskSettingData, out System.Management.ManagementPath Job) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("ConvertVirtualHardDisk");
inParams["DestinationPath"] = ((string)(DestinationPath));
inParams["SourcePath"] = ((string)(SourcePath));
inParams["Type"] = ((ushort)(Type));
inParams["VirtualDiskSettingData"] = ((string)(VirtualDiskSettingData));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("ConvertVirtualHardDisk", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
else {
Job = null;
return System.Convert.ToUInt32(0);
}
}
public uint CreateDifferencingVirtualHardDisk(string ParentPath, string Path, out System.Management.ManagementPath Job) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("CreateDifferencingVirtualHardDisk");
inParams["ParentPath"] = ((string)(ParentPath));
inParams["Path"] = ((string)(Path));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("CreateDifferencingVirtualHardDisk", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
else {
Job = null;
return System.Convert.ToUInt32(0);
}
}
public uint CreateDynamicVirtualHardDisk(ulong MaxInternalSize, string Path, out System.Management.ManagementPath Job) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("CreateDynamicVirtualHardDisk");
inParams["MaxInternalSize"] = ((ulong)(MaxInternalSize));
inParams["Path"] = ((string)(Path));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("CreateDynamicVirtualHardDisk", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
else {
Job = null;
return System.Convert.ToUInt32(0);
}
}
public uint CreateFixedVirtualHardDisk(ulong MaxInternalSize, string Path, out System.Management.ManagementPath Job) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("CreateFixedVirtualHardDisk");
inParams["MaxInternalSize"] = ((ulong)(MaxInternalSize));
inParams["Path"] = ((string)(Path));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("CreateFixedVirtualHardDisk", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
if ((outParams.Properties["Job"] != null))
{
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -925,8 +1065,9 @@
inParams["Path"] = ((string)(Path));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("CreateVirtualFloppyDisk", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
if ((outParams.Properties["Job"] != null))
{
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -936,16 +1077,16 @@
}
}
public uint ExpandVirtualHardDisk(ulong MaxInternalSize, string Path, out System.Management.ManagementPath Job) {
public uint CreateVirtualHardDisk(string VirtualDiskSettingData, out System.Management.ManagementPath Job) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("ExpandVirtualHardDisk");
inParams["MaxInternalSize"] = ((ulong)(MaxInternalSize));
inParams["Path"] = ((string)(Path));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("ExpandVirtualHardDisk", inParams, null);
inParams = PrivateLateBoundObject.GetMethodParameters("CreateVirtualHardDisk");
inParams["VirtualDiskSettingData"] = ((string)(VirtualDiskSettingData));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("CreateVirtualHardDisk", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
if ((outParams.Properties["Job"] != null))
{
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -955,22 +1096,44 @@
}
}
public uint GetVirtualHardDiskInfo(string Path, out string Info, out System.Management.ManagementPath Job) {
public uint GetVirtualHardDiskSettingData(string Path, out System.Management.ManagementPath Job, out string SettingData) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("GetVirtualHardDiskInfo");
inParams = PrivateLateBoundObject.GetMethodParameters("GetVirtualHardDiskSettingData");
inParams["Path"] = ((string)(Path));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("GetVirtualHardDiskInfo", inParams, null);
Info = System.Convert.ToString(outParams.Properties["Info"].Value);
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("GetVirtualHardDiskSettingData", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
if ((outParams.Properties["Job"] != null))
{
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
SettingData = System.Convert.ToString(outParams.Properties["SettingData"].Value);
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
else {
Info = null;
Job = null;
SettingData = null;
return System.Convert.ToUInt32(0);
}
}
public uint GetVirtualHardDiskState(string Path, out System.Management.ManagementPath Job, out string State) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("GetVirtualHardDiskState");
inParams["Path"] = ((string)(Path));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("GetVirtualHardDiskState", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null))
{
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
State = System.Convert.ToString(outParams.Properties["State"].Value);
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
else {
Job = null;
State = null;
return System.Convert.ToUInt32(0);
}
}
@ -983,8 +1146,9 @@
inParams["SourcePath"] = ((string)(SourcePath));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("MergeVirtualHardDisk", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
if ((outParams.Properties["Job"] != null))
{
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -994,123 +1158,78 @@
}
}
public uint Mount(string Path, out System.Management.ManagementPath Job) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("Mount");
inParams["Path"] = ((string)(Path));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("Mount", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
else {
Job = null;
return System.Convert.ToUInt32(0);
}
}
public uint ReconnectParentVirtualHardDisk(string ChildPath, bool Force, string ParentPath, out System.Management.ManagementPath Job) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("ReconnectParentVirtualHardDisk");
inParams["ChildPath"] = ((string)(ChildPath));
inParams["Force"] = ((bool)(Force));
inParams["ParentPath"] = ((string)(ParentPath));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("ReconnectParentVirtualHardDisk", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
else {
Job = null;
return System.Convert.ToUInt32(0);
}
}
// Converts a given time interval in DMTF format to System.TimeSpan object.
static System.TimeSpan ToTimeSpan(string dmtfTimespan) {
int days = 0;
int hours = 0;
int minutes = 0;
int seconds = 0;
long ticks = 0;
if ((dmtfTimespan == null)) {
throw new System.ArgumentOutOfRangeException();
}
if ((dmtfTimespan.Length == 0)) {
throw new System.ArgumentOutOfRangeException();
}
if ((dmtfTimespan.Length != 25)) {
throw new System.ArgumentOutOfRangeException();
}
if ((dmtfTimespan.Substring(21, 4) != ":000")) {
throw new System.ArgumentOutOfRangeException();
}
try {
string tempString = string.Empty;
tempString = dmtfTimespan.Substring(0, 8);
days = int.Parse(tempString);
tempString = dmtfTimespan.Substring(8, 2);
hours = int.Parse(tempString);
tempString = dmtfTimespan.Substring(10, 2);
minutes = int.Parse(tempString);
tempString = dmtfTimespan.Substring(12, 2);
seconds = int.Parse(tempString);
tempString = dmtfTimespan.Substring(15, 6);
ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000))));
}
catch (System.Exception e) {
throw new System.ArgumentOutOfRangeException(null, e.Message);
}
System.TimeSpan timespan = new System.TimeSpan(days, hours, minutes, seconds, 0);
System.TimeSpan tsTemp = System.TimeSpan.FromTicks(ticks);
timespan = timespan.Add(tsTemp);
return timespan;
}
// Converts a given System.TimeSpan object to DMTF Time interval format.
static string ToDmtfTimeInterval(System.TimeSpan timespan) {
string dmtftimespan = ((int)(timespan.Days)).ToString().PadLeft(8, '0');
System.TimeSpan maxTimeSpan = System.TimeSpan.MaxValue;
if ((timespan.Days > maxTimeSpan.Days)) {
throw new System.ArgumentOutOfRangeException();
}
System.TimeSpan minTimeSpan = System.TimeSpan.MinValue;
if ((timespan.Days < minTimeSpan.Days)) {
throw new System.ArgumentOutOfRangeException();
}
dmtftimespan = string.Concat(dmtftimespan, ((int)(timespan.Hours)).ToString().PadLeft(2, '0'));
dmtftimespan = string.Concat(dmtftimespan, ((int)(timespan.Minutes)).ToString().PadLeft(2, '0'));
dmtftimespan = string.Concat(dmtftimespan, ((int)(timespan.Seconds)).ToString().PadLeft(2, '0'));
dmtftimespan = string.Concat(dmtftimespan, ".");
System.TimeSpan tsTemp = new System.TimeSpan(timespan.Days, timespan.Hours, timespan.Minutes, timespan.Seconds, 0);
long microsec = ((long)((((timespan.Ticks - tsTemp.Ticks)
* 1000)
/ System.TimeSpan.TicksPerMillisecond)));
string strMicroSec = ((long)(microsec)).ToString();
if ((strMicroSec.Length > 6)) {
strMicroSec = strMicroSec.Substring(0, 6);
}
dmtftimespan = string.Concat(dmtftimespan, strMicroSec.PadLeft(6, '0'));
dmtftimespan = string.Concat(dmtftimespan, ":000");
return dmtftimespan;
}
public uint RequestStateChange(ushort RequestedState, System.TimeSpan TimeoutPeriod, out System.Management.ManagementPath Job) {
public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod, out System.Management.ManagementPath Job) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("RequestStateChange");
inParams["RequestedState"] = ((ushort)(RequestedState));
inParams["TimeoutPeriod"] = ToDmtfTimeInterval(((System.TimeSpan)(TimeoutPeriod)));
inParams["TimeoutPeriod"] = ToDmtfDateTime(((System.DateTime)(TimeoutPeriod)));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("RequestStateChange", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
if ((outParams.Properties["Job"] != null))
{
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
else {
Job = null;
return System.Convert.ToUInt32(0);
}
}
public uint ResizeVirtualHardDisk(ulong MaxInternalSize, string Path, out System.Management.ManagementPath Job) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("ResizeVirtualHardDisk");
inParams["MaxInternalSize"] = ((ulong)(MaxInternalSize));
inParams["Path"] = ((string)(Path));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("ResizeVirtualHardDisk", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null))
{
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
else {
Job = null;
return System.Convert.ToUInt32(0);
}
}
public uint SetParentVirtualHardDisk(string ChildPath, bool IgnoreIDMismatch, string LeafPath, string ParentPath, out System.Management.ManagementPath Job) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("SetParentVirtualHardDisk");
inParams["ChildPath"] = ((string)(ChildPath));
inParams["IgnoreIDMismatch"] = ((bool)(IgnoreIDMismatch));
inParams["LeafPath"] = ((string)(LeafPath));
inParams["ParentPath"] = ((string)(ParentPath));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("SetParentVirtualHardDisk", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null))
{
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
else {
Job = null;
return System.Convert.ToUInt32(0);
}
}
public uint SetVirtualHardDiskSettingData(string VirtualDiskSettingData, out System.Management.ManagementPath Job) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("SetVirtualHardDiskSettingData");
inParams["VirtualDiskSettingData"] = ((string)(VirtualDiskSettingData));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("SetVirtualHardDiskSettingData", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null))
{
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -1142,19 +1261,6 @@
}
}
public uint Unmount(string Path) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("Unmount");
inParams["Path"] = ((string)(Path));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("Unmount", inParams, null);
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
else {
return System.Convert.ToUInt32(0);
}
}
public uint ValidateVirtualHardDisk(string Path, out System.Management.ManagementPath Job) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
@ -1162,8 +1268,9 @@
inParams["Path"] = ((string)(Path));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("ValidateVirtualHardDisk", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
if ((outParams.Properties["Job"] != null))
{
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}

View File

@ -1311,8 +1311,9 @@
inParams["TimeoutPeriod"] = ToDmtfDateTime(((System.DateTime)(TimeoutPeriod)));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("RequestStateChange", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
if ((outParams.Properties["Job"] != null))
{
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}

View File

@ -1,4 +1,4 @@
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION {
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
using System;
using System.ComponentModel;
using System.Management;
@ -13,15 +13,14 @@
// Functions Reset<PropertyName> are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL.
// Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used.
// Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa.
// Time interval functions ToTimeSpan and ToDmtfTimeInterval are added to the class to convert DMTF Time Interval to System.TimeSpan and vice-versa.
// An Early Bound class generated for the WMI class.Msvm_SwitchLANEndpoint
public class SwitchLANEndpoint : System.ComponentModel.Component {
// An Early Bound class generated for the WMI class.Msvm_LANEndpoint
public class LANEndpoint : System.ComponentModel.Component {
// Private property to hold the WMI namespace in which the class resides.
private static string CreatedWmiNamespace = "ROOT\\virtualization";
private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2";
// Private property to hold the name of WMI class which created this class.
public static string CreatedClassName = "Msvm_SwitchLANEndpoint";
public static string CreatedClassName = "Msvm_LANEndpoint";
// Private member variable to hold the ManagementScope which is used by the various methods.
private static System.Management.ManagementScope statMgmtScope = null;
@ -44,35 +43,35 @@
private bool isEmbedded;
// Below are different overloads of constructors to initialize an instance of the class with a WMI object.
public SwitchLANEndpoint() {
public LANEndpoint() {
this.InitializeObject(null, null, null);
}
public SwitchLANEndpoint(string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) {
this.InitializeObject(null, new System.Management.ManagementPath(SwitchLANEndpoint.ConstructPath(keyCreationClassName, keyName, keySystemCreationClassName, keySystemName)), null);
public LANEndpoint(string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) {
this.InitializeObject(null, new System.Management.ManagementPath(LANEndpoint.ConstructPath(keyCreationClassName, keyName, keySystemCreationClassName, keySystemName)), null);
}
public SwitchLANEndpoint(System.Management.ManagementScope mgmtScope, string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) {
this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(SwitchLANEndpoint.ConstructPath(keyCreationClassName, keyName, keySystemCreationClassName, keySystemName)), null);
public LANEndpoint(System.Management.ManagementScope mgmtScope, string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) {
this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(LANEndpoint.ConstructPath(keyCreationClassName, keyName, keySystemCreationClassName, keySystemName)), null);
}
public SwitchLANEndpoint(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
public LANEndpoint(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
this.InitializeObject(null, path, getOptions);
}
public SwitchLANEndpoint(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
public LANEndpoint(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
this.InitializeObject(mgmtScope, path, null);
}
public SwitchLANEndpoint(System.Management.ManagementPath path) {
public LANEndpoint(System.Management.ManagementPath path) {
this.InitializeObject(null, path, null);
}
public SwitchLANEndpoint(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
public LANEndpoint(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
this.InitializeObject(mgmtScope, path, getOptions);
}
public SwitchLANEndpoint(System.Management.ManagementObject theObject) {
public LANEndpoint(System.Management.ManagementObject theObject) {
Initialize();
if ((CheckIfProperClass(theObject) == true)) {
PrivateLateBoundObject = theObject;
@ -84,7 +83,7 @@
}
}
public SwitchLANEndpoint(System.Management.ManagementBaseObject theObject) {
public LANEndpoint(System.Management.ManagementBaseObject theObject) {
Initialize();
if ((CheckIfProperClass(theObject) == true)) {
embeddedObj = theObject;
@ -102,7 +101,7 @@
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string OriginatingNamespace {
get {
return "ROOT\\virtualization";
return "ROOT\\virtualization\\v2";
}
}
@ -214,11 +213,27 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ushort[] AvailableRequestedStates {
get {
return ((ushort[])(curObj["AvailableRequestedStates"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string Caption {
get {
return ((string)(curObj["Caption"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsBroadcastResetSupportedNull {
public bool IsCommunicationStatusNull {
get {
if ((curObj["BroadcastResetSupported"] == null)) {
if ((curObj["CommunicationStatus"] == null)) {
return true;
}
else {
@ -230,20 +245,12 @@
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public bool BroadcastResetSupported {
public ushort CommunicationStatus {
get {
if ((curObj["BroadcastResetSupported"] == null)) {
return System.Convert.ToBoolean(0);
if ((curObj["CommunicationStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((bool)(curObj["BroadcastResetSupported"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string Caption {
get {
return ((string)(curObj["Caption"]));
return ((ushort)(curObj["CommunicationStatus"]));
}
}
@ -289,6 +296,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsDetailedStatusNull {
get {
if ((curObj["DetailedStatus"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort DetailedStatus {
get {
if ((curObj["DetailedStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["DetailedStatus"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string ElementName {
@ -407,6 +439,14 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string InstanceID {
get {
return ((string)(curObj["InstanceID"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string LANID {
@ -489,6 +529,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsOperatingStatusNull {
get {
if ((curObj["OperatingStatus"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort OperatingStatus {
get {
if ((curObj["OperatingStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["OperatingStatus"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ushort[] OperationalStatus {
@ -521,6 +586,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsPrimaryStatusNull {
get {
if ((curObj["PrimaryStatus"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort PrimaryStatus {
get {
if ((curObj["PrimaryStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["PrimaryStatus"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsProtocolIFTypeNull {
@ -655,6 +745,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsTransitioningToStateNull {
get {
if ((curObj["TransitioningToState"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort TransitioningToState {
get {
if ((curObj["TransitioningToState"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["TransitioningToState"]));
}
}
private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) {
if (((path != null)
&& (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
@ -684,8 +799,8 @@
return false;
}
private bool ShouldSerializeBroadcastResetSupported() {
if ((this.IsBroadcastResetSupportedNull == false)) {
private bool ShouldSerializeCommunicationStatus() {
if ((this.IsCommunicationStatusNull == false)) {
return true;
}
return false;
@ -698,6 +813,13 @@
return false;
}
private bool ShouldSerializeDetailedStatus() {
if ((this.IsDetailedStatusNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeEnabledDefault() {
if ((this.IsEnabledDefaultNull == false)) {
return true;
@ -864,6 +986,20 @@
return false;
}
private bool ShouldSerializeOperatingStatus() {
if ((this.IsOperatingStatusNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializePrimaryStatus() {
if ((this.IsPrimaryStatusNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeProtocolIFType() {
if ((this.IsProtocolIFTypeNull == false)) {
return true;
@ -892,6 +1028,13 @@
return false;
}
private bool ShouldSerializeTransitioningToState() {
if ((this.IsTransitioningToStateNull == false)) {
return true;
}
return false;
}
[Browsable(true)]
public void CommitObject() {
if ((isEmbedded == false)) {
@ -912,7 +1055,7 @@
}
private static string ConstructPath(string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) {
string strPath = "ROOT\\virtualization:Msvm_SwitchLANEndpoint";
string strPath = "ROOT\\virtualization\\v2:Msvm_LANEndpoint";
strPath = string.Concat(strPath, string.Concat(".CreationClassName=", string.Concat("\"", string.Concat(keyCreationClassName, "\""))));
strPath = string.Concat(strPath, string.Concat(",Name=", string.Concat("\"", string.Concat(keyName, "\""))));
strPath = string.Concat(strPath, string.Concat(",SystemCreationClassName=", string.Concat("\"", string.Concat(keySystemCreationClassName, "\""))));
@ -933,70 +1076,70 @@
}
// Different overloads of GetInstances() help in enumerating instances of the WMI class.
public static SwitchLANEndpointCollection GetInstances() {
public static LANEndpointCollection GetInstances() {
return GetInstances(null, null, null);
}
public static SwitchLANEndpointCollection GetInstances(string condition) {
public static LANEndpointCollection GetInstances(string condition) {
return GetInstances(null, condition, null);
}
public static SwitchLANEndpointCollection GetInstances(string[] selectedProperties) {
public static LANEndpointCollection GetInstances(string[] selectedProperties) {
return GetInstances(null, null, selectedProperties);
}
public static SwitchLANEndpointCollection GetInstances(string condition, string[] selectedProperties) {
public static LANEndpointCollection GetInstances(string condition, string[] selectedProperties) {
return GetInstances(null, condition, selectedProperties);
}
public static SwitchLANEndpointCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
public static LANEndpointCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;
}
}
System.Management.ManagementPath pathObj = new System.Management.ManagementPath();
pathObj.ClassName = "Msvm_SwitchLANEndpoint";
pathObj.NamespacePath = "root\\virtualization";
pathObj.ClassName = "Msvm_LANEndpoint";
pathObj.NamespacePath = "root\\virtualization\\v2";
System.Management.ManagementClass clsObject = new System.Management.ManagementClass(mgmtScope, pathObj, null);
if ((enumOptions == null)) {
enumOptions = new System.Management.EnumerationOptions();
enumOptions.EnsureLocatable = true;
}
return new SwitchLANEndpointCollection(clsObject.GetInstances(enumOptions));
return new LANEndpointCollection(clsObject.GetInstances(enumOptions));
}
public static SwitchLANEndpointCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
public static LANEndpointCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
return GetInstances(mgmtScope, condition, null);
}
public static SwitchLANEndpointCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
public static LANEndpointCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
return GetInstances(mgmtScope, null, selectedProperties);
}
public static SwitchLANEndpointCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
public static LANEndpointCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;
}
}
System.Management.ManagementObjectSearcher ObjectSearcher = new System.Management.ManagementObjectSearcher(mgmtScope, new SelectQuery("Msvm_SwitchLANEndpoint", condition, selectedProperties));
System.Management.ManagementObjectSearcher ObjectSearcher = new System.Management.ManagementObjectSearcher(mgmtScope, new SelectQuery("Msvm_LANEndpoint", condition, selectedProperties));
System.Management.EnumerationOptions enumOptions = new System.Management.EnumerationOptions();
enumOptions.EnsureLocatable = true;
ObjectSearcher.Options = enumOptions;
return new SwitchLANEndpointCollection(ObjectSearcher.Get());
return new LANEndpointCollection(ObjectSearcher.Get());
}
[Browsable(true)]
public static SwitchLANEndpoint CreateInstance() {
public static LANEndpoint CreateInstance() {
System.Management.ManagementScope mgmtScope = null;
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
@ -1007,7 +1150,7 @@
}
System.Management.ManagementPath mgmtPath = new System.Management.ManagementPath(CreatedClassName);
System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null);
return new SwitchLANEndpoint(tmpMgmtClass.CreateInstance());
return new LANEndpoint(tmpMgmtClass.CreateInstance());
}
[Browsable(true)]
@ -1015,96 +1158,16 @@
PrivateLateBoundObject.Delete();
}
public uint BroadcastReset() {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("BroadcastReset", inParams, null);
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
else {
return System.Convert.ToUInt32(0);
}
}
// Converts a given time interval in DMTF format to System.TimeSpan object.
static System.TimeSpan ToTimeSpan(string dmtfTimespan) {
int days = 0;
int hours = 0;
int minutes = 0;
int seconds = 0;
long ticks = 0;
if ((dmtfTimespan == null)) {
throw new System.ArgumentOutOfRangeException();
}
if ((dmtfTimespan.Length == 0)) {
throw new System.ArgumentOutOfRangeException();
}
if ((dmtfTimespan.Length != 25)) {
throw new System.ArgumentOutOfRangeException();
}
if ((dmtfTimespan.Substring(21, 4) != ":000")) {
throw new System.ArgumentOutOfRangeException();
}
try {
string tempString = string.Empty;
tempString = dmtfTimespan.Substring(0, 8);
days = int.Parse(tempString);
tempString = dmtfTimespan.Substring(8, 2);
hours = int.Parse(tempString);
tempString = dmtfTimespan.Substring(10, 2);
minutes = int.Parse(tempString);
tempString = dmtfTimespan.Substring(12, 2);
seconds = int.Parse(tempString);
tempString = dmtfTimespan.Substring(15, 6);
ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000))));
}
catch (System.Exception e) {
throw new System.ArgumentOutOfRangeException(null, e.Message);
}
System.TimeSpan timespan = new System.TimeSpan(days, hours, minutes, seconds, 0);
System.TimeSpan tsTemp = System.TimeSpan.FromTicks(ticks);
timespan = timespan.Add(tsTemp);
return timespan;
}
// Converts a given System.TimeSpan object to DMTF Time interval format.
static string ToDmtfTimeInterval(System.TimeSpan timespan) {
string dmtftimespan = ((int)(timespan.Days)).ToString().PadLeft(8, '0');
System.TimeSpan maxTimeSpan = System.TimeSpan.MaxValue;
if ((timespan.Days > maxTimeSpan.Days)) {
throw new System.ArgumentOutOfRangeException();
}
System.TimeSpan minTimeSpan = System.TimeSpan.MinValue;
if ((timespan.Days < minTimeSpan.Days)) {
throw new System.ArgumentOutOfRangeException();
}
dmtftimespan = string.Concat(dmtftimespan, ((int)(timespan.Hours)).ToString().PadLeft(2, '0'));
dmtftimespan = string.Concat(dmtftimespan, ((int)(timespan.Minutes)).ToString().PadLeft(2, '0'));
dmtftimespan = string.Concat(dmtftimespan, ((int)(timespan.Seconds)).ToString().PadLeft(2, '0'));
dmtftimespan = string.Concat(dmtftimespan, ".");
System.TimeSpan tsTemp = new System.TimeSpan(timespan.Days, timespan.Hours, timespan.Minutes, timespan.Seconds, 0);
long microsec = ((long)((((timespan.Ticks - tsTemp.Ticks)
* 1000)
/ System.TimeSpan.TicksPerMillisecond)));
string strMicroSec = ((long)(microsec)).ToString();
if ((strMicroSec.Length > 6)) {
strMicroSec = strMicroSec.Substring(0, 6);
}
dmtftimespan = string.Concat(dmtftimespan, strMicroSec.PadLeft(6, '0'));
dmtftimespan = string.Concat(dmtftimespan, ":000");
return dmtftimespan;
}
public uint RequestStateChange(ushort RequestedState, System.TimeSpan TimeoutPeriod, out System.Management.ManagementPath Job) {
public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod, out System.Management.ManagementPath Job) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("RequestStateChange");
inParams["RequestedState"] = ((ushort)(RequestedState));
inParams["TimeoutPeriod"] = ToDmtfTimeInterval(((System.TimeSpan)(TimeoutPeriod)));
inParams["TimeoutPeriod"] = ToDmtfDateTime(((System.DateTime)(TimeoutPeriod)));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("RequestStateChange", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
if ((outParams.Properties["Job"] != null) && outParams.Properties["Job"].Value != null) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].Value.ToString());
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -1115,11 +1178,11 @@
}
// Enumerator implementation for enumerating instances of the class.
public class SwitchLANEndpointCollection : object, ICollection {
public class LANEndpointCollection : object, ICollection {
private ManagementObjectCollection privColObj;
public SwitchLANEndpointCollection(ManagementObjectCollection objCollection) {
public LANEndpointCollection(ManagementObjectCollection objCollection) {
privColObj = objCollection;
}
@ -1145,25 +1208,25 @@
privColObj.CopyTo(array, index);
int nCtr;
for (nCtr = 0; (nCtr < array.Length); nCtr = (nCtr + 1)) {
array.SetValue(new SwitchLANEndpoint(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
array.SetValue(new LANEndpoint(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
}
}
public virtual System.Collections.IEnumerator GetEnumerator() {
return new SwitchLANEndpointEnumerator(privColObj.GetEnumerator());
return new LANEndpointEnumerator(privColObj.GetEnumerator());
}
public class SwitchLANEndpointEnumerator : object, System.Collections.IEnumerator {
public class LANEndpointEnumerator : object, System.Collections.IEnumerator {
private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum;
public SwitchLANEndpointEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
public LANEndpointEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
privObjEnum = objEnum;
}
public virtual object Current {
get {
return new SwitchLANEndpoint(((System.Management.ManagementObject)(privObjEnum.Current)));
return new LANEndpoint(((System.Management.ManagementObject)(privObjEnum.Current)));
}
}

View File

@ -1,4 +1,4 @@
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION {
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
using System;
using System.ComponentModel;
using System.Management;
@ -16,7 +16,7 @@
public class MemorySettingData : System.ComponentModel.Component {
// Private property to hold the WMI namespace in which the class resides.
private static string CreatedWmiNamespace = "ROOT\\virtualization";
private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2";
// Private property to hold the name of WMI class which created this class.
public static string CreatedClassName = "Msvm_MemorySettingData";
@ -100,7 +100,7 @@
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string OriginatingNamespace {
get {
return "ROOT\\virtualization";
return "ROOT\\virtualization\\v2";
}
}
@ -212,6 +212,14 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string AddressOnParent {
get {
return ((string)(curObj["AddressOnParent"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string AllocationUnits {
@ -319,26 +327,6 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("Address or other identifying information to uniquely name the logical device. Thi" +
"s property is always set to \"Microsoft:GUID\".")]
public string DeviceID {
get {
return ((string)(curObj["DeviceID"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The format of the corresponding DeviceID property, or the supported device IDs wh" +
"en used to represent a capability. This property is not used.")]
public string DeviceIDFormat {
get {
return ((string)(curObj["DeviceIDFormat"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsDynamicMemoryEnabledNull {
@ -354,7 +342,7 @@
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("Reserved for future use.")]
[Description("Indicates if dynamic memory is enabled.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public bool DynamicMemoryEnabled {
get {
@ -465,6 +453,33 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsMaxMemoryBlocksPerNumaNodeNull {
get {
if ((curObj["MaxMemoryBlocksPerNumaNode"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The maximum amount of memory that can be observed within the VM as belonging to a" +
" single NUMA node.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ulong MaxMemoryBlocksPerNumaNode {
get {
if ((curObj["MaxMemoryBlocksPerNumaNode"] == null)) {
return System.Convert.ToUInt64(0);
}
return ((ulong)(curObj["MaxMemoryBlocksPerNumaNode"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string OtherResourceType {
@ -547,6 +562,32 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsSwapFilesInUseNull {
get {
if ((curObj["SwapFilesInUse"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("Indicates if smart paging is active.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public bool SwapFilesInUse {
get {
if ((curObj["SwapFilesInUse"] == null)) {
return System.Convert.ToBoolean(0);
}
return ((bool)(curObj["SwapFilesInUse"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsTargetMemoryBufferNull {
@ -597,6 +638,14 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string VirtualQuantityUnits {
get {
return ((string)(curObj["VirtualQuantityUnits"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsWeightNull {
@ -700,6 +749,13 @@
return false;
}
private bool ShouldSerializeMaxMemoryBlocksPerNumaNode() {
if ((this.IsMaxMemoryBlocksPerNumaNodeNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeReservation() {
if ((this.IsReservationNull == false)) {
return true;
@ -714,6 +770,13 @@
return false;
}
private bool ShouldSerializeSwapFilesInUse() {
if ((this.IsSwapFilesInUseNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeTargetMemoryBuffer() {
if ((this.IsTargetMemoryBufferNull == false)) {
return true;
@ -755,7 +818,7 @@
}
private static string ConstructPath(string keyInstanceID) {
string strPath = "ROOT\\virtualization:Msvm_MemorySettingData";
string strPath = "ROOT\\virtualization\\v2:Msvm_MemorySettingData";
strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\""))));
return strPath;
}
@ -793,7 +856,7 @@
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;
@ -801,7 +864,7 @@
}
System.Management.ManagementPath pathObj = new System.Management.ManagementPath();
pathObj.ClassName = "Msvm_MemorySettingData";
pathObj.NamespacePath = "root\\virtualization";
pathObj.NamespacePath = "root\\virtualization\\v2";
System.Management.ManagementClass clsObject = new System.Management.ManagementClass(mgmtScope, pathObj, null);
if ((enumOptions == null)) {
enumOptions = new System.Management.EnumerationOptions();
@ -822,7 +885,7 @@
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;

View File

@ -1,4 +1,4 @@
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION {
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
using System;
using System.ComponentModel;
using System.Management;
@ -16,7 +16,7 @@
public class ProcessorSettingData : System.ComponentModel.Component {
// Private property to hold the WMI namespace in which the class resides.
private static string CreatedWmiNamespace = "ROOT\\virtualization";
private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2";
// Private property to hold the name of WMI class which created this class.
public static string CreatedClassName = "Msvm_ProcessorSettingData";
@ -100,7 +100,7 @@
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string OriginatingNamespace {
get {
return "ROOT\\virtualization";
return "ROOT\\virtualization\\v2";
}
}
@ -212,6 +212,14 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string AddressOnParent {
get {
return ((string)(curObj["AddressOnParent"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string AllocationUnits {
@ -319,26 +327,6 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("Address or other identifying information to uniquely name the logical device.\n Th" +
"is property is always set to \"Microsoft:GUID\".")]
public string DeviceID {
get {
return ((string)(curObj["DeviceID"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The format of the corresponding device ID, or the supported device IDs when used " +
"to represent a capability.\nThis property is not used.")]
public string DeviceIDFormat {
get {
return ((string)(curObj["DeviceIDFormat"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string ElementName {
@ -363,32 +351,6 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsIsVirtualizedNull {
get {
if ((curObj["IsVirtualized"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description(@"Indicates whether this device is virtualized or passed through, possibly using partitioning. When set to False, the underlying or host resource is utilized. At least one item shall be present in the DeviceID property. When set to True, the resource is virtualized and may not map directly to an underlying/host resource. Some implementations may support specific assignment for virtualized resources, in which case the host resource(s) are exposed using the DeviceID property. This property is set to True.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public bool IsVirtualized {
get {
if ((curObj["IsVirtualized"] == null)) {
return System.Convert.ToBoolean(0);
}
return ((bool)(curObj["IsVirtualized"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsLimitNull {
@ -429,8 +391,9 @@
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description(@"Indicates whether the virtual machine should lower the CPU identifier. Some older operating systems may require you to limit processor functionality in this way in order to run.
This is a read-only property, but it can be changed using the ModifyVirtualSystemResources method of the Msvm_VirtualSystemManagementService class.")]
[Description("Indicates whether the virtual machine should lower the CPU identifier. Some older" +
" operating systems may require you to limit processor functionality in this way " +
"in order to run.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public bool LimitCPUID {
get {
@ -456,8 +419,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description(@"Indicates whether the VM should limit the CPU features exposed to the operating system. Limiting the processor features enables the VM to be migrated to different host computer systems with different processors. Migrating VMs between computers with processors from different vendors is not supported.
Windows Server 2008: The LimitProcessorFeatures property is not supported until Windows Server 2008 R2.")]
[Description(@"Indicates whether the VM should limit the CPU features exposed to the operating system. Limiting the processor features enables the VM to be migrated to different host computer systems with different processors. Migrating VMs between computers with processors from different vendors is not supported.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public bool LimitProcessorFeatures {
get {
@ -493,6 +455,60 @@ Windows Server 2008: The LimitProcessorFeatures property is not supported until
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsMaxNumaNodesPerSocketNull {
get {
if ((curObj["MaxNumaNodesPerSocket"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The maximum number of NUMA nodes that can be observed within the VM as belonging " +
"to a single processor socket.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ulong MaxNumaNodesPerSocket {
get {
if ((curObj["MaxNumaNodesPerSocket"] == null)) {
return System.Convert.ToUInt64(0);
}
return ((ulong)(curObj["MaxNumaNodesPerSocket"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsMaxProcessorsPerNumaNodeNull {
get {
if ((curObj["MaxProcessorsPerNumaNode"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The maximum number of virtual processors that can be observed within the VM as be" +
"longing to a single virtual NUMA node.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ulong MaxProcessorsPerNumaNode {
get {
if ((curObj["MaxProcessorsPerNumaNode"] == null)) {
return System.Convert.ToUInt64(0);
}
return ((ulong)(curObj["MaxProcessorsPerNumaNode"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string OtherResourceType {
@ -517,33 +533,6 @@ Windows Server 2008: The LimitProcessorFeatures property is not supported until
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsProcessorsPerSocketNull {
get {
if ((curObj["ProcessorsPerSocket"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The number of processors, or cores, configured for each socket in the virtual sys" +
"tem.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort ProcessorsPerSocket {
get {
if ((curObj["ProcessorsPerSocket"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["ProcessorsPerSocket"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsReservationNull {
@ -602,62 +591,6 @@ Windows Server 2008: The LimitProcessorFeatures property is not supported until
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsSocketCountNull {
get {
if ((curObj["SocketCount"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The number of processor sockets in the virtual machine. The total number of proce" +
"ssors is the value of this property times the value of the ProcessorsPerSocket p" +
"roperty.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort SocketCount {
get {
if ((curObj["SocketCount"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["SocketCount"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsThreadsEnabledNull {
get {
if ((curObj["ThreadsEnabled"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("Indicates whether hardware threads should be visible to the virtual system. If th" +
"e physical processor does not support hardware threads, this value has no effect" +
" in the virtual system.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public bool ThreadsEnabled {
get {
if ((curObj["ThreadsEnabled"] == null)) {
return System.Convert.ToBoolean(0);
}
return ((bool)(curObj["ThreadsEnabled"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsVirtualQuantityNull {
@ -683,6 +616,14 @@ Windows Server 2008: The LimitProcessorFeatures property is not supported until
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string VirtualQuantityUnits {
get {
return ((string)(curObj["VirtualQuantityUnits"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsWeightNull {
@ -758,13 +699,6 @@ Windows Server 2008: The LimitProcessorFeatures property is not supported until
return false;
}
private bool ShouldSerializeIsVirtualized() {
if ((this.IsIsVirtualizedNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeLimit() {
if ((this.IsLimitNull == false)) {
return true;
@ -793,8 +727,15 @@ Windows Server 2008: The LimitProcessorFeatures property is not supported until
return false;
}
private bool ShouldSerializeProcessorsPerSocket() {
if ((this.IsProcessorsPerSocketNull == false)) {
private bool ShouldSerializeMaxNumaNodesPerSocket() {
if ((this.IsMaxNumaNodesPerSocketNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeMaxProcessorsPerNumaNode() {
if ((this.IsMaxProcessorsPerNumaNodeNull == false)) {
return true;
}
return false;
@ -814,20 +755,6 @@ Windows Server 2008: The LimitProcessorFeatures property is not supported until
return false;
}
private bool ShouldSerializeSocketCount() {
if ((this.IsSocketCountNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeThreadsEnabled() {
if ((this.IsThreadsEnabledNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeVirtualQuantity() {
if ((this.IsVirtualQuantityNull == false)) {
return true;
@ -862,7 +789,7 @@ Windows Server 2008: The LimitProcessorFeatures property is not supported until
}
private static string ConstructPath(string keyInstanceID) {
string strPath = "ROOT\\virtualization:Msvm_ProcessorSettingData";
string strPath = "ROOT\\virtualization\\v2:Msvm_ProcessorSettingData";
strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\""))));
return strPath;
}
@ -900,7 +827,7 @@ Windows Server 2008: The LimitProcessorFeatures property is not supported until
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;
@ -908,7 +835,7 @@ Windows Server 2008: The LimitProcessorFeatures property is not supported until
}
System.Management.ManagementPath pathObj = new System.Management.ManagementPath();
pathObj.ClassName = "Msvm_ProcessorSettingData";
pathObj.NamespacePath = "root\\virtualization";
pathObj.NamespacePath = "root\\virtualization\\v2";
System.Management.ManagementClass clsObject = new System.Management.ManagementClass(mgmtScope, pathObj, null);
if ((enumOptions == null)) {
enumOptions = new System.Management.EnumerationOptions();
@ -929,7 +856,7 @@ Windows Server 2008: The LimitProcessorFeatures property is not supported until
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;

View File

@ -1,4 +1,5 @@
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION {
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
{
using System;
using System.ComponentModel;
using System.Management;
@ -16,7 +17,7 @@
public class ResourceAllocationSettingData : System.ComponentModel.Component {
// Private property to hold the WMI namespace in which the class resides.
private static string CreatedWmiNamespace = "ROOT\\virtualization";
private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2";
// Private property to hold the name of WMI class which created this class.
public static string CreatedClassName = "Msvm_ResourceAllocationSettingData";
@ -100,7 +101,7 @@
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string OriginatingNamespace {
get {
return "ROOT\\virtualization";
return "ROOT\\virtualization\\v2";
}
}
@ -212,6 +213,14 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string AddressOnParent {
get {
return ((string)(curObj["AddressOnParent"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string AllocationUnits {
@ -500,6 +509,14 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string VirtualQuantityUnits {
get {
return ((string)(curObj["VirtualQuantityUnits"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description(@"A free-form string array of identifiers of this resource presented to the virtual computer system's operating system. These values are only used if the ResourceType property is set to 6 (Parallel SCSI HBA) and the ResourceSubType property is set to ""Microsoft Synthetic SCSI Controller"". This property is set to ""GUID"".
@ -648,7 +665,7 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt
}
private static string ConstructPath(string keyInstanceID) {
string strPath = "ROOT\\virtualization:Msvm_ResourceAllocationSettingData";
string strPath = "ROOT\\virtualization\\v2:Msvm_ResourceAllocationSettingData";
strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\""))));
return strPath;
}
@ -686,7 +703,7 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;
@ -694,7 +711,7 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt
}
System.Management.ManagementPath pathObj = new System.Management.ManagementPath();
pathObj.ClassName = "Msvm_ResourceAllocationSettingData";
pathObj.NamespacePath = "root\\virtualization";
pathObj.NamespacePath = "root\\virtualization\\v2";
System.Management.ManagementClass clsObject = new System.Management.ManagementClass(mgmtScope, pathObj, null);
if ((enumOptions == null)) {
enumOptions = new System.Management.EnumerationOptions();
@ -715,7 +732,7 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;

View File

@ -1,4 +1,4 @@
namespace CloudStack.Plugin.AgentShell.ROOT.VIRTUALIZATION {
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
using System;
using System.ComponentModel;
using System.Management;
@ -56,7 +56,7 @@
public class SummaryInformation : System.ComponentModel.Component {
// Private property to hold the WMI namespace in which the class resides.
private static string CreatedWmiNamespace = "ROOT\\virtualization";
private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2";
// Private property to hold the name of WMI class which created this class.
private static string CreatedClassName = "Msvm_SummaryInformation";
@ -132,7 +132,7 @@
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string OriginatingNamespace {
get {
return "ROOT\\virtualization";
return "ROOT\\virtualization\\v2";
}
}
@ -246,6 +246,32 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsApplicationHealthNull {
get {
if ((curObj["ApplicationHealth"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description(@"The current application health status for the virtual system. This property may be one of the following values: ""OK""; ""Application Critical""; ""Disabled"".For more information, see the documentation for the StatusDescriptions property of the Msvm_HeartbeatComponent class. This property is not valid for instances of Msvm_SummaryInformation representing a virtual system snapshot.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ApplicationHealthValues ApplicationHealth {
get {
if ((curObj["ApplicationHealth"] == null)) {
return ((ApplicationHealthValues)(System.Convert.ToInt32(0)));
}
return ((ApplicationHealthValues)(System.Convert.ToInt32(curObj["ApplicationHealth"])));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("An array of Msvm_ConcreteJob instances representing any asynchronous operations r" +
@ -411,6 +437,33 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsIntegrationServicesVersionStateNull {
get {
if ((curObj["IntegrationServicesVersionState"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("Whether or not the integration services installed in the virtual machine are up t" +
"o date")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public IntegrationServicesVersionStateValues IntegrationServicesVersionState {
get {
if ((curObj["IntegrationServicesVersionState"] == null)) {
return ((IntegrationServicesVersionStateValues)(System.Convert.ToInt32(3)));
}
return ((IntegrationServicesVersionStateValues)(System.Convert.ToInt32(curObj["IntegrationServicesVersionState"])));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsMemoryAvailableNull {
@ -437,6 +490,34 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsMemorySpansPhysicalNumaNodesNull {
get {
if ((curObj["MemorySpansPhysicalNumaNodes"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("Indicates whether or not the memory of the one or more of the virtual non-uniform" +
" memory access (NUMA) nodes of the virtual machine spans multiple physical NUMA " +
"nodes of the hosting computer system.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public bool MemorySpansPhysicalNumaNodes {
get {
if ((curObj["MemorySpansPhysicalNumaNodes"] == null)) {
return System.Convert.ToBoolean(0);
}
return ((bool)(curObj["MemorySpansPhysicalNumaNodes"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsMemoryUsageNull {
@ -518,6 +599,17 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("A string that describes the enabled or disabled state of the element when the Ena" +
"bledState property is set to 1 (\"Other\"). This property must be set to null when" +
" EnabledState is any value other than 1.")]
public string OtherEnabledState {
get {
return ((string)(curObj["OtherEnabledState"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsProcessorLoadNull {
@ -556,6 +648,84 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsReplicationHealthNull {
get {
if ((curObj["ReplicationHealth"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("Replication health for the virtual machine.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ReplicationHealthValues ReplicationHealth {
get {
if ((curObj["ReplicationHealth"] == null)) {
return ((ReplicationHealthValues)(System.Convert.ToInt32(4)));
}
return ((ReplicationHealthValues)(System.Convert.ToInt32(curObj["ReplicationHealth"])));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsReplicationModeNull {
get {
if ((curObj["ReplicationMode"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("Identifies replication type for the virtual machine.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ReplicationModeValues ReplicationMode {
get {
if ((curObj["ReplicationMode"] == null)) {
return ((ReplicationModeValues)(System.Convert.ToInt32(4)));
}
return ((ReplicationModeValues)(System.Convert.ToInt32(curObj["ReplicationMode"])));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsReplicationStateNull {
get {
if ((curObj["ReplicationState"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("Replication state for the virtual machine.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ReplicationStateValues ReplicationState {
get {
if ((curObj["ReplicationState"] == null)) {
return ((ReplicationStateValues)(System.Convert.ToInt32(12)));
}
return ((ReplicationStateValues)(System.Convert.ToInt32(curObj["ReplicationState"])));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("An array of Msvm_VirtualSystemSettingData instances representing the snapshots fo" +
@ -576,6 +746,46 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsSwapFilesInUseNull {
get {
if ((curObj["SwapFilesInUse"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("Indecates if smart paging is active.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public bool SwapFilesInUse {
get {
if ((curObj["SwapFilesInUse"] == null)) {
return System.Convert.ToBoolean(0);
}
return ((bool)(curObj["SwapFilesInUse"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("Reference to the CIM_ComputerSystem instance representing the test replica virtua" +
"l system for the virtual machine. This property is not valid for instances of Ms" +
"vm_SummaryInformation representing a virtual system snapshot.")]
public System.Management.ManagementPath TestReplicaSystem {
get {
if ((curObj["TestReplicaSystem"] != null)) {
return new System.Management.ManagementPath(curObj["TestReplicaSystem"].ToString());
}
return null;
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("An array containing a small, thumbnail-sized image of the desktop for the virtual" +
@ -643,6 +853,13 @@
return false;
}
private bool ShouldSerializeApplicationHealth() {
if ((this.IsApplicationHealthNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeAvailableMemoryBuffer() {
if ((this.IsAvailableMemoryBufferNull == false)) {
return true;
@ -802,6 +1019,13 @@
return false;
}
private bool ShouldSerializeIntegrationServicesVersionState() {
if ((this.IsIntegrationServicesVersionStateNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeMemoryAvailable() {
if ((this.IsMemoryAvailableNull == false)) {
return true;
@ -809,6 +1033,13 @@
return false;
}
private bool ShouldSerializeMemorySpansPhysicalNumaNodes() {
if ((this.IsMemorySpansPhysicalNumaNodesNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeMemoryUsage() {
if ((this.IsMemoryUsageNull == false)) {
return true;
@ -830,6 +1061,34 @@
return false;
}
private bool ShouldSerializeReplicationHealth() {
if ((this.IsReplicationHealthNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeReplicationMode() {
if ((this.IsReplicationModeNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeReplicationState() {
if ((this.IsReplicationStateNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeSwapFilesInUse() {
if ((this.IsSwapFilesInUseNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeUpTime() {
if ((this.IsUpTimeNull == false)) {
return true;
@ -857,7 +1116,7 @@
}
private static string ConstructPath() {
string strPath = "ROOT\\virtualization:Msvm_SummaryInformation";
string strPath = "ROOT\\virtualization\\v2:Msvm_SummaryInformation";
return strPath;
}
@ -894,7 +1153,7 @@
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;
@ -902,7 +1161,7 @@
}
System.Management.ManagementPath pathObj = new System.Management.ManagementPath();
pathObj.ClassName = "Msvm_SummaryInformation";
pathObj.NamespacePath = "root\\virtualization";
pathObj.NamespacePath = "root\\virtualization\\v2";
System.Management.ManagementClass clsObject = new System.Management.ManagementClass(mgmtScope, pathObj, null);
if ((enumOptions == null)) {
enumOptions = new System.Management.EnumerationOptions();
@ -923,7 +1182,7 @@
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;
@ -956,6 +1215,83 @@
PrivateLateBoundObject.Delete();
}
public enum ApplicationHealthValues {
OK = 2,
Application_Critical = 32782,
Disabled = 32896,
NULL_ENUM_VALUE = 0,
}
public enum IntegrationServicesVersionStateValues {
Unknown0 = 0,
UpToDate = 1,
Mismatch = 2,
NULL_ENUM_VALUE = 3,
}
public enum ReplicationHealthValues {
Not_applicable = 0,
Ok = 1,
Warning = 2,
Critical = 3,
NULL_ENUM_VALUE = 4,
}
public enum ReplicationModeValues {
None = 0,
Primary = 1,
Recovery = 2,
Test_Replica = 3,
NULL_ENUM_VALUE = 4,
}
public enum ReplicationStateValues {
Disabled = 0,
Ready_for_replication = 1,
Waiting_to_complete_initial_replication = 2,
Replicating = 3,
Synced_replication_complete = 4,
Recovered = 5,
Committed = 6,
Suspended = 7,
Critical = 8,
Waiting_to_start_resynchronization = 9,
Resynchronizing = 10,
Resynchronization_suspended = 11,
NULL_ENUM_VALUE = 12,
}
// Enumerator implementation for enumerating instances of the class.
public class SummaryInformationCollection : object, ICollection {

View File

@ -1,4 +1,4 @@
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION {
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
using System;
using System.ComponentModel;
using System.Management;
@ -16,7 +16,7 @@
public class SyntheticEthernetPortSettingData : System.ComponentModel.Component {
// Private property to hold the WMI namespace in which the class resides.
private static string CreatedWmiNamespace = "ROOT\\virtualization";
private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2";
// Private property to hold the name of WMI class which created this class.
public static string CreatedClassName = "Msvm_SyntheticEthernetPortSettingData";
@ -100,7 +100,7 @@
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string OriginatingNamespace {
get {
return "ROOT\\virtualization";
return "ROOT\\virtualization\\v2";
}
}
@ -212,6 +212,14 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string AddressOnParent {
get {
return ((string)(curObj["AddressOnParent"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string AllocationUnits {
@ -319,6 +327,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsDesiredVLANEndpointModeNull {
get {
if ((curObj["DesiredVLANEndpointMode"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort DesiredVLANEndpointMode {
get {
if ((curObj["DesiredVLANEndpointMode"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["DesiredVLANEndpointMode"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string ElementName {
@ -393,6 +426,14 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string OtherEndpointMode {
get {
return ((string)(curObj["OtherEndpointMode"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string OtherResourceType {
@ -528,6 +569,14 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string VirtualQuantityUnits {
get {
return ((string)(curObj["VirtualQuantityUnits"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description(@"A free-form string array of identifiers of this resource presented to the virtual computer system's operating system. The indexes and values per index are defined on a per resource basis (that is, for each enumerated ResourceType value). This property is set to ""GUID"".
@ -613,6 +662,13 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
return false;
}
private bool ShouldSerializeDesiredVLANEndpointMode() {
if ((this.IsDesiredVLANEndpointModeNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeLimit() {
if ((this.IsLimitNull == false)) {
return true;
@ -682,7 +738,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
}
private static string ConstructPath(string keyInstanceID) {
string strPath = "ROOT\\virtualization:Msvm_SyntheticEthernetPortSettingData";
string strPath = "ROOT\\virtualization\\v2:Msvm_SyntheticEthernetPortSettingData";
strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\""))));
return strPath;
}
@ -720,7 +776,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;
@ -728,7 +784,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
}
System.Management.ManagementPath pathObj = new System.Management.ManagementPath();
pathObj.ClassName = "Msvm_SyntheticEthernetPortSettingData";
pathObj.NamespacePath = "root\\virtualization";
pathObj.NamespacePath = "root\\virtualization\\v2";
System.Management.ManagementClass clsObject = new System.Management.ManagementClass(mgmtScope, pathObj, null);
if ((enumOptions == null)) {
enumOptions = new System.Management.EnumerationOptions();
@ -749,7 +805,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;

View File

@ -1,4 +1,4 @@
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION {
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
using System;
using System.ComponentModel;
using System.Management;
@ -13,15 +13,14 @@
// Functions Reset<PropertyName> are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL.
// Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used.
// Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa.
// Time interval functions ToTimeSpan and ToDmtfTimeInterval are added to the class to convert DMTF Time Interval to System.TimeSpan and vice-versa.
// An Early Bound class generated for the WMI class.Msvm_VirtualSwitch
public class VirtualSwitch : System.ComponentModel.Component {
// An Early Bound class generated for the WMI class.Msvm_VirtualEthernetSwitch
public class VirtualEthernetSwitch : System.ComponentModel.Component {
// Private property to hold the WMI namespace in which the class resides.
private static string CreatedWmiNamespace = "ROOT\\virtualization";
private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2";
// Private property to hold the name of WMI class which created this class.
public static string CreatedClassName = "Msvm_VirtualSwitch";
public static string CreatedClassName = "Msvm_VirtualEthernetSwitch";
// Private member variable to hold the ManagementScope which is used by the various methods.
private static System.Management.ManagementScope statMgmtScope = null;
@ -44,35 +43,35 @@
private bool isEmbedded;
// Below are different overloads of constructors to initialize an instance of the class with a WMI object.
public VirtualSwitch() {
public VirtualEthernetSwitch() {
this.InitializeObject(null, null, null);
}
public VirtualSwitch(string keyCreationClassName, string keyName) {
this.InitializeObject(null, new System.Management.ManagementPath(VirtualSwitch.ConstructPath(keyCreationClassName, keyName)), null);
public VirtualEthernetSwitch(string keyCreationClassName, string keyName) {
this.InitializeObject(null, new System.Management.ManagementPath(VirtualEthernetSwitch.ConstructPath(keyCreationClassName, keyName)), null);
}
public VirtualSwitch(System.Management.ManagementScope mgmtScope, string keyCreationClassName, string keyName) {
this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(VirtualSwitch.ConstructPath(keyCreationClassName, keyName)), null);
public VirtualEthernetSwitch(System.Management.ManagementScope mgmtScope, string keyCreationClassName, string keyName) {
this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(VirtualEthernetSwitch.ConstructPath(keyCreationClassName, keyName)), null);
}
public VirtualSwitch(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
public VirtualEthernetSwitch(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
this.InitializeObject(null, path, getOptions);
}
public VirtualSwitch(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
public VirtualEthernetSwitch(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
this.InitializeObject(mgmtScope, path, null);
}
public VirtualSwitch(System.Management.ManagementPath path) {
public VirtualEthernetSwitch(System.Management.ManagementPath path) {
this.InitializeObject(null, path, null);
}
public VirtualSwitch(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
public VirtualEthernetSwitch(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
this.InitializeObject(mgmtScope, path, getOptions);
}
public VirtualSwitch(System.Management.ManagementObject theObject) {
public VirtualEthernetSwitch(System.Management.ManagementObject theObject) {
Initialize();
if ((CheckIfProperClass(theObject) == true)) {
PrivateLateBoundObject = theObject;
@ -84,7 +83,7 @@
}
}
public VirtualSwitch(System.Management.ManagementBaseObject theObject) {
public VirtualEthernetSwitch(System.Management.ManagementBaseObject theObject) {
Initialize();
if ((CheckIfProperClass(theObject) == true)) {
embeddedObj = theObject;
@ -102,7 +101,7 @@
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string OriginatingNamespace {
get {
return "ROOT\\virtualization";
return "ROOT\\virtualization\\v2";
}
}
@ -206,6 +205,14 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ushort[] AvailableRequestedStates {
get {
return ((ushort[])(curObj["AvailableRequestedStates"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string Caption {
@ -214,6 +221,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsCommunicationStatusNull {
get {
if ((curObj["CommunicationStatus"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort CommunicationStatus {
get {
if ((curObj["CommunicationStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["CommunicationStatus"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string CreationClassName {
@ -238,6 +270,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsDetailedStatusNull {
get {
if ((curObj["DetailedStatus"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort DetailedStatus {
get {
if ((curObj["DetailedStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["DetailedStatus"]));
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string ElementName {
@ -356,11 +413,19 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string InstanceID {
get {
return ((string)(curObj["InstanceID"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsMaxChimneyOffloadsNull {
public bool IsMaxIOVOffloadsNull {
get {
if ((curObj["MaxChimneyOffloads"] == null)) {
if ((curObj["MaxIOVOffloads"] == null)) {
return true;
}
else {
@ -371,14 +436,14 @@
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The maximum number of Chimney offloads allowed for a port on this switch.")]
[Description("The maximum number of SR-IOV Virtual Function offloads available on this switch.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public uint MaxChimneyOffloads {
public uint MaxIOVOffloads {
get {
if ((curObj["MaxChimneyOffloads"] == null)) {
if ((curObj["MaxIOVOffloads"] == null)) {
return System.Convert.ToUInt32(0);
}
return ((uint)(curObj["MaxChimneyOffloads"]));
return ((uint)(curObj["MaxIOVOffloads"]));
}
}
@ -397,7 +462,7 @@
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The maximum number of VM queue (VMQ) offloads allowed for a port on this switch.")]
[Description("The maximum number of VMQ offloads allowed for a port on this switch.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public uint MaxVMQOffloads {
get {
@ -406,6 +471,13 @@
}
return ((uint)(curObj["MaxVMQOffloads"]));
}
set {
curObj["MaxVMQOffloads"] = value;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
}
}
}
[Browsable(true)]
@ -426,9 +498,9 @@
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsNumLearnableAddressesNull {
public bool IsOperatingStatusNull {
get {
if ((curObj["NumLearnableAddresses"] == null)) {
if ((curObj["OperatingStatus"] == null)) {
return true;
}
else {
@ -439,14 +511,13 @@
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The number of learnable addresses for this switch.")]
[TypeConverter(typeof(WMIValueTypeConverter))]
public uint NumLearnableAddresses {
public ushort OperatingStatus {
get {
if ((curObj["NumLearnableAddresses"] == null)) {
return System.Convert.ToUInt32(0);
if ((curObj["OperatingStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((uint)(curObj["NumLearnableAddresses"]));
return ((ushort)(curObj["OperatingStatus"]));
}
}
@ -506,6 +577,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsPrimaryStatusNull {
get {
if ((curObj["PrimaryStatus"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort PrimaryStatus {
get {
if ((curObj["PrimaryStatus"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["PrimaryStatus"]));
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsRequestedStateNull {
@ -564,22 +660,6 @@
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("The authorization manager scope for the switch service.")]
public string ScopeOfResidence {
get {
return ((string)(curObj["ScopeOfResidence"]));
}
set {
curObj["ScopeOfResidence"] = value;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string Status {
@ -623,6 +703,31 @@
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsTransitioningToStateNull {
get {
if ((curObj["TransitioningToState"] == null)) {
return true;
}
else {
return false;
}
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[TypeConverter(typeof(WMIValueTypeConverter))]
public ushort TransitioningToState {
get {
if ((curObj["TransitioningToState"] == null)) {
return System.Convert.ToUInt16(0);
}
return ((ushort)(curObj["TransitioningToState"]));
}
}
private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) {
if (((path != null)
&& (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
@ -652,6 +757,20 @@
return false;
}
private bool ShouldSerializeCommunicationStatus() {
if ((this.IsCommunicationStatusNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeDetailedStatus() {
if ((this.IsDetailedStatusNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializeEnabledDefault() {
if ((this.IsEnabledDefaultNull == false)) {
return true;
@ -804,8 +923,8 @@
return false;
}
private bool ShouldSerializeMaxChimneyOffloads() {
if ((this.IsMaxChimneyOffloadsNull == false)) {
private bool ShouldSerializeMaxIOVOffloads() {
if ((this.IsMaxIOVOffloadsNull == false)) {
return true;
}
return false;
@ -818,8 +937,23 @@
return false;
}
private bool ShouldSerializeNumLearnableAddresses() {
if ((this.IsNumLearnableAddressesNull == false)) {
private void ResetMaxVMQOffloads() {
curObj["MaxVMQOffloads"] = null;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
}
}
private bool ShouldSerializeOperatingStatus() {
if ((this.IsOperatingStatusNull == false)) {
return true;
}
return false;
}
private bool ShouldSerializePrimaryStatus() {
if ((this.IsPrimaryStatusNull == false)) {
return true;
}
return false;
@ -839,14 +973,6 @@
return false;
}
private void ResetScopeOfResidence() {
curObj["ScopeOfResidence"] = null;
if (((isEmbedded == false)
&& (AutoCommitProp == true))) {
PrivateLateBoundObject.Put();
}
}
private bool ShouldSerializeTimeOfLastStateChange() {
if ((this.IsTimeOfLastStateChangeNull == false)) {
return true;
@ -854,6 +980,13 @@
return false;
}
private bool ShouldSerializeTransitioningToState() {
if ((this.IsTransitioningToStateNull == false)) {
return true;
}
return false;
}
[Browsable(true)]
public void CommitObject() {
if ((isEmbedded == false)) {
@ -874,7 +1007,7 @@
}
private static string ConstructPath(string keyCreationClassName, string keyName) {
string strPath = "ROOT\\virtualization:Msvm_VirtualSwitch";
string strPath = "ROOT\\virtualization\\v2:Msvm_VirtualEthernetSwitch";
strPath = string.Concat(strPath, string.Concat(".CreationClassName=", string.Concat("\"", string.Concat(keyCreationClassName, "\""))));
strPath = string.Concat(strPath, string.Concat(",Name=", string.Concat("\"", string.Concat(keyName, "\""))));
return strPath;
@ -893,70 +1026,70 @@
}
// Different overloads of GetInstances() help in enumerating instances of the WMI class.
public static VirtualSwitchCollection GetInstances() {
public static VirtualEthernetSwitchCollection GetInstances() {
return GetInstances(null, null, null);
}
public static VirtualSwitchCollection GetInstances(string condition) {
public static VirtualEthernetSwitchCollection GetInstances(string condition) {
return GetInstances(null, condition, null);
}
public static VirtualSwitchCollection GetInstances(string[] selectedProperties) {
public static VirtualEthernetSwitchCollection GetInstances(string[] selectedProperties) {
return GetInstances(null, null, selectedProperties);
}
public static VirtualSwitchCollection GetInstances(string condition, string[] selectedProperties) {
public static VirtualEthernetSwitchCollection GetInstances(string condition, string[] selectedProperties) {
return GetInstances(null, condition, selectedProperties);
}
public static VirtualSwitchCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
public static VirtualEthernetSwitchCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;
}
}
System.Management.ManagementPath pathObj = new System.Management.ManagementPath();
pathObj.ClassName = "Msvm_VirtualSwitch";
pathObj.NamespacePath = "root\\virtualization";
pathObj.ClassName = "Msvm_VirtualEthernetSwitch";
pathObj.NamespacePath = "root\\virtualization\\v2";
System.Management.ManagementClass clsObject = new System.Management.ManagementClass(mgmtScope, pathObj, null);
if ((enumOptions == null)) {
enumOptions = new System.Management.EnumerationOptions();
enumOptions.EnsureLocatable = true;
}
return new VirtualSwitchCollection(clsObject.GetInstances(enumOptions));
return new VirtualEthernetSwitchCollection(clsObject.GetInstances(enumOptions));
}
public static VirtualSwitchCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
public static VirtualEthernetSwitchCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
return GetInstances(mgmtScope, condition, null);
}
public static VirtualSwitchCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
public static VirtualEthernetSwitchCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
return GetInstances(mgmtScope, null, selectedProperties);
}
public static VirtualSwitchCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
public static VirtualEthernetSwitchCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
if ((mgmtScope == null)) {
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
mgmtScope.Path.NamespacePath = "root\\virtualization";
mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
}
else {
mgmtScope = statMgmtScope;
}
}
System.Management.ManagementObjectSearcher ObjectSearcher = new System.Management.ManagementObjectSearcher(mgmtScope, new SelectQuery("Msvm_VirtualSwitch", condition, selectedProperties));
System.Management.ManagementObjectSearcher ObjectSearcher = new System.Management.ManagementObjectSearcher(mgmtScope, new SelectQuery("Msvm_VirtualEthernetSwitch", condition, selectedProperties));
System.Management.EnumerationOptions enumOptions = new System.Management.EnumerationOptions();
enumOptions.EnsureLocatable = true;
ObjectSearcher.Options = enumOptions;
return new VirtualSwitchCollection(ObjectSearcher.Get());
return new VirtualEthernetSwitchCollection(ObjectSearcher.Get());
}
[Browsable(true)]
public static VirtualSwitch CreateInstance() {
public static VirtualEthernetSwitch CreateInstance() {
System.Management.ManagementScope mgmtScope = null;
if ((statMgmtScope == null)) {
mgmtScope = new System.Management.ManagementScope();
@ -967,7 +1100,7 @@
}
System.Management.ManagementPath mgmtPath = new System.Management.ManagementPath(CreatedClassName);
System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null);
return new VirtualSwitch(tmpMgmtClass.CreateInstance());
return new VirtualEthernetSwitch(tmpMgmtClass.CreateInstance());
}
[Browsable(true)]
@ -975,85 +1108,16 @@
PrivateLateBoundObject.Delete();
}
// Converts a given time interval in DMTF format to System.TimeSpan object.
static System.TimeSpan ToTimeSpan(string dmtfTimespan) {
int days = 0;
int hours = 0;
int minutes = 0;
int seconds = 0;
long ticks = 0;
if ((dmtfTimespan == null)) {
throw new System.ArgumentOutOfRangeException();
}
if ((dmtfTimespan.Length == 0)) {
throw new System.ArgumentOutOfRangeException();
}
if ((dmtfTimespan.Length != 25)) {
throw new System.ArgumentOutOfRangeException();
}
if ((dmtfTimespan.Substring(21, 4) != ":000")) {
throw new System.ArgumentOutOfRangeException();
}
try {
string tempString = string.Empty;
tempString = dmtfTimespan.Substring(0, 8);
days = int.Parse(tempString);
tempString = dmtfTimespan.Substring(8, 2);
hours = int.Parse(tempString);
tempString = dmtfTimespan.Substring(10, 2);
minutes = int.Parse(tempString);
tempString = dmtfTimespan.Substring(12, 2);
seconds = int.Parse(tempString);
tempString = dmtfTimespan.Substring(15, 6);
ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000))));
}
catch (System.Exception e) {
throw new System.ArgumentOutOfRangeException(null, e.Message);
}
System.TimeSpan timespan = new System.TimeSpan(days, hours, minutes, seconds, 0);
System.TimeSpan tsTemp = System.TimeSpan.FromTicks(ticks);
timespan = timespan.Add(tsTemp);
return timespan;
}
// Converts a given System.TimeSpan object to DMTF Time interval format.
static string ToDmtfTimeInterval(System.TimeSpan timespan) {
string dmtftimespan = ((int)(timespan.Days)).ToString().PadLeft(8, '0');
System.TimeSpan maxTimeSpan = System.TimeSpan.MaxValue;
if ((timespan.Days > maxTimeSpan.Days)) {
throw new System.ArgumentOutOfRangeException();
}
System.TimeSpan minTimeSpan = System.TimeSpan.MinValue;
if ((timespan.Days < minTimeSpan.Days)) {
throw new System.ArgumentOutOfRangeException();
}
dmtftimespan = string.Concat(dmtftimespan, ((int)(timespan.Hours)).ToString().PadLeft(2, '0'));
dmtftimespan = string.Concat(dmtftimespan, ((int)(timespan.Minutes)).ToString().PadLeft(2, '0'));
dmtftimespan = string.Concat(dmtftimespan, ((int)(timespan.Seconds)).ToString().PadLeft(2, '0'));
dmtftimespan = string.Concat(dmtftimespan, ".");
System.TimeSpan tsTemp = new System.TimeSpan(timespan.Days, timespan.Hours, timespan.Minutes, timespan.Seconds, 0);
long microsec = ((long)((((timespan.Ticks - tsTemp.Ticks)
* 1000)
/ System.TimeSpan.TicksPerMillisecond)));
string strMicroSec = ((long)(microsec)).ToString();
if ((strMicroSec.Length > 6)) {
strMicroSec = strMicroSec.Substring(0, 6);
}
dmtftimespan = string.Concat(dmtftimespan, strMicroSec.PadLeft(6, '0'));
dmtftimespan = string.Concat(dmtftimespan, ":000");
return dmtftimespan;
}
public uint RequestStateChange(ushort RequestedState, System.TimeSpan TimeoutPeriod, out System.Management.ManagementPath Job) {
public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod, out System.Management.ManagementPath Job) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("RequestStateChange");
inParams["RequestedState"] = ((ushort)(RequestedState));
inParams["TimeoutPeriod"] = ToDmtfTimeInterval(((System.TimeSpan)(TimeoutPeriod)));
inParams["TimeoutPeriod"] = ToDmtfDateTime(((System.DateTime)(TimeoutPeriod)));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("RequestStateChange", inParams, null);
Job = null;
if ((outParams.Properties["Job"] != null)) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
if ((outParams.Properties["Job"] != null) && outParams.Properties["Job"].Value != null) {
Job = new System.Management.ManagementPath(outParams.Properties["Job"].Value.ToString());
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -1078,11 +1142,11 @@
}
// Enumerator implementation for enumerating instances of the class.
public class VirtualSwitchCollection : object, ICollection {
public class VirtualEthernetSwitchCollection : object, ICollection {
private ManagementObjectCollection privColObj;
public VirtualSwitchCollection(ManagementObjectCollection objCollection) {
public VirtualEthernetSwitchCollection(ManagementObjectCollection objCollection) {
privColObj = objCollection;
}
@ -1108,25 +1172,25 @@
privColObj.CopyTo(array, index);
int nCtr;
for (nCtr = 0; (nCtr < array.Length); nCtr = (nCtr + 1)) {
array.SetValue(new VirtualSwitch(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
array.SetValue(new VirtualEthernetSwitch(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
}
}
public virtual System.Collections.IEnumerator GetEnumerator() {
return new VirtualSwitchEnumerator(privColObj.GetEnumerator());
return new VirtualEthernetSwitchEnumerator(privColObj.GetEnumerator());
}
public class VirtualSwitchEnumerator : object, System.Collections.IEnumerator {
public class VirtualEthernetSwitchEnumerator : object, System.Collections.IEnumerator {
private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum;
public VirtualSwitchEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
public VirtualEthernetSwitchEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
privObjEnum = objEnum;
}
public virtual object Current {
get {
return new VirtualSwitch(((System.Management.ManagementObject)(privObjEnum.Current)));
return new VirtualEthernetSwitch(((System.Management.ManagementObject)(privObjEnum.Current)));
}
}

View File

@ -1006,13 +1006,13 @@
inParams["FeatureSettings"] = ((string[])(FeatureSettings));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("AddFeatureSettings", inParams, null);
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null))
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
ResultingFeatureSettings = null;
if ((outParams.Properties["ResultingFeatureSettings"] != null)) {
if ((outParams.Properties["ResultingFeatureSettings"] != null && outParams.Properties["ResultingFeatureSettings"].Value != null))
{
int len = ((System.Array)(outParams.Properties["ResultingFeatureSettings"].Value)).Length;
System.Management.ManagementPath[] arrToRet = new System.Management.ManagementPath[len];
for (int iCounter = 0; (iCounter < len); iCounter = (iCounter + 1)) {
@ -1052,11 +1052,9 @@
inParams["TargetSystem"] = ((System.Management.ManagementPath)(TargetSystem)).Path;
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("AddKvpItems", inParams, null);
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null))
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath(outParams.Properties["Job"].Value.ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -1074,13 +1072,13 @@
inParams["ResourceSettings"] = ((string[])(ResourceSettings));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("AddResourceSettings", inParams, null);
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null))
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
ResultingResourceSettings = null;
if ((outParams.Properties["ResultingResourceSettings"] != null)) {
if ((outParams.Properties["ResultingResourceSettings"] != null && outParams.Properties["ResultingResourceSettings"].Value != null))
{
int len = ((System.Array)(outParams.Properties["ResultingResourceSettings"].Value)).Length;
System.Management.ManagementPath[] arrToRet = new System.Management.ManagementPath[len];
for (int iCounter = 0; (iCounter < len); iCounter = (iCounter + 1)) {
@ -1097,23 +1095,23 @@
}
}
public uint DefineSystem(System.Management.ManagementPath ReferenceConfiguration, string[] ResourceSettings, string SystemSettings, out System.Management.ManagementPath Job, out System.Management.ManagementPath ResultingSystem) {
public uint DefineSystem(string ReferenceConfigurationPath, string[] ResourceSettings, string SystemSettings, out System.Management.ManagementPath Job, out System.Management.ManagementPath ResultingSystem) {
if ((isEmbedded == false)) {
System.Management.ManagementBaseObject inParams = null;
inParams = PrivateLateBoundObject.GetMethodParameters("DefineSystem");
inParams["ReferenceConfiguration"] = ((System.Management.ManagementPath)(ReferenceConfiguration)).Path;
inParams["ResourceSettings"] = ((string[])(ResourceSettings));
inParams["SystemSettings"] = ((string)(SystemSettings));
inParams["ReferenceConfiguration"] = ReferenceConfigurationPath;
inParams["ResourceSettings"] = ResourceSettings;
inParams["SystemSettings"] = SystemSettings;
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("DefineSystem", inParams, null);
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null) && outParams.Properties["Job"].Value != null)
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
ResultingSystem = null;
if ((outParams.Properties["ResultingSystem"] != null)) {
ResultingSystem = new System.Management.ManagementPath(outParams.Properties["ResultingSystem"].ToString());
if ((outParams.Properties["ResultingSystem"] != null && outParams.Properties["ResultingSystem"].Value != null))
{
ResultingSystem = new System.Management.ManagementPath((string)outParams.Properties["ResultingSystem"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -1131,10 +1129,9 @@
inParams["AffectedSystem"] = ((System.Management.ManagementPath)(AffectedSystem)).Path;
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("DestroySystem", inParams, null);
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null))
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -1153,11 +1150,11 @@
inParams["ExportSettingData"] = ((string)(ExportSettingData));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("ExportSystemDefinition", inParams, null);
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null))
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
else {
@ -1290,7 +1287,8 @@
inParams["SnapshotFolder"] = ((string)(SnapshotFolder));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("ImportSnapshotDefinitions", inParams, null);
ImportedSnapshots = null;
if ((outParams.Properties["ImportedSnapshots"] != null)) {
if ((outParams.Properties["ImportedSnapshots"] != null && outParams.Properties["ImportedSnapshots"].Value != null))
{
int len = ((System.Array)(outParams.Properties["ImportedSnapshots"].Value)).Length;
System.Management.ManagementPath[] arrToRet = new System.Management.ManagementPath[len];
for (int iCounter = 0; (iCounter < len); iCounter = (iCounter + 1)) {
@ -1299,10 +1297,9 @@
ImportedSnapshots = arrToRet;
}
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null))
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -1322,15 +1319,16 @@
inParams["SystemDefinitionFile"] = ((string)(SystemDefinitionFile));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("ImportSystemDefinition", inParams, null);
ImportedSystem = null;
if ((outParams.Properties["ImportedSystem"] != null)) {
if ((outParams.Properties["ImportedSystem"] != null && outParams.Properties["ImportedSystem"].Value != null))
{
ImportedSystem = new System.Management.ManagementPath(outParams.Properties["ImportedSystem"].ToString());
}
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null))
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
else {
@ -1347,10 +1345,9 @@
inParams["SettingData"] = ((string)(SettingData));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("ModifyDiskMergeSettings", inParams, null);
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null))
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -1367,13 +1364,13 @@
inParams["FeatureSettings"] = ((string[])(FeatureSettings));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("ModifyFeatureSettings", inParams, null);
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null))
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
ResultingFeatureSettings = null;
if ((outParams.Properties["ResultingFeatureSettings"] != null)) {
if ((outParams.Properties["ResultingFeatureSettings"] != null && outParams.Properties["ResultingFeatureSettings"].Value != null))
{
int len = ((System.Array)(outParams.Properties["ResultingFeatureSettings"].Value)).Length;
System.Management.ManagementPath[] arrToRet = new System.Management.ManagementPath[len];
for (int iCounter = 0; (iCounter < len); iCounter = (iCounter + 1)) {
@ -1398,10 +1395,9 @@
inParams["TargetSystem"] = ((System.Management.ManagementPath)(TargetSystem)).Path;
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("ModifyKvpItems", inParams, null);
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null))
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -1418,13 +1414,13 @@
inParams["ResourceSettings"] = ((string[])(ResourceSettings));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("ModifyResourceSettings", inParams, null);
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null) && outParams.Properties["Job"].Value != null)
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
ResultingResourceSettings = null;
if ((outParams.Properties["ResultingResourceSettings"] != null)) {
if ((outParams.Properties["ResultingResourceSettings"] != null && outParams.Properties["ResultingResourceSettings"].Value != null))
{
int len = ((System.Array)(outParams.Properties["ResultingResourceSettings"].Value)).Length;
System.Management.ManagementPath[] arrToRet = new System.Management.ManagementPath[len];
for (int iCounter = 0; (iCounter < len); iCounter = (iCounter + 1)) {
@ -1448,10 +1444,9 @@
inParams["SettingData"] = ((string)(SettingData));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("ModifyServiceSettings", inParams, null);
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null))
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -1468,10 +1463,9 @@
inParams["SystemSettings"] = ((string)(SystemSettings));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("ModifySystemSettings", inParams, null);
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null))
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -1488,10 +1482,9 @@
inParams["PlannedSystem"] = ((System.Management.ManagementPath)(PlannedSystem)).Path;
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("RealizePlannedSystem", inParams, null);
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null))
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
ResultingSystem = null;
if ((outParams.Properties["ResultingSystem"] != null)) {
@ -1523,10 +1516,9 @@
}
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("RemoveFeatureSettings", inParams, null);
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null))
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -1557,11 +1549,9 @@
inParams["TargetSystem"] = ((System.Management.ManagementPath)(TargetSystem)).Path;
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("RemoveKvpItems", inParams, null);
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null))
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath(outParams.Properties["Job"].Value.ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -1588,11 +1578,9 @@
}
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("RemoveResourceSettings", inParams, null);
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null))
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath(outParams.Properties["Job"].Value.ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -1610,11 +1598,9 @@
inParams["TimeoutPeriod"] = ToDmtfDateTime(((System.DateTime)(TimeoutPeriod)));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("RequestStateChange", inParams, null);
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null))
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath(outParams.Properties["Job"].Value.ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -1632,11 +1618,9 @@
inParams["NetworkConfiguration"] = ((string[])(NetworkConfiguration));
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("SetGuestNetworkAdapterConfiguration", inParams, null);
Job = null;
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
// if (outParams.Properties["Job"] != null)
if ((outParams.Properties["Job"] != null))
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath(outParams.Properties["Job"].Value.ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}
@ -1675,10 +1659,9 @@
inParams["PlannedSystem"] = ((System.Management.ManagementPath)(PlannedSystem)).Path;
System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("ValidatePlannedSystem", inParams, null);
Job = null;
// if (outParams.Properties["Job"] != null)
if (outParams.Properties["Job"] != null || outParams.Properties["Job"].Value != null)
if ((outParams.Properties["Job"] != null))
{
// Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
}
return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
}

View File

@ -1,4 +1,5 @@
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
{
using System;
using System.ComponentModel;
using System.Management;

View File

@ -87,75 +87,27 @@
<Compile Include="ROOT.CIMV2.Win32_Processor.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_ComputerSystem.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_ConcreteJob.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_ExternalEthernetPort.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_ImageManagementService.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_MemorySettingData.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_ProcessorSettingData.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_ResourceAllocationSettingData.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_SummaryInformation.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_SwitchLANEndpoint.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_SwitchPort.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_SyntheticEthernetPort.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_SyntheticEthernetPortSettingData.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_VirtualSwitch.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_VirtualSwitchManagementService.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_VirtualSystemGlobalSettingData.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_VirtualSystemManagementService.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_VirtualSystemManagementServiceSettingData.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_VirtualSystemSettingData.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_VLANEndpoint.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_VLANEndpointSettingData.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.Msvm_VmLANEndpoint.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.v2.Msvm_ComputerSystem.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.v2.Msvm_ConcreteJob.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.v2.Msvm_EthernetPortAllocationSettingData.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.v2.Msvm_EthernetSwitchPort.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.v2.Msvm_EthernetSwitchPortVlanSettingData.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.v2.Msvm_ExternalEthernetPort.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.v2.Msvm_ImageManagementService.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.v2.Msvm_KvpExchangeComponent.cs">
<SubType>Component</SubType>
</Compile>
@ -165,6 +117,36 @@
<Compile Include="ROOT.virtualization.v2.Msvm_KvpExchangeDataItem.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.v2.Msvm_LANEndpoint.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.v2.Msvm_MemorySettingData.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.v2.Msvm_ProcessorSettingData.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.v2.Msvm_ResourceAllocationSettingData.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.v2.Msvm_StorageAllocationSettingData.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.v2.Msvm_SummaryInformation.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.v2.Msvm_SyntheticEthernetPortSettingData.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.v2.Msvm_VirtualEthernetSwitch.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.v2.Msvm_VirtualEthernetSwitchManagementService.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.v2.Msvm_VirtualHardDiskSettingData.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ROOT.virtualization.v2.Msvm_VirtualSystemManagementService.cs">
<SubType>Component</SubType>
</Compile>