Navigation


Changeset 228

Show
Ignore:
Timestamp:
11/13/08 16:36:52 (8 weeks ago)
Author:
tinova
Message:

Fixed leases deletion.

Location:
one/branches/DEVELOPMENT/VirtualNetworkManager
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • one/branches/DEVELOPMENT/VirtualNetworkManager/include/Attribute.h

    r218 r228  
    8181     
    8282    /** 
    83      *  Replaces the attribute value from a string. 
    84      */ 
    85     virtual void replace(const string& sattr) = 0; 
    86      
    87     /** 
    8883     *  Returns the attribute type 
    8984     */ 
     
    219214    /** 
    220215     *  Replace the value of the given attribute with the provided map 
    221      */     
    222     void replace(const string& sattr); 
     216     */ 
     217    void replace(const map<string,string>& attr); 
     218 
    223219 
    224220    /** 
  • one/branches/DEVELOPMENT/VirtualNetworkManager/src/common/Attribute.cc

    r218 r228  
    9090/* -------------------------------------------------------------------------- */ 
    9191 
    92 void VectorAttribute::replace(const string& sattr) 
     92void VectorAttribute::replace(const map<string,string>& attr) 
    9393{ 
    94         attribute_value.erase(attribute_value.begin(),attribute_value.end()); 
    95  
    96         unmarshall(sattr); 
     94        attribute_value = attr; 
    9795} 
    9896 
  • one/branches/DEVELOPMENT/VirtualNetworkManager/src/vm/VirtualMachine.cc

    r227 r228  
    305305    VirtualNetwork           * vn; 
    306306    VectorAttribute          * nic; 
    307  
    308     ostringstream              new_nic; 
     307    map<string,string>         new_nic; 
    309308     
    310309    string                     ip; 
     
    312311    string                     bridge; 
    313312    string                     network; 
     313 
     314    ostringstream              vnid; 
    314315 
    315316    //Set a name if the VM has not got one 
     
    337338     num_nics   = vm_template.get("NIC",nics); 
    338339      
    339      for(int i=0; i<num_nics; i++,new_nic.str("")) 
     340     for(int i=0; i<num_nics; i++,vnid.str("")) 
    340341     { 
     342         new_nic.erase(new_nic.begin(),new_nic.end()); 
     343 
    341344         nic = dynamic_cast<VectorAttribute * >(nics[i]); 
    342345 
     
    366369          
    367370         vn->unlock(); 
     371 
     372         vnid << vn->get_oid(); 
     373 
     374         new_nic.insert(make_pair("NETWORK",network)); 
     375         new_nic.insert(make_pair("MAC"    ,mac)); 
     376         new_nic.insert(make_pair("BRIDGE" ,bridge)); 
     377         new_nic.insert(make_pair("VNID"   ,vnid.str())); 
     378         new_nic.insert(make_pair("IP"     ,ip)); 
    368379          
    369          new_nic << "NETWORK="  << network << "," << 
    370                     "MAC="      << mac     << "," << 
    371                     "BRIDGE="   << bridge  << "," << 
    372                     "VNID="     << vn->get_oid() << "," << 
    373                     "IP="       << ip;    
    374           
    375          nic->replace(new_nic.str()); 
     380         nic->replace(new_nic); 
    376381                  
    377382    }