Re: [libvirt] [PATCH] cgroup : remove the ns_cgroup
by Daniel Lezcano
On 01/27/2011 02:45 AM, Andrew Morton wrote:
> On Thu, 27 Jan 2011 09:08:51 +0800 Li Zefan<lizf(a)cn.fujitsu.com> wrote:
>
>> Andrew Morton wrote:
>>> On Tue, 25 Jan 2011 10:39:48 +0100
>>> Daniel Lezcano<daniel.lezcano(a)free.fr> wrote:
>>>
>>>> This patch removes the ns_cgroup as suggested in the following thread:
>>> I had this patch queued up in September last year, but dropped it. Why
>>> did I do that?
>> Because you wanted to wait for some time for users (if any) to notice this
>> coming change.
>>
>> Author: Daniel Lezcano<daniel.lezcano(a)free.fr>
>> Date: Wed Oct 27 15:33:38 2010 -0700
>>
>> cgroup: notify ns_cgroup deprecated
>>
>> The ns_cgroup will be removed very soon. Let's warn, for this version,
>> ns_cgroup is deprecated.
>>
>> Make ns_cgroup and clone_children exclusive. If the clone_children is set
>> and the ns_cgroup is mounted, let's fail with EINVAL when the ns_cgroup
>> subsys is created (a printk will help the user to understand why the
>> creation fails).
>>
>> Update the feature remove schedule file with the deprecated ns_cgroup.
>>
>> Signed-off-by: Daniel Lezcano<daniel.lezcano(a)free.fr>
>> Acked-by: Paul Menage<menage(a)google.com>
>> Signed-off-by: Andrew Morton<akpm(a)linux-foundation.org>
>> Signed-off-by: Linus Torvalds<torvalds(a)linux-foundation.org>
> ooh, that was clever of me.
>
> Here is the text which was missing from the changelog:
>
> This is a userspace-visible change. Commit 45531757b45c ("cgroup:
> notify ns_cgroup deprecated") (merged into 2.6.27) caused the kernel
> to emit a printk warning users that the feature is planned for
> removal. Since that time we have heard from XXX users who were
> affected by this.
>
> Please provide XXX.
Ok, AFAIK nobody makes use of the ns_cgroup except the LXC userspace
tools which I maintain and where
the backward compatibility with the ns_cgroup and the clone_children
flag is already implemented.
Since today nobody seems to be affected by this.
I Cc'ed the libvirt mailing list.
> How do we know that 2.6.37->2.6.38 is long enough? Will any major
> distros be released containing this warning in that timeframe? I doubt
> it.
Hmm, maybe it is too short but I don't think someone will complain about
this feature removal.
Google chromium is using the namespaces, hence a lot of cgroup is
created on the system. The vsftpd and some pam modules uses the
namespaces too.
I won't be surprised if one of these applications fails with 'clone'
returning EEXIST ...
13 years, 10 months
[libvirt] C# bindings need and advice from the experts
by arnaud.champion@devatom.fr
?Hi,
I'm working on C# bindings. The goal is to obtain a more C# API for the API users.
So I have create object for libvirt familly function (an object Connect, Domain, Storage and so on).
All is almost done, but I need and advice about the way to handle object properties. For example, for the Connect object, I expose a "RunningDomains" property that can be used in this manner :
Connect myConn = new Connect("qemu+tcp://192.168.220.198/system");
List<Domain> runningDomains = myConn.RunningsDomains;
In the Connect object, the property "RunningDomains" is coded in this :
/// <summary>
/// Get the list of running domains
/// </summary>
public List<Domain> RunningDomains
{
get
{
if (_conn == IntPtr.Zero) return null;
int nbRunningDomain = NumOfDomains(_conn);
int[] runningDomainIds = new int[nbRunningDomain];
ListDomains(_conn, runningDomainIds, nbRunningDomain);
return runningDomainIds.Select(id => new Domain(Domain.LookupByID(_conn, id), this)).ToList();
}
}
So the property call "virConnectNumOfDomains" and "virConnectListDomains" each time the property is called. And I don't know if it is a good thing. The other way, is to keep the list in the Connect object and handle domain adding or removing in this via callbacks. This avoid multiple call to the librar.
Any advice ?
Regards,
Arnaud
13 years, 10 months
[libvirt] [PATCH 0/4 v2] Add blkio cgroup support
by Gui Jianfeng
Hi
This patchset adds blkio cgroup support for qemu and lxc.
[PATCH 1/4] cgroup: Enable cgroup hierarchy for blkio cgroup
[PATCH 2/4 v2] cgroup: Implement blkio.weight tuning API.
[PATCH 3/4 v2] qemu: Implement blkio tunable XML configuration and parsing.
[PATCH 4/4] LXC: LXC Blkio weight configuration support.
Will post a patchset to implement virsh command "blkiotune" to tune blkio
cgroup parameter later on.
conf/domain_conf.c | 15 ++++++++++++++-
conf/domain_conf.h | 4 ++++
libvirt_private.syms | 2 ++
lxc/lxc_controller.c | 10 ++++++++++
qemu/qemu_cgroup.c | 16 +++++++++++++++-
qemu/qemu_conf.c | 3 ++-
util/cgroup.c | 41 ++++++++++++++++++++++++++++++++++++++++-
util/cgroup.h | 4 ++++
8 files changed, 91 insertions(+), 4 deletions(-)
Thanks
Gui
13 years, 10 months
[libvirt] [RFC/PATCH REPOST] Adding persistent entry for cpu tunable
by Nikunj A. Dadhania
From: Nikunj A. Dadhania <nikunj(a)linux.vnet.ibm.com>
Make cpu share persistent and add support for parsing them.
docs/formatdomain.html.in: Document cputune element
src/conf/domain_conf.c,src/conf/domain_conf.h: Add cputune element parsing
src/lxc/lxc_controller.c: Use the parsed cputune shares value
src/qemu/qemu_cgroup.c: Use the parsed cputune shares value
Signed-off-by: Nikunj A. Dadhania <nikunj(a)linux.vnet.ibm.com>
---
docs/formatdomain.html.in | 11 +++++++++++
src/conf/domain_conf.c | 14 ++++++++++++++
src/conf/domain_conf.h | 3 +++
src/lxc/lxc_controller.c | 10 ++++++++++
src/qemu/qemu_cgroup.c | 15 +++++++++++++++
5 files changed, 53 insertions(+), 0 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 55e2cbd..522dc06 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -280,6 +280,9 @@
<swap_hard_limit>2097152</swap_hard_limit>
<min_guarantee>65536</min_guarantee>
</memtune>
+ <cputune>
+ <shares>1024</shares>
+ </cputune>
<vcpu cpuset="1-4,^3,6" current="1">2</vcpu>
...</pre>
@@ -317,6 +320,14 @@
<dd> The optional <code>min_guarantee</code> element is the guaranteed
minimum memory allocation for the guest. The units for this value are
kilobytes (i.e. blocks of 1024 bytes)</dd>
+ <dt><code>cputune</code></dt>
+ <dd> The optional <code>cputune</code> element provides details
+ regarding the cpu tuneable parameters for the domain. If this is
+ omitted, it defaults to the OS provided defaults.</dd>
+ <dt><code>shares</code></dt>
+ <dd> The optional <code>shares</code> element is the proportional
+ weighted share for the domain. If this is omitted, it defaults to the OS
+ provided defaults.</dd>
<dt><code>vcpu</code></dt>
<dd>The content of this element defines the maximum number of virtual
CPUs allocated for the guest OS, which must be between 1 and
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 645767e..63c8927 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4904,6 +4904,11 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
&def->mem.swap_hard_limit) < 0)
def->mem.swap_hard_limit = 0;
+ /* Extract cpu tunables */
+ if (virXPathULong("string(./cputune/shares[1])", ctxt,
+ &def->cputune.shares) < 0)
+ def->cputune.shares = 0;
+
n = virXPathULong("string(./vcpu[1])", ctxt, &count);
if (n == -2) {
virDomainReportError(VIR_ERR_XML_ERROR, "%s",
@@ -7313,6 +7318,15 @@ char *virDomainDefFormat(virDomainDefPtr def,
def->mem.swap_hard_limit)
virBufferVSprintf(&buf, " </memtune>\n");
+ if (def->cputune.shares)
+ virBufferVSprintf(&buf, " <cputune>\n");
+ if (def->cputune.shares) {
+ virBufferVSprintf(&buf, " <shares>%lu</shares>\n",
+ def->cputune.shares);
+ }
+ if (def->cputune.shares)
+ virBufferVSprintf(&buf, " </cputune>\n");
+
if (def->mem.hugepage_backed) {
virBufferAddLit(&buf, " <memoryBacking>\n");
virBufferAddLit(&buf, " <hugepages/>\n");
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index cf7bdc0..a2c83d3 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -981,6 +981,9 @@ struct _virDomainDef {
unsigned short maxvcpus;
int cpumasklen;
char *cpumask;
+ struct {
+ unsigned long shares; /* proportional weight */
+ } cputune;
/* These 3 are based on virDomainLifeCycleAction enum flags */
int onReboot;
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index af0b70c..24edb49 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -144,6 +144,16 @@ static int lxcSetContainerResources(virDomainDefPtr def)
}
}
+ if(def->cputune.shares) {
+ rc = virCgroupSetCpuShares(cgroup, def->cputune.shares);
+ if (rc != 0) {
+ virReportSystemError(-rc,
+ _("Unable to set cpu shares for domain %s"),
+ def->name);
+ goto cleanup;
+ }
+ }
+
rc = virCgroupDenyAllDevices(cgroup);
if (rc != 0) {
virReportSystemError(-rc,
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index e5536c0..d4e73bd 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -304,6 +304,21 @@ int qemuSetupCgroup(struct qemud_driver *driver,
vm->def->name);
}
+ if ((rc = qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU))) {
+ if (vm->def->cputune.shares != 0) {
+ rc = virCgroupSetCpuShares(cgroup, vm->def->cputune.shares);
+ if (rc != 0) {
+ virReportSystemError(-rc,
+ _("Unable to set cpu shares for domain %s"),
+ vm->def->name);
+ goto cleanup;
+ }
+ }
+ } else {
+ VIR_WARN("CPU cgroup is disabled in qemu configuration file: %s",
+ vm->def->name);
+ }
+
done:
virCgroupFree(&cgroup);
return 0;
13 years, 10 months
[libvirt] [PATCH] docs: Add docs for new extra parameter pkipath
by Osier Yang
* docs/remote.html.in
---
docs/remote.html.in | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/docs/remote.html.in b/docs/remote.html.in
index b0fdb7c..a68d0fa 100644
--- a/docs/remote.html.in
+++ b/docs/remote.html.in
@@ -308,6 +308,22 @@ Note that parameter values must be
<td colspan="2"/>
<td> Example: <code>no_tty=1</code> </td>
</tr>
+ <tr>
+ <td>
+ <code>pkipath</code>
+ </td>
+ <td> tls</td>
+ <td>
+ Specifies x509 certificates path for client. As long as one of the
+ certificates (CA cerfificate, client key, client certificate) doesn't
+ exist in the specified path, the connection will fail with fatal
+ error.
+</td>
+ </tr>
+ <tr>
+ <td colspan="2"/>
+ <td> Example: <code>pkipath=/tmp/pki/client</code> </td>
+ </tr>
</table>
<h3>
<a name="Remote_certificates">Generating TLS certificates</a>
@@ -372,6 +388,20 @@ next section.
</td>
</tr>
</table>
+ <p>
+If 'pkipath' is specified in URI, then all the client certificates should
+be able to found in the path specified, otherwise, connection will fail
+with fatal error. And if 'pkipath' is not specified:
+</p>
+ <ul>
+ <li> For user who is non-root, libvirt trys to find the certificates
+in $HOME/.pki/libvirt, if one of the required certificates can not be found,
+global default locations(/etc/pki/CA/cacert.pem,
+/etc/pki/libvirt/private/clientkey, /etc/pki/libvirt/clientcert.pem) will be
+used.
+</li>
+ <li> For user who is root, global default location will be used. </li>
+ </ul>
<h4>
<a name="Remote_TLS_background">Background to TLS certificates</a>
</h4>
--
1.7.3.2
13 years, 10 months
[libvirt] [PATCH 4/4] LXC: LXC Blkio weight configuration support.
by Gui Jianfeng
LXC Blkio weight configuration support.
Signed-off-by: Gui Jianfeng <guijianfeng(a)cn.fujitsu.com>
---
src/lxc/lxc_controller.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index af0b70c..7bb3581 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -104,6 +104,16 @@ static int lxcSetContainerResources(virDomainDefPtr def)
goto cleanup;
}
+ if (def->blkio.weight) {
+ rc = virCgroupSetWeight(cgroup, def->blkio.weight);
+ if (rc != 0) {
+ virReportSystemError(-rc,
+ _("Unable to set Blkio weight for domain %s"),
+ def->name);
+ goto cleanup;
+ }
+ }
+
rc = virCgroupSetMemory(cgroup, def->mem.max_balloon);
if (rc != 0) {
virReportSystemError(-rc,
--
1.7.1
13 years, 10 months
[libvirt] [PATCH 3/4 v2] qemu: Implement blkio tunable XML configuration and parsing.
by Gui Jianfeng
Implement blkio tunable XML configuration and parsing.
Signed-off-by: Gui Jianfeng <guijianfeng(a)cn.fujitsu.com>
---
src/conf/domain_conf.c | 15 ++++++++++++++-
src/conf/domain_conf.h | 4 ++++
src/qemu/qemu_cgroup.c | 16 +++++++++++++++-
src/qemu/qemu_conf.c | 3 ++-
4 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 645767e..1d4cd30 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4810,7 +4810,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
{
xmlNodePtr *nodes = NULL, node = NULL;
char *tmp = NULL;
- int i, n;
+ int i, n, w;
long id = -1;
virDomainDefPtr def;
unsigned long count;
@@ -4887,6 +4887,11 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
if (node)
def->mem.hugepage_backed = 1;
+ /* Extract blkio cgroup tunables */
+ if (virXPathULong("string(./blkiotune/weight)", ctxt,
+ &def->blkio.weight) < 0)
+ def->blkio.weight = 0;
+
/* Extract other memory tunables */
if (virXPathULong("string(./memtune/hard_limit)", ctxt,
&def->mem.hard_limit) < 0)
@@ -7289,6 +7294,14 @@ char *virDomainDefFormat(virDomainDefPtr def,
virBufferVSprintf(&buf, " <currentMemory>%lu</currentMemory>\n",
def->mem.cur_balloon);
+ /* add blkiotune only if there are any */
+ if (def->blkio.weight) {
+ virBufferVSprintf(&buf, " <blkiotune>\n");
+ virBufferVSprintf(&buf, " <weight>%lu</weight>\n",
+ def->blkio.weight);
+ virBufferVSprintf(&buf, " </blkiotune>\n");
+ }
+
/* add memtune only if there are any */
if (def->mem.hard_limit || def->mem.soft_limit || def->mem.min_guarantee ||
def->mem.swap_hard_limit)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index cf7bdc0..b117869 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -969,6 +969,10 @@ struct _virDomainDef {
char *description;
struct {
+ unsigned long weight;
+ } blkio;
+
+ struct {
unsigned long max_balloon;
unsigned long cur_balloon;
unsigned long hugepage_backed;
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index e5536c0..f664c17 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -54,7 +54,6 @@ int qemuCgroupControllerActive(struct qemud_driver *driver,
return 0;
}
-
int qemuSetupDiskPathAllow(virDomainDiskDefPtr disk ATTRIBUTE_UNUSED,
const char *path,
size_t depth ATTRIBUTE_UNUSED,
@@ -270,6 +269,21 @@ int qemuSetupCgroup(struct qemud_driver *driver,
}
}
+ if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) {
+ if (vm->def->blkio.weight != 0) {
+ rc = virCgroupSetWeight(cgroup, vm->def->blkio.weight);
+ if(rc != 0) {
+ virReportSystemError(-rc,
+ _("Unable to set io weight for domain %s"),
+ vm->def->name);
+ goto cleanup;
+ }
+ }
+ } else {
+ qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Block I/O tuning is not available on this host"));
+ }
+
if ((rc = qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_MEMORY))) {
if (vm->def->mem.hard_limit != 0) {
rc = virCgroupSetMemoryHardLimit(cgroup, vm->def->mem.hard_limit);
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index e1502dc..121080f 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -299,7 +299,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
driver->cgroupControllers =
(1 << VIR_CGROUP_CONTROLLER_CPU) |
(1 << VIR_CGROUP_CONTROLLER_DEVICES) |
- (1 << VIR_CGROUP_CONTROLLER_MEMORY);
+ (1 << VIR_CGROUP_CONTROLLER_MEMORY) |
+ (1 << VIR_CGROUP_CONTROLLER_BLKIO);
}
for (i = 0 ; i < VIR_CGROUP_CONTROLLER_LAST ; i++) {
if (driver->cgroupControllers & (1 << i)) {
--
1.7.1
13 years, 10 months
[libvirt] [PATCH] Report error more accurate if failes on attaching device.
by Hu Tao
When attaching device from a xml file and the device is mis-configured,
virsh gives mis-leading message "out of memory". This patch fixes this.
---
src/qemu/qemu_command.c | 2 ++
src/qemu/qemu_hotplug.c | 1 -
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6dc586f..303063a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1496,6 +1496,8 @@ qemuBuildControllerDevStr(virDomainControllerDefPtr def)
/* We always get an IDE controller, whether we want it or not. */
case VIR_DOMAIN_CONTROLLER_TYPE_IDE:
default:
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "Unknown controller type: %s\n",
+ virDomainControllerTypeToString(def->type));
goto error;
}
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 8be993b..ca81a3d 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -260,7 +260,6 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
goto cleanup;
if (!(devstr = qemuBuildControllerDevStr(controller))) {
- virReportOOMError();
goto cleanup;
}
}
--
1.7.3.1
13 years, 10 months
[libvirt] [PATCH 0/3 v2] qemu: Allow serving VNC over a unix domain socket
by Cole Robinson
This series enables use of qemu's -vnc unix:/some/socket/path functionality.
A qemu.conf option is provided to make this the default for VNC devices
without an explicit listen or socket value.
Serving VNC over a unix socket prevents unprivileged local users from
accessing a guest's console. The downside is that no clients currently
support it (though virt-manager support is ready), and certain
common usage scenarios cannot handle the tighter permissions (like a
regular user connecting to qemu:///system with policykit).
v2:
schema: Make listen vs. socket a <choice>
Add qemu.conf option for auto allocating a socket
Cole Robinson (3):
qemu: Set domain def transient at beginning of startup process
qemu: Allow serving VNC over a unix domain socket
qemu: Add conf option to auto setup VNC unix sockets
docs/formatdomain.html.in | 6 ++-
docs/schemas/domain.rng | 47 ++++++++++------
src/conf/domain_conf.c | 41 +++++++++-----
src/conf/domain_conf.h | 4 +-
src/lxc/lxc_driver.c | 2 +-
src/qemu/qemu.conf | 8 +++
src/qemu/qemu_command.c | 60 ++++++++++++++------
src/qemu/qemu_conf.c | 4 +
src/qemu/qemu_conf.h | 1 +
src/qemu/qemu_driver.c | 14 +++--
src/test/test_driver.c | 2 +-
src/uml/uml_driver.c | 2 +-
tests/qemuargv2xmltest.c | 1 +
.../qemuxml2argv-graphics-vnc-socket.args | 1 +
.../qemuxml2argv-graphics-vnc-socket.xml | 30 ++++++++++
tests/qemuxml2argvtest.c | 1 +
16 files changed, 164 insertions(+), 60 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml
--
1.7.3.2
13 years, 10 months
[libvirt] [PATCH 0/3] Add some new features into migration
by Wen Congyang
This patch set adds three new features into migration:
1. Cancel migration if user presses Ctrl-C when migration is in progress
2. show migration's progress
3. auto-suspend the guest OS at timeout, where the migration will complete offline
Hu Tao (1):
Cancel migration if user presses Ctrl-C when migration is in progress
Wen Congyang (2):
show mig progress
force guest suspend at timeout
tools/virsh.c | 211 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
tools/virsh.pod | 7 ++-
2 files changed, 206 insertions(+), 12 deletions(-)
13 years, 10 months