Merge remote-tracking branch 'apache/4.18' into main

This commit is contained in:
Abhishek Kumar 2023-10-20 17:40:19 +05:30
commit 99ded8169b
5 changed files with 36 additions and 1 deletions

View File

@ -4331,7 +4331,9 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
if (nic == null || vmProfile.getType() == VirtualMachine.Type.User) {
final int deviceId = _nicDao.getFreeDeviceId(vm.getId());
nic = allocateNic(requested, network, false, deviceId, vmProfile).first();
boolean isDefaultNic = getNicProfileDefaultNic(requested);
nic = allocateNic(requested, network, isDefaultNic, deviceId, vmProfile).first();
if (nic == null) {
throw new CloudRuntimeException("Failed to allocate nic for vm " + vm + " in network " + network);
@ -4359,6 +4361,16 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
return nic;
}
private boolean getNicProfileDefaultNic(NicProfile nicProfile) {
if (nicProfile != null) {
s_logger.debug(String.format("Using requested nic profile isDefaultNic value [%s].", nicProfile.isDefaultNic()));
return nicProfile.isDefaultNic();
}
s_logger.debug("Using isDefaultNic default value [false] as requested nic profile is null.");
return false;
}
@Override
public List<NicProfile> getNicProfiles(final VirtualMachine vm) {
final List<NicVO> nics = _nicDao.listByVmId(vm.getId());

View File

@ -1441,6 +1441,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
}
}
setNicAsDefaultIfNeeded(vmInstance, profile);
NicProfile guestNic = null;
boolean cleanUp = true;
@ -1469,6 +1471,18 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
return _vmDao.findById(vmInstance.getId());
}
/**
* Set NIC as default if VM has no default NIC
* @param vmInstance VM instance to be checked
* @param nicProfile NIC profile to be updated
*/
public void setNicAsDefaultIfNeeded(UserVmVO vmInstance, NicProfile nicProfile) {
if (_networkModel.getDefaultNic(vmInstance.getId()) == null) {
s_logger.debug(String.format("Setting NIC %s as default as VM %s has no default NIC.", nicProfile.getName(), vmInstance.getName()));
nicProfile.setDefaultNic(true);
}
}
/**
* duplicated in {@see VirtualMachineManagerImpl} for a {@see VMInstanceVO}
*/

View File

@ -3149,6 +3149,7 @@
"message.vr.alert.upon.network.offering.creation.l2": "As virtual routers are not created for L2 networks, the compute offering will not be used.",
"message.vr.alert.upon.network.offering.creation.others": "As none of the obligatory services for creating a virtual router (VPN, DHCP, DNS, Firewall, LB, UserData, SourceNat, StaticNat, PortForwarding) are enabled, the virtual router will not be created and the compute offering will not be used.",
"message.warn.filetype": "jpg, jpeg, png, bmp and svg are the only supported image formats.",
"message.warn.importing.instance.without.nic": "WARNING: this instance is being imported without NICs and many network resources will not be available. Consider creating a NIC via VCenter before importing or as soon as the instance is imported.",
"message.warn.zone.mtu.update": "Please note that this limit won't affect pre-existing networks MTU settings",
"message.zone.creation.complete": "Zone creation complete.",
"message.zone.detail.description": "Populate zone details.",

View File

@ -2477,6 +2477,7 @@
"message.vr.alert.upon.network.offering.creation.l2": "Como VRs não são criados para redes do tipo L2, a oferta de computação não será utilizada.",
"message.vr.alert.upon.network.offering.creation.others": "Como nenhum dos serviços obrigatórios para criação do VR (VPN, DHCP, DNS, Firewall, LB, UserData, SourceNat, StaticNat, PortForwarding) foram habilitados, o VR não será criado e a oferta de computação não será usada.",
"message.warn.filetype": "jpg, jpeg, png, bmp e svg s\u00e3o os \u00fanicos formatos de imagem suportados",
"message.warn.importing.instance.without.nic": "AVISO: essa instância está sendo importada sem NICs e muitos recursos de rede não estarão disponíveis. Considere criar uma NIC antes de importar via VCenter ou assim que a instância for importada.",
"message.zone.creation.complete": "Cria\u00e7\u00e3o de zona completa",
"message.zone.detail.description": "Preencha os detalhes da zona",
"message.zone.detail.hint": "Uma zona \u00e9 a maior unidade organizacional no CloudStack, e normalmente corresponde a um \u00fanico datacenter. As zonas proporcionam isolamento f\u00edsico e redund\u00e2ncia. Uma zona consiste em um ou mais pods (cada um contendo hosts e servidores de armazenamento prim\u00e1rio) e um servidor de armazenamento secund\u00e1rio que \u00e9 compartilhado por todos os pods da zona.",

View File

@ -227,6 +227,13 @@
filterMatchKey="broadcasturi"
@select-multi-network="updateMultiNetworkOffering" />
</div>
<a-row v-else style="margin: 12px 0">
<a-alert type="warning">
<template #message>
<div v-html="$t('message.warn.importing.instance.without.nic')"></div>
</template>
</a-alert>
</a-row>
<a-row :gutter="12">
<a-col :md="24" :lg="12">
<a-form-item name="migrateallowed" ref="migrateallowed">