mirror of https://github.com/apache/cloudstack.git
agent: Set the listen addr of a VM specificly to the private IP of a host
Now users have to modify their /etc/libvirt/qemu.conf vnc_listen, this is not needed anymore
This commit is contained in:
parent
27e504cb18
commit
bc94948e06
|
|
@ -2481,7 +2481,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
|||
ConsoleDef console = new ConsoleDef("pty", null, null, (short) 0);
|
||||
devices.addDevice(console);
|
||||
|
||||
GraphicDef grap = new GraphicDef("vnc", (short) 0, true, null, null,
|
||||
GraphicDef grap = new GraphicDef("vnc", (short) 0, true, vmTO.getVncAddr(), null,
|
||||
null);
|
||||
devices.addDevice(grap);
|
||||
|
||||
|
|
@ -2507,6 +2507,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
|||
|
||||
protected synchronized StartAnswer execute(StartCommand cmd) {
|
||||
VirtualMachineTO vmSpec = cmd.getVirtualMachine();
|
||||
vmSpec.setVncAddr(cmd.getHostIp());
|
||||
String vmName = vmSpec.getName();
|
||||
LibvirtVMDef vm = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,12 +17,14 @@
|
|||
package com.cloud.agent.api;
|
||||
|
||||
import com.cloud.agent.api.to.VirtualMachineTO;
|
||||
import com.cloud.host.Host;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class StartCommand extends Command {
|
||||
VirtualMachineTO vm;
|
||||
|
||||
String hostIp;
|
||||
|
||||
public VirtualMachineTO getVirtualMachine() {
|
||||
return vm;
|
||||
}
|
||||
|
|
@ -34,8 +36,17 @@ public class StartCommand extends Command {
|
|||
|
||||
protected StartCommand() {
|
||||
}
|
||||
|
||||
|
||||
public StartCommand(VirtualMachineTO vm) {
|
||||
this.vm = vm;
|
||||
}
|
||||
|
||||
public StartCommand(VirtualMachineTO vm, Host host) {
|
||||
this.vm = vm;
|
||||
this.hostIp = host.getPrivateIpAddress();
|
||||
}
|
||||
|
||||
public String getHostIp() {
|
||||
return this.hostIp;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ public class VirtualMachineTO {
|
|||
boolean enableHA;
|
||||
boolean limitCpuUse;
|
||||
String vncPassword;
|
||||
String vncAddr;
|
||||
Map<String, String> params;
|
||||
|
||||
VolumeTO[] disks;
|
||||
|
|
@ -191,6 +192,14 @@ public class VirtualMachineTO {
|
|||
public void setVncPassword(String vncPassword) {
|
||||
this.vncPassword = vncPassword;
|
||||
}
|
||||
|
||||
public String getVncAddr() {
|
||||
return this.vncAddr;
|
||||
}
|
||||
|
||||
public void setVncAddr(String vncAddr) {
|
||||
this.vncAddr = vncAddr;
|
||||
}
|
||||
|
||||
public Map<String, String> getDetails() {
|
||||
return params;
|
||||
|
|
|
|||
|
|
@ -755,7 +755,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
|
|||
vmTO = hvGuru.implement(vmProfile);
|
||||
|
||||
cmds = new Commands(OnError.Stop);
|
||||
cmds.addCommand(new StartCommand(vmTO));
|
||||
cmds.addCommand(new StartCommand(vmTO, dest.getHost()));
|
||||
|
||||
vmGuru.finalizeDeployment(cmds, vmProfile, dest, ctx);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue