[libvirt] [PATCH 2/5] S390: CPU support for s390(x)
by Viktor Mihajlovski
Adding CPU encoder/decoder for s390 to avoid runtime error messages.
Signed-off-by: Thang Pham <thang.pham(a)us.ibm.com>
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
src/Makefile.am | 1 +
src/cpu/cpu.c | 2 +
src/cpu/cpu_s390x.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++
src/cpu/cpu_s390x.h | 31 +++++++++++++++++++
4 files changed, 114 insertions(+), 0 deletions(-)
create mode 100644 src/cpu/cpu_s390x.c
create mode 100644 src/cpu/cpu_s390x.h
diff --git a/src/Makefile.am b/src/Makefile.am
index e40909b..b0bd3e8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -566,6 +566,7 @@ CPU_SOURCES = \
cpu/cpu.h cpu/cpu.c \
cpu/cpu_generic.h cpu/cpu_generic.c \
cpu/cpu_x86.h cpu/cpu_x86.c cpu/cpu_x86_data.h \
+ cpu/cpu_s390x.h cpu/cpu_s390x.c \
cpu/cpu_map.h cpu/cpu_map.c cpu/cpu_powerpc.h \
cpu/cpu_powerpc.c
diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index b8ccd24..08cb144 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -29,6 +29,7 @@
#include "cpu.h"
#include "cpu_x86.h"
#include "cpu_powerpc.h"
+#include "cpu_s390x.h"
#include "cpu_generic.h"
@@ -38,6 +39,7 @@
static struct cpuArchDriver *drivers[] = {
&cpuDriverX86,
&cpuDriverPowerPC,
+ &cpuDriverS390X,
/* generic driver must always be the last one */
&cpuDriverGeneric
};
diff --git a/src/cpu/cpu_s390x.c b/src/cpu/cpu_s390x.c
new file mode 100644
index 0000000..da45433
--- /dev/null
+++ b/src/cpu/cpu_s390x.c
@@ -0,0 +1,80 @@
+/*
+ * cpu_s390x.c: CPU driver for s390x CPUs
+ *
+ * Copyright IBM Corp. 2012
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Authors:
+ * Thang Pham <thang.pham(a)us.ibm.com>
+ */
+
+#include <config.h>
+
+#include "memory.h"
+#include "cpu.h"
+
+
+#define VIR_FROM_THIS VIR_FROM_CPU
+
+static const char *archs[] = { "s390", "s390x" };
+
+static union cpuData *
+s390xNodeData(void)
+{
+ union cpuData *data;
+
+ if (VIR_ALLOC(data) < 0) {
+ virReportOOMError();
+ return NULL;
+ }
+
+ return data;
+}
+
+
+static int
+s390xDecode(virCPUDefPtr cpu ATTRIBUTE_UNUSED,
+ const union cpuData *data ATTRIBUTE_UNUSED,
+ const char **models ATTRIBUTE_UNUSED,
+ unsigned int nmodels ATTRIBUTE_UNUSED,
+ const char *preferred ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static void
+s390xDataFree(union cpuData *data)
+{
+ if (data == NULL)
+ return;
+
+ VIR_FREE(data);
+}
+
+struct cpuArchDriver cpuDriverS390X = {
+ .name = "s390x",
+ .arch = archs,
+ .narch = ARRAY_CARDINALITY(archs),
+ .compare = NULL,
+ .decode = s390xDecode,
+ .encode = NULL,
+ .free = s390xDataFree,
+ .nodeData = s390xNodeData,
+ .guestData = NULL,
+ .baseline = NULL,
+ .update = NULL,
+ .hasFeature = NULL,
+};
diff --git a/src/cpu/cpu_s390x.h b/src/cpu/cpu_s390x.h
new file mode 100644
index 0000000..f91377f
--- /dev/null
+++ b/src/cpu/cpu_s390x.h
@@ -0,0 +1,31 @@
+/*
+ * cpu_s390x.c: CPU driver for s390x CPUs
+ *
+ * Copyright IBM Corp. 2012
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Authors:
+ * Thang Pham <thang.pham(a)us.ibm.com>
+ */
+
+#ifndef __VIR_CPU_S390X_H__
+# define __VIR_CPU_S390X_H__
+
+# include "cpu.h"
+
+extern struct cpuArchDriver cpuDriverS390X;
+
+#endif /* __VIR_CPU_S390X_H__ */
--
1.7.0.4
--
Mit freundlichen Grüßen/Kind Regards
Viktor Mihajlovski
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
12 years, 10 months
[libvirt] [PATCH v2] add xhci support
by Gerd Hoffmann
qemu 1.1 features a xhci controller,
this patch adds support for it.
[v2: rebased, added docs/ updates ]
Signed-off-by: Gerd Hoffmann <kraxel(a)redhat.com>
---
docs/formatdomain.html.in | 4 ++--
docs/schemas/domaincommon.rng | 1 +
src/conf/domain_conf.c | 3 ++-
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 3 +++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 5 ++++-
7 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 1f30772..e1c0af5 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1820,8 +1820,8 @@
A "usb" controller has an optional attribute <code>model</code>,
which is one of "piix3-uhci", "piix4-uhci", "ehci",
"ich9-ehci1", "ich9-uhci1", "ich9-uhci2", "ich9-uhci3",
- "vt82c686b-uhci" or "pci-ohci". The PowerPC64 "spapr-vio"
- addresses do not have an associated controller.
+ "vt82c686b-uhci", "pci-ohci" or "nec-xhci". The PowerPC64
+ "spapr-vio" addresses do not have an associated controller.
</p>
<p>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 46e539d..8630625 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1201,6 +1201,7 @@
<value>ich9-uhci3</value>
<value>vt82c686b-uhci</value>
<value>pci-ohci</value>
+ <value>nec-xhci</value>
</choice>
</attribute>
</optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 81c6308..4651765 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -257,7 +257,8 @@ VIR_ENUM_IMPL(virDomainControllerModelUSB, VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST,
"ich9-uhci2",
"ich9-uhci3",
"vt82c686b-uhci",
- "pci-ohci")
+ "pci-ohci",
+ "nec-xhci")
VIR_ENUM_IMPL(virDomainFS, VIR_DOMAIN_FS_TYPE_LAST,
"mount",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 44280ba..3712785 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -631,6 +631,7 @@ enum virDomainControllerModelUSB {
VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI3,
VIR_DOMAIN_CONTROLLER_MODEL_USB_VT82C686B_UHCI,
VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI,
+ VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI,
VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST
};
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 4308833..578daeb 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -165,6 +165,7 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
"hda-micro", /* 95 */
"dump-guest-memory",
+ "nec-usb-xhci",
);
@@ -1421,6 +1422,8 @@ qemuCapsParseDeviceStr(const char *str, virBitmapPtr flags)
qemuCapsSet(flags, QEMU_CAPS_VT82C686B_USB_UHCI);
if (strstr(str, "name \"pci-ohci\""))
qemuCapsSet(flags, QEMU_CAPS_PCI_OHCI);
+ if (strstr(str, "name \"nec-usb-xhci\""))
+ qemuCapsSet(flags, QEMU_CAPS_NEC_USB_XHCI);
if (strstr(str, "name \"usb-redir\""))
qemuCapsSet(flags, QEMU_CAPS_USB_REDIR);
if (strstr(str, "name \"usb-hub\""))
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 640f7f5..83c135b 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -132,6 +132,7 @@ enum qemuCapsFlags {
QEMU_CAPS_NO_USER_CONFIG = 94, /* -no-user-config */
QEMU_CAPS_HDA_MICRO = 95, /* -device hda-micro */
QEMU_CAPS_DUMP_GUEST_MEMORY = 96, /* dump-guest-memory command */
+ QEMU_CAPS_NEC_USB_XHCI = 97, /* -device nec-usb-xhci */
QEMU_CAPS_LAST, /* this must always be the last item */
};
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index bd4f96a..6549f57 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -106,7 +106,8 @@ VIR_ENUM_IMPL(qemuControllerModelUSB, VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST,
"ich9-usb-uhci2",
"ich9-usb-uhci3",
"vt82c686b-usb-uhci",
- "pci-ohci");
+ "pci-ohci",
+ "nec-usb-xhci");
VIR_ENUM_DECL(qemuDomainFSDriver)
VIR_ENUM_IMPL(qemuDomainFSDriver, VIR_DOMAIN_FS_DRIVER_TYPE_LAST,
@@ -2598,6 +2599,8 @@ qemuControllerModelUSBToCaps(int model)
return QEMU_CAPS_VT82C686B_USB_UHCI;
case VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI:
return QEMU_CAPS_PCI_OHCI;
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI:
+ return QEMU_CAPS_NEC_USB_XHCI;
default:
return -1;
}
--
1.7.1
12 years, 10 months
[libvirt] [PATCH] Switch automated builds to use Mingw64 toolchain instead of Mingw32
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The Mingw32 toolchain is broadly obsoleted by the Mingw64 toolchain.
The latter has been adopted by Fedora 17 and newer. Maintaining a
RPM spec for Mingw32 is a needless burden, so switch to a Mingw64
RPM spec (which provides 32 & 64 bit builds).
---
.gitignore | 2 +-
Makefile.am | 2 +-
autobuild.sh | 46 +++++---
configure.ac | 2 +-
mingw-libvirt.spec.in | 298 +++++++++++++++++++++++++++++++++++++++++++++++
mingw32-libvirt.spec.in | 216 ----------------------------------
6 files changed, 334 insertions(+), 232 deletions(-)
create mode 100644 mingw-libvirt.spec.in
delete mode 100644 mingw32-libvirt.spec.in
diff --git a/.gitignore b/.gitignore
index d535398..cd978d2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -80,7 +80,7 @@
/ltmain.sh
/m4/*
/maint.mk
-/mingw32-libvirt.spec
+/mingw-libvirt.spec
/mkinstalldirs
/po/*
/proxy/
diff --git a/Makefile.am b/Makefile.am
index 75cff8d..41636b1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,7 +20,7 @@ XML_EXAMPLES = \
EXTRA_DIST = \
ChangeLog-old \
libvirt.spec libvirt.spec.in \
- mingw32-libvirt.spec.in \
+ mingw-libvirt.spec.in \
libvirt.pc.in \
autobuild.sh \
Makefile.nonreentrant \
diff --git a/autobuild.sh b/autobuild.sh
index 7e8f645..d167ebb 100755
--- a/autobuild.sh
+++ b/autobuild.sh
@@ -50,30 +50,30 @@ test -x /usr/bin/lcov && make cov
rm -f *.tar.gz
make dist
-if [ -n "$AUTOBUILD_COUNTER" ]; then
+if test -n "$AUTOBUILD_COUNTER" ; then
EXTRA_RELEASE=".auto$AUTOBUILD_COUNTER"
else
NOW=`date +"%s"`
EXTRA_RELEASE=".$USER$NOW"
fi
-if [ -f /usr/bin/rpmbuild ]; then
+if test -f /usr/bin/rpmbuild ; then
rpmbuild --nodeps \
--define "extra_release $EXTRA_RELEASE" \
--define "_sourcedir `pwd`" \
-ba --clean libvirt.spec
fi
-# Test mingw cross-compile
-if [ -x /usr/bin/i686-pc-mingw32-gcc ]; then
+# Test mingw32 cross-compile
+if test -x /usr/bin/i686-w64-mingw32-gcc ; then
make distclean
- PKG_CONFIG_PATH="$AUTOBUILD_INSTALL_ROOT/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig" \
- CC="i686-pc-mingw32-gcc" \
+ PKG_CONFIG_PATH="$AUTOBUILD_INSTALL_ROOT/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig" \
+ CC="i686-w64-mingw32-gcc" \
../configure \
- --build=$(uname -m)-pc-linux \
- --host=i686-pc-mingw32 \
- --prefix="$AUTOBUILD_INSTALL_ROOT/i686-pc-mingw32/sys-root/mingw" \
+ --build=$(uname -m)-w64-linux \
+ --host=i686-w64-mingw32 \
+ --prefix="$AUTOBUILD_INSTALL_ROOT/i686-w64-mingw32/sys-root/mingw" \
--enable-werror \
--without-libvirtd \
--without-python
@@ -81,13 +81,33 @@ if [ -x /usr/bin/i686-pc-mingw32-gcc ]; then
make
make install
- #set -o pipefail
- #make check 2>&1 | tee "$RESULTS"
+fi
+
+# Test mingw64 cross-compile
+if test -x /usr/bin/x86_64-w64-mingw32-gcc ; then
+ make distclean
+
+ PKG_CONFIG_PATH="$AUTOBUILD_INSTALL_ROOT/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig" \
+ CC="x86_64-w64-mingw32-gcc" \
+ ../configure \
+ --build=$(uname -m)-w64-linux \
+ --host=x86_64-w64-mingw32 \
+ --prefix="$AUTOBUILD_INSTALL_ROOT/x86_64-w64-mingw32/sys-root/mingw" \
+ --enable-werror \
+ --without-libvirtd \
+ --without-python
+
+ make
+ make install
+
+fi
+
- if [ -f /usr/bin/rpmbuild ]; then
+if test -x /usr/bin/i686-w64-mingw32-gcc -a test -x /usr/bin/x86_64-w64-mingw32-gcc ; then
+ if test -f /usr/bin/rpmbuild ; then
rpmbuild --nodeps \
--define "extra_release $EXTRA_RELEASE" \
--define "_sourcedir `pwd`" \
- -ba --clean mingw32-libvirt.spec
+ -ba --clean mingw-libvirt.spec
fi
fi
diff --git a/configure.ac b/configure.ac
index dda764d..d8aa6af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2752,7 +2752,7 @@ AC_OUTPUT(Makefile src/Makefile include/Makefile docs/Makefile \
docs/schemas/Makefile \
gnulib/lib/Makefile \
gnulib/tests/Makefile \
- libvirt.pc libvirt.spec mingw32-libvirt.spec \
+ libvirt.pc libvirt.spec mingw-libvirt.spec \
po/Makefile.in \
include/libvirt/Makefile include/libvirt/libvirt.h \
python/Makefile python/tests/Makefile \
diff --git a/mingw-libvirt.spec.in b/mingw-libvirt.spec.in
new file mode 100644
index 0000000..68fc5fc
--- /dev/null
+++ b/mingw-libvirt.spec.in
@@ -0,0 +1,298 @@
+%{?mingw_package_header}
+
+# Default to skipping autoreconf. Distros can change just this one line
+# (or provide a command-line override) if they backport any patches that
+# touch configure.ac or Makefile.am.
+%{!?enable_autotools:%define enable_autotools 0}
+
+# The mingw build is client only. Set up defaults for hypervisor drivers
+# that talk via a native remote protocol, and for which prereq mingw
+# libraries exist.
+%define with_phyp 0%{!?_without_phyp:1}
+%define with_esx 0%{!?_without_esx:1}
+# missing libwsman, so can't build hyper-v
+%define with_hyperv 0%{!?_without_hyperv:0}
+%define with_xenapi 0%{!?_without_xenapi:1}
+
+# RHEL ships ESX but not PowerHypervisor, HyperV, or libxenserver (xenapi)
+%if 0%{?rhel}
+%define with_phyp 0
+%define with_xenapi 0
+%define with_hyperv 0
+%endif
+
+Name: mingw-libvirt
+Version: @VERSION@
+Release: 1%{?dist}%{?extra_release}
+Summary: MinGW Windows libvirt virtualization library
+
+License: LGPLv2+
+Group: Development/Libraries
+URL: http://libvirt.org/
+Source0: ftp://libvirt.org/libvirt/libvirt-%{version}.tar.gz
+Patch1: 0001-build-do-not-build-shunloadtest-if-pthread-missing.patch
+Patch2: 0002-build-fix-output-of-pid-values.patch
+Patch3: 0003-build-update-pid_t-type-static-check.patch
+# Mingw-w64 trunk (jan 27 2012) contains an inline implementation of the
+# vscanf and vfscanf functions in stdio.h. This break compilation of gnulib
+# which tries to provide its own implementation for the vscanf and vfscanf
+# functions. Workaround is by making sure that the inline implementation
+# isn't triggered by #include <stdio.h>
+Patch4: libvirt-gnulib-workaround-mingw-w64-vfscanf-failure.patch
+
+BuildRequires: mingw32-filesystem >= 95
+BuildRequires: mingw64-filesystem >= 95
+BuildRequires: mingw32-gcc
+BuildRequires: mingw64-gcc
+BuildRequires: mingw32-binutils
+BuildRequires: mingw64-binutils
+BuildRequires: mingw32-libgpg-error
+BuildRequires: mingw64-libgpg-error
+BuildRequires: mingw32-libgcrypt
+BuildRequires: mingw64-libgcrypt
+BuildRequires: mingw32-gnutls
+BuildRequires: mingw64-gnutls
+BuildRequires: mingw32-gettext
+BuildRequires: mingw64-gettext
+BuildRequires: mingw32-libxml2
+BuildRequires: mingw64-libxml2
+BuildRequires: mingw32-portablexdr
+BuildRequires: mingw64-portablexdr
+
+BuildRequires: pkgconfig
+# Need native version for msgfmt
+BuildRequires: gettext
+%if 0%{?enable_autotools}
+BuildRequires: autoconf
+BuildRequires: automake
+BuildRequires: gettext-devel
+BuildRequires: libtool
+%endif
+
+%if %{with_phyp}
+BuildRequires: mingw32-libssh2
+BuildRequires: mingw64-libssh2
+%endif
+%if %{with_esx}
+BuildRequires: mingw32-curl
+BuildRequires: mingw64-curl
+%endif
+
+BuildArch: noarch
+
+%description
+MinGW Windows libvirt virtualization library.
+
+# Mingw32
+%package -n mingw32-libvirt
+Summary: %{summary}
+
+%description -n mingw32-libvirt
+MinGW Windows libvirt virtualization library.
+
+%package -n mingw32-libvirt-static
+Summary: %{summary}
+Requires: mingw32-libvirt = %{version}-%{release}
+
+%description -n mingw32-libvirt-static
+MinGW Windows libvirt virtualization library, static version.
+
+# Mingw64
+%package -n mingw64-libvirt
+Summary: %{summary}
+
+%description -n mingw64-libvirt
+MinGW Windows libvirt virtualization library.
+
+%package -n mingw64-libvirt-static
+Summary: %{summary}
+Requires: mingw64-libvirt = %{version}-%{release}
+
+%description -n mingw64-libvirt-static
+MinGW Windows libvirt virtualization library, static version.
+
+%{?mingw_debug_package}
+
+
+%prep
+%setup -q -n libvirt-%{version}
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p0
+
+%build
+%if ! %{with_phyp}
+%define _without_phyp --without-phyp
+%endif
+
+%if ! %{with_esx}
+%define _without_esx --without-esx
+%endif
+
+%if ! %{with_hyperv}
+%define _without_hyperv --without-hyperv
+%endif
+
+%if ! %{with_xenapi}
+%define _without_xenapi --without-xenapi
+%endif
+
+%if 0%{?enable_autotools}
+autoreconf -if
+%endif
+
+# XXX enable SASL in future
+%mingw_configure \
+ --enable-static \
+ --without-xen \
+ --without-qemu \
+ --without-openvz \
+ --without-lxc \
+ --without-vbox \
+ %{?_without_xenapi} \
+ --without-sasl \
+ --without-avahi \
+ --without-polkit \
+ --without-python \
+ --without-libvirtd \
+ --without-uml \
+ %{?_without_phyp} \
+ %{?_without_esx} \
+ %{?_without_hyperv} \
+ --without-vmware \
+ --without-netcf \
+ --without-audit \
+ --without-dtrace
+
+
+%mingw_make %{?_smp_mflags}
+
+
+%install
+%mingw_make_install "DESTDIR=$RPM_BUILD_ROOT"
+
+# Libtool files don't need to be bundled
+find $RPM_BUILD_ROOT -name "*.la" -delete
+
+rm -rf $RPM_BUILD_ROOT%{mingw32_sysconfdir}/libvirt/nwfilter
+rm -rf $RPM_BUILD_ROOT%{mingw64_sysconfdir}/libvirt/nwfilter
+rm -rf $RPM_BUILD_ROOT%{mingw32_datadir}/doc/*
+rm -rf $RPM_BUILD_ROOT%{mingw64_datadir}/doc/*
+rm -rf $RPM_BUILD_ROOT%{mingw32_datadir}/gtk-doc/*
+rm -rf $RPM_BUILD_ROOT%{mingw64_datadir}/gtk-doc/*
+
+rm -rf $RPM_BUILD_ROOT%{mingw32_libexecdir}/libvirt_iohelper.exe
+rm -rf $RPM_BUILD_ROOT%{mingw64_libexecdir}/libvirt_iohelper.exe
+
+
+# Mingw32
+%files -n mingw32-libvirt
+%dir %{mingw32_sysconfdir}/libvirt/
+%config(noreplace) %{mingw32_sysconfdir}/libvirt/libvirt.conf
+
+%{mingw32_bindir}/libvirt-0.dll
+%{mingw32_bindir}/virsh.exe
+%{mingw32_bindir}/virt-xml-validate
+%{mingw32_bindir}/virt-pki-validate
+%{mingw32_bindir}/virt-host-validate.exe
+%{mingw32_bindir}/libvirt-qemu-0.dll
+
+%{mingw32_libdir}/libvirt.dll.a
+%{mingw32_libdir}/pkgconfig/libvirt.pc
+%{mingw32_libdir}/libvirt-qemu.dll.a
+
+%dir %{mingw32_datadir}/libvirt/
+%dir %{mingw32_datadir}/libvirt/schemas/
+%{mingw32_datadir}/libvirt/schemas/basictypes.rng
+%{mingw32_datadir}/libvirt/schemas/capability.rng
+%{mingw32_datadir}/libvirt/schemas/domain.rng
+%{mingw32_datadir}/libvirt/schemas/domaincommon.rng
+%{mingw32_datadir}/libvirt/schemas/domainsnapshot.rng
+%{mingw32_datadir}/libvirt/schemas/interface.rng
+%{mingw32_datadir}/libvirt/schemas/network.rng
+%{mingw32_datadir}/libvirt/schemas/networkcommon.rng
+%{mingw32_datadir}/libvirt/schemas/nodedev.rng
+%{mingw32_datadir}/libvirt/schemas/nwfilter.rng
+%{mingw32_datadir}/libvirt/schemas/secret.rng
+%{mingw32_datadir}/libvirt/schemas/storageencryption.rng
+%{mingw32_datadir}/libvirt/schemas/storagepool.rng
+%{mingw32_datadir}/libvirt/schemas/storagevol.rng
+%dir %{mingw32_datadir}/libvirt/api/
+%{mingw32_datadir}/libvirt/api/libvirt-api.xml
+%{mingw32_datadir}/libvirt/api/libvirt-qemu-api.xml
+
+%{mingw32_datadir}/libvirt/cpu_map.xml
+
+%{mingw32_datadir}/locale/*/LC_MESSAGES/libvirt.mo
+
+%dir %{mingw32_includedir}/libvirt
+%{mingw32_includedir}/libvirt/libvirt.h
+%{mingw32_includedir}/libvirt/virterror.h
+%{mingw32_includedir}/libvirt/libvirt-qemu.h
+
+%{mingw32_mandir}/man1/virsh.1*
+%{mingw32_mandir}/man1/virt-xml-validate.1*
+%{mingw32_mandir}/man1/virt-pki-validate.1*
+%{mingw32_mandir}/man1/virt-host-validate.1*
+
+%files -n mingw32-libvirt-static
+%{mingw32_libdir}/libvirt.a
+%{mingw32_libdir}/libvirt-qemu.a
+
+# Mingw64
+%files -n mingw64-libvirt
+%dir %{mingw64_sysconfdir}/libvirt/
+%config(noreplace) %{mingw64_sysconfdir}/libvirt/libvirt.conf
+
+%{mingw64_bindir}/libvirt-0.dll
+%{mingw64_bindir}/virsh.exe
+%{mingw64_bindir}/virt-xml-validate
+%{mingw64_bindir}/virt-pki-validate
+%{mingw64_bindir}/virt-host-validate.exe
+%{mingw64_bindir}/libvirt-qemu-0.dll
+
+%{mingw64_libdir}/libvirt.dll.a
+%{mingw64_libdir}/pkgconfig/libvirt.pc
+%{mingw64_libdir}/libvirt-qemu.dll.a
+
+%dir %{mingw64_datadir}/libvirt/
+%dir %{mingw64_datadir}/libvirt/schemas/
+%{mingw64_datadir}/libvirt/schemas/basictypes.rng
+%{mingw64_datadir}/libvirt/schemas/capability.rng
+%{mingw64_datadir}/libvirt/schemas/domain.rng
+%{mingw64_datadir}/libvirt/schemas/domaincommon.rng
+%{mingw64_datadir}/libvirt/schemas/domainsnapshot.rng
+%{mingw64_datadir}/libvirt/schemas/interface.rng
+%{mingw64_datadir}/libvirt/schemas/network.rng
+%{mingw64_datadir}/libvirt/schemas/networkcommon.rng
+%{mingw64_datadir}/libvirt/schemas/nodedev.rng
+%{mingw64_datadir}/libvirt/schemas/nwfilter.rng
+%{mingw64_datadir}/libvirt/schemas/secret.rng
+%{mingw64_datadir}/libvirt/schemas/storageencryption.rng
+%{mingw64_datadir}/libvirt/schemas/storagepool.rng
+%{mingw64_datadir}/libvirt/schemas/storagevol.rng
+%dir %{mingw64_datadir}/libvirt/api/
+%{mingw64_datadir}/libvirt/api/libvirt-api.xml
+%{mingw64_datadir}/libvirt/api/libvirt-qemu-api.xml
+
+%{mingw64_datadir}/libvirt/cpu_map.xml
+
+%{mingw64_datadir}/locale/*/LC_MESSAGES/libvirt.mo
+
+%dir %{mingw64_includedir}/libvirt
+%{mingw64_includedir}/libvirt/libvirt.h
+%{mingw64_includedir}/libvirt/virterror.h
+%{mingw64_includedir}/libvirt/libvirt-qemu.h
+
+%{mingw64_mandir}/man1/virsh.1*
+%{mingw64_mandir}/man1/virt-xml-validate.1*
+%{mingw64_mandir}/man1/virt-pki-validate.1*
+%{mingw64_mandir}/man1/virt-host-validate.1*
+
+%files -n mingw64-libvirt-static
+%{mingw64_libdir}/libvirt.a
+%{mingw64_libdir}/libvirt-qemu.a
+
+
+%changelog
diff --git a/mingw32-libvirt.spec.in b/mingw32-libvirt.spec.in
deleted file mode 100644
index 4d23c75..0000000
--- a/mingw32-libvirt.spec.in
+++ /dev/null
@@ -1,216 +0,0 @@
-%define __strip %{_mingw32_strip}
-%define __objdump %{_mingw32_objdump}
-%define _use_internal_dependency_generator 0
-%define __find_requires %{_mingw32_findrequires}
-%define __find_provides %{_mingw32_findprovides}
-%define __debug_install_post %{_mingw32_debug_install_post}
-
-# Default to skipping autoreconf. Distros can change just this one line
-# (or provide a command-line override) if they backport any patches that
-# touch configure.ac or Makefile.am.
-%{!?enable_autotools:%define enable_autotools 0}
-
-# The mingw build is client only. Set up defaults for hypervisor drivers
-# that talk via a native remote protocol, and for which prereq mingw
-# libraries exist.
-%define with_phyp 0%{!?_without_phyp:1}
-%define with_esx 0%{!?_without_esx:1}
-# missing libwsman, so can't build hyper-v
-%define with_hyperv 0%{!?_without_hyperv:0}
-%define with_xenapi 0%{!?_without_xenapi:1}
-
-# RHEL ships ESX but not PowerHypervisor, HyperV, or libxenserver (xenapi)
-%if 0%{?rhel}
-%define with_phyp 0
-%define with_xenapi 0
-%define with_hyperv 0
-%endif
-
-Name: mingw32-libvirt
-Version: @VERSION@
-Release: 3%{?dist}%{?extra_release}
-Summary: MinGW Windows libvirt virtualization library
-
-License: LGPLv2+
-Group: Development/Libraries
-URL: http://libvirt.org/
-Source0: ftp://libvirt.org/libvirt/libvirt-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
-BuildRequires: mingw32-filesystem >= 23
-BuildRequires: mingw32-gcc
-BuildRequires: mingw32-binutils
-BuildRequires: mingw32-libgpg-error
-BuildRequires: mingw32-libgcrypt
-BuildRequires: mingw32-gnutls
-BuildRequires: mingw32-gettext
-BuildRequires: mingw32-libxml2
-BuildRequires: mingw32-portablexdr
-BuildRequires: pkgconfig
-# Need native version for msgfmt
-BuildRequires: gettext
-%if 0%{?enable_autotools}
-BuildRequires: autoconf
-BuildRequires: automake
-BuildRequires: gettext-devel
-BuildRequires: libtool
-%endif
-
-%if %{with_phyp}
-BuildRequires: mingw32-libssh2
-%endif
-%if %{with_esx}
-BuildRequires: mingw32-curl
-%endif
-
-BuildArch: noarch
-
-%{?_mingw32_debug_package}
-
-%description
-MinGW Windows libvirt virtualization library.
-
-
-%prep
-%setup -q -n libvirt-%{version}
-
-
-%build
-%if ! %{with_phyp}
-%define _without_phyp --without-phyp
-%endif
-
-%if ! %{with_esx}
-%define _without_esx --without-esx
-%endif
-
-%if ! %{with_hyperv}
-%define _without_hyperv --without-hyperv
-%endif
-
-%if ! %{with_xenapi}
-%define _without_xenapi --without-xenapi
-%endif
-
-%if 0%{?enable_autotools}
-autoreconf -if
-%endif
-# XXX enable SASL in future
-%{_mingw32_configure} \
- --without-xen \
- --without-qemu \
- --without-openvz \
- --without-lxc \
- --without-vbox \
- %{?_without_xenapi} \
- --without-sasl \
- --without-avahi \
- --without-polkit \
- --without-python \
- --without-libvirtd \
- --without-uml \
- %{?_without_phyp} \
- %{?_without_esx} \
- %{?_without_hyperv} \
- --without-vmware \
- --without-netcf \
- --without-audit \
- --without-dtrace
-make
-
-
-%install
-rm -rf $RPM_BUILD_ROOT
-
-make DESTDIR=$RPM_BUILD_ROOT install
-
-rm -rf $RPM_BUILD_ROOT%{_mingw32_sysconfdir}/libvirt/nwfilter
-rm -rf $RPM_BUILD_ROOT%{_mingw32_datadir}/doc/*
-rm -rf $RPM_BUILD_ROOT%{_mingw32_datadir}/gtk-doc/*
-
-rm -rf $RPM_BUILD_ROOT%{_mingw32_libexecdir}/libvirt_iohelper.exe
-
-rm $RPM_BUILD_ROOT%{_mingw32_libdir}/libvirt.a
-rm $RPM_BUILD_ROOT%{_mingw32_libdir}/libvirt-qemu.a
-
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-
-%files
-%defattr(-,root,root)
-%dir %{_mingw32_sysconfdir}/libvirt/
-%config(noreplace) %{_mingw32_sysconfdir}/libvirt/libvirt.conf
-
-%{_mingw32_bindir}/libvirt-0.dll
-%{_mingw32_bindir}/virsh.exe
-%{_mingw32_bindir}/virt-xml-validate
-%{_mingw32_bindir}/virt-pki-validate
-%{_mingw32_bindir}/virt-host-validate.exe
-%{_mingw32_bindir}/libvirt-qemu-0.dll
-
-%{_mingw32_libdir}/libvirt.dll.a
-%{_mingw32_libdir}/libvirt.la
-%{_mingw32_libdir}/pkgconfig/libvirt.pc
-%{_mingw32_libdir}/libvirt-qemu.dll.a
-%{_mingw32_libdir}/libvirt-qemu.la
-
-%dir %{_mingw32_datadir}/libvirt/api/
-%{_mingw32_datadir}/libvirt/api/libvirt-api.xml
-%{_mingw32_datadir}/libvirt/api/libvirt-qemu-api.xml
-
-%dir %{_mingw32_datadir}/libvirt/
-%dir %{_mingw32_datadir}/libvirt/schemas/
-%{_mingw32_datadir}/libvirt/schemas/basictypes.rng
-%{_mingw32_datadir}/libvirt/schemas/capability.rng
-%{_mingw32_datadir}/libvirt/schemas/domain.rng
-%{_mingw32_datadir}/libvirt/schemas/domaincommon.rng
-%{_mingw32_datadir}/libvirt/schemas/domainsnapshot.rng
-%{_mingw32_datadir}/libvirt/schemas/interface.rng
-%{_mingw32_datadir}/libvirt/schemas/network.rng
-%{_mingw32_datadir}/libvirt/schemas/networkcommon.rng
-%{_mingw32_datadir}/libvirt/schemas/nodedev.rng
-%{_mingw32_datadir}/libvirt/schemas/nwfilter.rng
-%{_mingw32_datadir}/libvirt/schemas/secret.rng
-%{_mingw32_datadir}/libvirt/schemas/storageencryption.rng
-%{_mingw32_datadir}/libvirt/schemas/storagepool.rng
-%{_mingw32_datadir}/libvirt/schemas/storagevol.rng
-
-%{_mingw32_datadir}/libvirt/cpu_map.xml
-
-%{_mingw32_datadir}/locale/*/LC_MESSAGES/libvirt.mo
-
-%dir %{_mingw32_includedir}/libvirt
-%{_mingw32_includedir}/libvirt/libvirt.h
-%{_mingw32_includedir}/libvirt/virterror.h
-%{_mingw32_includedir}/libvirt/libvirt-qemu.h
-
-%{_mingw32_mandir}/man1/virsh.1*
-%{_mingw32_mandir}/man1/virt-xml-validate.1*
-%{_mingw32_mandir}/man1/virt-pki-validate.1*
-%{_mingw32_mandir}/man1/virt-host-validate.1*
-
-
-%changelog
-* Thu Sep 25 2008 Richard Jones <rjones(a)redhat.com> - 0.4.6-3
-- BuildArch should be noarch
-
-* Wed Sep 24 2008 Richard W.M. Jones <rjones(a)redhat.com> - 0.4.6-2
-- Whitespace removal.
-
-* Wed Sep 24 2008 Richard W.M. Jones <rjones(a)redhat.com> - 0.4.6-1
-- New upstream release 0.4.6.
-- Rename mingw -> mingw32.
-
-* Mon Sep 22 2008 Daniel P. Berrange <berrange(a)redhat.com> - 0.4.5-4%{?extra_release}
-- Import crash fix from rawhide
-
-* Thu Sep 11 2008 Daniel P. Berrange <berrange(a)redhat.com> - 0.4.5-3%{?extra_release}
-- Add dep on gettext & pkgconfig
-
-* Wed Sep 10 2008 Richard W.M. Jones <rjones(a)redhat.com> - 0.4.5-2
-- Remove static lib.
-
-* Tue Sep 2 2008 Daniel P. Berrange <berrange(a)redhat.com> - 0.4.4-1
-- Initial RPM release, largely based on earlier work from several sources.
--
1.7.10.2
12 years, 10 months
[libvirt] Libvirt / GNULIB failures using Mingw64 toolchain
by Daniel P. Berrange
With current Libvirt master + GNULIB (77cef20) I can successfully
compile using the Mingw32 toolchain. If attempting to use the
alternative Mingw64 toolchain, however, I get a number of errors.
On both x86_64-w64-mingw32 and i686-w64-mingw32 I see the
following:
CC fstat.lo
../../../gnulib/lib/fstat.c:27:0: warning: "stat" redefined [enabled by default]
In file included from ./sys/stat.h:32:0,
from ../../../gnulib/lib/fstat.c:25:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/sys/stat.h:258:0: note: this is the location of the previous definition
../../../gnulib/lib/fstat.c:28:0: warning: "fstat" redefined [enabled by default]
In file included from ./sys/stat.h:32:0,
from ../../../gnulib/lib/fstat.c:25:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/sys/stat.h:259:0: note: this is the location of the previous definition
CC stat.lo
../../../gnulib/lib/stat.c:32:0: warning: "stat" redefined [enabled by default]
In file included from ./sys/stat.h:32:0,
from ../../../gnulib/lib/stat.c:27:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/sys/stat.h:258:0: note: this is the location of the previous definition
CC stdio-read.lo
../../../gnulib/lib/stdio-read.c:102:1: error: redefinition of 'vscanf'
In file included from ./stdio.h:43:0,
from ../../../gnulib/lib/stdio-read.c:21:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:397:7: note: previous definition of 'vscanf' was here
../../../gnulib/lib/stdio-read.c:108:1: error: redefinition of 'vfscanf'
In file included from ./stdio.h:43:0,
from ../../../gnulib/lib/stdio-read.c:21:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:384:7: note: previous definition of 'vfscanf' was here
make[3]: *** [stdio-read.lo] Error 1
make[3]: Leaving directory `/home/berrange/src/virt/libvirt/build/gnulib/lib'
While on x86_64-w64-mingw32 only I see:
In file included from ../../../gnulib/lib/regex.c:69:0:
../../../gnulib/lib/regcomp.c: In function 'parse_dup_op':
../../../gnulib/lib/regcomp.c:2624:39: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
../../../gnulib/lib/regcomp.c: In function 'mark_opt_subexp':
../../../gnulib/lib/regcomp.c:3859:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
12 years, 10 months
[libvirt] [PATCH 0/4] Various minor fixes
by Martin Kletzander
I stumbled upon few things that would be nice to have when fixed, so I
separated them into sensible groups.
Martin Kletzander (4):
docs: allow custom link elements
docs: fix 404 page when fetched from different location
docs: update and fix search page
docs/virsh: various minor fixes
docs/404.html.in | 5 ++-
docs/api_extension.html.in | 4 --
docs/page.xsl | 3 ++
docs/pending.html.in | 4 --
docs/search.php | 80 +++++++++++++++++++++++++++++--------------
tools/virsh.c | 4 +-
6 files changed, 63 insertions(+), 37 deletions(-)
--
1.7.8.6
12 years, 10 months
[libvirt] [PATCH] Initialize random generator in lxc controller
by Jim Fehlig
I'm having some problems sending patches to the list via git
send-email. The messages are being delivered to my MTA afaict, and I
can send patches to my personal and corporate accounts. Until I get
this resolved, attaching a patch to fix a segfault in libvirt_lxc.
Regards,
Jim
12 years, 10 months
[libvirt] [PATCH] util: Fix the indention
by Osier Yang
src/util/util.c: virFileOpenAs.
Pushed under trivial rule.
---
src/util/util.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/util/util.c b/src/util/util.c
index 28a4fe7..ce98d20 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -995,14 +995,14 @@ virFileOpenAs(const char *path, int openflags, mode_t mode,
/* allow using -1 to mean "current value" */
if (uid == (uid_t) -1)
- uid = getuid();
+ uid = getuid();
if (gid == (gid_t) -1)
- gid = getgid();
+ gid = getgid();
/* treat absence of both flags as presence of both for simpler
* calling. */
if (!(flags & (VIR_FILE_OPEN_NOFORK|VIR_FILE_OPEN_FORK)))
- flags |= VIR_FILE_OPEN_NOFORK|VIR_FILE_OPEN_FORK;
+ flags |= VIR_FILE_OPEN_NOFORK|VIR_FILE_OPEN_FORK;
if ((flags & VIR_FILE_OPEN_NOFORK)
|| (getuid() != 0)
--
1.7.7.3
12 years, 10 months
[libvirt] [PATCH] storage: Set the perms if the pool target already exists for fs pools
by Osier Yang
The comment says:
/* Now create the final dir in the path with the uid/gid/mode
* requested in the config. If the dir already exists, just set
* the perms.
*/
However, virDirCreate is only invoked if the target path doesn't
exist yet (which is opposite with the comment), or the uid from
the config is not -1 (I don't understand why, think it's just
another mistake). And the result is the perms of the pool won't
be changed if one tries to build the pool with different perms
again.
Besides these logic error fix, if no uid and gid are specified in
the config, the practical used uid, gid are reflected.
---
src/storage/storage_backend_fs.c | 44 +++++++++++++++++++------------------
1 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 169037b..ed0d6ec 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -789,30 +789,32 @@ virStorageBackendFileSystemBuild(virConnectPtr conn ATTRIBUTE_UNUSED,
/* Now create the final dir in the path with the uid/gid/mode
* requested in the config. If the dir already exists, just set
* the perms. */
+ uid_t uid;
+ gid_t gid;
- struct stat st;
-
- if ((stat(pool->def->target.path, &st) < 0)
- || (pool->def->target.perms.uid != -1)) {
-
- uid_t uid = (pool->def->target.perms.uid == -1)
- ? getuid() : pool->def->target.perms.uid;
- gid_t gid = (pool->def->target.perms.gid == -1)
- ? getgid() : pool->def->target.perms.gid;
-
- if ((err = virDirCreate(pool->def->target.path,
- pool->def->target.perms.mode,
- uid, gid,
- VIR_DIR_CREATE_FORCE_PERMS |
- VIR_DIR_CREATE_ALLOW_EXIST |
- (pool->def->type == VIR_STORAGE_POOL_NETFS
- ? VIR_DIR_CREATE_AS_UID : 0)) < 0)) {
- virReportSystemError(-err, _("cannot create path '%s'"),
- pool->def->target.path);
- goto error;
- }
+ uid = (pool->def->target.perms.uid == -1)
+ ? getuid() : pool->def->target.perms.uid;
+ gid = (pool->def->target.perms.gid == -1)
+ ? getgid() : pool->def->target.perms.gid;
+
+ if ((err = virDirCreate(pool->def->target.path,
+ pool->def->target.perms.mode,
+ uid, gid,
+ VIR_DIR_CREATE_FORCE_PERMS |
+ VIR_DIR_CREATE_ALLOW_EXIST |
+ (pool->def->type == VIR_STORAGE_POOL_NETFS
+ ? VIR_DIR_CREATE_AS_UID : 0)) < 0)) {
+ virReportSystemError(-err, _("cannot create path '%s'"),
+ pool->def->target.path);
+ goto error;
}
+ /* Reflect the actual uid and gid to the config. */
+ if (pool->def->target.perms.uid == -1)
+ pool->def->target.perms.uid = uid;
+ if (pool->def->target.perms.gid == -1)
+ pool->def->target.perms.gid = gid;
+
if (flags != 0) {
ret = virStorageBackendMakeFileSystem(pool, flags);
} else {
--
1.7.7.3
12 years, 10 months
[libvirt] [PATCHv2 variant 1] snapshot: implement new APIs for esx and vbox
by Eric Blake
The two new APIs are rather trivial; based on bits and pieces of
other existing APIs. But rather than blindly return 0 or 1 for
HasMetadata, I chose to first validate that the snapshot in
question in fact exists. In the process, I noticed other APIs
that were blindly succeeding instead of checking for existence.
* src/esx/esx_driver.c (esxDomainSnapshotIsCurrent)
(esxDomainSnapshotHasMetadata): New functions.
(esxDomainIsUpdated, esxDomainIsPersistent): Add existence checks.
* src/vbox/vbox_tmpl.c (vboxDomainSnapshotIsCurrent)
(vboxDomainSnapshotHasMetadata): New functions.
(vboxDomainIsPersistent, vboxDomainIsUpdated): Add existence checks.
---
v2: add existence checks to other functions
I like this version better. However, while it compiles, I'm
completely unable to runtime test it, so I'd appreciate a
good review.
src/esx/esx_driver.c | 116 ++++++++++++++++++++++++++++++++++++++--
src/vbox/vbox_tmpl.c | 145 ++++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 253 insertions(+), 8 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index b3f1948..db2144c 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -4243,10 +4243,28 @@ esxDomainIsActive(virDomainPtr domain)
static int
-esxDomainIsPersistent(virDomainPtr domain ATTRIBUTE_UNUSED)
+esxDomainIsPersistent(virDomainPtr domain)
{
- /* ESX has no concept of transient domains, so all of them are persistent */
- return 1;
+ /* ESX has no concept of transient domains, so all of them are
+ * persistent. However, we do want to check for existence. */
+ int result = -1;
+ esxPrivate *priv = domain->conn->privateData;
+ esxVI_ObjectContent *virtualMachine = NULL;
+
+ if (esxVI_EnsureSession(priv->primary) < 0)
+ return -1;
+
+ if (esxVI_LookupVirtualMachineByUuid(priv->primary, domain->uuid,
+ NULL, &virtualMachine,
+ esxVI_Occurrence_RequiredItem) < 0)
+ goto cleanup;
+
+ result = 1;
+
+cleanup:
+ esxVI_ObjectContent_Free(&virtualMachine);
+
+ return result;
}
@@ -4254,7 +4272,26 @@ esxDomainIsPersistent(virDomainPtr domain ATTRIBUTE_UNUSED)
static int
esxDomainIsUpdated(virDomainPtr domain ATTRIBUTE_UNUSED)
{
- return 0;
+ /* ESX domains never have a persistent state that differs from
+ * current state. However, we do want to check for existence. */
+ int result = -1;
+ esxPrivate *priv = domain->conn->privateData;
+ esxVI_ObjectContent *virtualMachine = NULL;
+
+ if (esxVI_EnsureSession(priv->primary) < 0)
+ return -1;
+
+ if (esxVI_LookupVirtualMachineByUuid(priv->primary, domain->uuid,
+ NULL, &virtualMachine,
+ esxVI_Occurrence_RequiredItem) < 0)
+ goto cleanup;
+
+ result = 0;
+
+cleanup:
+ esxVI_ObjectContent_Free(&virtualMachine);
+
+ return result;
}
@@ -4707,6 +4744,75 @@ esxDomainSnapshotCurrent(virDomainPtr domain, unsigned int flags)
}
+static int
+esxDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot, unsigned int flags)
+{
+ esxPrivate *priv = snapshot->domain->conn->privateData;
+ esxVI_VirtualMachineSnapshotTree *currentSnapshotTree = NULL;
+ esxVI_VirtualMachineSnapshotTree *rootSnapshotList = NULL;
+ esxVI_VirtualMachineSnapshotTree *snapshotTree = NULL;
+ int ret = -1;
+
+ virCheckFlags(0, -1);
+
+ if (esxVI_EnsureSession(priv->primary) < 0) {
+ return -1;
+ }
+
+ /* Check that snapshot exists. */
+ if (esxVI_LookupRootSnapshotTreeList(priv->primary, snapshot->domain->uuid,
+ &rootSnapshotList) < 0 ||
+ esxVI_GetSnapshotTreeByName(rootSnapshotList, snapshot->name,
+ &snapshotTree, NULL,
+ esxVI_Occurrence_RequiredItem) < 0) {
+ goto cleanup;
+ }
+
+ if (esxVI_LookupCurrentSnapshotTree(priv->primary, snapshot->domain->uuid,
+ ¤tSnapshotTree,
+ esxVI_Occurrence_RequiredItem) < 0) {
+ goto cleanup;
+ }
+
+ ret = STREQ(snapshot->name, currentSnapshotTree->name);
+
+cleanup:
+ esxVI_VirtualMachineSnapshotTree_Free(¤tSnapshotTree);
+ esxVI_VirtualMachineSnapshotTree_Free(&rootSnapshotList);
+ return ret;
+}
+
+
+static int
+esxDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot, unsigned int flags)
+{
+ esxPrivate *priv = snapshot->domain->conn->privateData;
+ esxVI_VirtualMachineSnapshotTree *rootSnapshotList = NULL;
+ esxVI_VirtualMachineSnapshotTree *snapshotTree = NULL;
+ int ret = -1;
+
+ virCheckFlags(0, -1);
+
+ if (esxVI_EnsureSession(priv->primary) < 0) {
+ return -1;
+ }
+
+ /* Check that snapshot exists. If so, there is no metadata. */
+ if (esxVI_LookupRootSnapshotTreeList(priv->primary, snapshot->domain->uuid,
+ &rootSnapshotList) < 0 ||
+ esxVI_GetSnapshotTreeByName(rootSnapshotList, snapshot->name,
+ &snapshotTree, NULL,
+ esxVI_Occurrence_RequiredItem) < 0) {
+ goto cleanup;
+ }
+
+ ret = 0;
+
+cleanup:
+ esxVI_VirtualMachineSnapshotTree_Free(&rootSnapshotList);
+ return ret;
+}
+
static int
esxDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, unsigned int flags)
@@ -5021,6 +5127,8 @@ static virDriver esxDriver = {
.domainSnapshotGetParent = esxDomainSnapshotGetParent, /* 0.9.7 */
.domainSnapshotCurrent = esxDomainSnapshotCurrent, /* 0.8.0 */
.domainRevertToSnapshot = esxDomainRevertToSnapshot, /* 0.8.0 */
+ .domainSnapshotIsCurrent = esxDomainSnapshotIsCurrent, /* 0.9.13 */
+ .domainSnapshotHasMetadata = esxDomainSnapshotHasMetadata, /* 0.9.13 */
.domainSnapshotDelete = esxDomainSnapshotDelete, /* 0.8.0 */
.isAlive = esxIsAlive, /* 0.9.8 */
};
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 4b0ee2e..8b7415a 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -1490,14 +1490,54 @@ static int vboxDomainIsActive(virDomainPtr dom) {
}
-static int vboxDomainIsPersistent(virDomainPtr dom ATTRIBUTE_UNUSED) {
- /* All domains are persistent. */
- return 1;
+static int vboxDomainIsPersistent(virDomainPtr dom ATTRIBUTE_UNUSED)
+{
+ /* All domains are persistent. However, we do want to check for
+ * existence. */
+ VBOX_OBJECT_CHECK(dom->conn, int, -1);
+ vboxIID iid = VBOX_IID_INITIALIZER;
+ IMachine *machine = NULL;
+ nsresult rc;
+
+ vboxIIDFromUUID(&iid, dom->uuid);
+ rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
+ if (NS_FAILED(rc)) {
+ vboxError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching UUID"));
+ goto cleanup;
+ }
+
+ ret = 1;
+
+cleanup:
+ VBOX_RELEASE(machine);
+ vboxIIDUnalloc(&iid);
+ return ret;
}
static int vboxDomainIsUpdated(virDomainPtr dom ATTRIBUTE_UNUSED) {
- return 0;
+ /* VBox domains never have a persistent state that differs from
+ * current state. However, we do want to check for existence. */
+ VBOX_OBJECT_CHECK(dom->conn, int, -1);
+ vboxIID iid = VBOX_IID_INITIALIZER;
+ IMachine *machine = NULL;
+ nsresult rc;
+
+ vboxIIDFromUUID(&iid, dom->uuid);
+ rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
+ if (NS_FAILED(rc)) {
+ vboxError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching UUID"));
+ goto cleanup;
+ }
+
+ ret = 0;
+
+cleanup:
+ VBOX_RELEASE(machine);
+ vboxIIDUnalloc(&iid);
+ return ret;
}
static int vboxDomainSuspend(virDomainPtr dom) {
@@ -6426,6 +6466,101 @@ cleanup:
return ret;
}
+static int
+vboxDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot,
+ unsigned int flags)
+{
+ virDomainPtr dom = snapshot->domain;
+ VBOX_OBJECT_CHECK(dom->conn, int, -1);
+ vboxIID iid = VBOX_IID_INITIALIZER;
+ IMachine *machine = NULL;
+ ISnapshot *snap = NULL;
+ ISnapshot *current = NULL;
+ PRUnichar *nameUtf16 = NULL;
+ char *name = NULL;
+ nsresult rc;
+
+ virCheckFlags(0, -1);
+
+ vboxIIDFromUUID(&iid, dom->uuid);
+ rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
+ if (NS_FAILED(rc)) {
+ vboxError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching UUID"));
+ goto cleanup;
+ }
+
+ if (!(snap = vboxDomainSnapshotGet(data, dom, machine, snapshot->name)))
+ goto cleanup;
+
+ rc = machine->vtbl->GetCurrentSnapshot(machine, ¤t);
+ if (NS_FAILED(rc)) {
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not get current snapshot"));
+ goto cleanup;
+ }
+ if (!current) {
+ ret = 0;
+ goto cleanup;
+ }
+
+ rc = current->vtbl->GetName(current, &nameUtf16);
+ if (NS_FAILED(rc) || !nameUtf16) {
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not get current snapshot name"));
+ goto cleanup;
+ }
+
+ VBOX_UTF16_TO_UTF8(nameUtf16, &name);
+ if (!name) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ ret = STREQ(snapshot->name, name);
+
+cleanup:
+ VBOX_UTF8_FREE(name);
+ VBOX_UTF16_FREE(nameUtf16);
+ VBOX_RELEASE(current);
+ VBOX_RELEASE(machine);
+ vboxIIDUnalloc(&iid);
+ return ret;
+}
+
+static int
+vboxDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot,
+ unsigned int flags)
+{
+ virDomainPtr dom = snapshot->domain;
+ VBOX_OBJECT_CHECK(dom->conn, int, -1);
+ vboxIID iid = VBOX_IID_INITIALIZER;
+ IMachine *machine = NULL;
+ ISnapshot *snap = NULL;
+ nsresult rc;
+
+ virCheckFlags(0, -1);
+
+ vboxIIDFromUUID(&iid, dom->uuid);
+ rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
+ if (NS_FAILED(rc)) {
+ vboxError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching UUID"));
+ goto cleanup;
+ }
+
+ /* Check that snapshot exists. If so, there is no metadata. */
+ if (!(snap = vboxDomainSnapshotGet(data, dom, machine, snapshot->name)))
+ goto cleanup;
+
+ ret = 0;
+
+cleanup:
+ VBOX_RELEASE(machine);
+ vboxIIDUnalloc(&iid);
+ return ret;
+}
+
#if VBOX_API_VERSION < 3001
static int
vboxDomainSnapshotRestore(virDomainPtr dom,
@@ -9172,6 +9307,8 @@ virDriver NAME(Driver) = {
.domainHasCurrentSnapshot = vboxDomainHasCurrentSnapshot, /* 0.8.0 */
.domainSnapshotGetParent = vboxDomainSnapshotGetParent, /* 0.9.7 */
.domainSnapshotCurrent = vboxDomainSnapshotCurrent, /* 0.8.0 */
+ .domainSnapshotIsCurrent = vboxDomainSnapshotIsCurrent, /* 0.9.13 */
+ .domainSnapshotHasMetadata = vboxDomainSnapshotHasMetadata, /* 0.9.13 */
.domainRevertToSnapshot = vboxDomainRevertToSnapshot, /* 0.8.0 */
.domainSnapshotDelete = vboxDomainSnapshotDelete, /* 0.8.0 */
.isAlive = vboxIsAlive, /* 0.9.8 */
--
1.7.10.2
12 years, 10 months