beautypg.com

Client api interface 36 – HP 2000SA G2-Modular-Smart-Array User Manual

Page 36

background image

true, false, false, false);

std::cout << "Completed EI..." << endl;

// There should always be one and only one Top Computer System instance

if (cimNInstances.size() == 0)

{

std::cout << "No instances. Disconnecting..." << endl;

client->disconnect();

return;

}

// Print the properties of Top Computer System instance

std::cout<< "DHS_TopComputerSystem Instance" << std::endl;

std::cout << "====================================================" << std::endl;

for (Uint32 j = 0; j < cimNInstances[0].getPropertyCount(); j++)

{

CIMName propertyName = cimNInstances[0].getProperty(j).getName();

std::cout<< propertyName << "="

<< cimNInstances[0].getProperty(j).getValue().toString()

<< endl;

}

std::cout << "====================================================" << std::endl;

// Traverse through CIM_SystemDevice association to grab the CIM_DiskDrive instances

Array cimNAssocs =

client->associators(NAMESPACE, cimNInstances[0].getPath(),

CIMName("CIM_SystemDevice"), CIMName("CIM_DiskDrive"));

if (cimNAssocs.size() == 0)

{

std::cout << "No DiskDrive instances. Disconnecting..." << endl;

client->disconnect();

return;

}

for (int i=0; i < cimNAssocs.size(); ++i)

{

std::cout<< "DiskDrive " << i << std::endl;

std::cout << "====================================================" << std::endl;

// Print the properties of each of the Disk Drive instances

for (Uint32 j = 0; j < cimNAssocs[i].getPropertyCount(); j++)

{

CIMName propertyName = cimNAssocs[i].getProperty(j).getName();

std::cout<< propertyName << "="

<< cimNAssocs[i].getProperty(j).getValue().toString()

<< endl;

}

// Take the CIM_realizes association and go to CIM_PhysicalPackage class which

// has some rich set of information about each of these Disk drives

Array diskAssocs = client->associators(NAMESPACE,

cimNAssocs[i].getPath(), CIMName("CIM_Realizes"), CIMName("CIM_PhysicalPackage"));

for (Uint32 k = 0; k < diskAssocs[0].getPropertyCount(); k++)

{

CIMName propertyName = diskAssocs[0].getProperty(k).getName();

std::cout<< propertyName << "="

<< diskAssocs[0].getProperty(k).getValue().toString()

<< endl;

}

std::cout << "====================================================" << std::endl;

}

}

}

}

catch(ConnectionTimeoutException& e)

{

PEGASUS_STD(cerr) << "Warning: " << e.getMessage() << PEGASUS_STD(endl);

exit(2);

}

catch(Exception& e)

{

PEGASUS_STD(cerr) << "Error: " << e.getMessage() << PEGASUS_STD(endl);

exit(1);

}

}

///////////////////////////////////////////////////////////////

// MAIN

Client API Interface

36

This manual is related to the following products: