mirror of https://github.com/apache/cloudstack.git
Merge 7c4300623f into 5893ba5a8c
This commit is contained in:
commit
19af7d1007
|
|
@ -232,7 +232,7 @@ public interface NetworkService {
|
|||
/**
|
||||
* Requests an IP address for the guest NIC
|
||||
*/
|
||||
NicSecondaryIp allocateSecondaryGuestIP(long nicId, IpAddresses requestedIpPair) throws InsufficientAddressCapacityException;
|
||||
NicSecondaryIp allocateSecondaryGuestIP(long nicId, IpAddresses requestedIpPair, String description) throws InsufficientAddressCapacityException;
|
||||
|
||||
boolean releaseSecondaryIpFromNic(long ipAddressId);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ public interface NicSecondaryIp extends ControlledEntity, Identity, InternalIden
|
|||
|
||||
String getIp6Address();
|
||||
|
||||
String getDescription();
|
||||
|
||||
long getNetworkId();
|
||||
|
||||
long getVmId();
|
||||
|
|
|
|||
|
|
@ -56,6 +56,9 @@ public class AddIpToVmNicCmd extends BaseAsyncCreateCmd {
|
|||
@Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, required = false, description = "Secondary IP Address")
|
||||
private String ipAddr;
|
||||
|
||||
@Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, required = false, description = "Description", length = 2048)
|
||||
private String description;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -160,7 +163,7 @@ public class AddIpToVmNicCmd extends BaseAsyncCreateCmd {
|
|||
}
|
||||
|
||||
try {
|
||||
result = _networkService.allocateSecondaryGuestIP(getNicId(), requestedIpPair);
|
||||
result = _networkService.allocateSecondaryGuestIP(getNicId(), requestedIpPair, description);
|
||||
if (result != null) {
|
||||
setEntityId(result.getId());
|
||||
setEntityUuid(result.getUuid());
|
||||
|
|
|
|||
|
|
@ -53,6 +53,10 @@ public class NicSecondaryIpResponse extends BaseResponse {
|
|||
@Param(description = "The ID of the Instance")
|
||||
private String vmId;
|
||||
|
||||
@SerializedName(ApiConstants.DESCRIPTION)
|
||||
@Param(description = "description")
|
||||
private String description;
|
||||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
return this.getId();
|
||||
|
|
@ -98,6 +102,14 @@ public class NicSecondaryIpResponse extends BaseResponse {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public List<NicSecondaryIpResponse> getSecondaryIpsList() {
|
||||
return secondaryIpsList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class AddIpToVmNicTest extends TestCase {
|
|||
NicSecondaryIp secIp = Mockito.mock(NicSecondaryIp.class);
|
||||
|
||||
Mockito.when(
|
||||
networkService.allocateSecondaryGuestIP(ArgumentMatchers.anyLong(), ArgumentMatchers.any()))
|
||||
networkService.allocateSecondaryGuestIP(ArgumentMatchers.anyLong(), ArgumentMatchers.any(), ArgumentMatchers.anyString()))
|
||||
.thenReturn(secIp);
|
||||
|
||||
ipTonicCmd._networkService = networkService;
|
||||
|
|
@ -79,7 +79,7 @@ public class AddIpToVmNicTest extends TestCase {
|
|||
AddIpToVmNicCmd ipTonicCmd = Mockito.mock(AddIpToVmNicCmd.class);
|
||||
|
||||
Mockito.when(
|
||||
networkService.allocateSecondaryGuestIP(ArgumentMatchers.anyLong(), ArgumentMatchers.any()))
|
||||
networkService.allocateSecondaryGuestIP(ArgumentMatchers.anyLong(), ArgumentMatchers.any(), ArgumentMatchers.anyString()))
|
||||
.thenReturn(null);
|
||||
|
||||
ipTonicCmd._networkService = networkService;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class NicSecondaryIpVO implements NicSecondaryIp {
|
|||
this.networkId = networkId;
|
||||
}
|
||||
|
||||
public NicSecondaryIpVO(long nicId, String ip4Address, String ip6Address, long vmId, long accountId, long domainId, long networkId) {
|
||||
public NicSecondaryIpVO(long nicId, String ip4Address, String ip6Address, long vmId, long accountId, long domainId, long networkId, String description) {
|
||||
this.nicId = nicId;
|
||||
this.vmId = vmId;
|
||||
this.ip4Address = ip4Address;
|
||||
|
|
@ -51,6 +51,7 @@ public class NicSecondaryIpVO implements NicSecondaryIp {
|
|||
this.accountId = accountId;
|
||||
this.domainId = domainId;
|
||||
this.networkId = networkId;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
protected NicSecondaryIpVO() {
|
||||
|
|
@ -88,6 +89,18 @@ public class NicSecondaryIpVO implements NicSecondaryIp {
|
|||
@Column(name = "vmId")
|
||||
long vmId;
|
||||
|
||||
@Column(name = "description")
|
||||
String description;
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("NicSecondaryIp %s",
|
||||
|
|
|
|||
|
|
@ -131,3 +131,6 @@ CREATE TABLE IF NOT EXISTS `cloud_usage`.`quota_tariff_usage` (
|
|||
-- Add the 'keep_mac_address_on_public_nic' column to the 'cloud.networks' and 'cloud.vpc' tables
|
||||
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.networks', 'keep_mac_address_on_public_nic', 'TINYINT(1) NOT NULL DEFAULT 1');
|
||||
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vpc', 'keep_mac_address_on_public_nic', 'TINYINT(1) NOT NULL DEFAULT 1');
|
||||
|
||||
-- Add description for secondary IP addresses
|
||||
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.nic_secondary_ips','description', 'varchar(2048) DEFAULT NULL');
|
||||
|
|
|
|||
|
|
@ -4759,6 +4759,7 @@ public class ApiResponseHelper implements ResponseGenerator, ResourceIdSupport {
|
|||
setResponseIpAddress(result, response);
|
||||
response.setNicId(nic.getUuid());
|
||||
response.setNwId(network.getUuid());
|
||||
response.setDescription(result.getDescription());
|
||||
response.setObjectName("nicsecondaryip");
|
||||
return response;
|
||||
}
|
||||
|
|
@ -4845,6 +4846,7 @@ public class ApiResponseHelper implements ResponseGenerator, ResourceIdSupport {
|
|||
for (NicSecondaryIpVO ip : secondaryIps) {
|
||||
NicSecondaryIpResponse ipRes = new NicSecondaryIpResponse();
|
||||
ipRes.setId(ip.getUuid());
|
||||
ipRes.setDescription(ip.getDescription());
|
||||
setResponseIpAddress(ip, ipRes);
|
||||
ipList.add(ipRes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -386,6 +386,7 @@ public class UserVmJoinDaoImpl extends GenericDaoBaseWithTagInformation<UserVmJo
|
|||
for (NicSecondaryIpVO ip : secondaryIps) {
|
||||
NicSecondaryIpResponse ipRes = new NicSecondaryIpResponse();
|
||||
ipRes.setId(ip.getUuid());
|
||||
ipRes.setDescription(ip.getDescription());
|
||||
ApiResponseHelper.setResponseIpAddress(ip, ipRes);
|
||||
ipList.add(ipRes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -891,7 +891,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
|
|||
*/
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_NIC_SECONDARY_IP_ASSIGN, eventDescription = "Assigning secondary IP to NIC", create = true)
|
||||
public NicSecondaryIp allocateSecondaryGuestIP(final long nicId, IpAddresses requestedIpPair) throws InsufficientAddressCapacityException {
|
||||
public NicSecondaryIp allocateSecondaryGuestIP(final long nicId, IpAddresses requestedIpPair, String description) throws InsufficientAddressCapacityException {
|
||||
|
||||
Account caller = CallContext.current().getCallingAccount();
|
||||
String ipv4Address = requestedIpPair.getIp4Address();
|
||||
|
|
@ -989,7 +989,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
|
|||
|
||||
logger.debug("Setting nic_secondary_ip table ...");
|
||||
Long vmId = nicVO.getInstanceId();
|
||||
NicSecondaryIpVO secondaryIpVO = new NicSecondaryIpVO(nicId, ip4AddrFinal, ip6AddrFinal, vmId, ipOwner.getId(), ipOwner.getDomainId(), networkId);
|
||||
NicSecondaryIpVO secondaryIpVO = new NicSecondaryIpVO(nicId, ip4AddrFinal, ip6AddrFinal, vmId, ipOwner.getId(), ipOwner.getDomainId(), networkId, description);
|
||||
_nicSecondaryIpDao.persist(secondaryIpVO);
|
||||
return secondaryIpVO.getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -904,7 +904,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkOrches
|
|||
}
|
||||
|
||||
@Override
|
||||
public NicSecondaryIp allocateSecondaryGuestIP(long nicId, IpAddresses requestedIpPair) {
|
||||
public NicSecondaryIp allocateSecondaryGuestIP(long nicId, IpAddresses requestedIpPair, String description) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1742,6 +1742,7 @@
|
|||
"label.new.password": "New password",
|
||||
"label.new.project": "New Project",
|
||||
"label.new.secondaryip.description": "Enter new secondary IP address",
|
||||
"label.new.secondaryip.description.description": "Enter a description for the new secondary IP address",
|
||||
"label.new.tag": "New tag",
|
||||
"label.new.vm": "New Instance",
|
||||
"label.new.version.available": "New version available",
|
||||
|
|
@ -2251,6 +2252,7 @@
|
|||
"label.secondary.storage": "Secondary Storage",
|
||||
"label.secondary.storage.vm": "Secondary Storage VM",
|
||||
"label.secondaryips": "Secondary IPs",
|
||||
"label.secondaryip.description": "Description",
|
||||
"label.secondarystoragelimit": "Secondary Storage limits (GiB)",
|
||||
"label.secretkey": "Secret key",
|
||||
"label.secured": "Secured",
|
||||
|
|
|
|||
|
|
@ -1114,6 +1114,7 @@
|
|||
"label.new.password": "Nova senha",
|
||||
"label.new.project": "Novo projeto",
|
||||
"label.new.secondaryip.description": "Insira um novo endere\u00e7o IP secund\u00e1rio",
|
||||
"label.new.secondaryip.description.description": "Insira uma descri\u00e7\u00e3o para o novo endere\u00e7o IP secund\u00e1rio",
|
||||
"label.new.tag": "Nova etiqueta",
|
||||
"label.new.vm": "Nova VM",
|
||||
"label.newdiskoffering": "Nova oferta",
|
||||
|
|
@ -1452,6 +1453,7 @@
|
|||
"label.secondary.storage": "Armazenamento secund\u00e1rio",
|
||||
"label.secondary.storage.vm": "VM de armazenamento secund\u00e1rio",
|
||||
"label.secondaryips": "IPs secund\u00e1rios",
|
||||
"label.secondaryip.description": "Descri\u00e7\u00e3o",
|
||||
"label.secondarystoragelimit": "Limites do armazenamento secund\u00e1rio (GiB)",
|
||||
"label.secretkey": "Chave secreta",
|
||||
"label.secured": "Protegido",
|
||||
|
|
|
|||
|
|
@ -222,6 +222,10 @@
|
|||
:placeholder="$t('label.new.secondaryip.description')"
|
||||
v-model:value="newSecondaryIp"
|
||||
v-focus="editNicResource.type!=='Shared'"></a-input>
|
||||
<p class="modal-form__label">{{ $t('label.secondaryip.description') }}:</p>
|
||||
<a-input
|
||||
:placeholder="$t('label.new.secondaryip.description.description')"
|
||||
v-model:value="newSecondaryIpDescription"></a-input>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 10px; display: flex; justify-content:flex-end;">
|
||||
|
|
@ -326,6 +330,7 @@ export default {
|
|||
secondaryIPs: [],
|
||||
selectedNicId: '',
|
||||
newSecondaryIp: '',
|
||||
newSecondaryIpDescription: '',
|
||||
editNicResource: {},
|
||||
listIps: {
|
||||
loading: false,
|
||||
|
|
@ -401,6 +406,7 @@ export default {
|
|||
this.addNetworkData.makedefault = false
|
||||
this.editIpAddressValue = ''
|
||||
this.newSecondaryIp = ''
|
||||
this.newSecondaryIpDescription = ''
|
||||
},
|
||||
onChangeIPAddress (record) {
|
||||
this.editNicResource = record.nic
|
||||
|
|
@ -589,6 +595,7 @@ export default {
|
|||
if (this.newSecondaryIp) {
|
||||
params.ipaddress = this.newSecondaryIp
|
||||
}
|
||||
params.description = this.newSecondaryIpDescription
|
||||
|
||||
postAPI('addIpToNic', params).then(response => {
|
||||
this.$pollJob({
|
||||
|
|
@ -616,6 +623,7 @@ export default {
|
|||
this.loadingNic = false
|
||||
}).finally(() => {
|
||||
this.newSecondaryIp = null
|
||||
this.newSecondaryIpDescription = null
|
||||
this.fetchPublicIps(this.editNetworkId)
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
{{ record.traffictype }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item :label="$t('label.secondaryips')" v-if="record.secondaryip && record.secondaryip.length > 0 && record.type !== 'L2'">
|
||||
{{ record.secondaryip.map(x => x.ipaddress).join(', ') }}
|
||||
{{ record.secondaryip.map(x => x.description ? (x.ipaddress + ': ' + x.description) : x.ipaddress).join(', ') }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item :label="$t('label.ip6address')" v-if="record.ip6address">
|
||||
{{ record.ip6address }}
|
||||
|
|
|
|||
Loading…
Reference in New Issue