提交 0e458e66 编写于 作者: J John Ferlan

secret: Rename directory to configDir

This follows other drivers usage model.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 72a01218
...@@ -66,7 +66,7 @@ typedef virSecretDriverState *virSecretDriverStatePtr; ...@@ -66,7 +66,7 @@ typedef virSecretDriverState *virSecretDriverStatePtr;
struct _virSecretDriverState { struct _virSecretDriverState {
virMutex lock; virMutex lock;
virSecretObj *secrets; virSecretObj *secrets;
char *directory; char *configDir;
}; };
static virSecretDriverStatePtr driver; static virSecretDriverStatePtr driver;
...@@ -166,7 +166,7 @@ secretFindByUsage(int usageType, ...@@ -166,7 +166,7 @@ secretFindByUsage(int usageType,
/* Permament secret storage */ /* Permament secret storage */
/* Secrets are stored in virSecretDriverStatePtr->directory. Each secret /* Secrets are stored in virSecretDriverStatePtr->configDir. Each secret
has virSecretDef stored as XML in "$basename.xml". If a value of the has virSecretDef stored as XML in "$basename.xml". If a value of the
secret is defined, it is stored as base64 (with no formatting) in secret is defined, it is stored as base64 (with no formatting) in
"$basename.base64". "$basename" is in both cases the base64-encoded UUID. */ "$basename.base64". "$basename" is in both cases the base64-encoded UUID. */
...@@ -192,7 +192,7 @@ secretComputePath(const virSecretObj *secret, ...@@ -192,7 +192,7 @@ secretComputePath(const virSecretObj *secret,
virUUIDFormat(secret->def->uuid, uuidstr); virUUIDFormat(secret->def->uuid, uuidstr);
ignore_value(virAsprintf(&ret, "%s/%s%s", driver->directory, ignore_value(virAsprintf(&ret, "%s/%s%s", driver->configDir,
uuidstr, suffix)); uuidstr, suffix));
return ret; return ret;
} }
...@@ -212,9 +212,9 @@ secretBase64Path(const virSecretObj *secret) ...@@ -212,9 +212,9 @@ secretBase64Path(const virSecretObj *secret)
static int static int
secretEnsureDirectory(void) secretEnsureDirectory(void)
{ {
if (mkdir(driver->directory, S_IRWXU) < 0 && errno != EEXIST) { if (mkdir(driver->configDir, S_IRWXU) < 0 && errno != EEXIST) {
virReportSystemError(errno, _("cannot create '%s'"), virReportSystemError(errno, _("cannot create '%s'"),
driver->directory); driver->configDir);
return -1; return -1;
} }
return 0; return 0;
...@@ -401,7 +401,7 @@ secretLoad(const char *xml_basename) ...@@ -401,7 +401,7 @@ secretLoad(const char *xml_basename)
virSecretObjPtr secret = NULL, ret = NULL; virSecretObjPtr secret = NULL, ret = NULL;
char *xml_filename; char *xml_filename;
if (virAsprintf(&xml_filename, "%s/%s", driver->directory, if (virAsprintf(&xml_filename, "%s/%s", driver->configDir,
xml_basename) < 0) xml_basename) < 0)
goto cleanup; goto cleanup;
...@@ -438,11 +438,11 @@ loadSecrets(virSecretObjPtr *dest) ...@@ -438,11 +438,11 @@ loadSecrets(virSecretObjPtr *dest)
struct dirent *de; struct dirent *de;
virSecretObjPtr list = NULL; virSecretObjPtr list = NULL;
if (!(dir = opendir(driver->directory))) { if (!(dir = opendir(driver->configDir))) {
if (errno == ENOENT) if (errno == ENOENT)
return 0; return 0;
virReportSystemError(errno, _("cannot open '%s'"), virReportSystemError(errno, _("cannot open '%s'"),
driver->directory); driver->configDir);
return -1; return -1;
} }
...@@ -1022,7 +1022,7 @@ secretStateCleanup(void) ...@@ -1022,7 +1022,7 @@ secretStateCleanup(void)
secret = listUnlink(&driver->secrets); secret = listUnlink(&driver->secrets);
secretFree(secret); secretFree(secret);
} }
VIR_FREE(driver->directory); VIR_FREE(driver->configDir);
secretDriverUnlock(); secretDriverUnlock();
virMutexDestroy(&driver->lock); virMutexDestroy(&driver->lock);
...@@ -1054,7 +1054,7 @@ secretStateInitialize(bool privileged, ...@@ -1054,7 +1054,7 @@ secretStateInitialize(bool privileged,
if (!(base = virGetUserConfigDirectory())) if (!(base = virGetUserConfigDirectory()))
goto error; goto error;
} }
if (virAsprintf(&driver->directory, "%s/secrets", base) < 0) if (virAsprintf(&driver->configDir, "%s/secrets", base) < 0)
goto error; goto error;
VIR_FREE(base); VIR_FREE(base);
...@@ -1086,7 +1086,7 @@ secretStateReload(void) ...@@ -1086,7 +1086,7 @@ secretStateReload(void)
/* Keep ephemeral secrets from current state. /* Keep ephemeral secrets from current state.
* Discard non-ephemeral secrets that were removed * Discard non-ephemeral secrets that were removed
* by the secrets directory. */ * by the secrets configDir. */
while (driver->secrets != NULL) { while (driver->secrets != NULL) {
virSecretObjPtr secret; virSecretObjPtr secret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册