HPE GreenLake Administration
- Community Home
- >
- Software
- >
- HPE Morpheus Software
- >
- HPE Morpheus Enterprise
- >
- Configuration phase to modify requested instance v...
HPE Morpheus Enterprise
1834456
Members
2514
Online
110067
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2023 01:04 AM
06-15-2023 01:04 AM
Configuration phase to modify requested instance volume information before deployment
Hello,
This is a quick post to share an example configuration phase script that will enforce that the root volume goes to 50GB and then the VM deploys with two additional volumes, regardless of what a user inputs during instance provision. This was for a niche customer use-case, but I thought it might be useful for the community as another example of using the configuration phase.
Script:
import json
configspec = morpheus['spec']
volume1 = None
for volume in configspec['volumes']:
if volume["rootVolume"] == True:
volume1 = volume
break #we have the root volume
#change size of root volume
volume1["size"] = 50 #50GB
#create some custom volumes to overide user selected volume settings
volume2 = {}
volume2["size"] = 10
volume2["storageType"] = volume1["storageType"] #get same storage type as first (root) volume
volume2["id"] = -1 #no id yet as its new
volume2["datastoreId"] = volume1["datastoreId"]
volume2["rootVolume"] = False
volume2["name"] = "volume2"
volume3 = {}
volume3["size"] = 20
volume3["storageType"] = volume1["storageType"] #get same storage type as first (root) volume
volume3["id"] = -1 #no id yet as its new
volume3["datastoreId"] = volume1["datastoreId"]
volume3["rootVolume"] = False
volume3["name"] = "volume3"
configspec["volumes"] = [volume1, volume2, volume3] #override the existing volumes data
configspec["volumesDisplay"] = configspec["volumes"] #copy over in other place in spec
newspec = {}
newspec['spec'] = configspec
print(json.dumps(newspec)) #return spec so Morpheus uses new spec
Cheers,
Chris
- Tags:
- automation
- Workflows
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP