[libvirt] [PATCH] qemu: domain: Drop declaration of qemuDomainDefValidateDisk
by Peter Krempa
There is no such function in our code. Commit abca72faa49 added it
spuriously.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
Pushed as trivial.
src/qemu/qemu_domain.h | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 6d3e6eb5e3..63d9fb6d21 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -888,9 +888,6 @@ bool qemuDomainVcpuHotplugIsInOrder(virDomainDefPtr def)
void qemuDomainVcpuPersistOrder(virDomainDefPtr def)
ATTRIBUTE_NONNULL(1);
-int qemuDomainDefValidateDisk(const virDomainDiskDef *disk,
- virQEMUCapsPtr qemuCaps);
-
int qemuDomainCheckMonitor(virQEMUDriverPtr driver,
virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob);
--
2.16.2
6 years, 9 months
[libvirt] [PATCH 0/4] Be consistent with vir*Obj*Remove* APIs
by John Ferlan
Using comments from recent changes/reviews w/ libxl and usage of
the virDomainObjListRemove which note that it's "a problem" that
the Remove API expects a locked @obj on input, but then returns
the @obj unlocked.
Although adjusting domainobjlist is a "future" task, we can at least
modify the other drivers/vir*obj modules to be consistent at least
with respect to expecting and returning a locked (and reffed) object.
Thus, modify interface, secret, nodedev, and storage pool. The network
is already done this way and nwfilter appears to be a lost cause as
we cannot come to a concensus over how to use hash objects and thus
the code still uses forward linked list object manipulation.
Changes for virdomainobjlist require a number of other changes to
happen first with respect to consistent usage of Find and Add API's
to return locked and ref counted objects, then being able to have
the virDomainObjListRemove be consistent as well.
John Ferlan (4):
secret: Return with locked obj from virSecretObjListRemove
interface: Return with locked obj from virInterfaceObjListRemove
nodedev: Return with locked obj from virNodeDeviceObjListRemove
storagepool: Return with locked obj from virStoragePoolObjRemove
src/conf/virinterfaceobj.c | 13 ++++++++++++-
src/conf/virnodedeviceobj.c | 13 ++++++++++++-
src/conf/virsecretobj.c | 15 ++++++++-------
src/conf/virstorageobj.c | 17 ++++++++++++++---
src/node_device/node_device_hal.c | 4 ++--
src/node_device/node_device_udev.c | 2 +-
src/secret/secret_driver.c | 4 ----
src/storage/storage_driver.c | 12 +-----------
src/test/test_driver.c | 20 +++++---------------
9 files changed, 55 insertions(+), 45 deletions(-)
--
2.13.6
6 years, 9 months
[libvirt] [PATCH] lxc: report error message raised by the failing function
by Prafull
The code that calls VIR_WARN after a function fails, doesn't
report the error message raised by the failing function.
Such error messages are now reported in lxc/lxc_driver.c
Signed-off-by: Prafullkumar T <talep158(a)gmail.com>
---
src/lxc/lxc_driver.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 4f6b93b..4f600f3 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -3915,8 +3915,8 @@ lxcDomainAttachDeviceDiskLive(virLXCDriverPtr driver,
major(sb.st_rdev),
minor(sb.st_rdev),
perms) < 0)
- VIR_WARN("cannot deny device %s for domain %s",
- src, vm->def->name);
+ VIR_WARN("cannot deny device %s for domain %s: %s",
+ src, vm->def->name, virGetLastErrorMessage());
goto cleanup;
}
@@ -4011,8 +4011,8 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn,
goto cleanup;
} else {
VIR_WARN("setting bandwidth on interfaces of "
- "type '%s' is not implemented yet",
- virDomainNetTypeToString(actualType));
+ "type '%s' is not implemented yet: %s",
+ virDomainNetTypeToString(actualType), virGetLastErrorMessage());
}
}
@@ -4116,8 +4116,8 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver,
if (virUSBDeviceFileIterate(usb,
virLXCTeardownHostUSBDeviceCgroup,
priv->cgroup) < 0)
- VIR_WARN("cannot deny device %s for domain %s",
- src, vm->def->name);
+ VIR_WARN("cannot deny device %s for domain %s: %s",
+ src, vm->def->name, virGetLastErrorMessage());
goto cleanup;
}
@@ -4190,8 +4190,8 @@ lxcDomainAttachDeviceHostdevStorageLive(virLXCDriverPtr driver,
major(sb.st_rdev),
minor(sb.st_rdev),
VIR_CGROUP_DEVICE_RWM) < 0)
- VIR_WARN("cannot deny device %s for domain %s",
- def->source.caps.u.storage.block, vm->def->name);
+ VIR_WARN("cannot deny device %s for domain %s: %s",
+ def->source.caps.u.storage.block, vm->def->name, virGetLastErrorMessage());
goto cleanup;
}
@@ -4262,8 +4262,8 @@ lxcDomainAttachDeviceHostdevMiscLive(virLXCDriverPtr driver,
major(sb.st_rdev),
minor(sb.st_rdev),
VIR_CGROUP_DEVICE_RWM) < 0)
- VIR_WARN("cannot deny device %s for domain %s",
- def->source.caps.u.storage.block, vm->def->name);
+ VIR_WARN("cannot deny device %s for domain %s: %s",
+ def->source.caps.u.storage.block, vm->def->name, virGetLastErrorMessage());
goto cleanup;
}
@@ -4434,8 +4434,8 @@ lxcDomainDetachDeviceDiskLive(virDomainObjPtr vm,
if (virCgroupDenyDevicePath(priv->cgroup, src,
VIR_CGROUP_DEVICE_RWM, false) != 0)
- VIR_WARN("cannot deny device %s for domain %s",
- src, vm->def->name);
+ VIR_WARN("cannot deny device %s for domain %s: %s",
+ src, vm->def->name, virGetLastErrorMessage());
virDomainDiskRemove(vm->def, idx);
virDomainDiskDefFree(def);
@@ -4567,8 +4567,8 @@ lxcDomainDetachDeviceHostdevUSBLive(virLXCDriverPtr driver,
if (virUSBDeviceFileIterate(usb,
virLXCTeardownHostUSBDeviceCgroup,
priv->cgroup) < 0)
- VIR_WARN("cannot deny device %s for domain %s",
- dst, vm->def->name);
+ VIR_WARN("cannot deny device %s for domain %s: %s",
+ dst, vm->def->name, virGetLastErrorMessage());
virObjectLock(hostdev_mgr->activeUSBHostdevs);
virUSBDeviceListDel(hostdev_mgr->activeUSBHostdevs, usb);
@@ -4623,8 +4623,8 @@ lxcDomainDetachDeviceHostdevStorageLive(virDomainObjPtr vm,
if (virCgroupDenyDevicePath(priv->cgroup, def->source.caps.u.storage.block,
VIR_CGROUP_DEVICE_RWM, false) != 0)
- VIR_WARN("cannot deny device %s for domain %s",
- def->source.caps.u.storage.block, vm->def->name);
+ VIR_WARN("cannot deny device %s for domain %s: %s",
+ def->source.caps.u.storage.block, vm->def->name, virGetLastErrorMessage());
virDomainHostdevRemove(vm->def, idx);
virDomainHostdevDefFree(def);
@@ -4673,8 +4673,8 @@ lxcDomainDetachDeviceHostdevMiscLive(virDomainObjPtr vm,
if (virCgroupDenyDevicePath(priv->cgroup, def->source.caps.u.misc.chardev,
VIR_CGROUP_DEVICE_RWM, false) != 0)
- VIR_WARN("cannot deny device %s for domain %s",
- def->source.caps.u.misc.chardev, vm->def->name);
+ VIR_WARN("cannot deny device %s for domain %s: %s",
+ def->source.caps.u.misc.chardev, vm->def->name, virGetLastErrorMessage());
virDomainHostdevRemove(vm->def, idx);
virDomainHostdevDefFree(def);
--
2.1.4
6 years, 9 months
[libvirt] [PATCH] remote: remove some __sun conditionals
by Daniel P. Berrangé
The libvirtd daemon has some arbitrary logic to drop privileges, but
only on Solaris platforms. This was added during Xen days, when Xen was
the only driver running in libvirtd. There's no expectation or testing
that this works with the new libxl stack, nor whether dropping
privileges breaks any of the secondary drivers. Finally, we'll be
splitting drivers out into their own independant daemons, so this won't
be applicable to libvirtd in future anyway.
The remote driver client meanwhile arbitrarily disables daemon
auto-spawn when connecting as non-root, breaking a key feature of
libvirt unprivileged connections.
Since we've not had any contributions for Solaris since circa 2012
and we don't do any CI testing we should consider this platform
unmaintained and thus reasonable to remove this cruft. If someone steps
forward to maintain Solaris again, this code would need re-evaluating to
come up with something more targetted.
There's various __sun conditionals in the Xen driver code, but those are
not touched. This is all for the legacy Xen driver, which will be
entirely removed at some point in future, so not benefit to hacking out
just the Solaris parts.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/remote/remote_daemon.c | 33 ---------------------------------
src/remote/remote_driver.c | 2 --
2 files changed, 35 deletions(-)
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index 2f9dfad443..31c6ce1b61 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -675,30 +675,6 @@ daemonVersion(const char *argv0)
printf("%s (%s) %s\n", argv0, PACKAGE_NAME, PACKAGE_VERSION);
}
-#ifdef __sun
-static int
-daemonSetupPrivs(void)
-{
- chown("/var/run/libvirt", SYSTEM_UID, SYSTEM_UID);
-
- if (__init_daemon_priv(PU_RESETGROUPS | PU_CLEARLIMITSET,
- SYSTEM_UID, SYSTEM_UID, PRIV_XVM_CONTROL, NULL)) {
- VIR_ERROR(_("additional privileges are required"));
- return -1;
- }
-
- if (priv_set(PRIV_OFF, PRIV_ALLSETS, PRIV_FILE_LINK_ANY, PRIV_PROC_INFO,
- PRIV_PROC_SESSION, PRIV_PROC_EXEC, PRIV_PROC_FORK, NULL)) {
- VIR_ERROR(_("failed to set reduced privileges"));
- return -1;
- }
-
- return 0;
-}
-#else
-# define daemonSetupPrivs() 0
-#endif
-
static void daemonShutdownHandler(virNetDaemonPtr dmn,
siginfo_t *sig ATTRIBUTE_UNUSED,
@@ -1336,15 +1312,6 @@ int main(int argc, char **argv) {
goto cleanup;
}
- /* Beyond this point, nothing should rely on using
- * getuid/geteuid() == 0, for privilege level checks.
- */
- VIR_DEBUG("Dropping privileges (if required)");
- if (daemonSetupPrivs() < 0) {
- ret = VIR_DAEMON_ERR_PRIVS;
- goto cleanup;
- }
-
daemonInitialize();
remoteProcs[REMOTE_PROC_AUTH_LIST].needAuth = false;
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index f765c09416..34e5ced0a9 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -1350,7 +1350,6 @@ remoteConnectOpen(virConnectPtr conn,
*/
if (!conn->uri) {
VIR_DEBUG("Auto-probe remote URI");
-#ifndef __sun
if (geteuid() > 0) {
VIR_DEBUG("Auto-spawn user daemon instance");
rflags |= VIR_DRV_OPEN_REMOTE_USER;
@@ -1359,7 +1358,6 @@ remoteConnectOpen(virConnectPtr conn,
STRNEQ(autostart, "0")))
rflags |= VIR_DRV_OPEN_REMOTE_AUTOSTART;
}
-#endif
}
ret = doRemoteOpen(conn, priv, auth, conf, rflags);
--
2.14.3
6 years, 9 months
[libvirt] [dbus PATCH v2] Convert testsuite from unittest to pytest
by Katerina Koukiou
Move to pytest to take advantage of:
* tests parametrization
* pdb support
* more compact tests - not forcing large test classes
Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
HACKING.md | 2 +-
test/Makefile.am | 7 ++++---
test/conftest.py | 15 +++++++++++++++
test/libvirttest.py | 49 +++++++++++++++++++++++++++++--------------------
test/test_connect.py | 33 +++++++++++++++++----------------
test/test_domain.py | 37 +++++++++++++++++++------------------
test/travis-run | 2 +-
7 files changed, 86 insertions(+), 59 deletions(-)
create mode 100644 test/conftest.py
diff --git a/HACKING.md b/HACKING.md
index 75aa6d0..bb22fd6 100644
--- a/HACKING.md
+++ b/HACKING.md
@@ -35,7 +35,7 @@ Running from git repository
make check
```
- The test tool requires python3 and python3-dbus.
+ The test tool requires python3, python3-pytest and python3-dbus.
* To run libvirt-dbus directly from the build dir without installing it
diff --git a/test/Makefile.am b/test/Makefile.am
index d3997f3..acb2d33 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,17 +1,18 @@
test_helpers = \
- libvirttest.py
+ libvirttest.py \
+ conftest.py
test_programs = \
test_connect.py \
test_domain.py
-TESTS = $(test_programs)
-
EXTRA_DIST = \
$(test_helpers) \
$(test_programs) \
travis-run
+TESTS = $(test_programs)
+
TESTS_ENVIRONMENT = \
abs_top_builddir=$(abs_top_builddir) \
VIRT_DBUS_INTERFACES_DIR=$(abs_top_srcdir)/data
diff --git a/test/conftest.py b/test/conftest.py
new file mode 100644
index 0000000..3bce7b7
--- /dev/null
+++ b/test/conftest.py
@@ -0,0 +1,15 @@
+import os
+import pytest
+import subprocess
+
+
+(a)pytest.fixture(scope="session", autouse=True)
+def dbus_daemon_session():
+ """Fixture to start D-Bus message bus session daemon for use in the whole test suite.
+ """
+ dbus_daemon = subprocess.Popen(['dbus-daemon', '--session', '--print-address'],
+ stdout=subprocess.PIPE, universal_newlines=True)
+ os.environ['DBUS_SESSION_BUS_ADDRESS'] = dbus_daemon.stdout.readline().strip()
+ yield
+ dbus_daemon.terminate()
+ dbus_daemon.wait(timeout=10)
diff --git a/test/libvirttest.py b/test/libvirttest.py
index 6a00aea..23fe536 100644
--- a/test/libvirttest.py
+++ b/test/libvirttest.py
@@ -1,34 +1,37 @@
-#!/usr/bin/python3
-
from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GLib
import dbus
import os
+import pytest
import subprocess
+import sys
import time
-import unittest
+
root = os.environ.get('abs_top_builddir', os.path.dirname(os.path.dirname(__file__)))
exe = os.path.join(root, 'src', 'libvirt-dbus')
DBusGMainLoop(set_as_default=True)
-class TestCase(unittest.TestCase):
- @classmethod
- def setUpClass(cls):
- cls.bus = subprocess.Popen(['dbus-daemon', '--session', '--print-address'],
- stdout=subprocess.PIPE, universal_newlines=True)
- os.environ['DBUS_SESSION_BUS_ADDRESS'] = cls.bus.stdout.readline().strip()
- @classmethod
- def tearDownClass(cls):
- cls.bus.terminate()
- cls.bus.wait(timeout=10)
+def run():
+ exit(pytest.main(sys.argv))
- def setUp(self):
- os.environ['LIBVIRT_DEBUG'] = '3'
- self.daemon = subprocess.Popen([exe])
+class BaseTestClass():
+ """ Base test class for whole test suite
+ """
+ connect = None
+ bus = None
+ libvirt_dbus = None
+ loop = False
+
+ @pytest.fixture(autouse=True)
+ def libvirt_dbus_setup(self, request):
+ """Start libvirt-dbus for each test function
+ """
+ os.environ['LIBVIRT_DEBUG'] = '3'
+ self.libvirt_dbus = subprocess.Popen([exe])
self.bus = dbus.SessionBus()
for i in range(10):
@@ -41,12 +44,18 @@ class TestCase(unittest.TestCase):
obj = self.bus.get_object('org.libvirt', '/org/libvirt/Test')
self.connect = dbus.Interface(obj, 'org.libvirt.Connect')
- def tearDown(self):
- self.daemon.terminate()
- self.daemon.wait(timeout=10)
+ @pytest.fixture(autouse=True)
+ def libvirt_dbus_teardown(self):
+ """Terminate libvirt-dbus at the teardown of each test
+ """
+ yield
+ self.libvirt_dbus.terminate()
+ self.libvirt_dbus.wait(timeout=10)
def main_loop(self):
- self.assertFalse(getattr(self, 'loop', False))
+ """Initializes the mainloop
+ """
+ assert getattr(self, 'loop', False) is False
def timeout():
self.loop.quit()
diff --git a/test/test_connect.py b/test/test_connect.py
index 4ec3fe0..a52140c 100755
--- a/test/test_connect.py
+++ b/test/test_connect.py
@@ -2,9 +2,10 @@
import dbus
import libvirttest
-import unittest
-minimal_xml = '''
+
+class TestConnect(libvirttest.BaseTestClass):
+ minimal_xml = '''
<domain type="test">
<name>foo</name>
<memory>1024</memory>
@@ -12,16 +13,15 @@ minimal_xml = '''
<type>hvm</type>
</os>
</domain>
-'''
+ '''
-class TestConnect(libvirttest.TestCase):
def test_list_domains(self):
domains = self.connect.ListDomains(0)
- self.assertEqual(type(domains), dbus.Array)
- self.assertEqual(len(domains), 1)
+ assert isinstance(domains, dbus.Array)
+ assert len(domains) == 1
for path in domains:
- self.assertEqual(type(path), dbus.ObjectPath)
+ assert isinstance(path, dbus.ObjectPath)
domain = self.bus.get_object('org.libvirt', path)
# ensure the path exists by calling Introspect on it
@@ -29,29 +29,30 @@ class TestConnect(libvirttest.TestCase):
def test_create(self):
def domain_started(name, path):
- self.assertEqual(name, 'foo')
- self.assertEqual(type(path), dbus.ObjectPath)
+ assert name == 'foo'
+ assert isinstance(path, dbus.ObjectPath)
self.loop.quit()
self.connect.connect_to_signal('DomainStarted', domain_started)
- path = self.connect.CreateXML(minimal_xml, 0)
- self.assertEqual(type(path), dbus.ObjectPath)
+ path = self.connect.CreateXML(self.minimal_xml, 0)
+ assert isinstance(path, dbus.ObjectPath)
self.main_loop()
def test_define(self):
def domain_defined(name, path):
- self.assertEqual(name, 'foo')
- self.assertEqual(type(path), dbus.ObjectPath)
+ assert name == 'foo'
+ assert isinstance(path, dbus.ObjectPath)
self.loop.quit()
self.connect.connect_to_signal('DomainDefined', domain_defined)
- path = self.connect.DefineXML(minimal_xml)
- self.assertEqual(type(path), dbus.ObjectPath)
+ path = self.connect.DefineXML(self.minimal_xml)
+ assert isinstance(path, dbus.ObjectPath)
self.main_loop()
+
if __name__ == '__main__':
- unittest.main(verbosity=2)
+ libvirttest.run()
diff --git a/test/test_domain.py b/test/test_domain.py
index b1ab7a5..1bf9c1b 100755
--- a/test/test_domain.py
+++ b/test/test_domain.py
@@ -2,9 +2,9 @@
import dbus
import libvirttest
-import unittest
-class TestDomain(libvirttest.TestCase):
+
+class TestDomain(libvirttest.BaseTestClass):
def domain(self):
path = self.connect.ListDomains(0)[0]
obj = self.bus.get_object('org.libvirt', path)
@@ -14,21 +14,21 @@ class TestDomain(libvirttest.TestCase):
obj, domain = self.domain()
props = obj.GetAll('org.libvirt.Domain', dbus_interface=dbus.PROPERTIES_IFACE)
- self.assertEqual(type(props['Name']), dbus.String)
- self.assertEqual(type(props['UUID']), dbus.String)
- self.assertEqual(type(props['Id']), dbus.UInt32)
- self.assertEqual(type(props['Vcpus']), dbus.UInt32)
- self.assertEqual(type(props['OSType']), dbus.String)
- self.assertEqual(type(props['Active']), dbus.Boolean)
- self.assertEqual(type(props['Persistent']), dbus.Boolean)
- self.assertEqual(type(props['State']), dbus.String)
- self.assertEqual(type(props['Autostart']), dbus.Boolean)
+ assert isinstance(props['Name'], dbus.String)
+ assert isinstance(props['UUID'], dbus.String)
+ assert isinstance(props['Id'], dbus.UInt32)
+ assert isinstance(props['Vcpus'], dbus.UInt32)
+ assert isinstance(props['OSType'], dbus.String)
+ assert isinstance(props['Active'], dbus.Boolean)
+ assert isinstance(props['Persistent'], dbus.Boolean)
+ assert isinstance(props['State'], dbus.String)
+ assert isinstance(props['Autostart'], dbus.Boolean)
# Call all methods except Reset and GetStats, because the test backend
# doesn't support those
xml = domain.GetXMLDesc(0)
- self.assertEqual(type(xml), dbus.String)
+ assert isinstance(xml, dbus.String)
domain.Reboot(0)
domain.Shutdown()
@@ -38,8 +38,8 @@ class TestDomain(libvirttest.TestCase):
def test_shutdown(self):
def domain_stopped(name, path):
- self.assertEqual(name, 'test')
- self.assertEqual(type(path), dbus.ObjectPath)
+ assert name == 'test'
+ assert isinstance(path, dbus.ObjectPath)
self.loop.quit()
self.connect.connect_to_signal('DomainStopped', domain_stopped)
@@ -48,14 +48,14 @@ class TestDomain(libvirttest.TestCase):
domain.Shutdown()
state = obj.Get('org.libvirt.Domain', 'State', dbus_interface=dbus.PROPERTIES_IFACE)
- self.assertEqual(state, 'shutoff')
+ assert state == 'shutoff'
self.main_loop()
def test_undefine(self):
def domain_undefined(name, path):
- self.assertEqual(name, 'test')
- self.assertEqual(type(path), dbus.ObjectPath)
+ assert name == 'test'
+ assert isinstance(path, dbus.ObjectPath)
self.loop.quit()
self.connect.connect_to_signal('DomainUndefined', domain_undefined)
@@ -66,5 +66,6 @@ class TestDomain(libvirttest.TestCase):
self.main_loop()
+
if __name__ == '__main__':
- unittest.main(verbosity=2)
+ libvirttest.run()
diff --git a/test/travis-run b/test/travis-run
index 7577253..80b6dec 100755
--- a/test/travis-run
+++ b/test/travis-run
@@ -22,7 +22,7 @@ sudo chroot "$CHROOT" << EOF
set -ex
# install build deps
apt-get update
-apt-get install -y dh-autoreconf pkg-config libvirt-dev libglib2.0-dev libtool python3-gi python3-dbus dbus
+apt-get install -y dh-autoreconf pkg-config libvirt-dev libglib2.0-dev libtool python3-gi python3-dbus python3-pytest dbus
# run build and tests as user
chown -R buildd:buildd /build
--
2.15.0
6 years, 9 months
[libvirt] [PATCH v2 0/2] introduce libvirt-dbus binding
by Pavel Hrdina
Pavel Hrdina (2):
docs: fix a typo in docs.html page
docs: introduce libvirt-dbus binding
docs/bindings.html.in | 13 ++++++-
docs/dbus.html.in | 102 +++++++++++++++++++++++++++++++++++++++++++++++++
docs/docs.html.in | 8 ++--
docs/downloads.html.in | 15 ++++++++
4 files changed, 134 insertions(+), 4 deletions(-)
create mode 100644 docs/dbus.html.in
--
2.14.3
6 years, 9 months
[libvirt] [PATCH RFC] storage: Remove 'cow' disk format
by Peter Krempa
There's no tests for this format and nothing seems to specifically care
about this format. QEMU does not even recognize it. Remove it completely.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
docs/schemas/storagecommon.rng | 1 -
src/util/virstoragefile.c | 31 +------------------------------
src/util/virstoragefile.h | 3 +--
3 files changed, 2 insertions(+), 33 deletions(-)
diff --git a/docs/schemas/storagecommon.rng b/docs/schemas/storagecommon.rng
index edee1b0845..310ed758ff 100644
--- a/docs/schemas/storagecommon.rng
+++ b/docs/schemas/storagecommon.rng
@@ -78,7 +78,6 @@
we know how to follow backing chains, and all others -->
<define name='storageFormatBacking'>
<choice>
- <value>cow</value>
<value>qcow</value>
<value>qcow2</value>
<value>qed</value>
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 67b9ec71ac..dd07f09d2c 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -67,7 +67,7 @@ VIR_ENUM_IMPL(virStorageFileFormat,
/* Not direct file formats, but used for various drivers */
"fat", "vhd", "ploop",
/* Formats with backing file below here */
- "cow", "qcow", "qcow2", "qed", "vmdk")
+ "qcow", "qcow2", "qed", "vmdk")
VIR_ENUM_IMPL(virStorageFileFeature,
VIR_STORAGE_FILE_FEATURE_LAST,
@@ -170,8 +170,6 @@ struct FileTypeInfo {
};
-static int cowGetBackingStore(char **, int *,
- const char *, size_t);
static int qcow1GetBackingStore(char **, int *,
const char *, size_t);
static int qcow2GetBackingStore(char **, int *,
@@ -348,11 +346,6 @@ static struct FileTypeInfo const fileTypeInfo[] = {
PLOOP_SIZE_MULTIPLIER, NULL, NULL, NULL },
/* All formats with a backing store probe below here */
- [VIR_STORAGE_FILE_COW] = {
- 0, "OOOM", NULL,
- LV_BIG_ENDIAN, 4, 4, {2},
- 4+4+1024+4, 8, 1, NULL, cowGetBackingStore, NULL
- },
[VIR_STORAGE_FILE_QCOW] = {
0, "QFI", NULL,
LV_BIG_ENDIAN, 4, 4, {1},
@@ -397,28 +390,6 @@ static const int qcow2CompatibleFeatureArray[] = {
verify(ARRAY_CARDINALITY(qcow2CompatibleFeatureArray) ==
QCOW2_COMPATIBLE_FEATURE_LAST);
-static int
-cowGetBackingStore(char **res,
- int *format,
- const char *buf,
- size_t buf_size)
-{
-#define COW_FILENAME_MAXLEN 1024
- *res = NULL;
- *format = VIR_STORAGE_FILE_AUTO;
-
- if (buf_size < 4+4+ COW_FILENAME_MAXLEN)
- return BACKING_STORE_INVALID;
- if (buf[4+4] == '\0') { /* cow_header_v2.backing_file[0] */
- *format = VIR_STORAGE_FILE_NONE;
- return BACKING_STORE_OK;
- }
-
- if (VIR_STRNDUP(*res, (const char*)buf + 4 + 4, COW_FILENAME_MAXLEN) < 0)
- return BACKING_STORE_ERROR;
- return BACKING_STORE_OK;
-}
-
static int
qcow2GetBackingStoreFormat(int *format,
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 596746ccb7..c84e013f46 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -82,8 +82,7 @@ typedef enum {
* libvirt support for following a backing chain */
VIR_STORAGE_FILE_BACKING,
- VIR_STORAGE_FILE_COW = VIR_STORAGE_FILE_BACKING,
- VIR_STORAGE_FILE_QCOW,
+ VIR_STORAGE_FILE_QCOW = VIR_STORAGE_FILE_BACKING,
VIR_STORAGE_FILE_QCOW2,
VIR_STORAGE_FILE_QED,
VIR_STORAGE_FILE_VMDK,
--
2.16.2
6 years, 9 months
[libvirt] [PATCH] docs: introduce libvirt-dbus binding
by Pavel Hrdina
libvirt-dbus is a new binding that wraps libvirt API into D-Bus calls.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
docs/bindings.html.in | 4 ++
docs/dbus.html.in | 102 +++++++++++++++++++++++++++++++++++++++++++++++++
docs/docs.html.in | 1 +
docs/downloads.html.in | 15 ++++++++
4 files changed, 122 insertions(+)
create mode 100644 docs/dbus.html.in
diff --git a/docs/bindings.html.in b/docs/bindings.html.in
index 733c89bc20..236bdcf2ae 100644
--- a/docs/bindings.html.in
+++ b/docs/bindings.html.in
@@ -18,6 +18,10 @@
<strong>Go</strong>: Daniel Berrange develops
<a href="https://godoc.org/github.com/libvirt/libvirt-go">Go bindings</a>.
</li>
+ <li>
+ <strong>D-Bus</strong>: Pavel Hrdina develops
+ <a href="dbus.html">D-Bus bindings</a>.
+ </li>
<li>
<strong>Java</strong>: Daniel Veillard develops
<a href="java.html">Java bindings</a>.
diff --git a/docs/dbus.html.in b/docs/dbus.html.in
new file mode 100644
index 0000000000..0da8096122
--- /dev/null
+++ b/docs/dbus.html.in
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <body>
+ <h1>D-Bus API bindings</h1>
+
+ <ul id="toc"></ul>
+
+ <h2><a name="description">Description</a></h2>
+
+ <p>
+ libvirt-dbus wraps libvirt API to provide a high-level object-oriented
+ API better suited for dbus-based applications.
+ </p>
+
+ <h2><a name="git">GIT source repository</a></h2>
+ <p>
+ The D-Bus bindings source code is maintained in a
+ <a href="https://git-scm.com/">git</a> repository available on
+ <a href="https://libvirt.org/git/">libvirt.org</a>:
+ </p>
+
+<pre>
+git clone https://libvirt.org/git/libvirt-dbus.git
+</pre>
+
+ <p>
+ They can also be browsed online:
+ </p>
+
+<pre>
+<a href="https://libvirt.org/git/?p=libvirt-dbus.git">https://libvirt.org/git/?p=libvirt-dbus.git</a>
+</pre>
+
+ <h2><a name="usage">Usage</a></h2>
+
+ <p>
+ libvirt-dbus exports libvirt API using D-Bus objects with methods and
+ properties described by interfaces. Currently only local connection
+ to libvirt is exported and the list of supported drivers depends
+ on the type of the bus connection (session or system).
+ </p>
+
+ <p>
+ The name of the libvirt-dbus service is <code>org.libvirt</code>.
+ libvirt-dbus distributes an interface XML descriptions which can be
+ usually found at <code>/usr/share/dbus-1/interfaces/</code>.
+ </p>
+
+ <p>
+ By default unprivileged user has access only to the session D-Bus
+ connection. In order to allow specific user "foo" to access the system
+ D-Bus connection you need to create a file
+ <code>/etc/dbus-1/system.d/org.libvirt.conf</code> that contains:
+ </p>
+
+<pre>
+<?xml version="1.0"?>
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+
+<busconfig>
+
+ <policy user="foo">
+ <allow send_destination="org.libvirt"/>
+ </policy>
+
+</busconfig>
+</pre>
+
+ <p>
+ To get a list of supported drivers for the specific bus connection
+ you can run these commands (not all drivers may be available on
+ the host):
+ </p>
+
+<pre>
+gdbus introspect --xml --session --dest org.libvirt --object-path /org/libvirt
+gdbus introspect --xml --system --dest org.libvirt --object-path /org/libvirt
+</pre>
+
+ <p>
+ Every object is introspectable so you can get a list of available
+ interfaces with methods, signals and properties running this command:
+ </p>
+
+<pre>
+gdbus introspect --xml --system --dest org.libvirt --object-path /org/libvirt/QEMU
+</pre>
+
+ <p>
+ To get a list of domains for specific connection driver you can run
+ this command:
+ </p>
+
+<pre>
+gdbus call --system --dest org.libvirt --object-path /org/libvirt/QEMU \
+ --method org.libvirt.Connect.ListDomains 0
+</pre>
+
+ </body>
+</html>
diff --git a/docs/docs.html.in b/docs/docs.html.in
index a8d544f83f..abd344ca2e 100644
--- a/docs/docs.html.in
+++ b/docs/docs.html.in
@@ -57,6 +57,7 @@
<dt><a href="bindings.html">Language bindings</a></dt>
<dd>Bindings of the libvirt API for
<a href="csharp.html">c#</a>,
+ <a href="dbus.html">D-Bus</a>,
<a href="https://godoc.org/github.com/libvirt/libvirt-go">go</a>,
<a href="java.html">java</a>,
<a href="https://libvirt.org/ocaml/">ocaml</a>.
diff --git a/docs/downloads.html.in b/docs/downloads.html.in
index 7c28e2ba9b..c2bc7af3e9 100644
--- a/docs/downloads.html.in
+++ b/docs/downloads.html.in
@@ -60,6 +60,21 @@
</td>
<td></td>
</tr>
+ <tr>
+ <td>D-Bus</td>
+ <td>
+ <a href="ftp://libvirt.org/libvirt/dbus/">ftp</a>
+ <a href="https://libvirt.org/sources/dbus/">https</a>
+ </td>
+ <td>
+ <a href="https://libvirt.org/git/?p=libvirt-dbus.git;a=summary">libvirt</a>
+ </td>
+ <td>
+ <a href="https://gitlab.com/libvirt/libvirt-dbus">gitlab</a>
+ <a href="https://github.com/libvirt/libvirt-dbus">github</a>
+ </td>
+ <td></td>
+ </tr>
<tr>
<td>Go</td>
<td>
--
2.14.3
6 years, 9 months
[libvirt] ANNOUNCE: libvirt-dbus 0.0.1 released
by Pavel Hrdina
I'm happy to announce the release of libvirt-dbus 0.0.1.
libvirt-dbus wraps libvirt API to provide high-level object-oriented
API better suited for dbus-based applications.
This is a first release which should be considered as unstable
release since we don't promise API stability.
You can download it here:
https://libvirt.org/sources/dbus/libvirt-dbus-0.0.1.tar.gz
This release contains a limited support of libvirt APIs as proof of
concept, but we are planning to cover all relevant APIs.
Thanks everybody who contributed!
Pavel
6 years, 9 months