os-cmpi-xen

view src/Xen_VirtualSystemManagementService_Resource.h @ 121:4868ace2726b

Add initial consistence checks in test suite for Xen_MemoryPool, Xen_ProcessorPool and Xen_VirtualSystemManagementService.

Signed-off-by: Luke Szymanski <Lukasz.Szymanski@Unisys.com>
author Jim Fehlig <jfehlig@novell.com>
date Fri Jun 08 10:22:05 2007 -0600 (2007-06-08)
parents e0f068d0632a
children
line source
1 // Copyright (C) 2006 IBM Corporation
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 // ============================================================================
17 // Authors: Dr. Gareth S. Bestor, <bestor@us.ibm.com>
18 // Contributors: Jim Fehlig, <jfehlig@novell.com>
19 // Description:
20 // ============================================================================
22 /* Include required libxen headers. */
23 #include <xen_common.h>
24 #include <xen_vm.h>
25 #include <xen_string_string_map.h>
27 #include "xen_utils.h"
30 /*** CUSTOMIZE FOR EACH PROVIDER ***/
31 /* DEFINE A HANDLE TO REPRESENT THE 'LIST' OF ALL SYSTEM RESOURCES.
32 THE MAIN PROVIDER CODE DOES NOT NEED TO KNOW THE PARTICULARS OF HOW THIS
33 LIST IS IMPLEMENTED - IT MAY BE AN ARRAY, LINKED LIST, FILE, ETC.
34 THIS HANDLE IS PASSED INTO THE APPROPRIATE RESOURCE ACCESS METHODS WHEN
35 ACCESSING/ITERATING/ADDING/REMOVING RESOURCES INSTANCES. */
36 typedef struct {
37 int finished;
38 } _RESOURCES;
40 /*** CUSTOMIZE FOR EACH PROVIDER ***/
41 /* DEFINE A HANDLE TO BE USED FOR EACH INSTANCE OF A SYSTEM RESOURCE.
42 THE MAIN PROVIDER CODE DOES NOT NEED TO KNOW THE PARTICULARS OF HOW EACH
43 RESOURCE IS REPRESENTED, BUT TYPICALLY IT IS A STRUCTURE MIRRORING THE
44 PROPERTIES IN THE CIM CLASS. THIS HANDLE IS PASSED BETWEEN THE RESOURCE
45 ACCESS METHODS WHEN MANIPULATING SPECIFIC RESOURCE INSTANCES. */
46 typedef struct {
47 char *name;
48 int running;
49 xen_string_string_map *versions;
50 } _RESOURCE;
52 /* NOTHING BELOW THIS LINE SHOULD NEED TO BE CHANGED. */
54 /* Include the required CMPI data types. */
55 #include "cmpidt.h"
57 // ----------------------------------------------------------------------------
58 // Generic resource access methods for CMPI providers.
59 // Return value:
60 // -1 = Unsupported
61 // 0 = Failed
62 // 1 = OK
63 // ----------------------------------------------------------------------------
65 /* Get a handle to the list of all system resources for this class. */
66 int Xen_VirtualSystemManagementService_getResources(_RESOURCES ** resources);
68 /* Free/deallocate/cleanup the resources list after use. */
69 int Xen_VirtualSystemManagementService_freeResources(_RESOURCES * resources);
71 /* Iterator to get the next resource from the resources list. */
72 int Xen_VirtualSystemManagementService_getNextResource(xen_utils_session *session,
73 _RESOURCES * resources,
74 _RESOURCE ** resource);
76 /* Get the specific resource that matches the CMPI object path. */
77 int Xen_VirtualSystemManagementService_getResourceForObjectPath(xen_utils_session *session,
78 _RESOURCES * resources,
79 _RESOURCE ** resource,
80 const CMPIObjectPath * objectpath);
82 /* Free/deallocate/cleanup a resource after use. */
83 int Xen_VirtualSystemManagementService_freeResource(_RESOURCE * resource);
85 /* Set the property values of a CMPI instance from a specific resource. */
86 int Xen_VirtualSystemManagementService_setInstanceFromResource(_RESOURCE * resource,
87 const CMPIInstance * instance,
88 const CMPIBroker * broker);
90 // THE FOLLOWING METHODS MAY/NOT BE SUPPORTED BY THE SYSTEM FOR THIS CLASS
92 /* Delete the specified resource from the system. */
93 int Xen_VirtualSystemManagementService_deleteResource(_RESOURCES * resources,
94 _RESOURCE * resource);
96 /* Modify the specified resource using the property values of a CMPI instance. */
97 int Xen_VirtualSystemManagementService_setResourceFromInstance(_RESOURCE * resource,
98 const CMPIInstance * instance,
99 const CMPIBroker * broker);
101 /* Create a new resource using the property values of a CMPI instance. */
102 int Xen_VirtualSystemManagementService_createResourceFromInstance(_RESOURCES * resources,
103 _RESOURCE ** resource,
104 const CMPIInstance * instance,
105 const CMPIBroker * broker);
107 /* Disable the specified resource. */
108 int Xen_VirtualSystemManagementService_disableResource(xen_utils_session *session,
109 _RESOURCES * resources,
110 _RESOURCE * resource);
112 /* Enable the specified resource. */
113 int Xen_VirtualSystemManagementService_enableResource(xen_utils_session *session,
114 _RESOURCES * resources,
115 _RESOURCE * resource);