CLOUDSTACK-6790: Disable PXE ROM for system vm nics

This commit is contained in:
Marcus Sorensen 2014-05-27 16:47:16 -06:00
parent 021a604493
commit 7ce3034299
6 changed files with 35 additions and 1 deletions

View File

@ -23,6 +23,7 @@ public class NicTO extends NetworkTO {
Integer networkRateMbps;
Integer networkRateMulticastMbps;
boolean defaultNic;
boolean pxeDisable;
String uuid;
List<String> nicSecIps;
@ -58,6 +59,14 @@ public class NicTO extends NetworkTO {
this.defaultNic = defaultNic;
}
public void setPxeDisable(boolean pxeDisable) {
this.pxeDisable = pxeDisable;
}
public boolean getPxeDisable() {
return pxeDisable;
}
@Override
public String getUuid() {
return uuid;

View File

@ -904,6 +904,9 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
} else {
to.setGateway(config.getGateway());
}
if (nic.getVmType() != VirtualMachine.Type.User) {
to.setPxeDisable(true);
}
to.setDefaultNic(nic.isDefaultNic());
to.setBroadcastUri(nic.getBroadcastUri());
to.setIsolationuri(nic.getIsolationUri());

View File

@ -142,6 +142,9 @@ public class BridgeVifDriver extends VifDriverBase {
String storageBrName = nic.getName() == null ? _bridges.get("private") : nic.getName();
intf.defBridgeNet(storageBrName, null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter));
}
if (nic.getPxeDisable() == true) {
intf.setPxeDisable(true);
}
return intf;
}

View File

@ -3793,6 +3793,14 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
_vms.put(vmName, State.Starting);
}
NicTO[] nics = vmSpec.getNics();
for (NicTO nic : nics) {
if (vmSpec.getType() != VirtualMachine.Type.User) {
nic.setPxeDisable(true);
}
}
vm = createVMFromSpec(vmSpec);
conn = LibvirtConnection.getConnectionByType(vm.getHvsType());
@ -3808,7 +3816,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
s_logger.debug("starting " + vmName + ": " + vm.toString());
startVM(conn, vmName, vm.toString());
NicTO[] nics = vmSpec.getNics();
for (NicTO nic : nics) {
if (nic.isSecurityGroupEnabled() || (nic.getIsolationUri() != null && nic.getIsolationUri().getScheme().equalsIgnoreCase(IsolationType.Ec2.toString()))) {
if (vmSpec.getType() != VirtualMachine.Type.User) {

View File

@ -765,6 +765,7 @@ public class LibvirtVMDef {
private String _virtualPortType;
private String _virtualPortInterfaceId;
private int _vlanTag = -1;
private boolean _pxeDisable = false;
public void defBridgeNet(String brName, String targetBrName, String macAddr, nicModel model) {
defBridgeNet(brName, targetBrName, macAddr, model, 0);
@ -832,6 +833,10 @@ public class LibvirtVMDef {
return _hostNetType;
}
public void setPxeDisable(boolean pxeDisable) {
_pxeDisable = pxeDisable;
}
public String getBrName() {
return _sourceName;
}
@ -909,6 +914,9 @@ public class LibvirtVMDef {
if (_scriptPath != null) {
netBuilder.append("<script path='" + _scriptPath + "'/>\n");
}
if (_pxeDisable) {
netBuilder.append("<rom bar='off' file='dummy'/>");
}
if (_virtualPortType != null) {
netBuilder.append("<virtualport type='" + _virtualPortType + "'>\n");
if (_virtualPortInterfaceId != null) {

View File

@ -97,6 +97,10 @@ public abstract class HypervisorGuruBase extends AdapterBase implements Hypervis
// Workaround to make sure the TO has the UUID we need for Niciri integration
NicVO nicVO = _nicDao.findById(profile.getId());
to.setUuid(nicVO.getUuid());
// disable pxe on system vm nics to speed up boot time
if(nicVO != null && nicVO.getVmType() != VirtualMachine.Type.User){
to.setPxeDisable(true);
}
//check whether the this nic has secondary ip addresses set
//set nic secondary ip address in NicTO which are used for security group
// configuration. Use full when vm stop/start