Skip to content

Commit 5a72044

Browse files
author
Alena Prokharchyk
committed
Merge branch 'master' into vpc
2 parents 237d91d + e9a7495 commit 5a72044

329 files changed

Lines changed: 4964 additions & 13783 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one
4+
or more contributor license agreements. See the NOTICE file
5+
distributed with this work for additional information
6+
regarding copyright ownership. The ASF licenses this file
7+
to you under the Apache License, Version 2.0 (the
8+
"License"); you may not use this file except in compliance
9+
with the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing,
14+
software distributed under the License is distributed on an
15+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
KIND, either express or implied. See the License for the
17+
specific language governing permissions and limitations
18+
under the License.
19+
-->
220
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
321
<body>
422
<a href="http://cloud.com"><img src="docs/images/logo_cloud.jpg"></a>

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
# License
2+
3+
Licensed to the Apache Software Foundation (ASF) under one
4+
or more contributor license agreements. See the NOTICE file
5+
distributed with this work for additional information
6+
regarding copyright ownership. The ASF licenses this file
7+
to you under the Apache License, Version 2.0 (the
8+
"License"); you may not use this file except in compliance
9+
with the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing,
14+
software distributed under the License is distributed on an
15+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
KIND, either express or implied. See the License for the
17+
specific language governing permissions and limitations
18+
under the License.
19+
120
# Apache CloudStack
221

322
Apache CloudStack is a massively scalable free/libre open source Infrastructure as a Service cloud platform.

agent-simulator/src/com/cloud/agent/manager/MockAgentManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ public interface MockAgentManager extends Manager {
5050
Answer checkHealth(CheckHealthCommand cmd);
5151
Answer pingTest(PingTestCommand cmd);
5252

53-
Answer PrepareForMigration(PrepareForMigrationCommand cmd);
53+
Answer prepareForMigrate(PrepareForMigrationCommand cmd);
5454

5555
MockHost getHost(String guid);
5656

57-
Answer MaintainCommand(MaintainCommand cmd);
57+
Answer maintain(MaintainCommand cmd);
5858

5959
Answer checkNetworkCommand(CheckNetworkCommand cmd);
6060
}

