Commit 2a902a63 by Stéphane Graber Committed by GitHub

Merge pull request #1535 from brauner/2017-05-03/api_extension_lxc_is_supported_config_item

api extension: lxc_config_item_is_supported()
parents 2c0807c7 add40e62
...@@ -4522,3 +4522,8 @@ free_ct_name: ...@@ -4522,3 +4522,8 @@ free_ct_name:
free(ct_name); free(ct_name);
return ret; return ret;
} }
bool lxc_config_item_is_supported(const char *key)
{
return !!lxc_getconfig(key);
}
...@@ -1022,6 +1022,13 @@ int list_all_containers(const char *lxcpath, char ***names, struct lxc_container ...@@ -1022,6 +1022,13 @@ int list_all_containers(const char *lxcpath, char ***names, struct lxc_container
*/ */
void lxc_log_close(void); void lxc_log_close(void);
/*!
* \brief Check if the configuration item is supported by this LXC instance.
*
* \param key Configuration item to check for.
*/
bool lxc_config_item_is_supported(const char *key);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -391,6 +391,17 @@ int main(int argc, char *argv[]) ...@@ -391,6 +391,17 @@ int main(int argc, char *argv[])
fprintf(stderr, "%d: failed clearing lxc.hook\n", __LINE__); fprintf(stderr, "%d: failed clearing lxc.hook\n", __LINE__);
goto out; goto out;
} }
if (!lxc_config_item_is_supported("lxc.arch")) {
fprintf(stderr, "%d: failed to report \"lxc.arch\" as supported configuration item\n", __LINE__);
goto out;
}
if (lxc_config_item_is_supported("lxc.nonsense")) {
fprintf(stderr, "%d: failed to detect \"lxc.nonsense\" as unsupported configuration item\n", __LINE__);
goto out;
}
printf("All get_item tests passed\n"); printf("All get_item tests passed\n");
ret = EXIT_SUCCESS; ret = EXIT_SUCCESS;
out: out:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment