fix(vif.set): remove old VIF before creating new one (#457)
Fixes #1784
This commit is contained in:
parent
86a1ed6d46
commit
9ab9155bf0
@ -10,7 +10,6 @@ import {
|
|||||||
async function delete_ ({vif}) {
|
async function delete_ ({vif}) {
|
||||||
this.allocIpAddresses(
|
this.allocIpAddresses(
|
||||||
vif.id,
|
vif.id,
|
||||||
vif.$network,
|
|
||||||
null,
|
null,
|
||||||
vif.allowedIpv4Addresses.concat(vif.allowedIpv6Addresses)
|
vif.allowedIpv4Addresses.concat(vif.allowedIpv6Addresses)
|
||||||
)::pCatch(noop)
|
)::pCatch(noop)
|
||||||
@ -85,16 +84,16 @@ export async function set ({
|
|||||||
attached == null && (attached = vif.attached)
|
attached == null && (attached = vif.attached)
|
||||||
|
|
||||||
await this.allocIpAddresses(vif.id, null, oldIpAddresses)
|
await this.allocIpAddresses(vif.id, null, oldIpAddresses)
|
||||||
|
await xapi.deleteVif(vif._xapiId)
|
||||||
|
|
||||||
// create new VIF with new parameters
|
// create new VIF with new parameters
|
||||||
await xapi.createVif(vm.$id, network.$id, {
|
const newVif = await xapi.createVif(vm.$id, network.$id, {
|
||||||
mac,
|
mac,
|
||||||
currently_attached: attached,
|
currently_attached: attached,
|
||||||
ipv4Allowed: allowedIpv4Addresses,
|
ipv4_allowed: newIpAddresses
|
||||||
ipv6Allowed: allowedIpv6Addresses
|
|
||||||
})
|
})
|
||||||
|
|
||||||
await this.allocIpAddresses(vif.id, newIpAddresses)
|
await this.allocIpAddresses(newVif.$id, newIpAddresses)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user