mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
kvm: Remove main methods in various classes
This is dead code which seems to be in there from the VMOps time. No reason for this to be here, so this can safely be removed
This commit is contained in:
parent
65daade79a
commit
34ed15e44e
@ -186,34 +186,4 @@ public class KVMHABase {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
NfsStoragePool pool = new KVMHAMonitor.NfsStoragePool(null, null, null,
|
||||
null, PoolType.PrimaryStorage);
|
||||
|
||||
KVMHAMonitor haWritter = new KVMHAMonitor(pool, "192.168.1.163", null);
|
||||
Thread ha = new Thread(haWritter);
|
||||
ha.start();
|
||||
|
||||
KVMHAChecker haChecker = new KVMHAChecker(haWritter.getStoragePools(),
|
||||
"192.168.1.163");
|
||||
|
||||
ExecutorService exe = Executors.newFixedThreadPool(1);
|
||||
Future<Boolean> future = exe.submit((Callable<Boolean>) haChecker);
|
||||
try {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
System.out.println(future.get());
|
||||
future = exe.submit((Callable<Boolean>) haChecker);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (ExecutionException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -127,68 +127,4 @@ public class LibvirtCapXMLParser extends LibvirtXMLParser {
|
||||
return _emulator.toString();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String capXML = "<capabilities>" + " <host>" + " <cpu>"
|
||||
+ " <arch>x86_64</arch>" + " <model>core2duo</model>"
|
||||
+ " <topology sockets='1' cores='2' threads='1'/>"
|
||||
+ " <feature name='lahf_lm'/>"
|
||||
+ " <feature name='xtpr'/>"
|
||||
+ " <feature name='cx16'/>"
|
||||
+ " <feature name='tm2'/>" + " <feature name='est'/>"
|
||||
+ " <feature name='vmx'/>"
|
||||
+ " <feature name='ds_cpl'/>"
|
||||
+ " <feature name='pbe'/>" + " <feature name='tm'/>"
|
||||
+ " <feature name='ht'/>" + " <feature name='ss'/>"
|
||||
+ " <feature name='acpi'/>" + " <feature name='ds'/>"
|
||||
+ " </cpu>" + " <migration_features>" + " <live/>"
|
||||
+ " <uri_transports>"
|
||||
+ " <uri_transport>tcp</uri_transport>"
|
||||
+ " </uri_transports>" + " </migration_features>"
|
||||
+ " <topology>" + " <cells num='1'>"
|
||||
+ " <cell id='0'>" + " <cpus num='2'>"
|
||||
+ " <cpu id='0'/>" + " <cpu id='1'/>"
|
||||
+ " </cpus>" + " </cell>" + " </cells>"
|
||||
+ " </topology>" + " </host>" + "" + " <guest>"
|
||||
+ " <os_type>hvm</os_type>" + " <arch name='i686'>"
|
||||
+ " <wordsize>32</wordsize>"
|
||||
+ " <emulator>/usr/bin/qemu</emulator>"
|
||||
+ " <machine>pc-0.11</machine>"
|
||||
+ " <machine canonical='pc-0.11'>pc</machine>"
|
||||
+ " <machine>pc-0.10</machine>"
|
||||
+ " <machine>isapc</machine>"
|
||||
+ " <domain type='qemu'>" + " </domain>"
|
||||
+ " <domain type='kvm'>"
|
||||
+ " <emulator>/usr/bin/qemu-kvm</emulator>"
|
||||
+ " <machine>pc-0.11</machine>"
|
||||
+ " <machine canonical='pc-0.11'>pc</machine>"
|
||||
+ " <machine>pc-0.10</machine>"
|
||||
+ " <machine>isapc</machine>" + " </domain>"
|
||||
+ " </arch>" + " <features>" + " <cpuselection/>"
|
||||
+ " <pae/>" + " <nonpae/>"
|
||||
+ " <acpi default='on' toggle='yes'/>"
|
||||
+ " <apic default='on' toggle='no'/>" + " </features>"
|
||||
+ " </guest>" + " <guest>" + " <os_type>hvm</os_type>"
|
||||
+ " <arch name='x86_64'>" + " <wordsize>64</wordsize>"
|
||||
+ " <emulator>/usr/bin/qemu-system-x86_64</emulator>"
|
||||
+ " <machine>pc-0.11</machine>"
|
||||
+ " <machine canonical='pc-0.11'>pc</machine>"
|
||||
+ " <machine>pc-0.10</machine>"
|
||||
+ " <machine>isapc</machine>"
|
||||
+ " <domain type='qemu'>" + " </domain>"
|
||||
+ " <domain type='kvm'>"
|
||||
+ " <emulator>/usr/bin/qemu-kvm</emulator>"
|
||||
+ " <machine>pc-0.11</machine>"
|
||||
+ " <machine canonical='pc-0.11'>pc</machine>"
|
||||
+ " <machine>pc-0.10</machine>"
|
||||
+ " <machine>isapc</machine>" + " </domain>"
|
||||
+ " </arch>" + " <features>" + " <cpuselection/>"
|
||||
+ " <acpi default='on' toggle='yes'/>"
|
||||
+ " <apic default='on' toggle='no'/>" + " </features>"
|
||||
+ " </guest>" + "</capabilities>";
|
||||
|
||||
LibvirtCapXMLParser parser = new LibvirtCapXMLParser();
|
||||
String cap = parser.parseCapabilitiesXML(capXML);
|
||||
System.out.println(parser.getGuestOsType());
|
||||
System.out.println(parser.getEmulator());
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,69 +182,4 @@ public class LibvirtDomainXMLParser {
|
||||
public String getDescription() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
LibvirtDomainXMLParser parser = new LibvirtDomainXMLParser();
|
||||
parser.parseDomainXML("<domain type='kvm' id='12'>"
|
||||
+ "<name>r-6-CV-5002-1</name>"
|
||||
+ "<uuid>581b5a4b-b496-8d4d-e44e-a7dcbe9df0b5</uuid>"
|
||||
+ "<description>testVM</description>"
|
||||
+ "<memory>131072</memory>"
|
||||
+ "<currentMemory>131072</currentMemory>"
|
||||
+ "<vcpu>1</vcpu>"
|
||||
+ "<os>"
|
||||
+ "<type arch='i686' machine='pc-0.11'>hvm</type>"
|
||||
+ "<kernel>/var/lib/libvirt/qemu/vmlinuz-2.6.31.6-166.fc12.i686</kernel>"
|
||||
+ "<cmdline>ro root=/dev/sda1 acpi=force selinux=0 eth0ip=10.1.1.1 eth0mask=255.255.255.0 eth2ip=192.168.10.152 eth2mask=255.255.255.0 gateway=192.168.10.1 dns1=72.52.126.11 dns2=72.52.126.12 domain=v4.myvm.com</cmdline>"
|
||||
+ "<boot dev='hd'/>"
|
||||
+ "</os>"
|
||||
+ "<features>"
|
||||
+ "<acpi/>"
|
||||
+ "<pae/>"
|
||||
+ "</features>"
|
||||
+ "<clock offset='utc'/>"
|
||||
+ "<on_poweroff>destroy</on_poweroff>"
|
||||
+ "<on_reboot>restart</on_reboot>"
|
||||
+ "<on_crash>destroy</on_crash>"
|
||||
+ "<devices>"
|
||||
+ "<emulator>/usr/bin/qemu-kvm</emulator>"
|
||||
+ "<disk type='file' device='disk'>"
|
||||
+ "<driver name='qemu' type='raw'/>"
|
||||
+ "<source file='/mnt/tank//vmops/CV/vm/u000004/r000006/rootdisk'/>"
|
||||
+ "<target dev='hda' bus='ide'/>" + "</disk>"
|
||||
+ "<interface type='bridge'>"
|
||||
+ "<mac address='02:00:50:02:00:01'/>"
|
||||
+ "<source bridge='vnbr5002'/>" + "<target dev='vtap5002'/>"
|
||||
+ "<model type='e1000'/>" + "</interface>"
|
||||
+ "<interface type='network'>"
|
||||
+ "<mac address='00:16:3e:77:e2:a1'/>"
|
||||
+ "<source network='vmops-private'/>" + "<target dev='vnet3'/>"
|
||||
+ "<model type='e1000'/>" + "</interface>"
|
||||
+ "<interface type='bridge'>"
|
||||
+ "<mac address='06:85:00:00:00:04'/>"
|
||||
+ "<source bridge='br0'/>" + "<target dev='tap5002'/>"
|
||||
+ "<model type='e1000'/>" + "</interface>"
|
||||
+ "<input type='mouse' bus='ps2'/>"
|
||||
+ "<graphics type='vnc' port='6031' autoport='no' listen=''/>"
|
||||
+ "<video>" + "<model type='cirrus' vram='9216' heads='1'/>"
|
||||
+ "</video>" + "</devices>" + "</domain>"
|
||||
|
||||
);
|
||||
for (InterfaceDef intf : parser.getInterfaces()) {
|
||||
System.out.println(intf);
|
||||
}
|
||||
for (DiskDef disk : parser.getDisks()) {
|
||||
System.out.println(disk);
|
||||
}
|
||||
System.out.println(parser.getVncPort());
|
||||
System.out.println(parser.getDescription());
|
||||
|
||||
List<String> test = new ArrayList<String>(1);
|
||||
test.add("1");
|
||||
test.add("2");
|
||||
if (test.contains("1")) {
|
||||
System.out.print("fdf");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -169,25 +169,4 @@ public class LibvirtNetworkDef {
|
||||
netBuilder.append("</network>\n");
|
||||
return netBuilder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
LibvirtNetworkDef net = new LibvirtNetworkDef("cloudPrivate", null,
|
||||
"cloud.com");
|
||||
net.defNATNetwork("cloudbr0", false, 0, null, "192.168.168.1",
|
||||
"255.255.255.0");
|
||||
net.adddhcpIPRange("192.168.168.100", "192.168.168.220");
|
||||
net.adddhcpIPRange("192.168.168.10", "192.168.168.50");
|
||||
net.adddhcpMapping("branch0.cloud.com", "00:16:3e:77:e2:ed",
|
||||
"192.168.168.100");
|
||||
net.adddhcpMapping("branch1.cloud.com", "00:16:3e:77:e2:ef",
|
||||
"192.168.168.101");
|
||||
net.adddhcpMapping("branch2.cloud.com", "00:16:3e:77:e2:f0",
|
||||
"192.168.168.102");
|
||||
System.out.println(net.toString());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -105,24 +105,4 @@ public class LibvirtStoragePoolXMLParser {
|
||||
Element node = (Element) tagNode.item(0);
|
||||
return node.getAttribute(attr);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
s_logger.addAppender(new org.apache.log4j.ConsoleAppender(
|
||||
new org.apache.log4j.PatternLayout(), "System.out"));
|
||||
String storagePool = "<pool type='dir'>" + "<name>test</name>"
|
||||
+ "<uuid>bf723c83-4b95-259c-7089-60776e61a11f</uuid>"
|
||||
+ "<capacity>20314165248</capacity>"
|
||||
+ "<allocation>1955450880</allocation>"
|
||||
+ "<available>18358714368</available>" + "<source>"
|
||||
+ "<host name='nfs1.lab.vmops.com'/>"
|
||||
+ "<dir path='/export/home/edison/kvm/primary'/>"
|
||||
+ "<format type='auto'/>" + "</source>" + "<target>"
|
||||
+ "<path>/media</path>" + "<permissions>" + "<mode>0700</mode>"
|
||||
+ "<owner>0</owner>" + "<group>0</group>" + "</permissions>"
|
||||
+ "</target>" + "</pool>";
|
||||
|
||||
LibvirtStoragePoolXMLParser parser = new LibvirtStoragePoolXMLParser();
|
||||
LibvirtStoragePoolDef pool = parser.parseStoragePoolXML(storagePool);
|
||||
s_logger.debug(pool.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,24 +81,4 @@ public class LibvirtStorageVolumeXMLParser {
|
||||
Element node = (Element) tagNode.item(0);
|
||||
return node.getAttribute(attr);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
s_logger.addAppender(new org.apache.log4j.ConsoleAppender(
|
||||
new org.apache.log4j.PatternLayout(), "System.out"));
|
||||
String storagePool = "<pool type='dir'>" + "<name>test</name>"
|
||||
+ "<uuid>bf723c83-4b95-259c-7089-60776e61a11f</uuid>"
|
||||
+ "<capacity>20314165248</capacity>"
|
||||
+ "<allocation>1955450880</allocation>"
|
||||
+ "<available>18358714368</available>" + "<source>"
|
||||
+ "<host name='nfs1.lab.vmops.com'/>"
|
||||
+ "<dir path='/export/home/edison/kvm/primary'/>"
|
||||
+ "<format type='auto'/>" + "</source>" + "<target>"
|
||||
+ "<path>/media</path>" + "<permissions>" + "<mode>0700</mode>"
|
||||
+ "<owner>0</owner>" + "<group>0</group>" + "</permissions>"
|
||||
+ "</target>" + "</pool>";
|
||||
|
||||
LibvirtStoragePoolXMLParser parser = new LibvirtStoragePoolXMLParser();
|
||||
LibvirtStoragePoolDef pool = parser.parseStoragePoolXML(storagePool);
|
||||
s_logger.debug(pool.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -883,81 +883,4 @@ public class LibvirtVMDef {
|
||||
vmBuilder.append("</domain>\n");
|
||||
return vmBuilder.toString();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("testing");
|
||||
LibvirtVMDef vm = new LibvirtVMDef();
|
||||
vm.setHvsType("kvm");
|
||||
vm.setDomainName("testing");
|
||||
vm.setDomUUID(UUID.randomUUID().toString());
|
||||
|
||||
GuestDef guest = new GuestDef();
|
||||
guest.setGuestType(GuestDef.guestType.KVM);
|
||||
guest.setGuestArch("x86_64");
|
||||
guest.setMachineType("pc-0.11");
|
||||
guest.setBootOrder(GuestDef.bootOrder.HARDISK);
|
||||
vm.addComp(guest);
|
||||
|
||||
GuestResourceDef grd = new GuestResourceDef();
|
||||
grd.setMemorySize(512 * 1024);
|
||||
grd.setVcpuNum(1);
|
||||
vm.addComp(grd);
|
||||
|
||||
FeaturesDef features = new FeaturesDef();
|
||||
features.addFeatures("pae");
|
||||
features.addFeatures("apic");
|
||||
features.addFeatures("acpi");
|
||||
vm.addComp(features);
|
||||
|
||||
TermPolicy term = new TermPolicy();
|
||||
term.setCrashPolicy("destroy");
|
||||
term.setPowerOffPolicy("destroy");
|
||||
term.setRebootPolicy("destroy");
|
||||
vm.addComp(term);
|
||||
|
||||
DevicesDef devices = new DevicesDef();
|
||||
devices.setEmulatorPath("/usr/bin/cloud-qemu-system-x86_64");
|
||||
|
||||
DiskDef hda = new DiskDef();
|
||||
hda.defFileBasedDisk("/path/to/hda1", 0, DiskDef.diskBus.VIRTIO,
|
||||
DiskDef.diskFmtType.QCOW2);
|
||||
devices.addDevice(hda);
|
||||
|
||||
DiskDef hdb = new DiskDef();
|
||||
hdb.defFileBasedDisk("/path/to/hda2", 1, DiskDef.diskBus.VIRTIO,
|
||||
DiskDef.diskFmtType.QCOW2);
|
||||
devices.addDevice(hdb);
|
||||
|
||||
InterfaceDef pubNic = new InterfaceDef();
|
||||
pubNic.defBridgeNet("cloudbr0", "vnet1", "00:16:3e:77:e2:a1",
|
||||
InterfaceDef.nicModel.VIRTIO);
|
||||
devices.addDevice(pubNic);
|
||||
|
||||
InterfaceDef privNic = new InterfaceDef();
|
||||
privNic.defPrivateNet("cloud-private", null, "00:16:3e:77:e2:a2",
|
||||
InterfaceDef.nicModel.VIRTIO);
|
||||
devices.addDevice(privNic);
|
||||
|
||||
InterfaceDef vlanNic = new InterfaceDef();
|
||||
vlanNic.defBridgeNet("vnbr1000", "tap1", "00:16:3e:77:e2:a2",
|
||||
InterfaceDef.nicModel.VIRTIO);
|
||||
devices.addDevice(vlanNic);
|
||||
|
||||
SerialDef serial = new SerialDef("pty", null, (short) 0);
|
||||
devices.addDevice(serial);
|
||||
|
||||
ConsoleDef console = new ConsoleDef("pty", null, null, (short) 0);
|
||||
devices.addDevice(console);
|
||||
|
||||
GraphicDef grap = new GraphicDef("vnc", (short) 0, true, null, null,
|
||||
null);
|
||||
devices.addDevice(grap);
|
||||
|
||||
InputDef input = new InputDef("tablet", "usb");
|
||||
devices.addDevice(input);
|
||||
|
||||
vm.addComp(devices);
|
||||
|
||||
System.out.println(vm.toString());
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user