} cfg_system_t;
/* }}} cfg_system_t */
-/*!
- * \brief Struct representing a volume.
- *
- * A volume currently has a name and two sets of values:
- *
- * - Performance data, such as bytes read/written, number of operations
- * performed and average time per operation.
- *
- * - Usage data, i. e. amount of used and free space in the volume.
- */
-typedef struct volume_s {
- char *name;
- data_volume_perf_t perf_data;
- struct volume_s *next;
-} volume_t;
-
struct host_config_s {
char *name;
na_server_transport_t protocol;
cfg_volume_perf_t *cfg_volume_perf;
cfg_volume_usage_t *cfg_volume_usage;
cfg_system_t *cfg_system;
- volume_t *volumes;
struct host_config_s *next;
};
#define HOST_INIT { NULL, NA_SERVER_TRANSPORT_HTTPS, NULL, 0, NULL, NULL, 0, \
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, \
+ NULL, NULL, NULL, NULL, NULL, NULL, \
NULL}
static host_config_t *global_host_config;
*
* Used to free the various structures above.
*/
-static void free_volume (volume_t *volume) /* {{{ */
-{
- volume_t *next;
-
- if (volume == NULL)
- return;
-
- next = volume->next;
-
- sfree (volume->name);
- sfree (volume);
-
- free_volume (next);
-} /* }}} void free_volume */
-
static void free_disk (disk_t *disk) /* {{{ */
{
disk_t *next;
free_cfg_volume_perf (hc->cfg_volume_perf);
free_cfg_volume_usage (hc->cfg_volume_usage);
free_cfg_system (hc->cfg_system);
- free_volume (hc->volumes);
+
+ if (hc->srv != NULL)
+ na_server_close (hc->srv);
sfree (hc);
return (0);
} /* }}} int cna_config_volume_performance */
-/* Handling of the "Capacity" and "Snapshot" options within a <VolumeUsage />
- * block. */
+/* Handling of the "GetCapacity" and "GetSnapshot" options within a
+ * <VolumeUsage /> block. */
static void cna_config_volume_usage_option (cfg_volume_usage_t *cvu, /* {{{ */
const oconfig_item_t *ci)
{
name = ci->values[0].value.string;
- if (strcasecmp ("Capacity", ci->key) == 0)
+ if (strcasecmp ("GetCapacity", ci->key) == 0)
il = cvu->il_capacity;
- else if (strcasecmp ("Snapshot", ci->key) == 0)
+ else if (strcasecmp ("GetSnapshot", ci->key) == 0)
il = cvu->il_snapshot;
else
return;
/*
* <VolumeUsage>
- * Capacity "vol0"
- * Capacity "vol1"
- * Capacity "vol2"
- * Capacity "vol3"
- * Capacity "vol4"
+ * GetCapacity "vol0"
+ * GetCapacity "vol1"
+ * GetCapacity "vol2"
+ * GetCapacity "vol3"
+ * GetCapacity "vol4"
* IgnoreSelectedCapacity false
*
- * Snapshot "vol0"
- * Snapshot "vol3"
- * Snapshot "vol4"
- * Snapshot "vol7"
+ * GetSnapshot "vol0"
+ * GetSnapshot "vol3"
+ * GetSnapshot "vol4"
+ * GetSnapshot "vol7"
* IgnoreSelectedSnapshot false
* </VolumeUsage>
*/
/* if (!item || !item->key || !*item->key) continue; */
if (strcasecmp(item->key, "Interval") == 0)
cna_config_get_interval (item, &cfg_volume_usage->interval);
- else if (!strcasecmp(item->key, "Capacity"))
+ else if (!strcasecmp(item->key, "GetCapacity"))
cna_config_volume_usage_option (cfg_volume_usage, item);
- else if (!strcasecmp(item->key, "Snapshot"))
+ else if (!strcasecmp(item->key, "GetSnapshot"))
cna_config_volume_usage_option (cfg_volume_usage, item);
else if (!strcasecmp(item->key, "IgnoreSelectedCapacity"))
cna_config_volume_usage_default (cfg_volume_usage, item);
return 0;
} /* }}} int cna_read */
+static int cna_shutdown (void) /* {{{ */
+{
+ free_host_config (global_host_config);
+ global_host_config = NULL;
+
+ return (0);
+} /* }}} int cna_shutdown */
+
void module_register(void) {
plugin_register_complex_config("netapp", cna_config);
plugin_register_init("netapp", cna_init);
plugin_register_read("netapp", cna_read);
+ plugin_register_shutdown("netapp", cna_shutdown);
}
/* vim: set sw=2 ts=2 noet fdm=marker : */