예제 #1
0
        /// <summary>
        /// <para>From DMTF Spec:</para>This operation is used to create a single CIM Instance in the target Namespace. The Instance MUST NOT already exist.
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="defaultNamespace"></param>
        /// <returns>The CimXml request as a string.</returns>
        public static void CreateInstance(CimXmlWriter cxw, CreateInstanceOpSettings settings, CimName defaultNamespace)
        {
            #region Actual XML Request
            /*
             * For CreateInstance, DeleteInstance, use the tree under CIM_NFS, OMC_NFS  (but not OMC_LinuxNFS)
             * There are no instances right now, so we instantly know which instances are ours.

            <?xml version="1.0" encoding="utf-8" ?>
            <CIM CIMVERSION="2.0" DTDVERSION="2.0">
                <MESSAGE ID="40" PROTOCOLVERSION="1.0">
                    <SIMPLEREQ>
                        <IMETHODCALL NAME="CreateInstance">
                            <LOCALNAMESPACEPATH>
                                <NAMESPACE NAME="smash"></NAMESPACE>
                            </LOCALNAMESPACEPATH>
                            <IPARAMVALUE NAME="NewInstance">
                                <INSTANCE CLASSNAME="CIM_NFS">
                                    <QUALIFIER NAME="Deprecated" TYPE="string" TOSUBCLASS="false" >
                                        <VALUE.ARRAY>
                                            <VALUE>CIM_FileShare</VALUE>
                                        </VALUE.ARRAY>
                                    </QUALIFIER>
                                    <QUALIFIER NAME="Version" TYPE="string" TOSUBCLASS="false" TRANSLATABLE="true" >
                                        <VALUE>2.6.0</VALUE>
                                    </QUALIFIER>
                                    [...]
                                    <PROPERTY NAME="CSCreationClassName" TYPE="string" CLASSORIGIN="CIM_FileSystem" PROPAGATED="true" >
                                        <QUALIFIER NAME="Key" TYPE="boolean" OVERRIDABLE="false" >
                                            <VALUE>true</VALUE>
                                        </QUALIFIER>
                                        [...]
                                        <VALUE>tCSCreationClassName</VALUE>
                                    </PROPERTY>
                                    [...]
                                    <PROPERTY NAME="Root" TYPE="string" CLASSORIGIN="CIM_FileSystem" PROPAGATED="true" >
                                        <QUALIFIER NAME="Description" TYPE="string" TRANSLATABLE="true" >
                                            <VALUE>Path name or other information defining the root of the FileSystem.</VALUE>
                                        </QUALIFIER>
                                        [...]
                                    </PROPERTY>
                                    [...]
                                    <PROPERTY.ARRAY NAME="OperationalStatus" TYPE="uint16" CLASSORIGIN="CIM_ManagedSystemElement" PROPAGATED="true" >
                                        <QUALIFIER NAME="Description" TYPE="string" TRANSLATABLE="true" >
                                            <VALUE>Indicates the current statuses of the element. Various operational statuses are defined. Many of the enumeration&apos;s values are self-explanatory. However, a few are not and are described here in more detail. &quot;Stressed&quot; indicates that the element is functioning, but needs attention. Examples of &quot;Stressed&quot; states are overload, overheated, and so on. &quot;Predictive Failure&quot; indicates that an element is functioning nominally but predicting a failure in the near future. &quot;In Service&quot; describes an element being configured, maintained, cleaned, or otherwise administered. &quot;No Contact&quot; indicates that the monitoring system has knowledge of this element, but has never been able to establish communications with it. &quot;Lost Communication&quot; indicates that the ManagedSystem Element is known to exist and has been contacted successfully in the past, but is currently unreachable. &quot;Stopped&quot; and &quot;Aborted&quot; are similar, although the former implies a clean and orderly stop, while the latter implies an abrupt stop where the state and configuration of the element might need to be updated. &quot;Dormant&quot; indicates that the element is inactive or quiesced. &quot;Supporting Entity in Error&quot; indicates that this element might be &quot;OK&quot; but that another element, on which it is dependent, is in error. An example is a network service or endpoint that cannot function due to lower-layer networking problems. &quot;Completed&quot; indicates that the element has completed its operation. This value should be combined with either OK, Error, or Degraded so that a client can tell if the complete operation Completed with OK (passed), Completed with Error (failed), or Completed with Degraded (the operation finished, but it did not complete OK or did not report an error). &quot;Power Mode&quot; indicates that the element has additional power model information contained in the Associated PowerManagementService association. OperationalStatus replaces the Status property on ManagedSystemElement to provide a consistent approach to enumerations, to address implementation needs for an array property, and to provide a migration path from today&apos;s environment to the future. This change was not made earlier because it required the deprecated qualifier. Due to the widespread use of the existing Status property in management applications, it is strongly recommended that providers or instrumentation provide both the Status and OperationalStatus properties. Further, the first value of OperationalStatus should contain the primary status for the element. When instrumented, Status (because it is single-valued) should also provide the primary status of the element.</VALUE>
                                        </QUALIFIER>
                                        [...]
                                        <VALUE.ARRAY>
                                            <VALUE></VALUE>
                                        </VALUE.ARRAY>
                                    </PROPERTY.ARRAY>
                                    [...]
                                </INSTANCE>
                            </IPARAMVALUE>
                        </IMETHODCALL>
                    </SIMPLEREQ>
                </MESSAGE>
            </CIM>
            */
            #endregion

            // Set the Method Name
            cxw.WriteIMethodCallStartElement("CreateInstance");

            // Set the namespace
            cxw.WriteCimNamespace(defaultNamespace);

            //<IPARAMVALUE NAME="NewInstance">
            cxw.WriteNewInstance();

            // Set the OpSettings
            cxw.WriteUnnamedCimInstance(settings.Instance);

            //</IPARAMVALUE>
            cxw.WriteEndElement();

            //</IMETHODCALL>
            cxw.WriteEndElement();
        }