Revision 1035fe77 src/vnm/VirtualNetwork.cc
src/vnm/VirtualNetwork.cc | ||
---|---|---|
317 | 317 |
|
318 | 318 |
vn_template.erase("PUBLIC"); |
319 | 319 |
|
320 |
// ------------------------------------------------------------------------ |
|
321 |
// Authorize this request |
|
322 |
// ------------------------------------------------------------------------ |
|
323 |
|
|
324 |
if ( uid != 0 ) // uid == 0 means oneadmin |
|
325 |
{ |
|
326 |
string t64; |
|
327 |
AuthRequest ar(uid); |
|
328 |
|
|
329 |
ar.add_auth(AuthRequest::NET, |
|
330 |
vn_template.to_xml(t64), |
|
331 |
AuthRequest::CREATE, |
|
332 |
uid, |
|
333 |
public_vnet); |
|
334 |
|
|
335 |
if (UserPool::authorize(ar) == -1) |
|
336 |
{ |
|
337 |
goto error_authorize; |
|
338 |
} |
|
339 |
} |
|
340 |
|
|
341 | 320 |
// ------------ INSERT THE TEMPLATE -------------------- |
342 | 321 |
|
343 | 322 |
if ( vn_template.id == -1 ) |
... | ... | |
440 | 419 |
ose << "No BRIDGE in template for Virtual Network id " << oid; |
441 | 420 |
goto error_common; |
442 | 421 |
|
443 |
error_authorize: |
|
444 |
ose << "Error authorizing Virtual Network creation"; |
|
445 |
goto error_common; |
|
446 |
|
|
447 | 422 |
error_template: |
448 | 423 |
ose << "Can not insert in DB template for Virtual Network id " << oid; |
449 | 424 |
goto error_common; |
... | ... | |
640 | 615 |
{ |
641 | 616 |
int rc; |
642 | 617 |
|
643 |
string network; |
|
644 | 618 |
string model; |
645 | 619 |
string ip; |
646 | 620 |
string mac; |
... | ... | |
649 | 623 |
|
650 | 624 |
map<string,string> new_nic; |
651 | 625 |
|
652 |
network = nic->vector_value("NETWORK"); |
|
653 | 626 |
model = nic->vector_value("MODEL"); |
654 | 627 |
ip = nic->vector_value("IP"); |
655 | 628 |
vnid << oid; |
... | ... | |
676 | 649 |
// NEW NIC ATTRIBUTES |
677 | 650 |
//-------------------------------------------------------------------------- |
678 | 651 |
|
679 |
new_nic.insert(make_pair("NETWORK",network));
|
|
680 |
new_nic.insert(make_pair("MAC" ,mac)); |
|
681 |
new_nic.insert(make_pair("BRIDGE" ,bridge)); |
|
682 |
new_nic.insert(make_pair("VNID" ,vnid.str()));
|
|
683 |
new_nic.insert(make_pair("IP" ,ip)); |
|
652 |
new_nic.insert(make_pair("NETWORK" ,name));
|
|
653 |
new_nic.insert(make_pair("MAC" ,mac));
|
|
654 |
new_nic.insert(make_pair("BRIDGE" ,bridge));
|
|
655 |
new_nic.insert(make_pair("NETWORK_ID",vnid.str()));
|
|
656 |
new_nic.insert(make_pair("IP" ,ip));
|
|
684 | 657 |
|
685 | 658 |
if (!model.empty()) |
686 | 659 |
{ |
Also available in: Unified diff