mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
pre-commit: fix .cs files with the trailing-whitespace hook (#9794)
Co-authored-by: Vishesh <vishesh92@gmail.com>
This commit is contained in:
parent
0128046429
commit
fd24509ba7
@ -59,7 +59,7 @@ repos:
|
||||
- id: mixed-line-ending
|
||||
exclude: \.(cs|xml)$
|
||||
- id: trailing-whitespace
|
||||
files: \.(bat|css|gitignore|header|in|install|java|md|properties|py|rb|sh|sql|txt|vue|xml|xsl|yaml|yml)$
|
||||
files: \.(cs|bat|css|gitignore|header|in|install|java|md|properties|py|rb|sh|sql|txt|vue|xml|xsl|yaml|yml)$
|
||||
args: [--markdown-linebreak-ext=md]
|
||||
exclude: ^services/console-proxy/rdpconsole/src/test/doc/freerdp-debug-log\.txt$
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
|
||||
@ -18,7 +18,7 @@ namespace CloudStack.Plugin.AgentShell
|
||||
{
|
||||
partial class AgentService
|
||||
{
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
@ -38,8 +38,8 @@ namespace CloudStack.Plugin.AgentShell
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
|
||||
@ -67,7 +67,7 @@ namespace CloudStack.Plugin.AgentShell
|
||||
public static void ConfigServerResource()
|
||||
{
|
||||
// For simplicity, ServerResource config and settings file are tightly coupled.
|
||||
// An alternative is to pass a dictionary to the server resource and let it find
|
||||
// An alternative is to pass a dictionary to the server resource and let it find
|
||||
// required settings. In contrast, the approach below is strongly typed and makes
|
||||
// use of VisualStudio settings designer. The designer allows us to avoid
|
||||
// accessing config using their key strings.
|
||||
|
||||
@ -16,20 +16,20 @@
|
||||
// under the License.
|
||||
|
||||
namespace CloudStack.Plugin.AgentShell {
|
||||
|
||||
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
public sealed partial class AgentSettings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
|
||||
private static AgentSettings defaultInstance = ((AgentSettings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new AgentSettings())));
|
||||
|
||||
|
||||
public static AgentSettings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("8")]
|
||||
@ -38,7 +38,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((int)(this["cpus"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Routing")]
|
||||
@ -47,7 +47,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((string)(this["type"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("5fe2bad3-d785-394e-9949-89786b8a63d2")]
|
||||
@ -56,7 +56,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((global::System.Guid)(this["local_storage_uuid"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("hvm")]
|
||||
@ -65,7 +65,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((string)(this["capabilities"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("2130")]
|
||||
@ -74,7 +74,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((int)(this["Settingcpuspeed"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("8250")]
|
||||
@ -83,7 +83,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((int)(this["port"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("34359738368")]
|
||||
@ -92,7 +92,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((long)(this["memory"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("camldonall01.citrite.net")]
|
||||
@ -101,7 +101,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((string)(this["host"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("1")]
|
||||
@ -110,7 +110,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((int)(this["pod"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("10.1.1.1")]
|
||||
@ -119,7 +119,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((string)(this["gateway_ip_address"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
public global::System.Guid guid {
|
||||
@ -127,7 +127,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((global::System.Guid)(this["guid"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("2")]
|
||||
@ -136,7 +136,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((int)(this["cluster"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("1")]
|
||||
@ -145,7 +145,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((int)(this["zone"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("c:\\Secondary")]
|
||||
@ -157,7 +157,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
this["local_secondary_storage_path"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("E:\\Disks\\Disks")]
|
||||
@ -169,7 +169,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
this["local_storage_path"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("5")]
|
||||
@ -178,7 +178,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((int)(this["workers"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("255.255.240.0")]
|
||||
@ -187,7 +187,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((string)(this["private_ip_netmask"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("4294967296")]
|
||||
@ -196,7 +196,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((long)(this["RootDeviceReservedSpaceBytes"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("../../../../../")]
|
||||
@ -205,7 +205,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((string)(this["hyperv_plugin_root"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("e:\\")]
|
||||
@ -214,7 +214,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((string)(this["RootDeviceName"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("101F742C6B88")]
|
||||
@ -247,7 +247,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
this["testLocalStorePath"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("testS3Bucket")]
|
||||
@ -259,7 +259,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
this["testS3Bucket"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("testS3Endpoint")]
|
||||
@ -271,7 +271,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
this["testS3Endpoint"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("testS3AccessKey")]
|
||||
@ -283,7 +283,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
this["testS3AccessKey"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("testS3SecretKey")]
|
||||
@ -295,7 +295,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
this["testS3SecretKey"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("206-2-73592258-559a-3b38-8f66-b667aab143eb")]
|
||||
@ -307,7 +307,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
this["testS3TemplateName"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("5fe2bad3-d785-394e-9949-89786b8a63d2")]
|
||||
@ -319,7 +319,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
this["testLocalStoreUUID"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("acton-systemvm-02062012.vhd.bz2")]
|
||||
@ -331,7 +331,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
this["testSystemVMTemplateName"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("acton-systemvm-02062012")]
|
||||
@ -343,7 +343,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
this["testSystemVMTemplateNameNoExt"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("2048")]
|
||||
@ -352,7 +352,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((ulong)(this["dom0MinMemory"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("10.1.1.1")]
|
||||
@ -361,7 +361,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
return ((string)(this["private_ip_address"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("cifs://10.1.1.1/secondary?user\\u003dadministrator\\u0026password\\u003d1pass%40w" +
|
||||
@ -374,7 +374,7 @@ namespace CloudStack.Plugin.AgentShell {
|
||||
this["testCifsUrl"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("template/tmpl/2/201/61d5316a-3cc4-30cf-a557-78691ff5c143.vhd")]
|
||||
|
||||
@ -23,7 +23,7 @@ namespace CloudStack.Plugin.AgentShell
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
|
||||
@ -19,7 +19,7 @@ using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("AgentShell")]
|
||||
@ -31,8 +31,8 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
@ -42,11 +42,11 @@ using System.Runtime.InteropServices;
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
|
||||
@ -26,7 +26,7 @@ using System.Threading.Tasks;
|
||||
// C# versions of certain CloudStack types to simplify JSON serialisation.
|
||||
// Limit to the number of types, because they are written and maintained manually.
|
||||
// JsonProperty used to identify property name when serialised, which allows
|
||||
// later adoption of C# naming conventions if requried.
|
||||
// later adoption of C# naming conventions if requried.
|
||||
namespace HypervResource
|
||||
{
|
||||
public class PrimaryDataStoreTO
|
||||
@ -474,15 +474,15 @@ namespace HypervResource
|
||||
/// </summary>
|
||||
Filesystem,
|
||||
/// <summary>
|
||||
/// NFS or CIFS
|
||||
/// NFS or CIFS
|
||||
/// </summary>
|
||||
NetworkFilesystem,
|
||||
/// <summary>
|
||||
/// shared LUN, with a clusterfs overlay
|
||||
/// shared LUN, with a clusterfs overlay
|
||||
/// </summary>
|
||||
IscsiLUN,
|
||||
/// <summary>
|
||||
/// for e.g., ZFS Comstar
|
||||
/// for e.g., ZFS Comstar
|
||||
/// </summary>
|
||||
Iscsi,
|
||||
/// <summary>
|
||||
@ -494,31 +494,31 @@ namespace HypervResource
|
||||
/// </summary>
|
||||
LVM,
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
CLVM,
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
RBD,
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
SharedMountPoint,
|
||||
/// <summary>
|
||||
/// VMware VMFS storage
|
||||
/// VMware VMFS storage
|
||||
/// </summary>
|
||||
VMFS,
|
||||
/// <summary>
|
||||
/// for XenServer, Storage Pool is set up by customers.
|
||||
/// for XenServer, Storage Pool is set up by customers.
|
||||
/// </summary>
|
||||
PreSetup,
|
||||
/// <summary>
|
||||
/// XenServer local EXT SR
|
||||
/// XenServer local EXT SR
|
||||
/// </summary>
|
||||
EXT,
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
OCFS2,
|
||||
/// <summary>
|
||||
@ -662,7 +662,7 @@ namespace HypervResource
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fully qualified named for a number of types used in CloudStack. Used to specify the intended type for JSON serialised objects.
|
||||
/// Fully qualified named for a number of types used in CloudStack. Used to specify the intended type for JSON serialised objects.
|
||||
/// </summary>
|
||||
public class CloudStackTypes
|
||||
{
|
||||
|
||||
@ -129,7 +129,7 @@ namespace HypervResource
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// POST takes dynamic to allow it to receive JSON without concern for what is the underlying object.
|
||||
/// E.g. http://stackoverflow.com/questions/14071715/passing-dynamic-json-object-to-web-api-newtonsoft-example
|
||||
/// E.g. http://stackoverflow.com/questions/14071715/passing-dynamic-json-object-to-web-api-newtonsoft-example
|
||||
/// and http://stackoverflow.com/questions/3142495/deserialize-json-into-c-sharp-dynamic-object
|
||||
/// Use ActionName attribute to allow multiple POST URLs, one for each supported command
|
||||
/// E.g. http://stackoverflow.com/a/12703423/939250
|
||||
@ -141,7 +141,7 @@ namespace HypervResource
|
||||
/// Exceptions handled on command by command basis rather than globally to allow details of the command
|
||||
/// to be reflected in the response. Default error handling is in the catch for Exception, but
|
||||
/// other exception types may be caught where the feedback would be different.
|
||||
/// NB: global alternatives discussed at
|
||||
/// NB: global alternatives discussed at
|
||||
/// http://weblogs.asp.net/fredriknormen/archive/2012/06/11/asp-net-web-api-exception-handling.aspx
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
@ -174,7 +174,7 @@ namespace HypervResource
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NOP - placeholder for future setup, e.g. delete existing VMs or Network ports
|
||||
/// NOP - placeholder for future setup, e.g. delete existing VMs or Network ports
|
||||
/// POST api/HypervResource/SetupCommand
|
||||
/// </summary>
|
||||
/// <param name="cmd"></param>
|
||||
@ -486,7 +486,7 @@ namespace HypervResource
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static JArray ReturnCloudStackTypedJArray(object ansContent, string ansType)
|
||||
{
|
||||
JObject ansObj = Utils.CreateCloudStackObject(ansType, ansContent);
|
||||
@ -705,7 +705,7 @@ namespace HypervResource
|
||||
/// +-System.UnauthorizedAccessException
|
||||
/// +-System.IO.IOException
|
||||
/// +-System.IO.PathTooLongException
|
||||
///
|
||||
///
|
||||
/// Exceptions related to HTTP URIs
|
||||
/// System.SystemException
|
||||
/// +-System.InvalidOperationException
|
||||
|
||||
@ -19,7 +19,7 @@ using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("HypervResource")]
|
||||
@ -31,8 +31,8 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
@ -42,11 +42,11 @@ using System.Runtime.InteropServices;
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
|
||||
@ -111,7 +111,7 @@ namespace HypervResource
|
||||
|
||||
return vm;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns ComputerSystem lacking any NICs and VOLUMEs
|
||||
/// </summary>
|
||||
@ -164,7 +164,7 @@ namespace HypervResource
|
||||
// Obtain controller for Hyper-V networking subsystem
|
||||
var vmNetMgmtSvc = GetVirtualSwitchManagementService();
|
||||
|
||||
// Create NIC resource by cloning the default NIC
|
||||
// Create NIC resource by cloning the default NIC
|
||||
var synthNICsSettings = SyntheticEthernetPortSettingData.GetInstances(vmNetMgmtSvc.Scope, "InstanceID LIKE \"%Default\"");
|
||||
|
||||
// Assert
|
||||
@ -217,7 +217,7 @@ namespace HypervResource
|
||||
public const string HARDDISK_DISK = "Microsoft:Hyper-V:Virtual Hard Disk"; // For IDE_HARDDISK_DRIVE
|
||||
|
||||
/// <summary>
|
||||
/// Create new VM. By default we start it.
|
||||
/// Create new VM. By default we start it.
|
||||
/// </summary>
|
||||
public ComputerSystem DeployVirtualMachine(dynamic jsonObj, string systemVmIso)
|
||||
{
|
||||
@ -351,9 +351,9 @@ namespace HypervResource
|
||||
break;
|
||||
case "DATADISK":
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
// TODO: double check exception type
|
||||
errMsg = string.Format("Unknown disk type {0} for disk {1}, vm named {2}",
|
||||
errMsg = string.Format("Unknown disk type {0} for disk {1}, vm named {2}",
|
||||
string.IsNullOrEmpty(driveType) ? "NULL" : driveType,
|
||||
string.IsNullOrEmpty(diskName) ? "NULL" : diskName, vmName);
|
||||
var ex = new WmiException(errMsg);
|
||||
@ -452,9 +452,9 @@ namespace HypervResource
|
||||
SetBandWidthLimit((ulong)networkRateMbps, portSettings);
|
||||
}
|
||||
|
||||
logger.DebugFormat("Created adapter {0} on port {1}, {2}",
|
||||
logger.DebugFormat("Created adapter {0} on port {1}, {2}",
|
||||
newAdapter.Path, portSettings.Path, (vlan == null ? "No VLAN" : "VLAN " + vlan));
|
||||
// logger.DebugFormat("Created adapter {0} on port {1}, {2}",
|
||||
// logger.DebugFormat("Created adapter {0} on port {1}, {2}",
|
||||
// newAdapter.Path, portSettings.Path, (vlan == null ? "No VLAN" : "VLAN " + vlan));
|
||||
}
|
||||
}
|
||||
@ -468,7 +468,7 @@ namespace HypervResource
|
||||
var vm = GetComputerSystem(vmName);
|
||||
if (bootArgs != null && !String.IsNullOrEmpty((string)bootArgs))
|
||||
{
|
||||
|
||||
|
||||
String bootargs = bootArgs;
|
||||
AddUserData(vm, bootargs);
|
||||
}
|
||||
@ -576,7 +576,7 @@ namespace HypervResource
|
||||
}
|
||||
|
||||
/// this method is to add a dvd drive and attach the systemvm iso.
|
||||
///
|
||||
///
|
||||
public void patchSystemVmIso(String vmName, String systemVmIso)
|
||||
{
|
||||
ComputerSystem vmObject = GetComputerSystem(vmName);
|
||||
@ -611,7 +611,7 @@ namespace HypervResource
|
||||
/// <param name="driveResourceType">IDE_HARDDISK_DRIVE or IDE_ISO_DRIVE</param>
|
||||
public ManagementPath AddDiskDriveToIdeController(ComputerSystem vm, string vhdfile, string cntrllerAddr, string driveResourceType)
|
||||
{
|
||||
logger.DebugFormat("Creating DISK for VM {0} (GUID {1}) by attaching {2}",
|
||||
logger.DebugFormat("Creating DISK for VM {0} (GUID {1}) by attaching {2}",
|
||||
vm.ElementName,
|
||||
vm.Name,
|
||||
vhdfile);
|
||||
@ -622,13 +622,13 @@ namespace HypervResource
|
||||
case HARDDISK_DRIVE:
|
||||
diskResourceSubType = HARDDISK_DISK;
|
||||
break;
|
||||
case ISO_DRIVE:
|
||||
case ISO_DRIVE:
|
||||
diskResourceSubType = ISO_DISK;
|
||||
break;
|
||||
default:
|
||||
var errMsg = string.Format(
|
||||
"Unrecognised disk drive type {0} for VM {1} (GUID {2})",
|
||||
string.IsNullOrEmpty(driveResourceType) ? "NULL": driveResourceType,
|
||||
string.IsNullOrEmpty(driveResourceType) ? "NULL": driveResourceType,
|
||||
vm.ElementName,
|
||||
vm.Name);
|
||||
var ex = new WmiException(errMsg);
|
||||
@ -886,7 +886,7 @@ namespace HypervResource
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create Msvm_StorageAllocationSettingData corresponding to the ISO image, and
|
||||
/// Create Msvm_StorageAllocationSettingData corresponding to the ISO image, and
|
||||
/// associate this with the VM's DVD drive.
|
||||
/// </summary>
|
||||
private void AttachIso(ComputerSystem vm, string isoPath)
|
||||
@ -1191,7 +1191,7 @@ namespace HypervResource
|
||||
string vmToDestroy = jsonObj.vmName;
|
||||
DestroyVm(vmToDestroy);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Remove all VMs and all SwitchPorts with the displayName. VHD gets deleted elsewhere.
|
||||
/// </summary>
|
||||
@ -1461,7 +1461,7 @@ namespace HypervResource
|
||||
/// </summary>
|
||||
/// <param name="storageSettings">Path that uniquely identifies the resource.</param>
|
||||
/// <param name="vm">VM to which the disk image will be attached.</param>
|
||||
// Add new
|
||||
// Add new
|
||||
private void RemoveNetworkResource(ManagementPath resourcePath)
|
||||
{
|
||||
var virtSwitchMgmtSvc = GetVirtualSwitchManagementService();
|
||||
@ -1523,9 +1523,9 @@ namespace HypervResource
|
||||
public void SetState(ComputerSystem vm, ushort requiredState)
|
||||
{
|
||||
logger.InfoFormat(
|
||||
"Changing state of {0} (GUID {1}) to {2}",
|
||||
vm.ElementName,
|
||||
vm.Name,
|
||||
"Changing state of {0} (GUID {1}) to {2}",
|
||||
vm.ElementName,
|
||||
vm.Name,
|
||||
RequiredState.ToString(requiredState));
|
||||
|
||||
ManagementPath jobPath;
|
||||
@ -1555,9 +1555,9 @@ namespace HypervResource
|
||||
}
|
||||
|
||||
logger.InfoFormat(
|
||||
"Successfully changed vm state of {0} (GUID {1} to requested state {2}",
|
||||
vm.ElementName,
|
||||
vm.Name,
|
||||
"Successfully changed vm state of {0} (GUID {1} to requested state {2}",
|
||||
vm.ElementName,
|
||||
vm.Name,
|
||||
requiredState);
|
||||
}
|
||||
|
||||
@ -1589,9 +1589,9 @@ namespace HypervResource
|
||||
|
||||
public SyntheticEthernetPortSettingData GetSyntheticEthernetPortSettings(EthernetSwitchPort port)
|
||||
{
|
||||
// An ASSOCIATOR object provides the cross reference from the EthernetSwitchPort and the
|
||||
// An ASSOCIATOR object provides the cross reference from the EthernetSwitchPort and the
|
||||
// SyntheticEthernetPortSettingData, but generated wrappers do not expose a ASSOCIATOR OF query as a method.
|
||||
// Instead, we use the System.Management to code the equivalant of
|
||||
// Instead, we use the System.Management to code the equivalant of
|
||||
// string query = string.Format( "ASSOCIATORS OF {{{0}}} WHERE ResultClass = {1}", vm.path, resultclassName);
|
||||
//
|
||||
var wmiObjQuery = new RelatedObjectQuery(port.Path.Path, SyntheticEthernetPortSettingData.CreatedClassName);
|
||||
@ -1620,7 +1620,7 @@ namespace HypervResource
|
||||
/// <param name="storageSettings">Msvm_StorageAllocationSettings with HostResource configured with image
|
||||
/// file and Parent set to a controller associated with the ComputerSystem</param>
|
||||
/// <param name="vm">VM to which the disk image will be attached.</param>
|
||||
// Add new
|
||||
// Add new
|
||||
private ManagementPath[] AddStorageResource(string[] storageSettings, ComputerSystem vm)
|
||||
{
|
||||
return AddVirtualResource(storageSettings, vm);
|
||||
@ -1697,7 +1697,7 @@ namespace HypervResource
|
||||
var vmVirtMgmtSvc = GetVirtualisationSystemManagementService();
|
||||
EthernetSwitchPortVlanSettingData.GetInstances();
|
||||
|
||||
// Create NIC resource by cloning the default NIC
|
||||
// Create NIC resource by cloning the default NIC
|
||||
var vlanSettings = EthernetSwitchPortVlanSettingData.GetInstances(vmVirtMgmtSvc.Scope, "InstanceID LIKE \"%Default\"");
|
||||
|
||||
// Assert
|
||||
@ -1783,7 +1783,7 @@ namespace HypervResource
|
||||
/// <remarks>
|
||||
/// With V1 API, external ethernet port was attached to the land endpoint, which was attached to the switch.
|
||||
/// e.g. Msvm_ExternalEthernetPort -> SwitchLANEndpoint -> SwitchPort -> VirtualSwitch
|
||||
///
|
||||
///
|
||||
/// With V2 API, there are two kinds of lan endpoint: one on the computer system and one on the switch
|
||||
/// e.g. Msvm_ExternalEthernetPort -> LANEndpoint -> LANEdnpoint -> EthernetSwitchPort -> VirtualEthernetSwitch
|
||||
/// </remarks>
|
||||
@ -1800,7 +1800,7 @@ namespace HypervResource
|
||||
logger.Error(errMsg, ex);
|
||||
throw ex;
|
||||
}
|
||||
foreach(ExternalEthernetPort externNIC in externNICs.OfType<ExternalEthernetPort>()) {
|
||||
foreach(ExternalEthernetPort externNIC in externNICs.OfType<ExternalEthernetPort>()) {
|
||||
// A sequence of ASSOCIATOR objects need to be traversed to get from external NIC the vswitch.
|
||||
// We use ManagementObjectSearcher objects to execute this sequence of questions
|
||||
// NB: default scope of ManagementObjectSearcher is '\\.\root\cimv2', which does not contain
|
||||
@ -1822,7 +1822,7 @@ namespace HypervResource
|
||||
var switchEndpointQuery = new RelatedObjectQuery(adapterEndPoint.Path.Path, LANEndpoint.CreatedClassName);
|
||||
var switchEndpointSearch = new ManagementObjectSearcher(externNIC.Scope, switchEndpointQuery);
|
||||
var switchEndpointCollection = new LANEndpoint.LANEndpointCollection(switchEndpointSearch.Get());
|
||||
|
||||
|
||||
// assert
|
||||
if (endpointCollection.Count < 1)
|
||||
{
|
||||
@ -1831,12 +1831,12 @@ namespace HypervResource
|
||||
logger.Error(errMsg, ex);
|
||||
throw ex;
|
||||
}
|
||||
|
||||
|
||||
LANEndpoint switchEndPoint = switchEndpointCollection.OfType<LANEndpoint>().First();
|
||||
var switchPortQuery = new RelatedObjectQuery(switchEndPoint.Path.Path, EthernetSwitchPort.CreatedClassName);
|
||||
var switchPortSearch = new ManagementObjectSearcher(switchEndPoint.Scope, switchPortQuery);
|
||||
var switchPortCollection = new EthernetSwitchPort.EthernetSwitchPortCollection(switchPortSearch.Get());
|
||||
|
||||
|
||||
// assert
|
||||
if (switchPortCollection.Count < 1 )
|
||||
{
|
||||
@ -1845,7 +1845,7 @@ namespace HypervResource
|
||||
logger.Error(errMsg, ex);
|
||||
throw ex;
|
||||
}
|
||||
|
||||
|
||||
EthernetSwitchPort switchPort = switchPortCollection.OfType<EthernetSwitchPort>().First();
|
||||
var vSwitchQuery = new RelatedObjectQuery(switchPort.Path.Path, VirtualEthernetSwitch.CreatedClassName);
|
||||
var vSwitchSearch = new ManagementObjectSearcher(externNIC.Scope, vSwitchQuery);
|
||||
@ -2001,7 +2001,7 @@ namespace HypervResource
|
||||
|
||||
private static ComputerSystem CreateDefaultVm(VirtualSystemManagementService vmMgmtSvc, string name)
|
||||
{
|
||||
// Tweak default settings by basing new VM on default global setting object
|
||||
// Tweak default settings by basing new VM on default global setting object
|
||||
// with designed display name.
|
||||
UInt16 startupAction = 2; // Do nothing.
|
||||
UInt16 stopAction = 4; // Shutdown.
|
||||
@ -2142,7 +2142,7 @@ namespace HypervResource
|
||||
{
|
||||
// VirtualSystemManagementService is a singleton, most anonymous way of lookup is by asking for the set
|
||||
// of local instances, which should be size 1.
|
||||
|
||||
|
||||
var virtSysMgmtSvcCollection = VirtualSystemManagementService.GetInstances();
|
||||
foreach (VirtualSystemManagementService item in virtSysMgmtSvcCollection)
|
||||
{
|
||||
@ -2192,8 +2192,8 @@ namespace HypervResource
|
||||
if (jobObj.JobState != JobState.Completed)
|
||||
{
|
||||
var errMsg = string.Format(
|
||||
"Hyper-V Job failed, Error Code:{0}, Description: {1}",
|
||||
jobObj.ErrorCode,
|
||||
"Hyper-V Job failed, Error Code:{0}, Description: {1}",
|
||||
jobObj.ErrorCode,
|
||||
jobObj.ErrorDescription);
|
||||
var ex = new WmiException(errMsg);
|
||||
logger.Error(errMsg, ex);
|
||||
@ -2269,18 +2269,18 @@ namespace HypervResource
|
||||
sockets++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void GetProcessorUsageInfo(out double cpuUtilization)
|
||||
{
|
||||
PerfFormattedData_Counters_ProcessorInformation.PerfFormattedData_Counters_ProcessorInformationCollection coll =
|
||||
PerfFormattedData_Counters_ProcessorInformation.PerfFormattedData_Counters_ProcessorInformationCollection coll =
|
||||
PerfFormattedData_Counters_ProcessorInformation.GetInstances("Name=\"_Total\"");
|
||||
cpuUtilization = 100;
|
||||
// Use the first one
|
||||
foreach (PerfFormattedData_Counters_ProcessorInformation procInfo in coll)
|
||||
{
|
||||
// Idle during a given internal
|
||||
// Idle during a given internal
|
||||
// See http://library.wmifun.net/cimv2/win32_perfformatteddata_counters_processorinformation.html
|
||||
cpuUtilization = 100.0 - (double)procInfo.PercentIdleTime;
|
||||
cpuUtilization = 100.0 - (double)procInfo.PercentIdleTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2308,7 +2308,7 @@ namespace HypervResource
|
||||
logger.Error(errMsg);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
return defaultVirtualHardDiskPath;
|
||||
}
|
||||
|
||||
@ -2376,9 +2376,9 @@ namespace HypervResource
|
||||
|
||||
public ProcessorSettingData GetProcSettings(VirtualSystemSettingData vmSettings)
|
||||
{
|
||||
// An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the
|
||||
// An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the
|
||||
// ProcessorSettingData, but generated wrappers do not expose a ASSOCIATOR OF query as a method.
|
||||
// Instead, we use the System.Management to code the equivalant of
|
||||
// Instead, we use the System.Management to code the equivalant of
|
||||
// string query = string.Format( "ASSOCIATORS OF {{{0}}} WHERE ResultClass = {1}", vmSettings.path, resultclassName);
|
||||
//
|
||||
var wmiObjQuery = new RelatedObjectQuery(vmSettings.Path.Path, ProcessorSettingData.CreatedClassName);
|
||||
@ -2401,9 +2401,9 @@ namespace HypervResource
|
||||
|
||||
public MemorySettingData GetMemSettings(VirtualSystemSettingData vmSettings)
|
||||
{
|
||||
// An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the
|
||||
// An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the
|
||||
// MemorySettingData, but generated wrappers do not expose a ASSOCIATOR OF query as a method.
|
||||
// Instead, we use the System.Management to code the equivalant of
|
||||
// Instead, we use the System.Management to code the equivalant of
|
||||
// string query = string.Format( "ASSOCIATORS OF {{{0}}} WHERE ResultClass = {1}", vmSettings.path, resultclassName);
|
||||
//
|
||||
var wmiObjQuery = new RelatedObjectQuery(vmSettings.Path.Path, MemorySettingData.CreatedClassName);
|
||||
@ -2431,7 +2431,7 @@ namespace HypervResource
|
||||
|
||||
foreach (ResourceAllocationSettingData wmiObj in wmiObjCollection)
|
||||
{
|
||||
// DVD drive is '16', see http://msdn.microsoft.com/en-us/library/hh850200(v=vs.85).aspx
|
||||
// DVD drive is '16', see http://msdn.microsoft.com/en-us/library/hh850200(v=vs.85).aspx
|
||||
if (wmiObj.ResourceType == 16)
|
||||
{
|
||||
return wmiObj;
|
||||
@ -2459,8 +2459,8 @@ namespace HypervResource
|
||||
}
|
||||
|
||||
var errMsg = string.Format(
|
||||
"Cannot find the Microsoft Emulated IDE Controlle at address {0} in VirtualSystemSettingData {1}",
|
||||
cntrllerAddr,
|
||||
"Cannot find the Microsoft Emulated IDE Controlle at address {0} in VirtualSystemSettingData {1}",
|
||||
cntrllerAddr,
|
||||
vmSettings.Path.Path);
|
||||
var ex = new WmiException(errMsg);
|
||||
logger.Error(errMsg, ex);
|
||||
@ -2488,8 +2488,8 @@ namespace HypervResource
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// VM resources, typically hardware a described by a generic MSVM_ResourceAllocationSettingData object. The hardware type being
|
||||
/// described is identified in two ways: in general terms using an enum in the ResourceType field, and in terms of the implementation
|
||||
/// VM resources, typically hardware a described by a generic MSVM_ResourceAllocationSettingData object. The hardware type being
|
||||
/// described is identified in two ways: in general terms using an enum in the ResourceType field, and in terms of the implementation
|
||||
/// using text in the ResourceSubType field.
|
||||
/// See http://msdn.microsoft.com/en-us/library/cc136877%28v=vs.85%29.aspx
|
||||
/// </summary>
|
||||
@ -2497,9 +2497,9 @@ namespace HypervResource
|
||||
/// <returns></returns>
|
||||
public ResourceAllocationSettingData.ResourceAllocationSettingDataCollection GetResourceAllocationSettings(VirtualSystemSettingData vmSettings)
|
||||
{
|
||||
// An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the
|
||||
// An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the
|
||||
// ResourceAllocationSettingData, but generated wrappers do not expose a ASSOCIATOR OF query as a method.
|
||||
// Instead, we use the System.Management to code the equivalant of
|
||||
// Instead, we use the System.Management to code the equivalant of
|
||||
// string query = string.Format( "ASSOCIATORS OF {{{0}}} WHERE ResultClass = {1}", vmSettings.path, resultclassName);
|
||||
//
|
||||
var wmiObjQuery = new RelatedObjectQuery(vmSettings.Path.Path, ResourceAllocationSettingData.CreatedClassName);
|
||||
@ -2525,9 +2525,9 @@ namespace HypervResource
|
||||
// ComputerSystem -> VirtualSystemSettingData -> EthernetPortAllocationSettingData
|
||||
VirtualSystemSettingData vmSettings = GetVmSettings(vm);
|
||||
|
||||
// An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the
|
||||
// An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the
|
||||
// EthernetPortAllocationSettingData, but generated wrappers do not expose a ASSOCIATOR OF query as a method.
|
||||
// Instead, we use the System.Management to code the equivalant of
|
||||
// Instead, we use the System.Management to code the equivalant of
|
||||
// string query = string.Format( "ASSOCIATORS OF {{{0}}} WHERE ResultClass = {1}", vmSettings.path, resultclassName);
|
||||
//
|
||||
var wmiObjQuery = new RelatedObjectQuery(vmSettings.Path.Path, EthernetPortAllocationSettingData.CreatedClassName);
|
||||
@ -2568,9 +2568,9 @@ namespace HypervResource
|
||||
|
||||
public EthernetSwitchPortVlanSettingData GetVlanSettings(EthernetPortAllocationSettingData ethernetConnection)
|
||||
{
|
||||
// An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the
|
||||
// An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the
|
||||
// EthernetPortAllocationSettingData, but generated wrappers do not expose a ASSOCIATOR OF query as a method.
|
||||
// Instead, we use the System.Management to code the equivalant of
|
||||
// Instead, we use the System.Management to code the equivalant of
|
||||
// string query = string.Format( "ASSOCIATORS OF {{{0}}} WHERE ResultClass = {1}", vmSettings.path, resultclassName);
|
||||
//
|
||||
var wmiObjQuery = new RelatedObjectQuery(ethernetConnection.Path.Path, EthernetSwitchPortVlanSettingData.CreatedClassName);
|
||||
@ -2596,14 +2596,14 @@ namespace HypervResource
|
||||
|
||||
return wmiObjCollection.OfType<EthernetSwitchPortVlanSettingData>().First();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public SyntheticEthernetPortSettingData[] GetEthernetPortSettings(ComputerSystem vm)
|
||||
{
|
||||
// An ASSOCIATOR object provides the cross reference from the ComputerSettings and the
|
||||
// An ASSOCIATOR object provides the cross reference from the ComputerSettings and the
|
||||
// SyntheticEthernetPortSettingData, via the VirtualSystemSettingData.
|
||||
// However, generated wrappers do not expose a ASSOCIATOR OF query as a method.
|
||||
// Instead, we use the System.Management to code the equivalant of
|
||||
// Instead, we use the System.Management to code the equivalant of
|
||||
//
|
||||
// string query = string.Format( "ASSOCIATORS OF {{{0}}} WHERE ResultClass = {1}", vm.path, resultclassName);
|
||||
//
|
||||
@ -2640,9 +2640,9 @@ namespace HypervResource
|
||||
|
||||
public VirtualSystemSettingData GetVmSettings(ComputerSystem vm)
|
||||
{
|
||||
// An ASSOCIATOR object provides the cross reference from the ComputerSettings and the
|
||||
// An ASSOCIATOR object provides the cross reference from the ComputerSettings and the
|
||||
// VirtualSystemSettingData, but generated wrappers do not expose a ASSOCIATOR OF query as a method.
|
||||
// Instead, we use the System.Management to code the equivalant of
|
||||
// Instead, we use the System.Management to code the equivalant of
|
||||
// string query = string.Format( "ASSOCIATORS OF {{{0}}} WHERE ResultClass = {1}", vm.path, resultclassName);
|
||||
//
|
||||
var wmiObjQuery = new RelatedObjectQuery(vm.Path.Path, VirtualSystemSettingData.CreatedClassName);
|
||||
@ -2671,9 +2671,9 @@ namespace HypervResource
|
||||
|
||||
public KvpExchangeComponentSettingData GetKvpSettings(VirtualSystemSettingData vmSettings)
|
||||
{
|
||||
// An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the
|
||||
// An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the
|
||||
// KvpExchangeComponentSettingData, but generated wrappers do not expose a ASSOCIATOR OF query as a method.
|
||||
// Instead, we use the System.Management to code the equivalant of
|
||||
// Instead, we use the System.Management to code the equivalant of
|
||||
// string query = string.Format( "ASSOCIATORS OF {{{0}}} WHERE ResultClass = {1}", vmSettings.path, resultclassName);
|
||||
//
|
||||
var wmiObjQuery = new RelatedObjectQuery(vmSettings.Path.Path, KvpExchangeComponentSettingData.CreatedClassName);
|
||||
@ -2700,7 +2700,7 @@ namespace HypervResource
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Process info available from WMI,
|
||||
// Process info available from WMI,
|
||||
// See http://msdn.microsoft.com/en-us/library/hh850062(v=vs.85).aspx
|
||||
uint[] requestedInfo = new uint[] { // TODO: correct?
|
||||
0, // Name
|
||||
@ -2887,7 +2887,7 @@ namespace HypervResource
|
||||
/// http://msdn.microsoft.com/en-us/library/hh850116(v=vs.85).aspx#methods
|
||||
/// However, the CIM standard has additional possibilities based on the description
|
||||
/// of EnabledState.
|
||||
/// The previous V1 API is described by
|
||||
/// The previous V1 API is described by
|
||||
/// http://msdn.microsoft.com/en-us/library/cc136822%28v=vs.85%29.aspx
|
||||
/// </summary>
|
||||
public class EnabledState
|
||||
@ -2914,27 +2914,27 @@ namespace HypervResource
|
||||
public const UInt16 Suspended = 32769;
|
||||
/// <summary>
|
||||
/// The VM is starting. This is a transitional state between 3 (Disabled)
|
||||
/// or 32769 (Suspended) and 2 (Enabled) initiated by a call to the
|
||||
/// or 32769 (Suspended) and 2 (Enabled) initiated by a call to the
|
||||
/// RequestStateChange method with a RequestedState parameter of 2 (Enabled).
|
||||
/// </summary>
|
||||
public const UInt16 Starting = 32770;
|
||||
/// <summary>
|
||||
/// Starting with Windows Server 2008 R2 this value is not supported.
|
||||
/// If the VM is performing a snapshot operation, the element at index 1
|
||||
/// of the OperationalStatus property array will contain 32768 (Creating Snapshot),
|
||||
/// Starting with Windows Server 2008 R2 this value is not supported.
|
||||
/// If the VM is performing a snapshot operation, the element at index 1
|
||||
/// of the OperationalStatus property array will contain 32768 (Creating Snapshot),
|
||||
/// 32769 (Applying Snapshot), or 32770 (Deleting Snapshot).
|
||||
/// </summary>
|
||||
public const UInt16 Snapshotting = 32771;
|
||||
/// <summary>
|
||||
/// The VM is saving its state. This is a transitional state between 2 (Enabled)
|
||||
/// and 32769 (Suspended) initiated by a call to the RequestStateChange method
|
||||
/// and 32769 (Suspended) initiated by a call to the RequestStateChange method
|
||||
/// with a RequestedState parameter of 32769 (Suspended).
|
||||
/// </summary>
|
||||
public const UInt16 Saving = 32773;
|
||||
/// <summary>
|
||||
/// The VM is turning off. This is a transitional state between 2 (Enabled)
|
||||
/// and 3 (Disabled) initiated by a call to the RequestStateChange method
|
||||
/// with a RequestedState parameter of 3 (Disabled) or a guest operating system
|
||||
/// The VM is turning off. This is a transitional state between 2 (Enabled)
|
||||
/// and 3 (Disabled) initiated by a call to the RequestStateChange method
|
||||
/// with a RequestedState parameter of 3 (Disabled) or a guest operating system
|
||||
/// initiated power off.
|
||||
/// </summary>
|
||||
public const UInt16 Stopping = 32774;
|
||||
@ -2980,7 +2980,7 @@ namespace HypervResource
|
||||
case Saving: result = "Saving"; break;
|
||||
case Stopping: result = "Stopping"; break;
|
||||
case Pausing: result = "Unknown"; break;
|
||||
case Resuming: result = "Starting"; break;
|
||||
case Resuming: result = "Starting"; break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ namespace ServerResource.Tests
|
||||
|
||||
/// <summary>
|
||||
/// Test WmiCalls to which incoming HTTP POST requests are dispatched.
|
||||
///
|
||||
///
|
||||
/// TODO: revise beyond first approximation
|
||||
/// First approximation is a quick port of the existing Java tests for Hyper-V server resource.
|
||||
/// A second approximation would use the AgentShell settings files directly.
|
||||
@ -117,10 +117,10 @@ namespace ServerResource.Tests
|
||||
|
||||
// Clean up old test files in local storage folder
|
||||
FileInfo testVolWorks = new FileInfo(Path.Combine(testLocalStorePath, testSampleVolumeWorkingUUID));
|
||||
// Assert.True(testVolWorks.Exists, "Create a working virtual disk at " + testVolWorks.FullName);
|
||||
|
||||
// Assert.True(testVolWorks.Exists, "Create a working virtual disk at " + testVolWorks.FullName);
|
||||
|
||||
testSampleTemplateURLJSON = JsonConvert.SerializeObject(testSampleTemplateUUID);
|
||||
s_logger.Info("Created " + testSampleTemplateURLJSON + " in local storage.");
|
||||
s_logger.Info("Created " + testSampleTemplateURLJSON + " in local storage.");
|
||||
|
||||
|
||||
// Capture other JSON encoded paths
|
||||
@ -150,7 +150,7 @@ namespace ServerResource.Tests
|
||||
|
||||
return JsonConvert.SerializeObject(newFileInfo.FullName);
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void TestCreateCommand()
|
||||
{
|
||||
@ -267,7 +267,7 @@ 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);
|
||||
|
||||
Assert.Null((string)startAns[0][CloudStackTypes.StartAnswer].details);
|
||||
Assert.Null((string)startAns[0][CloudStackTypes.StartAnswer].details);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -323,7 +323,7 @@ namespace ServerResource.Tests
|
||||
"\"volumeId\":10," +
|
||||
// "\"vmName\":\"i-3-5-VM\"," + // TODO: do we have to fill in the vmName?
|
||||
"\"accountId\":3,\"id\":10}" +
|
||||
"}"; // end of destTO
|
||||
"}"; // end of destTO
|
||||
return sampleVolumeObjectTO;
|
||||
}
|
||||
|
||||
@ -345,6 +345,6 @@ namespace ServerResource.Tests
|
||||
"\"broadcastUri\":\"vlan://261\",\"isolationUri\":\"vlan://261\",\"isSecurityGroupEnabled\":false}" +
|
||||
"]},\"contextMap\":{},\"wait\":0}";
|
||||
return sample;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ namespace ServerResource.Tests
|
||||
|
||||
/// <summary>
|
||||
/// Test WmiCalls to which incoming HTTP POST requests are dispatched.
|
||||
///
|
||||
///
|
||||
/// TODO: revise beyond first approximation
|
||||
/// First approximation is a quick port of the existing Java tests for Hyper-V server resource.
|
||||
/// A second approximation would use the AgentShell settings files directly.
|
||||
@ -326,7 +326,7 @@ namespace ServerResource.Tests
|
||||
"\"volumeId\":10," +
|
||||
// "\"vmName\":\"i-3-5-VM\"," + // TODO: do we have to fill in the vmName?
|
||||
"\"accountId\":3,\"id\":10}" +
|
||||
"}"; // end of destTO
|
||||
"}"; // end of destTO
|
||||
return sampleVolumeObjectTO;
|
||||
}
|
||||
|
||||
@ -443,7 +443,7 @@ namespace ServerResource.Tests
|
||||
"\"vmName\":\"i-3-5-VM\"," +
|
||||
"\"accountId\":3," +
|
||||
"\"id\":10 }" +
|
||||
"}," + // end of destTO
|
||||
"}," + // end of destTO
|
||||
"\"wait\":0}"; // end of Copy Command
|
||||
#endregion
|
||||
//"name":"ROOT-8","size":140616708,"volumeId":8,"vmName":"s-8-VM","accountId":1,"id":8}},"contextMap":{},"wait":0}
|
||||
@ -562,7 +562,7 @@ namespace ServerResource.Tests
|
||||
"\"vmName\":\"i-3-5-VM\"," +
|
||||
"\"accountId\":1," +
|
||||
"\"id\":10}" +
|
||||
"}," + // end of destTO
|
||||
"}," + // end of destTO
|
||||
"\"wait\":0}"; // end of Copy Command
|
||||
#endregion
|
||||
|
||||
@ -1117,7 +1117,7 @@ namespace ServerResource.Tests
|
||||
string strippedExpectedMac = expectedMac.Replace(":", string.Empty);
|
||||
Assert.Equal(nicSettingsViaVm[0].Address.ToLower(), strippedExpectedMac.ToLower());
|
||||
|
||||
// Assert switchport has correct VLAN
|
||||
// Assert switchport has correct VLAN
|
||||
var ethernetConnections = wmiCallsV2.GetEthernetConnections(vm);
|
||||
var vlanSettings = wmiCallsV2.GetVlanSettings(ethernetConnections[0]);
|
||||
string isolationUri = (string)jsonStartCmd.vm.nics[0].isolationUri;
|
||||
|
||||
@ -19,7 +19,7 @@ using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ServerResource.Tests")]
|
||||
@ -31,8 +31,8 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
@ -42,11 +42,11 @@ using System.Runtime.InteropServices;
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
@ -19,7 +19,7 @@ using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("WmiWrappers")]
|
||||
@ -31,8 +31,8 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
@ -42,11 +42,11 @@ using System.Runtime.InteropServices;
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -23,70 +23,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
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_EthernetSwitchPortBandwidthSettingData
|
||||
public class EthernetSwitchPortBandwidthSettingData : System.ComponentModel.Component {
|
||||
|
||||
|
||||
// Private property to hold the WMI namespace in which the class resides.
|
||||
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_EthernetSwitchPortBandwidthSettingData";
|
||||
|
||||
|
||||
// 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 EthernetSwitchPortBandwidthSettingData() {
|
||||
this.InitializeObject(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public EthernetSwitchPortBandwidthSettingData(string keyInstanceID) {
|
||||
this.InitializeObject(null, new System.Management.ManagementPath(EthernetSwitchPortBandwidthSettingData.ConstructPath(keyInstanceID)), null);
|
||||
}
|
||||
|
||||
|
||||
public EthernetSwitchPortBandwidthSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) {
|
||||
this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(EthernetSwitchPortBandwidthSettingData.ConstructPath(keyInstanceID)), null);
|
||||
}
|
||||
|
||||
|
||||
public EthernetSwitchPortBandwidthSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
|
||||
this.InitializeObject(null, path, getOptions);
|
||||
}
|
||||
|
||||
|
||||
public EthernetSwitchPortBandwidthSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
|
||||
this.InitializeObject(mgmtScope, path, null);
|
||||
}
|
||||
|
||||
|
||||
public EthernetSwitchPortBandwidthSettingData(System.Management.ManagementPath path) {
|
||||
this.InitializeObject(null, path, null);
|
||||
}
|
||||
|
||||
|
||||
public EthernetSwitchPortBandwidthSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
|
||||
this.InitializeObject(mgmtScope, path, getOptions);
|
||||
}
|
||||
|
||||
|
||||
public EthernetSwitchPortBandwidthSettingData(System.Management.ManagementObject theObject) {
|
||||
Initialize();
|
||||
if ((CheckIfProperClass(theObject) == true)) {
|
||||
@ -98,7 +98,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public EthernetSwitchPortBandwidthSettingData(System.Management.ManagementBaseObject theObject) {
|
||||
Initialize();
|
||||
if ((CheckIfProperClass(theObject) == true)) {
|
||||
@ -111,7 +111,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returns the namespace of the WMI class.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -120,7 +120,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return "ROOT\\virtualization\\v2";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ManagementClassName {
|
||||
@ -129,7 +129,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
if ((curObj != null)) {
|
||||
if ((curObj.ClassPath != null)) {
|
||||
strRet = ((string)(curObj["__CLASS"]));
|
||||
if (((strRet == null)
|
||||
if (((strRet == null)
|
||||
|| (strRet == string.Empty))) {
|
||||
strRet = CreatedClassName;
|
||||
}
|
||||
@ -138,7 +138,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return strRet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property pointing to an embedded object to get System properties of the WMI object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -147,7 +147,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return PrivateSystemProperties;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returning the underlying lateBound object.
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -156,7 +156,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return curObj;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ManagementScope of the object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -175,7 +175,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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)]
|
||||
@ -187,7 +187,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
AutoCommitProp = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// The ManagementPath of the underlying WMI object.
|
||||
[Browsable(true)]
|
||||
public System.Management.ManagementPath Path {
|
||||
@ -208,7 +208,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Public static scope property which is used by the various methods.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -220,7 +220,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
statMgmtScope = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsBurstLimitNull {
|
||||
@ -233,7 +233,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The peak bandwidth allowed from the port during bursts.")]
|
||||
@ -247,13 +247,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["BurstLimit"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsBurstSizeNull {
|
||||
@ -266,7 +266,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The maximum burst size allowed.")]
|
||||
@ -280,13 +280,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["BurstSize"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Caption {
|
||||
@ -294,7 +294,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["Caption"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Description {
|
||||
@ -302,7 +302,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["Description"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ElementName {
|
||||
@ -310,7 +310,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["ElementName"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string InstanceID {
|
||||
@ -318,7 +318,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["InstanceID"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsLimitNull {
|
||||
@ -331,7 +331,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The bandwidth limit allowed for the port.")]
|
||||
@ -345,13 +345,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["Limit"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsReservationNull {
|
||||
@ -364,7 +364,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The minimum absolute bandwidth guaranteed for the port.")]
|
||||
@ -378,13 +378,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["Reservation"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsWeightNull {
|
||||
@ -397,7 +397,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The minimum bandwidth in weight guaranteed for the port.")]
|
||||
@ -411,15 +411,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["Weight"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) {
|
||||
if (((path != null)
|
||||
if (((path != null)
|
||||
&& (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -427,9 +427,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) {
|
||||
if (((theObj != null)
|
||||
if (((theObj != null)
|
||||
&& (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -446,107 +446,107 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeBurstLimit() {
|
||||
if ((this.IsBurstLimitNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void ResetBurstLimit() {
|
||||
curObj["BurstLimit"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeBurstSize() {
|
||||
if ((this.IsBurstSizeNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void ResetBurstSize() {
|
||||
curObj["BurstSize"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeLimit() {
|
||||
if ((this.IsLimitNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void ResetLimit() {
|
||||
curObj["Limit"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeReservation() {
|
||||
if ((this.IsReservationNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void ResetReservation() {
|
||||
curObj["Reservation"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeWeight() {
|
||||
if ((this.IsWeightNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void ResetWeight() {
|
||||
curObj["Weight"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[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\\v2:Msvm_EthernetSwitchPortBandwidthSettingData";
|
||||
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)) {
|
||||
@ -558,24 +558,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject);
|
||||
curObj = PrivateLateBoundObject;
|
||||
}
|
||||
|
||||
|
||||
// Different overloads of GetInstances() help in enumerating instances of the WMI class.
|
||||
public static EthernetSwitchPortBandwidthSettingDataCollection GetInstances() {
|
||||
return GetInstances(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public static EthernetSwitchPortBandwidthSettingDataCollection GetInstances(string condition) {
|
||||
return GetInstances(null, condition, null);
|
||||
}
|
||||
|
||||
|
||||
public static EthernetSwitchPortBandwidthSettingDataCollection GetInstances(string[] selectedProperties) {
|
||||
return GetInstances(null, null, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static EthernetSwitchPortBandwidthSettingDataCollection GetInstances(string condition, string[] selectedProperties) {
|
||||
return GetInstances(null, condition, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static EthernetSwitchPortBandwidthSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
|
||||
if ((mgmtScope == null)) {
|
||||
if ((statMgmtScope == null)) {
|
||||
@ -596,15 +596,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
return new EthernetSwitchPortBandwidthSettingDataCollection(clsObject.GetInstances(enumOptions));
|
||||
}
|
||||
|
||||
|
||||
public static EthernetSwitchPortBandwidthSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
|
||||
return GetInstances(mgmtScope, condition, null);
|
||||
}
|
||||
|
||||
|
||||
public static EthernetSwitchPortBandwidthSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
|
||||
return GetInstances(mgmtScope, null, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static EthernetSwitchPortBandwidthSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
|
||||
if ((mgmtScope == null)) {
|
||||
if ((statMgmtScope == null)) {
|
||||
@ -621,7 +621,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
ObjectSearcher.Options = enumOptions;
|
||||
return new EthernetSwitchPortBandwidthSettingDataCollection(ObjectSearcher.Get());
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public static EthernetSwitchPortBandwidthSettingData CreateInstance() {
|
||||
System.Management.ManagementScope mgmtScope = null;
|
||||
@ -636,39 +636,39 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null);
|
||||
return new EthernetSwitchPortBandwidthSettingData(tmpMgmtClass.CreateInstance());
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public void Delete() {
|
||||
PrivateLateBoundObject.Delete();
|
||||
}
|
||||
|
||||
|
||||
// Enumerator implementation for enumerating instances of the class.
|
||||
public class EthernetSwitchPortBandwidthSettingDataCollection : object, ICollection {
|
||||
|
||||
|
||||
private ManagementObjectCollection privColObj;
|
||||
|
||||
|
||||
public EthernetSwitchPortBandwidthSettingDataCollection(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;
|
||||
@ -676,189 +676,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
array.SetValue(new EthernetSwitchPortBandwidthSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public virtual System.Collections.IEnumerator GetEnumerator() {
|
||||
return new EthernetSwitchPortBandwidthSettingDataEnumerator(privColObj.GetEnumerator());
|
||||
}
|
||||
|
||||
|
||||
public class EthernetSwitchPortBandwidthSettingDataEnumerator : object, System.Collections.IEnumerator {
|
||||
|
||||
|
||||
private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum;
|
||||
|
||||
|
||||
public EthernetSwitchPortBandwidthSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
|
||||
privObjEnum = objEnum;
|
||||
}
|
||||
|
||||
|
||||
public virtual object Current {
|
||||
get {
|
||||
return new EthernetSwitchPortBandwidthSettingData(((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))
|
||||
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))
|
||||
if (((baseType == typeof(bool))
|
||||
&& (baseType.BaseType == typeof(System.ValueType)))) {
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
&& (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
|
||||
return "";
|
||||
}
|
||||
return baseConverter.ConvertTo(context, culture, value, destinationType);
|
||||
}
|
||||
if (((context != null)
|
||||
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 {
|
||||
|
||||
@ -23,70 +23,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
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_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\\v2";
|
||||
|
||||
|
||||
// Private property to hold the name of WMI class which created this class.
|
||||
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;
|
||||
|
||||
|
||||
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 EthernetSwitchPortVlanSettingData() {
|
||||
this.InitializeObject(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public EthernetSwitchPortVlanSettingData(string keyInstanceID) {
|
||||
this.InitializeObject(null, new System.Management.ManagementPath(EthernetSwitchPortVlanSettingData.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 EthernetSwitchPortVlanSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
|
||||
this.InitializeObject(null, path, getOptions);
|
||||
}
|
||||
|
||||
|
||||
public EthernetSwitchPortVlanSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
|
||||
this.InitializeObject(mgmtScope, path, null);
|
||||
}
|
||||
|
||||
|
||||
public EthernetSwitchPortVlanSettingData(System.Management.ManagementPath path) {
|
||||
this.InitializeObject(null, path, null);
|
||||
}
|
||||
|
||||
|
||||
public EthernetSwitchPortVlanSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
|
||||
this.InitializeObject(mgmtScope, path, getOptions);
|
||||
}
|
||||
|
||||
|
||||
public EthernetSwitchPortVlanSettingData(System.Management.ManagementObject theObject) {
|
||||
Initialize();
|
||||
if ((CheckIfProperClass(theObject) == true)) {
|
||||
@ -98,7 +98,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public EthernetSwitchPortVlanSettingData(System.Management.ManagementBaseObject theObject) {
|
||||
Initialize();
|
||||
if ((CheckIfProperClass(theObject) == true)) {
|
||||
@ -111,7 +111,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returns the namespace of the WMI class.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -120,7 +120,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return "ROOT\\virtualization\\v2";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ManagementClassName {
|
||||
@ -129,7 +129,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
if ((curObj != null)) {
|
||||
if ((curObj.ClassPath != null)) {
|
||||
strRet = ((string)(curObj["__CLASS"]));
|
||||
if (((strRet == null)
|
||||
if (((strRet == null)
|
||||
|| (strRet == string.Empty))) {
|
||||
strRet = CreatedClassName;
|
||||
}
|
||||
@ -138,7 +138,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return strRet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property pointing to an embedded object to get System properties of the WMI object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -147,7 +147,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return PrivateSystemProperties;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returning the underlying lateBound object.
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -156,7 +156,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return curObj;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ManagementScope of the object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -175,7 +175,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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)]
|
||||
@ -187,7 +187,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
AutoCommitProp = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// The ManagementPath of the underlying WMI object.
|
||||
[Browsable(true)]
|
||||
public System.Management.ManagementPath Path {
|
||||
@ -208,7 +208,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Public static scope property which is used by the various methods.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -220,7 +220,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
statMgmtScope = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsAccessVlanIdNull {
|
||||
@ -233,7 +233,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The vlan ID in access mode.")]
|
||||
@ -247,13 +247,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["AccessVlanId"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Caption {
|
||||
@ -261,7 +261,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["Caption"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Description {
|
||||
@ -269,7 +269,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["Description"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ElementName {
|
||||
@ -277,7 +277,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["ElementName"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string InstanceID {
|
||||
@ -285,7 +285,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["InstanceID"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsNativeVlanIdNull {
|
||||
@ -298,7 +298,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The vlan ID in trunk mode.")]
|
||||
@ -312,13 +312,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["NativeVlanId"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsOperationModeNull {
|
||||
@ -331,7 +331,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The vlan operation modes.")]
|
||||
@ -350,13 +350,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
else {
|
||||
curObj["OperationMode"] = value;
|
||||
}
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsPrimaryVlanIdNull {
|
||||
@ -369,7 +369,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The primary vlan ID in private mode.")]
|
||||
@ -383,13 +383,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["PrimaryVlanId"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The prune vlan ID bitmap in trunk mode.")]
|
||||
@ -399,13 +399,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["PruneVlanIdArray"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsPvlanModeNull {
|
||||
@ -418,7 +418,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The private vlan modes.")]
|
||||
@ -437,13 +437,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
else {
|
||||
curObj["PvlanMode"] = value;
|
||||
}
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsSecondaryVlanIdNull {
|
||||
@ -456,7 +456,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The secondary vlan ID in private mode.")]
|
||||
@ -470,13 +470,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["SecondaryVlanId"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The secondary vlan ID bitmap in private mode.")]
|
||||
@ -486,13 +486,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["SecondaryVlanIdArray"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The trunk vlan ID bitmap in trunk mode.")]
|
||||
@ -502,15 +502,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["TrunkVlanIdArray"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) {
|
||||
if (((path != null)
|
||||
if (((path != null)
|
||||
&& (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -518,9 +518,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) {
|
||||
if (((theObj != null)
|
||||
if (((theObj != null)
|
||||
&& (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -537,146 +537,146 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeAccessVlanId() {
|
||||
if ((this.IsAccessVlanIdNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void ResetAccessVlanId() {
|
||||
curObj["AccessVlanId"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeNativeVlanId() {
|
||||
if ((this.IsNativeVlanIdNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void ResetNativeVlanId() {
|
||||
curObj["NativeVlanId"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeOperationMode() {
|
||||
if ((this.IsOperationModeNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void ResetOperationMode() {
|
||||
curObj["OperationMode"] = null;
|
||||
if (((isEmbedded == false)
|
||||
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)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ResetPruneVlanIdArray() {
|
||||
curObj["PruneVlanIdArray"] = null;
|
||||
if (((isEmbedded == false)
|
||||
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)
|
||||
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)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ResetSecondaryVlanIdArray() {
|
||||
curObj["SecondaryVlanIdArray"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ResetTrunkVlanIdArray() {
|
||||
curObj["TrunkVlanIdArray"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[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\\v2:Msvm_EthernetSwitchPortVlanSettingData";
|
||||
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)) {
|
||||
@ -688,24 +688,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject);
|
||||
curObj = PrivateLateBoundObject;
|
||||
}
|
||||
|
||||
|
||||
// Different overloads of GetInstances() help in enumerating instances of the WMI class.
|
||||
public static EthernetSwitchPortVlanSettingDataCollection GetInstances() {
|
||||
return GetInstances(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public static EthernetSwitchPortVlanSettingDataCollection GetInstances(string condition) {
|
||||
return GetInstances(null, condition, null);
|
||||
}
|
||||
|
||||
|
||||
public static EthernetSwitchPortVlanSettingDataCollection GetInstances(string[] selectedProperties) {
|
||||
return GetInstances(null, null, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static EthernetSwitchPortVlanSettingDataCollection GetInstances(string condition, string[] selectedProperties) {
|
||||
return GetInstances(null, condition, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static EthernetSwitchPortVlanSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
|
||||
if ((mgmtScope == null)) {
|
||||
if ((statMgmtScope == null)) {
|
||||
@ -726,15 +726,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
return new EthernetSwitchPortVlanSettingDataCollection(clsObject.GetInstances(enumOptions));
|
||||
}
|
||||
|
||||
|
||||
public static EthernetSwitchPortVlanSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
|
||||
return GetInstances(mgmtScope, condition, null);
|
||||
}
|
||||
|
||||
|
||||
public static EthernetSwitchPortVlanSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
|
||||
return GetInstances(mgmtScope, null, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static EthernetSwitchPortVlanSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
|
||||
if ((mgmtScope == null)) {
|
||||
if ((statMgmtScope == null)) {
|
||||
@ -751,7 +751,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
ObjectSearcher.Options = enumOptions;
|
||||
return new EthernetSwitchPortVlanSettingDataCollection(ObjectSearcher.Get());
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public static EthernetSwitchPortVlanSettingData CreateInstance() {
|
||||
System.Management.ManagementScope mgmtScope = null;
|
||||
@ -766,61 +766,61 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null);
|
||||
return new EthernetSwitchPortVlanSettingData(tmpMgmtClass.CreateInstance());
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public void Delete() {
|
||||
PrivateLateBoundObject.Delete();
|
||||
}
|
||||
|
||||
|
||||
public enum OperationModeValues {
|
||||
|
||||
|
||||
Access = 1,
|
||||
|
||||
|
||||
Trunk = 2,
|
||||
|
||||
|
||||
Private = 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 EthernetSwitchPortVlanSettingDataCollection : object, ICollection {
|
||||
|
||||
|
||||
private ManagementObjectCollection privColObj;
|
||||
|
||||
|
||||
public EthernetSwitchPortVlanSettingDataCollection(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;
|
||||
@ -828,189 +828,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
array.SetValue(new EthernetSwitchPortVlanSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public virtual System.Collections.IEnumerator GetEnumerator() {
|
||||
return new EthernetSwitchPortVlanSettingDataEnumerator(privColObj.GetEnumerator());
|
||||
}
|
||||
|
||||
|
||||
public class EthernetSwitchPortVlanSettingDataEnumerator : object, System.Collections.IEnumerator {
|
||||
|
||||
|
||||
private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum;
|
||||
|
||||
|
||||
public EthernetSwitchPortVlanSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
|
||||
privObjEnum = objEnum;
|
||||
}
|
||||
|
||||
|
||||
public virtual object Current {
|
||||
get {
|
||||
return new EthernetSwitchPortVlanSettingData(((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))
|
||||
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))
|
||||
if (((baseType == typeof(bool))
|
||||
&& (baseType.BaseType == typeof(System.ValueType)))) {
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
&& (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
|
||||
return "";
|
||||
}
|
||||
return baseConverter.ConvertTo(context, culture, value, destinationType);
|
||||
}
|
||||
if (((context != null)
|
||||
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 {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -24,70 +24,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
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_KvpExchangeComponentSettingData
|
||||
public class KvpExchangeComponentSettingData : System.ComponentModel.Component {
|
||||
|
||||
|
||||
// Private property to hold the WMI namespace in which the class resides.
|
||||
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_KvpExchangeComponentSettingData";
|
||||
|
||||
|
||||
// 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 KvpExchangeComponentSettingData() {
|
||||
this.InitializeObject(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public KvpExchangeComponentSettingData(string keyInstanceID) {
|
||||
this.InitializeObject(null, new System.Management.ManagementPath(KvpExchangeComponentSettingData.ConstructPath(keyInstanceID)), null);
|
||||
}
|
||||
|
||||
|
||||
public KvpExchangeComponentSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) {
|
||||
this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(KvpExchangeComponentSettingData.ConstructPath(keyInstanceID)), null);
|
||||
}
|
||||
|
||||
|
||||
public KvpExchangeComponentSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
|
||||
this.InitializeObject(null, path, getOptions);
|
||||
}
|
||||
|
||||
|
||||
public KvpExchangeComponentSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
|
||||
this.InitializeObject(mgmtScope, path, null);
|
||||
}
|
||||
|
||||
|
||||
public KvpExchangeComponentSettingData(System.Management.ManagementPath path) {
|
||||
this.InitializeObject(null, path, null);
|
||||
}
|
||||
|
||||
|
||||
public KvpExchangeComponentSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
|
||||
this.InitializeObject(mgmtScope, path, getOptions);
|
||||
}
|
||||
|
||||
|
||||
public KvpExchangeComponentSettingData(System.Management.ManagementObject theObject) {
|
||||
Initialize();
|
||||
if ((CheckIfProperClass(theObject) == true)) {
|
||||
@ -99,7 +99,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public KvpExchangeComponentSettingData(System.Management.ManagementBaseObject theObject) {
|
||||
Initialize();
|
||||
if ((CheckIfProperClass(theObject) == true)) {
|
||||
@ -112,7 +112,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returns the namespace of the WMI class.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -121,7 +121,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return "ROOT\\virtualization\\v2";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ManagementClassName {
|
||||
@ -130,7 +130,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
if ((curObj != null)) {
|
||||
if ((curObj.ClassPath != null)) {
|
||||
strRet = ((string)(curObj["__CLASS"]));
|
||||
if (((strRet == null)
|
||||
if (((strRet == null)
|
||||
|| (strRet == string.Empty))) {
|
||||
strRet = CreatedClassName;
|
||||
}
|
||||
@ -139,7 +139,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return strRet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property pointing to an embedded object to get System properties of the WMI object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -148,7 +148,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return PrivateSystemProperties;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returning the underlying lateBound object.
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -157,7 +157,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return curObj;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ManagementScope of the object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -176,7 +176,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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)]
|
||||
@ -188,7 +188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
AutoCommitProp = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// The ManagementPath of the underlying WMI object.
|
||||
[Browsable(true)]
|
||||
public System.Management.ManagementPath Path {
|
||||
@ -209,7 +209,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Public static scope property which is used by the various methods.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
statMgmtScope = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Address {
|
||||
@ -229,7 +229,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["Address"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string AddressOnParent {
|
||||
@ -237,7 +237,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["AddressOnParent"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string AllocationUnits {
|
||||
@ -245,7 +245,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["AllocationUnits"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsAutomaticAllocationNull {
|
||||
@ -258,7 +258,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -270,7 +270,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((bool)(curObj["AutomaticAllocation"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsAutomaticDeallocationNull {
|
||||
@ -283,7 +283,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -295,7 +295,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((bool)(curObj["AutomaticDeallocation"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Caption {
|
||||
@ -303,7 +303,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["Caption"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string[] Connection {
|
||||
@ -311,7 +311,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string[])(curObj["Connection"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsConsumerVisibilityNull {
|
||||
@ -324,7 +324,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -336,7 +336,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((ushort)(curObj["ConsumerVisibility"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Description {
|
||||
@ -344,7 +344,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["Description"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ElementName {
|
||||
@ -352,7 +352,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["ElementName"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsEnabledStateNull {
|
||||
@ -365,7 +365,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description(@"The enabled and disabled states of an element.
|
||||
@ -380,7 +380,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return ((ushort)(curObj["EnabledState"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("An array of Msvm_KvpExchangeDataItem instances.\nThis is a read-only property, but" +
|
||||
@ -391,7 +391,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return ((string[])(curObj["HostExchangeItems"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description(@"An array of Msvm_KvpExchangeDataItem instances containing the key/value pairs that are stored in the configuration file but not exchanged with the guest OS. This allows applications to store VM-specific data that does not need to be visible to the guest OS. The items are formatted the same as the items in the HostExchangeItems property except the Source property of the Msvm_KvpExchangeDataItem instance is set to 4. Each configuration file is limited to 128 key/value pairs, where each value field is allowed to be up to 16 KB in size and the key field is allowed to be up to512 bytes.")]
|
||||
@ -400,7 +400,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return ((string[])(curObj["HostOnlyItems"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string[] HostResource {
|
||||
@ -408,7 +408,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return ((string[])(curObj["HostResource"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string InstanceID {
|
||||
@ -416,7 +416,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return ((string)(curObj["InstanceID"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsLimitNull {
|
||||
@ -429,7 +429,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -441,7 +441,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return ((ulong)(curObj["Limit"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsMappingBehaviorNull {
|
||||
@ -454,7 +454,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -466,7 +466,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return ((ushort)(curObj["MappingBehavior"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string OtherResourceType {
|
||||
@ -474,7 +474,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return ((string)(curObj["OtherResourceType"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Parent {
|
||||
@ -482,7 +482,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return ((string)(curObj["Parent"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string PoolID {
|
||||
@ -490,7 +490,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return ((string)(curObj["PoolID"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsReservationNull {
|
||||
@ -503,7 +503,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -515,7 +515,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return ((ulong)(curObj["Reservation"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ResourceSubType {
|
||||
@ -523,7 +523,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return ((string)(curObj["ResourceSubType"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsResourceTypeNull {
|
||||
@ -536,7 +536,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -548,7 +548,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return ((ushort)(curObj["ResourceType"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsVirtualQuantityNull {
|
||||
@ -561,7 +561,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -573,7 +573,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return ((ulong)(curObj["VirtualQuantity"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string VirtualQuantityUnits {
|
||||
@ -581,7 +581,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return ((string)(curObj["VirtualQuantityUnits"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsWeightNull {
|
||||
@ -594,7 +594,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -606,9 +606,9 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return ((uint)(curObj["Weight"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) {
|
||||
if (((path != null)
|
||||
if (((path != null)
|
||||
&& (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -616,9 +616,9 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) {
|
||||
if (((theObj != null)
|
||||
if (((theObj != null)
|
||||
&& (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -635,102 +635,102 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeAutomaticAllocation() {
|
||||
if ((this.IsAutomaticAllocationNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeAutomaticDeallocation() {
|
||||
if ((this.IsAutomaticDeallocationNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeConsumerVisibility() {
|
||||
if ((this.IsConsumerVisibilityNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeEnabledState() {
|
||||
if ((this.IsEnabledStateNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeLimit() {
|
||||
if ((this.IsLimitNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeMappingBehavior() {
|
||||
if ((this.IsMappingBehaviorNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeReservation() {
|
||||
if ((this.IsReservationNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeResourceType() {
|
||||
if ((this.IsResourceTypeNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeVirtualQuantity() {
|
||||
if ((this.IsVirtualQuantityNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeWeight() {
|
||||
if ((this.IsWeightNull == 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\\v2:Msvm_KvpExchangeComponentSettingData";
|
||||
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)) {
|
||||
@ -742,24 +742,24 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject);
|
||||
curObj = PrivateLateBoundObject;
|
||||
}
|
||||
|
||||
|
||||
// Different overloads of GetInstances() help in enumerating instances of the WMI class.
|
||||
public static KvpExchangeComponentSettingDataCollection GetInstances() {
|
||||
return GetInstances(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public static KvpExchangeComponentSettingDataCollection GetInstances(string condition) {
|
||||
return GetInstances(null, condition, null);
|
||||
}
|
||||
|
||||
|
||||
public static KvpExchangeComponentSettingDataCollection GetInstances(string[] selectedProperties) {
|
||||
return GetInstances(null, null, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static KvpExchangeComponentSettingDataCollection GetInstances(string condition, string[] selectedProperties) {
|
||||
return GetInstances(null, condition, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static KvpExchangeComponentSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
|
||||
if ((mgmtScope == null)) {
|
||||
if ((statMgmtScope == null)) {
|
||||
@ -780,15 +780,15 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
}
|
||||
return new KvpExchangeComponentSettingDataCollection(clsObject.GetInstances(enumOptions));
|
||||
}
|
||||
|
||||
|
||||
public static KvpExchangeComponentSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
|
||||
return GetInstances(mgmtScope, condition, null);
|
||||
}
|
||||
|
||||
|
||||
public static KvpExchangeComponentSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
|
||||
return GetInstances(mgmtScope, null, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static KvpExchangeComponentSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
|
||||
if ((mgmtScope == null)) {
|
||||
if ((statMgmtScope == null)) {
|
||||
@ -805,7 +805,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
ObjectSearcher.Options = enumOptions;
|
||||
return new KvpExchangeComponentSettingDataCollection(ObjectSearcher.Get());
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public static KvpExchangeComponentSettingData CreateInstance() {
|
||||
System.Management.ManagementScope mgmtScope = null;
|
||||
@ -820,39 +820,39 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null);
|
||||
return new KvpExchangeComponentSettingData(tmpMgmtClass.CreateInstance());
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public void Delete() {
|
||||
PrivateLateBoundObject.Delete();
|
||||
}
|
||||
|
||||
|
||||
// Enumerator implementation for enumerating instances of the class.
|
||||
public class KvpExchangeComponentSettingDataCollection : object, ICollection {
|
||||
|
||||
|
||||
private ManagementObjectCollection privColObj;
|
||||
|
||||
|
||||
public KvpExchangeComponentSettingDataCollection(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;
|
||||
@ -860,189 +860,189 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
array.SetValue(new KvpExchangeComponentSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public virtual System.Collections.IEnumerator GetEnumerator() {
|
||||
return new KvpExchangeComponentSettingDataEnumerator(privColObj.GetEnumerator());
|
||||
}
|
||||
|
||||
|
||||
public class KvpExchangeComponentSettingDataEnumerator : object, System.Collections.IEnumerator {
|
||||
|
||||
|
||||
private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum;
|
||||
|
||||
|
||||
public KvpExchangeComponentSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
|
||||
privObjEnum = objEnum;
|
||||
}
|
||||
|
||||
|
||||
public virtual object Current {
|
||||
get {
|
||||
return new KvpExchangeComponentSettingData(((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))
|
||||
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))
|
||||
if (((baseType == typeof(bool))
|
||||
&& (baseType.BaseType == typeof(System.ValueType)))) {
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
&& (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
|
||||
return "";
|
||||
}
|
||||
return baseConverter.ConvertTo(context, culture, value, destinationType);
|
||||
}
|
||||
if (((context != null)
|
||||
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 {
|
||||
|
||||
@ -24,62 +24,62 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
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_KvpExchangeDataItem
|
||||
public class KvpExchangeDataItem : System.ComponentModel.Component {
|
||||
|
||||
|
||||
// Private property to hold the WMI namespace in which the class resides.
|
||||
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_KvpExchangeDataItem";
|
||||
|
||||
|
||||
// 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 KvpExchangeDataItem() {
|
||||
this.InitializeObject(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public KvpExchangeDataItem(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
|
||||
this.InitializeObject(null, path, getOptions);
|
||||
}
|
||||
|
||||
|
||||
public KvpExchangeDataItem(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
|
||||
this.InitializeObject(mgmtScope, path, null);
|
||||
}
|
||||
|
||||
|
||||
public KvpExchangeDataItem(System.Management.ManagementPath path) {
|
||||
this.InitializeObject(null, path, null);
|
||||
}
|
||||
|
||||
|
||||
public KvpExchangeDataItem(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
|
||||
this.InitializeObject(mgmtScope, path, getOptions);
|
||||
}
|
||||
|
||||
|
||||
public KvpExchangeDataItem(System.Management.ManagementObject theObject) {
|
||||
Initialize();
|
||||
if ((CheckIfProperClass(theObject) == true)) {
|
||||
@ -91,7 +91,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public KvpExchangeDataItem(System.Management.ManagementBaseObject theObject) {
|
||||
Initialize();
|
||||
if ((CheckIfProperClass(theObject) == true)) {
|
||||
@ -104,7 +104,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returns the namespace of the WMI class.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -113,7 +113,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return "ROOT\\virtualization\\v2";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ManagementClassName {
|
||||
@ -122,7 +122,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
if ((curObj != null)) {
|
||||
if ((curObj.ClassPath != null)) {
|
||||
strRet = ((string)(curObj["__CLASS"]));
|
||||
if (((strRet == null)
|
||||
if (((strRet == null)
|
||||
|| (strRet == string.Empty))) {
|
||||
strRet = CreatedClassName;
|
||||
}
|
||||
@ -131,7 +131,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return strRet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property pointing to an embedded object to get System properties of the WMI object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -140,7 +140,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return PrivateSystemProperties;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returning the underlying lateBound object.
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -149,7 +149,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return curObj;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ManagementScope of the object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -168,7 +168,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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)]
|
||||
@ -180,7 +180,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
AutoCommitProp = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// The ManagementPath of the underlying WMI object.
|
||||
[Browsable(true)]
|
||||
public System.Management.ManagementPath Path {
|
||||
@ -201,7 +201,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Public static scope property which is used by the various methods.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -213,7 +213,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
statMgmtScope = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Caption {
|
||||
@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["Caption"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Data {
|
||||
@ -229,7 +229,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["Data"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Description {
|
||||
@ -237,7 +237,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["Description"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ElementName {
|
||||
@ -245,7 +245,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["ElementName"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string InstanceID {
|
||||
@ -253,7 +253,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["InstanceID"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Name {
|
||||
@ -261,7 +261,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["Name"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsSourceNull {
|
||||
@ -274,7 +274,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -286,9 +286,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((ushort)(curObj["Source"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) {
|
||||
if (((path != null)
|
||||
if (((path != null)
|
||||
&& (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -296,9 +296,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) {
|
||||
if (((theObj != null)
|
||||
if (((theObj != null)
|
||||
&& (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -315,38 +315,38 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeSource() {
|
||||
if ((this.IsSourceNull == 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 strPath = "ROOT\\virtualization\\v2:Msvm_KvpExchangeDataItem";
|
||||
return strPath;
|
||||
}
|
||||
|
||||
|
||||
private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
|
||||
Initialize();
|
||||
if ((path != null)) {
|
||||
@ -358,24 +358,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject);
|
||||
curObj = PrivateLateBoundObject;
|
||||
}
|
||||
|
||||
|
||||
// Different overloads of GetInstances() help in enumerating instances of the WMI class.
|
||||
public static KvpExchangeDataItemCollection GetInstances() {
|
||||
return GetInstances(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public static KvpExchangeDataItemCollection GetInstances(string condition) {
|
||||
return GetInstances(null, condition, null);
|
||||
}
|
||||
|
||||
|
||||
public static KvpExchangeDataItemCollection GetInstances(string[] selectedProperties) {
|
||||
return GetInstances(null, null, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static KvpExchangeDataItemCollection GetInstances(string condition, string[] selectedProperties) {
|
||||
return GetInstances(null, condition, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static KvpExchangeDataItemCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
|
||||
if ((mgmtScope == null)) {
|
||||
if ((statMgmtScope == null)) {
|
||||
@ -396,15 +396,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
return new KvpExchangeDataItemCollection(clsObject.GetInstances(enumOptions));
|
||||
}
|
||||
|
||||
|
||||
public static KvpExchangeDataItemCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
|
||||
return GetInstances(mgmtScope, condition, null);
|
||||
}
|
||||
|
||||
|
||||
public static KvpExchangeDataItemCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
|
||||
return GetInstances(mgmtScope, null, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static KvpExchangeDataItemCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
|
||||
if ((mgmtScope == null)) {
|
||||
if ((statMgmtScope == null)) {
|
||||
@ -421,7 +421,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
ObjectSearcher.Options = enumOptions;
|
||||
return new KvpExchangeDataItemCollection(ObjectSearcher.Get());
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public static KvpExchangeDataItem CreateInstance() {
|
||||
System.Management.ManagementScope mgmtScope = null;
|
||||
@ -436,39 +436,39 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null);
|
||||
return new KvpExchangeDataItem(tmpMgmtClass.CreateInstance());
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public void Delete() {
|
||||
PrivateLateBoundObject.Delete();
|
||||
}
|
||||
|
||||
|
||||
// Enumerator implementation for enumerating instances of the class.
|
||||
public class KvpExchangeDataItemCollection : object, ICollection {
|
||||
|
||||
|
||||
private ManagementObjectCollection privColObj;
|
||||
|
||||
|
||||
public KvpExchangeDataItemCollection(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;
|
||||
@ -476,189 +476,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
array.SetValue(new KvpExchangeDataItem(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public virtual System.Collections.IEnumerator GetEnumerator() {
|
||||
return new KvpExchangeDataItemEnumerator(privColObj.GetEnumerator());
|
||||
}
|
||||
|
||||
|
||||
public class KvpExchangeDataItemEnumerator : object, System.Collections.IEnumerator {
|
||||
|
||||
|
||||
private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum;
|
||||
|
||||
|
||||
public KvpExchangeDataItemEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
|
||||
privObjEnum = objEnum;
|
||||
}
|
||||
|
||||
|
||||
public virtual object Current {
|
||||
get {
|
||||
return new KvpExchangeDataItem(((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))
|
||||
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))
|
||||
if (((baseType == typeof(bool))
|
||||
&& (baseType.BaseType == typeof(System.ValueType)))) {
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
&& (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
|
||||
return "";
|
||||
}
|
||||
return baseConverter.ConvertTo(context, culture, value, destinationType);
|
||||
}
|
||||
if (((context != null)
|
||||
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 {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -23,70 +23,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
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_ProcessorSettingData
|
||||
public class ProcessorSettingData : System.ComponentModel.Component {
|
||||
|
||||
|
||||
// Private property to hold the WMI namespace in which the class resides.
|
||||
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";
|
||||
|
||||
|
||||
// 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 ProcessorSettingData() {
|
||||
this.InitializeObject(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public ProcessorSettingData(string keyInstanceID) {
|
||||
this.InitializeObject(null, new System.Management.ManagementPath(ProcessorSettingData.ConstructPath(keyInstanceID)), null);
|
||||
}
|
||||
|
||||
|
||||
public ProcessorSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) {
|
||||
this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(ProcessorSettingData.ConstructPath(keyInstanceID)), null);
|
||||
}
|
||||
|
||||
|
||||
public ProcessorSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
|
||||
this.InitializeObject(null, path, getOptions);
|
||||
}
|
||||
|
||||
|
||||
public ProcessorSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
|
||||
this.InitializeObject(mgmtScope, path, null);
|
||||
}
|
||||
|
||||
|
||||
public ProcessorSettingData(System.Management.ManagementPath path) {
|
||||
this.InitializeObject(null, path, null);
|
||||
}
|
||||
|
||||
|
||||
public ProcessorSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
|
||||
this.InitializeObject(mgmtScope, path, getOptions);
|
||||
}
|
||||
|
||||
|
||||
public ProcessorSettingData(System.Management.ManagementObject theObject) {
|
||||
Initialize();
|
||||
if ((CheckIfProperClass(theObject) == true)) {
|
||||
@ -98,7 +98,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ProcessorSettingData(System.Management.ManagementBaseObject theObject) {
|
||||
Initialize();
|
||||
if ((CheckIfProperClass(theObject) == true)) {
|
||||
@ -111,7 +111,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returns the namespace of the WMI class.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -120,7 +120,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return "ROOT\\virtualization\\v2";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ManagementClassName {
|
||||
@ -129,7 +129,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
if ((curObj != null)) {
|
||||
if ((curObj.ClassPath != null)) {
|
||||
strRet = ((string)(curObj["__CLASS"]));
|
||||
if (((strRet == null)
|
||||
if (((strRet == null)
|
||||
|| (strRet == string.Empty))) {
|
||||
strRet = CreatedClassName;
|
||||
}
|
||||
@ -138,7 +138,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return strRet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property pointing to an embedded object to get System properties of the WMI object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -147,7 +147,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return PrivateSystemProperties;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returning the underlying lateBound object.
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -156,7 +156,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return curObj;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ManagementScope of the object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -175,7 +175,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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)]
|
||||
@ -187,7 +187,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
AutoCommitProp = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// The ManagementPath of the underlying WMI object.
|
||||
[Browsable(true)]
|
||||
public System.Management.ManagementPath Path {
|
||||
@ -208,7 +208,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Public static scope property which is used by the various methods.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -220,7 +220,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
statMgmtScope = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Address {
|
||||
@ -228,7 +228,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["Address"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string AddressOnParent {
|
||||
@ -236,7 +236,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["AddressOnParent"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string AllocationUnits {
|
||||
@ -244,7 +244,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["AllocationUnits"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsAutomaticAllocationNull {
|
||||
@ -257,7 +257,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -269,7 +269,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((bool)(curObj["AutomaticAllocation"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsAutomaticDeallocationNull {
|
||||
@ -282,7 +282,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -294,7 +294,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((bool)(curObj["AutomaticDeallocation"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Caption {
|
||||
@ -302,7 +302,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["Caption"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string[] Connection {
|
||||
@ -310,7 +310,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string[])(curObj["Connection"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsConsumerVisibilityNull {
|
||||
@ -323,7 +323,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -335,7 +335,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((ushort)(curObj["ConsumerVisibility"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Description {
|
||||
@ -343,7 +343,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["Description"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ElementName {
|
||||
@ -351,7 +351,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["ElementName"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string[] HostResource {
|
||||
@ -359,7 +359,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string[])(curObj["HostResource"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string InstanceID {
|
||||
@ -367,7 +367,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["InstanceID"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsLimitNull {
|
||||
@ -380,7 +380,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -392,7 +392,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((ulong)(curObj["Limit"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsLimitCPUIDNull {
|
||||
@ -405,7 +405,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("Indicates whether the virtual machine should lower the CPU identifier. Some older" +
|
||||
@ -420,7 +420,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((bool)(curObj["LimitCPUID"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsLimitProcessorFeaturesNull {
|
||||
@ -433,7 +433,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[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.")]
|
||||
@ -446,7 +446,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((bool)(curObj["LimitProcessorFeatures"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsMappingBehaviorNull {
|
||||
@ -459,7 +459,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -471,7 +471,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((ushort)(curObj["MappingBehavior"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsMaxNumaNodesPerSocketNull {
|
||||
@ -484,7 +484,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The maximum number of NUMA nodes that can be observed within the VM as belonging " +
|
||||
@ -498,7 +498,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((ulong)(curObj["MaxNumaNodesPerSocket"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsMaxProcessorsPerNumaNodeNull {
|
||||
@ -511,7 +511,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The maximum number of virtual processors that can be observed within the VM as be" +
|
||||
@ -525,7 +525,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((ulong)(curObj["MaxProcessorsPerNumaNode"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string OtherResourceType {
|
||||
@ -533,7 +533,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["OtherResourceType"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Parent {
|
||||
@ -541,7 +541,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["Parent"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string PoolID {
|
||||
@ -549,7 +549,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["PoolID"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsReservationNull {
|
||||
@ -562,7 +562,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -574,7 +574,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((ulong)(curObj["Reservation"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ResourceSubType {
|
||||
@ -582,7 +582,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["ResourceSubType"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsResourceTypeNull {
|
||||
@ -595,7 +595,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -607,7 +607,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((ushort)(curObj["ResourceType"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsVirtualQuantityNull {
|
||||
@ -620,7 +620,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -632,7 +632,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((ulong)(curObj["VirtualQuantity"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string VirtualQuantityUnits {
|
||||
@ -640,7 +640,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["VirtualQuantityUnits"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsWeightNull {
|
||||
@ -653,7 +653,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -665,9 +665,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((uint)(curObj["Weight"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) {
|
||||
if (((path != null)
|
||||
if (((path != null)
|
||||
&& (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -675,9 +675,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) {
|
||||
if (((theObj != null)
|
||||
if (((theObj != null)
|
||||
&& (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -694,123 +694,123 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeAutomaticAllocation() {
|
||||
if ((this.IsAutomaticAllocationNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeAutomaticDeallocation() {
|
||||
if ((this.IsAutomaticDeallocationNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeConsumerVisibility() {
|
||||
if ((this.IsConsumerVisibilityNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeLimit() {
|
||||
if ((this.IsLimitNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeLimitCPUID() {
|
||||
if ((this.IsLimitCPUIDNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeLimitProcessorFeatures() {
|
||||
if ((this.IsLimitProcessorFeaturesNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeMappingBehavior() {
|
||||
if ((this.IsMappingBehaviorNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeMaxNumaNodesPerSocket() {
|
||||
if ((this.IsMaxNumaNodesPerSocketNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeMaxProcessorsPerNumaNode() {
|
||||
if ((this.IsMaxProcessorsPerNumaNodeNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeReservation() {
|
||||
if ((this.IsReservationNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeResourceType() {
|
||||
if ((this.IsResourceTypeNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeVirtualQuantity() {
|
||||
if ((this.IsVirtualQuantityNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeWeight() {
|
||||
if ((this.IsWeightNull == 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\\v2:Msvm_ProcessorSettingData";
|
||||
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)) {
|
||||
@ -822,24 +822,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject);
|
||||
curObj = PrivateLateBoundObject;
|
||||
}
|
||||
|
||||
|
||||
// Different overloads of GetInstances() help in enumerating instances of the WMI class.
|
||||
public static ProcessorSettingDataCollection GetInstances() {
|
||||
return GetInstances(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public static ProcessorSettingDataCollection GetInstances(string condition) {
|
||||
return GetInstances(null, condition, null);
|
||||
}
|
||||
|
||||
|
||||
public static ProcessorSettingDataCollection GetInstances(string[] selectedProperties) {
|
||||
return GetInstances(null, null, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static ProcessorSettingDataCollection GetInstances(string condition, string[] selectedProperties) {
|
||||
return GetInstances(null, condition, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static ProcessorSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
|
||||
if ((mgmtScope == null)) {
|
||||
if ((statMgmtScope == null)) {
|
||||
@ -860,15 +860,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
return new ProcessorSettingDataCollection(clsObject.GetInstances(enumOptions));
|
||||
}
|
||||
|
||||
|
||||
public static ProcessorSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
|
||||
return GetInstances(mgmtScope, condition, null);
|
||||
}
|
||||
|
||||
|
||||
public static ProcessorSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
|
||||
return GetInstances(mgmtScope, null, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static ProcessorSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
|
||||
if ((mgmtScope == null)) {
|
||||
if ((statMgmtScope == null)) {
|
||||
@ -885,7 +885,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
ObjectSearcher.Options = enumOptions;
|
||||
return new ProcessorSettingDataCollection(ObjectSearcher.Get());
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public static ProcessorSettingData CreateInstance() {
|
||||
System.Management.ManagementScope mgmtScope = null;
|
||||
@ -900,39 +900,39 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null);
|
||||
return new ProcessorSettingData(tmpMgmtClass.CreateInstance());
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public void Delete() {
|
||||
PrivateLateBoundObject.Delete();
|
||||
}
|
||||
|
||||
|
||||
// Enumerator implementation for enumerating instances of the class.
|
||||
public class ProcessorSettingDataCollection : object, ICollection {
|
||||
|
||||
|
||||
private ManagementObjectCollection privColObj;
|
||||
|
||||
|
||||
public ProcessorSettingDataCollection(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;
|
||||
@ -940,189 +940,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
array.SetValue(new ProcessorSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public virtual System.Collections.IEnumerator GetEnumerator() {
|
||||
return new ProcessorSettingDataEnumerator(privColObj.GetEnumerator());
|
||||
}
|
||||
|
||||
|
||||
public class ProcessorSettingDataEnumerator : object, System.Collections.IEnumerator {
|
||||
|
||||
|
||||
private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum;
|
||||
|
||||
|
||||
public ProcessorSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
|
||||
privObjEnum = objEnum;
|
||||
}
|
||||
|
||||
|
||||
public virtual object Current {
|
||||
get {
|
||||
return new ProcessorSettingData(((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))
|
||||
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))
|
||||
if (((baseType == typeof(bool))
|
||||
&& (baseType.BaseType == typeof(System.ValueType)))) {
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
&& (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
|
||||
return "";
|
||||
}
|
||||
return baseConverter.ConvertTo(context, culture, value, destinationType);
|
||||
}
|
||||
if (((context != null)
|
||||
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 {
|
||||
|
||||
@ -24,70 +24,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
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_ResourceAllocationSettingData
|
||||
public class ResourceAllocationSettingData : System.ComponentModel.Component {
|
||||
|
||||
|
||||
// Private property to hold the WMI namespace in which the class resides.
|
||||
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";
|
||||
|
||||
|
||||
// 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 ResourceAllocationSettingData() {
|
||||
this.InitializeObject(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public ResourceAllocationSettingData(string keyInstanceID) {
|
||||
this.InitializeObject(null, new System.Management.ManagementPath(ResourceAllocationSettingData.ConstructPath(keyInstanceID)), null);
|
||||
}
|
||||
|
||||
|
||||
public ResourceAllocationSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) {
|
||||
this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(ResourceAllocationSettingData.ConstructPath(keyInstanceID)), null);
|
||||
}
|
||||
|
||||
|
||||
public ResourceAllocationSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
|
||||
this.InitializeObject(null, path, getOptions);
|
||||
}
|
||||
|
||||
|
||||
public ResourceAllocationSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
|
||||
this.InitializeObject(mgmtScope, path, null);
|
||||
}
|
||||
|
||||
|
||||
public ResourceAllocationSettingData(System.Management.ManagementPath path) {
|
||||
this.InitializeObject(null, path, null);
|
||||
}
|
||||
|
||||
|
||||
public ResourceAllocationSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
|
||||
this.InitializeObject(mgmtScope, path, getOptions);
|
||||
}
|
||||
|
||||
|
||||
public ResourceAllocationSettingData(System.Management.ManagementObject theObject) {
|
||||
Initialize();
|
||||
if ((CheckIfProperClass(theObject) == true)) {
|
||||
@ -99,7 +99,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ResourceAllocationSettingData(System.Management.ManagementBaseObject theObject) {
|
||||
Initialize();
|
||||
if ((CheckIfProperClass(theObject) == true)) {
|
||||
@ -112,7 +112,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returns the namespace of the WMI class.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -121,7 +121,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return "ROOT\\virtualization\\v2";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ManagementClassName {
|
||||
@ -130,7 +130,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
if ((curObj != null)) {
|
||||
if ((curObj.ClassPath != null)) {
|
||||
strRet = ((string)(curObj["__CLASS"]));
|
||||
if (((strRet == null)
|
||||
if (((strRet == null)
|
||||
|| (strRet == string.Empty))) {
|
||||
strRet = CreatedClassName;
|
||||
}
|
||||
@ -139,7 +139,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return strRet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property pointing to an embedded object to get System properties of the WMI object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -148,7 +148,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return PrivateSystemProperties;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returning the underlying lateBound object.
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -157,7 +157,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return curObj;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ManagementScope of the object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -176,7 +176,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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)]
|
||||
@ -188,7 +188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
AutoCommitProp = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// The ManagementPath of the underlying WMI object.
|
||||
[Browsable(true)]
|
||||
public System.Management.ManagementPath Path {
|
||||
@ -209,7 +209,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Public static scope property which is used by the various methods.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
statMgmtScope = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Address {
|
||||
@ -229,7 +229,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["Address"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string AddressOnParent {
|
||||
@ -237,7 +237,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["AddressOnParent"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string AllocationUnits {
|
||||
@ -245,7 +245,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["AllocationUnits"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsAutomaticAllocationNull {
|
||||
@ -258,7 +258,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -270,7 +270,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((bool)(curObj["AutomaticAllocation"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsAutomaticDeallocationNull {
|
||||
@ -283,7 +283,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -295,7 +295,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((bool)(curObj["AutomaticDeallocation"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Caption {
|
||||
@ -303,7 +303,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["Caption"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string[] Connection {
|
||||
@ -311,7 +311,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string[])(curObj["Connection"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsConsumerVisibilityNull {
|
||||
@ -324,7 +324,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -336,7 +336,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((ushort)(curObj["ConsumerVisibility"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Description {
|
||||
@ -344,7 +344,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["Description"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ElementName {
|
||||
@ -352,7 +352,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["ElementName"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string[] HostResource {
|
||||
@ -360,7 +360,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string[])(curObj["HostResource"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string InstanceID {
|
||||
@ -368,7 +368,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["InstanceID"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsLimitNull {
|
||||
@ -381,7 +381,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -393,7 +393,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((ulong)(curObj["Limit"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsMappingBehaviorNull {
|
||||
@ -406,7 +406,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -418,7 +418,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((ushort)(curObj["MappingBehavior"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string OtherResourceType {
|
||||
@ -426,7 +426,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["OtherResourceType"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Parent {
|
||||
@ -434,7 +434,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["Parent"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string PoolID {
|
||||
@ -442,7 +442,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["PoolID"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsReservationNull {
|
||||
@ -455,7 +455,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -467,7 +467,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((ulong)(curObj["Reservation"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ResourceSubType {
|
||||
@ -475,7 +475,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((string)(curObj["ResourceSubType"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsResourceTypeNull {
|
||||
@ -488,7 +488,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -500,7 +500,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((ushort)(curObj["ResourceType"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsVirtualQuantityNull {
|
||||
@ -513,7 +513,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -525,7 +525,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return ((ulong)(curObj["VirtualQuantity"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string VirtualQuantityUnits {
|
||||
@ -533,7 +533,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
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"".
|
||||
@ -544,7 +544,7 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt
|
||||
return ((string[])(curObj["VirtualSystemIdentifiers"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsWeightNull {
|
||||
@ -557,7 +557,7 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -569,9 +569,9 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt
|
||||
return ((uint)(curObj["Weight"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) {
|
||||
if (((path != null)
|
||||
if (((path != null)
|
||||
&& (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -579,9 +579,9 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt
|
||||
return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) {
|
||||
if (((theObj != null)
|
||||
if (((theObj != null)
|
||||
&& (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -598,95 +598,95 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeAutomaticAllocation() {
|
||||
if ((this.IsAutomaticAllocationNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeAutomaticDeallocation() {
|
||||
if ((this.IsAutomaticDeallocationNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeConsumerVisibility() {
|
||||
if ((this.IsConsumerVisibilityNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeLimit() {
|
||||
if ((this.IsLimitNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeMappingBehavior() {
|
||||
if ((this.IsMappingBehaviorNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeReservation() {
|
||||
if ((this.IsReservationNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeResourceType() {
|
||||
if ((this.IsResourceTypeNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeVirtualQuantity() {
|
||||
if ((this.IsVirtualQuantityNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeWeight() {
|
||||
if ((this.IsWeightNull == 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\\v2:Msvm_ResourceAllocationSettingData";
|
||||
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)) {
|
||||
@ -698,24 +698,24 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt
|
||||
PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject);
|
||||
curObj = PrivateLateBoundObject;
|
||||
}
|
||||
|
||||
|
||||
// Different overloads of GetInstances() help in enumerating instances of the WMI class.
|
||||
public static ResourceAllocationSettingDataCollection GetInstances() {
|
||||
return GetInstances(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public static ResourceAllocationSettingDataCollection GetInstances(string condition) {
|
||||
return GetInstances(null, condition, null);
|
||||
}
|
||||
|
||||
|
||||
public static ResourceAllocationSettingDataCollection GetInstances(string[] selectedProperties) {
|
||||
return GetInstances(null, null, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static ResourceAllocationSettingDataCollection GetInstances(string condition, string[] selectedProperties) {
|
||||
return GetInstances(null, condition, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static ResourceAllocationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
|
||||
if ((mgmtScope == null)) {
|
||||
if ((statMgmtScope == null)) {
|
||||
@ -736,15 +736,15 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt
|
||||
}
|
||||
return new ResourceAllocationSettingDataCollection(clsObject.GetInstances(enumOptions));
|
||||
}
|
||||
|
||||
|
||||
public static ResourceAllocationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
|
||||
return GetInstances(mgmtScope, condition, null);
|
||||
}
|
||||
|
||||
|
||||
public static ResourceAllocationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
|
||||
return GetInstances(mgmtScope, null, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static ResourceAllocationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
|
||||
if ((mgmtScope == null)) {
|
||||
if ((statMgmtScope == null)) {
|
||||
@ -761,7 +761,7 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt
|
||||
ObjectSearcher.Options = enumOptions;
|
||||
return new ResourceAllocationSettingDataCollection(ObjectSearcher.Get());
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public static ResourceAllocationSettingData CreateInstance() {
|
||||
System.Management.ManagementScope mgmtScope = null;
|
||||
@ -776,39 +776,39 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt
|
||||
System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null);
|
||||
return new ResourceAllocationSettingData(tmpMgmtClass.CreateInstance());
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public void Delete() {
|
||||
PrivateLateBoundObject.Delete();
|
||||
}
|
||||
|
||||
|
||||
// Enumerator implementation for enumerating instances of the class.
|
||||
public class ResourceAllocationSettingDataCollection : object, ICollection {
|
||||
|
||||
|
||||
private ManagementObjectCollection privColObj;
|
||||
|
||||
|
||||
public ResourceAllocationSettingDataCollection(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;
|
||||
@ -816,189 +816,189 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt
|
||||
array.SetValue(new ResourceAllocationSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public virtual System.Collections.IEnumerator GetEnumerator() {
|
||||
return new ResourceAllocationSettingDataEnumerator(privColObj.GetEnumerator());
|
||||
}
|
||||
|
||||
|
||||
public class ResourceAllocationSettingDataEnumerator : object, System.Collections.IEnumerator {
|
||||
|
||||
|
||||
private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum;
|
||||
|
||||
|
||||
public ResourceAllocationSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
|
||||
privObjEnum = objEnum;
|
||||
}
|
||||
|
||||
|
||||
public virtual object Current {
|
||||
get {
|
||||
return new ResourceAllocationSettingData(((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))
|
||||
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))
|
||||
if (((baseType == typeof(bool))
|
||||
&& (baseType.BaseType == typeof(System.ValueType)))) {
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
&& (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
|
||||
return "";
|
||||
}
|
||||
return baseConverter.ConvertTo(context, culture, value, destinationType);
|
||||
}
|
||||
if (((context != null)
|
||||
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 {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -23,70 +23,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
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_SyntheticEthernetPortSettingData
|
||||
public class SyntheticEthernetPortSettingData : System.ComponentModel.Component {
|
||||
|
||||
|
||||
// Private property to hold the WMI namespace in which the class resides.
|
||||
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";
|
||||
|
||||
|
||||
// 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 SyntheticEthernetPortSettingData() {
|
||||
this.InitializeObject(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public SyntheticEthernetPortSettingData(string keyInstanceID) {
|
||||
this.InitializeObject(null, new System.Management.ManagementPath(SyntheticEthernetPortSettingData.ConstructPath(keyInstanceID)), null);
|
||||
}
|
||||
|
||||
|
||||
public SyntheticEthernetPortSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) {
|
||||
this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(SyntheticEthernetPortSettingData.ConstructPath(keyInstanceID)), null);
|
||||
}
|
||||
|
||||
|
||||
public SyntheticEthernetPortSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
|
||||
this.InitializeObject(null, path, getOptions);
|
||||
}
|
||||
|
||||
|
||||
public SyntheticEthernetPortSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
|
||||
this.InitializeObject(mgmtScope, path, null);
|
||||
}
|
||||
|
||||
|
||||
public SyntheticEthernetPortSettingData(System.Management.ManagementPath path) {
|
||||
this.InitializeObject(null, path, null);
|
||||
}
|
||||
|
||||
|
||||
public SyntheticEthernetPortSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
|
||||
this.InitializeObject(mgmtScope, path, getOptions);
|
||||
}
|
||||
|
||||
|
||||
public SyntheticEthernetPortSettingData(System.Management.ManagementObject theObject) {
|
||||
Initialize();
|
||||
if ((CheckIfProperClass(theObject) == true)) {
|
||||
@ -98,7 +98,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public SyntheticEthernetPortSettingData(System.Management.ManagementBaseObject theObject) {
|
||||
Initialize();
|
||||
if ((CheckIfProperClass(theObject) == true)) {
|
||||
@ -111,7 +111,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returns the namespace of the WMI class.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -120,7 +120,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return "ROOT\\virtualization\\v2";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ManagementClassName {
|
||||
@ -129,7 +129,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
if ((curObj != null)) {
|
||||
if ((curObj.ClassPath != null)) {
|
||||
strRet = ((string)(curObj["__CLASS"]));
|
||||
if (((strRet == null)
|
||||
if (((strRet == null)
|
||||
|| (strRet == string.Empty))) {
|
||||
strRet = CreatedClassName;
|
||||
}
|
||||
@ -138,7 +138,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return strRet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property pointing to an embedded object to get System properties of the WMI object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -147,7 +147,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return PrivateSystemProperties;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returning the underlying lateBound object.
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -156,7 +156,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return curObj;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ManagementScope of the object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -175,7 +175,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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)]
|
||||
@ -187,7 +187,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
AutoCommitProp = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// The ManagementPath of the underlying WMI object.
|
||||
[Browsable(true)]
|
||||
public System.Management.ManagementPath Path {
|
||||
@ -208,7 +208,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Public static scope property which is used by the various methods.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -220,7 +220,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
statMgmtScope = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Address {
|
||||
@ -228,7 +228,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["Address"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string AddressOnParent {
|
||||
@ -236,7 +236,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["AddressOnParent"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string AllocationUnits {
|
||||
@ -244,7 +244,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["AllocationUnits"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsAutomaticAllocationNull {
|
||||
@ -257,7 +257,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -269,7 +269,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((bool)(curObj["AutomaticAllocation"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsAutomaticDeallocationNull {
|
||||
@ -282,7 +282,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -294,7 +294,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((bool)(curObj["AutomaticDeallocation"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Caption {
|
||||
@ -302,7 +302,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["Caption"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string[] Connection {
|
||||
@ -310,7 +310,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string[])(curObj["Connection"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsConsumerVisibilityNull {
|
||||
@ -323,7 +323,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -335,7 +335,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((ushort)(curObj["ConsumerVisibility"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Description {
|
||||
@ -343,7 +343,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["Description"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsDesiredVLANEndpointModeNull {
|
||||
@ -356,7 +356,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -368,7 +368,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((ushort)(curObj["DesiredVLANEndpointMode"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ElementName {
|
||||
@ -376,7 +376,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["ElementName"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string[] HostResource {
|
||||
@ -384,7 +384,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string[])(curObj["HostResource"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string InstanceID {
|
||||
@ -392,7 +392,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["InstanceID"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsLimitNull {
|
||||
@ -405,7 +405,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -417,7 +417,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((ulong)(curObj["Limit"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsMappingBehaviorNull {
|
||||
@ -430,7 +430,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -442,7 +442,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((ushort)(curObj["MappingBehavior"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string OtherEndpointMode {
|
||||
@ -450,7 +450,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["OtherEndpointMode"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string OtherResourceType {
|
||||
@ -458,7 +458,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["OtherResourceType"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Parent {
|
||||
@ -466,7 +466,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["Parent"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string PoolID {
|
||||
@ -474,7 +474,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["PoolID"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsReservationNull {
|
||||
@ -487,7 +487,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -499,7 +499,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((ulong)(curObj["Reservation"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ResourceSubType {
|
||||
@ -507,7 +507,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["ResourceSubType"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsResourceTypeNull {
|
||||
@ -520,7 +520,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -532,7 +532,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((ushort)(curObj["ResourceType"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsStaticMacAddressNull {
|
||||
@ -545,7 +545,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("Indicates a static MAC address.\nThis is a read-only property, but it can be chang" +
|
||||
@ -560,7 +560,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((bool)(curObj["StaticMacAddress"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsVirtualQuantityNull {
|
||||
@ -573,7 +573,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -585,7 +585,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((ulong)(curObj["VirtualQuantity"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string VirtualQuantityUnits {
|
||||
@ -593,7 +593,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
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"".
|
||||
@ -603,7 +603,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return ((string[])(curObj["VirtualSystemIdentifiers"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsWeightNull {
|
||||
@ -616,7 +616,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -628,9 +628,9 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return ((uint)(curObj["Weight"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) {
|
||||
if (((path != null)
|
||||
if (((path != null)
|
||||
&& (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -638,9 +638,9 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) {
|
||||
if (((theObj != null)
|
||||
if (((theObj != null)
|
||||
&& (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -657,109 +657,109 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeAutomaticAllocation() {
|
||||
if ((this.IsAutomaticAllocationNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeAutomaticDeallocation() {
|
||||
if ((this.IsAutomaticDeallocationNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeConsumerVisibility() {
|
||||
if ((this.IsConsumerVisibilityNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeDesiredVLANEndpointMode() {
|
||||
if ((this.IsDesiredVLANEndpointModeNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeLimit() {
|
||||
if ((this.IsLimitNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeMappingBehavior() {
|
||||
if ((this.IsMappingBehaviorNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeReservation() {
|
||||
if ((this.IsReservationNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeResourceType() {
|
||||
if ((this.IsResourceTypeNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeStaticMacAddress() {
|
||||
if ((this.IsStaticMacAddressNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeVirtualQuantity() {
|
||||
if ((this.IsVirtualQuantityNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeWeight() {
|
||||
if ((this.IsWeightNull == 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\\v2:Msvm_SyntheticEthernetPortSettingData";
|
||||
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)) {
|
||||
@ -771,24 +771,24 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject);
|
||||
curObj = PrivateLateBoundObject;
|
||||
}
|
||||
|
||||
|
||||
// Different overloads of GetInstances() help in enumerating instances of the WMI class.
|
||||
public static SyntheticEthernetPortSettingDataCollection GetInstances() {
|
||||
return GetInstances(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public static SyntheticEthernetPortSettingDataCollection GetInstances(string condition) {
|
||||
return GetInstances(null, condition, null);
|
||||
}
|
||||
|
||||
|
||||
public static SyntheticEthernetPortSettingDataCollection GetInstances(string[] selectedProperties) {
|
||||
return GetInstances(null, null, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static SyntheticEthernetPortSettingDataCollection GetInstances(string condition, string[] selectedProperties) {
|
||||
return GetInstances(null, condition, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static SyntheticEthernetPortSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
|
||||
if ((mgmtScope == null)) {
|
||||
if ((statMgmtScope == null)) {
|
||||
@ -809,15 +809,15 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
}
|
||||
return new SyntheticEthernetPortSettingDataCollection(clsObject.GetInstances(enumOptions));
|
||||
}
|
||||
|
||||
|
||||
public static SyntheticEthernetPortSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
|
||||
return GetInstances(mgmtScope, condition, null);
|
||||
}
|
||||
|
||||
|
||||
public static SyntheticEthernetPortSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
|
||||
return GetInstances(mgmtScope, null, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static SyntheticEthernetPortSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
|
||||
if ((mgmtScope == null)) {
|
||||
if ((statMgmtScope == null)) {
|
||||
@ -834,7 +834,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
ObjectSearcher.Options = enumOptions;
|
||||
return new SyntheticEthernetPortSettingDataCollection(ObjectSearcher.Get());
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public static SyntheticEthernetPortSettingData CreateInstance() {
|
||||
System.Management.ManagementScope mgmtScope = null;
|
||||
@ -849,39 +849,39 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null);
|
||||
return new SyntheticEthernetPortSettingData(tmpMgmtClass.CreateInstance());
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public void Delete() {
|
||||
PrivateLateBoundObject.Delete();
|
||||
}
|
||||
|
||||
|
||||
// Enumerator implementation for enumerating instances of the class.
|
||||
public class SyntheticEthernetPortSettingDataCollection : object, ICollection {
|
||||
|
||||
|
||||
private ManagementObjectCollection privColObj;
|
||||
|
||||
|
||||
public SyntheticEthernetPortSettingDataCollection(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;
|
||||
@ -889,189 +889,189 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste
|
||||
array.SetValue(new SyntheticEthernetPortSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public virtual System.Collections.IEnumerator GetEnumerator() {
|
||||
return new SyntheticEthernetPortSettingDataEnumerator(privColObj.GetEnumerator());
|
||||
}
|
||||
|
||||
|
||||
public class SyntheticEthernetPortSettingDataEnumerator : object, System.Collections.IEnumerator {
|
||||
|
||||
|
||||
private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum;
|
||||
|
||||
|
||||
public SyntheticEthernetPortSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
|
||||
privObjEnum = objEnum;
|
||||
}
|
||||
|
||||
|
||||
public virtual object Current {
|
||||
get {
|
||||
return new SyntheticEthernetPortSettingData(((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))
|
||||
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))
|
||||
if (((baseType == typeof(bool))
|
||||
&& (baseType.BaseType == typeof(System.ValueType)))) {
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
&& (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
|
||||
return "";
|
||||
}
|
||||
return baseConverter.ConvertTo(context, culture, value, destinationType);
|
||||
}
|
||||
if (((context != null)
|
||||
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 {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -23,70 +23,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
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_VirtualHardDiskSettingData
|
||||
public class VirtualHardDiskSettingData : System.ComponentModel.Component {
|
||||
|
||||
|
||||
// Private property to hold the WMI namespace in which the class resides.
|
||||
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_VirtualHardDiskSettingData";
|
||||
|
||||
|
||||
// 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 VirtualHardDiskSettingData() {
|
||||
this.InitializeObject(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public VirtualHardDiskSettingData(string keyInstanceID) {
|
||||
this.InitializeObject(null, new System.Management.ManagementPath(VirtualHardDiskSettingData.ConstructPath(keyInstanceID)), null);
|
||||
}
|
||||
|
||||
|
||||
public VirtualHardDiskSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) {
|
||||
this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(VirtualHardDiskSettingData.ConstructPath(keyInstanceID)), null);
|
||||
}
|
||||
|
||||
|
||||
public VirtualHardDiskSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
|
||||
this.InitializeObject(null, path, getOptions);
|
||||
}
|
||||
|
||||
|
||||
public VirtualHardDiskSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
|
||||
this.InitializeObject(mgmtScope, path, null);
|
||||
}
|
||||
|
||||
|
||||
public VirtualHardDiskSettingData(System.Management.ManagementPath path) {
|
||||
this.InitializeObject(null, path, null);
|
||||
}
|
||||
|
||||
|
||||
public VirtualHardDiskSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
|
||||
this.InitializeObject(mgmtScope, path, getOptions);
|
||||
}
|
||||
|
||||
|
||||
public VirtualHardDiskSettingData(System.Management.ManagementObject theObject) {
|
||||
Initialize();
|
||||
if ((CheckIfProperClass(theObject) == true)) {
|
||||
@ -98,7 +98,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public VirtualHardDiskSettingData(System.Management.ManagementBaseObject theObject) {
|
||||
Initialize();
|
||||
if ((CheckIfProperClass(theObject) == true)) {
|
||||
@ -111,7 +111,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returns the namespace of the WMI class.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -120,7 +120,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return "ROOT\\virtualization\\v2";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ManagementClassName {
|
||||
@ -129,7 +129,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
if ((curObj != null)) {
|
||||
if ((curObj.ClassPath != null)) {
|
||||
strRet = ((string)(curObj["__CLASS"]));
|
||||
if (((strRet == null)
|
||||
if (((strRet == null)
|
||||
|| (strRet == string.Empty))) {
|
||||
strRet = CreatedClassName;
|
||||
}
|
||||
@ -138,7 +138,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return strRet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property pointing to an embedded object to get System properties of the WMI object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -147,7 +147,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return PrivateSystemProperties;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returning the underlying lateBound object.
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -156,7 +156,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return curObj;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ManagementScope of the object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -175,7 +175,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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)]
|
||||
@ -187,7 +187,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
AutoCommitProp = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// The ManagementPath of the underlying WMI object.
|
||||
[Browsable(true)]
|
||||
public System.Management.ManagementPath Path {
|
||||
@ -208,7 +208,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Public static scope property which is used by the various methods.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -220,7 +220,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
statMgmtScope = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsBlockSizeNull {
|
||||
@ -233,7 +233,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The block size used by the virtual hard disk")]
|
||||
@ -247,13 +247,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["BlockSize"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Caption {
|
||||
@ -262,13 +262,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["Caption"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Description {
|
||||
@ -277,13 +277,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["Description"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ElementName {
|
||||
@ -292,13 +292,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["ElementName"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsFormatNull {
|
||||
@ -311,7 +311,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The format for the virtual hard disk.")]
|
||||
@ -330,13 +330,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
else {
|
||||
curObj["Format"] = value;
|
||||
}
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string InstanceID {
|
||||
@ -345,13 +345,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["InstanceID"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsLogicalSectorSizeNull {
|
||||
@ -364,7 +364,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The logical sector size used by the virtual hard disk")]
|
||||
@ -378,13 +378,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["LogicalSectorSize"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsMaxInternalSizeNull {
|
||||
@ -397,7 +397,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The maximum size of the virtual hard disk as viewable by the virtual machine, in " +
|
||||
@ -413,13 +413,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["MaxInternalSize"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The parent of the virtual hard disk. If the virtual hard disk does not have a par" +
|
||||
@ -430,13 +430,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["ParentPath"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The path of the virtual hard disk.")]
|
||||
@ -446,13 +446,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["Path"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsPhysicalSectorSizeNull {
|
||||
@ -465,7 +465,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The physical sector size used by the virtual hard disk")]
|
||||
@ -479,13 +479,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["PhysicalSectorSize"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsTypeNull {
|
||||
@ -498,7 +498,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The type of virtual hard disk.")]
|
||||
@ -517,15 +517,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
else {
|
||||
curObj["Type"] = value;
|
||||
}
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) {
|
||||
if (((path != null)
|
||||
if (((path != null)
|
||||
&& (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -533,9 +533,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) {
|
||||
if (((theObj != null)
|
||||
if (((theObj != null)
|
||||
&& (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -552,162 +552,162 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeBlockSize() {
|
||||
if ((this.IsBlockSizeNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void ResetBlockSize() {
|
||||
curObj["BlockSize"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ResetCaption() {
|
||||
curObj["Caption"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ResetDescription() {
|
||||
curObj["Description"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ResetElementName() {
|
||||
curObj["ElementName"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeFormat() {
|
||||
if ((this.IsFormatNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void ResetFormat() {
|
||||
curObj["Format"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeLogicalSectorSize() {
|
||||
if ((this.IsLogicalSectorSizeNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void ResetLogicalSectorSize() {
|
||||
curObj["LogicalSectorSize"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeMaxInternalSize() {
|
||||
if ((this.IsMaxInternalSizeNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void ResetMaxInternalSize() {
|
||||
curObj["MaxInternalSize"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ResetParentPath() {
|
||||
curObj["ParentPath"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ResetPath0() {
|
||||
curObj["Path"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializePhysicalSectorSize() {
|
||||
if ((this.IsPhysicalSectorSizeNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void ResetPhysicalSectorSize() {
|
||||
curObj["PhysicalSectorSize"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeType() {
|
||||
if ((this.IsTypeNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void ResetType() {
|
||||
curObj["Type"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[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\\v2:Msvm_VirtualHardDiskSettingData";
|
||||
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)) {
|
||||
@ -719,24 +719,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject);
|
||||
curObj = PrivateLateBoundObject;
|
||||
}
|
||||
|
||||
|
||||
// Different overloads of GetInstances() help in enumerating instances of the WMI class.
|
||||
public static VirtualHardDiskSettingDataCollection GetInstances() {
|
||||
return GetInstances(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public static VirtualHardDiskSettingDataCollection GetInstances(string condition) {
|
||||
return GetInstances(null, condition, null);
|
||||
}
|
||||
|
||||
|
||||
public static VirtualHardDiskSettingDataCollection GetInstances(string[] selectedProperties) {
|
||||
return GetInstances(null, null, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static VirtualHardDiskSettingDataCollection GetInstances(string condition, string[] selectedProperties) {
|
||||
return GetInstances(null, condition, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static VirtualHardDiskSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
|
||||
if ((mgmtScope == null)) {
|
||||
if ((statMgmtScope == null)) {
|
||||
@ -757,15 +757,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
return new VirtualHardDiskSettingDataCollection(clsObject.GetInstances(enumOptions));
|
||||
}
|
||||
|
||||
|
||||
public static VirtualHardDiskSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
|
||||
return GetInstances(mgmtScope, condition, null);
|
||||
}
|
||||
|
||||
|
||||
public static VirtualHardDiskSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
|
||||
return GetInstances(mgmtScope, null, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static VirtualHardDiskSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
|
||||
if ((mgmtScope == null)) {
|
||||
if ((statMgmtScope == null)) {
|
||||
@ -782,7 +782,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
ObjectSearcher.Options = enumOptions;
|
||||
return new VirtualHardDiskSettingDataCollection(ObjectSearcher.Get());
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public static VirtualHardDiskSettingData CreateInstance() {
|
||||
System.Management.ManagementScope mgmtScope = null;
|
||||
@ -797,59 +797,59 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null);
|
||||
return new VirtualHardDiskSettingData(tmpMgmtClass.CreateInstance());
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public void Delete() {
|
||||
PrivateLateBoundObject.Delete();
|
||||
}
|
||||
|
||||
|
||||
public enum FormatValues {
|
||||
|
||||
|
||||
VHD = 2,
|
||||
|
||||
|
||||
VHDX = 3,
|
||||
|
||||
|
||||
NULL_ENUM_VALUE = 0,
|
||||
}
|
||||
|
||||
|
||||
public enum TypeValues {
|
||||
|
||||
|
||||
Fixed = 2,
|
||||
|
||||
|
||||
Dynamic = 3,
|
||||
|
||||
|
||||
Differencing = 4,
|
||||
|
||||
|
||||
NULL_ENUM_VALUE = 0,
|
||||
}
|
||||
|
||||
|
||||
// Enumerator implementation for enumerating instances of the class.
|
||||
public class VirtualHardDiskSettingDataCollection : object, ICollection {
|
||||
|
||||
|
||||
private ManagementObjectCollection privColObj;
|
||||
|
||||
|
||||
public VirtualHardDiskSettingDataCollection(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;
|
||||
@ -857,189 +857,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
array.SetValue(new VirtualHardDiskSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public virtual System.Collections.IEnumerator GetEnumerator() {
|
||||
return new VirtualHardDiskSettingDataEnumerator(privColObj.GetEnumerator());
|
||||
}
|
||||
|
||||
|
||||
public class VirtualHardDiskSettingDataEnumerator : object, System.Collections.IEnumerator {
|
||||
|
||||
|
||||
private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum;
|
||||
|
||||
|
||||
public VirtualHardDiskSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
|
||||
privObjEnum = objEnum;
|
||||
}
|
||||
|
||||
|
||||
public virtual object Current {
|
||||
get {
|
||||
return new VirtualHardDiskSettingData(((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))
|
||||
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))
|
||||
if (((baseType == typeof(bool))
|
||||
&& (baseType.BaseType == typeof(System.ValueType)))) {
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
&& (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
|
||||
return "";
|
||||
}
|
||||
return baseConverter.ConvertTo(context, culture, value, destinationType);
|
||||
}
|
||||
if (((context != null)
|
||||
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 {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,7 @@
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
{
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
@ -24,70 +24,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
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\\v2";
|
||||
|
||||
|
||||
// Private property to hold the name of WMI class which created this class.
|
||||
public 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)) {
|
||||
@ -99,7 +99,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public VirtualSystemManagementServiceSettingData(System.Management.ManagementBaseObject theObject) {
|
||||
Initialize();
|
||||
if ((CheckIfProperClass(theObject) == true)) {
|
||||
@ -112,7 +112,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returns the namespace of the WMI class.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -121,7 +121,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return "ROOT\\virtualization\\v2";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ManagementClassName {
|
||||
@ -130,7 +130,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
if ((curObj != null)) {
|
||||
if ((curObj.ClassPath != null)) {
|
||||
strRet = ((string)(curObj["__CLASS"]));
|
||||
if (((strRet == null)
|
||||
if (((strRet == null)
|
||||
|| (strRet == string.Empty))) {
|
||||
strRet = CreatedClassName;
|
||||
}
|
||||
@ -139,7 +139,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return strRet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property pointing to an embedded object to get System properties of the WMI object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -148,7 +148,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return PrivateSystemProperties;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returning the underlying lateBound object.
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -157,7 +157,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
return curObj;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ManagementScope of the object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -176,7 +176,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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)]
|
||||
@ -188,7 +188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
AutoCommitProp = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// The ManagementPath of the underlying WMI object.
|
||||
[Browsable(true)]
|
||||
public System.Management.ManagementPath Path {
|
||||
@ -209,7 +209,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Public static scope property which is used by the various methods.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2
|
||||
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.
|
||||
@ -231,7 +231,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
return ((string)(curObj["BiosLockString"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Caption {
|
||||
@ -239,7 +239,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
return ((string)(curObj["Caption"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The WorldWideNodeName address for dynamically generated WorldWideName addresses u" +
|
||||
@ -251,7 +251,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
return ((string)(curObj["CurrentWWNNAddress"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The default external data root. By default, \"root\\ProgramData\\Microsoft\\Windows\\V" +
|
||||
@ -262,7 +262,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
return ((string)(curObj["DefaultExternalDataRoot"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The default virtual hard disk path. By default, \"root\\Users\\Public\\Documents\\Virt" +
|
||||
@ -273,7 +273,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
return ((string)(curObj["DefaultVirtualHardDiskPath"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Description {
|
||||
@ -281,7 +281,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
return ((string)(curObj["Description"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ElementName {
|
||||
@ -289,7 +289,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
return ((string)(curObj["ElementName"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsHbaLunTimeoutNull {
|
||||
@ -302,7 +302,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description(@"This property describes the amount of time that the Synthetic FC virtual device will wait for a LUN to appear before starting a virtual machine.
|
||||
@ -316,7 +316,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
return ((uint)(curObj["HbaLunTimeout"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string InstanceID {
|
||||
@ -324,7 +324,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
return ((string)(curObj["InstanceID"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The maximum MAC address for dynamically generated MAC addresses.\nThis is a read-o" +
|
||||
@ -335,7 +335,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
return ((string)(curObj["MaximumMacAddress"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The maximum WorldWidePortName address for dynamically generated WorldWideName add" +
|
||||
@ -347,7 +347,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
return ((string)(curObj["MaximumWWPNAddress"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The minimum MAC address for dynamically generated MAC addresses.\nThis is a read-o" +
|
||||
@ -358,7 +358,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
return ((string)(curObj["MinimumMacAddress"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("The minimum WorldWidePortName address for dynamically generated WorldWideName add" +
|
||||
@ -370,7 +370,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
return ((string)(curObj["MinimumWWPNAddress"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsNumaSpanningEnabledNull {
|
||||
@ -383,7 +383,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("Reserved for future use.")]
|
||||
@ -396,7 +396,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
return ((bool)(curObj["NumaSpanningEnabled"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("Controls memory allocation for the VMs on non-uniform memory access (NUMA) system" +
|
||||
@ -407,7 +407,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
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.
|
||||
@ -417,9 +417,9 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
return ((string)(curObj["PrimaryOwnerName"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) {
|
||||
if (((path != null)
|
||||
if (((path != null)
|
||||
&& (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -427,9 +427,9 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) {
|
||||
if (((theObj != null)
|
||||
if (((theObj != null)
|
||||
&& (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -446,46 +446,46 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeHbaLunTimeout() {
|
||||
if ((this.IsHbaLunTimeoutNull == false)) {
|
||||
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\\v2: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)) {
|
||||
@ -497,24 +497,24 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
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)) {
|
||||
@ -535,15 +535,15 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
}
|
||||
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)) {
|
||||
@ -560,7 +560,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
ObjectSearcher.Options = enumOptions;
|
||||
return new VirtualSystemManagementServiceSettingDataCollection(ObjectSearcher.Get());
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public static VirtualSystemManagementServiceSettingData CreateInstance() {
|
||||
System.Management.ManagementScope mgmtScope = null;
|
||||
@ -575,39 +575,39 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
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;
|
||||
@ -615,189 +615,189 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti
|
||||
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))
|
||||
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))
|
||||
if (((baseType == typeof(bool))
|
||||
&& (baseType.BaseType == typeof(System.ValueType)))) {
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
&& (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
|
||||
return "";
|
||||
}
|
||||
return baseConverter.ConvertTo(context, culture, value, destinationType);
|
||||
}
|
||||
if (((context != null)
|
||||
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 {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -23,70 +23,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
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_VirtualSystemMigrationSettingData
|
||||
public class VirtualSystemMigrationSettingData : System.ComponentModel.Component {
|
||||
|
||||
|
||||
// Private property to hold the WMI namespace in which the class resides.
|
||||
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_VirtualSystemMigrationSettingData";
|
||||
|
||||
|
||||
// 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 VirtualSystemMigrationSettingData() {
|
||||
this.InitializeObject(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public VirtualSystemMigrationSettingData(string keyInstanceID) {
|
||||
this.InitializeObject(null, new System.Management.ManagementPath(VirtualSystemMigrationSettingData.ConstructPath(keyInstanceID)), null);
|
||||
}
|
||||
|
||||
|
||||
public VirtualSystemMigrationSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) {
|
||||
this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(VirtualSystemMigrationSettingData.ConstructPath(keyInstanceID)), null);
|
||||
}
|
||||
|
||||
|
||||
public VirtualSystemMigrationSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
|
||||
this.InitializeObject(null, path, getOptions);
|
||||
}
|
||||
|
||||
|
||||
public VirtualSystemMigrationSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
|
||||
this.InitializeObject(mgmtScope, path, null);
|
||||
}
|
||||
|
||||
|
||||
public VirtualSystemMigrationSettingData(System.Management.ManagementPath path) {
|
||||
this.InitializeObject(null, path, null);
|
||||
}
|
||||
|
||||
|
||||
public VirtualSystemMigrationSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
|
||||
this.InitializeObject(mgmtScope, path, getOptions);
|
||||
}
|
||||
|
||||
|
||||
public VirtualSystemMigrationSettingData(System.Management.ManagementObject theObject) {
|
||||
Initialize();
|
||||
if ((CheckIfProperClass(theObject) == true)) {
|
||||
@ -98,7 +98,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public VirtualSystemMigrationSettingData(System.Management.ManagementBaseObject theObject) {
|
||||
Initialize();
|
||||
if ((CheckIfProperClass(theObject) == true)) {
|
||||
@ -111,7 +111,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
throw new System.ArgumentException("Class name does not match.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returns the namespace of the WMI class.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -120,7 +120,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return "ROOT\\virtualization\\v2";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ManagementClassName {
|
||||
@ -129,7 +129,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
if ((curObj != null)) {
|
||||
if ((curObj.ClassPath != null)) {
|
||||
strRet = ((string)(curObj["__CLASS"]));
|
||||
if (((strRet == null)
|
||||
if (((strRet == null)
|
||||
|| (strRet == string.Empty))) {
|
||||
strRet = CreatedClassName;
|
||||
}
|
||||
@ -138,7 +138,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return strRet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property pointing to an embedded object to get System properties of the WMI object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -147,7 +147,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return PrivateSystemProperties;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Property returning the underlying lateBound object.
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -156,7 +156,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return curObj;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ManagementScope of the object.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -175,7 +175,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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)]
|
||||
@ -187,7 +187,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
AutoCommitProp = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// The ManagementPath of the underlying WMI object.
|
||||
[Browsable(true)]
|
||||
public System.Management.ManagementPath Path {
|
||||
@ -208,7 +208,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Public static scope property which is used by the various methods.
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
@ -220,7 +220,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
statMgmtScope = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsBandwidthNull {
|
||||
@ -233,7 +233,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -245,7 +245,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((ushort)(curObj["Bandwidth"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string BandwidthUnit {
|
||||
@ -253,7 +253,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["BandwidthUnit"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Caption {
|
||||
@ -261,7 +261,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["Caption"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Description {
|
||||
@ -269,7 +269,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
return ((string)(curObj["Description"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("For storage migration it will be NULL. For virtual system \nmigration, client can " +
|
||||
@ -280,19 +280,19 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
|
||||
}
|
||||
set {
|
||||
curObj["DestinationIPAddressList"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description(@"If we have a planned computer system at migration destination then DestinationPlannedVirtualSystemId could be set to
|
||||
the GUID of the destination Planned VM where the VM needs to
|
||||
migrate. This is useful for cases where user has created a
|
||||
planned VM at the destination along with resource fixup, and
|
||||
[Description(@"If we have a planned computer system at migration destination then DestinationPlannedVirtualSystemId could be set to
|
||||
the GUID of the destination Planned VM where the VM needs to
|
||||
migrate. This is useful for cases where user has created a
|
||||
planned VM at the destination along with resource fixup, and
|
||||
wants a VM from source to migrate into this planned VM.")]
|
||||
public string DestinationPlannedVirtualSystemId {
|
||||
get {
|
||||
@ -300,13 +300,13 @@ wants a VM from source to migrate into this planned VM.")]
|
||||
}
|
||||
set {
|
||||
curObj["DestinationPlannedVirtualSystemId"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string ElementName {
|
||||
@ -314,7 +314,7 @@ wants a VM from source to migrate into this planned VM.")]
|
||||
return ((string)(curObj["ElementName"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string InstanceID {
|
||||
@ -322,7 +322,7 @@ wants a VM from source to migrate into this planned VM.")]
|
||||
return ((string)(curObj["InstanceID"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsMigrationTypeNull {
|
||||
@ -335,7 +335,7 @@ wants a VM from source to migrate into this planned VM.")]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("MigrationType describes the type of migration operation to \nbe performed.\n")]
|
||||
@ -354,13 +354,13 @@ wants a VM from source to migrate into this planned VM.")]
|
||||
else {
|
||||
curObj["MigrationType"] = value;
|
||||
}
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string OtherTransportType {
|
||||
@ -368,7 +368,7 @@ wants a VM from source to migrate into this planned VM.")]
|
||||
return ((string)(curObj["OtherTransportType"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsPriorityNull {
|
||||
@ -381,7 +381,7 @@ wants a VM from source to migrate into this planned VM.")]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -393,7 +393,7 @@ wants a VM from source to migrate into this planned VM.")]
|
||||
return ((ushort)(curObj["Priority"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsRetainVhdCopiesOnSourceNull {
|
||||
@ -406,7 +406,7 @@ wants a VM from source to migrate into this planned VM.")]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("For storage migration, this could be set to TRUE or FALSE\nto determine wheither, " +
|
||||
@ -422,13 +422,13 @@ wants a VM from source to migrate into this planned VM.")]
|
||||
}
|
||||
set {
|
||||
curObj["RetainVhdCopiesOnSource"] = value;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsTransportTypeNull {
|
||||
@ -441,7 +441,7 @@ wants a VM from source to migrate into this planned VM.")]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[TypeConverter(typeof(WMIValueTypeConverter))]
|
||||
@ -453,9 +453,9 @@ wants a VM from source to migrate into this planned VM.")]
|
||||
return ((ushort)(curObj["TransportType"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) {
|
||||
if (((path != null)
|
||||
if (((path != null)
|
||||
&& (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -463,9 +463,9 @@ wants a VM from source to migrate into this planned VM.")]
|
||||
return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) {
|
||||
if (((theObj != null)
|
||||
if (((theObj != null)
|
||||
&& (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
|
||||
return true;
|
||||
}
|
||||
@ -482,99 +482,99 @@ wants a VM from source to migrate into this planned VM.")]
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeBandwidth() {
|
||||
if ((this.IsBandwidthNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void ResetDestinationIPAddressList() {
|
||||
curObj["DestinationIPAddressList"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ResetDestinationPlannedVirtualSystemId() {
|
||||
curObj["DestinationPlannedVirtualSystemId"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeMigrationType() {
|
||||
if ((this.IsMigrationTypeNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void ResetMigrationType() {
|
||||
curObj["MigrationType"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializePriority() {
|
||||
if ((this.IsPriorityNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeRetainVhdCopiesOnSource() {
|
||||
if ((this.IsRetainVhdCopiesOnSourceNull == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void ResetRetainVhdCopiesOnSource() {
|
||||
curObj["RetainVhdCopiesOnSource"] = null;
|
||||
if (((isEmbedded == false)
|
||||
if (((isEmbedded == false)
|
||||
&& (AutoCommitProp == true))) {
|
||||
PrivateLateBoundObject.Put();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldSerializeTransportType() {
|
||||
if ((this.IsTransportTypeNull == 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\\v2:Msvm_VirtualSystemMigrationSettingData";
|
||||
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)) {
|
||||
@ -586,24 +586,24 @@ wants a VM from source to migrate into this planned VM.")]
|
||||
PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject);
|
||||
curObj = PrivateLateBoundObject;
|
||||
}
|
||||
|
||||
|
||||
// Different overloads of GetInstances() help in enumerating instances of the WMI class.
|
||||
public static VirtualSystemMigrationSettingDataCollection GetInstances() {
|
||||
return GetInstances(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public static VirtualSystemMigrationSettingDataCollection GetInstances(string condition) {
|
||||
return GetInstances(null, condition, null);
|
||||
}
|
||||
|
||||
|
||||
public static VirtualSystemMigrationSettingDataCollection GetInstances(string[] selectedProperties) {
|
||||
return GetInstances(null, null, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static VirtualSystemMigrationSettingDataCollection GetInstances(string condition, string[] selectedProperties) {
|
||||
return GetInstances(null, condition, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static VirtualSystemMigrationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
|
||||
if ((mgmtScope == null)) {
|
||||
if ((statMgmtScope == null)) {
|
||||
@ -624,15 +624,15 @@ wants a VM from source to migrate into this planned VM.")]
|
||||
}
|
||||
return new VirtualSystemMigrationSettingDataCollection(clsObject.GetInstances(enumOptions));
|
||||
}
|
||||
|
||||
|
||||
public static VirtualSystemMigrationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
|
||||
return GetInstances(mgmtScope, condition, null);
|
||||
}
|
||||
|
||||
|
||||
public static VirtualSystemMigrationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
|
||||
return GetInstances(mgmtScope, null, selectedProperties);
|
||||
}
|
||||
|
||||
|
||||
public static VirtualSystemMigrationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
|
||||
if ((mgmtScope == null)) {
|
||||
if ((statMgmtScope == null)) {
|
||||
@ -649,7 +649,7 @@ wants a VM from source to migrate into this planned VM.")]
|
||||
ObjectSearcher.Options = enumOptions;
|
||||
return new VirtualSystemMigrationSettingDataCollection(ObjectSearcher.Get());
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public static VirtualSystemMigrationSettingData CreateInstance() {
|
||||
System.Management.ManagementScope mgmtScope = null;
|
||||
@ -664,56 +664,56 @@ wants a VM from source to migrate into this planned VM.")]
|
||||
System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null);
|
||||
return new VirtualSystemMigrationSettingData(tmpMgmtClass.CreateInstance());
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public void Delete() {
|
||||
PrivateLateBoundObject.Delete();
|
||||
}
|
||||
|
||||
|
||||
public enum MigrationTypeValues {
|
||||
|
||||
|
||||
Unknown0 = 0,
|
||||
|
||||
|
||||
VirtualSystem = 32768,
|
||||
|
||||
|
||||
Storage = 32769,
|
||||
|
||||
|
||||
Staged = 32770,
|
||||
|
||||
|
||||
VirtualSystemAndStorage = 32771,
|
||||
|
||||
|
||||
StorageDeepCheck = 32772,
|
||||
|
||||
|
||||
NULL_ENUM_VALUE = 32773,
|
||||
}
|
||||
|
||||
|
||||
// Enumerator implementation for enumerating instances of the class.
|
||||
public class VirtualSystemMigrationSettingDataCollection : object, ICollection {
|
||||
|
||||
|
||||
private ManagementObjectCollection privColObj;
|
||||
|
||||
|
||||
public VirtualSystemMigrationSettingDataCollection(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;
|
||||
@ -721,189 +721,189 @@ wants a VM from source to migrate into this planned VM.")]
|
||||
array.SetValue(new VirtualSystemMigrationSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public virtual System.Collections.IEnumerator GetEnumerator() {
|
||||
return new VirtualSystemMigrationSettingDataEnumerator(privColObj.GetEnumerator());
|
||||
}
|
||||
|
||||
|
||||
public class VirtualSystemMigrationSettingDataEnumerator : object, System.Collections.IEnumerator {
|
||||
|
||||
|
||||
private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum;
|
||||
|
||||
|
||||
public VirtualSystemMigrationSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
|
||||
privObjEnum = objEnum;
|
||||
}
|
||||
|
||||
|
||||
public virtual object Current {
|
||||
get {
|
||||
return new VirtualSystemMigrationSettingData(((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))
|
||||
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))
|
||||
if (((baseType == typeof(bool))
|
||||
&& (baseType.BaseType == typeof(System.ValueType)))) {
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
if ((((value == null)
|
||||
&& (context != null))
|
||||
&& (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
|
||||
return "";
|
||||
}
|
||||
return baseConverter.ConvertTo(context, culture, value, destinationType);
|
||||
}
|
||||
if (((context != null)
|
||||
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 {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user