mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: block: Add accessors for protocol/storage node names
Introduce a set of accessors, which return node names based on semantics. This will allow to us to modify how we setup the backing chain in cases when e.g. the format driver can be omitted, without breaking all the code. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
2568e9d29e
commit
84c85337ad
@ -52,6 +52,54 @@ qemuBlockNodeNameValidate(const char *nn)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuBlockStorageSourceSetStorageNodename:
|
||||
* @src: virStorageSource to set the storage nodename
|
||||
* @nodename: The node name to set (stolen)
|
||||
*
|
||||
* Sets @nodename as the storage node name of @src. Using NULL @nodename clears
|
||||
* the nodename. @src takes ownership of @nodename.
|
||||
*/
|
||||
void
|
||||
qemuBlockStorageSourceSetStorageNodename(virStorageSource *src,
|
||||
char *nodename)
|
||||
{
|
||||
g_free(src->nodestorage);
|
||||
src->nodestorage = nodename;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuBlockStorageSourceGetEffectiveStorageNodename:
|
||||
* @src: virStorageSource to get the effective nodename of
|
||||
*
|
||||
* Gets the nodename that exposes the storage corresponding to @src, without
|
||||
* the format driver applied. This function always returns a name.
|
||||
*/
|
||||
const char *
|
||||
qemuBlockStorageSourceGetEffectiveStorageNodename(virStorageSource *src)
|
||||
{
|
||||
if (src->sliceStorage &&
|
||||
src->sliceStorage->nodename)
|
||||
return src->sliceStorage->nodename;
|
||||
|
||||
return src->nodestorage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuBlockStorageSourceGetStorageNodename:
|
||||
* @src: virStorageSource to get the effective nodename of
|
||||
*
|
||||
* Gets the nodename corresponding to the real backing storage format layer.
|
||||
*/
|
||||
const char *
|
||||
qemuBlockStorageSourceGetStorageNodename(virStorageSource *src)
|
||||
{
|
||||
return src->nodestorage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuBlockStorageSourceSupportsConcurrentAccess:
|
||||
* @src: disk storage source
|
||||
|
@ -26,6 +26,17 @@
|
||||
#include "virjson.h"
|
||||
#include "viruri.h"
|
||||
|
||||
void
|
||||
qemuBlockStorageSourceSetStorageNodename(virStorageSource *src,
|
||||
char *nodename);
|
||||
|
||||
const char *
|
||||
qemuBlockStorageSourceGetEffectiveStorageNodename(virStorageSource *src);
|
||||
|
||||
const char *
|
||||
qemuBlockStorageSourceGetStorageNodename(virStorageSource *src);
|
||||
|
||||
|
||||
typedef struct qemuBlockNodeNameBackingChainData qemuBlockNodeNameBackingChainData;
|
||||
struct qemuBlockNodeNameBackingChainData {
|
||||
char *qemufilename; /* name of the image from qemu */
|
||||
|
Loading…
x
Reference in New Issue
Block a user