You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ni...@apache.org on 2013/05/11 11:59:55 UTC
[30/51] [partial] merge master
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PingTestCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PingTestCommand.java b/core/src/com/cloud/agent/api/PingTestCommand.java
new file mode 100644
index 0000000..69c6efa
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PingTestCommand.java
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+public class PingTestCommand extends Command {
+
+ String _computingHostIp = null;
+ String _routerIp = null;
+ String _privateIp = null;
+
+ public PingTestCommand() {}
+
+ public PingTestCommand(String computingHostIp) {
+ _computingHostIp = computingHostIp;
+ setWait(20);
+ }
+
+ public PingTestCommand(String routerIp, String privateIp) {
+ _routerIp = routerIp;
+ _privateIp = privateIp;
+ setWait(20);
+ }
+
+ public String getComputingHostIp() {
+ return _computingHostIp;
+ }
+
+ public String getRouterIp() {
+ return _routerIp;
+ }
+
+ public String getPrivateIp() {
+ return _privateIp;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PlugNicAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PlugNicAnswer.java b/core/src/com/cloud/agent/api/PlugNicAnswer.java
new file mode 100644
index 0000000..90d31bd
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PlugNicAnswer.java
@@ -0,0 +1,25 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+public class PlugNicAnswer extends Answer{
+ public PlugNicAnswer() {}
+
+ public PlugNicAnswer(PlugNicCommand cmd, boolean success, String result) {
+ super(cmd, success, result);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PlugNicCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PlugNicCommand.java b/core/src/com/cloud/agent/api/PlugNicCommand.java
new file mode 100644
index 0000000..b896e45
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PlugNicCommand.java
@@ -0,0 +1,46 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.to.NicTO;
+
+public class PlugNicCommand extends Command {
+
+ NicTO nic;
+ String instanceName;
+
+ public NicTO getNic() {
+ return nic;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ protected PlugNicCommand() {
+ }
+
+ public PlugNicCommand(NicTO nic, String instanceName) {
+ this.nic = nic;
+ this.instanceName = instanceName;
+ }
+
+ public String getVmName() {
+ return instanceName;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PoolEjectCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PoolEjectCommand.java b/core/src/com/cloud/agent/api/PoolEjectCommand.java
new file mode 100644
index 0000000..3085042
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PoolEjectCommand.java
@@ -0,0 +1,42 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+public class PoolEjectCommand extends Command {
+ private String hostuuid;
+
+ public String getHostuuid() {
+ return hostuuid;
+ }
+
+ public void setHostuuid(String hostuuid) {
+ this.hostuuid = hostuuid;
+ }
+ public PoolEjectCommand() {
+ super();
+ }
+ public PoolEjectCommand(String hostuuid) {
+ super();
+ setHostuuid(hostuuid);
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PrepareForMigrationAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PrepareForMigrationAnswer.java b/core/src/com/cloud/agent/api/PrepareForMigrationAnswer.java
new file mode 100644
index 0000000..1b215bc
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PrepareForMigrationAnswer.java
@@ -0,0 +1,34 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+public class PrepareForMigrationAnswer extends Answer {
+ protected PrepareForMigrationAnswer() {
+ }
+
+ public PrepareForMigrationAnswer(PrepareForMigrationCommand cmd, String detail) {
+ super(cmd, false, detail);
+ }
+
+ public PrepareForMigrationAnswer(PrepareForMigrationCommand cmd, Exception ex) {
+ super(cmd, ex);
+ }
+
+ public PrepareForMigrationAnswer(PrepareForMigrationCommand cmd) {
+ super(cmd, true, null);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PrepareForMigrationCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PrepareForMigrationCommand.java b/core/src/com/cloud/agent/api/PrepareForMigrationCommand.java
new file mode 100644
index 0000000..c0e1368
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PrepareForMigrationCommand.java
@@ -0,0 +1,39 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.to.VirtualMachineTO;
+
+public class PrepareForMigrationCommand extends Command {
+ VirtualMachineTO vm;
+
+ protected PrepareForMigrationCommand() {
+ }
+
+ public PrepareForMigrationCommand(VirtualMachineTO vm) {
+ this.vm = vm;
+ }
+
+ public VirtualMachineTO getVirtualMachine() {
+ return vm;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PrepareOCFS2NodesCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PrepareOCFS2NodesCommand.java b/core/src/com/cloud/agent/api/PrepareOCFS2NodesCommand.java
new file mode 100755
index 0000000..0c80bfa
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PrepareOCFS2NodesCommand.java
@@ -0,0 +1,44 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import java.util.List;
+
+import com.cloud.utils.Ternary;
+
+public class PrepareOCFS2NodesCommand extends Command {
+ List<Ternary<Integer, String, String>> nodes;
+ String clusterName;
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public PrepareOCFS2NodesCommand(String clusterName, List<Ternary<Integer, String, String>> nodes) {
+ this.nodes = nodes;
+ this.clusterName = clusterName;
+ }
+
+ public List<Ternary<Integer, String, String>> getNodes() {
+ return nodes;
+ }
+
+ public String getClusterName() {
+ return clusterName;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PropagateResourceEventCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PropagateResourceEventCommand.java b/core/src/com/cloud/agent/api/PropagateResourceEventCommand.java
new file mode 100755
index 0000000..45cd4b3
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PropagateResourceEventCommand.java
@@ -0,0 +1,48 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.resource.ResourceState;
+
+public class PropagateResourceEventCommand extends Command {
+ long hostId;
+ ResourceState.Event event;
+
+ protected PropagateResourceEventCommand() {
+
+ }
+
+ public PropagateResourceEventCommand(long hostId, ResourceState.Event event) {
+ this.hostId = hostId;
+ this.event = event;
+ }
+
+ public long getHostId() {
+ return hostId;
+ }
+
+ public ResourceState.Event getEvent() {
+ return event;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ReadyAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ReadyAnswer.java b/core/src/com/cloud/agent/api/ReadyAnswer.java
new file mode 100644
index 0000000..b5dd0b7
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ReadyAnswer.java
@@ -0,0 +1,31 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+public class ReadyAnswer extends Answer {
+ protected ReadyAnswer() {
+ }
+
+ public ReadyAnswer(ReadyCommand cmd) {
+ super(cmd, true, null);
+ }
+
+ public ReadyAnswer(ReadyCommand cmd, String details) {
+ super(cmd, false, details);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ReadyCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ReadyCommand.java b/core/src/com/cloud/agent/api/ReadyCommand.java
new file mode 100644
index 0000000..c6ca799
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ReadyCommand.java
@@ -0,0 +1,58 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+public class ReadyCommand extends Command {
+ private String _details;
+ public ReadyCommand() {
+ super();
+ }
+
+ private Long dcId;
+ private Long hostId;
+
+ public ReadyCommand(Long dcId) {
+ super();
+ this.dcId = dcId;
+ }
+
+ public ReadyCommand(Long dcId, Long hostId) {
+ this(dcId);
+ this.hostId = hostId;
+ }
+
+ public void setDetails(String details) {
+ _details = details;
+ }
+
+ public String getDetails() {
+ return _details;
+ }
+
+ public Long getDataCenterId() {
+ return dcId;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public Long getHostId() {
+ return hostId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/RebootAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/RebootAnswer.java b/core/src/com/cloud/agent/api/RebootAnswer.java
new file mode 100644
index 0000000..244bf1e
--- /dev/null
+++ b/core/src/com/cloud/agent/api/RebootAnswer.java
@@ -0,0 +1,42 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+public class RebootAnswer extends Answer {
+ Integer vncPort;
+
+ protected RebootAnswer() {
+ }
+
+ public RebootAnswer(RebootCommand cmd, String details, Integer vncport) {
+ super(cmd, true, details);
+ this.vncPort = vncport;
+ }
+
+ public RebootAnswer(RebootCommand cmd, String details, boolean success) {
+ super(cmd, success, details);
+ this.vncPort = null;
+ }
+
+ public RebootAnswer(RebootCommand cmd, Exception e) {
+ super(cmd, e);
+ }
+
+ public Integer getVncPort() {
+ return vncPort;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/RebootCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/RebootCommand.java b/core/src/com/cloud/agent/api/RebootCommand.java
new file mode 100755
index 0000000..49712b6
--- /dev/null
+++ b/core/src/com/cloud/agent/api/RebootCommand.java
@@ -0,0 +1,45 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.hypervisor.Hypervisor;
+import com.cloud.vm.VirtualMachine;
+
+public class RebootCommand extends Command {
+ String vmName;
+
+ protected RebootCommand() {
+ }
+
+ public RebootCommand(VirtualMachine vm) {
+ vmName = vm.getInstanceName();
+ }
+
+ public RebootCommand(String vmName) {
+ this.vmName = vmName;
+ }
+
+ public String getVmName() {
+ return vmName;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/RebootRouterCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/RebootRouterCommand.java b/core/src/com/cloud/agent/api/RebootRouterCommand.java
new file mode 100644
index 0000000..c5027b3
--- /dev/null
+++ b/core/src/com/cloud/agent/api/RebootRouterCommand.java
@@ -0,0 +1,38 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+
+public class RebootRouterCommand extends RebootCommand {
+
+ protected String privateIp;
+
+ protected RebootRouterCommand() {
+ }
+
+
+ public RebootRouterCommand(String vmName, String privateIp) {
+ super(vmName);
+ this.privateIp=privateIp;
+ }
+
+
+ public String getPrivateIpAddress() {
+ return privateIp;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java b/core/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java
new file mode 100644
index 0000000..848ffc0
--- /dev/null
+++ b/core/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java
@@ -0,0 +1,63 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+import com.cloud.vm.VirtualMachine;
+
+public class RevertToVMSnapshotAnswer extends Answer {
+
+ private List<VolumeTO> volumeTOs;
+ private VirtualMachine.State vmState;
+
+ public RevertToVMSnapshotAnswer(RevertToVMSnapshotCommand cmd, boolean result,
+ String message) {
+ super(cmd, result, message);
+ }
+
+ public RevertToVMSnapshotAnswer() {
+ super();
+ }
+
+ public RevertToVMSnapshotAnswer(RevertToVMSnapshotCommand cmd,
+ List<VolumeTO> volumeTOs,
+ VirtualMachine.State vmState) {
+ super(cmd, true, "");
+ this.volumeTOs = volumeTOs;
+ this.vmState = vmState;
+ }
+
+ public VirtualMachine.State getVmState() {
+ return vmState;
+ }
+
+ public List<VolumeTO> getVolumeTOs() {
+ return volumeTOs;
+ }
+
+ public void setVolumeTOs(List<VolumeTO> volumeTOs) {
+ this.volumeTOs = volumeTOs;
+ }
+
+ public void setVmState(VirtualMachine.State vmState) {
+ this.vmState = vmState;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java b/core/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
new file mode 100644
index 0000000..429a186
--- /dev/null
+++ b/core/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
@@ -0,0 +1,29 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+public class RevertToVMSnapshotCommand extends VMSnapshotBaseCommand {
+
+ public RevertToVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeTO> volumeTOs, String guestOSType) {
+ super(vmName, snapshot, volumeTOs, guestOSType);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ScaleVmAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ScaleVmAnswer.java b/core/src/com/cloud/agent/api/ScaleVmAnswer.java
new file mode 100644
index 0000000..31d6e44
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ScaleVmAnswer.java
@@ -0,0 +1,28 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+public class ScaleVmAnswer extends Answer {
+
+ protected ScaleVmAnswer() {
+ }
+
+ public ScaleVmAnswer(ScaleVmCommand cmd, boolean result, String detail) {
+ super(cmd, result, detail);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ScaleVmCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ScaleVmCommand.java b/core/src/com/cloud/agent/api/ScaleVmCommand.java
new file mode 100644
index 0000000..35d22ad
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ScaleVmCommand.java
@@ -0,0 +1,113 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.to.VirtualMachineTO;
+
+public class ScaleVmCommand extends Command {
+
+ VirtualMachineTO vm;
+ String vmName;
+ int cpus;
+ Integer speed;
+ long minRam;
+ long maxRam;
+
+ public VirtualMachineTO getVm() {
+ return vm;
+ }
+
+ public void setVm(VirtualMachineTO vm) {
+ this.vm = vm;
+ }
+
+ public int getCpus() {
+ return cpus;
+ }
+
+ public ScaleVmCommand(String vmName, int cpus,
+ Integer speed, long minRam, long maxRam, boolean limitCpuUse) {
+ super();
+ this.vmName = vmName;
+ this.cpus = cpus;
+ this.speed = speed;
+ this.minRam = minRam;
+ this.maxRam = maxRam;
+ this.vm = new VirtualMachineTO(1L, vmName, null, cpus, speed, minRam, maxRam, null, null, false, false, null);
+ /*vm.setName(vmName);
+ vm.setCpus(cpus);
+ vm.setRam(minRam, maxRam);*/
+ }
+
+ public void setCpus(int cpus) {
+ this.cpus = cpus;
+ }
+
+ public Integer getSpeed() {
+ return speed;
+ }
+
+ public void setSpeed(Integer speed) {
+ this.speed = speed;
+ }
+
+ public long getMinRam() {
+ return minRam;
+ }
+
+ public void setMinRam(long minRam) {
+ this.minRam = minRam;
+ }
+
+ public long getMaxRam() {
+ return maxRam;
+ }
+
+ public void setMaxRam(long maxRam) {
+ this.maxRam = maxRam;
+ }
+
+ public String getVmName() {
+ return vmName;
+ }
+
+ public void setVmName(String vmName) {
+ this.vmName = vmName;
+ }
+
+ public VirtualMachineTO getVirtualMachine() {
+ return vm;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ protected ScaleVmCommand() {
+ }
+
+ public ScaleVmCommand(VirtualMachineTO vm) {
+ this.vm = vm;
+ }
+
+ public boolean getLimitCpuUse() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java b/core/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java
new file mode 100755
index 0000000..e938de7
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java
@@ -0,0 +1,32 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+/*
+ * This is used to schedule an explicit host scan in MS peers. Currently used during
+ * add host operation so that correct MS can take host ownership. On receiving the
+ * command the scan is scheduled immediately.
+ */
+public class ScheduleHostScanTaskCommand extends Command {
+ public ScheduleHostScanTaskCommand() {
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false; // standalone command and can be executed independent of other commands
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SecStorageFirewallCfgCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SecStorageFirewallCfgCommand.java b/core/src/com/cloud/agent/api/SecStorageFirewallCfgCommand.java
new file mode 100755
index 0000000..41a779b
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SecStorageFirewallCfgCommand.java
@@ -0,0 +1,82 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SecStorageFirewallCfgCommand extends Command {
+
+ public static class PortConfig {
+ boolean add;
+ String sourceIp;
+ String port;
+ String intf;
+ public PortConfig(String sourceIp, String port, boolean add, String intf) {
+ this.add = add;
+ this.sourceIp = sourceIp;
+ this.port = port;
+ this.intf = intf;
+ }
+ public PortConfig() {
+
+ }
+ public boolean isAdd() {
+ return add;
+ }
+ public String getSourceIp() {
+ return sourceIp;
+ }
+ public String getPort() {
+ return port;
+ }
+ public String getIntf() {
+ return intf;
+ }
+ }
+
+ private List<PortConfig> portConfigs = new ArrayList<PortConfig>();
+ private boolean isAppendAIp = false;
+
+ public SecStorageFirewallCfgCommand() {
+
+ }
+
+ public SecStorageFirewallCfgCommand(boolean isAppend) {
+ this.isAppendAIp = isAppend;
+ }
+
+ public void addPortConfig(String sourceIp, String port, boolean add, String intf) {
+ PortConfig pc = new PortConfig(sourceIp, port, add, intf);
+ this.portConfigs.add(pc);
+
+ }
+
+ public boolean getIsAppendAIp() {
+ return isAppendAIp;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+
+
+ public List<PortConfig> getPortConfigs() {
+ return portConfigs;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SecStorageSetupAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SecStorageSetupAnswer.java b/core/src/com/cloud/agent/api/SecStorageSetupAnswer.java
new file mode 100644
index 0000000..bb0c016
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SecStorageSetupAnswer.java
@@ -0,0 +1,33 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+public class SecStorageSetupAnswer extends Answer {
+ private String _dir;
+ protected SecStorageSetupAnswer() {
+ }
+
+ public SecStorageSetupAnswer(String dir) {
+ super(null, true, "success");
+ this._dir = dir;
+ }
+
+ public String get_dir() {
+ return _dir;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SecStorageSetupCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SecStorageSetupCommand.java b/core/src/com/cloud/agent/api/SecStorageSetupCommand.java
new file mode 100644
index 0000000..50c06cf
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SecStorageSetupCommand.java
@@ -0,0 +1,83 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+
+public class SecStorageSetupCommand extends Command {
+ private String secUrl;
+ private Certificates certs;
+
+ public static class Certificates {
+ @LogLevel(Log4jLevel.Off)
+ private String privKey;
+ @LogLevel(Log4jLevel.Off)
+ private String privCert;
+ @LogLevel(Log4jLevel.Off)
+ private String certChain;
+
+ public Certificates() {
+
+ }
+
+ public Certificates(String prvKey, String privCert, String certChain) {
+ this.privKey = prvKey;
+ this.privCert = privCert;
+ this.certChain = certChain;
+ }
+
+ public String getPrivKey() {
+ return this.privKey;
+ }
+
+ public String getPrivCert() {
+ return this.privCert;
+ }
+
+ public String getCertChain() {
+ return this.certChain;
+ }
+ }
+
+ public SecStorageSetupCommand() {
+ super();
+ }
+
+ public SecStorageSetupCommand(String secUrl, Certificates certs) {
+ super();
+ this.secUrl = secUrl;
+ this.certs = certs;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public String getSecUrl() {
+ return secUrl;
+ }
+
+ public Certificates getCerts() {
+ return this.certs;
+ }
+
+ public void setSecUrl(String secUrl) {
+ this.secUrl = secUrl;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SecStorageVMSetupCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SecStorageVMSetupCommand.java b/core/src/com/cloud/agent/api/SecStorageVMSetupCommand.java
new file mode 100644
index 0000000..be97709
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SecStorageVMSetupCommand.java
@@ -0,0 +1,57 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+public class SecStorageVMSetupCommand extends Command {
+ String [] allowedInternalSites = new String[0];
+ String copyUserName;
+ String copyPassword;
+
+ public SecStorageVMSetupCommand() {
+ super();
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public String[] getAllowedInternalSites() {
+ return allowedInternalSites;
+ }
+
+ public void setAllowedInternalSites(String[] allowedInternalSites) {
+ this.allowedInternalSites = allowedInternalSites;
+ }
+
+ public String getCopyUserName() {
+ return copyUserName;
+ }
+
+ public void setCopyUserName(String copyUserName) {
+ this.copyUserName = copyUserName;
+ }
+
+ public String getCopyPassword() {
+ return copyPassword;
+ }
+
+ public void setCopyPassword(String copyPassword) {
+ this.copyPassword = copyPassword;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SecurityGroupRuleAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SecurityGroupRuleAnswer.java b/core/src/com/cloud/agent/api/SecurityGroupRuleAnswer.java
new file mode 100644
index 0000000..144fea2
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SecurityGroupRuleAnswer.java
@@ -0,0 +1,70 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+public class SecurityGroupRuleAnswer extends Answer {
+ public static enum FailureReason {
+ NONE,
+ UNKNOWN,
+ PROGRAMMING_FAILED,
+ CANNOT_BRIDGE_FIREWALL
+ }
+ Long logSequenceNumber = null;
+ Long vmId = null;
+ FailureReason reason = FailureReason.NONE;
+
+
+ protected SecurityGroupRuleAnswer() {
+ }
+
+ public SecurityGroupRuleAnswer(SecurityGroupRulesCmd cmd) {
+ super(cmd);
+ this.logSequenceNumber = cmd.getSeqNum();
+ this.vmId = cmd.getVmId();
+ }
+
+ public SecurityGroupRuleAnswer(SecurityGroupRulesCmd cmd, boolean result, String detail) {
+ super(cmd, result, detail);
+ this.logSequenceNumber = cmd.getSeqNum();
+ this.vmId = cmd.getVmId();
+ reason = FailureReason.PROGRAMMING_FAILED;
+ }
+
+ public SecurityGroupRuleAnswer(SecurityGroupRulesCmd cmd, boolean result, String detail, FailureReason r) {
+ super(cmd, result, detail);
+ this.logSequenceNumber = cmd.getSeqNum();
+ this.vmId = cmd.getVmId();
+ reason = r;
+ }
+
+ public Long getLogSequenceNumber() {
+ return logSequenceNumber;
+ }
+
+ public Long getVmId() {
+ return vmId;
+ }
+
+ public FailureReason getReason() {
+ return reason;
+ }
+
+ public void setReason(FailureReason reason) {
+ this.reason = reason;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SecurityGroupRulesCmd.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SecurityGroupRulesCmd.java b/core/src/com/cloud/agent/api/SecurityGroupRulesCmd.java
new file mode 100644
index 0000000..4336b4c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SecurityGroupRulesCmd.java
@@ -0,0 +1,304 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.List;
+import java.util.zip.DeflaterOutputStream;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.log4j.Logger;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.utils.net.NetUtils;
+
+
+public class SecurityGroupRulesCmd extends Command {
+ private static Logger s_logger = Logger.getLogger(SecurityGroupRulesCmd.class);
+ public static class IpPortAndProto {
+ private String proto;
+ private int startPort;
+ private int endPort;
+ @LogLevel(Log4jLevel.Trace)
+ private String [] allowedCidrs;
+
+ public IpPortAndProto() { }
+
+ public IpPortAndProto(String proto, int startPort, int endPort,
+ String[] allowedCidrs) {
+ super();
+ this.proto = proto;
+ this.startPort = startPort;
+ this.endPort = endPort;
+ this.allowedCidrs = allowedCidrs;
+ }
+
+ public String[] getAllowedCidrs() {
+ return allowedCidrs;
+ }
+
+ public void setAllowedCidrs(String[] allowedCidrs) {
+ this.allowedCidrs = allowedCidrs;
+ }
+
+ public String getProto() {
+ return proto;
+ }
+
+ public int getStartPort() {
+ return startPort;
+ }
+
+ public int getEndPort() {
+ return endPort;
+ }
+
+ }
+
+
+ String guestIp;
+ String vmName;
+ String guestMac;
+ String signature;
+ Long seqNum;
+ Long vmId;
+ Long msId;
+ IpPortAndProto [] ingressRuleSet;
+ IpPortAndProto [] egressRuleSet;
+ private List<String> secIps;
+
+ public SecurityGroupRulesCmd() {
+ super();
+ }
+
+
+ public SecurityGroupRulesCmd(String guestIp, String guestMac, String vmName, Long vmId, String signature, Long seqNum, IpPortAndProto[] ingressRuleSet, IpPortAndProto[] egressRuleSet) {
+ super();
+ this.guestIp = guestIp;
+ this.vmName = vmName;
+ this.ingressRuleSet = ingressRuleSet;
+ this.egressRuleSet = egressRuleSet;
+ this.guestMac = guestMac;
+ this.signature = signature;
+ this.seqNum = seqNum;
+ this.vmId = vmId;
+ if (signature == null) {
+ String stringified = stringifyRules();
+ this.signature = DigestUtils.md5Hex(stringified);
+ }
+ }
+
+
+ public SecurityGroupRulesCmd(String guestIp, String guestMac, String vmName, Long vmId, String signature, Long seqNum, IpPortAndProto[] ingressRuleSet, IpPortAndProto[] egressRuleSet, List<String> secIps) {
+ super();
+ this.guestIp = guestIp;
+ this.vmName = vmName;
+ this.ingressRuleSet = ingressRuleSet;
+ this.egressRuleSet = egressRuleSet;
+ this.guestMac = guestMac;
+ this.signature = signature;
+ this.seqNum = seqNum;
+ this.vmId = vmId;
+ if (signature == null) {
+ String stringified = stringifyRules();
+ this.signature = DigestUtils.md5Hex(stringified);
+ }
+ this.secIps = secIps;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+
+ public IpPortAndProto[] getIngressRuleSet() {
+ return ingressRuleSet;
+ }
+
+
+ public void setIngressRuleSet(IpPortAndProto[] ingressRuleSet) {
+ this.ingressRuleSet = ingressRuleSet;
+ }
+
+ public IpPortAndProto[] getEgressRuleSet() {
+ return egressRuleSet;
+ }
+
+
+ public void setEgressRuleSet(IpPortAndProto[] egressRuleSet) {
+ this.egressRuleSet = egressRuleSet;
+ }
+
+ public String getGuestIp() {
+ return guestIp;
+ }
+
+ public List<String> getSecIps() {
+ return secIps;
+ }
+
+
+ public String getVmName() {
+ return vmName;
+ }
+
+ public String stringifyRules() {
+ StringBuilder ruleBuilder = new StringBuilder();
+ for (SecurityGroupRulesCmd.IpPortAndProto ipPandP: getIngressRuleSet()) {
+ ruleBuilder.append("I:").append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
+ for (String cidr: ipPandP.getAllowedCidrs()) {
+ ruleBuilder.append(cidr).append(",");
+ }
+ ruleBuilder.append("NEXT");
+ ruleBuilder.append(" ");
+ }
+ for (SecurityGroupRulesCmd.IpPortAndProto ipPandP: getEgressRuleSet()) {
+ ruleBuilder.append("E:").append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
+ for (String cidr: ipPandP.getAllowedCidrs()) {
+ ruleBuilder.append(cidr).append(",");
+ }
+ ruleBuilder.append("NEXT");
+ ruleBuilder.append(" ");
+ }
+ return ruleBuilder.toString();
+ }
+
+ //convert cidrs in the form "a.b.c.d/e" to "hexvalue of 32bit ip/e"
+ private String compressCidr(String cidr) {
+ String [] toks = cidr.split("/");
+ long ipnum = NetUtils.ip2Long(toks[0]);
+ return Long.toHexString(ipnum) + "/" + toks[1];
+ }
+
+
+ public String getSecIpsString() {
+ StringBuilder sb = new StringBuilder();
+ List<String> ips = getSecIps();
+ if (ips == null) {
+ return "0:";
+ } else {
+ for (String ip : ips) {
+ sb.append(ip).append(":");
+ }
+ }
+ return sb.toString();
+ }
+
+
+ public String stringifyCompressedRules() {
+ StringBuilder ruleBuilder = new StringBuilder();
+ for (SecurityGroupRulesCmd.IpPortAndProto ipPandP : getIngressRuleSet()) {
+ ruleBuilder.append("I:").append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
+ for (String cidr: ipPandP.getAllowedCidrs()) {
+ //convert cidrs in the form "a.b.c.d/e" to "hexvalue of 32bit ip/e"
+ ruleBuilder.append(compressCidr(cidr)).append(",");
+ }
+ ruleBuilder.append("NEXT");
+ ruleBuilder.append(" ");
+ }
+ for (SecurityGroupRulesCmd.IpPortAndProto ipPandP : getEgressRuleSet()) {
+ ruleBuilder.append("E:").append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
+ for (String cidr: ipPandP.getAllowedCidrs()) {
+ //convert cidrs in the form "a.b.c.d/e" to "hexvalue of 32bit ip/e"
+ ruleBuilder.append(compressCidr(cidr)).append(",");
+ }
+ ruleBuilder.append("NEXT");
+ ruleBuilder.append(" ");
+ }
+ return ruleBuilder.toString();
+ }
+
+ /*
+ * Compress the security group rules using zlib compression to allow the call to the hypervisor
+ * to scale beyond 8k cidrs.
+ */
+ public String compressStringifiedRules() {
+ StringBuilder ruleBuilder = new StringBuilder();
+ for (SecurityGroupRulesCmd.IpPortAndProto ipPandP: getIngressRuleSet()) {
+ ruleBuilder.append("I:").append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
+ for (String cidr: ipPandP.getAllowedCidrs()) {
+ ruleBuilder.append(cidr).append(",");
+ }
+ ruleBuilder.append("NEXT");
+ ruleBuilder.append(" ");
+ }
+ for (SecurityGroupRulesCmd.IpPortAndProto ipPandP: getEgressRuleSet()) {
+ ruleBuilder.append("E:").append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
+ for (String cidr: ipPandP.getAllowedCidrs()) {
+ ruleBuilder.append(cidr).append(",");
+ }
+ ruleBuilder.append("NEXT");
+ ruleBuilder.append(" ");
+ }
+ String stringified = ruleBuilder.toString();
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ try {
+ //Note : not using GZipOutputStream since that is for files
+ //GZipOutputStream gives a different header, although the compression is the same
+ DeflaterOutputStream dzip = new DeflaterOutputStream(out);
+ dzip.write(stringified.getBytes());
+ dzip.close();
+ } catch (IOException e) {
+ s_logger.warn("Exception while compressing security group rules");
+ return null;
+ }
+ return Base64.encodeBase64String(out.toByteArray());
+ }
+
+ public String getSignature() {
+ return signature;
+ }
+
+
+ public String getGuestMac() {
+ return guestMac;
+ }
+
+
+ public Long getSeqNum() {
+ return seqNum;
+ }
+
+
+ public Long getVmId() {
+ return vmId;
+ }
+
+ public int getTotalNumCidrs() {
+ //useful for logging
+ int count = 0;
+ for (IpPortAndProto i: ingressRuleSet) {
+ count += i.allowedCidrs.length;
+ }
+ for (IpPortAndProto i: egressRuleSet) {
+ count += i.allowedCidrs.length;
+ }
+ return count;
+ }
+
+ public void setMsId(long msId) {
+ this.msId = msId;
+ }
+
+ public Long getMsId() {
+ return msId;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SetupAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SetupAnswer.java b/core/src/com/cloud/agent/api/SetupAnswer.java
new file mode 100644
index 0000000..97252a2
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SetupAnswer.java
@@ -0,0 +1,37 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+public class SetupAnswer extends Answer {
+ // indicate if agent reconnect is needed after setup command
+ private boolean _reconnect;
+ public SetupAnswer() {}
+
+ public SetupAnswer(SetupCommand cmd, boolean reconnect) {
+ super(cmd, true, null);
+ _reconnect = reconnect;
+ }
+
+ public SetupAnswer(SetupCommand cmd, String details) {
+ super(cmd, false, details);
+ _reconnect = true;
+ }
+ public boolean needReconnect() {
+ return _reconnect;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SetupCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SetupCommand.java b/core/src/com/cloud/agent/api/SetupCommand.java
new file mode 100644
index 0000000..ee43c59
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SetupCommand.java
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.host.HostEnvironment;
+
+public class SetupCommand extends Command {
+
+ HostEnvironment env;
+ boolean multipath;
+ boolean needSetup;
+
+ public boolean needSetup() {
+ return needSetup;
+ }
+
+ public void setNeedSetup(boolean setup) {
+ this.needSetup = setup;
+ }
+
+ public SetupCommand(HostEnvironment env) {
+ this.env = env;
+ this.multipath = false;
+ this.needSetup = false;
+ }
+
+ public HostEnvironment getEnvironment() {
+ return env;
+ }
+
+ protected SetupCommand() {
+ }
+
+ public void setMultipathOn() {
+ this.multipath = true;
+ }
+
+ public boolean useMultipath() {
+ return multipath;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SetupGuestNetworkAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SetupGuestNetworkAnswer.java b/core/src/com/cloud/agent/api/SetupGuestNetworkAnswer.java
new file mode 100644
index 0000000..972a1c2
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SetupGuestNetworkAnswer.java
@@ -0,0 +1,25 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+public class SetupGuestNetworkAnswer extends Answer{
+ public SetupGuestNetworkAnswer() {}
+
+ public SetupGuestNetworkAnswer(SetupGuestNetworkCommand cmd, boolean success, String result) {
+ super(cmd, success, result);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SetupGuestNetworkCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SetupGuestNetworkCommand.java b/core/src/com/cloud/agent/api/SetupGuestNetworkCommand.java
new file mode 100644
index 0000000..2cf5bf8
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SetupGuestNetworkCommand.java
@@ -0,0 +1,72 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.routing.NetworkElementCommand;
+import com.cloud.agent.api.to.NicTO;
+
+public class SetupGuestNetworkCommand extends NetworkElementCommand{
+ String dhcpRange;
+ String networkDomain;
+ String defaultDns1 = null;
+ String defaultDns2 = null;
+ boolean isRedundant = false;
+ Integer priority;
+ boolean add = true;
+ NicTO nic;
+
+ public NicTO getNic() {
+ return nic;
+ }
+
+ public String getDefaultDns1() {
+ return defaultDns1;
+ }
+
+ public String getDefaultDns2() {
+ return defaultDns2;
+ }
+
+ public String getNetworkDomain() {
+ return networkDomain;
+ }
+
+ public boolean isAdd() {
+ return add;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ protected SetupGuestNetworkCommand() {
+ }
+
+
+ public SetupGuestNetworkCommand(String dhcpRange, String networkDomain, boolean isRedundant, Integer priority,
+ String defaultDns1, String defaultDns2, boolean add, NicTO nic) {
+ this.dhcpRange = dhcpRange;
+ this.networkDomain = networkDomain;
+ this.defaultDns1 = defaultDns1;
+ this.defaultDns2 = defaultDns2;
+ this.isRedundant = isRedundant;
+ this.priority = priority;
+ this.add = add;
+ this.nic = nic;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ShutdownCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ShutdownCommand.java b/core/src/com/cloud/agent/api/ShutdownCommand.java
new file mode 100644
index 0000000..5412f35
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ShutdownCommand.java
@@ -0,0 +1,56 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+/**
+ *
+ */
+public class ShutdownCommand extends Command {
+ public static final String Requested = "sig.kill";
+ public static final String Update = "update";
+ public static final String Unknown = "unknown";
+ public static final String DeleteHost = "deleteHost";
+
+ private String reason;
+ private String detail;
+
+ protected ShutdownCommand() {
+ super();
+ }
+
+ public ShutdownCommand(String reason, String detail) {
+ super();
+ this.reason = reason;
+ this.detail = detail;
+ }
+
+ /**
+ * @return return the reason the agent shutdown. If Unknown, call getDetail() for any details.
+ */
+ public String getReason() {
+ return reason;
+ }
+
+ public String getDetail() {
+ return detail;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SnapshotCommand.java b/core/src/com/cloud/agent/api/SnapshotCommand.java
new file mode 100644
index 0000000..d8abeb6
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SnapshotCommand.java
@@ -0,0 +1,126 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.storage.StoragePool;
+
+/**
+ * This currently assumes that both primary and secondary storage are mounted on
+ * the XenServer.
+ */
+public class SnapshotCommand extends Command {
+ protected String primaryStoragePoolNameLabel;
+ StorageFilerTO primaryPool;
+ private String snapshotUuid;
+ private String snapshotName;
+ private String secondaryStorageUrl;
+ private Long dcId;
+ private Long accountId;
+ private Long volumeId;
+ private String volumePath;
+
+ protected SnapshotCommand() {
+
+ }
+
+ /**
+ * @param primaryStoragePoolNameLabel
+ * The primary storage Pool
+ * @param snapshotUuid
+ * The UUID of the snapshot which is going to be backed up
+ * @param secondaryStoragePoolURL
+ * This is what shows up in the UI when you click on Secondary
+ * storage. In the code, it is present as: In the
+ * vmops.host_details table, there is a field mount.parent. This
+ * is the value of that field If you have better ideas on how to
+ * get it, you are welcome.
+ */
+ public SnapshotCommand(StoragePool pool,
+ String secondaryStorageUrl, String snapshotUuid,
+ String snapshotName, Long dcId, Long accountId, Long volumeId) {
+ this.primaryStoragePoolNameLabel = pool.getUuid();
+ this.primaryPool = new StorageFilerTO(pool);
+ this.snapshotUuid = snapshotUuid;
+ this.secondaryStorageUrl = secondaryStorageUrl;
+ this.dcId = dcId;
+ this.accountId = accountId;
+ this.volumeId = volumeId;
+ this.snapshotName = snapshotName;
+ }
+
+ /**
+ * @return the primaryStoragePoolNameLabel
+ */
+ public String getPrimaryStoragePoolNameLabel() {
+ return primaryStoragePoolNameLabel;
+ }
+
+ /**
+ * @return the primaryPool
+ */
+ public StorageFilerTO getPool() {
+ return primaryPool;
+ }
+
+ /**
+ * @return the snapshotUuid
+ */
+ public String getSnapshotUuid() {
+ return snapshotUuid;
+ }
+
+ public String getSnapshotName() {
+ return snapshotName;
+ }
+
+ /**
+ * @return the secondaryStoragePoolURL
+ */
+ public String getSecondaryStorageUrl() {
+ return secondaryStorageUrl;
+ }
+
+ public Long getDataCenterId() {
+ return dcId;
+ }
+
+ public Long getAccountId() {
+ return accountId;
+ }
+
+ public Long getVolumeId() {
+ return volumeId;
+ }
+
+ public String getVolumePath() {
+ return volumePath;
+ }
+
+ public void setVolumePath(String path) {
+ volumePath = path;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartAnswer.java b/core/src/com/cloud/agent/api/StartAnswer.java
new file mode 100644
index 0000000..922d060
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartAnswer.java
@@ -0,0 +1,57 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.to.VirtualMachineTO;
+
+public class StartAnswer extends Answer {
+ VirtualMachineTO vm;
+ String host_guid;
+
+ protected StartAnswer() {
+ }
+
+ public StartAnswer(StartCommand cmd, String msg) {
+ super(cmd, false, msg);
+ this.vm = cmd.getVirtualMachine();
+ }
+
+ public StartAnswer(StartCommand cmd, Exception e) {
+ super(cmd, false, e.getMessage());
+ this.vm = cmd.getVirtualMachine();
+ }
+
+ public StartAnswer(StartCommand cmd) {
+ super(cmd, true, null);
+ this.vm = cmd.getVirtualMachine();
+ this.host_guid = null;
+ }
+
+ public StartAnswer(StartCommand cmd, String msg, String guid) {
+ super(cmd, true, msg);
+ this.vm = cmd.getVirtualMachine();
+ this.host_guid = guid;
+ }
+
+ public VirtualMachineTO getVirtualMachine() {
+ return vm;
+ }
+
+ public String getHost_guid() {
+ return host_guid;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartCommand.java b/core/src/com/cloud/agent/api/StartCommand.java
new file mode 100644
index 0000000..ec707d6
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartCommand.java
@@ -0,0 +1,52 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.to.VirtualMachineTO;
+import com.cloud.host.Host;
+
+/**
+ */
+public class StartCommand extends Command {
+ VirtualMachineTO vm;
+ String hostIp;
+
+ public VirtualMachineTO getVirtualMachine() {
+ return vm;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ protected StartCommand() {
+ }
+
+ public StartCommand(VirtualMachineTO vm) {
+ this.vm = vm;
+ }
+
+ public StartCommand(VirtualMachineTO vm, Host host) {
+ this.vm = vm;
+ this.hostIp = host.getPrivateIpAddress();
+ }
+
+ public String getHostIp() {
+ return this.hostIp;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartupAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartupAnswer.java b/core/src/com/cloud/agent/api/StartupAnswer.java
new file mode 100755
index 0000000..c0925cb
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartupAnswer.java
@@ -0,0 +1,44 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+
+public class StartupAnswer extends Answer {
+ long hostId;
+ int pingInterval;
+
+ protected StartupAnswer() {
+ }
+
+ public StartupAnswer(StartupCommand cmd, long hostId, int pingInterval) {
+ super(cmd);
+ this.hostId = hostId;
+ this.pingInterval = pingInterval;
+ }
+
+ public StartupAnswer(StartupCommand cmd, String details) {
+ super(cmd, false, details);
+ }
+
+ public long getHostId() {
+ return hostId;
+ }
+
+ public int getPingInterval() {
+ return pingInterval;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartupCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartupCommand.java b/core/src/com/cloud/agent/api/StartupCommand.java
new file mode 100755
index 0000000..dd2d390
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartupCommand.java
@@ -0,0 +1,286 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.host.Host;
+
+public class StartupCommand extends Command {
+ Host.Type type;
+ String dataCenter;
+ String pod;
+ String cluster;
+ String guid;
+ String name;
+ Long id;
+ String version;
+ String iqn;
+ String publicIpAddress;
+ String publicNetmask;
+ String publicMacAddress;
+ String privateIpAddress;
+ String privateMacAddress;
+ String privateNetmask;
+ String storageIpAddress;
+ String storageNetmask;
+ String storageMacAddress;
+ String storageIpAddressDeux;
+ String storageMacAddressDeux;
+ String storageNetmaskDeux;
+ String agentTag;
+ String resourceName;
+ String gatewayIpAddress;
+
+ public StartupCommand(Host.Type type) {
+ this.type = type;
+ }
+
+ public StartupCommand(Long id, Host.Type type, String name, String dataCenter, String pod, String guid, String version) {
+ super();
+ this.id = id;
+ this.dataCenter = dataCenter;
+ this.pod = pod;
+ this.guid = guid;
+ this.name = name;
+ this.version = version;
+ this.type = type;
+ }
+
+ public StartupCommand(Long id, Host.Type type, String name, String dataCenter, String pod, String guid, String version, String gatewayIpAddress) {
+ this(id, type, name, dataCenter, pod, guid, version);
+ this.gatewayIpAddress = gatewayIpAddress;
+ }
+
+ public Host.Type getHostType() {
+ return type;
+ }
+
+ public void setHostType(Host.Type type) {
+ this.type = type;
+ }
+
+ public String getIqn() {
+ return iqn;
+ }
+
+ public void setCluster(String cluster) {
+ this.cluster = cluster;
+ }
+
+ public String getCluster() {
+ return cluster;
+ }
+
+ public void setIqn(String iqn) {
+ this.iqn = iqn;
+ }
+
+ public String getDataCenter() {
+ return dataCenter;
+ }
+
+ public String getPod() {
+ return pod;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getStorageIpAddressDeux() {
+ return storageIpAddressDeux;
+ }
+
+ public void setStorageIpAddressDeux(String storageIpAddressDeux) {
+ this.storageIpAddressDeux = storageIpAddressDeux;
+ }
+
+ public String getStorageMacAddressDeux() {
+ return storageMacAddressDeux;
+ }
+
+ public void setStorageMacAddressDeux(String storageMacAddressDeux) {
+ this.storageMacAddressDeux = storageMacAddressDeux;
+ }
+
+ public String getStorageNetmaskDeux() {
+ return storageNetmaskDeux;
+ }
+
+ public void setStorageNetmaskDeux(String storageNetmaskDeux) {
+ this.storageNetmaskDeux = storageNetmaskDeux;
+ }
+
+ public String getGuid() {
+ return guid;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setDataCenter(String dataCenter) {
+ this.dataCenter = dataCenter;
+ }
+
+ public void setPod(String pod) {
+ this.pod = pod;
+ }
+
+ public void setGuid(String guid) {
+ this.guid = guid;
+ }
+
+ public void setGuid(String guid, String resourceName) {
+ this.resourceName = resourceName;
+ this.guid = guid + "-" + resourceName;
+ }
+
+ public String getPublicNetmask() {
+ return publicNetmask;
+ }
+
+ public void setPublicNetmask(String publicNetmask) {
+ this.publicNetmask = publicNetmask;
+ }
+
+ public String getPublicMacAddress() {
+ return publicMacAddress;
+ }
+
+ public void setPublicMacAddress(String publicMacAddress) {
+ this.publicMacAddress = publicMacAddress;
+ }
+
+ public String getPrivateIpAddress() {
+ return privateIpAddress;
+ }
+
+ public void setPrivateIpAddress(String privateIpAddress) {
+ this.privateIpAddress = privateIpAddress;
+ }
+
+ public String getPrivateMacAddress() {
+ return privateMacAddress;
+ }
+
+ public void setPrivateMacAddress(String privateMacAddress) {
+ this.privateMacAddress = privateMacAddress;
+ }
+
+ public String getPrivateNetmask() {
+ return privateNetmask;
+ }
+
+ public void setPrivateNetmask(String privateNetmask) {
+ this.privateNetmask = privateNetmask;
+ }
+
+ public String getStorageIpAddress() {
+ return storageIpAddress;
+ }
+
+ public void setStorageIpAddress(String storageIpAddress) {
+ this.storageIpAddress = storageIpAddress;
+ }
+
+ public String getStorageNetmask() {
+ return storageNetmask;
+ }
+
+ public void setStorageNetmask(String storageNetmask) {
+ this.storageNetmask = storageNetmask;
+ }
+
+ public String getStorageMacAddress() {
+ return storageMacAddress;
+ }
+
+ public void setStorageMacAddress(String storageMacAddress) {
+ this.storageMacAddress = storageMacAddress;
+ }
+
+ public String getPublicIpAddress() {
+ return publicIpAddress;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public void setPublicIpAddress(String publicIpAddress) {
+ this.publicIpAddress = publicIpAddress;
+ }
+
+ public String getAgentTag() {
+ return agentTag;
+ }
+
+ public void setAgentTag(String tag) {
+ agentTag = tag;
+ }
+
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ public String getGuidWithoutResource() {
+ if (resourceName == null) {
+ return guid;
+ } else {
+ int hyph = guid.lastIndexOf('-');
+ if (hyph == -1) {
+ return guid;
+ }
+ String tmpResource = guid.substring(hyph+1, guid.length());
+ if (resourceName.equals(tmpResource)){
+ return guid.substring(0, hyph);
+ } else {
+ return guid;
+ }
+ }
+ }
+
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ public String getGatewayIpAddress() {
+ return gatewayIpAddress;
+ }
+
+ public void setGatewayIpAddress(String gatewayIpAddress) {
+ this.gatewayIpAddress = gatewayIpAddress;
+ }
+
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartupExternalDhcpCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartupExternalDhcpCommand.java b/core/src/com/cloud/agent/api/StartupExternalDhcpCommand.java
new file mode 100644
index 0000000..b71f635
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartupExternalDhcpCommand.java
@@ -0,0 +1,25 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.host.Host;
+
+public class StartupExternalDhcpCommand extends StartupCommand {
+ public StartupExternalDhcpCommand() {
+ super(Host.Type.ExternalDhcp);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartupExternalFirewallCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartupExternalFirewallCommand.java b/core/src/com/cloud/agent/api/StartupExternalFirewallCommand.java
new file mode 100644
index 0000000..c4ed107
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartupExternalFirewallCommand.java
@@ -0,0 +1,26 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.host.Host;
+
+public class StartupExternalFirewallCommand extends StartupCommand {
+
+ public StartupExternalFirewallCommand() {
+ super(Host.Type.ExternalFirewall);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartupExternalLoadBalancerCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartupExternalLoadBalancerCommand.java b/core/src/com/cloud/agent/api/StartupExternalLoadBalancerCommand.java
new file mode 100644
index 0000000..1e7a5f1
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartupExternalLoadBalancerCommand.java
@@ -0,0 +1,26 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.host.Host;
+
+public class StartupExternalLoadBalancerCommand extends StartupCommand {
+ public StartupExternalLoadBalancerCommand() {
+ super(Host.Type.ExternalLoadBalancer);
+ }
+
+}