[libvirt] [BUG] storage_backend_fs: failung virStorageBackendProbeTarget() disabled whole pool
by Philipp Hahn
Hello,
I have a problem with the following code fragment, which refreshes a directory
based storage pool:
storage_backend_fs.c#virStorageBackendFileSystemRefresh(...)
...
while ((ent = readdir(dir)) != NULL) {
...
if ((ret = virStorageBackendProbeTarget(...) < 0) {
if (ret == -1)
goto cleanup;
...
}
...
}
closedir(dir);
...
return 0;
cleanup:
...
return -1;
}
This disables the whole pool, if it contains an Qcow2 volume while, whose
backfile is (currently) unavailable (because, for example, the central NFS
store is currently unavailable or the permissions don't allow reading). This
is very annoying, since it's hard to find the Qcow2 volume, which breaks the
pool. I use the following command to find broken volumes:
find "$dir" -maxdepth 1 \( -type f -o -type l \) \( -exec kvm-img info {}
\; -o -print \) 2>/dev/null
Even worse, you can't delete the broken or re-create the missing volume with
virsh allone.
To reproduce:
dir=$(mktemp -d)
virsh pool-create-as tmp dir '' '' '' '' "$dir"
virsh vol-create-as --format qcow2 tmp back 1G
virsh vol-create-as --format qcow2 --backing-vol-format qcow2 --backing-vol
back tmp cow 1G
virsh vol-delete --pool tmp back
virsh pool-refresh tmp
After the last step, the pool will be gone (because it was not persistent). As
long as the now broken image stays in the directory, you will not be able to
re-create or re-start the pool.
The easiest 'fix' would be to ignore all errors regarding the detection of the
backing files file format. This would at least allow users to still create
new volumes and list existing volumes.
I appreciate any comments.
BYtE
Philipp
--
Philipp Hahn Open Source Software Engineer hahn(a)univention.de
Univention GmbH Linux for Your Business fon: +49 421 22 232- 0
Mary-Somerville-Str.1 28359 Bremen fax: +49 421 22 232-99
http://www.univention.de/
** Besuchen Sie uns auf der CeBIT in Hannover **
** Auf dem Univention Stand D36 in Halle 2 **
** Vom 01. bis 05. März 2011 **
13 years, 10 months
[libvirt] [PATCH] Check return value of qemuMonitorDriveDel.
by Hu Tao
If we don't check it, virsh users will get "Disk detached successfully"
even when qemuMonitorDriveDel fails.
---
src/qemu/qemu_hotplug.c | 10 ++++++++--
src/qemu/qemu_monitor_json.c | 2 +-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index fb9db5a..70e9d8e 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1187,7 +1187,10 @@ int qemuDomainDetachPciDiskDevice(struct qemud_driver *driver,
}
/* disconnect guest from host device */
- qemuMonitorDriveDel(priv->mon, drivestr);
+ if (qemuMonitorDriveDel(priv->mon, drivestr) != 0) {
+ qemuDomainObjExitMonitor(vm);
+ goto cleanup;
+ }
qemuDomainObjExitMonitorWithDriver(driver, vm);
@@ -1269,7 +1272,10 @@ int qemuDomainDetachSCSIDiskDevice(struct qemud_driver *driver,
}
/* disconnect guest from host device */
- qemuMonitorDriveDel(priv->mon, drivestr);
+ if (qemuMonitorDriveDel(priv->mon, drivestr) != 0) {
+ qemuDomainObjExitMonitor(vm);
+ goto cleanup;
+ }
qemuDomainObjExitMonitorWithDriver(driver, vm);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index d5e8d37..b088405 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2338,7 +2338,7 @@ int qemuMonitorJSONDriveDel(qemuMonitorPtr mon,
if (ret == 0) {
/* See if drive_del isn't supported */
if (qemuMonitorJSONHasError(reply, "CommandNotFound")) {
- VIR_ERROR0(_("deleting disk is not supported. "
+ qemuReportError(VIR_ERR_NO_SUPPORT, _("deleting disk is not supported. "
"This may leak data if disk is reassigned"));
ret = 1;
goto cleanup;
--
1.7.3.1
13 years, 10 months
[libvirt] [PATCH v3] storage: Allow to delete device mapper disk partition
by Osier Yang
The name convention of device mapper disk is different, and 'parted'
can't be used to delete a device mapper disk partition. e.g.
Name Path
-----------------------------------------
3600a0b80005ad1d7000093604cae912fp1 /dev/mapper/3600a0b80005ad1d7000093604cae912fp1
Error: Expecting a partition number.
This patch introduces 'dmsetup' to fix it.
Changes:
- New function "virIsDevMapperDevice" in "src/utils/utils.c"
- remove "is_dm_device" in "src/storage/parthelper.c", use
"virIsDevMapperDevice" instead.
- Requires "device-mapper" for 'with-storage-disk" in "libvirt.spec.in"
- Check "dmsetup" in 'configure.ac' for "with-storage-disk"
- Changes on "src/Makefile.am" to link against libdevmapper
- New entry for "virIsDevMapperDevice" in "src/libvirt_private.syms"
Changes from v1 to v3:
- s/virIsDeviceMapperDevice/virIsDevMapperDevice/g
- replace "virRun" with "virCommand"
- sort the list of util functions in "libvirt_private.syms"
- ATTRIBUTE_NONNULL(1) for virIsDevMapperDevice declaration.
e.g.
Name Path
-----------------------------------------
3600a0b80005ad1d7000093604cae912fp1 /dev/mapper/3600a0b80005ad1d7000093604cae912fp1
Vol /dev/mapper/3600a0b80005ad1d7000093604cae912fp1 deleted
Name Path
-----------------------------------------
---
configure.ac | 28 +++++++++++++++------
libvirt.spec.in | 1 +
src/Makefile.am | 8 +++---
src/libvirt_private.syms | 2 +-
src/storage/parthelper.c | 14 +---------
src/storage/storage_backend_disk.c | 48 +++++++++++++++++++++--------------
src/util/util.c | 15 +++++++++++
src/util/util.h | 2 +
8 files changed, 73 insertions(+), 45 deletions(-)
diff --git a/configure.ac b/configure.ac
index 3cd824a..44a3b19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1725,12 +1725,19 @@ LIBPARTED_LIBS=
if test "$with_storage_disk" = "yes" ||
test "$with_storage_disk" = "check"; then
AC_PATH_PROG([PARTED], [parted], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([DMSETUP], [dmsetup], [], [$PATH:/sbin:/usr/sbin])
if test -z "$PARTED" ; then
PARTED_FOUND=no
else
PARTED_FOUND=yes
fi
+ if test -z "$DMSETUP" ; then
+ DMSETUP_FOUND=no
+ else
+ DMSETUP_FOUND=yes
+ fi
+
if test "$PARTED_FOUND" = "yes" && test "x$PKG_CONFIG" != "x" ; then
PKG_CHECK_MODULES([LIBPARTED], [libparted >= $PARTED_REQUIRED], [],
[PARTED_FOUND=no])
@@ -1748,14 +1755,17 @@ if test "$with_storage_disk" = "yes" ||
CFLAGS="$save_CFLAGS"
fi
- if test "$PARTED_FOUND" = "no" ; then
- if test "$with_storage_disk" = "yes" ; then
- AC_MSG_ERROR([We need parted for disk storage driver])
- else
- with_storage_disk=no
- fi
- else
- with_storage_disk=yes
+ if test "$with_storage_disk" = "yes" &&
+ test "$PARTED_FOUND:$DMSETUP_FOUND" != "yes:yes"; then
+ AC_MSG_ERROR([Need both parted and dmsetup for disk storage driver])
+ fi
+
+ if test "$with_storage_disk" = "check"; then
+ if test "$PARTED_FOUND:$DMSETUP_FOUND" != "yes:yes"; then
+ with_storage_disk=no
+ else
+ with_storage_disk=yes
+ fi
fi
if test "$with_storage_disk" = "yes"; then
@@ -1763,6 +1773,8 @@ if test "$with_storage_disk" = "yes" ||
[whether Disk backend for storage driver is enabled])
AC_DEFINE_UNQUOTED([PARTED],["$PARTED"],
[Location or name of the parted program])
+ AC_DEFINE_UNQUOTED([DMSETUP],["$DMSETUP"],
+ [Location or name of the dmsetup program])
fi
fi
AM_CONDITIONAL([WITH_STORAGE_DISK], [test "$with_storage_disk" = "yes"])
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 5021f45..8cb8fad 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -279,6 +279,7 @@ Requires: iscsi-initiator-utils
%if %{with_storage_disk}
# For disk driver
Requires: parted
+Requires: device-mapper
%endif
%if %{with_storage_mpath}
# For multipath support
diff --git a/src/Makefile.am b/src/Makefile.am
index 2f94efd..6e14043 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -437,9 +437,9 @@ libvirt_la_BUILT_LIBADD = libvirt_util.la
libvirt_util_la_SOURCES = \
$(UTIL_SOURCES)
libvirt_util_la_CFLAGS = $(CAPNG_CFLAGS) $(YAJL_CFLAGS) $(LIBNL_CFLAGS) \
- $(AM_CFLAGS) $(AUDIT_CFLAGS)
+ $(AM_CFLAGS) $(AUDIT_CFLAGS) $(DEVMAPPER_CFLAGS)
libvirt_util_la_LIBADD = $(CAPNG_LIBS) $(YAJL_LIBS) $(LIBNL_LIBS) \
- $(LIB_PTHREAD) $(AUDIT_LIBS)
+ $(LIB_PTHREAD) $(AUDIT_LIBS) $(DEVMAPPER_LIBS)
noinst_LTLIBRARIES += libvirt_conf.la
@@ -1154,7 +1154,6 @@ libvirt_parthelper_SOURCES = $(STORAGE_HELPER_DISK_SOURCES)
libvirt_parthelper_LDFLAGS = $(WARN_LDFLAGS) $(AM_LDFLAGS)
libvirt_parthelper_LDADD = \
$(LIBPARTED_LIBS) \
- $(DEVMAPPER_LIBS) \
libvirt_util.la \
../gnulib/lib/libgnu.la
@@ -1179,7 +1178,8 @@ libvirt_lxc_SOURCES = \
libvirt_lxc_LDFLAGS = $(WARN_CFLAGS) $(AM_LDFLAGS)
libvirt_lxc_LDADD = $(CAPNG_LIBS) $(YAJL_LIBS) \
$(LIBXML_LIBS) $(NUMACTL_LIBS) $(LIB_PTHREAD) \
- $(LIBNL_LIBS) $(AUDIT_LIBS) ../gnulib/lib/libgnu.la
+ $(LIBNL_LIBS) $(AUDIT_LIBS) $(DEVMAPPER_LIBS) \
+ ../gnulib/lib/libgnu.la
libvirt_lxc_CFLAGS = \
$(LIBPARTED_CFLAGS) \
$(NUMACTL_CFLAGS) \
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index b9e3efe..1ab3da3 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -884,6 +884,7 @@ virGetUserID;
virGetUserName;
virHexToBin;
virIndexToDiskName;
+virIsDevMapperDevice;
virKillProcess;
virMacAddrCompare;
virParseMacAddr;
@@ -910,7 +911,6 @@ virStrncpy;
virTimestamp;
virVasprintf;
-
# uuid.h
virGetHostUUID;
virSetHostUUIDStr;
diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c
index 6ef413d..acc9171 100644
--- a/src/storage/parthelper.c
+++ b/src/storage/parthelper.c
@@ -59,18 +59,6 @@ enum diskCommand {
DISK_GEOMETRY
};
-static int
-is_dm_device(const char *devname)
-{
- struct stat buf;
-
- if (devname && !stat(devname, &buf) && dm_is_dm_major(major(buf.st_rdev))) {
- return 1;
- }
-
- return 0;
-}
-
int main(int argc, char **argv)
{
PedDevice *dev;
@@ -96,7 +84,7 @@ int main(int argc, char **argv)
}
path = argv[1];
- if (is_dm_device(path)) {
+ if (virIsDevMapperDevice(path)) {
partsep = "p";
canonical_path = strdup(path);
if (canonical_path == NULL) {
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index c7ade6b..70e3ba6 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -31,6 +31,7 @@
#include "storage_backend_disk.h"
#include "util.h"
#include "memory.h"
+#include "command.h"
#include "configmake.h"
#define VIR_FROM_THIS VIR_FROM_STORAGE
@@ -647,6 +648,8 @@ virStorageBackendDiskDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
char *part_num = NULL;
char *devpath = NULL;
char *devname, *srcname;
+ virCommandPtr cmd = NULL;
+ bool isDevMapperDevice;
int rc = -1;
if (virFileResolveLink(vol->target.path, &devpath) < 0) {
@@ -660,36 +663,43 @@ virStorageBackendDiskDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
srcname = basename(pool->def->source.devices[0].path);
DEBUG("devname=%s, srcname=%s", devname, srcname);
- if (!STRPREFIX(devname, srcname)) {
+ isDevMapperDevice = virIsDevMapperDevice(devpath);
+
+ if (!isDevMapperDevice && !STRPREFIX(devname, srcname)) {
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
_("Volume path '%s' did not start with parent "
"pool source device name."), devname);
goto cleanup;
}
- part_num = devname + strlen(srcname);
+ if (!isDevMapperDevice) {
+ part_num = devname + strlen(srcname);
- if (*part_num == 0) {
- virStorageReportError(VIR_ERR_INTERNAL_ERROR,
- _("cannot parse partition number from target "
- "'%s'"), devname);
- goto cleanup;
- }
+ if (*part_num == 0) {
+ virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse partition number from target "
+ "'%s'"), devname);
+ goto cleanup;
+ }
- /* eg parted /dev/sda rm 2 */
- const char *prog[] = {
- PARTED,
- pool->def->source.devices[0].path,
- "rm",
- "--script",
- part_num,
- NULL,
- };
+ cmd = virCommandNewArgList(PARTED,
+ pool->def->source.devices[0].path,
+ "rm",
+ "--script",
+ part_num,
+ NULL);
- if (virRun(prog, NULL) < 0)
- goto cleanup;
+ if (virCommandRun(cmd, NULL) < 0)
+ goto cleanup;
+ } else {
+ cmd = virCommandNewArgList(DMSETUP, "remove", "--force", devpath, NULL);
+
+ if (virCommandRun(cmd, NULL) < 0)
+ goto cleanup;
+ }
rc = 0;
cleanup:
VIR_FREE(devpath);
+ virCommandFree(cmd);
return rc;
diff --git a/src/util/util.c b/src/util/util.c
index 6161be6..1ec61b8 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -45,6 +45,7 @@
#include <string.h>
#include <signal.h>
#include <termios.h>
+#include <libdevmapper.h>
#include "c-ctype.h"
#ifdef HAVE_PATHS_H
@@ -3123,3 +3124,17 @@ virTimestamp(void)
return timestamp;
}
+
+bool
+virIsDevMapperDevice(const char *devname)
+{
+ struct stat buf;
+
+ if (!stat(devname, &buf) &&
+ S_ISBLK(buf.st_mode) &&
+ dm_is_dm_major(major(buf.st_rdev)))
+ return true;
+
+ return false;
+}
+
diff --git a/src/util/util.h b/src/util/util.h
index 8373038..10d3253 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -296,4 +296,6 @@ int virBuildPathInternal(char **path, ...) ATTRIBUTE_SENTINEL;
char *virTimestamp(void);
+bool virIsDevMapperDevice(const char *devname) ATTRIBUTE_NONNULL(1);
+
#endif /* __VIR_UTIL_H__ */
--
1.7.4
13 years, 10 months
[libvirt] [PATCH] [libvirt-tck] Fix expected error code
by Jim Fehlig
Attempting to set a transient domain autostart results in
ERR_OPERATION_INVALID not ERR_INTERNAL_ERROR.
---
scripts/domain/051-transient-autostart.t | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/domain/051-transient-autostart.t b/scripts/domain/051-transient-autostart.t
index 3e5ea61..26ca82b 100644
--- a/scripts/domain/051-transient-autostart.t
+++ b/scripts/domain/051-transient-autostart.t
@@ -48,7 +48,7 @@ my $auto = $dom->get_autostart();
ok(!$auto, "autostart is disabled for transient VMs");
-ok_error(sub { $dom->set_autostart(1) }, "Set autostart not supported on transient VMs", Sys::Virt::Error::ERR_INTERNAL_ERROR);
+ok_error(sub { $dom->set_autostart(1) }, "Set autostart not supported on transient VMs", Sys::Virt::Error::ERR_OPERATION_INVALID);
diag "Destroying the transient domain";
$dom->destroy;
--
1.7.3.1
13 years, 10 months
[libvirt] [PATCH] qemu: Error prompt when saving a shutoff domain
by Osier Yang
* src/qemu/qemu_driver.c
---
src/qemu/qemu_driver.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c581cfe..8570e67 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4647,6 +4647,12 @@ static int qemudDomainSave(virDomainPtr dom, const char *path)
goto cleanup;
}
+ if (!virDomainObjIsActive(vm)) {
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is not running"));
+ goto cleanup;
+ }
+
ret = qemudDomainSaveFlag(driver, dom, vm, path, compressed);
cleanup:
--
1.7.4
13 years, 10 months
[libvirt] [PATCH 1/2] build-sys: fix build when daemon is disabled by not installing libvirtd.8
by Diego Elio Pettenò
Since the rule to build libvirtd.8 is within the WITH_LIBVIRTD conditional,
so declare the man page in there as well. Without this change, build
without daemon will fail.
---
.gnulib | 2 +-
daemon/Makefile.am | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/.gnulib b/.gnulib
index 1629006..11fbc57 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 1629006348e1f66f07ce3ddcf3ebd2d14556cfce
+Subproject commit 11fbc57405a118e6ec9a3ebc19bbf5ececdae4d6
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 963d64f..dbf0ac3 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -41,12 +41,12 @@ EXTRA_DIST = \
$(AVAHI_SOURCES) \
$(DAEMON_SOURCES)
-man_MANS = libvirtd.8
-
BUILT_SOURCES =
if WITH_LIBVIRTD
+man_MANS = libvirtd.8
+
sbin_PROGRAMS = libvirtd
confdir = $(sysconfdir)/libvirt/
--
1.7.2
13 years, 10 months
[libvirt] [PATCH] maint: delete unused 'make install' step
by Eric Blake
Libxml2-Logo-90x34.gif was removed from the repository in Sep 2009
(commit d6d528c) because our docs no longer reference it.
* docs/Makefile.am (install-data-local): Don't install missing file.
---
Pushing this under the trivial rule.
docs/Makefile.am | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 473bbbf..d0fe918 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -187,7 +187,6 @@ install-data-local:
$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)
for f in $(css) $(dot_html) $(gif) $(png); do \
$(INSTALL) -m 0644 $(srcdir)/$$f $(DESTDIR)$(HTML_DIR); done
- -$(INSTALL) -m 0644 $(srcdir)/Libxml2-Logo-90x34.gif $(DESTDIR)$(HTML_DIR)
$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/html
for h in $(apihtml); do \
$(INSTALL) -m 0644 $(srcdir)/$$h $(DESTDIR)$(HTML_DIR)/html; done
--
1.7.4
13 years, 10 months
[libvirt] [libvirt-php] Merge rpm spec files
by Lyre
Merge php-libvirt.spec & libvirt-php.obs.spec to libvirt-php.spec,
which will pack libvirt-php into two packages:
libvirt-php: the extension itself with the configuration file.
libvirt-php-doc: document package for libvirt-php
This spec file should works for Fedora 14, RHEL 6, openSuSE 11.3
and SLES 11 SP1.
* renamed: libvirt-php.obs.spec -> libvirt-php.spec
* deleted: php-libvirt.spec
* libvirt-php.spec: Added %dir for libvirt-php-doc to satisfy SLES.
* Makefile.am: changed the spec file name for distting.
---
Makefile.am | 2 +-
libvirt-php.obs.spec | 81 -------------------------------------------------
libvirt-php.spec | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++
php-libvirt.spec | 43 --------------------------
4 files changed, 83 insertions(+), 125 deletions(-)
delete mode 100644 libvirt-php.obs.spec
create mode 100644 libvirt-php.spec
delete mode 100644 php-libvirt.spec
diff --git a/Makefile.am b/Makefile.am
index eac6726..aa19b88 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,3 @@
SUBDIRS = src docs
-EXTRA_DIST = libvirt-php.obs.spec
+EXTRA_DIST = libvirt-php.spec
diff --git a/libvirt-php.obs.spec b/libvirt-php.obs.spec
deleted file mode 100644
index da59676..0000000
--- a/libvirt-php.obs.spec
+++ /dev/null
@@ -1,81 +0,0 @@
-%define req_libvirt_version 0.6.2
-
-%if 0%{?suse_version} || 0%{?sles_version}
-%define php_confdir %{_sysconfdir}/php5/conf.d
-%define php_extdir %{_libdir}/php5/extensions
-%else
-%define php_confdir %{_sysconfdir}/php.d
-%define php_extdir %{_libdir}/php/modules
-%endif
-
-Name: libvirt-php
-Version: 0.4
-Release: 1%{?dist}%{?extra_release}
-Summary: PHP language binding for Libvirt
-
-%if 0%{?suse_version} || 0%{?sles_version}
-Group: Development/Libraries/PHP
-%else
-Group: Development/Libraries
-%endif
-License: PHP
-URL: http://libvirt.org/
-Source0: http://libvirt.org/sources/libvirt-php-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
-
-BuildRequires: php-devel
-BuildRequires: libvirt-devel >= %{req_libvirt_version}
-BuildRequires: libxml2-devel
-%if 0%{?suse_version} || 0%{?sles_version}
-BuildRequires: xhtml-dtd
-%else
-BuildRequires: xhtml1-dtds
-%endif
-Requires: libvirt >= %{req_libvirt_version}
-%if 0%{?suse_version} || 0%{?sles_version}
-Requires: php5
-%else
-Requires: php
-%endif
-
-%description
-PHP language bindings for Libvirt API.
-For more details see: http://phplibvirt.cybersales.cz/ http://www.libvirt.org/ http://www.php.net/
-
-%package -n libvirt-php-doc
-Summary: Document of libvirt-php
-Group: Development/Libraries/PHP
-Requires: libvirt-php = %{version}
-
-%description -n libvirt-php-doc
-PHP language bindings for Libvirt API.
-For more details see: http://phplibvirt.cybersales.cz/ http://www.libvirt.org/ http://www.php.net/
-
-This package contain the document for libvirt-php.
-
-%prep
-%setup -q -n libvirt-php-%{version}
-
-%build
-%configure
-./configure --with-html-dir=%{_datadir}/doc --with-html-subdir=%{name}-%{version}/html
-make %{?_smp_mflags}
-
-%install
-make install DESTDIR=%{buildroot}
-
-%clean
-rm -rf %{buildroot}
-
-%files
-%defattr(-,root,root,-)
-%{php_extdir}/libvirt-php.so
-%config(noreplace) %{php_confdir}/libvirt-php.ini
-
-%files -n libvirt-php-doc
-%defattr(-,root,root,-)
-%doc
-%{_datadir}/doc/%{name}-%{version}/html
-
-%changelog
-
diff --git a/libvirt-php.spec b/libvirt-php.spec
new file mode 100644
index 0000000..5ac61b0
--- /dev/null
+++ b/libvirt-php.spec
@@ -0,0 +1,82 @@
+%define req_libvirt_version 0.6.2
+
+%if 0%{?suse_version} || 0%{?sles_version}
+%define php_confdir %{_sysconfdir}/php5/conf.d
+%define php_extdir %{_libdir}/php5/extensions
+%else
+%define php_confdir %{_sysconfdir}/php.d
+%define php_extdir %{_libdir}/php/modules
+%endif
+
+Name: libvirt-php
+Version: 0.4
+Release: 1%{?dist}%{?extra_release}
+Summary: PHP language binding for Libvirt
+
+%if 0%{?suse_version} || 0%{?sles_version}
+Group: Development/Libraries/PHP
+%else
+Group: Development/Libraries
+%endif
+License: PHP
+URL: http://libvirt.org/
+Source0: http://libvirt.org/sources/libvirt-php-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
+BuildRequires: php-devel
+BuildRequires: libvirt-devel >= %{req_libvirt_version}
+BuildRequires: libxml2-devel
+%if 0%{?suse_version} || 0%{?sles_version}
+BuildRequires: xhtml-dtd
+%else
+BuildRequires: xhtml1-dtds
+%endif
+Requires: libvirt >= %{req_libvirt_version}
+%if 0%{?suse_version} || 0%{?sles_version}
+Requires: php5
+%else
+Requires: php
+%endif
+
+%description
+PHP language bindings for Libvirt API.
+For more details see: http://phplibvirt.cybersales.cz/ http://www.libvirt.org/ http://www.php.net/
+
+%package -n libvirt-php-doc
+Summary: Document of libvirt-php
+Group: Development/Libraries/PHP
+Requires: libvirt-php = %{version}
+
+%description -n libvirt-php-doc
+PHP language bindings for Libvirt API.
+For more details see: http://phplibvirt.cybersales.cz/ http://www.libvirt.org/ http://www.php.net/
+
+This package contain the document for libvirt-php.
+
+%prep
+%setup -q -n libvirt-php-%{version}
+
+%build
+%configure
+./configure --with-html-dir=%{_datadir}/doc --with-html-subdir=%{name}-%{version}/html
+make %{?_smp_mflags}
+
+%install
+make install DESTDIR=%{buildroot}
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+%{php_extdir}/libvirt-php.so
+%config(noreplace) %{php_confdir}/libvirt-php.ini
+
+%files -n libvirt-php-doc
+%defattr(-,root,root,-)
+%doc
+%dir %{_datadir}/doc/%{name}-%{version}
+%{_datadir}/doc/%{name}-%{version}/html
+
+%changelog
+
diff --git a/php-libvirt.spec b/php-libvirt.spec
deleted file mode 100644
index b7bc92d..0000000
--- a/php-libvirt.spec
+++ /dev/null
@@ -1,43 +0,0 @@
-Name: php-libvirt
-Version: 0.4
-Release: 1%{?dist}%{?extra_release}
-Summary: PHP language binding for Libvirt
-Group: Development/Libraries
-License: PHP
-URL: http://libvirt.org/
-Source0: http://libvirt.org/sources/libvirt-php-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
-BuildRequires: php-devel
-BuildRequires: libvirt-devel
-BuildRequires: libxml2-devel
-Requires: libvirt
-Requires: php(zend-abi) = %{php_zend_api}
-Requires: php(api) = %{php_core_api}
-
-
-%description
-PHP language bindings for Libvirt API.
-For more details see: http://phplibvirt.cybersales.cz/ http://www.libvirt.org/ http://www.php.net/
-
-%prep
-%setup -q -n libvirt-php-%{version}
-
-%build
-%configure --with-html-dir=%{_datadir}/doc --with-html-subdir=%{name}-%{version}/html
-make %{?_smp_mflags}
-
-%install
-rm -rf %{buildroot}
-make install DESTDIR=%{buildroot}
-
-%clean
-rm -rf %{buildroot}
-
-%files
-%defattr(-,root,root,-)
-%{_libdir}/php/modules/libvirt-php.so
-%{_sysconfdir}/php.d/libvirt-php.ini
-%doc %{_datadir}/doc/%{name}-%{version}/html
-
-%changelog
--
1.7.1
13 years, 10 months
[libvirt] [PATCH SNMP] Add automated build control script
by Daniel P. Berrange
* .gitignore: Ignore build directory
* autobuild.sh: Add automated build script
* autogen.sh: Helper for re-generating autotools files
* libvirt-snmp.spec.in: Add extra_release and remove
substitution of mibdir since RPM path shouldn't change
regardless of current configure args
---
.gitignore | 1 +
autobuild.sh | 42 ++++++++++++++++++++++++++++++++++++++++++
autogen.sh | 24 ++++++++++++++++++++++++
libvirt-snmp.spec.in | 6 +++---
4 files changed, 70 insertions(+), 3 deletions(-)
create mode 100755 autobuild.sh
create mode 100755 autogen.sh
diff --git a/.gitignore b/.gitignore
index 98613d5..ed2e9f7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@
*.orig
*.rej
*~
+/build
/.git-module-status
Makefile
Makefile.in
diff --git a/autobuild.sh b/autobuild.sh
new file mode 100755
index 0000000..5eecb39
--- /dev/null
+++ b/autobuild.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+set -e
+set -v
+
+test -n "$1" && RESULTS=$1 || RESULTS=results.log
+: ${AUTOBUILD_INSTALL_ROOT=$HOME/builder}
+
+# Make things clean.
+test -f Makefile && make -k distclean || :
+
+rm -rf build
+mkdir build
+cd build
+
+MIBDIR=$AUTOBUILD_INSTALL_ROOT/share/snmp/mibs
+mkdir -p $MIBDIR
+
+../autogen.sh --prefix=$AUTOBUILD_INSTALL_ROOT \
+ --with-mibdir=$MIBDIR
+
+make
+make install
+
+make check | tee "$RESULTS"
+
+rm -f *.tar.gz
+make dist
+
+if [ -n "$AUTOBUILD_COUNTER" ]; then
+ EXTRA_RELEASE=".auto$AUTOBUILD_COUNTER"
+else
+ NOW=`date +"%s"`
+ EXTRA_RELEASE=".$USER$NOW"
+fi
+
+if [ -f /usr/bin/rpmbuild ]; then
+ rpmbuild --nodeps \
+ --define "extra_release $EXTRA_RELEASE" \
+ --define "_sourcedir `pwd`" \
+ -ba --clean libvirt-snmp.spec
+fi
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..917e923
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+set -e
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+THEDIR=`pwd`
+cd $srcdir
+
+if test -z "$*"; then
+ echo "I am going to run ./configure with not arguments - if you "
+ echo "wish to pass any extra arguments to it, please specify them on "
+ echo "the $0 command line."
+fi
+
+autoreconf -i -f
+
+cd $THEDIR
+
+$srcdir/configure "$@" && {
+ echo
+ echo "Now type 'make' to compile libvirt-snmp."
+}
diff --git a/libvirt-snmp.spec.in b/libvirt-snmp.spec.in
index 7ec8a3f..6082a7a 100644
--- a/libvirt-snmp.spec.in
+++ b/libvirt-snmp.spec.in
@@ -1,6 +1,6 @@
Name: libvirt-snmp
Version: @VERSION@
-Release: 1%{?dist}
+Release: 1%{?dist}%{?extra_release}
Summary: SNMP functionality for libvirt
Group: Development/Libraries
@@ -36,8 +36,8 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%{_bindir}/libvirtMib_subagent
-@MIB_DIR(a)/LIBVIRT-MIB.txt
-%doc
+%{_datadir}/snmp/mibs/LIBVIRT-MIB.txt
+%doc README NEWS ChangeLog AUTHORS
--
1.7.4
13 years, 10 months