### GET /resources/hypervisors Example (JSON) Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=wm-hypervisors This example demonstrates the JSON response structure when retrieving a list of hypervisors using the GET /resources/hypervisors endpoint. It includes details such as address, ID, name, network associations, and status. ```json [ { "address": "https://172.16.15.250/sdk", "certified": "T", "cloud": "/resources/clouds/7", "created": 1254889411919, "currentmessage": "RM03103", "currentmessage_text": "Started (move to maintenance mode to make changes)", "currentstatus": "RM01006", "currentstatus_text": "Started", "desiredstatus": "RM01006", "desiredstatus_text": "Started", "id": 16, "name": "virtualwas", "networks": [ "/resources/networks/38", "/resources/networks/39" ], "password": "125488941166924", "storage": [ "/resources/storage/56", "/resources/storage/57" ], "type": "ESX", "updated": 1254889464232, "userid": "root" }, { "address": "172.16.0.5", "certified": "T", "cloud": "/resources/clouds/17", "created": 1255049179858, "currentmessage": "RM03103", "currentmessage_text": "Started (move to maintenance mode to make changes)", "currentstatus": "RM01006", "currentstatus_text": "Started", "desiredstatus": "RM01006", "desiredstatus_text": "Started", "id": "PM-19", "name": "IBM 8204 E8A 10BC4A1", "networks": [ "/resources/networks/40", "/resources/networks/41" ], "password": "125504917100029", "storage": [ "/resources/storage/58", "/resources/storage/59", "/resources/storage/60" ], "type": "PowerVM", "updated": 1255049245832, "userid": "root" } ] ``` -------------------------------- ### GET /resources/hypervisors/{id} Example (JSON) Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=wm-hypervisors This example shows the JSON output for a single hypervisor retrieved using the GET /resources/hypervisors/{id} endpoint. It details attributes like network and storage associations, operational status, and identification. ```json { "address": "172.16.0.5", "certified": "T", "cloud": "/resources/clouds/17", "created": 1255049179858, "currentmessage": "RM03103", "currentmessage_text": "Started (move to maintenance mode to make changes)", "currentstatus": "RM01006", "currentstatus_text": "Started", "desiredstatus": "RM01006", "desiredstatus_text": "Started", "id": "PM-19", "name": "IBM 8204 E8A 10BC4A1", "networks": [ "/resources/networks/40", "/resources/networks/41" ], "password": "125504917100029", "storage": [ "/resources/storage/58", "/resources/storage/59", "/resources/storage/60" ], "type": "PowerVM", "updated": 1255049245832, "userid": "root" } ``` -------------------------------- ### Start Language Pack Installer Script Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=agent-installing-language-packs-linux-unix-computer This command initiates the language pack installation process. It requires navigating to the temporary directory where the language pack CD is mounted and then executing the installer script with the installation directory as a parameter. ```bash cd dir_name lpinstaller.sh -c install_dir ``` -------------------------------- ### GET /resources/networks Example Response Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=wm-networks This example demonstrates the JSON structure returned when retrieving a list of networks using the GET /resources/networks endpoint. It includes details such as creation time, hypervisor, ID, name, and update time for each network. ```json [ { "created": 1245009567989, "currentmessage": null, "currentmessage_text": null, "hypervisor": "/resources/hypervisors/1", "id": 1, "ipgroup": null, "name": "Public VM Network", "updated": 1245009567989, "vlan": null }, { "created": 1245009568100, "currentmessage": null, "currentmessage_text": null, "hypervisor": "/resources/hypervisors/1", "id": 2, "ipgroup": "/resources/ipGroups/1", "name": "VM Network", "updated": 1245009586180, "vlan": null } ] ``` -------------------------------- ### Example: Getting VM Instances Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=patterns-shared-service An example demonstrating how to retrieve VM instance details for the first deployed virtual application in the list. The output shows status, creator, and other relevant information. ```python >>> deployer.virtualapplications[0].vminstances() { "app_id": "d-2e0c8abb-373f-46fc-a05f-a255af3d3120", "app_type": "application", "creator": "u-0", "creator_name": "cbadmin", "deployment_name": "Sample JEE web application", "instances": (nested object), "role_error": False, "start_time": "2011-08-17T21:16:59.266Z", "status": "RUNNING", "virtual_system": (nested object) } ``` -------------------------------- ### PureCLI Connection and Authentication Example Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=interface-starting-in-interactive-mode This example demonstrates how to run the PureCLI with specified host, user, and certificate acceptance options. It shows the command syntax for connecting to the system. ```shell pure -h 127.10.111.22 -u user01 --acceptcert ``` -------------------------------- ### Example: Start a Specific Compute Node Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=nodes-compute-start Demonstrates how to start a specific compute node, identified by its index in the 'admin.computenodes' array. This example assumes an administrative context where 'admin' object is available. ```shell admin.computenodes[0].start() ``` -------------------------------- ### Execute Installation Command with Arguments and Logging Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=fixes-servicexml-reference This section details the execution of an installation script. It specifies the command to run, its arguments, the log directory, the execution location, and a timeout value. This is essential for automating application service installations. ```xml installArg1 installArg2 installArg3 $WAS_INSTALL_ROOT/UpdateInstaller/logs /tmp/update 600000 ``` -------------------------------- ### Interactively Create Virtual System with Pattern Selection Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=methods-wizard-objects-command-line-interface This example illustrates the interactive creation of a virtual system using the wizard class. It includes demonstrating how to select a pattern from a provided list by entering the corresponding number. ```python >>> w = deployer.wizard() >>> deployer.virtualsystems.create(w) Enter ?? for help using the wizard. name: MyVirtualSystem pattern (* to select from list): * 1. MyPattern1 2. MyPattern2 3. MyPattern3 pattern (* to select from list):1 ``` -------------------------------- ### Create Virtual System Instance (POST) Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=management-classic-virtual-system-instances This snippet demonstrates how to create a new virtual system instance using a POST request. It requires specifying attributes like cloud or environmentProfile, name, pattern, and optionally endtime. It also details how to configure network interfaces and IP addresses within the 'parts' attribute, especially when IP addresses are provided by the pattern deployer. ```json { "name": "my_virtual_system", "pattern": "/resources/pattern/my_pattern_id", "cloud": "/resources/cloud/my_cloud_id", "environmentProfile": "/resources/environmentProfile/my_env_profile_id", "endtime": 1678886400000, "parts": [ { "addresses": [ [ { "ipgroupid": "1", "hostname": "myhostname11.mycompany.com", "ipaddress": "172.20.17.11" }, { "ipgroupid": "1", "hostname": "myhostname12.mycompany.com", "ipaddress": "172.20.17.12" } ], [ { "ipgroupid": "1", "hostname": "myhostname13.mycompany.com", "ipaddress": "172.20.17.13" }, { "ipgroupid": "1", "hostname": "myhostname14.mycompany.com", "ipaddress": "172.20.17.14" } ] ] } ] } ``` -------------------------------- ### Running a Command with PureCLI Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=interface-starting-in-batch-mode This example demonstrates how to execute a single command using the PureCLI. It specifies the host, user, and accepts certificates automatically. The command 'deployer.patterns' is passed using the '-c' argument. ```bash pure -h 172.16.98.225 -u user01 --acceptcert -c deployer.patterns ``` -------------------------------- ### Configure Plugin Installation for Specific Products Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=options-product-specific-settings Specify that a plug-in is only installed for a particular product by defining the 'requires.products' array in config.json. This example shows 'caching' plug-in installed only if the product is 'IPAS'. ```json { "name":"caching", "version":"2.0.0.1", "patterntypes":{ "primary":{ "foundation":"2.0" } }, "requires":{ "products":["IPAS"] }, ``` -------------------------------- ### Example Installed Fix Packs File Content for WebSphere Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=tppid-cloud-pak-tries-install-already-installed-websphere-portal-server-fix-pack This is an example of the JSON content found within the '/0config/installedFixPacks' file. It lists installed middleware components and their versions. This content is used to understand the file structure and the format of version strings. ```json {"IBM WebSphere Application Server Network Deployment": "8.5.5.8", "IBM WebSphere Portal Server": "8.5.0.0 CF05"} ``` -------------------------------- ### Set Environment and Navigate to Start Directory (Shell) Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=scripts-running-lifecycle-virtual-machines This snippet details the steps to prepare the environment and navigate to the common start directory before executing .sh start scripts. This is essential for initiating the startup process of node parts. ```shell . /0config/nodepkgs/common/scripts/pdk-debug/setEnv.sh cd /0config/nodepkgs/common/start ``` -------------------------------- ### Start a Specific Virtual Machine (Example) Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=machines-virtual-start This example demonstrates how to start a specific virtual machine from a collection, likely accessed via an administrative object. It targets the first virtual machine in the 'virtualmachines' array. Ensure the administrative context and the existence of the virtual machine index are valid. ```javascript admin.virtualmachines[0].start() ``` -------------------------------- ### GET /resources/networks/{id} Example Response Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=wm-networks This example shows the JSON format for a single network resource when queried using the GET /resources/networks/{id} endpoint. It provides attributes like creation time, associated hypervisor, network ID, name, and last updated timestamp. ```json { "created": 1245009568100, "currentmessage": null, "currentmessage_text": null, "hypervisor": "/resources/hypervisors/1", "id": 2, "ipgroup": "/resources/ipGroups/1", "name": "VM Network", "updated": 1245009586180, "vlan": null } ``` -------------------------------- ### Example: Get ACL for User/Group Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=acl-get-given-user-group Demonstrates how to use the ACL retrieval syntax with specific resource objects like clouds and users. The second example shows the usage of the `"?user|group"` syntax for accessing ACLs when direct permissions are insufficient. ```shell >>>admin.clouds[0].acl[admin.users[0]] ``` ```shell >>>admin.clouds[0].acl["admin?user"] ``` -------------------------------- ### POST /resources/hypervisors Response Example (JSON) Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=wm-hypervisors This example illustrates the JSON response received after successfully creating a hypervisor with the POST /resources/hypervisors endpoint. It includes system-generated fields like ID, status, and creation timestamps. ```json { "address": "https://anotherhypervisor.mycompany.com/sdk", "certified": "I", "cloud": null, "created": 1245249680477, "currentmessage": "RM03106", "currentmessage_text": "Maintenance mode (must add to a cloud group to start)", "currentstatus": "RM01025", "currentstatus_text": "Maintenance mode", "desiredstatus": "RM01025", "desiredstatus_text": "Maintenance mode", "id": 5, "name": "another hypervisor", "networks": [ ], "password": "124524968047629", "storage": [ ], "type": "ESX", "updated": 1245249680477, "userid": "root" } ``` -------------------------------- ### Execute Python Script with runScript.sh for Starting (Shell) Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=scripts-running-lifecycle-virtual-machines This command illustrates how to run a Python script located in the start directory using `runScript.sh`. It's used to initiate the starting phase of node parts after environment setup. ```shell cd /0config/nodepkgs/common/start runScript.sh {script-name} ``` -------------------------------- ### Get Help for VirtualApplicationInstance using CLI Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=patterns-virtual-application-instances This snippet demonstrates how to get help for the VirtualApplicationInstance object using the command-line interface. It requires the 'deployer' module to be available in the Jython environment. The output is a help description of the object's attributes and methods. ```jython >>> help(deployer.virtualapplicationinstance) ``` -------------------------------- ### Define Environment Variables for Package Installation Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=fixes-servicexml-reference This snippet demonstrates how to define environment variables for a package installation. It covers string, password, enum, and boolean types, with examples of default values. These variables are crucial for configuring the installation process. ```xml ``` -------------------------------- ### Install Perl Core Module (Bash) Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=node-installing-external-storage-scale-tiebreaker This command installs the 'perl-core' module, which is required for running Perl commands on RHEL 7 and later systems. It ensures that all necessary Perl components are available for the IBM Storage Scale installation. ```bash yum install perl-core ``` -------------------------------- ### Start Server using startServer.sh Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=images-extending-partition-file-system-sizes This script initiates a server process, such as a WebSphere Application Server. It logs detailed tool information and provides status updates during server startup. The command typically requires the server name as an argument. ```bash ./startServer.sh server1 ADMU0116I: Tool information is being logged in file /opt/IBM/WebSphere/Profiles/DefaultAppSrv01/logs/server1/startServer.log ADMU0128I: Starting tool with the DefaultAppSrv01 profile ADMU3100I: Reading configuration for server: server1 ADMU3201I: Server launched. Waiting for initialization status. ADMU3000I: Server server1 open for e-business; process id is 7743 ``` -------------------------------- ### GET /resources/patterns API Response Example Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=management-classic-virtual-system-patterns This example demonstrates the JSON response structure for the GET /resources/patterns API endpoint. It shows a list of pattern objects, each containing attributes like 'created', 'currentstatus', 'description', 'id', 'name', 'owner', 'updated', and 'virtualsystems'. Refer to the _GET /resources/patterns/{id}_ documentation for detailed attribute explanations. ```json [ { "created": 1242965374865, "currentmessage": null, "currentmessage_text": null, "currentstatus": "RM01028", "currentstatus_text": "Read-only", "description": "Single server is a WebSphere Application Server topology or part of a WebSphere Application Server Network Deployment topology. The single node can be used for a development environment, or as part of a multiple node, production environment in which the application configuration is manually duplicated.", "id": 1, "name": "WebSphere single server", "owner": "/resources/users/1", "updated": 1242965392870, "virtualsystems": [ "/resources/virtualsystems/2", "/resources/virtualsystems/4", "/resources/virtualsystems/6" ] }, { "created": 1245007619361, "currentmessage": null, "currentmessage_text": null, "currentstatus": "RM01027", "currentstatus_text": "Draft", "description": "Test pattern", "id": 5, "name": "test pattern", "owner": "/resources/users/1", "updated": 1245007620130, "virtualsystems": [ ] }, etc. ] ``` -------------------------------- ### Example: Create BYOS RHEL 6.5 Virtual Image using Python SDK Source: https://www.ibm.com/docs/en/cloud-pak-system-w4600/2.3.6/index_topic=wvi-using-your-own-linux-os-image-create-virtual-system-instances This is a practical example of the Python SDK commands used to create a virtual image. It demonstrates retrieving a specific RHEL 6.5 virtual machine and then creating a new image named 'BYOS RHEL 6.5' with a specified version and description, using an HTTP URL for the metadata OVA. ```python vm=admin.virtualmachines.list({'name':''My RHEL 6.5 VM 2''})[0] deployer.virtualimages.create({'url':'http://172.16.15.250/jobs/MAESTRO_LINUX_OS_IMG_METADATA_OVA/lastSuccessful/archive/MAESTRO_LINUX_OS_IMG_METADATA_2.1-11.ova','vmid':vm.id,'name':'BYOS RHEL 6.5','version':'1.0.0.0','description':'My RHEL 6.5 Image for pattern deploy'}) ```