mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
development: Fix bug in vrouter attach nic.
This commit is contained in:
parent
4167c2b0fc
commit
698ada1004
@ -184,6 +184,7 @@ void VirtualRouterAttachNic::request_execute(
|
||||
VirtualRouterPool* vrpool = static_cast<VirtualRouterPool*>(pool);
|
||||
VirtualRouter * vr;
|
||||
VectorAttribute* nic;
|
||||
VectorAttribute* nic_bck;
|
||||
|
||||
VirtualMachineTemplate tmpl;
|
||||
PoolObjectAuth vr_perms;
|
||||
@ -256,6 +257,11 @@ void VirtualRouterAttachNic::request_execute(
|
||||
|
||||
nic = vr->attach_nic(&tmpl, att.resp_msg);
|
||||
|
||||
if ( nic != 0 )
|
||||
{
|
||||
nic_bck = nic->clone();
|
||||
}
|
||||
|
||||
set<int> vms = vr->get_vms();
|
||||
|
||||
vrpool->update(vr);
|
||||
@ -279,18 +285,22 @@ void VirtualRouterAttachNic::request_execute(
|
||||
{
|
||||
VirtualMachineTemplate tmpl;
|
||||
|
||||
tmpl.set(nic->clone());
|
||||
tmpl.set(nic_bck->clone());
|
||||
|
||||
ErrorCode ec = vm_attach_nic.request_execute(*vmid, tmpl, att);
|
||||
|
||||
if (ec != SUCCESS) //TODO: manage individual attach error, do rollback?
|
||||
{
|
||||
delete nic_bck;
|
||||
|
||||
failure_response(ACTION, att);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
delete nic_bck;
|
||||
|
||||
success_response(vrid, att);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user