Revision dd32809e

View differences:

include/Attribute.h
39 39
            attribute_name.end(),
40 40
            attribute_name.begin(),
41 41
            (int(*)(int))toupper);
42

  
43
        // FIX Attribute name if it does not conform XML element
44
        // naming conventions
45

  
46
        int size = attribute_name.size();
47

  
48
        if  ((size >0 && !isalpha(aname[0]))||
49
             (size >=3 && (aname[0]=='X' && aname[1]=='M' && aname[2]=='L')))
50
        {
51
            attribute_name.insert(0,"ONE_");    
52
        }
42 53
    };
43 54

  
44 55
    virtual ~Attribute(){};
include/PoolObjectSQL.h
189 189
        const string& name,
190 190
        const string& value)
191 191
    {
192
        SingleAttribute * sattr;
192
        SingleAttribute * sattr = new SingleAttribute(name,value);
193 193

  
194
        obj_template->erase(name);
194
        obj_template->erase(sattr->name());
195 195

  
196
        sattr = new SingleAttribute(name,value);
197 196
        obj_template->set(sattr);
198 197

  
199 198
        return 0;
src/vmm/VirtualMachineManagerDriver.cc
453 453
            int             net_rx = -1;
454 454
            char            state  = '-';
455 455

  
456
            string monitor_str = is.str();
457
            bool   parse_error = false;
458

  
456 459
            while(is.good())
457 460
            {
458 461
                is >> tmp >> ws;
......
461 464

  
462 465
                if ( pos == string::npos )
463 466
                {
464
                    os.str("");
465
                    os << "Error parsing monitoring attribute: " << tmp;
466

  
467
                    vm->log("VMM",Log::ERROR,os);
468

  
469
                    break;
467
                    parse_error = true;
468
                    continue;
470 469
                }
471 470

  
472 471
                tmp.replace(pos,1," ");
......
475 474

  
476 475
                tiss.str(tmp);
477 476

  
478
                tiss >> var;
477
                tiss >> var >> ws;
478

  
479
                if (!tiss.good())
480
                {
481
                    parse_error = true;
482
                    continue;
483
                }
479 484

  
480 485
                if (var == "USEDMEMORY")
481 486
                {
......
502 507
                    string val;
503 508

  
504 509
                    os.str("");
505
                    os << "Unknown monitoring attribute (adding/updating"
506
                       << " template): " << tmp;
510
                    os << "Adding custom monitoring attribute: " << tmp;
507 511

  
508 512
                    vm->log("VMM",Log::WARNING,os);
509 513

  
......
513 517
                }
514 518
            }
515 519

  
520
            if (parse_error)
521
            {
522
                os.str("");
523
                os << "Error parsing monitoring str:\"" << monitor_str <<"\"";
524

  
525
                vm->log("VMM",Log::ERROR,os);
526

  
527
                vm->set_template_error_message(os.str());
528
                vmpool->update(vm);
529

  
530
                vm->unlock();
531
                return;
532
            }
533

  
516 534
            vm->update_info(memory,cpu,net_tx,net_rx);
517 535

  
518 536
            vmpool->update(vm);

Also available in: Unified diff