Contained WithinFind More DocumentationFeatured Support Resources | Download this book in PDF (695 KB)
Chapter 5 Copying Objects Between Master ServersIn this release of the N1 Service Provisioning System, a new Import-Export feature has been provided to enable you to easily copy various Service Provisioning System objects at once from your development master server to your testing server, to your staging master server, and from there to your production master server. Service Provisioning System objects can include:
Overview of the Import-Export FeatureService Provisioning System objects such as components, plans and host sets can now easily be copied from one master server into a single file and on to another master server. This is done as follows:
Note – All users can use the import-export feature. Creating a Bundle TemplateCreate a bundle template using the bdb.b.add command. Use the following arguments with the bdb.b.add command:
The result of the bdb.b.add command is the generation of a unique bundle ID. For full usage of this command, see Appendix A, Appendix — New Commands. Note – The bundle ID can be a cumbersome ID to enter at the command-line. Consider substituting the ID for a shorter term using the NM command as described in Using NM: to Perform ID Substitution in Sun N1 Service Provisioning System 5.2 Command-Line Interface Reference Manual. Note – A bundle template cannot contain another bundle template. Declaring Search Criteria for a Bundle TemplateWhen you create the bundle template, specify search criteria for plans, components or other objects in the correct order of their dependencies. To specify search criteria for the bundle template, use the bdb.b.add command. The order in which you declare search criteria using the bdb.b.add command is important. Matched objects are exported into the bundle jar in the order of the search criteria that they match. The search criteria must be in the correct order of the matched object's dependencies. Note – The ordering of systemService and componentType search criteria is not significant. The component to which they refer must be included in the same bundle template. Search criteria can be specified as set out in the following table. Table 5–1 Search Criteria and How They Can Be Specified
For example, it is possible to specify the name and description search criteria for system services. If you specify a search criterion for an entity and the entity does not exist, the creation of the bundle template is successful but the export to a bundle jar does not succeed. Bundle templates can have zero or more search criteria. Criteria are declared as attribute=value pairs, separated by a comma. Multiple similar criteria are separated by a semicolon. Pattern strings that contain a comma, semicolon or an equals character in them can be included by the use of '\' (backslash) as an escape character. Backslash itself could be specified as '\\' in the pattern. Attributes are declared as follows:
Search Criteria ValidationSearch criteria are validated internally using the following character limits.
Example 5–1 Creating a Bundle TemplateThis example shows a bundle template being created with the bdb.b.add command. Note that the search criteria are separated by semicolons, and attribute value pairs are separated by = as described in Declaring Search Criteria for a Bundle Template.
The result of the command is that the bundle template is created and the associated bundle ID is returned.
For full usage of this command, see Appendix A, Appendix — New Commands. Viewing and Listing Bundle TemplatesThis section explains how to view a bundle template and how to list all bundle templates on the master server. Listing All Bundle TemplatesTo list all bundle templates, use the bdb.b.la command. The output of the bdb.b.la commands is as follows:
For full usage of this command, see Appendix A, Appendix — New Commands. Example 5–2 Output of the bdb.b.la CommandThis example shows a sample output returned after issuing the bdb.b.la command, which lists all bundle templates on the master server.
The output shows that there are two bundle templates. The first string of numbers is the bundle ID. Looking at the first of the two bundles, its ID is 129158239109-1160744183744-00241-1568077714 and its bundle name is bplan4. Its bundle description is bundles1. Viewing a Single Bundle TemplateTo display the details of a single bundle template, including the defined search criteria and the corresponding elements or objects, use the bdb.b.lo command with the -ID argument, where ID is the ID of the bundle template. You can substitute the ID as explained in Creating a Bundle Template. The default output of the bdb.b.lo command is the same as that of the bdb.b.la command. In addition, with the bdb.b.lo you can use the -o option to obtain a more detailed summary. The following information is displayed in tabular form:
For full usage of this command, see Appendix A, Appendix — New Commands. Example 5–3 Output of the bdb.b.lo CommandThis example shows a sample output returned after issuing the bdb.b.lo command to list the details of a specified single bundle template. In this example, the command is issued with the -o option, and the NM command has been used to replace the bundle ID with a shorter term.
The result is as follows.
The bdb.b.lo command can be used without the -o option, to get a summary of the details of a single bundle template.
The result is as follows.
Modifying a Bundle TemplateOnce you have created a bundle template, you can edit its name, description and search criteria. Use the bdb.b.mod command to modify the bundle template. Use the following arguments with the bdb.b.mod command:
Note – The bdb.b.mod command does not change the ID of the bundle template. Once you are satisfied with the bundle template, save it and export it in the form of a bundle jar. The bdb.b.mod command overwrites existing search criteria. To delete a single search criteria, all existing criteria except the one to be deleted, need to be provided to the bdb.b.mod command. Note – When you use the bdb.b.mod command with the -criteria option, all existing are overwritten, even if you do not declare them with the bdb.b.mod command. Criteria that you do not declare are removed. For full usage of this command, see Appendix A, Appendix — New Commands. Example 5–4 Using the bdb.b.mod Command to Modify a Bundle Template By Overwriting Existing CriteriaThis example shows how to use the bdb.b.mod command to modify a bundle template, overwriting all existing search criteria.
The output of the command is the bundle template ID.
The ID remains that same as it was before the bundle template search criteria were modified. Example 5–5 Using the bdb.b.mod Command to Modify a Bundle Template and Remove Existing CriteriaThis example shows how to use the bdb.b.mod command to modify a bundle template, removing all existing search criteria.
The following command also works.
The output of the command is the bundle template ID.
The ID remains that same as it was before the bundle template's search criteria were removed. Deleting a Bundle TemplateDelete a bundle template using the bdb.b.del command. The bdb.b.del command takes the ID of the bundle template as an argument. You can delete a bundle template without deleting the entities that it references. This is because the entity search criteria, and not the entities themselves, are saved in the bundle template. Example 5–6 Using the bdb.b.del Command to Delete a Bundle TemplateThis example shows how to use the bdb.b.del command to delete a bundle template.
For full usage of this command, see Appendix A, Appendix — New Commands. Exporting a Bundle Template to a Bundle JarWhen you have created the bundle template, you are ready to export it to a bundle jar. Specify the file system path in which to save the bundle jar. The maximum size of a bundle jar is 2GB. Use the bdb.b.exp command to export a bundle template to a bundle jar: This command takes the ID of the bundle template as an argument. The path argument is also used, to specify the path to the file system in which to save the bundle jar. For full usage of this command, see Appendix A, Appendix — New Commands. During the export of the bundle template, if the resultant bundle jar would exceed 2GB, the export operation fails. If more than one search criteria match the same object, only the first criteria is considered. Only a saved bundle template can be used to export a bundle jar. Bundle template search criteria must refer to a single version of objects that can have versions. Export of multiple versions of the same object is not supported. The default value for the visibility filter is visible therefore, unless specified otherwise in the command criteria, only visible entities are exported. Do not export directories that have symbolic links within them. Export of a directory containing a symbolic link fails. On export, the resource version number is set to 1.0, if it is already not 1.0 in the component XML. If the resulting bundle jar was imported to a master server that did not already have this resource checked in, import would have failed. To avoid this, the version is set to 1.0 implicitly. The export operation fetches the bundle template immediately, hence any subsequent edit or delete operations on the bundle template do not impact the export operation. Example 5–7 Using the bdb.b.exp Command to Export a Bundle TemplateThis example shows how to use the bdb.b.exp command to export a bundle template to a Bundle Jar. The jar path is input as /aa/aa/abc.jar
The result is as follows.
The output shows that the operation was successful. Importing a Bundle JarA bundle jar can be imported by selecting it from the local filesystem. If the operation is successful, its entities are added to the destination master server in the order specified in the bundle descriptor file. Ensure that all entities satisfy the usual requirements of the provisioning system, and that any plugins on which they depend are already imported. Use the bdb.b.imp command to import a bundle jar from the local file system. This command takes the following arguments:
For full usage of this command, see Appendix A, Appendix — New Commands. On each master server, you can only import one bundle jar at any time. After the import operation, the newly imported objects are visible, but are not categorized. Any previous versions of these objects are implicitly hidden. Entities added or updated by the import operation have no record that they were checked in by a bundle jar. If plans or components owned by a plugin and that depend on elements in the plugin, are included in a bundle jar, the plans or components might not function after the import operation, unless all elements on which they depend are also imported. By default, therefore, search criteria in bundle templates exclude entities that are contained in plugins. Folder paths for plans or components in the bundle jar cannot be owned by a plugin that is already imported on the master server. Best practice is not to include versions when referring to subplans, subcomponents and targeters, because subplans, subcomponents and targeters may not work reliably after import in different environments. Only one import operation is permitted for a master server at any time. Example 5–8 Using the bdb.b.imp Command to Validate the Import of a Bundle JarThis example shows how to use the bdb.b.imp command with the -v option to test if the import of a bundle jar would be successful. The jar path is input as /bb/bb/bundle.jar
The result is as follows.
The output shows that the operation would be successful. Example 5–9 Using the bdb.b.imp Command to Import a Bundle JarThis example shows how to use the bdb.b.imp command to import a bundle jar. The jar path is input as /bb/bb/bundle.jar
The result is as follows.
The output shows that the import operation was successful. Contents of a Bundle JarThe contents of a bundle jar are described in an XML descriptor file, located in the top level directory of the bundle jar file. The rest of the jar file is composed of XML representations of the entities that were the result of bundle template's search criteria. The XML descriptor file is enclosed in the <bundle> element. The <bundle> element is a new element for this release, and is not described in the XML Schema Guide. You can manually create a bundle jar, or modify it after it has been automatically created by the system. This is on the condition that the jar contents are always consistent with the bundle descriptor file. Attributes of the <bundle> ElementThe <bundle> element has the following attributes. Table 5–2 Bundle Element Attributes
Child Elements of the <bundle> elementThe <bundle> element has the following child element. memberList: List of member objects to create as part of the bundle. These member objects can include 1 or more objects of:
Child Elements of the <memberList> ElementThe <memberList> element has the following child elements:
<folder> ElementThe <folder> element is a child of the <memberList>element. It is used to declare a folder to be referenced by the bundle. The owner of these folders is the group you choose when importing. Attributes of the <folder> ElementThe <folder> element has two attributes:
<hostType> ElementThe <hostType> element is a child of the <memberList>element. It is used to declare a hostType to be referenced by the bundle. Attributes of the <hostType> ElementThe <hostType> element has two attributes:
<varList> ElementThe <hostType> element contains an optional <varList> child element. The <varList> element specifies a list of variables to be added to the <hostType> element and later used by hosts in configuration. The <varlist> element contains one or more <var> child elements. The <var> element provides <hostType> element variable declaration through two required attributes: <hostSet> ElementThe <hostSet> element is a child of the <memberList> element and is used to declare a host set to be referenced by the bundle. The <hostSet> element cannot contain hosts, since bundles cannot define hosts. The <hostSet> element contains two optional child elements:
Attributes for the <hostSet> ElementThe <hostSet> element has two attributes: <hostSetRef> ElementThe <hostSetRef> element is a child of the <hostSet> element. It specifies a sub-host set. This host set must have been previously defined either in this bundle or in the master server on which the bundle is being imported. Attributes for the <hostSetRef> ElementThe <hostSetRef> element has one attribute, name. This attribute provides the name of the host set reference. <hostSearchRef> ElementThe <hostSearchRef> element is a child of the <hostSet> element. It specifies a sub-host search. This host search must have been previously defined either in this bundle or in the master server on which the bundle is being imported. Attributes for the <hostSearchRef> ElementThe <hostSearchRef> element has one attribute, name. This attribute provides the name of the host search reference. <hostSearch> ElementThe bundle <hostSearch> element is a child of the <memberList> element and is used to declare a host search to be referenced by the bundle. The <hostSearch> element contains at least one of the following child elements:
Note – Although the <criteriaList>, <appTypeCriteria>, and <physicalCriteria> elements are each optional, one of the three must be provided. Attributes for the <hostSearch> ElementThe <hostSearch> element has two attributes: <criteriaList> ElementThe <criteriaList> element is a child of the <hostSearch> element. It specifies a list of criteria to be added to the <hostSearch> element. The <criteriaList> element must be specified if <appTypeCriteria> and <physicalCriteria> are not specified. The <criteriaList> element contains one or more <criteria> elements. The <criteria> element specifies a search criteria, including name, match type, and pattern. Attributes for the <criteria> ElementThe <criteria> element has three attributes: <appTypeCriteria> ElementThe <appTypeCriteria> element is a child of the <hostSearch> element. It specifies a list of application type criteria to be added to the <hostSearch> element. The arguments of the <appTypeCriteria> element are expressed as attributes, and order is not important. If all values are false or the element is empty or unspecified, the search disregards this criteria when performing the search. The <appTypeCriteria> element must be specified if <criteriaList> and <physicalCriteria> are not. Attributes for the <appTypeCriteria> ElementThe <appTypeCriteria> element has three optional attributes:
<physicalCriteria> ElementThe <physicalCriteria> element is a child of the <hostSearch> element. It specifies a list of physical type criteria to be added to the <hostSearch> element. The arguments of the <physicalCriteria> element are expressed as attributes, and order is not important. If all values are false or the element is empty or unspecified, the search disregards this criteria when performing the search. The <physicalCriteria> element must be specified if <criteriaList> and <appTypeCriteria> are not. Attributes for the <physicalCriteria> ElementThe <physicalCriteria> element has two optional attributes:
<component> ElementThe <component> element is a child of the <memberList> element and is used to declare a component in the bundle jar. All objects referenced by this component must have been previously defined either in this bundle or on the master server on which the bundle is being imported. The <component> element contains three optional child elements:
Attributes for the <component> ElementThe <component> element has two attributes:
<systemService> ElementThe <systemService> element is a child of the <component> element and is used to declare a system service backed by the containing component. This element may not be used with the <componentType> element. When the <systemService> element is used in a <component> element, a component is loaded and a <systemServiceRef> that references that component is created. Attributes for the <systemService> ElementThe <systemService> element has two attributes: <componentType> ElementThe <componentType> element is a child of the <component> element and is used to declare a component type backed by the containing component. The <componentType> element may not be used with the <systemService> element. When the <componentType> element used in a <component> element, a component is loaded and a component type that is backed by that component is created. Attributes for the <componentType> ElementThe <componentType> element has five attributes:
<resource> ElementThe <resource> element is a child of the <component> element. It specifies a resource file name and location in the jar. A resource is always checked in as a either a file-typed or a directory-typed resource. The component that contains the <resource> element must be a simple component whose <resourceRef> element refers to the resource created by the <resource> element. No component variables are automatically added to the component that contains the <resource> element, regardless of the value of the config attribute. Attributes for the <resource> ElementThe <resource> element has three attributes:
<plan> ElementThe <plan> element is a child of the <memberList> element and is used to declare a plan in the bundle jar. All objects referenced by this plan must have been previously defined either in this bundle or on the master server on which the bundle is being imported. Attributes for the <plan> ElementThe <plan> element has two attributes:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||