如何使用libvirt java api启动来宾域 .
我有一台客机,目前已关机 . 如何开机
那台机器使用libvirt java api .Below是我的代码
@RequestMapping(value = "/power/{vmName}", produces = { "application/json" }, method = RequestMethod.PUT)
public @ResponseBody ResponseEntity updatePower(HttpServletRequest request, @PathVariable("vmName") String vmName) throws LibvirtException {
ResponseEntity resp = null;
Connect conn = Connection.getConnection();
Domain machine=conn.domainLookupByName(vmName);
if(machine.isActive()==1){
machine.shutdown();
}else{
//I need to start my guest domain here if its inactive.
}
return resp;
}