You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by de...@apache.org on 2013/12/04 06:14:02 UTC

[1/4] Changes for allowing migration of a vm on hyperv. Migration was blocked in cloudstack for hyperv. Enabled it. Also updated the agent code to allow hyperv migration.

Updated Branches:
  refs/heads/master f420b7489 -> d26b9ac00


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a96307f/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemMigrationSettingData.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemMigrationSettingData.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemMigrationSettingData.cs
new file mode 100644
index 0000000..de5bea5
--- /dev/null
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemMigrationSettingData.cs
@@ -0,0 +1,915 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
+    using System;
+    using System.ComponentModel;
+    using System.Management;
+    using System.Collections;
+    using System.Globalization;
+    using System.ComponentModel.Design.Serialization;
+    using System.Reflection;
+    
+    
+    // Functions ShouldSerialize<PropertyName> are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use Is<PropertyName>Null function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio.
+    // Functions Is<PropertyName>Null() are used to check if a property is NULL.
+    // Functions Reset<PropertyName> are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL.
+    // Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used.
+    // An Early Bound class generated for the WMI class.Msvm_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)) {
+                PrivateLateBoundObject = theObject;
+                PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject);
+                curObj = PrivateLateBoundObject;
+            }
+            else {
+                throw new System.ArgumentException("Class name does not match.");
+            }
+        }
+        
+        public VirtualSystemMigrationSettingData(System.Management.ManagementBaseObject theObject) {
+            Initialize();
+            if ((CheckIfProperClass(theObject) == true)) {
+                embeddedObj = theObject;
+                PrivateSystemProperties = new ManagementSystemProperties(theObject);
+                curObj = embeddedObj;
+                isEmbedded = true;
+            }
+            else {
+                throw new System.ArgumentException("Class name does not match.");
+            }
+        }
+        
+        // Property returns the namespace of the WMI class.
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string OriginatingNamespace {
+            get {
+                return "ROOT\\virtualization\\v2";
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string ManagementClassName {
+            get {
+                string strRet = CreatedClassName;
+                if ((curObj != null)) {
+                    if ((curObj.ClassPath != null)) {
+                        strRet = ((string)(curObj["__CLASS"]));
+                        if (((strRet == null) 
+                                    || (strRet == string.Empty))) {
+                            strRet = CreatedClassName;
+                        }
+                    }
+                }
+                return strRet;
+            }
+        }
+        
+        // Property pointing to an embedded object to get System properties of the WMI object.
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public ManagementSystemProperties SystemProperties {
+            get {
+                return PrivateSystemProperties;
+            }
+        }
+        
+        // Property returning the underlying lateBound object.
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public System.Management.ManagementBaseObject LateBoundObject {
+            get {
+                return curObj;
+            }
+        }
+        
+        // ManagementScope of the object.
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public System.Management.ManagementScope Scope {
+            get {
+                if ((isEmbedded == false)) {
+                    return PrivateLateBoundObject.Scope;
+                }
+                else {
+                    return null;
+                }
+            }
+            set {
+                if ((isEmbedded == false)) {
+                    PrivateLateBoundObject.Scope = value;
+                }
+            }
+        }
+        
+        // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property).
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool AutoCommit {
+            get {
+                return AutoCommitProp;
+            }
+            set {
+                AutoCommitProp = value;
+            }
+        }
+        
+        // The ManagementPath of the underlying WMI object.
+        [Browsable(true)]
+        public System.Management.ManagementPath Path {
+            get {
+                if ((isEmbedded == false)) {
+                    return PrivateLateBoundObject.Path;
+                }
+                else {
+                    return null;
+                }
+            }
+            set {
+                if ((isEmbedded == false)) {
+                    if ((CheckIfProperClass(null, value, null) != true)) {
+                        throw new System.ArgumentException("Class name does not match.");
+                    }
+                    PrivateLateBoundObject.Path = value;
+                }
+            }
+        }
+        
+        // Public static scope property which is used by the various methods.
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public static System.Management.ManagementScope StaticScope {
+            get {
+                return statMgmtScope;
+            }
+            set {
+                statMgmtScope = value;
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsBandwidthNull {
+            get {
+                if ((curObj["Bandwidth"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort Bandwidth {
+            get {
+                if ((curObj["Bandwidth"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["Bandwidth"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string BandwidthUnit {
+            get {
+                return ((string)(curObj["BandwidthUnit"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string Caption {
+            get {
+                return ((string)(curObj["Caption"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string Description {
+            get {
+                return ((string)(curObj["Description"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [Description("For storage migration it will be NULL. For virtual system \nmigration, client can " +
+            "provide a list of IP addresses of the \ndestination host.")]
+        public string[] DestinationIPAddressList {
+            get {
+                return ((string[])(curObj["DestinationIPAddressList"]));
+            }
+            set {
+                curObj["DestinationIPAddressList"] = value;
+                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 
+wants a VM from source to migrate into this planned VM.")]
+        public string DestinationPlannedVirtualSystemId {
+            get {
+                return ((string)(curObj["DestinationPlannedVirtualSystemId"]));
+            }
+            set {
+                curObj["DestinationPlannedVirtualSystemId"] = value;
+                if (((isEmbedded == false) 
+                            && (AutoCommitProp == true))) {
+                    PrivateLateBoundObject.Put();
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string ElementName {
+            get {
+                return ((string)(curObj["ElementName"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string InstanceID {
+            get {
+                return ((string)(curObj["InstanceID"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsMigrationTypeNull {
+            get {
+                if ((curObj["MigrationType"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [Description("MigrationType describes the type of migration operation to \nbe performed.\n")]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public MigrationTypeValues MigrationType {
+            get {
+                if ((curObj["MigrationType"] == null)) {
+                    return ((MigrationTypeValues)(System.Convert.ToInt32(32773)));
+                }
+                return ((MigrationTypeValues)(System.Convert.ToInt32(curObj["MigrationType"])));
+            }
+            set {
+                if ((MigrationTypeValues.NULL_ENUM_VALUE == value)) {
+                    curObj["MigrationType"] = null;
+                }
+                else {
+                    curObj["MigrationType"] = value;
+                }
+                if (((isEmbedded == false) 
+                            && (AutoCommitProp == true))) {
+                    PrivateLateBoundObject.Put();
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string OtherTransportType {
+            get {
+                return ((string)(curObj["OtherTransportType"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsPriorityNull {
+            get {
+                if ((curObj["Priority"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort Priority {
+            get {
+                if ((curObj["Priority"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["Priority"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsRetainVhdCopiesOnSourceNull {
+            get {
+                if ((curObj["RetainVhdCopiesOnSource"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [Description("For storage migration, this could be set to TRUE or FALSE\nto determine wheither, " +
+            "at the end of a storage migration, when the\nsource host is beeing clean up, the " +
+            "read only VHDs should be removedor not.")]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public bool RetainVhdCopiesOnSource {
+            get {
+                if ((curObj["RetainVhdCopiesOnSource"] == null)) {
+                    return System.Convert.ToBoolean(0);
+                }
+                return ((bool)(curObj["RetainVhdCopiesOnSource"]));
+            }
+            set {
+                curObj["RetainVhdCopiesOnSource"] = value;
+                if (((isEmbedded == false) 
+                            && (AutoCommitProp == true))) {
+                    PrivateLateBoundObject.Put();
+                }
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsTransportTypeNull {
+            get {
+                if ((curObj["TransportType"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort TransportType {
+            get {
+                if ((curObj["TransportType"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["TransportType"]));
+            }
+        }
+        
+        private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) {
+            if (((path != null) 
+                        && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
+                return true;
+            }
+            else {
+                return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam));
+            }
+        }
+        
+        private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) {
+            if (((theObj != null) 
+                        && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
+                return true;
+            }
+            else {
+                System.Array parentClasses = ((System.Array)(theObj["__DERIVATION"]));
+                if ((parentClasses != null)) {
+                    int count = 0;
+                    for (count = 0; (count < parentClasses.Length); count = (count + 1)) {
+                        if ((string.Compare(((string)(parentClasses.GetValue(count))), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0)) {
+                            return true;
+                        }
+                    }
+                }
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeBandwidth() {
+            if ((this.IsBandwidthNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private void ResetDestinationIPAddressList() {
+            curObj["DestinationIPAddressList"] = null;
+            if (((isEmbedded == false) 
+                        && (AutoCommitProp == true))) {
+                PrivateLateBoundObject.Put();
+            }
+        }
+        
+        private void ResetDestinationPlannedVirtualSystemId() {
+            curObj["DestinationPlannedVirtualSystemId"] = null;
+            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) 
+                        && (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) 
+                        && (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)) {
+                if ((CheckIfProperClass(mgmtScope, path, getOptions) != true)) {
+                    throw new System.ArgumentException("Class name does not match.");
+                }
+            }
+            PrivateLateBoundObject = new System.Management.ManagementObject(mgmtScope, path, getOptions);
+            PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject);
+            curObj = PrivateLateBoundObject;
+        }
+        
+        // Different overloads of GetInstances() help in enumerating instances of the WMI class.
+        public static 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)) {
+                    mgmtScope = new System.Management.ManagementScope();
+                    mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
+                }
+                else {
+                    mgmtScope = statMgmtScope;
+                }
+            }
+            System.Management.ManagementPath pathObj = new System.Management.ManagementPath();
+            pathObj.ClassName = "Msvm_VirtualSystemMigrationSettingData";
+            pathObj.NamespacePath = "root\\virtualization\\v2";
+            System.Management.ManagementClass clsObject = new System.Management.ManagementClass(mgmtScope, pathObj, null);
+            if ((enumOptions == null)) {
+                enumOptions = new System.Management.EnumerationOptions();
+                enumOptions.EnsureLocatable = true;
+            }
+            return new 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)) {
+                    mgmtScope = new System.Management.ManagementScope();
+                    mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
+                }
+                else {
+                    mgmtScope = statMgmtScope;
+                }
+            }
+            System.Management.ManagementObjectSearcher ObjectSearcher = new System.Management.ManagementObjectSearcher(mgmtScope, new SelectQuery("Msvm_VirtualSystemMigrationSettingData", condition, selectedProperties));
+            System.Management.EnumerationOptions enumOptions = new System.Management.EnumerationOptions();
+            enumOptions.EnsureLocatable = true;
+            ObjectSearcher.Options = enumOptions;
+            return new VirtualSystemMigrationSettingDataCollection(ObjectSearcher.Get());
+        }
+        
+        [Browsable(true)]
+        public static VirtualSystemMigrationSettingData CreateInstance() {
+            System.Management.ManagementScope mgmtScope = null;
+            if ((statMgmtScope == null)) {
+                mgmtScope = new System.Management.ManagementScope();
+                mgmtScope.Path.NamespacePath = CreatedWmiNamespace;
+            }
+            else {
+                mgmtScope = statMgmtScope;
+            }
+            System.Management.ManagementPath mgmtPath = new System.Management.ManagementPath(CreatedClassName);
+            System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null);
+            return new 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;
+                for (nCtr = 0; (nCtr < array.Length); nCtr = (nCtr + 1)) {
+                    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)) 
+                                && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
+                        return  "NULL_ENUM_VALUE" ;
+                    }
+                    return baseConverter.ConvertTo(context, culture, value, destinationType);
+                }
+                if (((baseType == typeof(bool)) 
+                            && (baseType.BaseType == typeof(System.ValueType)))) {
+                    if ((((value == null) 
+                                && (context != null)) 
+                                && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
+                        return "";
+                    }
+                    return baseConverter.ConvertTo(context, culture, value, destinationType);
+                }
+                if (((context != null) 
+                            && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
+                    return "";
+                }
+                return baseConverter.ConvertTo(context, culture, value, destinationType);
+            }
+        }
+        
+        // Embedded class to represent WMI system Properties.
+        [TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))]
+        public class ManagementSystemProperties {
+            
+            private System.Management.ManagementBaseObject PrivateLateBoundObject;
+            
+            public ManagementSystemProperties(System.Management.ManagementBaseObject ManagedObject) {
+                PrivateLateBoundObject = ManagedObject;
+            }
+            
+            [Browsable(true)]
+            public int GENUS {
+                get {
+                    return ((int)(PrivateLateBoundObject["__GENUS"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string CLASS {
+                get {
+                    return ((string)(PrivateLateBoundObject["__CLASS"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string SUPERCLASS {
+                get {
+                    return ((string)(PrivateLateBoundObject["__SUPERCLASS"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string DYNASTY {
+                get {
+                    return ((string)(PrivateLateBoundObject["__DYNASTY"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string RELPATH {
+                get {
+                    return ((string)(PrivateLateBoundObject["__RELPATH"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public int PROPERTY_COUNT {
+                get {
+                    return ((int)(PrivateLateBoundObject["__PROPERTY_COUNT"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string[] DERIVATION {
+                get {
+                    return ((string[])(PrivateLateBoundObject["__DERIVATION"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string SERVER {
+                get {
+                    return ((string)(PrivateLateBoundObject["__SERVER"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string NAMESPACE {
+                get {
+                    return ((string)(PrivateLateBoundObject["__NAMESPACE"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string PATH {
+                get {
+                    return ((string)(PrivateLateBoundObject["__PATH"]));
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a96307f/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/WmiWrappers.csproj
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/WmiWrappers.csproj b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/WmiWrappers.csproj
index da0c0d6..1a70340 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/WmiWrappers.csproj
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/WmiWrappers.csproj
@@ -123,6 +123,9 @@
     <Compile Include="ROOT.virtualization.v2.Msvm_MemorySettingData.cs">
       <SubType>Component</SubType>
     </Compile>
+    <Compile Include="ROOT.virtualization.v2.Msvm_MigrationJob.cs">
+      <SubType>Component</SubType>
+    </Compile>
     <Compile Include="ROOT.virtualization.v2.Msvm_ProcessorSettingData.cs">
       <SubType>Component</SubType>
     </Compile>
@@ -153,6 +156,12 @@
     <Compile Include="ROOT.virtualization.v2.Msvm_VirtualSystemManagementServiceSettingData.cs">
       <SubType>Component</SubType>
     </Compile>
+    <Compile Include="ROOT.virtualization.v2.Msvm_VirtualSystemMigrationService.cs">
+      <SubType>Component</SubType>
+    </Compile>
+    <Compile Include="ROOT.virtualization.v2.Msvm_VirtualSystemMigrationSettingData.cs">
+      <SubType>Component</SubType>
+    </Compile>
     <Compile Include="ROOT.virtualization.v2.Msvm_VirtualSystemSettingData.cs">
       <SubType>Component</SubType>
     </Compile>
@@ -172,4 +181,4 @@
   <Target Name="AfterBuild">
   </Target>
   -->
-</Project>
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a96307f/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 860f165..ee9c04a 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -1067,12 +1067,14 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
             throw ex;
         }
 
-        if (!vm.getHypervisorType().equals(HypervisorType.XenServer) && !vm.getHypervisorType().equals(HypervisorType.VMware) &&
-            !vm.getHypervisorType().equals(HypervisorType.KVM) && !vm.getHypervisorType().equals(HypervisorType.Ovm)) {
+        if (!vm.getHypervisorType().equals(HypervisorType.XenServer) && !vm.getHypervisorType().equals(HypervisorType.VMware)
+                && !vm.getHypervisorType().equals(HypervisorType.KVM) && !vm.getHypervisorType().equals(HypervisorType.Ovm)
+                && !vm.getHypervisorType().equals(HypervisorType.Hyperv)) {
             if (s_logger.isDebugEnabled()) {
-                s_logger.debug(vm + " is not XenServer/VMware/KVM/OVM, cannot migrate this VM.");
+                s_logger.debug(vm + " is not XenServer/VMware/KVM/OVM/Hyperv, cannot migrate this VM.");
             }
-            throw new InvalidParameterValueException("Unsupported Hypervisor Type for VM migration, we support " + "XenServer/VMware/KVM/Ovm only");
+            throw new InvalidParameterValueException("Unsupported Hypervisor Type for VM migration, we support " +
+                    "XenServer/VMware/KVM/Ovm/Hyperv only");
         }
 
         long srcHostId = vm.getHostId();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a96307f/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index d3dd356..49f4e2e 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -3873,13 +3873,18 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             ex.addProxyObject(vm.getUuid(), "vmId");
             throw ex;
         }
-        if (!vm.getHypervisorType().equals(HypervisorType.XenServer) && !vm.getHypervisorType().equals(HypervisorType.VMware) &&
-            !vm.getHypervisorType().equals(HypervisorType.KVM) && !vm.getHypervisorType().equals(HypervisorType.Ovm) &&
-            !vm.getHypervisorType().equals(HypervisorType.Simulator)) {
+        if (!vm.getHypervisorType().equals(HypervisorType.XenServer)
+                && !vm.getHypervisorType().equals(HypervisorType.VMware)
+                && !vm.getHypervisorType().equals(HypervisorType.KVM)
+                && !vm.getHypervisorType().equals(HypervisorType.Ovm)
+                && !vm.getHypervisorType().equals(HypervisorType.Hyperv)
+                && !vm.getHypervisorType().equals(HypervisorType.Simulator)) {
             if (s_logger.isDebugEnabled()) {
-                s_logger.debug(vm + " is not XenServer/VMware/KVM/Ovm, cannot migrate this VM.");
+                s_logger.debug(vm
+                        + " is not XenServer/VMware/KVM/Ovm/Hyperv, cannot migrate this VM.");
             }
-            throw new InvalidParameterValueException("Unsupported Hypervisor Type for VM migration, we support XenServer/VMware/KVM only");
+            throw new InvalidParameterValueException(
+                    "Unsupported Hypervisor Type for VM migration, we support XenServer/VMware/KVM/Ovm/Hyperv only");
         }
 
         if (isVMUsingLocalStorage(vm)) {


[3/4] git commit: updated refs/heads/master to d26b9ac

Posted by de...@apache.org.
Changes for allowing migration of a vm on hyperv. Migration was blocked in cloudstack for hyperv.
Enabled it. Also updated the agent code to allow hyperv migration.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5a96307f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5a96307f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5a96307f

Branch: refs/heads/master
Commit: 5a96307fbf81ce42b3ad82a56bc6a1b2434cb396
Parents: f420b74
Author: Devdeep Singh <de...@gmail.com>
Authored: Tue Dec 3 17:27:24 2013 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Wed Dec 4 10:29:36 2013 +0530

----------------------------------------------------------------------
 .../HypervResource/CloudStackTypes.cs           |    1 +
 .../HypervResource/HypervResourceController.cs  |   10 +-
 .../HypervResource/IWmiCallsV2.cs               |    1 +
 .../ServerResource/HypervResource/WmiCallsV2.cs |   98 +-
 .../ROOT.virtualization.v2.Msvm_MigrationJob.cs | 1867 ++++++++++++++++++
 ...ion.v2.Msvm_VirtualSystemMigrationService.cs | 1581 +++++++++++++++
 ...v2.Msvm_VirtualSystemMigrationSettingData.cs |  915 +++++++++
 .../WmiWrappers/WmiWrappers.csproj              |   11 +-
 .../com/cloud/server/ManagementServerImpl.java  |   10 +-
 server/src/com/cloud/vm/UserVmManagerImpl.java  |   15 +-
 10 files changed, 4495 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a96307f/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
index af8c61f..7a373a4 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
@@ -160,6 +160,7 @@ namespace HypervResource
                 else
                 {
                     fileName = @"\\" + this.primaryDataStore.uri.Host + this.primaryDataStore.uri.LocalPath + @"\" + this.name;
+                    fileName = fileName.Replace(@"/", @"\");
                 }
 
                 if (this.format != null)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a96307f/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
index fd6fe9f..fc4dea5 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
@@ -1477,14 +1477,15 @@ namespace HypervResource
                 logger.Info(CloudStackTypes.PrepareForMigrationCommand + cmd.ToString());
 
                 string details = null;
-                bool result = false;
+                bool result = true;
 
                 try
                 {
-                    details = "NOP - failure";
+                    details = "NOP - success";
                 }
                 catch (Exception sysEx)
                 {
+                    result = false;
                     details = CloudStackTypes.PrepareForMigrationCommand + " failed due to " + sysEx.Message;
                     logger.Error(details, sysEx);
                 }
@@ -1514,7 +1515,10 @@ namespace HypervResource
 
                 try
                 {
-                    details = "NOP - failure";
+                    string vm = (string)cmd.vmName;
+                    string destination = (string)cmd.destIp;
+                    wmiCallsV2.MigrateVm(vm, destination);
+                    result = true;
                 }
                 catch (Exception sysEx)
                 {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a96307f/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs
index 223f748..99ce352 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs
@@ -38,6 +38,7 @@ namespace HypervResource
         ComputerSystem DeployVirtualMachine(dynamic jsonObj, string systemVmIso);
         void DestroyVm(dynamic jsonObj);
         void DestroyVm(string displayName);
+        void MigrateVm(string vmName, string destination);
         void DetachDisk(string displayName, string diskFileName);
         ComputerSystem GetComputerSystem(string displayName);
         string GetDefaultDataRoot();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a96307f/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
index e2d4f6c..c020168 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
@@ -36,6 +36,26 @@ namespace HypervResource
     {
         public static String CloudStackUserDataKey = "cloudstack-vm-userdata";
 
+        /// <summary>
+        /// Defines the migration types.
+        /// </summary>
+        public enum MigrationType
+        {
+            VirtualSystem = 32768,
+            Storage = 32769,
+            Staged = 32770,
+            VirtualSystemAndStorage = 32771
+        };
+
+        /// <summary>
+        /// Defines migration transport types.
+        /// </summary>
+        public enum TransportType
+        {
+            TCP = 5,
+            SMB = 32768
+        };
+
         public static void Initialize()
         {
             // Trigger assembly load into curren appdomain
@@ -858,7 +878,42 @@ namespace HypervResource
             }
             while (vm != null);
         }
-        
+
+        /// <summary>
+        /// Migrates a vm to the given destination host
+        /// </summary>
+        /// <param name="desplayName"></param>
+        /// <param name="destination host"></param>
+        public void MigrateVm(string vmName, string destination)
+        {
+            ComputerSystem vm = GetComputerSystem(vmName);
+            VirtualSystemMigrationSettingData migrationSettingData = VirtualSystemMigrationSettingData.CreateInstance();
+            VirtualSystemMigrationService service = GetVirtualisationSystemMigrationService();
+
+            migrationSettingData.LateBoundObject["MigrationType"] = MigrationType.VirtualSystem;
+            migrationSettingData.LateBoundObject["TransportType"] = TransportType.TCP;
+            string migrationSettings = migrationSettingData.LateBoundObject.GetText(System.Management.TextFormat.CimDtd20);
+
+            ManagementPath jobPath;
+            string destinationHost = "band-cloud153.blr.cloudstack.org";
+            var ret_val = service.MigrateVirtualSystemToHost(vm.Path, destinationHost, migrationSettings, null, null, out jobPath);
+            if (ret_val == ReturnCode.Started)
+            {
+                MigrationJobCompleted(jobPath);
+            }
+            else if (ret_val != ReturnCode.Completed)
+            {
+                var errMsg = string.Format(
+                    "Failed migrating VM {0} (GUID {1}) due to {2}",
+                    vm.ElementName,
+                    vm.Name,
+                    ReturnCode.ToString(ret_val));
+                var ex = new WmiException(errMsg);
+                logger.Error(errMsg, ex);
+                throw ex;
+            }
+        }
+
         /// <summary>
         /// Create new storage media resources, e.g. hard disk images and ISO disk images
         /// see http://msdn.microsoft.com/en-us/library/hh859775(v=vs.85).aspx
@@ -1475,6 +1530,21 @@ namespace HypervResource
             throw ex;
         }
 
+        public VirtualSystemMigrationService GetVirtualisationSystemMigrationService()
+        {
+
+            var virtSysMigSvcCollection = VirtualSystemMigrationService.GetInstances();
+            foreach (VirtualSystemMigrationService item in virtSysMigSvcCollection)
+            {
+                return item;
+            }
+
+            var errMsg = string.Format("No Hyper-V migration service subsystem on server");
+            var ex = new WmiException(errMsg);
+            logger.Error(errMsg, ex);
+            throw ex;
+        }
+
         /// <summary>
         /// Similar to http://msdn.microsoft.com/en-us/library/hh850031%28v=vs.85%29.aspx
         /// </summary>
@@ -1508,6 +1578,32 @@ namespace HypervResource
             logger.DebugFormat("WMI job succeeded: {0}, Elapsed={1}", jobObj.Description, jobObj.ElapsedTime);
         }
 
+        private static void MigrationJobCompleted(ManagementPath jobPath)
+        {
+            MigrationJob jobObj = null;
+            for (;;)
+            {
+                jobObj = new MigrationJob(jobPath);
+                if (jobObj.JobState != JobState.Starting && jobObj.JobState != JobState.Running)
+                {
+                    break;
+                }
+                logger.InfoFormat("In progress... {0}% completed.", jobObj.PercentComplete);
+                System.Threading.Thread.Sleep(1000);
+            }
+
+            if (jobObj.JobState != JobState.Completed)
+            {
+                var errMsg = string.Format(
+                    "Hyper-V Job failed, Error Code:{0}, Description: {1}",
+                    jobObj.ErrorCode,
+                    jobObj.ErrorDescription);
+                var ex = new WmiException(errMsg);
+                logger.Error(errMsg, ex);
+                throw ex;
+            }
+        }
+
         public void GetProcessorResources(out uint cores, out uint mhz)
         {
             //  Processor processors

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a96307f/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_MigrationJob.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_MigrationJob.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_MigrationJob.cs
new file mode 100644
index 0000000..7b7e5f1
--- /dev/null
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_MigrationJob.cs
@@ -0,0 +1,1867 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
+    using System;
+    using System.ComponentModel;
+    using System.Management;
+    using System.Collections;
+    using System.Globalization;
+    using System.ComponentModel.Design.Serialization;
+    using System.Reflection;
+
+
+    // Functions ShouldSerialize<PropertyName> are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use Is<PropertyName>Null function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio.
+    // Functions Is<PropertyName>Null() are used to check if a property is NULL.
+    // Functions Reset<PropertyName> are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL.
+    // Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used.
+    // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa.
+    // An Early Bound class generated for the WMI class.Msvm_MigrationJob
+    public class MigrationJob : 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_MigrationJob";
+        
+        // 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 MigrationJob() {
+            this.InitializeObject(null, null, null);
+        }
+        
+        public MigrationJob(string keyInstanceID) {
+            this.InitializeObject(null, new System.Management.ManagementPath(MigrationJob.ConstructPath(keyInstanceID)), null);
+        }
+        
+        public MigrationJob(System.Management.ManagementScope mgmtScope, string keyInstanceID) {
+            this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(MigrationJob.ConstructPath(keyInstanceID)), null);
+        }
+        
+        public MigrationJob(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
+            this.InitializeObject(null, path, getOptions);
+        }
+        
+        public MigrationJob(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
+            this.InitializeObject(mgmtScope, path, null);
+        }
+        
+        public MigrationJob(System.Management.ManagementPath path) {
+            this.InitializeObject(null, path, null);
+        }
+        
+        public MigrationJob(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
+            this.InitializeObject(mgmtScope, path, getOptions);
+        }
+        
+        public MigrationJob(System.Management.ManagementObject theObject) {
+            Initialize();
+            if ((CheckIfProperClass(theObject) == true)) {
+                PrivateLateBoundObject = theObject;
+                PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject);
+                curObj = PrivateLateBoundObject;
+            }
+            else {
+                throw new System.ArgumentException("Class name does not match.");
+            }
+        }
+        
+        public MigrationJob(System.Management.ManagementBaseObject theObject) {
+            Initialize();
+            if ((CheckIfProperClass(theObject) == true)) {
+                embeddedObj = theObject;
+                PrivateSystemProperties = new ManagementSystemProperties(theObject);
+                curObj = embeddedObj;
+                isEmbedded = true;
+            }
+            else {
+                throw new System.ArgumentException("Class name does not match.");
+            }
+        }
+        
+        // Property returns the namespace of the WMI class.
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string OriginatingNamespace {
+            get {
+                return "ROOT\\virtualization\\v2";
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string ManagementClassName {
+            get {
+                string strRet = CreatedClassName;
+                if ((curObj != null)) {
+                    if ((curObj.ClassPath != null)) {
+                        strRet = ((string)(curObj["__CLASS"]));
+                        if (((strRet == null) 
+                                    || (strRet == string.Empty))) {
+                            strRet = CreatedClassName;
+                        }
+                    }
+                }
+                return strRet;
+            }
+        }
+        
+        // Property pointing to an embedded object to get System properties of the WMI object.
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public ManagementSystemProperties SystemProperties {
+            get {
+                return PrivateSystemProperties;
+            }
+        }
+        
+        // Property returning the underlying lateBound object.
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public System.Management.ManagementBaseObject LateBoundObject {
+            get {
+                return curObj;
+            }
+        }
+        
+        // ManagementScope of the object.
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public System.Management.ManagementScope Scope {
+            get {
+                if ((isEmbedded == false)) {
+                    return PrivateLateBoundObject.Scope;
+                }
+                else {
+                    return null;
+                }
+            }
+            set {
+                if ((isEmbedded == false)) {
+                    PrivateLateBoundObject.Scope = value;
+                }
+            }
+        }
+        
+        // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property).
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool AutoCommit {
+            get {
+                return AutoCommitProp;
+            }
+            set {
+                AutoCommitProp = value;
+            }
+        }
+        
+        // The ManagementPath of the underlying WMI object.
+        [Browsable(true)]
+        public System.Management.ManagementPath Path {
+            get {
+                if ((isEmbedded == false)) {
+                    return PrivateLateBoundObject.Path;
+                }
+                else {
+                    return null;
+                }
+            }
+            set {
+                if ((isEmbedded == false)) {
+                    if ((CheckIfProperClass(null, value, null) != true)) {
+                        throw new System.ArgumentException("Class name does not match.");
+                    }
+                    PrivateLateBoundObject.Path = value;
+                }
+            }
+        }
+        
+        // Public static scope property which is used by the various methods.
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public static System.Management.ManagementScope StaticScope {
+            get {
+                return statMgmtScope;
+            }
+            set {
+                statMgmtScope = value;
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsCancellableNull {
+            get {
+                if ((curObj["Cancellable"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [Description("Indicates whether the job can be cancelled. The value of this property does not g" +
+            "uarantee that a request to cancel the job will succeed.")]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public bool Cancellable {
+            get {
+                if ((curObj["Cancellable"] == null)) {
+                    return System.Convert.ToBoolean(0);
+                }
+                return ((bool)(curObj["Cancellable"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string Caption {
+            get {
+                return ((string)(curObj["Caption"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsCommunicationStatusNull {
+            get {
+                if ((curObj["CommunicationStatus"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort CommunicationStatus {
+            get {
+                if ((curObj["CommunicationStatus"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["CommunicationStatus"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsDeleteOnCompletionNull {
+            get {
+                if ((curObj["DeleteOnCompletion"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public bool DeleteOnCompletion {
+            get {
+                if ((curObj["DeleteOnCompletion"] == null)) {
+                    return System.Convert.ToBoolean(0);
+                }
+                return ((bool)(curObj["DeleteOnCompletion"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string Description {
+            get {
+                return ((string)(curObj["Description"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [Description("Hostname the destination virtualization platform where the virtual system is migr" +
+            "ating. It will be NULL for storage migration.")]
+        public string DestinationHost {
+            get {
+                return ((string)(curObj["DestinationHost"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsDetailedStatusNull {
+            get {
+                if ((curObj["DetailedStatus"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort DetailedStatus {
+            get {
+                if ((curObj["DetailedStatus"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["DetailedStatus"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsElapsedTimeNull {
+            get {
+                if ((curObj["ElapsedTime"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public System.DateTime ElapsedTime {
+            get {
+                if ((curObj["ElapsedTime"] != null)) {
+                    return ToDateTime(((string)(curObj["ElapsedTime"])));
+                }
+                else {
+                    return System.DateTime.MinValue;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string ElementName {
+            get {
+                return ((string)(curObj["ElementName"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsErrorCodeNull {
+            get {
+                if ((curObj["ErrorCode"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort ErrorCode {
+            get {
+                if ((curObj["ErrorCode"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["ErrorCode"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string ErrorDescription {
+            get {
+                return ((string)(curObj["ErrorDescription"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string ErrorSummaryDescription {
+            get {
+                return ((string)(curObj["ErrorSummaryDescription"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsHealthStateNull {
+            get {
+                if ((curObj["HealthState"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort HealthState {
+            get {
+                if ((curObj["HealthState"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["HealthState"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsInstallDateNull {
+            get {
+                if ((curObj["InstallDate"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public System.DateTime InstallDate {
+            get {
+                if ((curObj["InstallDate"] != null)) {
+                    return ToDateTime(((string)(curObj["InstallDate"])));
+                }
+                else {
+                    return System.DateTime.MinValue;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string InstanceID {
+            get {
+                return ((string)(curObj["InstanceID"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsJobRunTimesNull {
+            get {
+                if ((curObj["JobRunTimes"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public uint JobRunTimes {
+            get {
+                if ((curObj["JobRunTimes"] == null)) {
+                    return System.Convert.ToUInt32(0);
+                }
+                return ((uint)(curObj["JobRunTimes"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsJobStateNull {
+            get {
+                if ((curObj["JobState"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort JobState {
+            get {
+                if ((curObj["JobState"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["JobState"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string JobStatus {
+            get {
+                return ((string)(curObj["JobStatus"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsJobTypeNull {
+            get {
+                if ((curObj["JobType"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [Description("Indicates the type of Job being tracked by this object.")]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public JobTypeValues JobType {
+            get {
+                if ((curObj["JobType"] == null)) {
+                    return ((JobTypeValues)(System.Convert.ToInt32(308)));
+                }
+                return ((JobTypeValues)(System.Convert.ToInt32(curObj["JobType"])));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsLocalOrUtcTimeNull {
+            get {
+                if ((curObj["LocalOrUtcTime"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort LocalOrUtcTime {
+            get {
+                if ((curObj["LocalOrUtcTime"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["LocalOrUtcTime"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsMigrationTypeNull {
+            get {
+                if ((curObj["MigrationType"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [Description("The migration type as defined in Msvm_VirtualSystemMigrationSettingData.Migration" +
+            "Type. This can beused to identify the type of migration the job represents.")]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort MigrationType {
+            get {
+                if ((curObj["MigrationType"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["MigrationType"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string Name {
+            get {
+                return ((string)(curObj["Name"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [Description(@"For Live Migration this must be set to NULL. For Storage Migration, it will specify the virtual machine's virtual hard drives which moved and where they moved. If not NULL, NewResourceSettingData will contain an array of embedded instances of resource allocation setting data (RASD) which represent VHDs. Destination location will be provided using Connection property of RASD.")]
+        public string[] NewResourceSettingData {
+            get {
+                return ((string[])(curObj["NewResourceSettingData"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [Description(@"For Live Migration this will be set to NULL. For Storage Migration, it will indicate the new path for virtual machine data (ExternalDataRoot, SnapshotDataRoot and SwapFileDataRoot).  This being NULL indicates that virtual machine's data roots are not moving.  Otherwise NewSystemSettingData will be instance of Msvm_VirtualSystemGlobalSettingData containing properties ExternalDataRoot, SnapshotDataRoot and SwapFileDataRoot. If not NULL, ExternalDataRoot property will specify new location of virtual machine's current configuration and saved state. If not NULL, SnapshotDataRoot property will specify new location for snapshots data. If not NULL, SwapFileDataRoot property will specify new location of virtual machine's smart paging files ")]
+        public string NewSystemSettingData {
+            get {
+                return ((string)(curObj["NewSystemSettingData"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string Notify {
+            get {
+                return ((string)(curObj["Notify"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsOperatingStatusNull {
+            get {
+                if ((curObj["OperatingStatus"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort OperatingStatus {
+            get {
+                if ((curObj["OperatingStatus"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["OperatingStatus"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public ushort[] OperationalStatus {
+            get {
+                return ((ushort[])(curObj["OperationalStatus"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string OtherRecoveryAction {
+            get {
+                return ((string)(curObj["OtherRecoveryAction"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string Owner {
+            get {
+                return ((string)(curObj["Owner"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsPercentCompleteNull {
+            get {
+                if ((curObj["PercentComplete"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort PercentComplete {
+            get {
+                if ((curObj["PercentComplete"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["PercentComplete"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsPrimaryStatusNull {
+            get {
+                if ((curObj["PrimaryStatus"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort PrimaryStatus {
+            get {
+                if ((curObj["PrimaryStatus"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["PrimaryStatus"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsPriorityNull {
+            get {
+                if ((curObj["Priority"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public uint Priority {
+            get {
+                if ((curObj["Priority"] == null)) {
+                    return System.Convert.ToUInt32(0);
+                }
+                return ((uint)(curObj["Priority"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsRecoveryActionNull {
+            get {
+                if ((curObj["RecoveryAction"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort RecoveryAction {
+            get {
+                if ((curObj["RecoveryAction"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["RecoveryAction"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsRunDayNull {
+            get {
+                if ((curObj["RunDay"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public sbyte RunDay {
+            get {
+                if ((curObj["RunDay"] == null)) {
+                    return System.Convert.ToSByte(0);
+                }
+                return ((sbyte)(curObj["RunDay"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsRunDayOfWeekNull {
+            get {
+                if ((curObj["RunDayOfWeek"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public sbyte RunDayOfWeek {
+            get {
+                if ((curObj["RunDayOfWeek"] == null)) {
+                    return System.Convert.ToSByte(0);
+                }
+                return ((sbyte)(curObj["RunDayOfWeek"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsRunMonthNull {
+            get {
+                if ((curObj["RunMonth"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public byte RunMonth {
+            get {
+                if ((curObj["RunMonth"] == null)) {
+                    return System.Convert.ToByte(0);
+                }
+                return ((byte)(curObj["RunMonth"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsRunStartIntervalNull {
+            get {
+                if ((curObj["RunStartInterval"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public System.DateTime RunStartInterval {
+            get {
+                if ((curObj["RunStartInterval"] != null)) {
+                    return ToDateTime(((string)(curObj["RunStartInterval"])));
+                }
+                else {
+                    return System.DateTime.MinValue;
+                }
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsScheduledStartTimeNull {
+            get {
+                if ((curObj["ScheduledStartTime"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public System.DateTime ScheduledStartTime {
+            get {
+                if ((curObj["ScheduledStartTime"] != null)) {
+                    return ToDateTime(((string)(curObj["ScheduledStartTime"])));
+                }
+                else {
+                    return System.DateTime.MinValue;
+                }
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsStartTimeNull {
+            get {
+                if ((curObj["StartTime"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public System.DateTime StartTime {
+            get {
+                if ((curObj["StartTime"] != null)) {
+                    return ToDateTime(((string)(curObj["StartTime"])));
+                }
+                else {
+                    return System.DateTime.MinValue;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string Status {
+            get {
+                return ((string)(curObj["Status"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string[] StatusDescriptions {
+            get {
+                return ((string[])(curObj["StatusDescriptions"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsTimeBeforeRemovalNull {
+            get {
+                if ((curObj["TimeBeforeRemoval"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public System.DateTime TimeBeforeRemoval {
+            get {
+                if ((curObj["TimeBeforeRemoval"] != null)) {
+                    return ToDateTime(((string)(curObj["TimeBeforeRemoval"])));
+                }
+                else {
+                    return System.DateTime.MinValue;
+                }
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsTimeOfLastStateChangeNull {
+            get {
+                if ((curObj["TimeOfLastStateChange"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public System.DateTime TimeOfLastStateChange {
+            get {
+                if ((curObj["TimeOfLastStateChange"] != null)) {
+                    return ToDateTime(((string)(curObj["TimeOfLastStateChange"])));
+                }
+                else {
+                    return System.DateTime.MinValue;
+                }
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsTimeSubmittedNull {
+            get {
+                if ((curObj["TimeSubmitted"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public System.DateTime TimeSubmitted {
+            get {
+                if ((curObj["TimeSubmitted"] != null)) {
+                    return ToDateTime(((string)(curObj["TimeSubmitted"])));
+                }
+                else {
+                    return System.DateTime.MinValue;
+                }
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsUntilTimeNull {
+            get {
+                if ((curObj["UntilTime"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public System.DateTime UntilTime {
+            get {
+                if ((curObj["UntilTime"] != null)) {
+                    return ToDateTime(((string)(curObj["UntilTime"])));
+                }
+                else {
+                    return System.DateTime.MinValue;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [Description("GUID of the affected virtual system.")]
+        public string VirtualSystemName {
+            get {
+                return ((string)(curObj["VirtualSystemName"]));
+            }
+        }
+        
+        private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) {
+            if (((path != null) 
+                        && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
+                return true;
+            }
+            else {
+                return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam));
+            }
+        }
+        
+        private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) {
+            if (((theObj != null) 
+                        && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
+                return true;
+            }
+            else {
+                System.Array parentClasses = ((System.Array)(theObj["__DERIVATION"]));
+                if ((parentClasses != null)) {
+                    int count = 0;
+                    for (count = 0; (count < parentClasses.Length); count = (count + 1)) {
+                        if ((string.Compare(((string)(parentClasses.GetValue(count))), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0)) {
+                            return true;
+                        }
+                    }
+                }
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeCancellable() {
+            if ((this.IsCancellableNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeCommunicationStatus() {
+            if ((this.IsCommunicationStatusNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeDeleteOnCompletion() {
+            if ((this.IsDeleteOnCompletionNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeDetailedStatus() {
+            if ((this.IsDetailedStatusNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        // Converts a given datetime in DMTF format to System.DateTime object.
+        static System.DateTime ToDateTime(string dmtfDate) {
+            System.DateTime initializer = System.DateTime.MinValue;
+            int year = initializer.Year;
+            int month = initializer.Month;
+            int day = initializer.Day;
+            int hour = initializer.Hour;
+            int minute = initializer.Minute;
+            int second = initializer.Second;
+            long ticks = 0;
+            string dmtf = dmtfDate;
+            System.DateTime datetime = System.DateTime.MinValue;
+            string tempString = string.Empty;
+            if ((dmtf == null)) {
+                throw new System.ArgumentOutOfRangeException();
+            }
+            if ((dmtf.Length == 0)) {
+                throw new System.ArgumentOutOfRangeException();
+            }
+            if ((dmtf.Length != 25)) {
+                throw new System.ArgumentOutOfRangeException();
+            }
+            try {
+                tempString = dmtf.Substring(0, 4);
+                if (("****" != tempString)) {
+                    year = int.Parse(tempString);
+                }
+                tempString = dmtf.Substring(4, 2);
+                if (("**" != tempString)) {
+                    month = int.Parse(tempString);
+                }
+                tempString = dmtf.Substring(6, 2);
+                if (("**" != tempString)) {
+                    day = int.Parse(tempString);
+                }
+                tempString = dmtf.Substring(8, 2);
+                if (("**" != tempString)) {
+                    hour = int.Parse(tempString);
+                }
+                tempString = dmtf.Substring(10, 2);
+                if (("**" != tempString)) {
+                    minute = int.Parse(tempString);
+                }
+                tempString = dmtf.Substring(12, 2);
+                if (("**" != tempString)) {
+                    second = int.Parse(tempString);
+                }
+                tempString = dmtf.Substring(15, 6);
+                if (("******" != tempString)) {
+                    ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000))));
+                }
+                if (((((((((year < 0) 
+                            || (month < 0)) 
+                            || (day < 0)) 
+                            || (hour < 0)) 
+                            || (minute < 0)) 
+                            || (minute < 0)) 
+                            || (second < 0)) 
+                            || (ticks < 0))) {
+                    throw new System.ArgumentOutOfRangeException();
+                }
+            }
+            catch (System.Exception e) {
+                throw new System.ArgumentOutOfRangeException(null, e.Message);
+            }
+            datetime = new System.DateTime(year, month, day, hour, minute, second, 0);
+            datetime = datetime.AddTicks(ticks);
+            System.TimeSpan tickOffset = System.TimeZone.CurrentTimeZone.GetUtcOffset(datetime);
+            int UTCOffset = 0;
+            int OffsetToBeAdjusted = 0;
+            long OffsetMins = ((long)((tickOffset.Ticks / System.TimeSpan.TicksPerMinute)));
+            tempString = dmtf.Substring(22, 3);
+            if ((tempString != "******")) {
+                tempString = dmtf.Substring(21, 4);
+                try {
+                    UTCOffset = int.Parse(tempString);
+                }
+                catch (System.Exception e) {
+                    throw new System.ArgumentOutOfRangeException(null, e.Message);
+                }
+                OffsetToBeAdjusted = ((int)((OffsetMins - UTCOffset)));
+                datetime = datetime.AddMinutes(((double)(OffsetToBeAdjusted)));
+            }
+            return datetime;
+        }
+        
+        // Converts a given System.DateTime object to DMTF datetime format.
+        static string ToDmtfDateTime(System.DateTime date) {
+            string utcString = string.Empty;
+            System.TimeSpan tickOffset = System.TimeZone.CurrentTimeZone.GetUtcOffset(date);
+            long OffsetMins = ((long)((tickOffset.Ticks / System.TimeSpan.TicksPerMinute)));
+            if ((System.Math.Abs(OffsetMins) > 999)) {
+                date = date.ToUniversalTime();
+                utcString = "+000";
+            }
+            else {
+                if ((tickOffset.Ticks >= 0)) {
+                    utcString = string.Concat("+", ((long)((tickOffset.Ticks / System.TimeSpan.TicksPerMinute))).ToString().PadLeft(3, '0'));
+                }
+                else {
+                    string strTemp = ((long)(OffsetMins)).ToString();
+                    utcString = string.Concat("-", strTemp.Substring(1, (strTemp.Length - 1)).PadLeft(3, '0'));
+                }
+            }
+            string dmtfDateTime = ((int)(date.Year)).ToString().PadLeft(4, '0');
+            dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Month)).ToString().PadLeft(2, '0'));
+            dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Day)).ToString().PadLeft(2, '0'));
+            dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Hour)).ToString().PadLeft(2, '0'));
+            dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Minute)).ToString().PadLeft(2, '0'));
+            dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0'));
+            dmtfDateTime = string.Concat(dmtfDateTime, ".");
+            System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0);
+            long microsec = ((long)((((date.Ticks - dtTemp.Ticks) 
+                        * 1000) 
+                        / System.TimeSpan.TicksPerMillisecond)));
+            string strMicrosec = ((long)(microsec)).ToString();
+            if ((strMicrosec.Length > 6)) {
+                strMicrosec = strMicrosec.Substring(0, 6);
+            }
+            dmtfDateTime = string.Concat(dmtfDateTime, strMicrosec.PadLeft(6, '0'));
+            dmtfDateTime = string.Concat(dmtfDateTime, utcString);
+            return dmtfDateTime;
+        }
+        
+        private bool ShouldSerializeElapsedTime() {
+            if ((this.IsElapsedTimeNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeErrorCode() {
+            if ((this.IsErrorCodeNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeHealthState() {
+            if ((this.IsHealthStateNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeInstallDate() {
+            if ((this.IsInstallDateNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeJobRunTimes() {
+            if ((this.IsJobRunTimesNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeJobState() {
+            if ((this.IsJobStateNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeJobType() {
+            if ((this.IsJobTypeNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeLocalOrUtcTime() {
+            if ((this.IsLocalOrUtcTimeNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeMigrationType() {
+            if ((this.IsMigrationTypeNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeOperatingStatus() {
+            if ((this.IsOperatingStatusNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializePercentComplete() {
+            if ((this.IsPercentCompleteNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializePrimaryStatus() {
+            if ((this.IsPrimaryStatusNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializePriority() {
+            if ((this.IsPriorityNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeRecoveryAction() {
+            if ((this.IsRecoveryActionNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeRunDay() {
+            if ((this.IsRunDayNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeRunDayOfWeek() {
+            if ((this.IsRunDayOfWeekNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeRunMonth() {
+            if ((this.IsRunMonthNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeRunStartInterval() {
+            if ((this.IsRunStartIntervalNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeScheduledStartTime() {
+            if ((this.IsScheduledStartTimeNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeStartTime() {
+            if ((this.IsStartTimeNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeTimeBeforeRemoval() {
+            if ((this.IsTimeBeforeRemovalNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeTimeOfLastStateChange() {
+            if ((this.IsTimeOfLastStateChangeNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeTimeSubmitted() {
+            if ((this.IsTimeSubmittedNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeUntilTime() {
+            if ((this.IsUntilTimeNull == 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_MigrationJob";
+            strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\""))));
+            return strPath;
+        }
+        
+        private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
+            Initialize();
+            if ((path != null)) {
+                if ((CheckIfProperClass(mgmtScope, path, getOptions) != true)) {
+                    throw new System.ArgumentException("Class name does not match.");
+                }
+            }
+            PrivateLateBoundObject = new System.Management.ManagementObject(mgmtScope, path, getOptions);
+            PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject);
+            curObj = PrivateLateBoundObject;
+        }
+        
+        // Different overloads of GetInstances() help in enumerating instances of the WMI class.
+        public static MigrationJobCollection GetInstances() {
+            return GetInstances(null, null, null);
+        }
+        
+        public static MigrationJobCollection GetInstances(string condition) {
+            return GetInstances(null, condition, null);
+        }
+        
+        public static MigrationJobCollection GetInstances(string[] selectedProperties) {
+            return GetInstances(null, null, selectedProperties);
+        }
+        
+        public static MigrationJobCollection GetInstances(string condition, string[] selectedProperties) {
+            return GetInstances(null, condition, selectedProperties);
+        }
+        
+        public static MigrationJobCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
+            if ((mgmtScope == null)) {
+                if ((statMgmtScope == null)) {
+                    mgmtScope = new System.Management.ManagementScope();
+                    mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
+                }
+                else {
+                    mgmtScope = statMgmtScope;
+                }
+            }
+            System.Management.ManagementPath pathObj = new System.Management.ManagementPath();
+            pathObj.ClassName = "Msvm_MigrationJob";
+            pathObj.NamespacePath = "root\\virtualization\\v2";
+            System.Management.ManagementClass clsObject = new System.Management.ManagementClass(mgmtScope, pathObj, null);
+            if ((enumOptions == null)) {
+                enumOptions = new System.Management.EnumerationOptions();
+                enumOptions.EnsureLocatable = true;
+            }
+            return new MigrationJobCollection(clsObject.GetInstances(enumOptions));
+        }
+        
+        public static MigrationJobCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
+            return GetInstances(mgmtScope, condition, null);
+        }
+        
+        public static MigrationJobCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
+            return GetInstances(mgmtScope, null, selectedProperties);
+        }
+        
+        public static MigrationJobCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
+            if ((mgmtScope == null)) {
+                if ((statMgmtScope == null)) {
+                    mgmtScope = new System.Management.ManagementScope();
+                    mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
+                }
+                else {
+                    mgmtScope = statMgmtScope;
+                }
+            }
+            System.Management.ManagementObjectSearcher ObjectSearcher = new System.Management.ManagementObjectSearcher(mgmtScope, new SelectQuery("Msvm_MigrationJob", condition, selectedProperties));
+            System.Management.EnumerationOptions enumOptions = new System.Management.EnumerationOptions();
+            enumOptions.EnsureLocatable = true;
+            ObjectSearcher.Options = enumOptions;
+            return new MigrationJobCollection(ObjectSearcher.Get());
+        }
+        
+        [Browsable(true)]
+        public static MigrationJob CreateInstance() {
+            System.Management.ManagementScope mgmtScope = null;
+            if ((statMgmtScope == null)) {
+                mgmtScope = new System.Management.ManagementScope();
+                mgmtScope.Path.NamespacePath = CreatedWmiNamespace;
+            }
+            else {
+                mgmtScope = statMgmtScope;
+            }
+            System.Management.ManagementPath mgmtPath = new System.Management.ManagementPath(CreatedClassName);
+            System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null);
+            return new MigrationJob(tmpMgmtClass.CreateInstance());
+        }
+        
+        [Browsable(true)]
+        public void Delete() {
+            PrivateLateBoundObject.Delete();
+        }
+        
+        public uint GetError(out string Error) {
+            if ((isEmbedded == false)) {
+                System.Management.ManagementBaseObject inParams = null;
+                System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("GetError", inParams, null);
+                Error = System.Convert.ToString(outParams.Properties["Error"].Value);
+                return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
+            }
+            else {
+                Error = null;
+                return System.Convert.ToUInt32(0);
+            }
+        }
+        
+        public uint GetErrorEx(out string[] Errors) {
+            if ((isEmbedded == false)) {
+                System.Management.ManagementBaseObject inParams = null;
+                System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("GetErrorEx", inParams, null);
+                Errors = ((string[])(outParams.Properties["Errors"].Value));
+                return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
+            }
+            else {
+                Errors = null;
+                return System.Convert.ToUInt32(0);
+            }
+        }
+        
+        public uint KillJob(bool DeleteOnKill) {
+            if ((isEmbedded == false)) {
+                System.Management.ManagementBaseObject inParams = null;
+                inParams = PrivateLateBoundObject.GetMethodParameters("KillJob");
+                inParams["DeleteOnKill"] = ((bool)(DeleteOnKill));
+                System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("KillJob", inParams, null);
+                return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
+            }
+            else {
+                return System.Convert.ToUInt32(0);
+            }
+        }
+        
+        public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod) {
+            if ((isEmbedded == false)) {
+                System.Management.ManagementBaseObject inParams = null;
+                inParams = PrivateLateBoundObject.GetMethodParameters("RequestStateChange");
+                inParams["RequestedState"] = ((ushort)(RequestedState));
+                inParams["TimeoutPeriod"] = ToDmtfDateTime(((System.DateTime)(TimeoutPeriod)));
+                System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("RequestStateChange", inParams, null);
+                return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
+            }
+            else {
+                return System.Convert.ToUInt32(0);
+            }
+        }
+        
+        public enum JobTypeValues {
+            
+            Unknown0 = 0,
+            
+            Creating_Remote_Virtual_Machine = 300,
+            
+            Checking_Virtual_Machine_Compatibility = 301,
+            
+            Checking_Virtual_Machine_and_Storage_Compatibility = 302,
+            
+            Checking_Storage_Compatibility = 303,
+            
+            Checking_Storage_Migration = 304,
+            
+            Moving_Virtual_Machine = 305,
+            
+            Moving_Virtual_Machine_and_Storage = 306,
+            
+            Moving_Storage = 307,
+            
+            NULL_ENUM_VALUE = 308,
+        }
+        
+        // Enumerator implementation for enumerating instances of the class.
+        public class MigrationJobCollection : object, ICollection {
+            
+            private ManagementObjectCollection privColObj;
+            
+            public MigrationJobCollection(ManagementObjectCollection objCollection) {
+                privColObj = objCollection;
+            }
+            
+            public virtual int Count {
+                get {
+                    return privColObj.Count;
+                }
+            }
+            
+            public virtual bool IsSynchronized {
+                get {
+                    return privColObj.IsSynchronized;
+                }
+            }
+            
+            public virtual object SyncRoot {
+                get {
+                    return this;
+                }
+            }
+            
+            public virtual void CopyTo(System.Array array, int index) {
+                privColObj.CopyTo(array, index);
+                int nCtr;
+                for (nCtr = 0; (nCtr < array.Length); nCtr = (nCtr + 1)) {
+                    array.SetValue(new MigrationJob(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
+                }
+            }
+            
+            public virtual System.Collections.IEnumerator GetEnumerator() {
+                return new MigrationJobEnumerator(privColObj.GetEnumerator());
+            }
+            
+            public class MigrationJobEnumerator : object, System.Collections.IEnumerator {
+                
+                private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum;
+                
+                public MigrationJobEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
+                    privObjEnum = objEnum;
+                }
+                
+                public virtual object Current {
+                    get {
+                        return new MigrationJob(((System.Management.ManagementObject)(privObjEnum.Current)));
+                    }
+                }
+                
+                public virtual bool MoveNext() {
+                    return privObjEnum.MoveNext();
+                }
+                
+                public virtual void Reset() {
+                    privObjEnum.Reset();
+                }
+            }
+        }
+        
+        // TypeConverter to handle null values for ValueType properties
+        public class WMIValueTypeConverter : TypeConverter {
+            
+            private TypeConverter baseConverter;
+            
+            private System.Type baseType;
+            
+            public WMIValueTypeConverter(System.Type inBaseType) {
+                baseConverter = TypeDescriptor.GetConverter(inBaseType);
+                baseType = inBaseType;
+            }
+            
+            public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Type srcType) {
+                return baseConverter.CanConvertFrom(context, srcType);
+            }
+            
+            public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Type destinationType) {
+                return baseConverter.CanConvertTo(context, destinationType);
+            }
+            
+            public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) {
+                return baseConverter.ConvertFrom(context, culture, value);
+            }
+            
+            public override object CreateInstance(System.ComponentModel.ITypeDescriptorContext context, System.Collections.IDictionary dictionary) {
+                return baseConverter.CreateInstance(context, dictionary);
+            }
+            
+            public override bool GetCreateInstanceSupported(System.ComponentModel.ITypeDescriptorContext context) {
+                return baseConverter.GetCreateInstanceSupported(context);
+            }
+            
+            public override PropertyDescriptorCollection GetProperties(System.ComponentModel.ITypeDescriptorContext context, object value, System.Attribute[] attributeVar) {
+                return baseConverter.GetProperties(context, value, attributeVar);
+            }
+            
+            public override bool GetPropertiesSupported(System.ComponentModel.ITypeDescriptorContext context) {
+                return baseConverter.GetPropertiesSupported(context);
+            }
+            
+            public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context) {
+                return baseConverter.GetStandardValues(context);
+            }
+            
+            public override bool GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext context) {
+                return baseConverter.GetStandardValuesExclusive(context);
+            }
+            
+            public override bool GetStandardValuesSupported(System.ComponentModel.ITypeDescriptorContext context) {
+                return baseConverter.GetStandardValuesSupported(context);
+            }
+            
+            public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType) {
+                if ((baseType.BaseType == typeof(System.Enum))) {
+                    if ((value.GetType() == destinationType)) {
+                        return value;
+                    }
+                    if ((((value == null) 
+                                && (context != null)) 
+                                && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
+                        return  "NULL_ENUM_VALUE" ;
+                    }
+                    return baseConverter.ConvertTo(context, culture, value, destinationType);
+                }
+                if (((baseType == typeof(bool)) 
+                            && (baseType.BaseType == typeof(System.ValueType)))) {
+                    if ((((value == null) 
+                                && (context != null)) 
+                                && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
+                        return "";
+                    }
+                    return baseConverter.ConvertTo(context, culture, value, destinationType);
+                }
+                if (((context != null) 
+                            && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
+                    return "";
+                }
+                return baseConverter.ConvertTo(context, culture, value, destinationType);
+            }
+        }
+        
+        // Embedded class to represent WMI system Properties.
+        [TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))]
+        public class ManagementSystemProperties {
+            
+            private System.Management.ManagementBaseObject PrivateLateBoundObject;
+            
+            public ManagementSystemProperties(System.Management.ManagementBaseObject ManagedObject) {
+                PrivateLateBoundObject = ManagedObject;
+            }
+            
+            [Browsable(true)]
+            public int GENUS {
+                get {
+                    return ((int)(PrivateLateBoundObject["__GENUS"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string CLASS {
+                get {
+                    return ((string)(PrivateLateBoundObject["__CLASS"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string SUPERCLASS {
+                get {
+                    return ((string)(PrivateLateBoundObject["__SUPERCLASS"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string DYNASTY {
+                get {
+                    return ((string)(PrivateLateBoundObject["__DYNASTY"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string RELPATH {
+                get {
+                    return ((string)(PrivateLateBoundObject["__RELPATH"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public int PROPERTY_COUNT {
+                get {
+                    return ((int)(PrivateLateBoundObject["__PROPERTY_COUNT"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string[] DERIVATION {
+                get {
+                    return ((string[])(PrivateLateBoundObject["__DERIVATION"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string SERVER {
+                get {
+                    return ((string)(PrivateLateBoundObject["__SERVER"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string NAMESPACE {
+                get {
+                    return ((string)(PrivateLateBoundObject["__NAMESPACE"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string PATH {
+                get {
+                    return ((string)(PrivateLateBoundObject["__PATH"]));
+                }
+            }
+        }
+    }
+}


[4/4] git commit: updated refs/heads/master to d26b9ac

Posted by de...@apache.org.
Fix for live migration of vm. Use the host name as the migration
destination. Also mapped the vm state corrected in check vm on host
answer.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d26b9ac0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d26b9ac0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d26b9ac0

Branch: refs/heads/master
Commit: d26b9ac00e1486dd7ec68e6f2ef03777f007a344
Parents: 5a96307
Author: Devdeep Singh <de...@gmail.com>
Authored: Wed Dec 4 02:27:27 2013 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Wed Dec 4 10:31:02 2013 +0530

----------------------------------------------------------------------
 .../HypervResource/HypervResourceController.cs               | 2 +-
 .../DotNet/ServerResource/HypervResource/WmiCallsV2.cs       | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d26b9ac0/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
index fc4dea5..915816d 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
@@ -738,7 +738,7 @@ namespace HypervResource
                 }
                 else
                 {
-                    state = EnabledState.ToString(sys.EnabledState); // TODO: V2 changes?
+                    state = EnabledState.ToCloudStackState(sys.EnabledState); // TODO: V2 changes?
                     result = true;
                 }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d26b9ac0/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
index c020168..c69ec38 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
@@ -890,13 +890,17 @@ namespace HypervResource
             VirtualSystemMigrationSettingData migrationSettingData = VirtualSystemMigrationSettingData.CreateInstance();
             VirtualSystemMigrationService service = GetVirtualisationSystemMigrationService();
 
+            IPAddress addr = IPAddress.Parse(destination);
+            IPHostEntry entry = Dns.GetHostEntry(addr);
+            string[] destinationHost = new string[] { destination };
+
             migrationSettingData.LateBoundObject["MigrationType"] = MigrationType.VirtualSystem;
             migrationSettingData.LateBoundObject["TransportType"] = TransportType.TCP;
+            migrationSettingData.LateBoundObject["DestinationIPAddressList"] = destinationHost;
             string migrationSettings = migrationSettingData.LateBoundObject.GetText(System.Management.TextFormat.CimDtd20);
 
             ManagementPath jobPath;
-            string destinationHost = "band-cloud153.blr.cloudstack.org";
-            var ret_val = service.MigrateVirtualSystemToHost(vm.Path, destinationHost, migrationSettings, null, null, out jobPath);
+            var ret_val = service.MigrateVirtualSystemToHost(vm.Path, entry.HostName, migrationSettings, null, null, out jobPath);
             if (ret_val == ReturnCode.Started)
             {
                 MigrationJobCompleted(jobPath);


[2/4] Changes for allowing migration of a vm on hyperv. Migration was blocked in cloudstack for hyperv. Enabled it. Also updated the agent code to allow hyperv migration.

Posted by de...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a96307f/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemMigrationService.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemMigrationService.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemMigrationService.cs
new file mode 100644
index 0000000..89592b1
--- /dev/null
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemMigrationService.cs
@@ -0,0 +1,1581 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 {
+    using System;
+    using System.ComponentModel;
+    using System.Management;
+    using System.Collections;
+    using System.Globalization;
+    using System.ComponentModel.Design.Serialization;
+    using System.Reflection;
+    
+    
+    // Functions ShouldSerialize<PropertyName> are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use Is<PropertyName>Null function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio.
+    // Functions Is<PropertyName>Null() are used to check if a property is NULL.
+    // Functions Reset<PropertyName> are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL.
+    // Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used.
+    // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa.
+    // An Early Bound class generated for the WMI class.Msvm_VirtualSystemMigrationService
+    public class VirtualSystemMigrationService : 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_VirtualSystemMigrationService";
+        
+        // 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 VirtualSystemMigrationService() {
+            this.InitializeObject(null, null, null);
+        }
+        
+        public VirtualSystemMigrationService(string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) {
+            this.InitializeObject(null, new System.Management.ManagementPath(VirtualSystemMigrationService.ConstructPath(keyCreationClassName, keyName, keySystemCreationClassName, keySystemName)), null);
+        }
+        
+        public VirtualSystemMigrationService(System.Management.ManagementScope mgmtScope, string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) {
+            this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(VirtualSystemMigrationService.ConstructPath(keyCreationClassName, keyName, keySystemCreationClassName, keySystemName)), null);
+        }
+        
+        public VirtualSystemMigrationService(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
+            this.InitializeObject(null, path, getOptions);
+        }
+        
+        public VirtualSystemMigrationService(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) {
+            this.InitializeObject(mgmtScope, path, null);
+        }
+        
+        public VirtualSystemMigrationService(System.Management.ManagementPath path) {
+            this.InitializeObject(null, path, null);
+        }
+        
+        public VirtualSystemMigrationService(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
+            this.InitializeObject(mgmtScope, path, getOptions);
+        }
+        
+        public VirtualSystemMigrationService(System.Management.ManagementObject theObject) {
+            Initialize();
+            if ((CheckIfProperClass(theObject) == true)) {
+                PrivateLateBoundObject = theObject;
+                PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject);
+                curObj = PrivateLateBoundObject;
+            }
+            else {
+                throw new System.ArgumentException("Class name does not match.");
+            }
+        }
+        
+        public VirtualSystemMigrationService(System.Management.ManagementBaseObject theObject) {
+            Initialize();
+            if ((CheckIfProperClass(theObject) == true)) {
+                embeddedObj = theObject;
+                PrivateSystemProperties = new ManagementSystemProperties(theObject);
+                curObj = embeddedObj;
+                isEmbedded = true;
+            }
+            else {
+                throw new System.ArgumentException("Class name does not match.");
+            }
+        }
+        
+        // Property returns the namespace of the WMI class.
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string OriginatingNamespace {
+            get {
+                return "ROOT\\virtualization\\v2";
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string ManagementClassName {
+            get {
+                string strRet = CreatedClassName;
+                if ((curObj != null)) {
+                    if ((curObj.ClassPath != null)) {
+                        strRet = ((string)(curObj["__CLASS"]));
+                        if (((strRet == null) 
+                                    || (strRet == string.Empty))) {
+                            strRet = CreatedClassName;
+                        }
+                    }
+                }
+                return strRet;
+            }
+        }
+        
+        // Property pointing to an embedded object to get System properties of the WMI object.
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public ManagementSystemProperties SystemProperties {
+            get {
+                return PrivateSystemProperties;
+            }
+        }
+        
+        // Property returning the underlying lateBound object.
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public System.Management.ManagementBaseObject LateBoundObject {
+            get {
+                return curObj;
+            }
+        }
+        
+        // ManagementScope of the object.
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public System.Management.ManagementScope Scope {
+            get {
+                if ((isEmbedded == false)) {
+                    return PrivateLateBoundObject.Scope;
+                }
+                else {
+                    return null;
+                }
+            }
+            set {
+                if ((isEmbedded == false)) {
+                    PrivateLateBoundObject.Scope = value;
+                }
+            }
+        }
+        
+        // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property).
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool AutoCommit {
+            get {
+                return AutoCommitProp;
+            }
+            set {
+                AutoCommitProp = value;
+            }
+        }
+        
+        // The ManagementPath of the underlying WMI object.
+        [Browsable(true)]
+        public System.Management.ManagementPath Path {
+            get {
+                if ((isEmbedded == false)) {
+                    return PrivateLateBoundObject.Path;
+                }
+                else {
+                    return null;
+                }
+            }
+            set {
+                if ((isEmbedded == false)) {
+                    if ((CheckIfProperClass(null, value, null) != true)) {
+                        throw new System.ArgumentException("Class name does not match.");
+                    }
+                    PrivateLateBoundObject.Path = value;
+                }
+            }
+        }
+        
+        // Public static scope property which is used by the various methods.
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public static System.Management.ManagementScope StaticScope {
+            get {
+                return statMgmtScope;
+            }
+            set {
+                statMgmtScope = value;
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsActiveStorageMigrationCountNull {
+            get {
+                if ((curObj["ActiveStorageMigrationCount"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [Description("The number of currently in-flight storage migrations.")]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public uint ActiveStorageMigrationCount {
+            get {
+                if ((curObj["ActiveStorageMigrationCount"] == null)) {
+                    return System.Convert.ToUInt32(0);
+                }
+                return ((uint)(curObj["ActiveStorageMigrationCount"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsActiveVirtualSystemMigrationCountNull {
+            get {
+                if ((curObj["ActiveVirtualSystemMigrationCount"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [Description("The number of currently in-flight virtual system migrations.")]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public uint ActiveVirtualSystemMigrationCount {
+            get {
+                if ((curObj["ActiveVirtualSystemMigrationCount"] == null)) {
+                    return System.Convert.ToUInt32(0);
+                }
+                return ((uint)(curObj["ActiveVirtualSystemMigrationCount"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public ushort[] AvailableRequestedStates {
+            get {
+                return ((ushort[])(curObj["AvailableRequestedStates"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string Caption {
+            get {
+                return ((string)(curObj["Caption"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsCommunicationStatusNull {
+            get {
+                if ((curObj["CommunicationStatus"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort CommunicationStatus {
+            get {
+                if ((curObj["CommunicationStatus"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["CommunicationStatus"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string CreationClassName {
+            get {
+                return ((string)(curObj["CreationClassName"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string Description {
+            get {
+                return ((string)(curObj["Description"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsDetailedStatusNull {
+            get {
+                if ((curObj["DetailedStatus"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort DetailedStatus {
+            get {
+                if ((curObj["DetailedStatus"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["DetailedStatus"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string ElementName {
+            get {
+                return ((string)(curObj["ElementName"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsEnabledDefaultNull {
+            get {
+                if ((curObj["EnabledDefault"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort EnabledDefault {
+            get {
+                if ((curObj["EnabledDefault"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["EnabledDefault"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsEnabledStateNull {
+            get {
+                if ((curObj["EnabledState"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort EnabledState {
+            get {
+                if ((curObj["EnabledState"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["EnabledState"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsHealthStateNull {
+            get {
+                if ((curObj["HealthState"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort HealthState {
+            get {
+                if ((curObj["HealthState"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["HealthState"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsInstallDateNull {
+            get {
+                if ((curObj["InstallDate"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public System.DateTime InstallDate {
+            get {
+                if ((curObj["InstallDate"] != null)) {
+                    return ToDateTime(((string)(curObj["InstallDate"])));
+                }
+                else {
+                    return System.DateTime.MinValue;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string InstanceID {
+            get {
+                return ((string)(curObj["InstanceID"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [Description("The list of IP addresses of the host, which  can be used for virtual system migra" +
+            "tion.")]
+        public string[] MigrationServiceListenerIPAddressList {
+            get {
+                return ((string[])(curObj["MigrationServiceListenerIPAddressList"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string Name {
+            get {
+                return ((string)(curObj["Name"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsOperatingStatusNull {
+            get {
+                if ((curObj["OperatingStatus"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort OperatingStatus {
+            get {
+                if ((curObj["OperatingStatus"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["OperatingStatus"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public ushort[] OperationalStatus {
+            get {
+                return ((ushort[])(curObj["OperationalStatus"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string OtherEnabledState {
+            get {
+                return ((string)(curObj["OtherEnabledState"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string PrimaryOwnerContact {
+            get {
+                return ((string)(curObj["PrimaryOwnerContact"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string PrimaryOwnerName {
+            get {
+                return ((string)(curObj["PrimaryOwnerName"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsPrimaryStatusNull {
+            get {
+                if ((curObj["PrimaryStatus"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort PrimaryStatus {
+            get {
+                if ((curObj["PrimaryStatus"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["PrimaryStatus"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsRequestedStateNull {
+            get {
+                if ((curObj["RequestedState"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort RequestedState {
+            get {
+                if ((curObj["RequestedState"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["RequestedState"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsStartedNull {
+            get {
+                if ((curObj["Started"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public bool Started {
+            get {
+                if ((curObj["Started"] == null)) {
+                    return System.Convert.ToBoolean(0);
+                }
+                return ((bool)(curObj["Started"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string StartMode {
+            get {
+                return ((string)(curObj["StartMode"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string Status {
+            get {
+                return ((string)(curObj["Status"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string[] StatusDescriptions {
+            get {
+                return ((string[])(curObj["StatusDescriptions"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string SystemCreationClassName {
+            get {
+                return ((string)(curObj["SystemCreationClassName"]));
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public string SystemName {
+            get {
+                return ((string)(curObj["SystemName"]));
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsTimeOfLastStateChangeNull {
+            get {
+                if ((curObj["TimeOfLastStateChange"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public System.DateTime TimeOfLastStateChange {
+            get {
+                if ((curObj["TimeOfLastStateChange"] != null)) {
+                    return ToDateTime(((string)(curObj["TimeOfLastStateChange"])));
+                }
+                else {
+                    return System.DateTime.MinValue;
+                }
+            }
+        }
+        
+        [Browsable(false)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        public bool IsTransitioningToStateNull {
+            get {
+                if ((curObj["TransitioningToState"] == null)) {
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+        }
+        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+        [TypeConverter(typeof(WMIValueTypeConverter))]
+        public ushort TransitioningToState {
+            get {
+                if ((curObj["TransitioningToState"] == null)) {
+                    return System.Convert.ToUInt16(0);
+                }
+                return ((ushort)(curObj["TransitioningToState"]));
+            }
+        }
+        
+        private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) {
+            if (((path != null) 
+                        && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
+                return true;
+            }
+            else {
+                return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam));
+            }
+        }
+        
+        private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) {
+            if (((theObj != null) 
+                        && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) {
+                return true;
+            }
+            else {
+                System.Array parentClasses = ((System.Array)(theObj["__DERIVATION"]));
+                if ((parentClasses != null)) {
+                    int count = 0;
+                    for (count = 0; (count < parentClasses.Length); count = (count + 1)) {
+                        if ((string.Compare(((string)(parentClasses.GetValue(count))), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0)) {
+                            return true;
+                        }
+                    }
+                }
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeActiveStorageMigrationCount() {
+            if ((this.IsActiveStorageMigrationCountNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeActiveVirtualSystemMigrationCount() {
+            if ((this.IsActiveVirtualSystemMigrationCountNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeCommunicationStatus() {
+            if ((this.IsCommunicationStatusNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeDetailedStatus() {
+            if ((this.IsDetailedStatusNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeEnabledDefault() {
+            if ((this.IsEnabledDefaultNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeEnabledState() {
+            if ((this.IsEnabledStateNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeHealthState() {
+            if ((this.IsHealthStateNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        // Converts a given datetime in DMTF format to System.DateTime object.
+        static System.DateTime ToDateTime(string dmtfDate) {
+            System.DateTime initializer = System.DateTime.MinValue;
+            int year = initializer.Year;
+            int month = initializer.Month;
+            int day = initializer.Day;
+            int hour = initializer.Hour;
+            int minute = initializer.Minute;
+            int second = initializer.Second;
+            long ticks = 0;
+            string dmtf = dmtfDate;
+            System.DateTime datetime = System.DateTime.MinValue;
+            string tempString = string.Empty;
+            if ((dmtf == null)) {
+                throw new System.ArgumentOutOfRangeException();
+            }
+            if ((dmtf.Length == 0)) {
+                throw new System.ArgumentOutOfRangeException();
+            }
+            if ((dmtf.Length != 25)) {
+                throw new System.ArgumentOutOfRangeException();
+            }
+            try {
+                tempString = dmtf.Substring(0, 4);
+                if (("****" != tempString)) {
+                    year = int.Parse(tempString);
+                }
+                tempString = dmtf.Substring(4, 2);
+                if (("**" != tempString)) {
+                    month = int.Parse(tempString);
+                }
+                tempString = dmtf.Substring(6, 2);
+                if (("**" != tempString)) {
+                    day = int.Parse(tempString);
+                }
+                tempString = dmtf.Substring(8, 2);
+                if (("**" != tempString)) {
+                    hour = int.Parse(tempString);
+                }
+                tempString = dmtf.Substring(10, 2);
+                if (("**" != tempString)) {
+                    minute = int.Parse(tempString);
+                }
+                tempString = dmtf.Substring(12, 2);
+                if (("**" != tempString)) {
+                    second = int.Parse(tempString);
+                }
+                tempString = dmtf.Substring(15, 6);
+                if (("******" != tempString)) {
+                    ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000))));
+                }
+                if (((((((((year < 0) 
+                            || (month < 0)) 
+                            || (day < 0)) 
+                            || (hour < 0)) 
+                            || (minute < 0)) 
+                            || (minute < 0)) 
+                            || (second < 0)) 
+                            || (ticks < 0))) {
+                    throw new System.ArgumentOutOfRangeException();
+                }
+            }
+            catch (System.Exception e) {
+                throw new System.ArgumentOutOfRangeException(null, e.Message);
+            }
+            datetime = new System.DateTime(year, month, day, hour, minute, second, 0);
+            datetime = datetime.AddTicks(ticks);
+            System.TimeSpan tickOffset = System.TimeZone.CurrentTimeZone.GetUtcOffset(datetime);
+            int UTCOffset = 0;
+            int OffsetToBeAdjusted = 0;
+            long OffsetMins = ((long)((tickOffset.Ticks / System.TimeSpan.TicksPerMinute)));
+            tempString = dmtf.Substring(22, 3);
+            if ((tempString != "******")) {
+                tempString = dmtf.Substring(21, 4);
+                try {
+                    UTCOffset = int.Parse(tempString);
+                }
+                catch (System.Exception e) {
+                    throw new System.ArgumentOutOfRangeException(null, e.Message);
+                }
+                OffsetToBeAdjusted = ((int)((OffsetMins - UTCOffset)));
+                datetime = datetime.AddMinutes(((double)(OffsetToBeAdjusted)));
+            }
+            return datetime;
+        }
+        
+        // Converts a given System.DateTime object to DMTF datetime format.
+        static string ToDmtfDateTime(System.DateTime date) {
+            string utcString = string.Empty;
+            System.TimeSpan tickOffset = System.TimeZone.CurrentTimeZone.GetUtcOffset(date);
+            long OffsetMins = ((long)((tickOffset.Ticks / System.TimeSpan.TicksPerMinute)));
+            if ((System.Math.Abs(OffsetMins) > 999)) {
+                date = date.ToUniversalTime();
+                utcString = "+000";
+            }
+            else {
+                if ((tickOffset.Ticks >= 0)) {
+                    utcString = string.Concat("+", ((long)((tickOffset.Ticks / System.TimeSpan.TicksPerMinute))).ToString().PadLeft(3, '0'));
+                }
+                else {
+                    string strTemp = ((long)(OffsetMins)).ToString();
+                    utcString = string.Concat("-", strTemp.Substring(1, (strTemp.Length - 1)).PadLeft(3, '0'));
+                }
+            }
+            string dmtfDateTime = ((int)(date.Year)).ToString().PadLeft(4, '0');
+            dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Month)).ToString().PadLeft(2, '0'));
+            dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Day)).ToString().PadLeft(2, '0'));
+            dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Hour)).ToString().PadLeft(2, '0'));
+            dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Minute)).ToString().PadLeft(2, '0'));
+            dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0'));
+            dmtfDateTime = string.Concat(dmtfDateTime, ".");
+            System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0);
+            long microsec = ((long)((((date.Ticks - dtTemp.Ticks) 
+                        * 1000) 
+                        / System.TimeSpan.TicksPerMillisecond)));
+            string strMicrosec = ((long)(microsec)).ToString();
+            if ((strMicrosec.Length > 6)) {
+                strMicrosec = strMicrosec.Substring(0, 6);
+            }
+            dmtfDateTime = string.Concat(dmtfDateTime, strMicrosec.PadLeft(6, '0'));
+            dmtfDateTime = string.Concat(dmtfDateTime, utcString);
+            return dmtfDateTime;
+        }
+        
+        private bool ShouldSerializeInstallDate() {
+            if ((this.IsInstallDateNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeOperatingStatus() {
+            if ((this.IsOperatingStatusNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializePrimaryStatus() {
+            if ((this.IsPrimaryStatusNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeRequestedState() {
+            if ((this.IsRequestedStateNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeStarted() {
+            if ((this.IsStartedNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeTimeOfLastStateChange() {
+            if ((this.IsTimeOfLastStateChangeNull == false)) {
+                return true;
+            }
+            return false;
+        }
+        
+        private bool ShouldSerializeTransitioningToState() {
+            if ((this.IsTransitioningToStateNull == 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 keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) {
+            string strPath = "ROOT\\virtualization\\v2:Msvm_VirtualSystemMigrationService";
+            strPath = string.Concat(strPath, string.Concat(".CreationClassName=", string.Concat("\"", string.Concat(keyCreationClassName, "\""))));
+            strPath = string.Concat(strPath, string.Concat(",Name=", string.Concat("\"", string.Concat(keyName, "\""))));
+            strPath = string.Concat(strPath, string.Concat(",SystemCreationClassName=", string.Concat("\"", string.Concat(keySystemCreationClassName, "\""))));
+            strPath = string.Concat(strPath, string.Concat(",SystemName=", string.Concat("\"", string.Concat(keySystemName, "\""))));
+            return strPath;
+        }
+        
+        private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {
+            Initialize();
+            if ((path != null)) {
+                if ((CheckIfProperClass(mgmtScope, path, getOptions) != true)) {
+                    throw new System.ArgumentException("Class name does not match.");
+                }
+            }
+            PrivateLateBoundObject = new System.Management.ManagementObject(mgmtScope, path, getOptions);
+            PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject);
+            curObj = PrivateLateBoundObject;
+        }
+        
+        // Different overloads of GetInstances() help in enumerating instances of the WMI class.
+        public static VirtualSystemMigrationServiceCollection GetInstances() {
+            return GetInstances(null, null, null);
+        }
+        
+        public static VirtualSystemMigrationServiceCollection GetInstances(string condition) {
+            return GetInstances(null, condition, null);
+        }
+        
+        public static VirtualSystemMigrationServiceCollection GetInstances(string[] selectedProperties) {
+            return GetInstances(null, null, selectedProperties);
+        }
+        
+        public static VirtualSystemMigrationServiceCollection GetInstances(string condition, string[] selectedProperties) {
+            return GetInstances(null, condition, selectedProperties);
+        }
+        
+        public static VirtualSystemMigrationServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {
+            if ((mgmtScope == null)) {
+                if ((statMgmtScope == null)) {
+                    mgmtScope = new System.Management.ManagementScope();
+                    mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
+                }
+                else {
+                    mgmtScope = statMgmtScope;
+                }
+            }
+            System.Management.ManagementPath pathObj = new System.Management.ManagementPath();
+            pathObj.ClassName = "Msvm_VirtualSystemMigrationService";
+            pathObj.NamespacePath = "root\\virtualization\\v2";
+            System.Management.ManagementClass clsObject = new System.Management.ManagementClass(mgmtScope, pathObj, null);
+            if ((enumOptions == null)) {
+                enumOptions = new System.Management.EnumerationOptions();
+                enumOptions.EnsureLocatable = true;
+            }
+            return new VirtualSystemMigrationServiceCollection(clsObject.GetInstances(enumOptions));
+        }
+        
+        public static VirtualSystemMigrationServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) {
+            return GetInstances(mgmtScope, condition, null);
+        }
+        
+        public static VirtualSystemMigrationServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) {
+            return GetInstances(mgmtScope, null, selectedProperties);
+        }
+        
+        public static VirtualSystemMigrationServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) {
+            if ((mgmtScope == null)) {
+                if ((statMgmtScope == null)) {
+                    mgmtScope = new System.Management.ManagementScope();
+                    mgmtScope.Path.NamespacePath = "root\\virtualization\\v2";
+                }
+                else {
+                    mgmtScope = statMgmtScope;
+                }
+            }
+            System.Management.ManagementObjectSearcher ObjectSearcher = new System.Management.ManagementObjectSearcher(mgmtScope, new SelectQuery("Msvm_VirtualSystemMigrationService", condition, selectedProperties));
+            System.Management.EnumerationOptions enumOptions = new System.Management.EnumerationOptions();
+            enumOptions.EnsureLocatable = true;
+            ObjectSearcher.Options = enumOptions;
+            return new VirtualSystemMigrationServiceCollection(ObjectSearcher.Get());
+        }
+        
+        [Browsable(true)]
+        public static VirtualSystemMigrationService CreateInstance() {
+            System.Management.ManagementScope mgmtScope = null;
+            if ((statMgmtScope == null)) {
+                mgmtScope = new System.Management.ManagementScope();
+                mgmtScope.Path.NamespacePath = CreatedWmiNamespace;
+            }
+            else {
+                mgmtScope = statMgmtScope;
+            }
+            System.Management.ManagementPath mgmtPath = new System.Management.ManagementPath(CreatedClassName);
+            System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null);
+            return new VirtualSystemMigrationService(tmpMgmtClass.CreateInstance());
+        }
+        
+        [Browsable(true)]
+        public void Delete() {
+            PrivateLateBoundObject.Delete();
+        }
+        
+        public uint AddNetworkSettings(string[] NetworkSettings, out System.Management.ManagementPath Job) {
+            if ((isEmbedded == false)) {
+                System.Management.ManagementBaseObject inParams = null;
+                inParams = PrivateLateBoundObject.GetMethodParameters("AddNetworkSettings");
+                inParams["NetworkSettings"] = ((string[])(NetworkSettings));
+                System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("AddNetworkSettings", inParams, null);
+                Job = null;
+                if ((outParams.Properties["Job"] != null)) {
+                    Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
+                }
+                return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
+            }
+            else {
+                Job = null;
+                return System.Convert.ToUInt32(0);
+            }
+        }
+        
+        public uint CheckSystemCompatibilityInfo(byte[] CompatibilityInfo, out string[] Reasons) {
+            if ((isEmbedded == false)) {
+                System.Management.ManagementBaseObject inParams = null;
+                inParams = PrivateLateBoundObject.GetMethodParameters("CheckSystemCompatibilityInfo");
+                inParams["CompatibilityInfo"] = ((byte[])(CompatibilityInfo));
+                System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("CheckSystemCompatibilityInfo", inParams, null);
+                Reasons = ((string[])(outParams.Properties["Reasons"].Value));
+                return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
+            }
+            else {
+                Reasons = null;
+                return System.Convert.ToUInt32(0);
+            }
+        }
+        
+        public uint CheckVirtualSystemIsMigratable(System.Management.ManagementPath ComputerSystem, string DestinationHost, string MigrationSettingData, string[] NewResourceSettingData, string NewSystemSettingData, out System.Management.ManagementPath Job) {
+            if ((isEmbedded == false)) {
+                System.Management.ManagementBaseObject inParams = null;
+                inParams = PrivateLateBoundObject.GetMethodParameters("CheckVirtualSystemIsMigratable");
+                inParams["ComputerSystem"] = ((System.Management.ManagementPath)(ComputerSystem)).Path;
+                inParams["DestinationHost"] = ((string)(DestinationHost));
+                inParams["MigrationSettingData"] = ((string)(MigrationSettingData));
+                inParams["NewResourceSettingData"] = ((string[])(NewResourceSettingData));
+                inParams["NewSystemSettingData"] = ((string)(NewSystemSettingData));
+                System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("CheckVirtualSystemIsMigratable", inParams, null);
+                Job = null;
+                if ((outParams.Properties["Job"] != null)) {
+                    Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
+                }
+                return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
+            }
+            else {
+                Job = null;
+                return System.Convert.ToUInt32(0);
+            }
+        }
+        
+        public uint CheckVirtualSystemIsMigratableToHost(System.Management.ManagementPath ComputerSystem, string DestinationHost, string MigrationSettingData, string[] NewResourceSettingData, string NewSystemSettingData, out bool IsMigratable) {
+            if ((isEmbedded == false)) {
+                System.Management.ManagementBaseObject inParams = null;
+                inParams = PrivateLateBoundObject.GetMethodParameters("CheckVirtualSystemIsMigratableToHost");
+                inParams["ComputerSystem"] = ((System.Management.ManagementPath)(ComputerSystem)).Path;
+                inParams["DestinationHost"] = ((string)(DestinationHost));
+                inParams["MigrationSettingData"] = ((string)(MigrationSettingData));
+                inParams["NewResourceSettingData"] = ((string[])(NewResourceSettingData));
+                inParams["NewSystemSettingData"] = ((string)(NewSystemSettingData));
+                System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("CheckVirtualSystemIsMigratableToHost", inParams, null);
+                IsMigratable = System.Convert.ToBoolean(outParams.Properties["IsMigratable"].Value);
+                return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
+            }
+            else {
+                IsMigratable = System.Convert.ToBoolean(0);
+                return System.Convert.ToUInt32(0);
+            }
+        }
+        
+        public uint CheckVirtualSystemIsMigratableToSystem(System.Management.ManagementPath ComputerSystem, System.Management.ManagementPath DestinationSystem, string MigrationSettingData, string[] NewResourceSettingData, string NewSystemSettingData, out bool IsMigratable) {
+            if ((isEmbedded == false)) {
+                System.Management.ManagementBaseObject inParams = null;
+                inParams = PrivateLateBoundObject.GetMethodParameters("CheckVirtualSystemIsMigratableToSystem");
+                inParams["ComputerSystem"] = ((System.Management.ManagementPath)(ComputerSystem)).Path;
+                inParams["DestinationSystem"] = ((System.Management.ManagementPath)(DestinationSystem)).Path;
+                inParams["MigrationSettingData"] = ((string)(MigrationSettingData));
+                inParams["NewResourceSettingData"] = ((string[])(NewResourceSettingData));
+                inParams["NewSystemSettingData"] = ((string)(NewSystemSettingData));
+                System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("CheckVirtualSystemIsMigratableToSystem", inParams, null);
+                IsMigratable = System.Convert.ToBoolean(outParams.Properties["IsMigratable"].Value);
+                return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
+            }
+            else {
+                IsMigratable = System.Convert.ToBoolean(0);
+                return System.Convert.ToUInt32(0);
+            }
+        }
+        
+        public uint GetSystemCompatibilityInfo(System.Management.ManagementPath ComputerSystem, out byte[] CompatibilityInfo) {
+            if ((isEmbedded == false)) {
+                System.Management.ManagementBaseObject inParams = null;
+                inParams = PrivateLateBoundObject.GetMethodParameters("GetSystemCompatibilityInfo");
+                inParams["ComputerSystem"] = ((System.Management.ManagementPath)(ComputerSystem)).Path;
+                System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("GetSystemCompatibilityInfo", inParams, null);
+                CompatibilityInfo = ((byte[])(outParams.Properties["CompatibilityInfo"].Value));
+                return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
+            }
+            else {
+                CompatibilityInfo = null;
+                return System.Convert.ToUInt32(0);
+            }
+        }
+        
+        public uint MigrateVirtualSystemToHost(System.Management.ManagementPath ComputerSystem, string DestinationHost, string MigrationSettingData, string[] NewResourceSettingData, string NewSystemSettingData, out System.Management.ManagementPath Job) {
+            if ((isEmbedded == false)) {
+                System.Management.ManagementBaseObject inParams = null;
+                inParams = PrivateLateBoundObject.GetMethodParameters("MigrateVirtualSystemToHost");
+                inParams["ComputerSystem"] = ((System.Management.ManagementPath)(ComputerSystem)).Path;
+                inParams["DestinationHost"] = ((string)(DestinationHost));
+                inParams["MigrationSettingData"] = ((string)(MigrationSettingData));
+                inParams["NewResourceSettingData"] = ((string[])(NewResourceSettingData));
+                inParams["NewSystemSettingData"] = ((string)(NewSystemSettingData));
+                System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("MigrateVirtualSystemToHost", inParams, null);
+                Job = null;
+                if ((outParams.Properties["Job"] != null) && outParams.Properties["Job"].Value != null)
+                {
+                    Job = new System.Management.ManagementPath((string)outParams.Properties["Job"].Value);
+                }
+                return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
+            }
+            else {
+                Job = null;
+                return System.Convert.ToUInt32(0);
+            }
+        }
+        
+        public uint MigrateVirtualSystemToSystem(System.Management.ManagementPath ComputerSystem, System.Management.ManagementPath DestinationSystem, string MigrationSettingData, string[] NewResourceSettingData, string NewSystemSettingData, out System.Management.ManagementPath Job, out System.Management.ManagementPath NewComputerSystem) {
+            if ((isEmbedded == false)) {
+                System.Management.ManagementBaseObject inParams = null;
+                inParams = PrivateLateBoundObject.GetMethodParameters("MigrateVirtualSystemToSystem");
+                inParams["ComputerSystem"] = ((System.Management.ManagementPath)(ComputerSystem)).Path;
+                inParams["DestinationSystem"] = ((System.Management.ManagementPath)(DestinationSystem)).Path;
+                inParams["MigrationSettingData"] = ((string)(MigrationSettingData));
+                inParams["NewResourceSettingData"] = ((string[])(NewResourceSettingData));
+                inParams["NewSystemSettingData"] = ((string)(NewSystemSettingData));
+                System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("MigrateVirtualSystemToSystem", inParams, null);
+                Job = null;
+                if ((outParams.Properties["Job"] != null)) {
+                    Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
+                }
+                NewComputerSystem = null;
+                if ((outParams.Properties["NewComputerSystem"] != null)) {
+                    NewComputerSystem = new System.Management.ManagementPath(outParams.Properties["NewComputerSystem"].ToString());
+                }
+                return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
+            }
+            else {
+                Job = null;
+                NewComputerSystem = null;
+                return System.Convert.ToUInt32(0);
+            }
+        }
+        
+        public uint ModifyNetworkSettings(string[] NetworkSettings, out System.Management.ManagementPath Job) {
+            if ((isEmbedded == false)) {
+                System.Management.ManagementBaseObject inParams = null;
+                inParams = PrivateLateBoundObject.GetMethodParameters("ModifyNetworkSettings");
+                inParams["NetworkSettings"] = ((string[])(NetworkSettings));
+                System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("ModifyNetworkSettings", inParams, null);
+                Job = null;
+                if ((outParams.Properties["Job"] != null)) {
+                    Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
+                }
+                return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
+            }
+            else {
+                Job = null;
+                return System.Convert.ToUInt32(0);
+            }
+        }
+        
+        public uint ModifyServiceSettings(string ServiceSettingData, out System.Management.ManagementPath Job) {
+            if ((isEmbedded == false)) {
+                System.Management.ManagementBaseObject inParams = null;
+                inParams = PrivateLateBoundObject.GetMethodParameters("ModifyServiceSettings");
+                inParams["ServiceSettingData"] = ((string)(ServiceSettingData));
+                System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("ModifyServiceSettings", inParams, null);
+                Job = null;
+                if ((outParams.Properties["Job"] != null)) {
+                    Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
+                }
+                return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
+            }
+            else {
+                Job = null;
+                return System.Convert.ToUInt32(0);
+            }
+        }
+        
+        public uint RemoveNetworkSettings(System.Management.ManagementPath[] NetworkSettings, out System.Management.ManagementPath Job) {
+            if ((isEmbedded == false)) {
+                System.Management.ManagementBaseObject inParams = null;
+                inParams = PrivateLateBoundObject.GetMethodParameters("RemoveNetworkSettings");
+                if ((NetworkSettings != null)) {
+                    int len = ((System.Array)(NetworkSettings)).Length;
+                    string[] arrProp = new string[len];
+                    for (int iCounter = 0; (iCounter < len); iCounter = (iCounter + 1)) {
+                        arrProp[iCounter] = ((System.Management.ManagementPath)(((System.Array)(NetworkSettings)).GetValue(iCounter))).Path;
+                    }
+                    inParams["NetworkSettings"] = arrProp;
+                }
+                else {
+                    inParams["NetworkSettings"] = null;
+                }
+                System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("RemoveNetworkSettings", inParams, null);
+                Job = null;
+                if ((outParams.Properties["Job"] != null)) {
+                    Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
+                }
+                return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
+            }
+            else {
+                Job = null;
+                return System.Convert.ToUInt32(0);
+            }
+        }
+        
+        public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod, out System.Management.ManagementPath Job) {
+            if ((isEmbedded == false)) {
+                System.Management.ManagementBaseObject inParams = null;
+                inParams = PrivateLateBoundObject.GetMethodParameters("RequestStateChange");
+                inParams["RequestedState"] = ((ushort)(RequestedState));
+                inParams["TimeoutPeriod"] = ToDmtfDateTime(((System.DateTime)(TimeoutPeriod)));
+                System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("RequestStateChange", inParams, null);
+                Job = null;
+                if ((outParams.Properties["Job"] != null)) {
+                    Job = new System.Management.ManagementPath(outParams.Properties["Job"].ToString());
+                }
+                return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
+            }
+            else {
+                Job = null;
+                return System.Convert.ToUInt32(0);
+            }
+        }
+        
+        public uint StartService() {
+            if ((isEmbedded == false)) {
+                System.Management.ManagementBaseObject inParams = null;
+                System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("StartService", inParams, null);
+                return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
+            }
+            else {
+                return System.Convert.ToUInt32(0);
+            }
+        }
+        
+        public uint StopService() {
+            if ((isEmbedded == false)) {
+                System.Management.ManagementBaseObject inParams = null;
+                System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("StopService", inParams, null);
+                return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
+            }
+            else {
+                return System.Convert.ToUInt32(0);
+            }
+        }
+        
+        // Enumerator implementation for enumerating instances of the class.
+        public class VirtualSystemMigrationServiceCollection : object, ICollection {
+            
+            private ManagementObjectCollection privColObj;
+            
+            public VirtualSystemMigrationServiceCollection(ManagementObjectCollection objCollection) {
+                privColObj = objCollection;
+            }
+            
+            public virtual int Count {
+                get {
+                    return privColObj.Count;
+                }
+            }
+            
+            public virtual bool IsSynchronized {
+                get {
+                    return privColObj.IsSynchronized;
+                }
+            }
+            
+            public virtual object SyncRoot {
+                get {
+                    return this;
+                }
+            }
+            
+            public virtual void CopyTo(System.Array array, int index) {
+                privColObj.CopyTo(array, index);
+                int nCtr;
+                for (nCtr = 0; (nCtr < array.Length); nCtr = (nCtr + 1)) {
+                    array.SetValue(new VirtualSystemMigrationService(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
+                }
+            }
+            
+            public virtual System.Collections.IEnumerator GetEnumerator() {
+                return new VirtualSystemMigrationServiceEnumerator(privColObj.GetEnumerator());
+            }
+            
+            public class VirtualSystemMigrationServiceEnumerator : object, System.Collections.IEnumerator {
+                
+                private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum;
+                
+                public VirtualSystemMigrationServiceEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) {
+                    privObjEnum = objEnum;
+                }
+                
+                public virtual object Current {
+                    get {
+                        return new VirtualSystemMigrationService(((System.Management.ManagementObject)(privObjEnum.Current)));
+                    }
+                }
+                
+                public virtual bool MoveNext() {
+                    return privObjEnum.MoveNext();
+                }
+                
+                public virtual void Reset() {
+                    privObjEnum.Reset();
+                }
+            }
+        }
+        
+        // TypeConverter to handle null values for ValueType properties
+        public class WMIValueTypeConverter : TypeConverter {
+            
+            private TypeConverter baseConverter;
+            
+            private System.Type baseType;
+            
+            public WMIValueTypeConverter(System.Type inBaseType) {
+                baseConverter = TypeDescriptor.GetConverter(inBaseType);
+                baseType = inBaseType;
+            }
+            
+            public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Type srcType) {
+                return baseConverter.CanConvertFrom(context, srcType);
+            }
+            
+            public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Type destinationType) {
+                return baseConverter.CanConvertTo(context, destinationType);
+            }
+            
+            public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) {
+                return baseConverter.ConvertFrom(context, culture, value);
+            }
+            
+            public override object CreateInstance(System.ComponentModel.ITypeDescriptorContext context, System.Collections.IDictionary dictionary) {
+                return baseConverter.CreateInstance(context, dictionary);
+            }
+            
+            public override bool GetCreateInstanceSupported(System.ComponentModel.ITypeDescriptorContext context) {
+                return baseConverter.GetCreateInstanceSupported(context);
+            }
+            
+            public override PropertyDescriptorCollection GetProperties(System.ComponentModel.ITypeDescriptorContext context, object value, System.Attribute[] attributeVar) {
+                return baseConverter.GetProperties(context, value, attributeVar);
+            }
+            
+            public override bool GetPropertiesSupported(System.ComponentModel.ITypeDescriptorContext context) {
+                return baseConverter.GetPropertiesSupported(context);
+            }
+            
+            public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context) {
+                return baseConverter.GetStandardValues(context);
+            }
+            
+            public override bool GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext context) {
+                return baseConverter.GetStandardValuesExclusive(context);
+            }
+            
+            public override bool GetStandardValuesSupported(System.ComponentModel.ITypeDescriptorContext context) {
+                return baseConverter.GetStandardValuesSupported(context);
+            }
+            
+            public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType) {
+                if ((baseType.BaseType == typeof(System.Enum))) {
+                    if ((value.GetType() == destinationType)) {
+                        return value;
+                    }
+                    if ((((value == null) 
+                                && (context != null)) 
+                                && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
+                        return  "NULL_ENUM_VALUE" ;
+                    }
+                    return baseConverter.ConvertTo(context, culture, value, destinationType);
+                }
+                if (((baseType == typeof(bool)) 
+                            && (baseType.BaseType == typeof(System.ValueType)))) {
+                    if ((((value == null) 
+                                && (context != null)) 
+                                && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
+                        return "";
+                    }
+                    return baseConverter.ConvertTo(context, culture, value, destinationType);
+                }
+                if (((context != null) 
+                            && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) {
+                    return "";
+                }
+                return baseConverter.ConvertTo(context, culture, value, destinationType);
+            }
+        }
+        
+        // Embedded class to represent WMI system Properties.
+        [TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))]
+        public class ManagementSystemProperties {
+            
+            private System.Management.ManagementBaseObject PrivateLateBoundObject;
+            
+            public ManagementSystemProperties(System.Management.ManagementBaseObject ManagedObject) {
+                PrivateLateBoundObject = ManagedObject;
+            }
+            
+            [Browsable(true)]
+            public int GENUS {
+                get {
+                    return ((int)(PrivateLateBoundObject["__GENUS"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string CLASS {
+                get {
+                    return ((string)(PrivateLateBoundObject["__CLASS"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string SUPERCLASS {
+                get {
+                    return ((string)(PrivateLateBoundObject["__SUPERCLASS"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string DYNASTY {
+                get {
+                    return ((string)(PrivateLateBoundObject["__DYNASTY"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string RELPATH {
+                get {
+                    return ((string)(PrivateLateBoundObject["__RELPATH"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public int PROPERTY_COUNT {
+                get {
+                    return ((int)(PrivateLateBoundObject["__PROPERTY_COUNT"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string[] DERIVATION {
+                get {
+                    return ((string[])(PrivateLateBoundObject["__DERIVATION"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string SERVER {
+                get {
+                    return ((string)(PrivateLateBoundObject["__SERVER"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string NAMESPACE {
+                get {
+                    return ((string)(PrivateLateBoundObject["__NAMESPACE"]));
+                }
+            }
+            
+            [Browsable(true)]
+            public string PATH {
+                get {
+                    return ((string)(PrivateLateBoundObject["__PATH"]));
+                }
+            }
+        }
+    }
+}