[libvirt] [python PATCH v7] Add virDomainCheckpoint APIs
by Eric Blake
Copies heavily from existing virDomainSnapshot handling, regarding
what special cases the generator has to be taught and what overrides
need to be written.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Python counterparts to my incremental backup patches. An earlier
version was already reviewed by Dan; the main diff here is the
addition of virDomainSnapshotCreateXML2 handling.
HACKING | 2 +
MANIFEST.in | 1 +
generator.py | 37 ++++++++--
libvirt-override-api.xml | 12 ++++
libvirt-override-virDomain.py | 13 ++++
libvirt-override-virDomainCheckpoint.py | 19 +++++
libvirt-override.c | 96 +++++++++++++++++++++++++
sanitytest.py | 11 +--
typewrappers.c | 13 ++++
typewrappers.h | 10 +++
10 files changed, 206 insertions(+), 8 deletions(-)
create mode 100644 libvirt-override-virDomainCheckpoint.py
diff --git a/HACKING b/HACKING
index 6eeb9e6..39e7cd3 100644
--- a/HACKING
+++ b/HACKING
@@ -28,6 +28,8 @@ hand written source files
the virConnect class
- libvirt-override-virDomain.py - high level overrides in
the virDomain class
+ - libvirt-override-virDomainCheckpoint.py - high level overrides in
+ the virDomainCheckpoint class
- libvirt-override-virDomainSnapshot.py - high level overrides in
the virDomainSnapshot class
- libvirt-override-virStoragePool.py - high level overrides in
diff --git a/MANIFEST.in b/MANIFEST.in
index b6788f4..5d2f559 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -23,6 +23,7 @@ include libvirt-override.c
include libvirt-override.py
include libvirt-override-virConnect.py
include libvirt-override-virDomain.py
+include libvirt-override-virDomainCheckpoint.py
include libvirt-override-virDomainSnapshot.py
include libvirt-override-virStoragePool.py
include libvirt-override-virStream.py
diff --git a/generator.py b/generator.py
index ffa3ce5..a16f9b1 100755
--- a/generator.py
+++ b/generator.py
@@ -35,6 +35,7 @@ libvirt_headers = [
"libvirt",
"libvirt-common",
"libvirt-domain",
+ "libvirt-domain-checkpoint",
"libvirt-domain-snapshot",
"libvirt-event",
"libvirt-host",
@@ -364,6 +365,10 @@ py_types = {
'virStream *': ('O', "virStream", "virStreamPtr", "virStreamPtr"),
'const virStream *': ('O', "virStream", "virStreamPtr", "virStreamPtr"),
+ 'virDomainCheckpointPtr': ('O', "virDomainCheckpoint", "virDomainCheckpointPtr", "virDomainCheckpointPtr"),
+ 'virDomainCheckpoint *': ('O', "virDomainCheckpoint", "virDomainCheckpointPtr", "virDomainCheckpointPtr"),
+ 'const virDomainCheckpoint *': ('O', "virDomainCheckpoint", "virDomainCheckpointPtr", "virDomainCheckpointPtr"),
+
'virDomainSnapshotPtr': ('O', "virDomainSnapshot", "virDomainSnapshotPtr", "virDomainSnapshotPtr"),
'virDomainSnapshot *': ('O', "virDomainSnapshot", "virDomainSnapshotPtr", "virDomainSnapshotPtr"),
'const virDomainSnapshot *': ('O', "virDomainSnapshot", "virDomainSnapshotPtr", "virDomainSnapshotPtr"),
@@ -536,6 +541,8 @@ skip_function = (
'virSaveLastError', # We have our own python error wrapper
'virFreeError', # Only needed if we use virSaveLastError
'virConnectListAllDomains', # overridden in virConnect.py
+ 'virDomainListAllCheckpoints', # overridden in virDomain.py
+ 'virDomainCheckpointListAllChildren', # overridden in virDomainCheckpoint.py
'virDomainListAllSnapshots', # overridden in virDomain.py
'virDomainSnapshotListAllChildren', # overridden in virDomainSnapshot.py
'virConnectListAllStoragePools', # overridden in virConnect.py
@@ -582,6 +589,7 @@ skip_function = (
"virStoragePoolRef",
"virStorageVolRef",
"virStreamRef",
+ "virDomainCheckpointRef",
"virDomainSnapshotRef",
# This functions shouldn't be called via the bindings (and even the docs
@@ -594,6 +602,8 @@ skip_function = (
"virNWFilterGetConnect",
"virStoragePoolGetConnect",
"virStorageVolGetConnect",
+ "virDomainCheckpointGetConnect",
+ "virDomainCheckpointGetDomain",
"virDomainSnapshotGetConnect",
"virDomainSnapshotGetDomain",
@@ -1023,6 +1033,8 @@ classes_type = {
"virStream *": ("._o", "virStream(self, _obj=%s)", "virStream"),
"virConnectPtr": ("._o", "virConnect(_obj=%s)", "virConnect"),
"virConnect *": ("._o", "virConnect(_obj=%s)", "virConnect"),
+ "virDomainCheckpointPtr": ("._o", "virDomainCheckpoint(self,_obj=%s)", "virDomainCheckpoint"),
+ "virDomainCheckpoint *": ("._o", "virDomainCheckpoint(self, _obj=%s)", "virDomainCheckpoint"),
"virDomainSnapshotPtr": ("._o", "virDomainSnapshot(self,_obj=%s)", "virDomainSnapshot"),
"virDomainSnapshot *": ("._o", "virDomainSnapshot(self, _obj=%s)", "virDomainSnapshot"),
}
@@ -1031,7 +1043,7 @@ primary_classes = ["virDomain", "virNetwork", "virInterface",
"virStoragePool", "virStorageVol",
"virConnect", "virNodeDevice", "virSecret",
"virNWFilter", "virNWFilterBinding",
- "virStream", "virDomainSnapshot"]
+ "virStream", "virDomainCheckpoint", "virDomainSnapshot"]
classes_destructors = {
"virDomain": "virDomainFree",
@@ -1043,6 +1055,7 @@ classes_destructors = {
"virSecret": "virSecretFree",
"virNWFilter": "virNWFilterFree",
"virNWFilterBinding": "virNWFilterBindingFree",
+ "virDomainCheckpoint": "virDomainCheckpointFree",
"virDomainSnapshot": "virDomainSnapshotFree",
# We hand-craft __del__ for this one
#"virStream": "virStreamFree",
@@ -1053,6 +1066,7 @@ class_skip_connect_impl = {
}
class_domain_impl = {
+ "virDomainCheckpoint": True,
"virDomainSnapshot": True,
}
@@ -1171,6 +1185,18 @@ def nameFixup(name, classe, type, file):
elif name[0:12] == "virDomainGet":
func = name[12:]
func = func[0:1].lower() + func[1:]
+ elif name[0:31] == "virDomainCheckpointLookupByName":
+ func = name[9:]
+ func = func[0:1].lower() + func[1:]
+ elif name[0:28] == "virDomainCheckpointCreateXML":
+ func = name[9:]
+ func = func[0:1].lower() + func[1:]
+ elif name[0:26] == "virDomainCheckpointCurrent":
+ func = name[9:]
+ func = func[0:1].lower() + func[1:]
+ elif name[0:19] == "virDomainCheckpoint":
+ func = name[19:]
+ func = func[0:1].lower() + func[1:]
elif name[0:29] == "virDomainSnapshotLookupByName":
func = name[9:]
func = func[0:1].lower() + func[1:]
@@ -1183,6 +1209,9 @@ def nameFixup(name, classe, type, file):
elif name[0:20] == "virDomainSnapshotNum":
func = name[9:]
func = func[0:1].lower() + func[1:]
+ elif name[0:27] == "virDomainSnapshotCreateXML2":
+ func = name[9:]
+ func = func[0:1].lower() + func[1:]
elif name[0:26] == "virDomainSnapshotCreateXML":
func = name[9:]
func = func[0:1].lower() + func[1:]
@@ -1501,7 +1530,7 @@ def buildWrappers(module):
"virStorageVol", "virNodeDevice", "virSecret","virStream",
"virNWFilter", "virNWFilterBinding" ]:
classes.write(" def __init__(self, conn, _obj=None):\n")
- elif classname in [ 'virDomainSnapshot' ]:
+ elif classname in [ "virDomainCheckpoint", "virDomainSnapshot" ]:
classes.write(" def __init__(self, dom, _obj=None):\n")
else:
classes.write(" def __init__(self, _obj=None):\n")
@@ -1513,7 +1542,7 @@ def buildWrappers(module):
classes.write(" self._conn = conn\n" + \
" if not isinstance(conn, virConnect):\n" + \
" self._conn = conn._conn\n")
- elif classname in [ "virDomainSnapshot" ]:
+ elif classname in [ "virDomainCheckpoint", "virDomainSnapshot" ]:
classes.write(" self._dom = dom\n")
classes.write(" self._conn = dom.connect()\n")
classes.write(" if type(_obj).__name__ not in [\"PyCapsule\", \"PyCObject\"]:\n")
@@ -1641,7 +1670,7 @@ def buildWrappers(module):
classes.write(
" if ret is None:raise libvirtError('%s() failed', vol=self)\n" %
(name))
- elif classname == "virDomainSnapshot":
+ elif classname in [ "virDomainCheckpoint", "virDomainSnapshot"]:
classes.write(
" if ret is None:raise libvirtError('%s() failed', dom=self._dom)\n" %
(name))
diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml
index 7f578e0..1edf0c5 100644
--- a/libvirt-override-api.xml
+++ b/libvirt-override-api.xml
@@ -576,6 +576,18 @@
<arg name='flags' type='unsigned int' info='flags'/>
<return type='int' info="0 on success, -1 on error"/>
</function>
+ <function name='virDomainListAllCheckpoints' file='python'>
+ <info>returns the list of checkpoints for the given domain</info>
+ <arg name='dom' type='virDomainPtr' info='pointer to the domain'/>
+ <arg name='flags' type='unsigned int' info='flags'/>
+ <return type='char *' info='the list of checkpoints or None in case of error'/>
+ </function>
+ <function name='virDomainCheckpointListAllChildren' file='python'>
+ <info>collect the list of child checkpoint names for the given checkpoint</info>
+ <arg name='checkpoint' type='virDomainCheckpointPtr' info='pointer to the checkpoint'/>
+ <arg name='flags' type='unsigned int' info='flags'/>
+ <return type='char *' info='the list of checkpoints or None in case of error'/>
+ </function>
<function name='virDomainGetBlockJobInfo' file='python'>
<info>Get progress information for a block job</info>
<arg name='dom' type='virDomainPtr' info='pointer to the domain'/>
diff --git a/libvirt-override-virDomain.py b/libvirt-override-virDomain.py
index 7c417b8..7ce34f1 100644
--- a/libvirt-override-virDomain.py
+++ b/libvirt-override-virDomain.py
@@ -11,6 +11,19 @@
return retlist
+ def listAllCheckpoints(self, flags=0):
+ """List all checkpoints and returns a list of checkpoint objects"""
+ ret = libvirtmod.virDomainListAllCheckpoints(self._o, flags)
+ if ret is None:
+ raise libvirtError("virDomainListAllCheckpoints() failed", conn=self)
+
+ retlist = list()
+ for chkptr in ret:
+ retlist.append(virDomainCheckpoint(self, _obj=chkptr))
+
+ return retlist
+
+
def createWithFiles(self, files, flags=0):
"""Launch a defined domain. If the call succeeds the domain moves from the
defined to the running domains pools.
diff --git a/libvirt-override-virDomainCheckpoint.py b/libvirt-override-virDomainCheckpoint.py
new file mode 100644
index 0000000..371b0fd
--- /dev/null
+++ b/libvirt-override-virDomainCheckpoint.py
@@ -0,0 +1,19 @@
+ def getConnect(self):
+ """Get the connection that owns the domain that a checkpoint was created for"""
+ return self.connect()
+
+ def getDomain(self):
+ """Get the domain that a checkpoint was created for"""
+ return self.domain()
+
+ def listAllChildren(self, flags=0):
+ """List all child checkpoints and returns a list of checkpoint objects"""
+ ret = libvirtmod.virDomainCheckpointListAllChildren(self._o, flags)
+ if ret is None:
+ raise libvirtError("virDomainCheckpointListAllChildren() failed", conn=self)
+
+ retlist = list()
+ for chkptr in ret:
+ retlist.append(virDomainCheckpoint(self, _obj=chkptr))
+
+ return retlist
diff --git a/libvirt-override.c b/libvirt-override.c
index c5e2908..777f533 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -2325,6 +2325,98 @@ libvirt_virConnectListDefinedDomains(PyObject *self ATTRIBUTE_UNUSED,
goto cleanup;
}
+#if LIBVIR_CHECK_VERSION(5, 1, 0)
+static PyObject *
+libvirt_virDomainListAllCheckpoints(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ PyObject *py_retval = NULL;
+ virDomainCheckpointPtr *chks = NULL;
+ int c_retval;
+ ssize_t i;
+ virDomainPtr dom;
+ PyObject *pyobj_dom;
+ unsigned int flags;
+
+ if (!PyArg_ParseTuple(args, (char *)"OI:virDomainListAllCheckpoints",
+ &pyobj_dom, &flags))
+ return NULL;
+ dom = (virDomainPtr) PyvirDomain_Get(pyobj_dom);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ c_retval = virDomainListAllCheckpoints(dom, &chks, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (c_retval < 0)
+ return VIR_PY_NONE;
+
+ if (!(py_retval = PyList_New(c_retval)))
+ goto cleanup;
+
+ for (i = 0; i < c_retval; i++) {
+ VIR_PY_LIST_SET_GOTO(py_retval, i,
+ libvirt_virDomainCheckpointPtrWrap(chks[i]), error);
+ chks[i] = NULL;
+ }
+
+ cleanup:
+ for (i = 0; i < c_retval; i++)
+ if (chks[i])
+ virDomainCheckpointFree(chks[i]);
+ VIR_FREE(chks);
+ return py_retval;
+
+ error:
+ Py_CLEAR(py_retval);
+ goto cleanup;
+}
+
+static PyObject *
+libvirt_virDomainCheckpointListAllChildren(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ PyObject *py_retval = NULL;
+ virDomainCheckpointPtr *chks = NULL;
+ int c_retval;
+ ssize_t i;
+ virDomainCheckpointPtr parent;
+ PyObject *pyobj_parent;
+ unsigned int flags;
+
+ if (!PyArg_ParseTuple(args, (char *)"OI:virDomainCheckpointListAllChildren",
+ &pyobj_parent, &flags))
+ return NULL;
+ parent = (virDomainCheckpointPtr) PyvirDomainCheckpoint_Get(pyobj_parent);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ c_retval = virDomainCheckpointListAllChildren(parent, &chks, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (c_retval < 0)
+ return VIR_PY_NONE;
+
+ if (!(py_retval = PyList_New(c_retval)))
+ goto cleanup;
+
+ for (i = 0; i < c_retval; i++) {
+ VIR_PY_LIST_SET_GOTO(py_retval, i,
+ libvirt_virDomainCheckpointPtrWrap(chks[i]), error);
+ chks[i] = NULL;
+ }
+
+ cleanup:
+ for (i = 0; i < c_retval; i++)
+ if (chks[i])
+ virDomainCheckpointFree(chks[i]);
+ VIR_FREE(chks);
+ return py_retval;
+
+ error:
+ Py_CLEAR(py_retval);
+ goto cleanup;
+}
+#endif /* LIBVIR_CHECK_VERSION(5, 1, 0) */
+
static PyObject *
libvirt_virDomainSnapshotListNames(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args)
@@ -10100,6 +10192,10 @@ static PyMethodDef libvirtMethods[] = {
#if LIBVIR_CHECK_VERSION(1, 0, 3)
{(char *) "virDomainGetJobStats", libvirt_virDomainGetJobStats, METH_VARARGS, NULL},
#endif /* LIBVIR_CHECK_VERSION(1, 0, 3) */
+#if LIBVIR_CHECK_VERSION(5, 1, 0)
+ {(char *) "virDomainListAllCheckpoints", libvirt_virDomainListAllCheckpoints, METH_VARARGS, NULL},
+ {(char *) "virDomainCheckpointListAllChildren", libvirt_virDomainCheckpointListAllChildren, METH_VARARGS, NULL},
+#endif /* LIBVIR_CHECK_VERSION(5, 1, 0) */
{(char *) "virDomainSnapshotListNames", libvirt_virDomainSnapshotListNames, METH_VARARGS, NULL},
#if LIBVIR_CHECK_VERSION(0, 9, 13)
{(char *) "virDomainListAllSnapshots", libvirt_virDomainListAllSnapshots, METH_VARARGS, NULL},
diff --git a/sanitytest.py b/sanitytest.py
index 68dde6b..b044231 100644
--- a/sanitytest.py
+++ b/sanitytest.py
@@ -249,13 +249,13 @@ for name in sorted(basicklassmap):
# Remove 'Get' prefix from most APIs, except those in virConnect
# and virDomainSnapshot namespaces which stupidly used a different
# convention which we now can't fix without breaking API
- if func[0:3] == "Get" and klass not in ["virConnect", "virDomainSnapshot", "libvirt"]:
+ if func[0:3] == "Get" and klass not in ["virConnect", "virDomainCheckpoint", "virDomainSnapshot", "libvirt"]:
if func not in ["GetCPUStats", "GetTime"]:
func = func[3:]
# The object creation and lookup APIs all have to get re-mapped
# into the parent class
- if func in ["CreateXML", "CreateLinux", "CreateXMLWithFiles",
+ if func in ["CreateXML", "CreateXML2", "CreateLinux", "CreateXMLWithFiles",
"DefineXML", "CreateXMLFrom", "LookupByUUID",
"LookupByUUIDString", "LookupByVolume" "LookupByName",
"LookupByID", "LookupByName", "LookupByKey", "LookupByPath",
@@ -266,7 +266,7 @@ for name in sorted(basicklassmap):
if klass != "virDomain":
func = klass[3:] + func
- if klass == "virDomainSnapshot":
+ if klass in [ "virDomainCheckpoint", "virDomainSnapshot"]:
klass = "virDomain"
func = func[6:]
elif klass == "virStorageVol" and func in ["StorageVolCreateXMLFrom", "StorageVolCreateXML"]:
@@ -297,10 +297,13 @@ for name in sorted(basicklassmap):
if func[0:6] == "Change":
klass = "virConnect"
- # Need to special case the snapshot APIs
+ # Need to special case the checkpoint and snapshot APIs
if klass == "virDomainSnapshot" and func in ["Current", "ListNames", "Num"]:
klass = "virDomain"
func = "snapshot" + func
+ elif klass == "virDomainCheckpoint" and func == "Current":
+ klass = "virDomain"
+ func = "checkpoint" + func
# Names should start with lowercase letter...
func = func[0:1].lower() + func[1:]
diff --git a/typewrappers.c b/typewrappers.c
index 9ba14b4..cd7a70b 100644
--- a/typewrappers.c
+++ b/typewrappers.c
@@ -568,6 +568,19 @@ libvirt_virStreamPtrWrap(virStreamPtr node)
return ret;
}
+PyObject *
+libvirt_virDomainCheckpointPtrWrap(virDomainCheckpointPtr node)
+{
+ PyObject *ret;
+
+ if (node == NULL) {
+ return VIR_PY_NONE;
+ }
+
+ ret = libvirt_buildPyObject(node, "virDomainCheckpointPtr", NULL);
+ return ret;
+}
+
PyObject *
libvirt_virDomainSnapshotPtrWrap(virDomainSnapshotPtr node)
{
diff --git a/typewrappers.h b/typewrappers.h
index 4423774..198397b 100644
--- a/typewrappers.h
+++ b/typewrappers.h
@@ -128,6 +128,15 @@ typedef struct {
} PyvirStream_Object;
+#define PyvirDomainCheckpoint_Get(v) (((v) == Py_None) ? NULL : \
+ (((PyvirDomainCheckpoint_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ virDomainCheckpointPtr obj;
+} PyvirDomainCheckpoint_Object;
+
+
#define PyvirDomainSnapshot_Get(v) (((v) == Py_None) ? NULL : \
(((PyvirDomainSnapshot_Object *)(v))->obj))
@@ -204,6 +213,7 @@ PyObject * libvirt_virSecretPtrWrap(virSecretPtr node);
PyObject * libvirt_virNWFilterPtrWrap(virNWFilterPtr node);
PyObject * libvirt_virNWFilterBindingPtrWrap(virNWFilterBindingPtr node);
PyObject * libvirt_virStreamPtrWrap(virStreamPtr node);
+PyObject * libvirt_virDomainCheckpointPtrWrap(virDomainCheckpointPtr node);
PyObject * libvirt_virDomainSnapshotPtrWrap(virDomainSnapshotPtr node);
--
2.20.1
5 years, 3 months
[libvirt] [PATCH] virfile: adds quobyte as a shared fs
by Silvan Kaiser
Adds detection of a Quobyte shared file system for
live migration.
Signed-off-by: Silvan Kaiser <silvan(a)quobyte.com>
---
src/util/virfile.c | 13 ++++++++++++-
src/util/virfile.h | 1 +
tests/virfiledata/mounts3.txt | 1 +
tests/virfilemock.c | 3 +++
tests/virfiletest.c | 1 +
5 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/util/virfile.c b/src/util/virfile.c
index f7415cf633..a46b8792f6 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -3434,6 +3434,9 @@ int virFilePrintf(FILE *fp, const char *msg, ...)
# ifndef GPFS_SUPER_MAGIC
# define GPFS_SUPER_MAGIC 0x47504653
# endif
+# ifndef QB_MAGIC
+# define QB_MAGIC 0x51626d6e
+# endif
# define PROC_MOUNTS "/proc/mounts"
@@ -3490,6 +3493,10 @@ virFileIsSharedFixFUSE(const char *path,
VIR_DEBUG("Found gluster FUSE mountpoint=%s for path=%s. "
"Fixing shared FS type", mntDir, canonPath);
*f_type = GFS2_MAGIC;
+ } else if (STREQ_NULLABLE(mntType, "fuse.quobyte")) {
+ VIR_DEBUG("Found Quobyte FUSE mountpoint=%s for path=%s. "
+ "Fixing shared FS type", mntDir, canonPath);
+ *f_type = QB_MAGIC;
}
ret = 0;
@@ -3582,6 +3589,9 @@ virFileIsSharedFSType(const char *path,
if ((fstypes & VIR_FILE_SHFS_GPFS) &&
(f_type == GPFS_SUPER_MAGIC))
return 1;
+ if ((fstypes & VIR_FILE_SHFS_QB) &&
+ (f_type == QB_MAGIC))
+ return 1;
return 0;
}
@@ -3771,7 +3781,8 @@ int virFileIsSharedFS(const char *path)
VIR_FILE_SHFS_SMB |
VIR_FILE_SHFS_CIFS |
VIR_FILE_SHFS_CEPH |
- VIR_FILE_SHFS_GPFS);
+ VIR_FILE_SHFS_GPFS|
+ VIR_FILE_SHFS_QB);
}
diff --git a/src/util/virfile.h b/src/util/virfile.h
index 641960e2ca..e06855ea86 100644
--- a/src/util/virfile.h
+++ b/src/util/virfile.h
@@ -212,6 +212,7 @@ enum {
VIR_FILE_SHFS_CIFS = (1 << 5),
VIR_FILE_SHFS_CEPH = (1 << 6),
VIR_FILE_SHFS_GPFS = (1 << 7),
+ VIR_FILE_SHFS_QB = (1 << 8),
};
int virFileIsSharedFSType(const char *path, int fstypes) ATTRIBUTE_NONNULL(1);
diff --git a/tests/virfiledata/mounts3.txt b/tests/virfiledata/mounts3.txt
index 4377e5d471..b91804a4e4 100644
--- a/tests/virfiledata/mounts3.txt
+++ b/tests/virfiledata/mounts3.txt
@@ -36,3 +36,4 @@ root@host:/tmp/mkdir /gluster/sshfs fuse.sshfs rw 0 0
192.168.0.1:/ceph/data /ceph ceph rw,noatime,name=cephfs,secret=<hidden>,acl,wsize=16777216 0 0
192.168.0.1,192.168.0.2,192.168.0.3:/ceph/data2 /ceph/multi ceph rw,noatime,name=cephfs,secret=<hidden>,acl,wsize=16777216 0 0
gpfs_data /gpfs/data gpfs rw,relatime 0 0
+quobyte(a)192.168.0.1/data /quobyte fuse.quobyte rw,nosuid,nodev,noatime,user_id=0,group_id=0,allow_other 0 0
diff --git a/tests/virfilemock.c b/tests/virfilemock.c
index 106032f857..54c57d417b 100644
--- a/tests/virfilemock.c
+++ b/tests/virfilemock.c
@@ -92,6 +92,9 @@ setmntent(const char *filename, const char *type)
#ifndef GPFS_SUPER_MAGIC
# define GPFS_SUPER_MAGIC 0x47504653
#endif
+# ifndef QB_MAGIC
+# define QB_MAGIC 0x51626d6e
+# endif
static int
diff --git a/tests/virfiletest.c b/tests/virfiletest.c
index e2bd4953ed..aa4c3435e5 100644
--- a/tests/virfiletest.c
+++ b/tests/virfiletest.c
@@ -458,6 +458,7 @@ mymain(void)
DO_TEST_FILE_IS_SHARED_FS_TYPE("mounts3.txt", "/ceph/file", true);
DO_TEST_FILE_IS_SHARED_FS_TYPE("mounts3.txt", "/ceph/multi/file", true);
DO_TEST_FILE_IS_SHARED_FS_TYPE("mounts3.txt", "/gpfs/data", true);
+ DO_TEST_FILE_IS_SHARED_FS_TYPE("mounts3.txt", "/quobyte", true);
return ret != 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}
--
2.16.5
5 years, 3 months
[libvirt] [dockerfiles PATCH] Add git-publish configuration file
by Andrea Bolognani
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
.gitpublish | 4 ++++
1 file changed, 4 insertions(+)
create mode 100644 .gitpublish
diff --git a/.gitpublish b/.gitpublish
new file mode 100644
index 0000000..a56a6d0
--- /dev/null
+++ b/.gitpublish
@@ -0,0 +1,4 @@
+[gitpublishprofile "default"]
+base = master
+to = libvir-list(a)redhat.com
+prefix = dockerfiles PATCH
--
2.20.1
5 years, 3 months
[libvirt] [PATCH v4 00/25] Fix and enable owner remembering
by Michal Privoznik
This is meant for next release to have the most time possible for
testing. Some of the patches were ACKed in v3 already but since they
don't make sense on their own I haven't pushed them.
v4 of:
https://www.redhat.com/archives/libvir-list/2019-March/msg01948.html
As usual, you can find (not only these) patches on my github:
https://github.com/zippy2/libvirt branch xattr_fixes_v4
diff to v3:
- Some new patches (qemusecuritytest and qemusecuritymock)
- Some other fixes raised by Cole in review of v3 (like double error
reporting and others)
- Remembering is done only for paths that cannot be shared between
domains. This renders refcounting needless because the refcounter
can't ever be greater than one. Nevertheless, I'm keeping it in
because in the long run I might come up with a solution to the problem
of shared resources and having refcounters might help.
Michal Prívozník (25):
qemusecuritymock: Mock virProcessRunInFork
qemusecuritymock: Fix bit arithmetic
qemusecuritymock: Actually set error on failure
qemusecuritymock: Introduce and use freePaths()
qemusecuritytest: Drop unused variable
qemusecuritytest: Use AUTOFREE/AUTOUNREF
qemusecuritytest: Fix capabilities loading
tools: Slightly rework libvirt_recover_xattrs.sh
virSecuritySELinuxRestoreAllLabel: Print @migrated in the debug
message too
virfile: Make virFileGetXAttr report errors
virFileSetXAttr: Report error on failure
virFileRemoveXAttr: Report error on failure
security: Don't skip label restore on file systems lacking XATTRs
security: Document @restore member of transaction list
security_dac: Allow caller to suppress owner remembering
security_selinux: Allow caller to suppress owner remembering
qemusecuritymock: Allow some paths to be not restored
security: Don't remember owner for shared resources
security: Introduce virSecurityManagerMoveImageMetadata
security_util: Introduce virSecurityMoveRememberedLabel
security_dac: Implement virSecurityManagerMoveImageMetadata
security_selinux: Implement virSecurityManagerMoveImageMetadata
qemu_security: Implement qemuSecurityMoveImageMetadata
qemu: Move image security metadata on snapshot activity
Revert "qemu: Temporary disable owner remembering"
docs/news.xml | 13 ++
src/libvirt_private.syms | 2 +
src/qemu/libvirtd_qemu.aug | 1 +
src/qemu/qemu.conf | 5 +
src/qemu/qemu_blockjob.c | 6 +
src/qemu/qemu_conf.c | 4 +
src/qemu/qemu_driver.c | 17 +-
src/qemu/qemu_security.c | 19 +++
src/qemu/qemu_security.h | 5 +
src/qemu/test_libvirtd_qemu.aug.in | 1 +
src/security/security_dac.c | 171 +++++++++++++++----
src/security/security_driver.h | 5 +
src/security/security_manager.c | 39 +++++
src/security/security_manager.h | 4 +
src/security/security_nop.c | 10 ++
src/security/security_selinux.c | 263 ++++++++++++++++++++---------
src/security/security_stack.c | 20 +++
src/security/security_util.c | 73 +++++++-
src/security/security_util.h | 5 +
src/util/virfile.c | 78 +++++++--
src/util/virfile.h | 5 +
src/util/virprocess.h | 3 +-
tests/qemusecuritymock.c | 76 +++++++--
tests/qemusecuritytest.c | 146 ++++++++++------
tests/qemusecuritytest.h | 4 +-
tools/libvirt_recover_xattrs.sh | 50 +++---
26 files changed, 802 insertions(+), 223 deletions(-)
--
2.21.0
5 years, 3 months
[libvirt] [PATCH v8 00/21] Incremental backups
by Eric Blake
The API is fairly stable, but there are still probably code cleanups
worth adding to the qemu driver implementation. I've also seen a
desire on the list to support all APIs in the test driver, so I'll
try and whip that together for my next round of patches.
If we are confident that the API is worth having in 5.3 (especially
since the earlier part of this series already has positive reviews),
then it's probably worth committing that part of the series now even
while I still address review comments on the later patches.
I've pushed a tag backup-v8 to both my libvirt.git and
libvirt-python.git repos to match:
https://repo.or.cz/libvirt/ericb.git/shortlog/refs/tags/backup-v8
https://repo.or.cz/libvirt-python/ericb.git/shortlog/refs/tags/backup-v8
Here's hoping we're happy enough with the API, including the fact that
rudimentary operation of pull mode backups work with qemu 4.0-rc1, for
this to make it into the 5.2 release.
Notable diffs from v7:
- address several review comments (although I didn't get to every
comment later in the series)
- actually support job id of 0 (it was documented but not working in v7)
- add support for Unix socket pull mode backups
- improve checkpoint XML handling (more tests, separate postparse actions
out from initial parse)
- rebase to master
001/21:[0044] [FC] 'backup: Document new XML for checkpoints'
002/21:[----] [--] 'backup: Document new XML for backups'
003/21:[0006] [FC] 'backup: Introduce virDomainCheckpoint APIs'
004/21:[0002] [FC] 'backup: Introduce virDomainBackup APIs'
005/21:[----] [--] 'backup: Document nuances between different state capture APIs'
006/21:[0304] [FC] 'backup: Parse and output checkpoint XML'
007/21:[0007] [FC] 'backup: Allow for lists of checkpoint objects'
008/21:[0004] [FC] 'backup: Add new domain:checkpoint access control'
009/21:[0043] [FC] 'backup: Implement backup APIs for remote driver'
010/21:[down] 'conf: Add parameter to virDomainDiskSourceFormat'
011/21:[0019] [FC] 'backup: Parse and output backup XML'
012/21:[0006] [FC] 'backup: Implement virsh support for checkpoints'
013/21:[0002] [FC] 'backup: Implement virsh support for backup'
014/21:[down] 'backup: Prepare for Unix sockets in QMP nbd-server-start'
015/21:[0008] [FC] 'backup: Add new qemu monitor interactions'
016/21:[0022] [FC] 'backup: qemu: Implement metadata tracking for checkpoint APIs'
017/21:[0004] [FC] 'backup: Wire up qemu checkpoint commands over QMP'
018/21:[0019] [FC] 'backup: qemu: Implement framework for backup job APIs'
019/21:[0042] [FC] 'backup: Wire up qemu full pull backup commands over QMP'
020/21:[----] [-C] 'backup: qemu: Wire up qemu full push backup commands over QMP'
021/21:[0003] [FC] 'backup: implement qemu incremental pull backup'
Eric Blake (21):
backup: Document new XML for checkpoints
backup: Document new XML for backups
backup: Introduce virDomainCheckpoint APIs
backup: Introduce virDomainBackup APIs
backup: Document nuances between different state capture APIs
backup: Parse and output checkpoint XML
backup: Allow for lists of checkpoint objects
backup: Add new domain:checkpoint access control
backup: Implement backup APIs for remote driver
conf: Add parameter to virDomainDiskSourceFormat
backup: Parse and output backup XML
backup: Implement virsh support for checkpoints
backup: Implement virsh support for backup
backup: Prepare for Unix sockets in QMP nbd-server-start
backup: Add new qemu monitor interactions
backup: qemu: Implement metadata tracking for checkpoint APIs
backup: Wire up qemu checkpoint commands over QMP
backup: qemu: Implement framework for backup job APIs
backup: Wire up qemu full pull backup commands over QMP
backup: qemu: Wire up qemu full push backup commands over QMP
backup: implement qemu incremental pull backup
include/libvirt/libvirt-domain-checkpoint.h | 161 ++
include/libvirt/libvirt-domain-snapshot.h | 8 +-
include/libvirt/libvirt-domain.h | 47 +-
include/libvirt/libvirt.h | 5 +-
src/access/viraccessperm.h | 6 +
src/conf/backup_conf.h | 97 +
src/conf/checkpoint_conf.h | 103 ++
src/conf/domain_conf.h | 3 +
src/conf/virconftypes.h | 12 +
src/conf/virdomaincheckpointobjlist.h | 74 +
src/conf/virdomainmomentobjlist.h | 7 +-
src/conf/virdomainobjlist.h | 7 +-
src/driver-hypervisor.h | 79 +
src/qemu/qemu_block.h | 3 +
src/qemu/qemu_blockjob.h | 1 +
src/qemu/qemu_capabilities.h | 2 +
src/qemu/qemu_conf.h | 2 +
src/qemu/qemu_domain.h | 19 +
src/qemu/qemu_monitor.h | 27 +-
src/qemu/qemu_monitor_json.h | 22 +-
tools/virsh-checkpoint.h | 29 +
tools/virsh-completer.h | 4 +
tools/virsh-util.h | 3 +
tools/virsh.h | 1 +
docs/Makefile.am | 3 +
docs/apibuild.py | 2 +
docs/docs.html.in | 10 +-
docs/domainstatecapture.html.in | 315 ++++
docs/format.html.in | 2 +
docs/formatbackup.html.in | 184 ++
docs/formatcheckpoint.html.in | 204 +++
docs/formatsnapshot.html.in | 2 +
docs/index.html.in | 4 +-
docs/schemas/domainbackup.rng | 219 +++
docs/schemas/domaincheckpoint.rng | 87 +
examples/object-events/event-test.c | 3 +
libvirt.spec.in | 3 +
mingw-libvirt.spec.in | 6 +
po/POTFILES | 3 +
src/Makefile.am | 2 +
src/access/viraccessperm.c | 3 +-
src/conf/Makefile.inc.am | 6 +
src/conf/backup_conf.c | 538 ++++++
src/conf/checkpoint_conf.c | 636 +++++++
src/conf/domain_conf.c | 22 +-
src/conf/snapshot_conf.c | 3 +-
src/conf/virdomaincheckpointobjlist.c | 223 +++
src/conf/virdomainmomentobjlist.c | 40 +-
src/conf/virdomainobjlist.c | 11 +
src/conf/virdomainsnapshotobjlist.c | 2 +-
src/libvirt-domain-checkpoint.c | 750 ++++++++
src/libvirt-domain-snapshot.c | 89 +
src/libvirt-domain.c | 237 ++-
src/libvirt_private.syms | 32 +
src/libvirt_public.syms | 24 +
src/qemu/qemu_block.c | 12 +
src/qemu/qemu_capabilities.c | 4 +
src/qemu/qemu_conf.c | 5 +
src/qemu/qemu_domain.c | 221 ++-
src/qemu/qemu_driver.c | 1577 +++++++++++++++++
src/qemu/qemu_migration.c | 9 +-
src/qemu/qemu_monitor.c | 72 +-
src/qemu/qemu_monitor_json.c | 222 ++-
src/qemu/qemu_process.c | 9 +
src/remote/remote_daemon_dispatch.c | 20 +
src/remote/remote_driver.c | 32 +-
src/remote/remote_protocol.x | 258 ++-
src/remote_protocol-structs | 139 ++
src/rpc/gendispatch.pl | 32 +-
tests/Makefile.am | 13 +-
tests/domainbackupxml2xmlin/backup-pull.xml | 9 +
tests/domainbackupxml2xmlin/backup-push.xml | 9 +
tests/domainbackupxml2xmlin/empty.xml | 1 +
tests/domainbackupxml2xmlout/backup-pull.xml | 9 +
tests/domainbackupxml2xmlout/backup-push.xml | 9 +
tests/domainbackupxml2xmlout/empty.xml | 7 +
tests/domaincheckpointxml2xmlin/empty.xml | 1 +
tests/domaincheckpointxml2xmlin/sample.xml | 7 +
tests/domaincheckpointxml2xmlin/size.xml | 4 +
tests/domaincheckpointxml2xmlout/empty.xml | 7 +
.../internal-active-invalid.xml | 53 +
.../internal-inactive-invalid.xml | 53 +
tests/domaincheckpointxml2xmlout/redefine.xml | 63 +
tests/domaincheckpointxml2xmlout/sample.xml | 12 +
tests/domaincheckpointxml2xmlout/size.xml | 11 +
tests/domaincheckpointxml2xmltest.c | 223 +++
tests/qemublocktest.c | 3 +-
.../caps_4.0.0.riscv32.xml | 2 +
.../caps_4.0.0.riscv64.xml | 2 +
.../caps_4.0.0.x86_64.xml | 2 +
tests/qemumonitorjsontest.c | 32 +-
tests/virschematest.c | 4 +
tests/virstoragetest.c | 2 +-
tools/Makefile.am | 1 +
tools/virsh-checkpoint.c | 1370 ++++++++++++++
tools/virsh-completer.c | 51 +
tools/virsh-domain-monitor.c | 23 +
tools/virsh-domain.c | 268 ++-
tools/virsh-snapshot.c | 37 +-
tools/virsh-util.c | 11 +
tools/virsh.c | 2 +
tools/virsh.pod | 302 +++-
102 files changed, 9502 insertions(+), 100 deletions(-)
create mode 100644 include/libvirt/libvirt-domain-checkpoint.h
create mode 100644 src/conf/backup_conf.h
create mode 100644 src/conf/checkpoint_conf.h
create mode 100644 src/conf/virdomaincheckpointobjlist.h
create mode 100644 tools/virsh-checkpoint.h
create mode 100644 docs/domainstatecapture.html.in
create mode 100644 docs/formatbackup.html.in
create mode 100644 docs/formatcheckpoint.html.in
create mode 100644 docs/schemas/domainbackup.rng
create mode 100644 docs/schemas/domaincheckpoint.rng
create mode 100644 src/conf/backup_conf.c
create mode 100644 src/conf/checkpoint_conf.c
create mode 100644 src/conf/virdomaincheckpointobjlist.c
create mode 100644 src/libvirt-domain-checkpoint.c
create mode 100644 tests/domainbackupxml2xmlin/backup-pull.xml
create mode 100644 tests/domainbackupxml2xmlin/backup-push.xml
create mode 100644 tests/domainbackupxml2xmlin/empty.xml
create mode 100644 tests/domainbackupxml2xmlout/backup-pull.xml
create mode 100644 tests/domainbackupxml2xmlout/backup-push.xml
create mode 100644 tests/domainbackupxml2xmlout/empty.xml
create mode 100644 tests/domaincheckpointxml2xmlin/empty.xml
create mode 100644 tests/domaincheckpointxml2xmlin/sample.xml
create mode 100644 tests/domaincheckpointxml2xmlin/size.xml
create mode 100644 tests/domaincheckpointxml2xmlout/empty.xml
create mode 100644 tests/domaincheckpointxml2xmlout/internal-active-invalid.xml
create mode 100644 tests/domaincheckpointxml2xmlout/internal-inactive-invalid.xml
create mode 100644 tests/domaincheckpointxml2xmlout/redefine.xml
create mode 100644 tests/domaincheckpointxml2xmlout/sample.xml
create mode 100644 tests/domaincheckpointxml2xmlout/size.xml
create mode 100644 tests/domaincheckpointxml2xmltest.c
create mode 100644 tools/virsh-checkpoint.c
--
2.20.1
5 years, 3 months
[libvirt] [PATCH 0/2] Couple of test_driver fixes
by Michal Privoznik
I was too eager to minimize patch 89320788ac4 and did some mistakes.
Here are the fixes.
Michal Prívozník (2):
test_driver: Don't access @vm after it was set to NULL
test_driver: Don't report VIR_DOMAIN_DISK_ERROR_NONE
src/test/test_driver.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--
2.21.0
5 years, 4 months
[libvirt] mdevctl: A shoestring mediated device management and persistence utility
by Alex Williamson
Hi,
Currently mediated device management, much like SR-IOV VF management,
is largely left as an exercise for the user. This is an attempt to
provide something and see where it goes. I doubt we'll solve
everyone's needs on the first pass, but maybe we'll solve enough and
provide helpers for the rest. Without further ado, I'll point to what
I have so far:
https://github.com/awilliam/mdevctl
This is inspired by driverctl, which is also a bash utility. mdevctl
uses udev and systemd to record and recreate mdev devices for
persistence and provides a command line utility for querying, listing,
starting, stopping, adding, and removing mdev devices. Currently, for
better or worse, it considers anything created to be persistent. I can
imagine a global configuration option that might disable this and
perhaps an autostart flag per mdev device, such that mdevctl might
simply "know" about some mdevs but not attempt to create them
automatically. Clearly command line usage help, man pages, and
packaging are lacking as well, release early, release often, plus this
is a discussion starter to see if perhaps this is sufficient to meet
some needs.
Originally I thought about making a utility to manage both mdev and
SR-IOV VFs all in one, but it seemed more natural to start here
(besides, I couldn't think of a good name for the combined utility).
If this seems useful, maybe I'll start on a vfctl for SR-IOV and we'll
see whether they have enough synergy to become one.
It would be really useful if s390 folks could help me understand
whether it's possible to glean all the information necessary to
recreate a ccw or ap mdev device from sysfs. I expect the file where
we currently only store the mdev_type to evolve into something that
includes more information to facilitate more complicated devices. For
now I make no claims to maintaining compatibility of recorded mdev
devices, it will absolutely change, but I didn't want to get bogged
down in making sure I don't accidentally source a root kit hidden in an
mdev config file.
I'm also curious how or if libvirt or openstack might use this. If
nothing else, it makes libvirt hook scripts easier to write, especially
if we add an option not to autostart mdevs, or if users don't mind
persistent mdevs, maybe there's nothing more to do.
BTW, feel free to clean up by bash, I'm a brute force and ignorance
shell coder ;) Thanks,
Alex
5 years, 4 months
[libvirt] [PATCH] snapshot: Store both config and live XML in the snapshot domain
by Maxiwell S. Garcia
The snapshot-create operation of running guests saves the live
XML and uses it to replace the active and inactive domain in
case of revert. So, the config XML is ignored by the snapshot
process. This commit changes it and adds the config XML in the
snapshot XML as the <inactive/domain> entry.
In case of offline guest, the behavior remains the same and the
config XML is saved in the snapshot XML as <domain> entry. The
behavior of older snapshots of running guests, that don't have
the new <inactive/domain>, remains the same too. The revert, in
this case, overrides both active and inactive domain with the
<domain> entry. So, the <inactive/domain> in the snapshot XML is
not required to snapshot work, but it's useful to preserve the
config XML of running guests.
Signed-off-by: Maxiwell S. Garcia <maxiwell(a)linux.ibm.com>
---
src/conf/moment_conf.c | 1 +
src/conf/moment_conf.h | 1 +
src/conf/snapshot_conf.c | 42 ++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_driver.c | 29 ++++++++++++++++++++++-----
4 files changed, 68 insertions(+), 5 deletions(-)
diff --git a/src/conf/moment_conf.c b/src/conf/moment_conf.c
index fea13f0f97..f54a44b33e 100644
--- a/src/conf/moment_conf.c
+++ b/src/conf/moment_conf.c
@@ -66,6 +66,7 @@ virDomainMomentDefDispose(void *obj)
VIR_FREE(def->description);
VIR_FREE(def->parent_name);
virDomainDefFree(def->dom);
+ virDomainDefFree(def->inactiveDom);
}
/* Provide defaults for creation time and moment name after parsing XML */
diff --git a/src/conf/moment_conf.h b/src/conf/moment_conf.h
index 00ec1c1904..b8bec7e456 100644
--- a/src/conf/moment_conf.h
+++ b/src/conf/moment_conf.h
@@ -38,6 +38,7 @@ struct _virDomainMomentDef {
long long creationTime; /* in seconds */
virDomainDefPtr dom;
+ virDomainDefPtr inactiveDom;
};
virClassPtr virClassForDomainMomentDef(void);
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index c7f29360e7..c66ee997a4 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -294,6 +294,28 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt,
} else {
VIR_WARN("parsing older snapshot that lacks domain");
}
+
+ /* /inactive/domain entry saves the config XML present in a running
+ * VM. In case of absent, leave parent.inactiveDom NULL and use
+ * parent.dom for config and live XML. */
+ if ((tmp = virXPathString("string(./inactive/domain/@type)", ctxt))) {
+ int domainflags = VIR_DOMAIN_DEF_PARSE_INACTIVE |
+ VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE;
+ xmlNodePtr domainNode = virXPathNode("./inactive/domain", ctxt);
+
+ VIR_FREE(tmp);
+ if (!domainNode) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("missing inactive domain in snapshot"));
+
+ goto cleanup;
+ }
+ def->parent.inactiveDom = virDomainDefParseNode(ctxt->node->doc, domainNode,
+ caps, xmlopt, NULL, domainflags);
+ if (!def->parent.inactiveDom)
+ goto cleanup;
+ }
+
} else if (virDomainXMLOptionRunMomentPostParse(xmlopt, &def->parent) < 0) {
goto cleanup;
}
@@ -511,6 +533,16 @@ virDomainSnapshotRedefineValidate(virDomainSnapshotDefPtr def,
VIR_STEAL_PTR(def->parent.dom, otherdef->parent.dom);
}
}
+ if (otherdef->parent.inactiveDom) {
+ if (def->parent.inactiveDom) {
+ if (!virDomainDefCheckABIStability(otherdef->parent.inactiveDom,
+ def->parent.inactiveDom, xmlopt))
+ return -1;
+ } else {
+ /* Transfer the inactive domain def */
+ VIR_STEAL_PTR(def->parent.inactiveDom, otherdef->parent.inactiveDom);
+ }
+ }
}
if (def->parent.dom) {
@@ -876,6 +908,16 @@ virDomainSnapshotDefFormatInternal(virBufferPtr buf,
virBufferAddLit(buf, "</domain>\n");
}
+ if (def->parent.inactiveDom) {
+ virBufferAddLit(buf, "<inactive>\n");
+ virBufferAdjustIndent(buf, 2);
+ if (virDomainDefFormatInternal(def->parent.inactiveDom, caps,
+ domainflags, buf, xmlopt) < 0)
+ goto error;
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "</inactive>\n");
+ }
+
if (virSaveCookieFormatBuf(buf, def->cookie,
virDomainXMLOptionGetSaveCookie(xmlopt)) < 0)
goto error;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 42b1ce2521..1ce7aa7b42 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15707,6 +15707,15 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)))
goto endjob;
+ if (vm->newDef) {
+ if (!(xml = qemuDomainDefFormatLive(driver, vm->newDef, priv->origCPU,
+ true, true)) ||
+ !(def->parent.inactiveDom = virDomainDefParseString(xml, caps, driver->xmlopt, NULL,
+ VIR_DOMAIN_DEF_PARSE_INACTIVE |
+ VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)))
+ goto endjob;
+ }
+
if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY) {
align_location = VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL;
align_match = false;
@@ -16241,6 +16250,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
qemuDomainObjPrivatePtr priv;
int rc;
virDomainDefPtr config = NULL;
+ virDomainDefPtr inactiveConfig = NULL;
virQEMUDriverConfigPtr cfg = NULL;
virCapsPtr caps = NULL;
bool was_stopped = false;
@@ -16341,17 +16351,22 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
* in the failure cases where we know there was no change? */
}
- /* Prepare to copy the snapshot inactive xml as the config of this
- * domain.
- *
- * XXX Should domain snapshots track live xml rather
- * than inactive xml? */
+ /* Prepare to copy the snapshot inactive domain as the config XML
+ * and the snapshot domain as the live XML. In case of inactive domain
+ * NULL, both config and live XML will be copied from snapshot domain.
+ */
if (snap->def->dom) {
config = virDomainDefCopy(snap->def->dom, caps,
driver->xmlopt, NULL, true);
if (!config)
goto endjob;
}
+ if (snap->def->inactiveDom) {
+ inactiveConfig = virDomainDefCopy(snap->def->inactiveDom, caps,
+ driver->xmlopt, NULL, true);
+ if (!inactiveConfig)
+ goto endjob;
+ }
cookie = (qemuDomainSaveCookiePtr) snapdef->cookie;
@@ -16602,6 +16617,10 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
goto endjob;
}
+ if (inactiveConfig) {
+ virDomainDefFree(vm->newDef);
+ VIR_STEAL_PTR(vm->newDef, inactiveConfig);
+ }
ret = 0;
endjob:
--
2.20.1
5 years, 4 months
[libvirt] [PATCH v3 0/8] CPU Model Baseline and Comparison for s390x
by Collin Walling
Changelog:
v2
- numerous cleanups
- removed "policy fix function" and now properly check
for policy == -1 in the CPUDef -> JSON parser
- resolved some memory leaks
- added string arg to qemuMonitorJSONParseCPUModelData for
error message to print out proper command name
v1
- introduce baseline
- split patches into small chunks
- free'd lingering qemuMonitorCPUModelInfo pointer
- when converting from virCPUDef -> virJSON, consider
feature policy FORCED for enabled
___
To run these patches, execute the virsh hypervisor-cpu-compare or
hypervisor-cpu-baseline commands and pass an XML file describing one or
more CPU definition. You can use the definition from virsh domcapabilities
or from a guest XML. There is no need extract it from the file and place
it a new one, as the XML parser will look specifically for the CPU tags.
___
These patches hookup the virsh hypervisor-cpu-compare/baseline commands
for the s390x architecture. They take an XML file describing some CPU
definitions and passes the data to QEMU, where the actual CPU model
comparison / baseline calculation is handled (available since QEMU 2.8.5).
These calculations are compared against / baselined with the hypervisor
CPU model, which can be observed via the virsh domcapabilities command
for s390x.
When baselining CPU models and the user appends the --features argument
to the command, s390x will only report back features that supersede the
base model definition.
**NOTE** if the --features flag is intended to expand ALL features
available to a CPU model (such as the huge list of features reported
by a full CPU model expansion), please let me know and I can resolve
this.
The first patch pulls some code out of the CPU Model Expansion JSON
function so that it can be later used for the Comparison and Baseline
JSON functions.
The rest of the patches follow this sequence:
- introduce JSON monitor functions
- introduce capability and update test files
- hook up monitor functions to virsh command
Patch 7 pulls out some code from the CPUDef XML parser to be
reused in the comparison hookup.
Thanks.
x86 and Power review by Daniel Henrique Barboza (thanks!)
Collin Walling (8):
qemu_monitor: helper functions for CPU models
qemu_monitor: implement query-cpu-model-baseline
qemu_capabilities: introduce QEMU_CAPS_QUERY_CPU_MODEL_BASELINE
qemu_driver: hook up query-cpu-model-baseline
qemu_monitor: implement query-cpu-model-comparison
qemu_capabilities: introduce QEMU_CAPS_QUERY_CPU_MODEL_COMPARISON
cpu_conf: xml to cpu definition parse helper
qemu_driver: hook up query-cpu-model-comparison
src/conf/cpu_conf.c | 30 +++
src/conf/cpu_conf.h | 6 +
src/cpu/cpu.c | 14 +-
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 138 +++++++++++
src/qemu/qemu_capabilities.h | 20 ++
src/qemu/qemu_driver.c | 38 +++
src/qemu/qemu_monitor.c | 44 ++++
src/qemu/qemu_monitor.h | 18 ++
src/qemu/qemu_monitor_json.c | 297 ++++++++++++++++++++---
src/qemu/qemu_monitor_json.h | 20 ++
tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml | 2 +
tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml | 2 +
tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml | 2 +
tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml | 2 +
tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml | 2 +
tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml | 2 +
tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml | 2 +
18 files changed, 591 insertions(+), 49 deletions(-)
--
2.7.4
5 years, 4 months
[libvirt] [PATCH] Revert "spec: Bump minimum supported Fedora version to 29"
by Ján Tomko
This reverts commit 8a1179831b5edc0a3590489eda693914fc0ff94f.
It bumped the version prematurely, before the EOL of Fedora 28.
Morover, this arbitrary bump did not let us perform any cleanups in the
specfile.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
libvirt.spec.in | 2 +-
mingw-libvirt.spec.in | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 78b7f43934..5c0b4a7605 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -4,7 +4,7 @@
# that's still supported by the vendor. It may work on other distros
# or versions, but no effort will be made to ensure that going forward.
%define min_rhel 7
-%define min_fedora 29
+%define min_fedora 28
%if (0%{?fedora} && 0%{?fedora} >= %{min_fedora}) || (0%{?rhel} && 0%{?rhel} >= %{min_rhel})
%define supported_platform 1
diff --git a/mingw-libvirt.spec.in b/mingw-libvirt.spec.in
index 9add033669..8a96ea914c 100644
--- a/mingw-libvirt.spec.in
+++ b/mingw-libvirt.spec.in
@@ -3,7 +3,7 @@
# This spec file assumes you are building on a Fedora version
# that's still supported by the vendor. It may work on other distros
# or versions, but no effort will be made to ensure that going forward.
-%define min_fedora 29
+%define min_fedora 28
%if 0%{?fedora} && 0%{?fedora} >= %{min_fedora}
%define supported_platform 1
--
2.20.1
5 years, 4 months