agent-simulator/src/com/cloud/agent/manager/MockAgentManagerImpl.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@
4545
import com.cloud.agent.api.PingTestCommand;
4646
import com.cloud.agent.api.PrepareForMigrationAnswer;
4747
import com.cloud.agent.api.PrepareForMigrationCommand;
48-
import com.cloud.agent.api.StartupCommand;
48+
import com.cloud.agent.api.to.VirtualMachineTO;
4949
import com.cloud.dc.dao.HostPodDao;
5050
import com.cloud.host.Host;
51-
import com.cloud.host.Host.Type;
5251
import com.cloud.resource.AgentResourceBase;
5352
import com.cloud.resource.AgentRoutingResource;
5453
import com.cloud.resource.AgentStorageResource;
@@ -340,7 +339,11 @@ public Answer pingTest(PingTestCommand cmd) {
340339

341340

342341
@Override
343-
public PrepareForMigrationAnswer PrepareForMigration(PrepareForMigrationCommand cmd) {
342+
public PrepareForMigrationAnswer prepareForMigrate(PrepareForMigrationCommand cmd) {
343+
VirtualMachineTO vm = cmd.getVirtualMachine();
344+
if (s_logger.isDebugEnabled()) {
345+
s_logger.debug("Preparing host for migrating " + vm);
346+
}
344347
return new PrepareForMigrationAnswer(cmd);
345348
}
346349

@@ -364,7 +367,7 @@ public String getName() {
364367

365368

366369
@Override
367-
public MaintainAnswer MaintainCommand(com.cloud.agent.api.MaintainCommand cmd) {
370+
public MaintainAnswer maintain(com.cloud.agent.api.MaintainCommand cmd) {
368371
return new MaintainAnswer(cmd);
369372
}
370373

agent-simulator/src/com/cloud/agent/manager/MockVmManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public interface MockVmManager extends Manager {
5555
public Answer stopVM(StopCommand cmd);
5656
public Answer rebootVM(RebootCommand cmd);
5757

58-
public Answer checkVmState(CheckVirtualMachineCommand cmd, String hostGuid);
58+
public Answer checkVmState(CheckVirtualMachineCommand cmd);
5959
public Map<String, State> getVmStates(String hostGuid);
6060
public Answer getVncPort(GetVncPortCommand cmd);
6161

agent-simulator/src/com/cloud/agent/manager/MockVmManagerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ public Answer getVmStats(GetVmStatsCommand cmd) {
243243
}
244244

245245
@Override
246-
public CheckVirtualMachineAnswer checkVmState(CheckVirtualMachineCommand cmd, String hostGuid) {
247-
MockVMVO vm = _mockVmDao.findByVmNameAndHost(cmd.getVmName(), hostGuid);
246+
public CheckVirtualMachineAnswer checkVmState(CheckVirtualMachineCommand cmd) {
247+
MockVMVO vm = _mockVmDao.findByVmName(cmd.getVmName());
248248
if (vm == null) {
249249
return new CheckVirtualMachineAnswer(cmd, "can't find vm:" + cmd.getVmName());
250250
}

agent-simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.sql.Connection;
2020
import java.sql.SQLException;
2121
import java.util.HashMap;
22-
import java.util.List;
2322
import java.util.Map;
2423

2524
import javax.ejb.Local;
@@ -33,6 +32,7 @@
3332
import com.cloud.agent.api.BackupSnapshotCommand;
3433
import com.cloud.agent.api.CheckHealthCommand;
3534
import com.cloud.agent.api.CheckNetworkCommand;
35+
import com.cloud.agent.api.CheckVirtualMachineCommand;
3636
import com.cloud.agent.api.CleanupNetworkRulesCmd;
3737
import com.cloud.agent.api.ClusterSyncCommand;
3838
import com.cloud.agent.api.Command;
@@ -54,6 +54,7 @@
5454
import com.cloud.agent.api.ModifyStoragePoolCommand;
5555
import com.cloud.agent.api.NetworkUsageCommand;
5656
import com.cloud.agent.api.PingTestCommand;
57+
import com.cloud.agent.api.PrepareForMigrationCommand;
5758
import com.cloud.agent.api.RebootCommand;
5859
import com.cloud.agent.api.SecStorageSetupCommand;
5960
import com.cloud.agent.api.SecStorageVMSetupCommand;
@@ -80,7 +81,6 @@
8081
import com.cloud.agent.api.storage.DownloadProgressCommand;
8182
import com.cloud.agent.api.storage.ListTemplateCommand;
8283
import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
83-
import com.cloud.agent.mockvm.MockVm;
8484
import com.cloud.simulator.MockConfigurationVO;
8585
import com.cloud.simulator.MockHost;
8686
import com.cloud.simulator.MockVMVO;
@@ -197,12 +197,16 @@ public Answer simulate(Command cmd, String hostGuid) {
197197
return _mockAgentMgr.checkHealth((CheckHealthCommand)cmd);
198198
} else if (cmd instanceof PingTestCommand) {
199199
return _mockAgentMgr.pingTest((PingTestCommand)cmd);
200+
} else if (cmd instanceof PrepareForMigrationCommand) {
201+
return _mockAgentMgr.prepareForMigrate((PrepareForMigrationCommand)cmd);
200202
} else if (cmd instanceof MigrateCommand) {
201203
return _mockVmMgr.Migrate((MigrateCommand)cmd, info);
202204
} else if (cmd instanceof StartCommand) {
203205
return _mockVmMgr.startVM((StartCommand)cmd, info);
204206
} else if (cmd instanceof CheckSshCommand) {
205207
return _mockVmMgr.checkSshCommand((CheckSshCommand)cmd);
208+
} else if (cmd instanceof CheckVirtualMachineCommand) {
209+
return _mockVmMgr.checkVmState((CheckVirtualMachineCommand)cmd);
206210
} else if (cmd instanceof SetStaticNatRulesCommand) {
207211
return _mockVmMgr.SetStaticNatRules((SetStaticNatRulesCommand)cmd);
208212
} else if (cmd instanceof SetFirewallRulesCommand) {
@@ -282,7 +286,7 @@ public Answer simulate(Command cmd, String hostGuid) {
282286
} else if (cmd instanceof CreatePrivateTemplateFromVolumeCommand) {
283287
return _mockStorageMgr.CreatePrivateTemplateFromVolume((CreatePrivateTemplateFromVolumeCommand)cmd);
284288
} else if (cmd instanceof MaintainCommand) {
285-
return _mockAgentMgr.MaintainCommand((MaintainCommand)cmd);
289+
return _mockAgentMgr.maintain((MaintainCommand)cmd);
286290
} else if (cmd instanceof GetVmStatsCommand) {
287291
return _mockVmMgr.getVmStats((GetVmStatsCommand)cmd);
288292
} else if (cmd instanceof GetDomRVersionCmd) {

agent-simulator/src/com/cloud/resource/AgentRoutingResource.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import com.cloud.agent.api.Command;
3434
import com.cloud.agent.api.PingCommand;
3535
import com.cloud.agent.api.PingRoutingWithNwGroupsCommand;
36+
import com.cloud.agent.api.PrepareForMigrationAnswer;
3637
import com.cloud.agent.api.PrepareForMigrationCommand;
3738
import com.cloud.agent.api.ReadyAnswer;
3839
import com.cloud.agent.api.ReadyCommand;
@@ -85,8 +86,6 @@ public Answer executeRequest(Command cmd) {
8586
return execute((StartCommand) cmd);
8687
} else if (cmd instanceof StopCommand) {
8788
return execute((StopCommand) cmd);
88-
} else if (cmd instanceof PrepareForMigrationCommand) {
89-
return execute((PrepareForMigrationCommand) cmd);
9089
} else if (cmd instanceof CheckVirtualMachineCommand) {
9190
return execute((CheckVirtualMachineCommand) cmd);
9291
} else if (cmd instanceof ReadyCommand) {
@@ -191,7 +190,7 @@ protected synchronized Answer execute(StartCommand cmd)
191190
String vmName = vmSpec.getName();
192191
if (this.totalCpu < (vmSpec.getCpus() * vmSpec.getSpeed() + this.usedCpu) ||
193192
this.totalMem < (vmSpec.getMaxRam() + this.usedMem)) {
194-
return new StartAnswer(cmd, "No enough resource to start the vm");
193+
return new StartAnswer(cmd, "Not enough resource to start the vm");
195194
}
196195
State state = State.Stopped;
197196
synchronized (_vms) {

api/src/com/cloud/storage/Volume.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ enum State {
3636
Snapshotting("There is a snapshot created on this volume, not backed up to secondary storage yet"),
3737
Expunging("The volume is being expunging"),
3838
Destroy("The volume is destroyed, and can't be recovered."),
39-
UploadOp ("The volume upload operation is in progress");
39+
UploadOp ("The volume upload operation is in progress or in short the volume is on secondary storage");
4040

4141
String _description;
4242

@@ -61,9 +61,10 @@ public String getDescription() {
6161
s_fsm.addTransition(Creating, Event.OperationSucceeded, Ready);
6262
s_fsm.addTransition(Creating, Event.DestroyRequested, Destroy);
6363
s_fsm.addTransition(Creating, Event.CreateRequested, Creating);
64-
s_fsm.addTransition(Allocated, Event.UploadRequested, UploadOp);
64+
s_fsm.addTransition(Allocated, Event.UploadRequested, UploadOp);
65+
s_fsm.addTransition(UploadOp, Event.CopyRequested, Creating);// CopyRequested for volume from sec to primary storage
6566
s_fsm.addTransition(Creating, Event.CopySucceeded, Ready);
66-
s_fsm.addTransition(UploadOp, Event.CopySucceeded, Ready);
67+
s_fsm.addTransition(Creating, Event.CopyFailed, UploadOp);// Copying volume from sec to primary failed.
6768
s_fsm.addTransition(UploadOp, Event.DestroyRequested, Destroy);
6869
s_fsm.addTransition(Ready, Event.DestroyRequested, Destroy);
6970
s_fsm.addTransition(Destroy, Event.ExpungingRequested, Expunging);

configure-info.in

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
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+
118
These are the configure-time variables used to compile this CloudStack:
219

320
@CONFIGUREVARS@

0 commit comments

Comments
 (0)