[libvirt] [RFC] Create ptmx as a device
by Serge Hallyn
Hi,
I'm seeing an issue with udev and libvirt-lxc. Libvirt-lxc creates
/dev/ptmx as a symlink to /dev/pts/ptmx. When udev starts up, it
checks the device type, sees ptmx is 'not right', and replaces it
with a 'proper' ptmx.
In lxc, /dev/ptmx is bind-mounted from /dev/pts/ptmx instead of being
symlinked, so udev sees the right device type and leaves it alone.
A patch like the following seems to work for me. Would there be
any objections to this?
>From 4c5035de52de7e06a0de9c5d0bab8c87a806cba7 Mon Sep 17 00:00:00 2001
From: Ubuntu <ubuntu(a)domU-12-31-39-14-F0-B3.compute-1.internal>
Date: Wed, 31 Aug 2011 18:15:54 +0000
Subject: [PATCH 1/1] make ptmx a bind mount rather than symlink
udev on some systems checks the device type of /dev/ptmx, and replaces it if
not as expected. The symlink created by libvirt-lxc therefore gets replaced.
By creating it as a bind mount, the device type is correct and udev leaves it
alone.
Signed-off-by: Serge Hallyn <serge.hallyn(a)canonical.com>
---
src/lxc/lxc_container.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index e425328..6991aec 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -543,18 +543,18 @@ static int lxcContainerPopulateDevices(void)
}
}
+ dev_t dev = makedev(LXC_DEV_MAJ_TTY, LXC_DEV_MIN_PTMX);
+ if (mknod("/dev/ptmx", S_IFCHR, dev) < 0 ||
+ chmod("/dev/ptmx", 0666)) {
+ virReportSystemError(errno, "%s",
+ _("Failed to make device /dev/ptmx"));
+ return -1;
+ }
+
if (access("/dev/pts/ptmx", W_OK) == 0) {
- if (symlink("/dev/pts/ptmx", "/dev/ptmx") < 0) {
- virReportSystemError(errno, "%s",
- _("Failed to create symlink /dev/ptmx to /dev/pts/ptmx"));
- return -1;
- }
- } else {
- dev_t dev = makedev(LXC_DEV_MAJ_TTY, LXC_DEV_MIN_PTMX);
- if (mknod("/dev/ptmx", S_IFCHR, dev) < 0 ||
- chmod("/dev/ptmx", 0666)) {
+ if (mount("/dev/pts/ptmx", "/dev/ptmx", "ptmx", MS_BIND, NULL) < 0) {
virReportSystemError(errno, "%s",
- _("Failed to make device /dev/ptmx"));
+ _("Failed to bind-mount /dev/ptmx to /dev/pts/ptmx"));
return -1;
}
}
--
1.7.5.4
13 years, 2 months
[libvirt] [PATCH 1/2] BlockJob: Bandwidth parameter is in MB when using text monitor
by Adam Litke
Due to an unfortunate precedent in qemu, the units for the bandwidth parameter
to block_job_set_speed are different between the text monitor and the qmp
monitor. While the qmp monitor uses bytes/s, the text monitor expects MB/s.
Correct the units for the text interface.
Signed-off-by: Adam Litke <agl(a)us.ibm.com>
---
src/qemu/qemu_monitor_text.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index f37c98c..854ee7f 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -3067,8 +3067,7 @@ int qemuMonitorTextBlockJob(qemuMonitorPtr mon,
ret = virAsprintf(&cmd, "%s", cmd_name);
} else if (mode == BLOCK_JOB_SPEED) {
cmd_name = "block_job_set_speed";
- ret = virAsprintf(&cmd, "%s %s %llu", cmd_name, device,
- bandwidth * 1024ULL * 1024ULL);
+ ret = virAsprintf(&cmd, "%s %s %luM", cmd_name, device, bandwidth);
} else if (mode == BLOCK_JOB_PULL) {
cmd_name = "block_stream";
ret = virAsprintf(&cmd, "%s %s", cmd_name, device);
--
1.7.3
13 years, 2 months
[libvirt] [PATCH] BlockPull: Set initial bandwidth limit if specified
by Adam Litke
The libvirt BlockPull API supports the use of an initial bandwidth limit but the
qemu block_stream API does not. To get the desired behavior we use the two APIs
strung together: first BlockPull, then BlockJobSetSpeed. We can do this at the
driver level to avoid duplicated code in each monitor path.
Signed-off-by: Adam Litke <agl(a)us.ibm.com>
---
src/qemu/qemu_driver.c | 8 +++++++-
src/qemu/qemu_monitor_json.c | 4 ----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4e8c691..7476bb4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -9418,8 +9418,14 @@ static int
qemuDomainBlockPull(virDomainPtr dom, const char *path, unsigned long bandwidth,
unsigned int flags)
{
+ int ret;
+
virCheckFlags(0, -1);
- return qemuDomainBlockJobImpl(dom, path, bandwidth, NULL, BLOCK_JOB_PULL);
+ ret = qemuDomainBlockJobImpl(dom, path, bandwidth, NULL, BLOCK_JOB_PULL);
+ if (ret == 0 && bandwidth != 0)
+ ret = qemuDomainBlockJobImpl(dom, path, bandwidth, NULL,
+ BLOCK_JOB_SPEED);
+ return ret;
}
static virDriver qemuDriver = {
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 715b26e..4ceb536 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2956,10 +2956,6 @@ int qemuMonitorJSONBlockJob(qemuMonitorPtr mon,
if (ret == 0 && mode == BLOCK_JOB_INFO)
ret = qemuMonitorJSONGetBlockJobInfo(reply, device, info);
- if (ret == 0 && mode == BLOCK_JOB_PULL && bandwidth != 0)
- ret = qemuMonitorJSONBlockJob(mon, device, bandwidth, NULL,
- BLOCK_JOB_SPEED);
-
virJSONValueFree(cmd);
virJSONValueFree(reply);
return ret;
--
1.7.3
13 years, 2 months
[libvirt] [PATCH] Increase size of buffer for xend response
by Jim Fehlig
On systems with many pcpus, the sexpr returned by xend can be quite
large for dom0 when it is configured to have #vcpus = #pcpus (default).
E.g. on a 80 pcpu system, where dom0 had 80 vcpus, the sexpr details
for dom0 was 73817 bytes! Increase maximum buffer size to 256k.
---
src/xen/xend_internal.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 957cd17..1fdebe1 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -56,7 +56,7 @@
* The number of Xen scheduler parameters
*/
-#define XEND_RCV_BUF_MAX_LEN 65536
+#define XEND_RCV_BUF_MAX_LEN 262144
static int
virDomainXMLDevID(virDomainPtr domain,
--
1.7.5.4
13 years, 2 months
[libvirt] [PATCH] Don't overwrite errors from xend_{get,req}
by Jim Fehlig
xenDaemonDomainFetch() was overwriting errors reported by
xend_get() and xend_req(). E.g. without patch
error: failed Xen syscall xenDaemonDomainFetch failed to find this domain
with patch
error: internal error Xend returned HTTP Content-Length of 73817, which exceeds maximum of 65536
---
src/xen/xend_internal.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index f44d674..957cd17 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -359,8 +359,10 @@ xend_get(virConnectPtr xend, const char *path,
ret = xend_req(s, content);
VIR_FORCE_CLOSE(s);
- if (((ret < 0) || (ret >= 300)) &&
- ((ret != 404) || (!STRPREFIX(path, "/xend/domain/")))) {
+ if (ret < 0)
+ return ret;
+
+ if ((ret >= 300) && ((ret != 404) || (!STRPREFIX(path, "/xend/domain/")))) {
virXendError(VIR_ERR_GET_FAILED,
_("%d status from xen daemon: %s:%s"),
ret, path, NULLSTR(*content));
@@ -1810,12 +1812,8 @@ xenDaemonDomainFetch(virConnectPtr conn,
root = sexpr_get(conn, "/xend/domain/%s?detail=1", name);
else
root = sexpr_get(conn, "/xend/domain/%d?detail=1", domid);
- if (root == NULL) {
- virXendError(VIR_ERR_XEN_CALL,
- "%s", _("xenDaemonDomainFetch failed to"
- " find this domain"));
+ if (root == NULL)
return (NULL);
- }
priv = (xenUnifiedPrivatePtr) conn->privateData;
--
1.7.5.4
13 years, 2 months
[libvirt] [PATCH] Change my email domain
by Jim Fehlig
I'd like to change my primary email address to jfehlig(a)suse.com.
This patch changes it in AUTHORS and .mailmap.
---
.mailmap | 3 ++-
AUTHORS | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/.mailmap b/.mailmap
index cdfd9fd..2795047 100644
--- a/.mailmap
+++ b/.mailmap
@@ -13,7 +13,8 @@
<meyering(a)redhat.com> <jim(a)meyering.net>
<socketpair(a)gmail.com> <socketpair gmail com>
<soren(a)linux2go.dk> <soren(a)ubuntu.com>
-<jfehlig(a)novell.com> <jfehlig(a)linux-ypgk.site>
+<jfehlig(a)suse.com> <jfehlig(a)novell.com>
+<jfehlig(a)suse.com> <jfehlig(a)linux-ypgk.site>
<jclift(a)redhat.com> <justin(a)salasaga.org>
<berrange(a)redhat.com> <dan(a)berrange.com>
<soren(a)linux2go.dk> <soren(a)canonical.com>
diff --git a/AUTHORS b/AUTHORS
index 6cf2cd5..3dc34e9 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -13,7 +13,7 @@ The primary maintainers and people with commit access rights:
Mark McLoughlin <markmc(a)redhat.com>
Anthony Liguori <aliguori(a)us.ibm.com>
Jim Meyering <meyering(a)redhat.com>
- Jim Fehlig <jfehlig(a)novell.com>
+ Jim Fehlig <jfehlig(a)suse.com>
Chris Lalancette <clalance(a)redhat.com>
Cole Robinson <crobinso(a)redhat.com>
Guido Günther <agx(a)sigxcpu.org>
--
1.7.5.4
13 years, 2 months
[libvirt] [PATCHv3 00/43] cleaned up snapshot series
by Eric Blake
As promised, here is my v3, which includes all the self-replies
I was scattering throughout v2:
https://www.redhat.com/archives/libvir-list/2011-August/msg00620.html
Also available here:
git fetch git://repo.or.cz/libvirt/ericb.git snapshot
or browse online at:
http://repo.or.cz/w/libvirt/ericb.git/shortlog/refs/heads/snapshot
I've tested that this can create external disk snapshots with
SELinux running using the qemu snapshot_blkdev monitor command,
then deleting the metadata for those snapshots.
Other things from my RFC still remain to be coded:
https://www.redhat.com/archives/libvir-list/2011-August/msg00361.html
support for offline external disk snapshots
support for more flags (such as starting an offline snapshot on revert)
support for revert and delete of disk snapshots
new apis for easier manipulation of snapshot hierarchies
Eric Blake (43):
snapshot: better event when reverting qemu to paused snapshot
snapshot: improve reverting to qemu paused snapshots
snapshot: properly revert qemu to offline snapshots
snapshot: don't leak resources on qemu snapshot failure
snapshot: only pass snapshot to qemu command line when reverting
snapshot: track current snapshot across restarts
snapshot: allow deletion of just snapshot metadata
snapshot: avoid crash when deleting qemu snapshots
snapshot: simplify acting on just children
snapshot: let qemu discard only snapshot metadata
snapshot: identify which snapshots have metadata
snapshot: identify qemu snapshot roots
snapshot: prevent stranding snapshot data on domain destruction
snapshot: refactor some qemu code
snapshot: cache qemu-img location
snapshot: support new undefine flags in qemu
snapshot: teach virsh about new undefine flags
snapshot: prevent migration from stranding snapshot data
snapshot: refactor domain xml output
snapshot: allow full domain xml in snapshot
snapshot: correctly escape generated xml
snapshot: update rng to support full domain in xml
snapshot: store qemu domain details in xml
snapshot: additions to domain xml for disks
snapshot: reject transient disks where code is not ready
snapshot: reflect recent options in virsh
snapshot: introduce new deletion flag
snapshot: expose new delete flag in virsh
snapshot: allow halting after snapshot
snapshot: refactor virsh snapshot creation
snapshot: expose halt-after-creation in virsh
snapshot: wire up new qemu monitor command
snapshot: support extra state in snapshots
snapshot: add <disks> to snapshot xml
snapshot: also support disks by path
snapshot: add virsh domblklist command
snapshot: add flag for requesting disk snapshot
snapshot: reject unimplemented disk snapshot features
snapshot: make it possible to audit external snapshot
snapshot: wire up disk-only flag to snapshot-create
snapshot: wire up live qemu disk snapshots
snapshot: refactor qemu file opening
snapshot: use SELinux and lock manager with external snapshots
docs/formatdomain.html.in | 40 +-
docs/formatsnapshot.html.in | 253 ++-
docs/schemas/Makefile.am | 1 +
docs/schemas/domain.rng | 2555 +-------------------
docs/schemas/{domain.rng => domaincommon.rng} | 32 +-
docs/schemas/domainsnapshot.rng | 89 +-
include/libvirt/libvirt.h.in | 62 +-
src/conf/domain_audit.c | 12 +-
src/conf/domain_audit.h | 4 +-
src/conf/domain_conf.c | 861 ++++++--
src/conf/domain_conf.h | 75 +-
src/esx/esx_driver.c | 41 +-
src/libvirt.c | 132 +-
src/libvirt_private.syms | 8 +
src/libxl/libxl_conf.c | 5 +
src/libxl/libxl_driver.c | 11 +-
src/qemu/qemu_command.c | 12 +-
src/qemu/qemu_conf.h | 1 +
src/qemu/qemu_driver.c | 1611 +++++++++----
src/qemu/qemu_hotplug.c | 18 +-
src/qemu/qemu_migration.c | 2 +-
src/qemu/qemu_monitor.c | 24 +
src/qemu/qemu_monitor.h | 4 +
src/qemu/qemu_monitor_json.c | 33 +
src/qemu/qemu_monitor_json.h | 4 +
src/qemu/qemu_monitor_text.c | 40 +
src/qemu/qemu_monitor_text.h | 4 +
src/qemu/qemu_process.c | 21 +-
src/qemu/qemu_process.h | 1 +
src/uml/uml_driver.c | 56 +-
src/vbox/vbox_tmpl.c | 46 +-
src/xen/xend_internal.c | 12 +-
src/xenxs/xen_sxpr.c | 5 +
src/xenxs/xen_xm.c | 5 +
tests/domainsnapshotxml2xmlin/disk_snapshot.xml | 16 +
tests/domainsnapshotxml2xmlout/disk_snapshot.xml | 77 +
tests/domainsnapshotxml2xmlout/full_domain.xml | 35 +
.../qemuxml2argv-disk-snapshot.args | 7 +
.../qemuxml2argv-disk-snapshot.xml | 39 +
.../qemuxml2argv-disk-transient.xml | 27 +
tests/qemuxml2argvtest.c | 2 +
tools/virsh.c | 755 +++++-
tools/virsh.pod | 111 +-
43 files changed, 3616 insertions(+), 3533 deletions(-)
copy docs/schemas/{domain.rng => domaincommon.rng} (98%)
create mode 100644 tests/domainsnapshotxml2xmlin/disk_snapshot.xml
create mode 100644 tests/domainsnapshotxml2xmlout/disk_snapshot.xml
create mode 100644 tests/domainsnapshotxml2xmlout/full_domain.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-transient.xml
--
1.7.4.4
13 years, 2 months
[libvirt] Problems with "attach-interface" command of libvirt
by Tao Siheng
Dear libvirt-developer:
I'm a student of computer science and technology in China. I encountered a problem when I want to attach a bridge to an existed Virtual Machine.
I used the command "attach-interface domain_id bridge br0 --target tap0". "br0" was created by brctl and "tap0" was created by tunctl.Here is the error information:
error: Failed to attach interface
error: internal error unable to send TAP file handle: No file descriptor supplied via SCM_RIGHTS.
I know there are some bugs in the earlier version of libvirt. So I upgraded the ubuntu kernel to 2.6.38.8 and added the module "macvtap" by the using the command "sudo modprobe macvtap". I have installed libvirt0.8.8, QEMU 0.8.8 and QEMU 0.12.3.Although I did all the above, the problem is still not solved.
I need your help sincerely.
Tao Siheng
2011.9.1
13 years, 2 months
[libvirt] [PATCH] virsh: improve send-key documentation
by Eric Blake
The 'virsh man' description of send-key was incomplete and used the
old style (literal 'optional name' instead of '[name]' metasyntax).
Meanwhile, none of the other virsh help texts include examples, so
I moved it out of virsh help and into the man page.
* tools/virsh.pod (send-key): Give better details.
* tools/virsh.c (info_send_key): Drop example from here.
---
Red Hat QE found this: https://bugzilla.redhat.com/show_bug.cgi?id=699847
tools/virsh.c | 13 ++++---------
tools/virsh.pod | 20 +++++++++++++++++---
2 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 49034ae..8500a03 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -3718,21 +3718,16 @@ cmdInjectNMI(vshControl *ctl, const vshCmd *cmd)
*/
static const vshCmdInfo info_send_key[] = {
{"help", N_("Send keycodes to the guest")},
- {"desc", N_("Send keycodes to the guest, the keycodes must be integers\n"
- " Examples:\n\n"
- " virsh # send-key <domain> 37 18 21\n"
- " virsh # send-key <domain> KEY_RIGHTCTRL KEY_C\n"
- " virsh # send-key <domain> --codeset xt 37 18 21\n"
- " virsh # send-key <domain> --holdtime 1000 0x15 18 0xf\n"
- )},
+ {"desc", N_("Send keycodes (integers or symbolic names) to the guest")},
{NULL, NULL}
};
static const vshCmdOptDef opts_send_key[] = {
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
- {"codeset", VSH_OT_STRING, VSH_OFLAG_REQ_OPT, N_("the codeset of keycodes, default:linux")},
+ {"codeset", VSH_OT_STRING, VSH_OFLAG_REQ_OPT,
+ N_("the codeset of keycodes, default:linux")},
{"holdtime", VSH_OT_INT, VSH_OFLAG_REQ_OPT,
- N_("the time (in millsecond) how long the keys will be held")},
+ N_("the time (in millseconds) how long the keys will be held")},
{"keycode", VSH_OT_ARGV, VSH_OFLAG_REQ, N_("the key code")},
{NULL, 0, 0, NULL}
};
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 2cd0f73..5c417f9 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -310,9 +310,23 @@ running B<virsh suspend>. When in a paused state the domain will still
consume allocated resources like memory, but will not be eligible for
scheduling by the hypervisor.
-=item B<send-key> I<domain-id> optional I<--codeset> B<codeset> optional I<--holdtime> B<holdtime> B<keycode>...
-
-Send keys to the guest
+=item B<send-key> I<domain-id> [I<--codeset> B<codeset>]
+[I<--holdtime> B<holdtime>] I<keycode>...
+
+Parse the I<keycode> sequence as keystrokes to send to I<domain-id>.
+Each I<keycode> can either be a numeric value or a symbolic name from
+the corresponding codeset. The default code set is B<linux>, but
+use of I<--codeset> can specify B<xt>, B<atset1>, B<atset2>, B<atset3>,
+B<os_x>, B<xt_kbd>, B<usb>, B<win32>, or B<rfb> instead. If I<--holdtime>
+is given, each keystroke will be held for that many milliseconds.
+
+B<Examples>
+ # send three strokes 'k', 'e', 'y', using xt codeset
+ virsh send-key dom --codeset xt 37 18 21
+ # send one stroke 'right-ctrl+C'
+ virsh send-key dom KEY_RIGHTCTRL KEY_C
+ # send a tab, held for 1 second
+ virsh send-key --holdtime 1000 0xf
=item B<shutdown>
--
1.7.4.4
13 years, 2 months
[libvirt] [PATCH] build: fix 'make check' with pdwtags
by Eric Blake
Problem introduced by commit b12354b.
* src/remote_protocol-structs: Remove spurious blank line.
---
Pushing under the build-breaker rule. It only affects people that
have pdwtags (from the dwarves package) installed.
src/remote_protocol-structs | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index 0498bd1..bb5ec44 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -1436,7 +1436,6 @@ struct remote_domain_migrate_get_max_speed_args {
struct remote_domain_migrate_get_max_speed_ret {
uint64_t bandwidth;
};
-
struct remote_domain_events_register_any_args {
int eventID;
};
--
1.7.4.4
13 years, 2 months