Skip to content

Commit 292e77b

Browse files
committed
Fix marvin test to add S3 image store and cache storage.
1 parent fa11575 commit 292e77b

9 files changed

Lines changed: 177 additions & 5 deletions

File tree

client/tomcatconf/commands.properties.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ listS3s=1
245245
addImageStore=1
246246
listImageStores=1
247247
deleteImageStore=1
248+
createCacheStore=1
248249

249250
#### host commands
250251
addHost=3

core/src/com/cloud/storage/resource/LocalNfsSecondaryStorageResource.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
public class LocalNfsSecondaryStorageResource extends
3333
NfsSecondaryStorageResource {
3434

35+
public LocalNfsSecondaryStorageResource(){
36+
this._dlMgr = new DownloadManagerImpl();
37+
}
38+
3539
@Override
3640
public Answer executeRequest(Command cmd) {
3741
if (cmd instanceof DownloadSystemTemplateCommand){

engine/storage/src/org/apache/cloudstack/storage/LocalHostEndpoint.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class LocalHostEndpoint implements EndPoint {
2323
private ScheduledExecutorService executor;
2424
ServerResource resource;
2525
public LocalHostEndpoint() {
26-
resource = ComponentContext.inject(LocalNfsSecondaryStorageResource.class);
26+
resource = new LocalNfsSecondaryStorageResource();
2727
executor = Executors.newScheduledThreadPool(10);
2828
}
2929
@Override

server/src/com/cloud/server/ManagementServerImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,6 +2153,7 @@ public List<Class<?>> getCommands() {
21532153
cmdList.add(AddImageStoreCmd.class);
21542154
cmdList.add(ListImageStoresCmd.class);
21552155
cmdList.add(DeleteImageStoreCmd.class);
2156+
cmdList.add(CreateCacheStoreCmd.class);
21562157
return cmdList;
21572158
}
21582159

setup/db/db/schema-410to420.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ CREATE VIEW `cloud`.`image_store_view` AS
115115
left join
116116
`cloud`.`data_center` ON image_store.data_center_id = data_center.id
117117
left join
118-
`cloud`.`image_store_details` ON image_store_details.store_id = image_store.id;
118+
`cloud`.`image_store_details` ON image_store_details.store_id = image_store.id
119+
where image_store.role = 'Image';
119120

120121
-- here we have to allow null for store_id to accomodate baremetal case to search for ready templates since template state is only stored in this table
121122
-- FK also commented out due to this

tools/devcloud/devcloud.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"secondaryStorages": [
8585
{
8686
"url": "nfs://192.168.56.10/opt/storage/secondary",
87-
"providerName": "CloudStack ImageStore Provider",
87+
"providerName": "NFS",
8888
"details": {
8989
}
9090
}

tools/devcloud/devcloud_s3.cfg

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
19+
{
20+
"zones": [
21+
{
22+
"name": "DevCloud0",
23+
"physical_networks": [
24+
{
25+
"broadcastdomainrange": "Zone",
26+
"name": "test-network",
27+
"traffictypes": [
28+
{
29+
"typ": "Guest"
30+
},
31+
{
32+
"typ": "Management"
33+
}
34+
],
35+
"providers": [
36+
{
37+
"broadcastdomainrange": "ZONE",
38+
"name": "VirtualRouter"
39+
},
40+
{
41+
"broadcastdomainrange": "Pod",
42+
"name": "SecurityGroupProvider"
43+
}
44+
]
45+
}
46+
],
47+
"dns2": "4.4.4.4",
48+
"dns1": "8.8.8.8",
49+
"securitygroupenabled": "true",
50+
"localstorageenabled": "true",
51+
"networktype": "Basic",
52+
"pods": [
53+
{
54+
"endip": "192.168.56.220",
55+
"name": "test00",
56+
"startip": "192.168.56.200",
57+
"guestIpRanges": [
58+
{
59+
"startip": "192.168.56.100",
60+
"endip": "192.168.56.199",
61+
"netmask": "255.255.255.0",
62+
"gateway": "192.168.56.1"
63+
}
64+
],
65+
"netmask": "255.255.255.0",
66+
"clusters": [
67+
{
68+
"clustername": "test000",
69+
"hypervisor": "XenServer",
70+
"hosts": [
71+
{
72+
"username": "root",
73+
"url": "http://192.168.56.10/",
74+
"password": "password"
75+
}
76+
],
77+
"clustertype": "CloudManaged"
78+
}
79+
],
80+
"gateway": "192.168.56.1"
81+
}
82+
],
83+
"internaldns1": "192.168.56.1",
84+
"secondaryStorages": [
85+
{
86+
"providerName": "S3",
87+
"details": [
88+
{
89+
"key" : "accesskey",
90+
"value" :"OYAZXCAFUC1DAFOXNJWI"
91+
},
92+
{
93+
"key" : "secretkey",
94+
"value" : "OYAZXCAFUC1DAFOXNJWI"
95+
},
96+
{
97+
"key" : "endpoint",
98+
"value" : "10.223.89.7:8080"
99+
},
100+
{
101+
"key" : "bucket",
102+
"value" : "cloudstack"
103+
}
104+
]
105+
}
106+
],
107+
"cacheStorages": [
108+
{
109+
"url": "nfs://192.168.56.10/opt/storage/cache",
110+
"providerName": "NFS",
111+
"details": [
112+
]
113+
}
114+
]
115+
}
116+
],
117+
"logger": [
118+
{
119+
"name": "TestClient",
120+
"file": "/tmp/testclient.log"
121+
},
122+
{
123+
"name": "TestCase",
124+
"file": "/tmp/testcase.log"
125+
}
126+
],
127+
"mgtSvr": [
128+
{
129+
"mgtSvrIp": "127.0.0.1",
130+
"port": 8096
131+
}
132+
],
133+
"dbSvr":
134+
{
135+
"dbSvr": "127.0.0.1",
136+
"port": 3306,
137+
"user": "cloud",
138+
"passwd": "cloud",
139+
"db": "cloud"
140+
}
141+
}

tools/marvin/marvin/configGenerator.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def __init__(self):
7070
self.physical_networks = []
7171
self.pods = []
7272
self.secondaryStorages = []
73+
self.cacheStorages = []
7374

7475

7576
class traffictype():
@@ -182,6 +183,12 @@ def __init__(self):
182183
self.providerName = None
183184
self.details = None
184185

186+
class cacheStorage():
187+
def __init__(self):
188+
self.url = None
189+
self.providerName = None
190+
self.details = None
191+
185192
class s3():
186193
def __init__(self):
187194
self.accesskey = None

tools/marvin/marvin/deployDataCenter.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,26 @@ def createSecondaryStorages(self, secondaryStorages, zoneId):
141141
secondarycmd = addImageStore.addImageStoreCmd()
142142
secondarycmd.url = secondary.url
143143
secondarycmd.provider = secondary.providerName
144-
"""if secondary.provider == "CloudStack ImageStore Provider":"""
145-
secondarycmd.zoneid = zoneId
144+
secondarycmd.details = []
145+
for item in secondary.details:
146+
secondarycmd.details.append(item.__dict__)
147+
if secondarycmd.provider == "NFS":
148+
secondarycmd.zoneid = zoneId
146149
self.apiClient.addImageStore(secondarycmd)
147150

151+
def createCacheStorages(self, cacheStorages, zoneId):
152+
if cacheStorages is None:
153+
return
154+
for cache in cacheStorages:
155+
cachecmd = createCacheStore.createCacheStoreCmd()
156+
cachecmd.url = cache.url
157+
cachecmd.provider = cache.providerName
158+
cachecmd.zoneid = zoneId
159+
cachecmd.details = []
160+
for item in cache.details:
161+
cachecmd.details.append(item.__dict__)
162+
self.apiClient.createCacheStore(cachecmd)
163+
148164
def createnetworks(self, networks, zoneId):
149165
if networks is None:
150166
return
@@ -322,6 +338,7 @@ def createZones(self, zones):
322338
zoneId)
323339

324340
self.createSecondaryStorages(zone.secondaryStorages, zoneId)
341+
self.createCacheStorages(zone.cacheStorages, zoneId)
325342
self.enableZone(zoneId, "Enabled")
326343
return
327344

0 commit comments

Comments
 (0)