Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit e5c8713

Browse files
committed
Changes to support API 600
1 parent 989c0b0 commit e5c8713

File tree

2 files changed

+27
-18
lines changed

2 files changed

+27
-18
lines changed

examples/storage_volume_templates.py

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@
2727
from config_loader import try_load_from_file
2828

2929
config = {
30-
"ip": "172.16.102.59",
30+
"ip": "16.124.133.232",
3131
"credentials": {
3232
"userName": "administrator",
33-
"password": ""
34-
}
33+
"password": "ecosystem"
34+
},
35+
"api_version": 600
3536
}
3637

3738
# Try load config from a file (if there is a config file)
@@ -41,10 +42,11 @@
4142

4243
options = {
4344
"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": ""},
4850
"description": "sample description"
4951
}
5052

@@ -101,7 +103,8 @@
101103

102104
# Create storage volume template
103105
print("Create storage volume template")
104-
options['provisioning']['storagePoolUri'] = storage_pool['uri']
106+
#options["provisioning"]["storagePoolUri"] = storage_pool["uri"]
107+
print options
105108
volume_template = oneview_client.storage_volume_templates.create(options)
106109
pprint(volume_template)
107110

@@ -117,9 +120,10 @@
117120
for template in volume_templates:
118121
print(" '{name}' at uri: {uri}".format(**template))
119122

123+
template_id = volume_template["uri"].split("/")[-1]
124+
120125
# Get storage volume template by id
121126
try:
122-
template_id = volume_template["uri"].split("/")[-1]
123127
print("Get storage volume template by id: '{}'".format(template_id))
124128
volume_template_byid = oneview_client.storage_volume_templates.get(template_id)
125129
print(" Found '{name}' at uri: {uri}".format(**volume_template_byid))
@@ -136,6 +140,19 @@
136140
volume_template_byname = oneview_client.storage_volume_templates.get_by('name', volume_template['name'])[0]
137141
print(" Found '{name}' at uri: {uri}".format(**volume_template_byname))
138142

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+
139156
# Remove storage volume template
140157
print("Delete storage volume template")
141158
oneview_client.storage_volume_templates.delete(volume_template)

hpOneView/resources/storage/storage_volume_templates.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,10 @@ def get_reachable_volume_templates(self, start=0, count=-1, filter='', query='',
130130
"""
131131
uri = self.URI + "/reachable-volume-templates"
132132

133-
if networks:
134-
elements = "\'"
135-
for n in networks:
136-
elements += n + ','
137-
elements = elements[:-1] + "\'"
138-
uri = uri + "?networks=" + elements
133+
uri += "?networks={}&privateAllowedOnly={}".format(networks, private_allowed_only)
139134

140135
get_uri = self._client.build_query_uri(start=start, count=count, filter=filter,
141136
query=query, sort=sort, uri=uri, scope_uris=scope_uris)
142-
143-
get_uri += '&privateAllowedOnly={}'.format(private_allowed_only)
144-
145137
return self._client.get(get_uri)
146138

147139
def get_compatible_systems(self, id_or_uri):

0 commit comments

Comments
 (0)