Revision 0dbb3330 src/vnm/VirtualNetworkPool.cc

View differences:

src/vnm/VirtualNetworkPool.cc
71 71

  
72 72
int VirtualNetworkPool::allocate (
73 73
    int            uid,
74
    const  string& stemplate,
74
    VirtualNetworkTemplate * vn_template,
75 75
    int *          oid)
76 76
{
77 77
    VirtualNetwork *    vn;
78
    char *              error_msg;
79
    int                 rc;
80 78

  
81
    // Build a new Virtual Network object
82
    vn = new VirtualNetwork();
79
    vn = new VirtualNetwork(vn_template);
83 80

  
84 81
    vn->uid = uid;
85 82

  
86
    rc = vn->vn_template.parse(stemplate,&error_msg);
87

  
88
    if ( rc != 0 )
89
    {
90
        ostringstream oss;
91

  
92
        oss << error_msg;
93
        NebulaLog::log("VNM", Log::ERROR, oss);
94
        free(error_msg);
95

  
96
        delete vn;
97

  
98
        return -1;
99
    }
100

  
101
    // Insert the VN in the pool so we have a valid OID
102

  
103 83
    *oid = PoolSQL::allocate(vn);
104 84

  
105 85
    return *oid;

Also available in: Unified diff