mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
cleaning up line endings agent-simulator
This commit is contained in:
parent
54d9686a1c
commit
581640147c
@ -10,68 +10,68 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Automatically generated by addcopyright.py at 04/03/2012
|
// Automatically generated by addcopyright.py at 04/03/2012
|
||||||
package com.cloud.agent;
|
package com.cloud.agent;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
public class MockVmMetrics implements Runnable {
|
public class MockVmMetrics implements Runnable {
|
||||||
private static final Logger s_logger = Logger.getLogger(MockVmMetrics.class);
|
private static final Logger s_logger = Logger.getLogger(MockVmMetrics.class);
|
||||||
|
|
||||||
private String vmName;
|
private String vmName;
|
||||||
|
|
||||||
public final int MAX_INTERFACES=1;
|
public final int MAX_INTERFACES=1;
|
||||||
|
|
||||||
public final int MAX_DISKS=8;
|
public final int MAX_DISKS=8;
|
||||||
|
|
||||||
//the last calculated traffic speed (transmit) per interface
|
//the last calculated traffic speed (transmit) per interface
|
||||||
private Map<String, Double> netTxKBps = new HashMap<String, Double>();
|
private Map<String, Double> netTxKBps = new HashMap<String, Double>();
|
||||||
|
|
||||||
//the last calculated traffic speed (receive) per interface
|
//the last calculated traffic speed (receive) per interface
|
||||||
private Map<String, Double> netRxKBps = new HashMap<String, Double>();
|
private Map<String, Double> netRxKBps = new HashMap<String, Double>();
|
||||||
|
|
||||||
//the last calculated disk write speed per disk (Bytes Per Second)
|
//the last calculated disk write speed per disk (Bytes Per Second)
|
||||||
private Map<String, Double> diskWriteKBytesPerSec = new HashMap<String, Double>();
|
private Map<String, Double> diskWriteKBytesPerSec = new HashMap<String, Double>();
|
||||||
|
|
||||||
//the last calculated disk read speed per disk (Bytes Per Second)
|
//the last calculated disk read speed per disk (Bytes Per Second)
|
||||||
private Map<String, Double> diskReadKBytesPerSec = new HashMap<String, Double>();
|
private Map<String, Double> diskReadKBytesPerSec = new HashMap<String, Double>();
|
||||||
|
|
||||||
//Total Bytes Transmitted on network interfaces
|
//Total Bytes Transmitted on network interfaces
|
||||||
private Map<String, Long> netTxTotalBytes = new HashMap<String, Long>();
|
private Map<String, Long> netTxTotalBytes = new HashMap<String, Long>();
|
||||||
|
|
||||||
//Total Bytes Received on network interfaces
|
//Total Bytes Received on network interfaces
|
||||||
private Map<String, Long> netRxTotalBytes = new HashMap<String, Long>();
|
private Map<String, Long> netRxTotalBytes = new HashMap<String, Long>();
|
||||||
|
|
||||||
//Total Bytes read per disk
|
//Total Bytes read per disk
|
||||||
private Map<String, Long> diskReadTotalBytes = new HashMap<String, Long>();
|
private Map<String, Long> diskReadTotalBytes = new HashMap<String, Long>();
|
||||||
|
|
||||||
//Total Bytes written per disk
|
//Total Bytes written per disk
|
||||||
private Map<String, Long> diskWriteTotalBytes = new HashMap<String, Long>();
|
private Map<String, Long> diskWriteTotalBytes = new HashMap<String, Long>();
|
||||||
|
|
||||||
//CPU time in seconds
|
//CPU time in seconds
|
||||||
private Double cpuSeconds = new Double(0.0);
|
private Double cpuSeconds = new Double(0.0);
|
||||||
|
|
||||||
//CPU percentage
|
//CPU percentage
|
||||||
private Float cpuPercent = new Float(0.0);
|
private Float cpuPercent = new Float(0.0);
|
||||||
|
|
||||||
private Map<String, String> diskMap = new HashMap<String, String>();
|
private Map<String, String> diskMap = new HashMap<String, String>();
|
||||||
|
|
||||||
private Map<String, String> vifMap = new HashMap<String, String>();
|
private Map<String, String> vifMap = new HashMap<String, String>();
|
||||||
|
|
||||||
private Map<String, Long> diskStatTimestamp = new HashMap<String, Long>();
|
private Map<String, Long> diskStatTimestamp = new HashMap<String, Long>();
|
||||||
private Map<String, Long> netStatTimestamp = new HashMap<String, Long>();
|
private Map<String, Long> netStatTimestamp = new HashMap<String, Long>();
|
||||||
|
|
||||||
private long cpuStatTimestamp = 0L;
|
private long cpuStatTimestamp = 0L;
|
||||||
|
|
||||||
private ScheduledFuture<?> future;
|
private ScheduledFuture<?> future;
|
||||||
private boolean stopped = false;
|
private boolean stopped = false;
|
||||||
private Random randSeed = new Random();
|
private Random randSeed = new Random();
|
||||||
|
|
||||||
public MockVmMetrics(String vmName) {
|
public MockVmMetrics(String vmName) {
|
||||||
this.vmName = vmName;
|
this.vmName = vmName;
|
||||||
vifMap.put("eth0", "eth0");
|
vifMap.put("eth0", "eth0");
|
||||||
vifMap.put("eth1", "eth1");
|
vifMap.put("eth1", "eth1");
|
||||||
@ -85,117 +85,117 @@ public class MockVmMetrics implements Runnable {
|
|||||||
netRxTotalBytes.put("eth1", networkStart);
|
netRxTotalBytes.put("eth1", networkStart);
|
||||||
|
|
||||||
netTxTotalBytes.put("eth2", networkStart);
|
netTxTotalBytes.put("eth2", networkStart);
|
||||||
netRxTotalBytes.put("eth2", networkStart);
|
netRxTotalBytes.put("eth2", networkStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getIncrementor() {
|
private int getIncrementor() {
|
||||||
return randSeed.nextInt(100);
|
return randSeed.nextInt(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if(s_logger.isDebugEnabled()) {
|
if(s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Generating MockVM metrics");
|
s_logger.debug("Generating MockVM metrics");
|
||||||
}
|
}
|
||||||
for (Map.Entry<String, Long> entry : netRxTotalBytes.entrySet()) {
|
for (Map.Entry<String, Long> entry : netRxTotalBytes.entrySet()) {
|
||||||
entry.setValue(entry.getValue() + getIncrementor());
|
entry.setValue(entry.getValue() + getIncrementor());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Map.Entry<String, Long> entry : netTxTotalBytes.entrySet()) {
|
for (Map.Entry<String, Long> entry : netTxTotalBytes.entrySet()) {
|
||||||
entry.setValue(entry.getValue() + getIncrementor());
|
entry.setValue(entry.getValue() + getIncrementor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVmName() {
|
public String getVmName() {
|
||||||
return vmName;
|
return vmName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Double> getNetTxKBps() {
|
public Map<String, Double> getNetTxKBps() {
|
||||||
return netTxKBps;
|
return netTxKBps;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Double> getNetRxKBps() {
|
public Map<String, Double> getNetRxKBps() {
|
||||||
return netRxKBps;
|
return netRxKBps;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Double> getDiskWriteBytesPerSec() {
|
public Map<String, Double> getDiskWriteBytesPerSec() {
|
||||||
return diskWriteKBytesPerSec;
|
return diskWriteKBytesPerSec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Double> getDiskReadBytesPerSec() {
|
public Map<String, Double> getDiskReadBytesPerSec() {
|
||||||
return diskReadKBytesPerSec;
|
return diskReadKBytesPerSec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Long> getNetTxTotalBytes() {
|
public Map<String, Long> getNetTxTotalBytes() {
|
||||||
return netTxTotalBytes;
|
return netTxTotalBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Long> getNetRxTotalBytes() {
|
public Map<String, Long> getNetRxTotalBytes() {
|
||||||
return netRxTotalBytes;
|
return netRxTotalBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Long> getDiskReadTotalBytes() {
|
public Map<String, Long> getDiskReadTotalBytes() {
|
||||||
return diskReadTotalBytes;
|
return diskReadTotalBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Long> getDiskWriteTotalBytes() {
|
public Map<String, Long> getDiskWriteTotalBytes() {
|
||||||
return diskWriteTotalBytes;
|
return diskWriteTotalBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getNetTxKBps(String intf) {
|
public Double getNetTxKBps(String intf) {
|
||||||
return netTxKBps.get(intf);
|
return netTxKBps.get(intf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getNetRxKBps(String intf) {
|
public Double getNetRxKBps(String intf) {
|
||||||
return netRxKBps.get(intf);
|
return netRxKBps.get(intf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getDiskWriteKBytesPerSec(String disk) {
|
public Double getDiskWriteKBytesPerSec(String disk) {
|
||||||
return diskWriteKBytesPerSec.get(disk);
|
return diskWriteKBytesPerSec.get(disk);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getDiskReadKBytesPerSec(String disk) {
|
public Double getDiskReadKBytesPerSec(String disk) {
|
||||||
return diskReadKBytesPerSec.get(disk);
|
return diskReadKBytesPerSec.get(disk);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getNetTxTotalBytes(String intf) {
|
public Long getNetTxTotalBytes(String intf) {
|
||||||
return netTxTotalBytes.get(intf);
|
return netTxTotalBytes.get(intf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getNetRxTotalBytes(String intf) {
|
public Long getNetRxTotalBytes(String intf) {
|
||||||
return netRxTotalBytes.get(intf);
|
return netRxTotalBytes.get(intf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getDiskReadTotalBytes(String disk) {
|
public Long getDiskReadTotalBytes(String disk) {
|
||||||
return diskReadTotalBytes.get(disk);
|
return diskReadTotalBytes.get(disk);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getDiskWriteTotalBytes(String disk) {
|
public Long getDiskWriteTotalBytes(String disk) {
|
||||||
return diskWriteTotalBytes.get(disk);
|
return diskWriteTotalBytes.get(disk);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getCpuSeconds() {
|
public Double getCpuSeconds() {
|
||||||
return cpuSeconds;
|
return cpuSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getDiskMap() {
|
public Map<String, String> getDiskMap() {
|
||||||
return diskMap;
|
return diskMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Float getCpuPercent() {
|
public Float getCpuPercent() {
|
||||||
return cpuPercent;
|
return cpuPercent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFuture(ScheduledFuture<?> sf) {
|
public void setFuture(ScheduledFuture<?> sf) {
|
||||||
this.future = sf;
|
this.future = sf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScheduledFuture<?> getFuture() {
|
public ScheduledFuture<?> getFuture() {
|
||||||
return future;
|
return future;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
this.stopped = true;
|
this.stopped = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,8 +10,8 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Automatically generated by addcopyright.py at 04/03/2012
|
// Automatically generated by addcopyright.py at 04/03/2012
|
||||||
package com.cloud.agent;
|
package com.cloud.agent;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.DatagramPacket;
|
import java.net.DatagramPacket;
|
||||||
import java.net.DatagramSocket;
|
import java.net.DatagramSocket;
|
||||||
@ -23,126 +23,126 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
public class MultiCaster implements Runnable {
|
public class MultiCaster implements Runnable {
|
||||||
private static final Logger s_logger = Logger.getLogger(MultiCaster.class);
|
private static final Logger s_logger = Logger.getLogger(MultiCaster.class);
|
||||||
|
|
||||||
public final int MAX_PACKET_SIZE = 8096;
|
public final int MAX_PACKET_SIZE = 8096;
|
||||||
|
|
||||||
private List<MultiCasterListener> listeners;
|
private List<MultiCasterListener> listeners;
|
||||||
private DatagramSocket socket;
|
private DatagramSocket socket;
|
||||||
private byte[] recvBuffer;
|
private byte[] recvBuffer;
|
||||||
|
|
||||||
private Thread driver;
|
private Thread driver;
|
||||||
private volatile boolean stopRequested = false;
|
private volatile boolean stopRequested = false;
|
||||||
|
|
||||||
public MultiCaster() {
|
public MultiCaster() {
|
||||||
listeners = new ArrayList<MultiCasterListener>();
|
listeners = new ArrayList<MultiCasterListener>();
|
||||||
recvBuffer = new byte[MAX_PACKET_SIZE];
|
recvBuffer = new byte[MAX_PACKET_SIZE];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addListener(MultiCasterListener listener) {
|
public void addListener(MultiCasterListener listener) {
|
||||||
synchronized(listeners) {
|
synchronized(listeners) {
|
||||||
listeners.add(listener);
|
listeners.add(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeListener(MultiCasterListener listener) {
|
public void removeListener(MultiCasterListener listener) {
|
||||||
synchronized(listeners) {
|
synchronized(listeners) {
|
||||||
listeners.remove(listener);
|
listeners.remove(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cast(byte[] buf, int off, int len,
|
public void cast(byte[] buf, int off, int len,
|
||||||
InetAddress toAddress, int nToPort) throws IOException {
|
InetAddress toAddress, int nToPort) throws IOException {
|
||||||
|
|
||||||
if(socket == null)
|
if(socket == null)
|
||||||
throw new IOException("multi caster is not started");
|
throw new IOException("multi caster is not started");
|
||||||
|
|
||||||
if(len >= MAX_PACKET_SIZE)
|
if(len >= MAX_PACKET_SIZE)
|
||||||
throw new IOException("packet size exceeds limit of " + MAX_PACKET_SIZE);
|
throw new IOException("packet size exceeds limit of " + MAX_PACKET_SIZE);
|
||||||
|
|
||||||
DatagramPacket packet = new DatagramPacket(buf, off,
|
DatagramPacket packet = new DatagramPacket(buf, off,
|
||||||
len, toAddress, nToPort);
|
len, toAddress, nToPort);
|
||||||
|
|
||||||
socket.send(packet);
|
socket.send(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start(String strOutboundAddress,
|
public void start(String strOutboundAddress,
|
||||||
String strClusterAddress, int nPort) throws SocketException {
|
String strClusterAddress, int nPort) throws SocketException {
|
||||||
assert(socket == null);
|
assert(socket == null);
|
||||||
|
|
||||||
InetAddress addr = null;
|
InetAddress addr = null;
|
||||||
try {
|
try {
|
||||||
addr = InetAddress.getByName(strClusterAddress);
|
addr = InetAddress.getByName(strClusterAddress);
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
s_logger.error("Unexpected exception " , e);
|
s_logger.error("Unexpected exception " , e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(addr != null && addr.isMulticastAddress()) {
|
if(addr != null && addr.isMulticastAddress()) {
|
||||||
try {
|
try {
|
||||||
socket = new MulticastSocket(nPort);
|
socket = new MulticastSocket(nPort);
|
||||||
socket.setReuseAddress(true);
|
socket.setReuseAddress(true);
|
||||||
|
|
||||||
if(s_logger.isInfoEnabled())
|
if(s_logger.isInfoEnabled())
|
||||||
s_logger.info("Join multicast group : " + addr);
|
s_logger.info("Join multicast group : " + addr);
|
||||||
|
|
||||||
((MulticastSocket)socket).joinGroup(addr);
|
((MulticastSocket)socket).joinGroup(addr);
|
||||||
((MulticastSocket)socket).setTimeToLive(1);
|
((MulticastSocket)socket).setTimeToLive(1);
|
||||||
|
|
||||||
if(strOutboundAddress != null) {
|
if(strOutboundAddress != null) {
|
||||||
if(s_logger.isInfoEnabled())
|
if(s_logger.isInfoEnabled())
|
||||||
s_logger.info("set outgoing interface to : " + strOutboundAddress);
|
s_logger.info("set outgoing interface to : " + strOutboundAddress);
|
||||||
|
|
||||||
InetAddress ia = InetAddress.getByName(strOutboundAddress);
|
InetAddress ia = InetAddress.getByName(strOutboundAddress);
|
||||||
NetworkInterface ni = NetworkInterface.getByInetAddress(ia);
|
NetworkInterface ni = NetworkInterface.getByInetAddress(ia);
|
||||||
((MulticastSocket)socket).setNetworkInterface(ni);
|
((MulticastSocket)socket).setNetworkInterface(ni);
|
||||||
}
|
}
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
s_logger.error("Unexpected exception " , e);
|
s_logger.error("Unexpected exception " , e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
socket = new DatagramSocket(nPort);
|
socket = new DatagramSocket(nPort);
|
||||||
socket.setReuseAddress(true);
|
socket.setReuseAddress(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
driver = new Thread(this, "Multi-caster");
|
driver = new Thread(this, "Multi-caster");
|
||||||
driver.setDaemon(true);
|
driver.setDaemon(true);
|
||||||
driver.start();
|
driver.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
if(socket != null) {
|
if(socket != null) {
|
||||||
stopRequested = true;
|
stopRequested = true;
|
||||||
|
|
||||||
socket.close();
|
socket.close();
|
||||||
if(driver != null) {
|
if(driver != null) {
|
||||||
try {
|
try {
|
||||||
driver.join();
|
driver.join();
|
||||||
} catch(InterruptedException e) {
|
} catch(InterruptedException e) {
|
||||||
}
|
}
|
||||||
driver = null;
|
driver = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
socket = null;
|
socket = null;
|
||||||
stopRequested = false;
|
stopRequested = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
while(!stopRequested) {
|
while(!stopRequested) {
|
||||||
try {
|
try {
|
||||||
DatagramPacket packet = new DatagramPacket(recvBuffer, recvBuffer.length);
|
DatagramPacket packet = new DatagramPacket(recvBuffer, recvBuffer.length);
|
||||||
socket.receive(packet);
|
socket.receive(packet);
|
||||||
|
|
||||||
for(Object listener : listeners.toArray()) {
|
for(Object listener : listeners.toArray()) {
|
||||||
((MultiCasterListener)listener).onMultiCasting(packet.getData(),
|
((MultiCasterListener)listener).onMultiCasting(packet.getData(),
|
||||||
packet.getOffset(), packet.getLength(), packet.getAddress());
|
packet.getOffset(), packet.getLength(), packet.getAddress());
|
||||||
}
|
}
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
} catch(Throwable e) {
|
} catch(Throwable e) {
|
||||||
s_logger.error("Unhandled exception : ", e);
|
s_logger.error("Unhandled exception : ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,9 +10,9 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Automatically generated by addcopyright.py at 04/03/2012
|
// Automatically generated by addcopyright.py at 04/03/2012
|
||||||
package com.cloud.agent;
|
package com.cloud.agent;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
|
||||||
public interface MultiCasterListener {
|
public interface MultiCasterListener {
|
||||||
public void onMultiCasting(byte[] data, int off, int len, InetAddress addrFrom);
|
public void onMultiCasting(byte[] data, int off, int len, InetAddress addrFrom);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,24 +10,24 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Automatically generated by addcopyright.py at 04/03/2012
|
// Automatically generated by addcopyright.py at 04/03/2012
|
||||||
package com.cloud.agent;
|
package com.cloud.agent;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
public class SimulatorCmd implements Serializable {
|
public class SimulatorCmd implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private String testCase = "DEFAULT";
|
private String testCase = "DEFAULT";
|
||||||
|
|
||||||
public SimulatorCmd(String testCase) {
|
public SimulatorCmd(String testCase) {
|
||||||
this.testCase = testCase;
|
this.testCase = testCase;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTestCase() {
|
public String getTestCase() {
|
||||||
return testCase;
|
return testCase;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTestCase(String testCase) {
|
public void setTestCase(String testCase) {
|
||||||
this.testCase = testCase;
|
this.testCase = testCase;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,70 +10,70 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Automatically generated by addcopyright.py at 04/03/2012
|
// Automatically generated by addcopyright.py at 04/03/2012
|
||||||
package com.cloud.agent;
|
package com.cloud.agent;
|
||||||
|
|
||||||
public class SimulatorMigrateVmCmd extends SimulatorCmd {
|
public class SimulatorMigrateVmCmd extends SimulatorCmd {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private String destIp;
|
private String destIp;
|
||||||
|
|
||||||
private String vmName;
|
private String vmName;
|
||||||
private long ramSize;
|
private long ramSize;
|
||||||
private int cpuCount;
|
private int cpuCount;
|
||||||
private int utilization;
|
private int utilization;
|
||||||
|
|
||||||
public SimulatorMigrateVmCmd(String testCase) {
|
public SimulatorMigrateVmCmd(String testCase) {
|
||||||
super(testCase);
|
super(testCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDestIp() {
|
public String getDestIp() {
|
||||||
return destIp;
|
return destIp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDestIp(String destIp) {
|
public void setDestIp(String destIp) {
|
||||||
this.destIp = destIp;
|
this.destIp = destIp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVmName() {
|
public String getVmName() {
|
||||||
return vmName;
|
return vmName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVmName(String vmName) {
|
public void setVmName(String vmName) {
|
||||||
this.vmName = vmName;
|
this.vmName = vmName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getRamSize() {
|
public long getRamSize() {
|
||||||
return ramSize;
|
return ramSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRamSize(long ramSize) {
|
public void setRamSize(long ramSize) {
|
||||||
this.ramSize = ramSize;
|
this.ramSize = ramSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCpuCount() {
|
public int getCpuCount() {
|
||||||
return cpuCount;
|
return cpuCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCpuCount(int cpuCount) {
|
public void setCpuCount(int cpuCount) {
|
||||||
this.cpuCount = cpuCount;
|
this.cpuCount = cpuCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUtilization() {
|
public int getUtilization() {
|
||||||
return utilization;
|
return utilization;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUtilization(int utilization) {
|
public void setUtilization(int utilization) {
|
||||||
this.utilization = utilization;
|
this.utilization = utilization;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append("SimulatorMigrateVmCmd {").append("vm: ").append(getVmName());
|
sb.append("SimulatorMigrateVmCmd {").append("vm: ").append(getVmName());
|
||||||
sb.append(", destIp: ").append(getDestIp()).append(", ramSize: ").append(getRamSize());
|
sb.append(", destIp: ").append(getDestIp()).append(", ramSize: ").append(getRamSize());
|
||||||
sb.append(", cpuCount: ").append(getCpuCount()).append(", utilization: ").append(getUtilization());
|
sb.append(", cpuCount: ").append(getCpuCount()).append(", utilization: ").append(getUtilization());
|
||||||
sb.append("}");
|
sb.append("}");
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Automatically generated by addcopyright.py at 04/03/2012
|
// Automatically generated by addcopyright.py at 04/03/2012
|
||||||
package com.cloud.agent.manager;
|
package com.cloud.agent.manager;
|
||||||
|
|
||||||
import com.cloud.agent.api.Answer;
|
import com.cloud.agent.api.Answer;
|
||||||
import com.cloud.agent.api.AttachIsoCommand;
|
import com.cloud.agent.api.AttachIsoCommand;
|
||||||
@ -43,8 +43,8 @@ import com.cloud.agent.api.storage.ListTemplateCommand;
|
|||||||
import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer;
|
import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer;
|
||||||
import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
|
import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
|
||||||
import com.cloud.utils.component.Manager;
|
import com.cloud.utils.component.Manager;
|
||||||
|
|
||||||
public interface MockStorageManager extends Manager {
|
public interface MockStorageManager extends Manager {
|
||||||
public static final long DEFAULT_HOST_STORAGE_SIZE = 1 * 1024 * 1024 * 1024 * 1024L; //1T
|
public static final long DEFAULT_HOST_STORAGE_SIZE = 1 * 1024 * 1024 * 1024 * 1024L; //1T
|
||||||
public static final long DEFAULT_TEMPLATE_SIZE = 1 * 1000 * 1000 * 1000L; //1G
|
public static final long DEFAULT_TEMPLATE_SIZE = 1 * 1000 * 1000 * 1000L; //1G
|
||||||
|
|
||||||
@ -83,5 +83,5 @@ public interface MockStorageManager extends Manager {
|
|||||||
|
|
||||||
StoragePoolInfo getLocalStorage(String hostGuid, Long storageSize);
|
StoragePoolInfo getLocalStorage(String hostGuid, Long storageSize);
|
||||||
|
|
||||||
CopyVolumeAnswer CopyVolume(CopyVolumeCommand cmd);
|
CopyVolumeAnswer CopyVolume(CopyVolumeCommand cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,8 +10,8 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Automatically generated by addcopyright.py at 04/03/2012
|
// Automatically generated by addcopyright.py at 04/03/2012
|
||||||
package com.cloud.agent.manager;
|
package com.cloud.agent.manager;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
@ -90,9 +90,9 @@ import com.cloud.vm.DiskProfile;
|
|||||||
import com.cloud.vm.VirtualMachine.State;
|
import com.cloud.vm.VirtualMachine.State;
|
||||||
|
|
||||||
|
|
||||||
@Local(value = { MockStorageManager.class })
|
@Local(value = { MockStorageManager.class })
|
||||||
public class MockStorageManagerImpl implements MockStorageManager {
|
public class MockStorageManagerImpl implements MockStorageManager {
|
||||||
private static final Logger s_logger = Logger.getLogger(MockStorageManagerImpl.class);
|
private static final Logger s_logger = Logger.getLogger(MockStorageManagerImpl.class);
|
||||||
@Inject MockStoragePoolDao _mockStoragePoolDao = null;
|
@Inject MockStoragePoolDao _mockStoragePoolDao = null;
|
||||||
@Inject MockSecStorageDao _mockSecStorageDao = null;
|
@Inject MockSecStorageDao _mockSecStorageDao = null;
|
||||||
@Inject MockVolumeDao _mockVolumeDao = null;
|
@Inject MockVolumeDao _mockVolumeDao = null;
|
||||||
@ -724,6 +724,6 @@ public class MockStorageManagerImpl implements MockStorageManager {
|
|||||||
return new CopyVolumeAnswer(cmd, true, null, primaryStorage.getMountPoint(), vol.getPath());
|
return new CopyVolumeAnswer(cmd, true, null, primaryStorage.getMountPoint(), vol.getPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,25 +10,25 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Automatically generated by addcopyright.py at 04/03/2012
|
// Automatically generated by addcopyright.py at 04/03/2012
|
||||||
package com.cloud.simulator;
|
package com.cloud.simulator;
|
||||||
|
|
||||||
import com.cloud.vm.VirtualMachine.State;
|
import com.cloud.vm.VirtualMachine.State;
|
||||||
|
|
||||||
// As storage is mapped from storage device, can virtually treat that VM here does
|
// As storage is mapped from storage device, can virtually treat that VM here does
|
||||||
public interface MockVm {
|
public interface MockVm {
|
||||||
|
|
||||||
|
|
||||||
public String getName();
|
|
||||||
|
|
||||||
public State getState();
|
|
||||||
|
|
||||||
public void setState(State state);
|
|
||||||
|
|
||||||
public void setHostId(long hostId);
|
|
||||||
public long getMemory();
|
public String getName();
|
||||||
|
|
||||||
public int getCpu();
|
public State getState();
|
||||||
public String getType();
|
|
||||||
|
public void setState(State state);
|
||||||
|
|
||||||
|
public void setHostId(long hostId);
|
||||||
|
public long getMemory();
|
||||||
|
|
||||||
|
public int getCpu();
|
||||||
|
public String getType();
|
||||||
public int getVncPort();
|
public int getVncPort();
|
||||||
|
|
||||||
public void setName(String name);
|
public void setName(String name);
|
||||||
@ -37,5 +37,5 @@ public interface MockVm {
|
|||||||
public void setType(String type);
|
public void setType(String type);
|
||||||
public void setVncPort(int vncPort);
|
public void setVncPort(int vncPort);
|
||||||
public long getId();
|
public long getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user