Revision fc15b997 src/host/Host.cc

View differences:

src/host/Host.cc
40 40
        vmm_mad_name(_vmm_mad_name),
41 41
        tm_mad_name(_tm_mad_name),
42 42
        last_monitored(0),
43
        host_template(id),
44
        cluster("default")
43
        cluster(ClusterPool::DEFAULT_CLUSTER_NAME),
44
        host_template(id)
45 45
        {};
46 46

  
47 47

  
......
123 123
    }
124 124

  
125 125
    // Get the template
126

  
127 126
    rc = host_template.select(db);
128 127

  
129 128
    if ( rc != 0 )
......
132 131
    }
133 132

  
134 133
    // Select the host shares from the DB
135

  
136 134
    rc = host_share.select(db);
137 135

  
138 136
    if ( rc != 0 )
......
143 141
    return 0;
144 142
}
145 143

  
146

  
147 144
/* ------------------------------------------------------------------------ */
148 145
/* ------------------------------------------------------------------------ */
149 146

  
......
421 418

  
422 419
ostream& operator<<(ostream& os, Host& host)
423 420
{
424
	string host_str;
421
    string host_str;
425 422

  
426
	os << host.to_xml(host_str);
423
    os << host.to_xml(host_str);
427 424

  
428 425
    return os;
429 426
};
430 427

  
431

  
432 428
/* ------------------------------------------------------------------------ */
433 429
/* ------------------------------------------------------------------------ */
434 430

  
435 431
string& Host::to_xml(string& xml) const
436 432
{
437 433
    string template_xml;
438
	string share_xml;
434
    string share_xml;
439 435
    ostringstream   oss;
440 436

  
441 437
    oss <<
......
448 444
       "<TM_MAD>"        << tm_mad_name    << "</TM_MAD>"        <<
449 445
       "<LAST_MON_TIME>" << last_monitored << "</LAST_MON_TIME>" <<
450 446
       "<CLUSTER>"       << cluster        << "</CLUSTER>"       <<
451
 	   host_share.to_xml(share_xml)  <<
447
       host_share.to_xml(share_xml)  <<
452 448
       host_template.to_xml(template_xml) <<
453
	"</HOST>";
449
    "</HOST>";
454 450

  
455 451
    xml = oss.str();
456 452

  
......
463 459
string& Host::to_str(string& str) const
464 460
{
465 461
    string template_str;
466
	string share_str;
462
    string share_str;
467 463

  
468 464
    ostringstream   os;
469 465

  
470 466
    os <<
471
		"ID      =  "  << oid            << endl <<
472
    	"NAME = "      << hostname       << endl <<
473
    	"STATE    = "  << state          << endl <<
474
    	"IM MAD   = "  << im_mad_name    << endl <<
475
    	"VMM MAD  = "  << vmm_mad_name   << endl <<
476
    	"TM MAD   = "  << tm_mad_name    << endl <<
477
    	"LAST_MON = "  << last_monitored << endl <<
467
        "ID      =  "  << oid            << endl <<
468
        "NAME = "      << hostname       << endl <<
469
        "STATE    = "  << state          << endl <<
470
        "IM MAD   = "  << im_mad_name    << endl <<
471
        "VMM MAD  = "  << vmm_mad_name   << endl <<
472
        "TM MAD   = "  << tm_mad_name    << endl <<
473
        "LAST_MON = "  << last_monitored << endl <<
478 474
        "CLUSTER  = "  << cluster        << endl <<
479 475
        "ATTRIBUTES"   << endl << host_template.to_str(template_str) << endl <<
480 476
        "HOST SHARES"  << endl << host_share.to_str(share_str) <<endl;
481 477

  
482
	str = os.str();
478
    str = os.str();
483 479

  
484
	return str;
480
    return str;
485 481
}

Also available in: Unified diff