Skip to content

Commit f101241

Browse files
committed
1 parent 48540dc commit f101241

17 files changed

Lines changed: 724 additions & 55 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
package com.cloud.agent.api.storage;
18+
19+
import com.cloud.agent.api.Answer;
20+
21+
public class CreateVolumeOVAAnswer extends Answer {
22+
public CreateVolumeOVAAnswer(CreateVolumeOVACommand cmd, boolean result, String details) {
23+
super(cmd, result, details);
24+
}
25+
26+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
package com.cloud.agent.api.storage;
18+
19+
import com.cloud.agent.api.Command;
20+
import com.cloud.agent.api.to.StorageFilerTO;
21+
import com.cloud.storage.StoragePool;
22+
23+
public class CreateVolumeOVACommand extends Command {
24+
String secUrl;
25+
String volPath;
26+
String volName;
27+
StorageFilerTO pool;
28+
29+
public CreateVolumeOVACommand() {
30+
}
31+
32+
public CreateVolumeOVACommand(String secUrl, String volPath, String volName, StoragePool pool, int wait) {
33+
this.secUrl = secUrl;
34+
this.volPath = volPath;
35+
this.volName = volName;
36+
this.pool = new StorageFilerTO(pool);
37+
setWait(wait);
38+
}
39+
40+
@Override
41+
public boolean executeInSequence() {
42+
return true;
43+
}
44+
45+
public String getVolPath() {
46+
return this.volPath;
47+
}
48+
49+
public String getVolName() {
50+
return this.volName;
51+
}
52+
public String getSecondaryStorageUrl() {
53+
return this.secUrl;
54+
}
55+
public StorageFilerTO getPool() {
56+
return pool;
57+
}
58+
}
59+
60+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
package com.cloud.agent.api.storage;
18+
19+
import com.cloud.agent.api.Answer;
20+
21+
public class PrepareOVAPackingAnswer extends Answer {
22+
public PrepareOVAPackingAnswer(PrepareOVAPackingCommand cmd, boolean result, String details) {
23+
super(cmd, result, details);
24+
}
25+
26+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
package com.cloud.agent.api.storage;
18+
19+
import com.cloud.agent.api.Command;
20+
21+
public class PrepareOVAPackingCommand extends Command {
22+
private String templatePath;
23+
private String secUrl;
24+
25+
public PrepareOVAPackingCommand() {
26+
}
27+
28+
public PrepareOVAPackingCommand(String secUrl, String templatePath) {
29+
this.secUrl = secUrl;
30+
this.templatePath = templatePath;
31+
}
32+
33+
@Override
34+
public boolean executeInSequence() {
35+
return true;
36+
}
37+
38+
public String getTemplatePath() {
39+
return this.templatePath;
40+
}
41+
42+
public String getSecondaryStorageUrl() {
43+
return this.secUrl;
44+
}
45+
46+
}
47+
48+

api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ public void create() throws ResourceAllocationException {
163163

164164
@Override
165165
public void execute() {
166+
s_logger.info("VOLSS: createSnapshotCmd starts:" + System.currentTimeMillis());
166167
UserContext.current().setEventDetails("Volume Id: "+getVolumeId());
167168
Snapshot snapshot = _snapshotService.createSnapshot(getVolumeId(), getPolicyId(), getEntityId(), _accountService.getAccount(getEntityOwnerId()));
168169
if (snapshot != null) {
@@ -172,6 +173,7 @@ public void execute() {
172173
} else {
173174
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot for volume " + volumeId);
174175
}
176+
s_logger.info("VOLSS: backupSnapshotCmd finishes:" + System.currentTimeMillis());
175177
}
176178

177179

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import com.cloud.agent.api.storage.CopyVolumeCommand;
2222
import com.cloud.agent.api.storage.CreateAnswer;
2323
import com.cloud.agent.api.storage.CreateCommand;
24+
import com.cloud.agent.api.storage.CreateVolumeOVAAnswer;
25+
import com.cloud.agent.api.storage.CreateVolumeOVACommand;
2426
import com.cloud.agent.api.storage.DestroyCommand;
2527
import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer;
2628
import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
@@ -34,5 +36,7 @@ public interface StoragePoolResource {
3436

3537
CopyVolumeAnswer execute(CopyVolumeCommand cmd);
3638

39+
CreateVolumeOVAAnswer execute(CreateVolumeOVACommand cmd);
40+
3741
CreateAnswer execute(CreateCommand cmd);
3842
}

plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
import com.cloud.agent.api.CreateVolumeFromSnapshotCommand;
3939
import com.cloud.agent.api.UnregisterVMCommand;
4040
import com.cloud.agent.api.storage.CopyVolumeCommand;
41+
import com.cloud.agent.api.storage.CreateVolumeOVACommand;
42+
import com.cloud.agent.api.storage.PrepareOVAPackingCommand;
4143
import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
4244
import com.cloud.agent.api.to.NicTO;
4345
import com.cloud.agent.api.to.VirtualMachineTO;
@@ -282,10 +284,18 @@ public long getCommandHostDelegation(long hostId, Command cmd) {
282284
cmd instanceof CreatePrivateTemplateFromVolumeCommand ||
283285
cmd instanceof CreatePrivateTemplateFromSnapshotCommand ||
284286
cmd instanceof CopyVolumeCommand ||
287+
cmd instanceof CreateVolumeOVACommand ||
288+
cmd instanceof PrepareOVAPackingCommand ||
285289
cmd instanceof CreateVolumeFromSnapshotCommand) {
286290
needDelegation = true;
287291
}
292+
/* Fang: remove this before checking in */
293+
// needDelegation = false;
288294

295+
if (cmd instanceof PrepareOVAPackingCommand ||
296+
cmd instanceof CreateVolumeOVACommand ) {
297+
cmd.setContextParam("hypervisor", HypervisorType.VMware.toString());
298+
}
289299
if(needDelegation) {
290300
HostVO host = _hostDao.findById(hostId);
291301
assert(host != null);
@@ -311,6 +321,8 @@ public long getCommandHostDelegation(long hostId, Command cmd) {
311321
cmd instanceof CreatePrivateTemplateFromVolumeCommand ||
312322
cmd instanceof CreatePrivateTemplateFromSnapshotCommand ||
313323
cmd instanceof CopyVolumeCommand ||
324+
cmd instanceof CreateVolumeOVACommand ||
325+
cmd instanceof PrepareOVAPackingCommand ||
314326
cmd instanceof CreateVolumeFromSnapshotCommand) {
315327

316328
String workerName = _vmwareMgr.composeWorkerName();

plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
import com.cloud.agent.api.DeleteVMSnapshotCommand;
2626
import com.cloud.agent.api.RevertToVMSnapshotCommand;
2727
import com.cloud.agent.api.storage.CopyVolumeCommand;
28+
import com.cloud.agent.api.storage.PrepareOVAPackingCommand;
29+
import com.cloud.agent.api.storage.CreateVolumeOVACommand;
2830
import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
2931

3032
public interface VmwareStorageManager {
@@ -33,6 +35,8 @@ public interface VmwareStorageManager {
3335
Answer execute(VmwareHostService hostService, CreatePrivateTemplateFromVolumeCommand cmd);
3436
Answer execute(VmwareHostService hostService, CreatePrivateTemplateFromSnapshotCommand cmd);
3537
Answer execute(VmwareHostService hostService, CopyVolumeCommand cmd);
38+
Answer execute(VmwareHostService hostService, CreateVolumeOVACommand cmd);
39+
Answer execute(VmwareHostService hostService, PrepareOVAPackingCommand cmd);
3640
Answer execute(VmwareHostService hostService, CreateVolumeFromSnapshotCommand cmd);
3741
Answer execute(VmwareHostService hostService, CreateVMSnapshotCommand cmd);
3842
Answer execute(VmwareHostService hostService, DeleteVMSnapshotCommand cmd);

0 commit comments

Comments
 (0)