commandList.add(new Command("n", Actions.OP_NAME,
Actions.DESC_LAUNCH_NAME,"", true, true));
commandList.add(new Command("p", Actions.OP_PATH,
- Actions.DESC_LAUNCH_PATH, FilePathResources.getBinPath(), false, true));
+ Actions.DESC_LAUNCH_PATH, FilePathResources.getEmulatorBinPath(""), false, true));
commandList.add(new Command("t", Actions.OP_TEST,
Actions.DESC_TEST, "", false, false));
/*
return getEmulatorDataPath(platformVersion) + bios_suffix;
}
- public static String getEmulatorQemuImgPath(String platformVersion) {
- return getEmulatorBinPath(platformVersion) + qemuImg_suffic;
+ public static String getEmulatorQemuImgPath() {
+ return getEmulatorToolPath() + qemuImg_suffic;
}
public static String getEmulatorDataPath(String platformVersion) {
return getEmulatorPath(platformVersion) + data_suffix;
}
+ public static String getEmulatorToolPath() {
+ // TODO return /tools/emulator/bin
+ return getEmulatorPath("2.4") + bin_suffix;
+ }
+
public static String getEmulatorPath(String platformVersion) {
String emulatorPath;
+ if (platformVersion == null || platformVersion.isEmpty()) {
+ platformVersion = "2.4"; // TODO Get lastest version.
+ }
try {
emulatorPath = new File(platformsPath + platform_prefix
+ platformVersion + common_suffix + emulator_suffix).getCanonicalPath();
int exitValue = 1;
List<String> cmd = new ArrayList<String>();
- cmd.add(FilePathResources.getBinPath() + File.separator +
+ cmd.add(FilePathResources.getEmulatorToolPath() + File.separator +
(System.getProperty("os.name").toLowerCase().indexOf("windows") > -1 ? "check-hax.exe" : "check-hax"));
ProcessBuilder pb = new ProcessBuilder(cmd);
- pb.directory(new File(FilePathResources.getBinPath()));
+ pb.directory(new File(FilePathResources.getEmulatorToolPath()));
try {
Process process = pb.start();
int exitValue = 1;
List<String> cmd = new ArrayList<String>();
- cmd.add(FilePathResources.getBinPath() + File.separator +
+ cmd.add(FilePathResources.getEmulatorToolPath() + File.separator +
(System.getProperty("os.name").toLowerCase().indexOf("windows") > -1 ? "check-gl.exe" : "check-gl"));
ProcessBuilder pb = new ProcessBuilder(cmd);
- pb.directory(new File(FilePathResources.getBinPath()));
+ pb.directory(new File(FilePathResources.getEmulatorToolPath()));
try {
Process process = pb.start();
import com.sun.jna.platform.win32.WinReg.HKEYByReference;
public class TapUtil {
- private static String devconPath = FilePathResources.getBinPath() + File.separator + "devcon.exe";
+
+ public static String getDevconPath(String platformVersion) {
+ return FilePathResources.getEmulatorBinPath(platformVersion)
+ + File.separator + "devcon.exe";
+ }
+
public static String getBridgeFromDevice(String device)
throws VMWorkerException {
}
public static void createTapDevice(String tapName, String ifName,
- ComboViewItem comboViewItem) {
+ ComboViewItem comboViewItem, String platformVersion) {
if (EmulatorManager.isWin()) {
MessageDialog msgDialog = new MessageDialog();
msgDialog
.openNoButtonInfoDialog("Creating tap device.\nThis will take minutes..");
TapCreateWorker worker = new TapCreateWorker(tapName, ifName,
- msgDialog, comboViewItem);
+ msgDialog, comboViewItem, platformVersion);
worker.start();
}
public static boolean isWinBridgeExist() {
String proxyCommand = "check-net.exe";
boolean isExist = false;
- List<String> cmd = Arrays.asList(FilePathResources.getBinPath()
+ List<String> cmd = Arrays.asList(FilePathResources.getEmulatorToolPath()
+ File.separator + proxyCommand, "--bridge");
ProcessResult res = HelperClass.runProcess(cmd);
boolean isCommandSuccess = false;
final String tapName;
final String ifName;
final ComboViewItem comboViewItem; // for refresh combo-list
+ final String platformVersion;
public TapCreateWorker(String tapName, String ifName,
- MessageDialog dialog, ComboViewItem comboViewItem) {
+ MessageDialog dialog, ComboViewItem comboViewItem, String platformVersion) {
this.dialog = dialog;
this.tapName = tapName;
this.ifName = ifName;
this.comboViewItem = comboViewItem;
+ this.platformVersion = platformVersion;
}
@Override
if (!EmulatorManager.isWin8()) {
EMLogger.getLogger().info(
"get CompatibleIDs from pci network device");
- cmd = Arrays.asList(devconPath, "find", "=net",
+ cmd = Arrays.asList(getDevconPath(platformVersion), "find", "=net",
"@pci*");
res = HelperClass.runProcess(cmd);
boolean isCommandSuccess = false;
// Create Bridge device and set IP
EMLogger.getLogger().info("create bridge");
cmd = Arrays
- .asList(devconPath,
+ .asList(getDevconPath(platformVersion),
"install",
"c:\\windows\\inf\\netbrdgm.inf",
"ms_bridgemp");
}
EMLogger.getLogger().info("bind interface to bridge");
- cmd = Arrays.asList(FilePathResources.getBinPath()
+ cmd = Arrays.asList(FilePathResources.getEmulatorBinPath(platformVersion)
+ File.separator + "bindbridge.exe",
"ms_bridge", CompatibleIDs, "bind");
res = HelperClass.runProcess(cmd);
// Create new tap
EMLogger.getLogger().info("Create new tap.");
- cmd = Arrays.asList(devconPath, "install",
- FilePathResources.getBinPath() + File.separator
+ cmd = Arrays.asList(getDevconPath(platformVersion), "install",
+ FilePathResources.getEmulatorBinPath(platformVersion) + File.separator
+ "OemWin2k.inf", "Tap0901");
res = HelperClass.runProcess(cmd);
EMLogger.getLogger().info("bind host network to bridge");
String tapPnpInstanceID = getPnpInstanceIDFromName(tapName);
- cmd = Arrays.asList(FilePathResources.getBinPath()
+ cmd = Arrays.asList(FilePathResources.getEmulatorBinPath(platformVersion)
+ File.separator + "bindbridge.exe", "ms_bridge",
tapPnpInstanceID, "bind");
res = HelperClass.runProcess(cmd);
EMLogger.getLogger().info(
"wait while finishing bridged network setting");
String proxyCommand = "check-net.exe";
- cmd = Arrays.asList(FilePathResources.getBinPath()
+ cmd = Arrays.asList(FilePathResources.getEmulatorToolPath()
+ File.separator + proxyCommand, "--bridge");
res = HelperClass.runProcess(cmd);
while (!res.getStdOutMsg().isEmpty()) {
boolean isBridge = false;
NetTapDeviceViewItemWin thisItem;
+ String platformVersion = "";
public NetTapDeviceViewItemWin(Item template,
LineLabelViewItem lineLabelViewItem) {
@Override
public void widgetSelected(SelectionEvent arg0) {
- TapDeviceDialogForWin.open(thisItem);
+ TapDeviceDialogForWin.open(thisItem, platformVersion);
resetCombo(NetConnectTypeViewItem.VALUE_BRIDGE);
}
@Override
public boolean settingModifyItem(VMPropertyValue value) {
oldValue = newValue = value.getAdvancedOptionValue(name);
+ platformVersion = value.version;
// text.setText(newValue);
AdvancedViewItem item = lineLabelViewItem
private static String ifName;
private static ComboViewItem comboViewItem;
+ private static String platformVersion;
public static ArrayList<String> getInterfaceList() {
// Get intereface list
ProcessResult res;
ArrayList<String> ifList = new ArrayList<String>();
- List<String> cmd = Arrays.asList(FilePathResources.getBinPath()
+ List<String> cmd = Arrays.asList(FilePathResources.getEmulatorBinPath(platformVersion)
+ File.separator + "devcon.exe", "find", "=net", "@pci*");
res = HelperClass.runProcess(cmd);
boolean isCommandSuccess = false;
return ifList;
}
- public static void open(ComboViewItem comboViewItem) {
+ public static void open(ComboViewItem comboViewItem, String platformVersion) {
TapDeviceDialogForWin.comboViewItem = comboViewItem;
+ TapDeviceDialogForWin.platformVersion = platformVersion;
makeDialog();
dialog.open();
while (!dialog.isDisposed()) {
}
dialog.close();
- TapUtil.createTapDevice(tapName, ifName, comboViewItem);
+ TapUtil.createTapDevice(tapName, ifName, comboViewItem, platformVersion);
// } else {
// new MessageDialog().openWarningDialog("Name already exist.");
ec.getBaseInformation().setDiskImage(factory.createBaseInformationTypeDiskImage());
if (newVM.isStandard) {
ec.getBaseInformation().getDiskImage().setType("standard");
- // TODO : get version
- if (newVM.version != null) {
- ec.getBaseInformation().getDiskImage().setVersion(newVM.version);
- } else {
- // TODO : temp name
- ec.getBaseInformation().getDiskImage().setVersion("Standard");
- }
} else {
ec.getBaseInformation().getDiskImage().setType("custom");
ec.getBaseInformation().setArchitecture(EmulatorVMList.getInstance().CustomArch);
}
+
+ // TODO : get version
+ if (newVM.version != null) {
+ ec.getBaseInformation().getDiskImage().setVersion(newVM.version);
+ } else {
+ // TODO : temp name
+ ec.getBaseInformation().getDiskImage().setVersion("Standard");
+ }
if (newVM.baseName != null) {
ec.getBaseInformation().getDiskImage().setBase(newVM.baseName);
}
// TODO :
ec.getBaseInformation().getDiskImage().getBaseDiskImage().setFormat("qcow2");
ec.getBaseInformation().getDiskImage().getBaseDiskImage().setValue(newVM.baseImagePath);
+ ec.getBaseInformation().getDiskImage().setBase(newVM.baseName);
+
if (!newVM.baseImage.getBinaryVersion().isEmpty()) {
ec.getBaseInformation().getDiskImage().getBaseDiskImage().setVersion(newVM.baseImage.getBinaryVersion());
}
private String getQemuImgPath() {
// return FilePathResources.getBinPath() + File.separator + "qemu-img";
- return FilePathResources.getEmulatorQemuImgPath(newVM.version);
+ return FilePathResources.getEmulatorQemuImgPath();
}
}
CheckingRunningEmulator.addEmulator(property);
MonitoringEmulator monitor = new MonitoringEmulator(property);
- Process process = launch(property.getName(), cmd, path);
+ Process process = launch(property.getName(), property.getPropertyValue().version,
+ cmd, path);
if (process != null) {
monitor.setProcess(process);
monitor.start();
private static List<String> getCommand(VMProperty property)
throws VMLauncherException {
- String binaryPath = FilePathResources.getBinPath() + File.separator
- + getBinary(property.getArch().toString());
+ String binaryPath = FilePathResources.getEmulatorBinPath(property.getPropertyValue().version)
+ + File.separator + getBinary(property.getArch().toString());
String configPath = LaunchConfig
.getLaunchConfigPath(property.getName());
if (!new File(configPath).exists()) {
return binary;
}
- public static Process launch(String vmName, List<String> cmd, String binPath) {
+ public static Process launch(String vmName, String platformVersion,
+ List<String> cmd, String binPath) {
ProcessBuilder pb = new ProcessBuilder(cmd);
// Make backup log.
String value = env.get("LD_LIBRARY_PATH");
env.put("LD_LIBRARY_PATH",
((value == null) ? "" : value + ":")
- + FilePathResources.getBinPath() + ":"
+ + FilePathResources.getEmulatorBinPath(platformVersion) + ":"
+ FilePathResources.getRemotePath()
+ File.separator + "lib:");
EMLogger.getLogger().log(Level.INFO,
}
if (binPath == null || binPath.isEmpty()) {
- pb.directory(new File(FilePathResources.getBinPath()));
+ pb.directory(new File(FilePathResources.getEmulatorBinPath(platformVersion)));
} else {
pb.directory(new File(binPath));
}
+ baseImage.getAbsolutePath());
}
- String exe_path = FilePathResources.getEmulatorQemuImgPath(property.getPropertyValue().version);
+ String exe_path = FilePathResources.getEmulatorQemuImgPath();
List<String> cmd = new ArrayList<String>();
cmd.add(exe_path);
isError = false;
ProcessBuilder pb = new ProcessBuilder(cmd);
- pb.directory(new File(FilePathResources.getBinPath()));
+ pb.directory(new File(FilePathResources.getEmulatorToolPath()));
try {
Process process = pb.start();
if (process != null) {
isError = false;
ProcessBuilder pb = new ProcessBuilder(cmd);
- pb.directory(new File(FilePathResources.getBinPath()));
+ pb.directory(new File(FilePathResources.getEmulatorToolPath()));
try {
Process process = pb.start();
if (process != null) {
config.addQemuOption("-device virtconsole,chardev=con1");
}
+ String platformVersion = property.getPropertyValue().version;
// bios
- config.addVariable(VAR_BIOS_PATH, FilePathResources.getBiosPath());
+ config.addVariable(VAR_BIOS_PATH, FilePathResources.getEmulatorBiosPath(platformVersion));
config.addQemuOption("-L", varForm(VAR_BIOS_PATH));
// kernel image
- config.addVariable(VAR_KERNEL, FilePathResources.getKernelPath()
+ config.addVariable(VAR_KERNEL, FilePathResources.getEmulatorKernelPath(platformVersion)
+ File.separator + "bzImage." + property.getArch().toString());
config.addQemuOption("-kernel", varForm(VAR_KERNEL));
.getAdvancedOptionSubValue(ItemName.NET_PROXY,
NetProxyViewItem.ITEM_PROXY_MODE);
if (proxyMode.equals(NetProxyViewItem.MODE_AUTO)) {
- proxyConfig = getHostProxy();
+ proxyConfig = getHostProxy(property.getPropertyValue().version);
} else if (proxyMode.equals(NetProxyViewItem.MODE_MANUAL)) {
proxyConfig = "http_proxy="
}
- private String getHostProxy() throws VMWorkerException {
+ private String getHostProxy(String platformVersion) throws VMWorkerException {
String result = null;
String proxyCommand = "check-net";
if (EmulatorManager.isWin()) {
proxyCommand = "check-net.exe";
}
- List<String> cmd = Arrays.asList(FilePathResources.getBinPath()
+ List<String> cmd = Arrays.asList(FilePathResources.getEmulatorToolPath()
+ File.separator + proxyCommand, "--proxy");
ProcessResult res = HelperClass.runProcess(cmd);
boolean isCommandSuccess = false;