[libvirt] Add hyperthreaded sibling info to virsh capabilities
by Dusty Mabe
Hi,
Would it be possible to augment the output produced in virsh
capabilities to also provide the hyperthreaded sibling of a processor?
For example the information would look something like:
<topology>
<cells num='2'>
<cell id='0'>
<cpus num='8'>
<cpu id='1' sibling='9'/>
<cpu id='3' sibling='11'/>
<cpu id='5' sibling='13'/>
<cpu id='7' sibling='15'/>
<cpu id='9' sibling='`1'/>
<cpu id='11' sibling='3'/>
<cpu id='13' sibling='5'/>
<cpu id='15' sibling='7'/>
</cpus>
</cell>
<cell id='1'>
<cpus num='8'>
<cpu id='0' sibling='8'/>
<cpu id='2' sibling='10'/>
<cpu id='4' sibling='12'/>
<cpu id='6' sibling='14'/>
<cpu id='8' sibling='0'/>
<cpu id='10' sibling='2'/>
<cpu id='12' sibling='4'/>
<cpu id='14' sibling='6'/>
</cpus>
</cell>
</cells>
</topology>
I notice that you guys are actually using some of the numactl stuff
(numa.h) to query for the cpus on a given node and I have combed
through that code to see if it provided any info about hyperthreaded
siblings but from what I can tell it does not. I have tinkered around
with the hwloc libraries (http://www.open-mpi.org/projects/hwloc/) and
have written a short program to print out each logical cpu and its
hyperthreaded sibling (see attached)
The output from it looks like so:
[root@hostname ~]# ./a.out
*** PU: 0 Hyperthreaded Sibling: 8
*** PU: 8 Hyperthreaded Sibling: 0
*** PU: 2 Hyperthreaded Sibling: 10
*** PU: 10 Hyperthreaded Sibling: 2
*** PU: 4 Hyperthreaded Sibling: 12
*** PU: 12 Hyperthreaded Sibling: 4
*** PU: 6 Hyperthreaded Sibling: 14
*** PU: 14 Hyperthreaded Sibling: 6
*** PU: 1 Hyperthreaded Sibling: 9
*** PU: 9 Hyperthreaded Sibling: 1
*** PU: 3 Hyperthreaded Sibling: 11
*** PU: 11 Hyperthreaded Sibling: 3
*** PU: 5 Hyperthreaded Sibling: 13
*** PU: 13 Hyperthreaded Sibling: 5
*** PU: 7 Hyperthreaded Sibling: 15
*** PU: 15 Hyperthreaded Sibling: 7
Would you guys ever consider adding something like this? I would be
willing to help create a patch if I had some guidance.
Thanks for your time,
Dusty Mabe
12 years
[libvirt] [PATCH 0/2] make external snapshots easier in virsh
by Eric Blake
Creating external snapshots with 'virsh snapshot-create' is awkward,
as it requires quite a bit of XML. This adds support in the
snapshot-create-as command to make the task easier.
Eric Blake (2):
virsh: make ,, escape parsing common
virsh: add snapshot-create-as memspec support
tests/virsh-optparse | 5 ++-
tools/virsh-snapshot.c | 102 ++++++++++++++++++++++++++++++++++++-------------
tools/virsh.c | 53 +++++++++++++++----------
tools/virsh.pod | 17 ++++++---
4 files changed, 122 insertions(+), 55 deletions(-)
--
1.7.11.7
12 years
[libvirt] [PATCH v2 0/2] Emit more events
by Michal Privoznik
diff to v1:
-a new event invented
-more APIs updated
Michal Privoznik (2):
Introduce new VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR event
qemu: Emit event if 'cont' fails
examples/domain-events/events-c/event-test.c | 3 +
examples/domain-events/events-python/event-test.py | 2 +-
include/libvirt/libvirt.h.in | 1 +
src/qemu/qemu_driver.c | 59 ++++++++++++++------
4 files changed, 47 insertions(+), 18 deletions(-)
--
1.7.8.6
12 years
[libvirt] Limit autostarting of domains to a few at a time.
by Ruben Kerkhof
Hi list,
I have about a hundred kvm vm's on a physical host, all marked as autostart.
As soon as libvirtd starts up, all vms get started and they start
fighting for disk I/O.
Would it be possible to add an option to wait a while before starting
the next vm?
Batch-starting them in parallel, let's say 10 at a time, would be great too.
I know I could use the libvirt-guest init script to do this, but we
rely on the autostart property for several purposes.
Kind regards,
Ruben Kerkhof
12 years
[libvirt] Using Generic Ethernet type with custom networking without lowering the host security level
by Ishimoto, Ryu
Hi Everyone,
I wanted to ask a question about the 'generic ethernet' NIC type. If I
understand its security concerns correctly, because it expects QEMU to
execute scripts to bring up/down the interface, it requires that the host
security level is lowered to allow QEMU to perform privileged operations.
While this is definitely not desirable, I'm have a situation where I want
to use libvirt to work with a custom networking solution that is neither
Linux bridge or OpenVSwitch. Currently, to make this happen, I would
create a tap interface myself, configure it(like adding it to the
datapath), and inform libvirt of this interface as a generic ethernet type
with script attribute set to ''. In order to make this work without the
security issue mentioned, I would like to suggest a new device type(or just
a modification of generic ethernet type) in which libvirt accepts an
interface name, opens it and gets its fd, and passes the fd to QEMU. QEMU
does not run any scripts and expects the tap interface to be already open.
Another solution might be to allow custom scripts to be plugged into
libvirt that allows you to add an interface to a bridge instead of running
brctl or ovs-vsctl. The latter solution lets libvirt create the tap
interface, whereas the former requires that the tap is 'plugged' into the
network before libvirt takes control for the VM to have connectivity when
it launches. I prefer the former because it seems less disruptive while
providing similar features.
I would be more than happy to send a patch for this, and I apologize that
this lacks details, but I just wanted to first make sure that what I'm
suggesting here makes sense and that I'm not missing something critical, as
I am fairly new to libvirt.
Thanks,
Ryu
12 years
[libvirt] Proposed: replace radvd with dnsmasq for Router Advertizing
by Gene Czarcinski
I have been doing some testing and dnsmasq is capable of handling the
service currently provided by radvd. To implement this in dnsmasq
requires the following:
if an IPv6 dhcp-range is specified, then add:
enable-ra
if no IPv6 dhcp-range is specified, then add:
dhsp-range=<IPv6-subnet>,ra-only
Tested. The second one will work with basic dnsmasq-2.6.3. The first
one and dhcp-range itself only works with dnsmasq-2.64 (when released)
or dnsmasq-2.63+patches.
Since dnsmasq-2.48 does not support IPv6 dhcp but does handle IPv6 for
dns and CentOS 6 does include radvd, I also propose that a libvirtd.conf
option be added. If the option is not present or set off, then radvd is
used. If the option is set on, then dnsmasq is used.
At some point in the future, it can be decided whether to keep using
radvd or not.
Comments? Suggestions?
Gene
12 years
[libvirt] [PATCH] qemu: Add ability to disable autostarting of guests on daemon start
by Peter Krempa
When the daemon is starting it autostarts all guests marked as
autostartable. This is not an ideal solution for autostarting if there's
a lot of domains configured so. After autostarting all right away the
guests start competing for disk I/O and the boot is prolonged
unnecessarily.
This patch adds a config option to disable autostarting to leave it on
user scripts that may use mechanisms to reduce load of the host by
limiting the number of guests started in parallel.
Unfortunately, there's no simple way we could do this in libvirt. The
problem is how to detect that the guest has finished booting as it's
mostly a black box for libvirt. There area few options:
1) Wait until I/O load of the guest drops.
- This is insufficient on guests that do heavy I/O all the time.
2) Let the guest tell us.
- Not every OS has the ability to have a guest agent.
3) Wait for certain amount of time.
- Very limited amount of control on diverse guests.
With this functionality, the user may write his own script that load
balances the autostart in a sane way with accordance to his
infrastructure (Query agents, check I/O, use configurable timeouts)
while stil being able to mark the domains as autostartable with all the
benefits (virsh list --all --autostart).
---
We could also add an example script based on parts of libvirt-guests to show
how to use this.
---
src/qemu/qemu.conf | 7 +++++++
src/qemu/qemu_conf.c | 4 ++++
src/qemu/qemu_conf.h | 2 ++
src/qemu/qemu_driver.c | 5 ++++-
4 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index dd853c8..91115bf 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -2,6 +2,13 @@
# All settings described here are optional - if omitted, sensible
# defaults are used.
+# When the qemu driver starts all guests that are marked to be
+# started automaticaly are started (at once). This option disables
+# autostarting of the guests. The user can use a script to do so in
+# a more sensible way. Eg. wait for guest to start up, before continuing.
+#
+#disable_autostart = 1
+
# VNC is configured to listen on 127.0.0.1 by default.
# To make it listen on all public interfaces, uncomment
# this next option.
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index dc4d680..598b34e 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -153,6 +153,10 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
return -1; \
}
+ p = virConfGetValue(conf, "disable_autostart");
+ CHECK_TYPE("disable_autostart", VIR_CONF_LONG);
+ if (p && p->l) driver->disableAutoStart = true;
+
p = virConfGetValue(conf, "vnc_auto_unix_socket");
CHECK_TYPE("vnc_auto_unix_socket", VIR_CONF_LONG);
if (p) driver->vncAutoUnixSocket = p->l;
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 2c7f70c..fb6e317 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -156,6 +156,8 @@ struct qemud_driver {
int keepAliveInterval;
unsigned int keepAliveCount;
int seccompSandbox;
+
+ bool disableAutoStart;
};
typedef struct _qemuDomainCmdlineDef qemuDomainCmdlineDef;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 978af57..3b4928f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -888,7 +888,10 @@ qemudStartup(int privileged) {
qemuDriverUnlock(qemu_driver);
- qemuAutostartDomains(qemu_driver);
+ if (!qemu_driver->disableAutoStart)
+ qemuAutostartDomains(qemu_driver);
+ else
+ VIR_WARN("QEMU domain autostarting is disabled");
if (conn)
virConnectClose(conn);
--
1.8.0
12 years
[libvirt] [PATCH] qemu: Emit event if save fails
by Michal Privoznik
When we are doing a (managed-) save of a domain, we stop its processors
firstly. And if the process of saving fails for some reason we try to
wake them up again. However, if this fails, an event should be emitted
so mgmt application can decide what to do.
---
I am not completely sure about combination of event and
event detail, maybe we need to invent a new combination.
Suggestions? VIR_DOMAIN_EVENT_STOPPED_FAILED means an
hypervisor error which may fit when 'cont' fails.
src/qemu/qemu_driver.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 978af57..e1c6067 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2990,8 +2990,12 @@ endjob:
rc = qemuProcessStartCPUs(driver, vm, dom->conn,
VIR_DOMAIN_RUNNING_SAVE_CANCELED,
QEMU_ASYNC_JOB_SAVE);
- if (rc < 0)
+ if (rc < 0) {
VIR_WARN("Unable to resume guest CPUs after save failure");
+ event = virDomainEventNewFromObj(vm,
+ VIR_DOMAIN_EVENT_STOPPED,
+ VIR_DOMAIN_EVENT_STOPPED_FAILED);
+ }
}
}
if (qemuDomainObjEndAsyncJob(driver, vm) == 0)
--
1.7.8.6
12 years
[libvirt] [PATCH] qemu: Don't corrupt pointer in qemuDomainSaveMemory()
by Peter Krempa
The code that was split out into the qemuDomainSaveMemory expands the
pointer containing the XML description of the domain that it gets from
higher layers. If the pointer changes the old one is invalid and the
upper layer function tries to free it causing an abort.
This patch changes the expansion of the original string to a new
alocation and copy of the contents.
---
src/qemu/qemu_driver.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 978af57..7b8eec6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2768,7 +2768,7 @@ static int
qemuDomainSaveMemory(struct qemud_driver *driver,
virDomainObjPtr vm,
const char *path,
- const char *xml,
+ const char *domXML,
int compressed,
bool was_running,
unsigned int flags,
@@ -2785,6 +2785,7 @@ qemuDomainSaveMemory(struct qemud_driver *driver,
unsigned long long pad;
unsigned long long offset;
size_t len;
+ char *xml = NULL;
memset(&header, 0, sizeof(header));
memcpy(header.magic, QEMUD_SAVE_PARTIAL, sizeof(header.magic));
@@ -2793,7 +2794,7 @@ qemuDomainSaveMemory(struct qemud_driver *driver,
header.compressed = compressed;
- len = strlen(xml) + 1;
+ len = strlen(domXML) + 1;
offset = sizeof(header) + len;
/* Due to way we append QEMU state on our header with dd,
@@ -2807,10 +2808,12 @@ qemuDomainSaveMemory(struct qemud_driver *driver,
pad = 1024;
pad += (QEMU_MONITOR_MIGRATE_TO_FILE_BS -
((offset + pad) % QEMU_MONITOR_MIGRATE_TO_FILE_BS));
- if (VIR_EXPAND_N(xml, len, pad) < 0) {
+ if (VIR_ALLOC_N(xml, len + pad) < 0) {
virReportOOMError();
goto cleanup;
}
+ strcpy(xml, domXML);
+
offset += pad;
header.xml_len = len;
@@ -2878,6 +2881,7 @@ cleanup:
VIR_FORCE_CLOSE(fd);
virFileWrapperFdCatchError(wrapperFd);
virFileWrapperFdFree(wrapperFd);
+ VIR_FREE(xml);
if (ret != 0 && needUnlink)
unlink(path);
--
1.8.0
12 years