|
27 | 27 | from config_loader import try_load_from_file |
28 | 28 |
|
29 | 29 | config = { |
30 | | - "ip": "172.16.102.59", |
| 30 | + "ip": "16.124.133.232", |
31 | 31 | "credentials": { |
32 | 32 | "userName": "administrator", |
33 | | - "password": "" |
34 | | - } |
| 33 | + "password": "ecosystem" |
| 34 | + }, |
| 35 | + "api_version": 600 |
35 | 36 | } |
36 | 37 |
|
37 | 38 | # Try load config from a file (if there is a config file) |
|
41 | 42 |
|
42 | 43 | options = { |
43 | 44 | "name": "OneView Test Volume Template", |
44 | | - "provisioning": { |
45 | | - "capacity": "235834383322", |
46 | | - "provisionType": "Thin", |
47 | | - "storagePoolUri": ""}, |
| 45 | + "properties": {}, |
| 46 | +# "provisioning": {}, |
| 47 | +# "capacity": "235834383322", |
| 48 | +# "provisionType": "Thin", |
| 49 | +# "storagePoolUri": ""}, |
48 | 50 | "description": "sample description" |
49 | 51 | } |
50 | 52 |
|
|
101 | 103 |
|
102 | 104 | # Create storage volume template |
103 | 105 | print("Create storage volume template") |
104 | | -options['provisioning']['storagePoolUri'] = storage_pool['uri'] |
| 106 | +#options["provisioning"]["storagePoolUri"] = storage_pool["uri"] |
| 107 | +print options |
105 | 108 | volume_template = oneview_client.storage_volume_templates.create(options) |
106 | 109 | pprint(volume_template) |
107 | 110 |
|
|
117 | 120 | for template in volume_templates: |
118 | 121 | print(" '{name}' at uri: {uri}".format(**template)) |
119 | 122 |
|
| 123 | +template_id = volume_template["uri"].split("/")[-1] |
| 124 | + |
120 | 125 | # Get storage volume template by id |
121 | 126 | try: |
122 | | - template_id = volume_template["uri"].split("/")[-1] |
123 | 127 | print("Get storage volume template by id: '{}'".format(template_id)) |
124 | 128 | volume_template_byid = oneview_client.storage_volume_templates.get(template_id) |
125 | 129 | print(" Found '{name}' at uri: {uri}".format(**volume_template_byid)) |
|
136 | 140 | volume_template_byname = oneview_client.storage_volume_templates.get_by('name', volume_template['name'])[0] |
137 | 141 | print(" Found '{name}' at uri: {uri}".format(**volume_template_byname)) |
138 | 142 |
|
| 143 | +# Gets the storage templates that are connected on the specified networks |
| 144 | +#print("Storage templates that are connected on the specified networks") |
| 145 | +#storage_templates=oneview_client.storage_volume_templates.get_reachable_volume_templates( |
| 146 | +# networks='/rest/fcoe-networks/7f0f74a0-4957-47ac-81c1-f573aa6d83de', |
| 147 | +# scope_uris='/rest/scopes/63d1ca81-95b3-41f1-a1ee-f9e1bc2d635f', |
| 148 | +# private_allowed_only=False) |
| 149 | +#print(storage_templates) |
| 150 | + |
| 151 | +# Retrieves all storage systems that is applicable to the storage volume template. |
| 152 | +#print("Storage systems that is applicable to the storage volume template") |
| 153 | +#storage_systems = oneview_client.storage_volume_templates.get_compatible_systems(id_or_uri=template_id) |
| 154 | +#print(storage_systems) |
| 155 | + |
139 | 156 | # Remove storage volume template |
140 | 157 | print("Delete storage volume template") |
141 | 158 | oneview_client.storage_volume_templates.delete(volume_template) |
|
0 commit comments