1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

Polishing VMWare VMM

git-svn-id: http://svn.opennebula.org/one/trunk@493 3034c82b-c49b-4eb3-8279-a7acafdc01c0
This commit is contained in:
Constantino Vázquez Blanco 2009-04-27 18:52:05 +00:00
parent 34c11ea6c3
commit f386cadf21
3 changed files with 33 additions and 12 deletions

View File

@ -169,7 +169,7 @@ public class DeployVM
return datastoreName;
}
private boolean shapeVM() throws Exception
public boolean shapeVM() throws Exception
{
virtualMachine

View File

@ -124,25 +124,26 @@ class OneVmmVmware extends Thread
// TODO this is just for testing
// argsWithHost[arguments.length + 1 ] = "https://" + hostName + ":443/sdk";
argsWithHost[arguments.length + 1 ] = "https://localhost:8008/sdk";
RegisterVM rVM = new RegisterVM(argsWithHost, hostName, "one-" + vid_str);
if(!rVM.registerVirtualMachine())
{
throw new Exception("Error registering VM.")
}
// Now, let's read the XML file and extract needed info
// let's read the XML file and extract needed info
ParseXML pXML = new ParseXML(fileName);
// Now, proceed with the reconfiguration
DeployVM dVM = new DeployVM(argsWithHost, hostName, "one-" + vid_str,pXML);
if(!rVM.shapeVM())
if(!dVM.registerVirtualMachine())
{
throw new Exception("Error reconfiguring VM.")
throw new Exception("Error registering VM.");
}
// Now, proceed with the reconfiguration
if(!dVM.shapeVM())
{
throw new Exception("Error reconfiguring VM.");
}
continue;
}
catch(Exception e)

View File

@ -13,7 +13,7 @@ import org.xml.sax.SAXParseException;
public class ParseXML
{
private String name;
private String cpu;
private String[] disk;
private String memory;
@ -41,6 +41,17 @@ public class ParseXML
throw new Exception("Number of VM tags different of 1: [" + vm.getLength() + "]");
}
// Name
NodeList nameNL = doc.getElementsByTagName("NAME");
if(nameNL.getLength()!=1)
{
throw new Exception("Number of NAME tags different of 1: [" + nameNL.getLength() + "]");
}
name = ((Node)nameNL.item(0)).getNodeValue().trim();
// CPU
NodeList cpuNL = doc.getElementsByTagName("CPU");
@ -137,4 +148,13 @@ public class ParseXML
{
return macs;
}
/**
* Returns VM name
* @return anme of the VM
**/
String getName()
{
return name;
}
}