Revision 74aa41ba include/VirtualNetworkPool.h

View differences:

include/VirtualNetworkPool.h
81 81
    //--------------------------------------------------------------------------
82 82

  
83 83
    /**
84
     *  Generates a NIC attribute for VM templates using the VirtualNetwork
85
     *  metadata
86
     *    @param nic the nic attribute to be generated
87
     *    @param vid of the VM requesting the lease
88
     *    @return 0 on success, -1 error, -2 not using the pool
89
     */
90
    int nic_attribute(VectorAttribute * nic, int vid)
91
    {
92
        string           network;
93
        VirtualNetwork * vnet;
94

  
95
        network = nic->vector_value("NETWORK");
96

  
97
        if (network.empty())
98
        {
99
            return -2;
100
        }
101

  
102
        vnet = get(network,true);
103

  
104
        if (vnet == 0)
105
        {
106
            return -1;
107
        }
108

  
109
        int rc = vnet->nic_attribute(nic,vid);
110

  
111
        vnet->unlock();
112

  
113
        return rc;
114
    }
115

  
116
    /**
84 117
     *  Updates the template of a VN, adding a new attribute (replacing it if
85 118
     *  already defined), the VN's mutex SHOULD be locked
86 119
     *    @param vn pointer to the virtual network object

Also available in: Unified diff