public void scaleCPU(int scaleToVal)
	{
		
		String vmname = config.getvm_name();
		int currentCPUCap, scaleToCPUCap;
		ProcessBuilder p = new ProcessBuilder("/bin/bash","-c","xm sched-credit");
		Process proc;
		try {
			proc = p.start();
			
			BufferedReader output = new BufferedReader(new InputStreamReader(proc.getInputStream()));
			BufferedReader error = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
			
			String line = "";
			
			while ((line = output.readLine()) != null) {
				String parts[] = line.split("\\s+");
				if (vmname.equals(parts[0]))
				{
					currentCPUCap=Integer.parseInt(parts[2]);
					if(scaleToVal > 0 && scaleToVal <= 10)
						scaleToCPUCap = currentCPUCap - 64;
					else if(scaleToVal > 85)
						scaleToCPUCap = currentCPUCap + 256;
					else
						scaleToCPUCap = currentCPUCap + 64;
					
					logger.info("Elastically Scaling CPU value : " + scaleToCPUCap);
					
					p = new ProcessBuilder("/bin/bash","-c","xm sched-credit -d "+vmname+" -w "+scaleToCPUCap);
					proc = p.start();
					BufferedReader innerOutput = new BufferedReader(new InputStreamReader(proc.getInputStream()));
					BufferedReader innerError = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
					while ((line = innerError.readLine()) != null) {
						parts = line.split(":");
						if ("Error".equals(parts[0]))
						{
							logger.error("Command didn't execute successfully: xm sched-credit -d "+vmname+" -w "+scaleToCPUCap);
							break;
						}
					}	
					break;
				}
			}			
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
	}