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