one_xen_rate_limit.diff

Add NIC upload rate limiting on Xen - Vivien Bernet-Rollande, 06/07/2011 11:29 AM

Download (1.77 KB)

View differences:

src/vmm/XenDriver.cc
59 59
    string mac        = "";
60 60
    string bridge     = "";
61 61
    string model      = "";
62
    string rate       = "";
62 63

  
63 64
    const VectorAttribute * graphics;
64 65

  
......
351 352
        mac    = nic->vector_value("MAC");
352 353
        bridge = nic->vector_value("BRIDGE");
353 354
        model  = nic->vector_value("MODEL");
355
        rate   = nic->vector_value("RATE");
354 356

  
355 357
        if( !model.empty() )
356 358
        {
......
375 377
            file << pre_char << "bridge=" << bridge;
376 378
        }
377 379

  
380
        if( !rate.empty() )
381
        {
382
            file << pre_char << "rate=" << rate;
383
        }
384

  
378 385
        file << "',";
379 386
        file << endl;
380 387
    }
src/vnm/VirtualNetwork.cc
638 638
    int rc;
639 639

  
640 640
    string  model;
641
    string  rate;
641 642
    string  ip;
642 643
    string  mac;
643 644

  
......
646 647
    map<string,string> new_nic;
647 648

  
648 649
    model   = nic->vector_value("MODEL");
650
    rate    = nic->vector_value("RATE");
649 651
    ip      = nic->vector_value("IP");
650 652
    vnid   << oid;
651 653

  
......
682 684
        new_nic.insert(make_pair("MODEL",model));
683 685
    }
684 686

  
687
    if (!rate.empty())
688
    {
689
        new_nic.insert(make_pair("RATE",rate));
690
    }
691

  
685 692
    nic->replace(new_nic);
686 693

  
687 694
    return 0;