HP 2000sa HP StorageWorks MSA2000 G2 SMI-S Proxy Provider User Guide (573100-0 - Page 36

cimNAssocs[i].getPath, CIMNameCIM_Realizes, CIMNameCIM_PhysicalPackage

Page 36 highlights

true, false, false, false); std::cout

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48

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<CIMObject> 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<CIMObject> 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