[libvirt] [PATCH] Mount temporary devpts on /var/lib/libvirt/lxc/$NAME.devpts
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Currently the lxc controller sets up the devpts instance on
$rootfsdef->src, but this only works if $rootfsdef is using
type=mount. To support type=block or type=file for the root
filesystem, we must use /var/lib/libvirt/lxc/$NAME.devpts
for the temporary devpts mount in the controller
---
src/lxc/lxc_container.c | 43 +++++++++++++++++++++++++------------------
src/lxc/lxc_controller.c | 13 ++++---------
2 files changed, 29 insertions(+), 27 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index bf17a38..be9bc6c 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -627,15 +627,17 @@ static int lxcContainerMountProcFuse(virDomainDefPtr def ATTRIBUTE_UNUSED,
}
#endif
-static int lxcContainerMountFSDevPTS(virDomainFSDefPtr root)
+static int lxcContainerMountFSDevPTS(virDomainDefPtr def,
+ const char *srcprefix)
{
- char *devpts = NULL;
- int rc = -1;
+ int ret;
+ char *path = NULL;
- if (virAsprintf(&devpts, "/.oldroot%s/dev/pts", root->src) < 0) {
- virReportOOMError();
- goto cleanup;
- }
+ if ((ret = virAsprintf(&path,
+ "%s/%s/%s.devpts",
+ srcprefix ? srcprefix : "", LXC_STATE_DIR,
+ def->name)) < 0)
+ return ret;
if (virFileMakePath("/dev/pts") < 0) {
virReportSystemError(errno, "%s",
@@ -643,19 +645,20 @@ static int lxcContainerMountFSDevPTS(virDomainFSDefPtr root)
goto cleanup;
}
- VIR_DEBUG("Trying to move %s to %s", devpts, "/dev/pts");
- if ((rc = mount(devpts, "/dev/pts", NULL, MS_MOVE, NULL)) < 0) {
- virReportSystemError(errno, "%s",
- _("Failed to mount /dev/pts in container"));
+ VIR_DEBUG("Trying to move %s to /dev/pts", path);
+
+ if ((ret = mount(path, "/dev/pts",
+ NULL, MS_MOVE, NULL)) < 0) {
+ virReportSystemError(errno,
+ _("Failed to mount %s on /dev/pts"),
+ path);
goto cleanup;
}
- rc = 0;
-
- cleanup:
- VIR_FREE(devpts);
+cleanup:
+ VIR_FREE(path);
- return rc;
+ return ret;
}
static int lxcContainerPopulateDevices(char **ttyPaths, size_t nttyPaths)
@@ -1961,7 +1964,7 @@ static int lxcContainerSetupPivotRoot(virDomainDefPtr vmDef,
goto cleanup;
/* Mounts /dev/pts */
- if (lxcContainerMountFSDevPTS(root) < 0)
+ if (lxcContainerMountFSDevPTS(vmDef, "/.oldroot") < 0)
goto cleanup;
/* Populates device nodes in /dev/ */
@@ -2204,7 +2207,11 @@ static int lxcContainerChild(void *data)
if (argv->nttyPaths) {
if (root) {
- if (virAsprintf(&ttyPath, "%s%s", root->src, argv->ttyPaths[0]) < 0) {
+ const char *tty = argv->ttyPaths[0];
+ if (STRPREFIX(tty, "/dev/pts/"))
+ tty += strlen("/dev/pts/");
+ if (virAsprintf(&ttyPath, "%s/%s.devpts/%s",
+ LXC_STATE_DIR, vmDef->name, tty) < 0) {
virReportOOMError();
goto cleanup;
}
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index bb369e2..1d1443c 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -1219,15 +1219,10 @@ virLXCControllerSetupDevPTS(virLXCControllerPtr ctrl)
mount_options = virSecurityManagerGetMountOptions(ctrl->securityManager,
ctrl->def);
- if (!virFileExists(root->src)) {
- virReportSystemError(errno,
- _("root source %s does not exist"),
- root->src);
- goto cleanup;
- }
-
- if (virAsprintf(&devpts, "%s/dev/pts", root->src) < 0 ||
- virAsprintf(&ctrl->devptmx, "%s/dev/pts/ptmx", root->src) < 0) {
+ if (virAsprintf(&devpts, "%s/%s.devpts",
+ LXC_STATE_DIR, ctrl->def->name) < 0 ||
+ virAsprintf(&ctrl->devptmx, "%s/%s.devpts/ptmx",
+ LXC_STATE_DIR, ctrl->def->name) < 0) {
virReportOOMError();
goto cleanup;
}
--
1.7.11.7
11 years, 9 months
[libvirt] [PATCH V2] Fix parsing of bond interface XML
by Jim Fehlig
Noticed that parsing bond interface XML containing the miimon element
fails
<interface type="bond" name="bond0">
...
<bond mode="active-backup">
<miimon freq="100" carrier="netif"/>
...
</bond>
</interface>
This configuration does not contain the optional updelay and downdelay
attributes, but parsing will fail due to returning the result of
virXPathULong (a -1 when the attribute doesn't exist) from
virInterfaceDefParseBond after examining the updelay attribute.
While fixing this bug, cleanup the function to use virXPathInt instead
of virXPathULong, and store the result directly instead of using a tmp
variable. Using virXPathInt actually fixes a potential silent
truncation bug noted by Eric Blake.
Also, there is no cleaup in the error label. Remove the label,
returning failure where failure occurs and success if the end of the
function is reached.
---
V2:
Use virXPathInt instead of virXPathULong to avoid silent truncation,
and store value directly in the def structure instead of using a tmp
variable.
src/conf/interface_conf.c | 63 ++++++++++++++++++++---------------------------
1 file changed, 27 insertions(+), 36 deletions(-)
diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index 9301ec0..7ca9c86 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -572,81 +572,72 @@ error:
static int
virInterfaceDefParseBond(virInterfaceDefPtr def,
xmlXPathContextPtr ctxt) {
- int ret = -1;
- unsigned long tmp;
+ int res;
def->data.bond.mode = virInterfaceDefParseBondMode(ctxt);
if (def->data.bond.mode < 0)
- goto error;
+ return -1;
- ret = virInterfaceDefParseBondItfs(def, ctxt);
- if (ret != 0)
- goto error;
+ if (virInterfaceDefParseBondItfs(def, ctxt) != 0)
+ return -1;
if (virXPathNode("./miimon[1]", ctxt) != NULL) {
def->data.bond.monit = VIR_INTERFACE_BOND_MONIT_MII;
- ret = virXPathULong("string(./miimon/@freq)", ctxt, &tmp);
- if ((ret == -2) || (ret == -1)) {
+ res = virXPathInt("string(./miimon/@freq)", ctxt,
+ &def->data.bond.frequency);
+ if ((res == -2) || (res == -1)) {
virReportError(VIR_ERR_XML_ERROR,
"%s", _("bond interface miimon freq missing or invalid"));
- goto error;
+ return -1;
}
- def->data.bond.frequency = (int) tmp;
- ret = virXPathULong("string(./miimon/@downdelay)", ctxt, &tmp);
- if (ret == -2) {
+ res = virXPathInt("string(./miimon/@downdelay)", ctxt,
+ &def->data.bond.downdelay);
+ if (res == -2) {
virReportError(VIR_ERR_XML_ERROR,
"%s", _("bond interface miimon downdelay invalid"));
- goto error;
- } else if (ret == 0) {
- def->data.bond.downdelay = (int) tmp;
+ return -1;
}
- ret = virXPathULong("string(./miimon/@updelay)", ctxt, &tmp);
- if (ret == -2) {
+ res = virXPathInt("string(./miimon/@updelay)", ctxt,
+ &def->data.bond.updelay);
+ if (res == -2) {
virReportError(VIR_ERR_XML_ERROR,
"%s", _("bond interface miimon updelay invalid"));
- goto error;
- } else if (ret == 0) {
- def->data.bond.updelay = (int) tmp;
+ return -1;
}
def->data.bond.carrier = virInterfaceDefParseBondMiiCarrier(ctxt);
- if (def->data.bond.carrier < 0) {
- ret = -1;
- goto error;
- }
+ if (def->data.bond.carrier < 0)
+ return -1;
} else if (virXPathNode("./arpmon[1]", ctxt) != NULL) {
def->data.bond.monit = VIR_INTERFACE_BOND_MONIT_ARP;
- ret = virXPathULong("string(./arpmon/@interval)", ctxt, &tmp);
- if ((ret == -2) || (ret == -1)) {
+ res = virXPathInt("string(./arpmon/@interval)", ctxt,
+ &def->data.bond.interval);
+ if ((res == -2) || (res == -1)) {
virReportError(VIR_ERR_XML_ERROR,
"%s", _("bond interface arpmon interval missing or invalid"));
- goto error;
+ return -1;
}
- def->data.bond.interval = (int) tmp;
def->data.bond.target =
virXPathString("string(./arpmon/@target)", ctxt);
if (def->data.bond.target == NULL) {
virReportError(VIR_ERR_XML_ERROR,
"%s", _("bond interface arpmon target missing"));
- ret = -1;
- goto error;
+ return -1;
}
def->data.bond.validate = virInterfaceDefParseBondArpValid(ctxt);
- if (def->data.bond.validate < 0) {
- ret = -1;
- goto error;
- }
+ if (def->data.bond.validate < 0)
+ return -1;
}
-error:
- return ret;
+
+ return 0;
}
static int
--
1.8.0.1
11 years, 9 months
[libvirt] Schedule for the next release suggestions
by Daniel Veillard
The 1.0.3 release was on the 5th March, and right now we have
accumulated 'only' 150 commits since the release. Based on this I
would suggest to wait a couple of weeks before to enter a freeze
for the following release. This mean we drift from the usual end
of month, but the ratio of freeze/devel will remain more or less
constant as well as the expected size of change in the new release.
So if this is fine I would suggest to enter freeze for 1.0.4
on the 5th of April for a release around the 12. Unless there is
a reason to push a release earlier,
Opinions ?
Daniel
--
Daniel Veillard | Open Source and Standards, Red Hat
veillard(a)redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | virtualization library http://libvirt.org/
11 years, 9 months
[libvirt] Build failed in Jenkins: libvirt-syntax-check #759
by Jenkins CI
See <http://honk.sigxcpu.org:8001/job/libvirt-syntax-check/759/>
------------------------------------------
Started by upstream project "libvirt-build" build number 856
[workspace] $ /bin/sh -xe /tmp/hudson8330114436432330964.sh
+ make syntax-check
GEN bracket-spacing-check
GFDL_version
0.88 GFDL_version
TAB_in_indentation
0.59 TAB_in_indentation
Wundef_boolean
0.38 Wundef_boolean
avoid_attribute_unused_in_header
0.40 avoid_attribute_unused_in_header
avoid_ctype_macros
0.81 avoid_ctype_macros
avoid_if_before_free
8.18 avoid_if_before_free
avoid_strcase
0.91 avoid_strcase
avoid_write
0.55 avoid_write
bindtextdomain
0.46 bindtextdomain
cast_of_argument_to_free
0.76 cast_of_argument_to_free
cast_of_x_alloc_return_value
0.73 cast_of_x_alloc_return_value
changelog
0.32 changelog
const_long_option
0.52 const_long_option
copyright_address
0.87 copyright_address
copyright_check
1.06 copyright_check
copyright_format
2.39 copyright_format
correct_id_types
1.00 correct_id_types
error_message_period
0.72 error_message_period
error_message_warn_fatal
0.73 error_message_warn_fatal
flags_debug
1.72 flags_debug
flags_usage
1.68 flags_usage
libvirt_unmarked_diagnostics
2.57 libvirt_unmarked_diagnostics
m4_quote_check
0.38 m4_quote_check
makefile_TAB_only_indentation
0.37 makefile_TAB_only_indentation
makefile_at_at_check
0.31 makefile_at_at_check
po_check
19.90 po_check
preprocessor_indentation
maint.mk: skipping test sc_preprocessor_indentation: cppi not installed
0.06 preprocessor_indentation
prohibit_HAVE_MBRTOWC
0.86 prohibit_HAVE_MBRTOWC
prohibit_PATH_MAX
0.87 prohibit_PATH_MAX
prohibit_VIR_ERR_NO_MEMORY
0.83 prohibit_VIR_ERR_NO_MEMORY
prohibit_access_xok
0.88 prohibit_access_xok
prohibit_always-defined_macros
3.47 prohibit_always-defined_macros
prohibit_always_true_header_tests
0.95 prohibit_always_true_header_tests
prohibit_argmatch_without_use
grep: write error
grep: write error
sed: couldn't write 1 item to stdout: Broken pipe
sed: couldn't write 49 items to stdout: Broken pipe
0.58 prohibit_argmatch_without_use
prohibit_asprintf
0.90 prohibit_asprintf
prohibit_assert_without_use
grep: write error
grep: write error
sed: couldn't write 1 item to stdout: Broken pipe
sed: couldn't write 49 items to stdout: Broken pipe
0.61 prohibit_assert_without_use
prohibit_backup_files
0.22 prohibit_backup_files
prohibit_c_ctype_without_use
grep: write error
grep: write error
sed: couldn't write 1 item to stdout: Broken pipe
sed: couldn't write 49 items to stdout: Broken pipe
0.58 prohibit_c_ctype_without_use
prohibit_canonicalize_without_use
grep: write error
grep: write error
sed: couldn't write 1 item to stdout: Broken pipe
sed: couldn't write 49 items to stdout: Broken pipe
0.57 prohibit_canonicalize_without_use
prohibit_cloexec_without_use
grep: write error
grep: write error
sed: couldn't write 1 item to stdout: Broken pipe
sed: couldn't write 49 items to stdout: Broken pipe
0.57 prohibit_cloexec_without_use
prohibit_close
1.70 prohibit_close
prohibit_close_stream_without_use
grep: write error
grep: write error
sed: couldn't write 1 item to stdout: Broken pipe
sed: couldn't write 49 items to stdout: Broken pipe
0.70 prohibit_close_stream_without_use
prohibit_cross_inclusion
9.89 prohibit_cross_inclusion
prohibit_ctype_h
0.87 prohibit_ctype_h
prohibit_cvs_keyword
0.89 prohibit_cvs_keyword
prohibit_defined_have_decl_tests
0.87 prohibit_defined_have_decl_tests
prohibit_diagnostic_without_format
1.95 prohibit_diagnostic_without_format
prohibit_dirent_without_use
grep: write error
grep: write error
sed: couldn't write 1 item to stdout: Broken pipe
sed: couldn't write 49 items to stdout: Broken pipe
0.61 prohibit_dirent_without_use
prohibit_doubled_word
8.83 prohibit_doubled_word
prohibit_empty_lines_at_EOF
0.52 prohibit_empty_lines_at_EOF
prohibit_error_without_use
grep: write error
grep: write error
sed: couldn't write 1 item to stdout: Broken pipe
sed: couldn't write 49 items to stdout: Broken pipe
0.58 prohibit_error_without_use
prohibit_exit_in_tests
0.72 prohibit_exit_in_tests
prohibit_fork_wrappers
0.99 prohibit_fork_wrappers
prohibit_gethostby
0.86 prohibit_gethostby
prohibit_gethostname
0.88 prohibit_gethostname
prohibit_getopt_without_use
grep: write error
grep: write error
sed: couldn't write 1 item to stdout: Broken pipe
sed: couldn't write 49 items to stdout: Broken pipe
0.59 prohibit_getopt_without_use
prohibit_gettext_markup
0.92 prohibit_gettext_markup
prohibit_gettext_noop
0.86 prohibit_gettext_noop
prohibit_hash_pjw_without_use
grep: write error
grep: write error
sed: couldn't write 1 item to stdout: Broken pipe
sed: couldn't write 49 items to stdout: Broken pipe
0.57 prohibit_hash_pjw_without_use
prohibit_have_config_h
0.84 prohibit_have_config_h
prohibit_ignore_value_without_use
grep: write error
grep: write error
sed: couldn't write 1 item to stdout: Broken pipe
sed: couldn't write 49 items to stdout: Broken pipe
0.57 prohibit_ignore_value_without_use
prohibit_internal_functions
0.99 prohibit_internal_functions
prohibit_intprops_without_use
grep: write error
grep: write error
sed: couldn't write 1 item to stdout: Broken pipe
sed: couldn't write 49 items to stdout: Broken pipe
0.58 prohibit_intprops_without_use
prohibit_inttostr_without_use
grep: write error
grep: write error
sed: couldn't write 1 item to stdout: Broken pipe
sed: couldn't write 49 items to stdout: Broken pipe
0.56 prohibit_inttostr_without_use
prohibit_long_options_without_use
grep: write error
grep: write error
sed: couldn't write 1 item to stdout: Broken pipe
sed: couldn't write 49 items to stdout: Broken pipe
0.54 prohibit_long_options_without_use
prohibit_magic_number_exit
1.23 prohibit_magic_number_exit
prohibit_mkstemp
0.85 prohibit_mkstemp
prohibit_newline_at_end_of_diagnostic
0.95 prohibit_newline_at_end_of_diagnostic
prohibit_nonreentrant
38.00 prohibit_nonreentrant
prohibit_openat_without_use
grep: write error
grep: write error
sed: couldn't write 1 item to stdout: Broken pipe
sed: couldn't write 49 items to stdout: Broken pipe
0.57 prohibit_openat_without_use
prohibit_path_max_allocation
0.85 prohibit_path_max_allocation
prohibit_posixver_without_use
grep: write error
grep: write error
sed: couldn't write 1 item to stdout: Broken pipe
sed: couldn't write 49 items to stdout: Broken pipe
0.58 prohibit_posixver_without_use
prohibit_raw_allocation
1.02 prohibit_raw_allocation
prohibit_readlink
0.87 prohibit_readlink
prohibit_return_as_function
0.89 prohibit_return_as_function
prohibit_reversed_compare_failure
0.74 prohibit_reversed_compare_failure
prohibit_risky_id_promotion
0.97 prohibit_risky_id_promotion
prohibit_root_dev_ino_without_use
grep: write error
grep: write error
sed: couldn't write 1 item to stdout: Broken pipe
sed: couldn't write 49 items to stdout: Broken pipe
0.55 prohibit_root_dev_ino_without_use
prohibit_safe_read_without_use
grep: write error
grep: write error
sed: couldn't write 1 item to stdout: Broken pipe
sed: couldn't write 49 items to stdout: Broken pipe
0.58 prohibit_safe_read_without_use
prohibit_same_without_use
grep: write error
grep: write error
sed: couldn't write 1 item to stdout: Broken pipe
sed: couldn't write 49 items to stdout: Broken pipe
0.57 prohibit_same_without_use
prohibit_semicolon_at_eol_in_python
python/generator.py:1493: classes.write("=0");
maint.mk: Don't use semicolon at eol in python files
make: *** [sc_prohibit_semicolon_at_eol_in_python] Error 1
Build step 'Execute shell' marked build as failure
11 years, 9 months
[libvirt] [PATCH] [TCK] nwfilter: probe for inverted ctdir
by Stefan Berger
Linux netfilter at some point inverted the meaning of the '--ctdir reply'
and newer netfilter implementations now expect '--ctdir original'
instead and vice-versa.
We probe for this netfilter change via an IMCP message over loopback and 3
filtering rules applied to INPUT. If the sent byte arrives, the newer
netfilter implementation has been detected and we convert the strings
in the iptables output to now match that inversion implemented by libvirt.
The downside of this is that probing of libvirt and this test tool are
independent and this test tool will only work correctly for all cases
if used with libvirt probing for 'ctdir inversion' as well.
Signed-off-by: Stefan Berger <stefanb(a)linux.vnet.ibm.com>
---
scripts/nwfilter/nwfilter2vmtest.sh | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
Index: libvirt-tck/scripts/nwfilter/nwfilter2vmtest.sh
===================================================================
--- libvirt-tck.orig/scripts/nwfilter/nwfilter2vmtest.sh
+++ libvirt-tck/scripts/nwfilter/nwfilter2vmtest.sh
@@ -28,6 +28,10 @@ FLAG_LIBVIRT_TEST="$((1<<3))"
FLAG_TAP_TEST="$((1<<4))"
FLAG_FORCE_CLEAN="$((1<<5))"
+# --ctdir original vs. --ctdir reply's meaning was inverted in
+# netfilter at some point. We probe for it.
+IPTABLES_CTRDIR_CORRECTED=0
+
failctr=0
passctr=0
attachfailctr=0
@@ -100,6 +104,15 @@ mktmpdir() {
return 0
}
+probeIptablesCtdir() {
+ iptables -I INPUT 1 -i lo -p icmp -m state --state ESTABLISHED -j ACCEPT
+ iptables -I INPUT 2 -i lo -p icmp -m conntrack --ctdir ORIGINAL -j ACCEPT
+ iptables -I INPUT 3 -i lo -p icmp -j DROP
+ IPTABLES_CTDIR_CORRECTED=$(ping 127.0.0.1 -c 1 | sed -n 's/.*,
\([0-9]*\) received,.*/\1/p')
+ iptables -D INPUT -i lo -p icmp -m state --state ESTABLISHED -j ACCEPT
+ iptables -D INPUT -i lo -p icmp -m conntrack --ctdir ORIGINAL -j ACCEPT
+ iptables -D INPUT -i lo -p icmp -j DROP
+}
checkExpectedOutput() {
xmlfile="$1"
@@ -160,6 +173,14 @@ checkExpectedOutput() {
break
fi
+ if [ $IPTABLES_CTDIR_CORRECTED -ne 0 ]; then
+ #change --ctdir ORIGINAL to --ctdir REPLY
+ #and --ctdir REPLY to --ctdir ORIGINAL
+ sed -i "s/ctdir[ ]*ORIGINAL/ctdir _REPLY/" ${tmpfile}
+ sed -i "s/ctdir[ ]*REPLY/ctdir ORIGINAL/" ${tmpfile}
+ sed -i "s/ctdir _REPLY/ctdir REPLY/" ${tmpfile}
+ fi
+
diff -w ${tmpfile} ${tmpfile2} >/dev/null
if [ $? -ne 0 ]; then
@@ -551,6 +572,8 @@ main() {
echo "This script will only run on Linux."
fi
exit 1;
+ else
+ probeIptablesCtdir
fi
if [ $(($flags & $FLAG_TAP_TEST)) -ne 0 ]; then
11 years, 9 months
[libvirt] [PATCH] Fix thread safety in LXC callback handling
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Some of the LXC callbacks did not lock the virDomainObjPtr
instance. This caused transient errors like
error: Failed to start domain busy-mount
error: cannot rename file '/var/run/libvirt/lxc/busy-mount.xml.new' as '/var/run/libvirt/lxc/busy-mount.xml': No such file or directory
as 2 threads tried to update the status file concurrently
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/lxc/lxc_process.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 670a032..39a6ea2 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -610,8 +610,13 @@ static void virLXCProcessMonitorExitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED
virLXCMonitorExitStatus status,
virDomainObjPtr vm)
{
+ virLXCDriverPtr driver = lxc_driver;
virLXCDomainObjPrivatePtr priv = vm->privateData;
+ lxcDriverLock(driver);
+ virObjectLock(vm);
+ lxcDriverUnlock(driver);
+
switch (status) {
case VIR_LXC_MONITOR_EXIT_STATUS_SHUTDOWN:
priv->stopReason = VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN;
@@ -629,6 +634,8 @@ static void virLXCProcessMonitorExitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED
}
VIR_DEBUG("Domain shutoff reason %d (from status %d)",
priv->stopReason, status);
+
+ virObjectUnlock(vm);
}
static int
@@ -667,9 +674,15 @@ static void virLXCProcessMonitorInitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED
pid_t initpid,
virDomainObjPtr vm)
{
- virLXCDomainObjPrivatePtr priv = vm->privateData;
+ virLXCDriverPtr driver = lxc_driver;
+ virLXCDomainObjPrivatePtr priv;
ino_t inode;
+ lxcDriverLock(driver);
+ virObjectLock(vm);
+ lxcDriverUnlock(driver);
+
+ priv = vm->privateData;
priv->initpid = initpid;
if (virLXCProcessGetNsInode(initpid, "pid", &inode) < 0) {
@@ -684,6 +697,8 @@ static void virLXCProcessMonitorInitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED
if (virDomainSaveStatus(lxc_driver->xmlconf, lxc_driver->stateDir, vm) < 0)
VIR_WARN("Cannot update XML with PID for LXC %s", vm->def->name);
+
+ virObjectUnlock(vm);
}
static virLXCMonitorCallbacks monitorCallbacks = {
--
1.7.11.7
11 years, 9 months
[libvirt] [PATCH] Remove bogus filtering from virDomainGetRootFilesystem
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The virDomainGetRootFilesystem was only returning filesystems
with type=mount. This is bogus - any type of filesystem is
valid as the root, if dst=/.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/conf/domain_conf.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0ef67be..4cae0d3 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15635,9 +15635,6 @@ virDomainGetRootFilesystem(virDomainDefPtr def)
int i;
for (i = 0 ; i < def->nfss ; i++) {
- if (def->fss[i]->type != VIR_DOMAIN_FS_TYPE_MOUNT)
- continue;
-
if (STREQ(def->fss[i]->dst, "/"))
return def->fss[i];
}
--
1.7.11.7
11 years, 9 months
[libvirt] [PATCH] virsh: don't print --(null) in vol-name and vol-pool
by Ján Tomko
Don't print the pool option name if it's null.
Before:
virsh # vol-name vol
error: failed to get vol 'vol', specifying --(null) might help
error: Storage volume not found: no storage vol with matching path vol
After:
virsh # vol-name vol
error: failed to get vol 'vol'
error: Storage volume not found: no storage vol with matching path vol
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=924571
---
tools/virsh-volume.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index 89ad8ea..0ca295f 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -88,7 +88,7 @@ vshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
}
if (!vol) {
- if (pool)
+ if (pool || !pooloptname)
vshError(ctl, _("failed to get vol '%s'"), n);
else
vshError(ctl, _("failed to get vol '%s', specifying --%s "
--
1.8.1.5
11 years, 9 months
[libvirt] [PATCH] util: fix virAllocVar's comment
by Ján Tomko
---
Pushed under the trivial rule.
src/util/viralloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/viralloc.c b/src/util/viralloc.c
index 342b0eb..8f219bf 100644
--- a/src/util/viralloc.c
+++ b/src/util/viralloc.c
@@ -389,7 +389,7 @@ virDeleteElementsN(void *ptrptr, size_t size, size_t at,
}
/**
- * Vir_Alloc_Var:
+ * virAllocVar:
* @ptrptr: pointer to hold address of allocated memory
* @struct_size: size of initial struct
* @element_size: size of array elements
--
1.8.1.5
11 years, 9 months
[libvirt] [PATCH] viralloc: Export virAllocTest*
by Michal Privoznik
If users build with --enable-test-oom configure option,
they get this error saying, virAllocTest* functions are
not defined within tests/testutils.c.
---
src/libvirt_private.syms | 4 ++++
src/util/viralloc.c | 24 ++++++++++++++++++++++++
src/util/viralloc.h | 7 -------
tests/testutils.c | 2 +-
4 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 9529265..f241ec4 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -993,6 +993,10 @@ virSecurityManagerVerify;
# util/viralloc.h
virAlloc;
virAllocN;
+virAllocTestCount;
+virAllocTestHook;
+virAllocTestInit;
+virAllocTestOOM;
virAllocVar;
virDeleteElementsN;
virExpandN;
diff --git a/src/util/viralloc.c b/src/util/viralloc.c
index 807de04..342b0eb 100644
--- a/src/util/viralloc.c
+++ b/src/util/viralloc.c
@@ -74,6 +74,30 @@ static int virAllocTestFail(void)
testMallocNext++;
return fail;
}
+
+#else
+
+void virAllocTestOOM(int n ATTRIBUTE_UNUSED,
+ int m ATTRIBUTE_UNUSED)
+{
+ /* nada */
+}
+
+int virAllocTestCount(void)
+{
+ return 0;
+}
+
+void virAllocTestInit(void)
+{
+ /* nada */
+}
+
+void virAllocTestHook(void (*func)(int, void*) ATTRIBUTE_UNUSED,
+ void *data ATTRIBUTE_UNUSED)
+{
+ /* nada */
+}
#endif
diff --git a/src/util/viralloc.h b/src/util/viralloc.h
index 6f46d0b..7be7f82 100644
--- a/src/util/viralloc.h
+++ b/src/util/viralloc.h
@@ -376,15 +376,8 @@ void virFree(void *ptrptr) ATTRIBUTE_NONNULL(1);
# define VIR_FREE(ptr) virFree((void *) &(ptr))
# endif
-
-
-# if TEST_OOM
void virAllocTestInit(void);
int virAllocTestCount(void);
void virAllocTestOOM(int n, int m);
void virAllocTestHook(void (*func)(int, void*), void *data);
-# endif
-
-
-
#endif /* __VIR_MEMORY_H_ */
diff --git a/tests/testutils.c b/tests/testutils.c
index ea46c09..0fb69ec 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -697,7 +697,7 @@ int virtTestMain(int argc,
if (worker) {
_exit(ret);
} else {
- int i, status;
+ int i;
for (i = 0 ; i < mp ; i++) {
if (virProcessWait(workers[i], NULL) < 0)
ret = EXIT_FAILURE;
--
1.8.1.5
11 years, 9 months