forked from pool/libvirt
This commit is contained in:
parent
2df017fec4
commit
420c59c5d3
@ -1,55 +0,0 @@
|
|||||||
Index: libvirt-0.4.6/src/cgroup.c
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-0.4.6.orig/src/cgroup.c
|
|
||||||
+++ libvirt-0.4.6/src/cgroup.c
|
|
||||||
@@ -761,6 +761,36 @@ out:
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/**
|
|
||||||
+ * virCgroupAllowDeviceMajor:
|
|
||||||
+ *
|
|
||||||
+ * @group: The cgroup to allow an entire device major type for
|
|
||||||
+ * @type: The device type (i.e., 'c' or 'b')
|
|
||||||
+ * @major: The major number of the device type
|
|
||||||
+ *
|
|
||||||
+ * Returns: 0 on success
|
|
||||||
+ */
|
|
||||||
+int virCgroupAllowDeviceMajor(virCgroupPtr group,
|
|
||||||
+ char type,
|
|
||||||
+ int major)
|
|
||||||
+{
|
|
||||||
+ int rc;
|
|
||||||
+ char *devstr = NULL;
|
|
||||||
+
|
|
||||||
+ if (asprintf(&devstr, "%c %i:* rwm", type, major) == -1) {
|
|
||||||
+ rc = -ENOMEM;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rc = virCgroupSetValueStr(group,
|
|
||||||
+ "devices.allow",
|
|
||||||
+ devstr);
|
|
||||||
+ out:
|
|
||||||
+ VIR_FREE(devstr);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
int virCgroupSetCpuShares(virCgroupPtr group, unsigned long shares)
|
|
||||||
{
|
|
||||||
return virCgroupSetValueU64(group, "cpu.shares", (uint64_t)shares);
|
|
||||||
Index: libvirt-0.4.6/src/cgroup.h
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-0.4.6.orig/src/cgroup.h
|
|
||||||
+++ libvirt-0.4.6/src/cgroup.h
|
|
||||||
@@ -35,6 +35,9 @@ int virCgroupAllowDevice(virCgroupPtr gr
|
|
||||||
char type,
|
|
||||||
int major,
|
|
||||||
int minor);
|
|
||||||
+int virCgroupAllowDeviceMajor(virCgroupPtr group,
|
|
||||||
+ char type,
|
|
||||||
+ int major);
|
|
||||||
|
|
||||||
int virCgroupSetCpuShares(virCgroupPtr group, unsigned long shares);
|
|
||||||
int virCgroupGetCpuShares(virCgroupPtr group, unsigned long *shares);
|
|
822
cgroup.patch
822
cgroup.patch
@ -1,822 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User danms
|
|
||||||
# Date 1223056682 0
|
|
||||||
# Node ID 64f19f607bc6837fe2411cfdb2942b13ce8902c1
|
|
||||||
# Parent a28490b116b0430aa0d4f579bba57d52793312ed
|
|
||||||
[r2008-10-03 17:58:02 by danms] Add forgotten cgroup.{c,h} and ChangeLog
|
|
||||||
|
|
||||||
Index: libvirt-0.4.6/src/cgroup.c
|
|
||||||
===================================================================
|
|
||||||
--- /dev/null
|
|
||||||
+++ libvirt-0.4.6/src/cgroup.c
|
|
||||||
@@ -0,0 +1,762 @@
|
|
||||||
+/*
|
|
||||||
+ * cgroup.c: Tools for managing cgroups
|
|
||||||
+ *
|
|
||||||
+ * Copyright IBM Corp. 2008
|
|
||||||
+ *
|
|
||||||
+ * See COPYING.LIB for the License of this software
|
|
||||||
+ *
|
|
||||||
+ * Authors:
|
|
||||||
+ * Dan Smith <danms@us.ibm.com>
|
|
||||||
+ */
|
|
||||||
+#include <config.h>
|
|
||||||
+
|
|
||||||
+#include <stdio.h>
|
|
||||||
+#include <stdint.h>
|
|
||||||
+#include <inttypes.h>
|
|
||||||
+#include <mntent.h>
|
|
||||||
+#include <fcntl.h>
|
|
||||||
+#include <string.h>
|
|
||||||
+#include <errno.h>
|
|
||||||
+#include <stdlib.h>
|
|
||||||
+#include <stdbool.h>
|
|
||||||
+#include <sys/stat.h>
|
|
||||||
+#include <sys/types.h>
|
|
||||||
+#include <libgen.h>
|
|
||||||
+
|
|
||||||
+#include "internal.h"
|
|
||||||
+#include "util.h"
|
|
||||||
+#include "memory.h"
|
|
||||||
+#include "cgroup.h"
|
|
||||||
+
|
|
||||||
+#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
|
|
||||||
+#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
|
|
||||||
+
|
|
||||||
+#define CGROUP_MAX_VAL 512
|
|
||||||
+
|
|
||||||
+struct virCgroup {
|
|
||||||
+ char *path;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+const char *supported_controllers[] = {
|
|
||||||
+ "memory",
|
|
||||||
+ "devices",
|
|
||||||
+ NULL
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * virCgroupFree:
|
|
||||||
+ *
|
|
||||||
+ * @group: The group structure to free
|
|
||||||
+ */
|
|
||||||
+void virCgroupFree(virCgroupPtr *group)
|
|
||||||
+{
|
|
||||||
+ if (*group != NULL) {
|
|
||||||
+ VIR_FREE((*group)->path);
|
|
||||||
+ VIR_FREE(*group);
|
|
||||||
+ *group = NULL;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static virCgroupPtr virCgroupGetMount(const char *controller)
|
|
||||||
+{
|
|
||||||
+ FILE *mounts;
|
|
||||||
+ struct mntent entry;
|
|
||||||
+ char buf[CGROUP_MAX_VAL];
|
|
||||||
+ virCgroupPtr root = NULL;
|
|
||||||
+
|
|
||||||
+ if (VIR_ALLOC(root) != 0)
|
|
||||||
+ return NULL;
|
|
||||||
+
|
|
||||||
+ mounts = fopen("/proc/mounts", "r");
|
|
||||||
+ if (mounts == NULL) {
|
|
||||||
+ DEBUG0("Unable to open /proc/mounts: %m");
|
|
||||||
+ goto err;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ while (getmntent_r(mounts, &entry, buf, sizeof(buf)) != NULL) {
|
|
||||||
+ if (STREQ(entry.mnt_type, "cgroup") &&
|
|
||||||
+ (strstr(entry.mnt_opts, controller))) {
|
|
||||||
+ root->path = strdup(entry.mnt_dir);
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ DEBUG("Mount for %s is %s\n", controller, root->path);
|
|
||||||
+
|
|
||||||
+ if (root->path == NULL) {
|
|
||||||
+ DEBUG0("Did not find cgroup mount");
|
|
||||||
+ goto err;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ fclose(mounts);
|
|
||||||
+
|
|
||||||
+ return root;
|
|
||||||
+err:
|
|
||||||
+ virCgroupFree(&root);
|
|
||||||
+
|
|
||||||
+ return NULL;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * virCgroupHaveSupport:
|
|
||||||
+ *
|
|
||||||
+ * Returns 0 if support is present, negative if not
|
|
||||||
+ */
|
|
||||||
+int virCgroupHaveSupport(void)
|
|
||||||
+{
|
|
||||||
+ virCgroupPtr root;
|
|
||||||
+ int i;
|
|
||||||
+
|
|
||||||
+ for (i = 0; supported_controllers[i] != NULL; i++) {
|
|
||||||
+ root = virCgroupGetMount(supported_controllers[i]);
|
|
||||||
+ if (root == NULL)
|
|
||||||
+ return -1;
|
|
||||||
+ virCgroupFree(&root);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int virCgroupPathOfGroup(const char *group,
|
|
||||||
+ const char *controller,
|
|
||||||
+ char **path)
|
|
||||||
+{
|
|
||||||
+ virCgroupPtr root = NULL;
|
|
||||||
+ int rc = 0;
|
|
||||||
+
|
|
||||||
+ root = virCgroupGetMount(controller);
|
|
||||||
+ if (root == NULL) {
|
|
||||||
+ rc = -ENOTDIR;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (asprintf(path, "%s/%s", root->path, group) == -1)
|
|
||||||
+ rc = -ENOMEM;
|
|
||||||
+out:
|
|
||||||
+ virCgroupFree(&root);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int virCgroupPathOf(const char *grppath,
|
|
||||||
+ const char *key,
|
|
||||||
+ char **path)
|
|
||||||
+{
|
|
||||||
+ virCgroupPtr root;
|
|
||||||
+ int rc = 0;
|
|
||||||
+ char *controller = NULL;
|
|
||||||
+
|
|
||||||
+ if (strchr(key, '.') == NULL)
|
|
||||||
+ return -EINVAL;
|
|
||||||
+
|
|
||||||
+ if (sscanf(key, "%a[^.]", &controller) != 1)
|
|
||||||
+ return -EINVAL;
|
|
||||||
+
|
|
||||||
+ root = virCgroupGetMount(controller);
|
|
||||||
+ if (root == NULL) {
|
|
||||||
+ rc = -ENOTDIR;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (asprintf(path, "%s/%s/%s", root->path, grppath, key) == -1)
|
|
||||||
+ rc = -ENOMEM;
|
|
||||||
+out:
|
|
||||||
+ virCgroupFree(&root);
|
|
||||||
+ VIR_FREE(controller);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int virCgroupSetValueStr(virCgroupPtr group,
|
|
||||||
+ const char *key,
|
|
||||||
+ const char *value)
|
|
||||||
+{
|
|
||||||
+ int fd = -1;
|
|
||||||
+ int rc = 0;
|
|
||||||
+ char *keypath = NULL;
|
|
||||||
+
|
|
||||||
+ rc = virCgroupPathOf(group->path, key, &keypath);
|
|
||||||
+ if (rc != 0)
|
|
||||||
+ return rc;
|
|
||||||
+
|
|
||||||
+ fd = open(keypath, O_WRONLY);
|
|
||||||
+ if (fd < 0) {
|
|
||||||
+ DEBUG("Unable to open %s: %m", keypath);
|
|
||||||
+ rc = -ENOENT;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ DEBUG("Writing '%s' to '%s'", value, keypath);
|
|
||||||
+
|
|
||||||
+ rc = safewrite(fd, value, strlen(value));
|
|
||||||
+ if (rc < 0) {
|
|
||||||
+ DEBUG("Failed to write value '%s': %m", value);
|
|
||||||
+ rc = -errno;
|
|
||||||
+ goto out;
|
|
||||||
+ } else if (rc != strlen(value)) {
|
|
||||||
+ DEBUG("Short write of value '%s'", value);
|
|
||||||
+ rc = -ENOSPC;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rc = 0;
|
|
||||||
+out:
|
|
||||||
+ VIR_FREE(keypath);
|
|
||||||
+ close(fd);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int virCgroupSetValueU64(virCgroupPtr group,
|
|
||||||
+ const char *key,
|
|
||||||
+ uint64_t value)
|
|
||||||
+{
|
|
||||||
+ char *strval = NULL;
|
|
||||||
+ int rc;
|
|
||||||
+
|
|
||||||
+ if (asprintf(&strval, "%" PRIu64, value) == -1)
|
|
||||||
+ return -ENOMEM;
|
|
||||||
+
|
|
||||||
+ rc = virCgroupSetValueStr(group, key, strval);
|
|
||||||
+
|
|
||||||
+ VIR_FREE(strval);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#if 0
|
|
||||||
+/* This is included for completeness, but not yet used */
|
|
||||||
+
|
|
||||||
+static int virCgroupSetValueI64(virCgroupPtr group,
|
|
||||||
+ const char *key,
|
|
||||||
+ int64_t value)
|
|
||||||
+{
|
|
||||||
+ char *strval = NULL;
|
|
||||||
+ int rc;
|
|
||||||
+
|
|
||||||
+ if (asprintf(&strval, "%" PRIi64, value) == -1)
|
|
||||||
+ return -ENOMEM;
|
|
||||||
+
|
|
||||||
+ rc = virCgroupSetValueStr(group, key, strval);
|
|
||||||
+
|
|
||||||
+ VIR_FREE(strval);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int virCgroupGetValueStr(virCgroupPtr group,
|
|
||||||
+ const char *key,
|
|
||||||
+ char **value)
|
|
||||||
+{
|
|
||||||
+ int fd = -1;
|
|
||||||
+ int rc;
|
|
||||||
+ char *keypath = NULL;
|
|
||||||
+ char buf[CGROUP_MAX_VAL];
|
|
||||||
+
|
|
||||||
+ memset(buf, 0, sizeof(buf));
|
|
||||||
+
|
|
||||||
+ rc = virCgroupPathOf(group->path, key, &keypath);
|
|
||||||
+ if (rc != 0) {
|
|
||||||
+ DEBUG("No path of %s, %s", group->path, key);
|
|
||||||
+ return rc;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ fd = open(keypath, O_RDONLY);
|
|
||||||
+ if (fd < 0) {
|
|
||||||
+ DEBUG("Unable to open %s: %m", keypath);
|
|
||||||
+ rc = -ENOENT;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rc = saferead(fd, buf, sizeof(buf));
|
|
||||||
+ if (rc < 0) {
|
|
||||||
+ DEBUG("Failed to read %s: %m\n", keypath);
|
|
||||||
+ rc = -errno;
|
|
||||||
+ goto out;
|
|
||||||
+ } else if (rc == 0) {
|
|
||||||
+ DEBUG("Short read of %s\n", keypath);
|
|
||||||
+ rc = -EIO;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ *value = strdup(buf);
|
|
||||||
+ if (*value == NULL) {
|
|
||||||
+ rc = -ENOMEM;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rc = 0;
|
|
||||||
+out:
|
|
||||||
+ VIR_FREE(keypath);
|
|
||||||
+ close(fd);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int virCgroupGetValueU64(virCgroupPtr group,
|
|
||||||
+ const char *key,
|
|
||||||
+ uint64_t *value)
|
|
||||||
+{
|
|
||||||
+ char *strval = NULL;
|
|
||||||
+ int rc = 0;
|
|
||||||
+
|
|
||||||
+ rc = virCgroupGetValueStr(group, key, &strval);
|
|
||||||
+ if (rc != 0)
|
|
||||||
+ goto out;
|
|
||||||
+
|
|
||||||
+ if (sscanf(strval, "%" SCNu64, value) != 1)
|
|
||||||
+ rc = -EINVAL;
|
|
||||||
+out:
|
|
||||||
+ VIR_FREE(strval);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int virCgroupGetValueI64(virCgroupPtr group,
|
|
||||||
+ const char *key,
|
|
||||||
+ int64_t *value)
|
|
||||||
+{
|
|
||||||
+ char *strval = NULL;
|
|
||||||
+ int rc = 0;
|
|
||||||
+
|
|
||||||
+ rc = virCgroupGetValueStr(group, key, &strval);
|
|
||||||
+ if (rc != 0)
|
|
||||||
+ goto out;
|
|
||||||
+
|
|
||||||
+ if (sscanf(strval, "%" SCNi64, value) != 1)
|
|
||||||
+ rc = -EINVAL;
|
|
||||||
+out:
|
|
||||||
+ VIR_FREE(strval);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+static int _virCgroupInherit(const char *path,
|
|
||||||
+ const char *key)
|
|
||||||
+{
|
|
||||||
+ int rc = 0;
|
|
||||||
+ int fd = -1;
|
|
||||||
+ char buf[CGROUP_MAX_VAL];
|
|
||||||
+ char *keypath = NULL;
|
|
||||||
+ char *pkeypath = NULL;
|
|
||||||
+
|
|
||||||
+ memset(buf, 0, sizeof(buf));
|
|
||||||
+
|
|
||||||
+ if (asprintf(&keypath, "%s/%s", path, key) == -1) {
|
|
||||||
+ rc = -ENOMEM;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (access(keypath, F_OK) != 0) {
|
|
||||||
+ DEBUG("Group %s has no key %s\n", path, key);
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (asprintf(&pkeypath, "%s/../%s", path, key) == -1) {
|
|
||||||
+ rc = -ENOMEM;
|
|
||||||
+ VIR_FREE(keypath);
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ fd = open(pkeypath, O_RDONLY);
|
|
||||||
+ if (fd < 0) {
|
|
||||||
+ rc = -errno;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (saferead(fd, buf, sizeof(buf)) <= 0) {
|
|
||||||
+ rc = -errno;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ close(fd);
|
|
||||||
+
|
|
||||||
+ fd = open(keypath, O_WRONLY);
|
|
||||||
+ if (fd < 0) {
|
|
||||||
+ rc = -errno;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (safewrite(fd, buf, strlen(buf)) != strlen(buf)) {
|
|
||||||
+ rc = -errno;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+out:
|
|
||||||
+ VIR_FREE(keypath);
|
|
||||||
+ VIR_FREE(pkeypath);
|
|
||||||
+ close(fd);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int virCgroupInherit(const char *grppath)
|
|
||||||
+{
|
|
||||||
+ int i;
|
|
||||||
+ int rc = 0;
|
|
||||||
+ const char *inherit_values[] = {
|
|
||||||
+ "cpuset.cpus",
|
|
||||||
+ "cpuset.mems",
|
|
||||||
+ NULL
|
|
||||||
+ };
|
|
||||||
+
|
|
||||||
+ for (i = 0; inherit_values[i] != NULL; i++) {
|
|
||||||
+ const char *key = inherit_values[i];
|
|
||||||
+
|
|
||||||
+ rc = _virCgroupInherit(grppath, key);
|
|
||||||
+ if (rc != 0) {
|
|
||||||
+ DEBUG("inherit of %s failed\n", key);
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int virCgroupMakeGroup(const char *name)
|
|
||||||
+{
|
|
||||||
+ int i;
|
|
||||||
+ int rc = 0;
|
|
||||||
+
|
|
||||||
+ for (i = 0; supported_controllers[i] != NULL; i++) {
|
|
||||||
+ char *path = NULL;
|
|
||||||
+ virCgroupPtr root;
|
|
||||||
+
|
|
||||||
+ root = virCgroupGetMount(supported_controllers[i]);
|
|
||||||
+ if (root == NULL)
|
|
||||||
+ continue;
|
|
||||||
+
|
|
||||||
+ rc = virCgroupPathOfGroup(name, supported_controllers[i], &path);
|
|
||||||
+ if (rc != 0) {
|
|
||||||
+ virCgroupFree(&root);
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ virCgroupFree(&root);
|
|
||||||
+
|
|
||||||
+ if (access(path, F_OK) != 0) {
|
|
||||||
+ if (mkdir(path, 0655) < 0) {
|
|
||||||
+ rc = -errno;
|
|
||||||
+ VIR_FREE(path);
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ virCgroupInherit(path);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ VIR_FREE(path);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int virCgroupRoot(virCgroupPtr *root)
|
|
||||||
+{
|
|
||||||
+ int rc = 0;
|
|
||||||
+ char *grppath = NULL;
|
|
||||||
+
|
|
||||||
+ if (VIR_ALLOC((*root)) != 0) {
|
|
||||||
+ rc = -ENOMEM;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ (*root)->path = strdup("libvirt");
|
|
||||||
+ if ((*root)->path == NULL) {
|
|
||||||
+ rc = -ENOMEM;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rc = virCgroupMakeGroup((*root)->path);
|
|
||||||
+out:
|
|
||||||
+ if (rc != 0)
|
|
||||||
+ virCgroupFree(root);
|
|
||||||
+ VIR_FREE(grppath);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int virCgroupNew(virCgroupPtr *parent,
|
|
||||||
+ const char *group,
|
|
||||||
+ virCgroupPtr *newgroup)
|
|
||||||
+{
|
|
||||||
+ int rc = 0;
|
|
||||||
+ char *typpath = NULL;
|
|
||||||
+
|
|
||||||
+ *newgroup = NULL;
|
|
||||||
+
|
|
||||||
+ if (*parent == NULL) {
|
|
||||||
+ rc = virCgroupRoot(parent);
|
|
||||||
+ if (rc != 0)
|
|
||||||
+ goto err;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (VIR_ALLOC((*newgroup)) != 0) {
|
|
||||||
+ rc = -ENOMEM;
|
|
||||||
+ goto err;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rc = asprintf(&((*newgroup)->path),
|
|
||||||
+ "%s/%s",
|
|
||||||
+ (*parent)->path,
|
|
||||||
+ group);
|
|
||||||
+ if (rc == -1) {
|
|
||||||
+ rc = -ENOMEM;
|
|
||||||
+ goto err;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rc = 0;
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+err:
|
|
||||||
+ virCgroupFree(newgroup);
|
|
||||||
+ *newgroup = NULL;
|
|
||||||
+
|
|
||||||
+ VIR_FREE(typpath);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int virCgroupOpen(virCgroupPtr parent,
|
|
||||||
+ const char *group,
|
|
||||||
+ virCgroupPtr *newgroup)
|
|
||||||
+{
|
|
||||||
+ int rc = 0;
|
|
||||||
+ char *grppath = NULL;
|
|
||||||
+ bool free_parent = (parent == NULL);
|
|
||||||
+
|
|
||||||
+ rc = virCgroupNew(&parent, group, newgroup);
|
|
||||||
+ if (rc != 0)
|
|
||||||
+ goto err;
|
|
||||||
+
|
|
||||||
+ if (free_parent)
|
|
||||||
+ virCgroupFree(&parent);
|
|
||||||
+
|
|
||||||
+ rc = virCgroupPathOfGroup((*newgroup)->path,
|
|
||||||
+ supported_controllers[0],
|
|
||||||
+ &grppath);
|
|
||||||
+ if (rc != 0)
|
|
||||||
+ goto err;
|
|
||||||
+
|
|
||||||
+ if (access(grppath, F_OK) != 0) {
|
|
||||||
+ rc = -ENOENT;
|
|
||||||
+ goto err;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+err:
|
|
||||||
+ virCgroupFree(newgroup);
|
|
||||||
+ *newgroup = NULL;
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int virCgroupCreate(virCgroupPtr parent,
|
|
||||||
+ const char *group,
|
|
||||||
+ virCgroupPtr *newgroup)
|
|
||||||
+{
|
|
||||||
+ int rc = 0;
|
|
||||||
+ bool free_parent = (parent == NULL);
|
|
||||||
+
|
|
||||||
+ rc = virCgroupNew(&parent, group, newgroup);
|
|
||||||
+ if (rc != 0) {
|
|
||||||
+ DEBUG0("Unable to allocate new virCgroup structure");
|
|
||||||
+ goto err;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rc = virCgroupMakeGroup((*newgroup)->path);
|
|
||||||
+ if (rc != 0)
|
|
||||||
+ goto err;
|
|
||||||
+
|
|
||||||
+ if (free_parent)
|
|
||||||
+ virCgroupFree(&parent);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+err:
|
|
||||||
+ virCgroupFree(newgroup);
|
|
||||||
+ *newgroup = NULL;
|
|
||||||
+
|
|
||||||
+ if (free_parent)
|
|
||||||
+ virCgroupFree(&parent);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * virCgroupRemove:
|
|
||||||
+ *
|
|
||||||
+ * @group: The group to be removed
|
|
||||||
+ *
|
|
||||||
+ * Returns: 0 on success
|
|
||||||
+ */
|
|
||||||
+int virCgroupRemove(virCgroupPtr group)
|
|
||||||
+{
|
|
||||||
+ int rc = 0;
|
|
||||||
+ int i;
|
|
||||||
+ char *grppath = NULL;
|
|
||||||
+
|
|
||||||
+ for (i = 0; supported_controllers[i] != NULL; i++) {
|
|
||||||
+ if (virCgroupPathOfGroup(group->path,
|
|
||||||
+ supported_controllers[i],
|
|
||||||
+ &grppath) != 0)
|
|
||||||
+ continue;
|
|
||||||
+
|
|
||||||
+ if (rmdir(grppath) != 0)
|
|
||||||
+ rc = -errno;
|
|
||||||
+
|
|
||||||
+ VIR_FREE(grppath);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * virCgroupAddTask:
|
|
||||||
+ *
|
|
||||||
+ * @group: The cgroup to add a task to
|
|
||||||
+ * @pid: The pid of the task to add
|
|
||||||
+ *
|
|
||||||
+ * Returns: 0 on success
|
|
||||||
+ */
|
|
||||||
+int virCgroupAddTask(virCgroupPtr group, pid_t pid)
|
|
||||||
+{
|
|
||||||
+ int rc = 0;
|
|
||||||
+ int fd = -1;
|
|
||||||
+ int i;
|
|
||||||
+ char *grppath = NULL;
|
|
||||||
+ char *taskpath = NULL;
|
|
||||||
+ char *pidstr = NULL;
|
|
||||||
+
|
|
||||||
+ for (i = 0; supported_controllers[i] != NULL; i++) {
|
|
||||||
+ rc = virCgroupPathOfGroup(group->path,
|
|
||||||
+ supported_controllers[i],
|
|
||||||
+ &grppath);
|
|
||||||
+ if (rc != 0)
|
|
||||||
+ goto done;
|
|
||||||
+
|
|
||||||
+ if (asprintf(&taskpath, "%s/tasks", grppath) == -1) {
|
|
||||||
+ rc = -ENOMEM;
|
|
||||||
+ goto done;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ fd = open(taskpath, O_WRONLY);
|
|
||||||
+ if (fd < 0) {
|
|
||||||
+ rc = -errno;
|
|
||||||
+ goto done;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (asprintf(&pidstr, "%lu", (unsigned long)pid) == -1) {
|
|
||||||
+ rc = -ENOMEM;
|
|
||||||
+ goto done;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (write(fd, pidstr, strlen(pidstr)) <= 0) {
|
|
||||||
+ rc = -errno;
|
|
||||||
+ goto done;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ done:
|
|
||||||
+ VIR_FREE(grppath);
|
|
||||||
+ VIR_FREE(taskpath);
|
|
||||||
+ VIR_FREE(pidstr);
|
|
||||||
+ close(fd);
|
|
||||||
+
|
|
||||||
+ if (rc != 0)
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * virCgroupForDomain:
|
|
||||||
+ *
|
|
||||||
+ * @def: Domain definition to create cgroup for
|
|
||||||
+ * @driverName: Classification of this domain type (e.g., xen, qemu, lxc)
|
|
||||||
+ * @group: Pointer to returned virCgroupPtr
|
|
||||||
+ *
|
|
||||||
+ * Returns 0 on success
|
|
||||||
+ */
|
|
||||||
+int virCgroupForDomain(virDomainDefPtr def,
|
|
||||||
+ const char *driverName,
|
|
||||||
+ virCgroupPtr *group)
|
|
||||||
+{
|
|
||||||
+ int rc;
|
|
||||||
+ virCgroupPtr typegrp = NULL;
|
|
||||||
+
|
|
||||||
+ rc = virCgroupOpen(NULL, driverName, &typegrp);
|
|
||||||
+ if (rc == -ENOENT) {
|
|
||||||
+ rc = virCgroupCreate(NULL, driverName, &typegrp);
|
|
||||||
+ if (rc != 0)
|
|
||||||
+ goto out;
|
|
||||||
+ } else if (rc != 0)
|
|
||||||
+ goto out;
|
|
||||||
+
|
|
||||||
+ rc = virCgroupOpen(typegrp, def->name, group);
|
|
||||||
+ if (rc == -ENOENT)
|
|
||||||
+ rc = virCgroupCreate(typegrp, def->name, group);
|
|
||||||
+out:
|
|
||||||
+ virCgroupFree(&typegrp);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * virCgroupSetMemory:
|
|
||||||
+ *
|
|
||||||
+ * @group: The cgroup to change memory for
|
|
||||||
+ * @kb: The memory amount in kilobytes
|
|
||||||
+ *
|
|
||||||
+ * Returns: 0 on success
|
|
||||||
+ */
|
|
||||||
+int virCgroupSetMemory(virCgroupPtr group, unsigned long kb)
|
|
||||||
+{
|
|
||||||
+ return virCgroupSetValueU64(group,
|
|
||||||
+ "memory.limit_in_bytes",
|
|
||||||
+ kb << 10);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * virCgroupDenyAllDevices:
|
|
||||||
+ *
|
|
||||||
+ * @group: The cgroup to deny devices for
|
|
||||||
+ *
|
|
||||||
+ * Returns: 0 on success
|
|
||||||
+ */
|
|
||||||
+int virCgroupDenyAllDevices(virCgroupPtr group)
|
|
||||||
+{
|
|
||||||
+ return virCgroupSetValueStr(group,
|
|
||||||
+ "devices.deny",
|
|
||||||
+ "a");
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * virCgroupAllowDevice:
|
|
||||||
+ *
|
|
||||||
+ * @group: The cgroup to allow a device for
|
|
||||||
+ * @type: The device type (i.e., 'c' or 'b')
|
|
||||||
+ * @major: The major number of the device
|
|
||||||
+ * @minor: The minor number of the device
|
|
||||||
+ *
|
|
||||||
+ * Returns: 0 on success
|
|
||||||
+ */
|
|
||||||
+int virCgroupAllowDevice(virCgroupPtr group,
|
|
||||||
+ char type,
|
|
||||||
+ int major,
|
|
||||||
+ int minor)
|
|
||||||
+{
|
|
||||||
+ int rc;
|
|
||||||
+ char *devstr = NULL;
|
|
||||||
+
|
|
||||||
+ if (asprintf(&devstr, "%c %i:%i rwm", type, major, minor) == -1) {
|
|
||||||
+ rc = -ENOMEM;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rc = virCgroupSetValueStr(group,
|
|
||||||
+ "devices.allow",
|
|
||||||
+ devstr);
|
|
||||||
+out:
|
|
||||||
+ VIR_FREE(devstr);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
Index: libvirt-0.4.6/src/cgroup.h
|
|
||||||
===================================================================
|
|
||||||
--- /dev/null
|
|
||||||
+++ libvirt-0.4.6/src/cgroup.h
|
|
||||||
@@ -0,0 +1,43 @@
|
|
||||||
+/*
|
|
||||||
+ * cgroup.h: Interface to tools for managing cgroups
|
|
||||||
+ *
|
|
||||||
+ * Copyright IBM Corp. 2008
|
|
||||||
+ *
|
|
||||||
+ * See COPYING.LIB for the License of this software
|
|
||||||
+ *
|
|
||||||
+ * Authors:
|
|
||||||
+ * Dan Smith <danms@us.ibm.com>
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#ifndef CGROUP_H
|
|
||||||
+#define CGROUP_H
|
|
||||||
+
|
|
||||||
+#include <stdint.h>
|
|
||||||
+
|
|
||||||
+struct virCgroup;
|
|
||||||
+typedef struct virCgroup *virCgroupPtr;
|
|
||||||
+
|
|
||||||
+#include "domain_conf.h"
|
|
||||||
+
|
|
||||||
+int virCgroupHaveSupport(void);
|
|
||||||
+
|
|
||||||
+int virCgroupForDomain(virDomainDefPtr def,
|
|
||||||
+ const char *driverName,
|
|
||||||
+ virCgroupPtr *group);
|
|
||||||
+
|
|
||||||
+int virCgroupAddTask(virCgroupPtr group, pid_t pid);
|
|
||||||
+
|
|
||||||
+int virCgroupSetMemory(virCgroupPtr group, unsigned long kb);
|
|
||||||
+
|
|
||||||
+int virCgroupDenyAllDevices(virCgroupPtr group);
|
|
||||||
+
|
|
||||||
+int virCgroupAllowDevice(virCgroupPtr group,
|
|
||||||
+ char type,
|
|
||||||
+ int major,
|
|
||||||
+ int minor);
|
|
||||||
+
|
|
||||||
+int virCgroupRemove(virCgroupPtr group);
|
|
||||||
+
|
|
||||||
+void virCgroupFree(virCgroupPtr *group);
|
|
||||||
+
|
|
||||||
+#endif /* CGROUP_H */
|
|
118
cgshares.patch
118
cgshares.patch
@ -1,118 +0,0 @@
|
|||||||
Add get/set of cpu.shares to cgroup implementation
|
|
||||||
|
|
||||||
This brings get/set of U64 out of the #if 0, which looks messier than it is.
|
|
||||||
|
|
||||||
diff -r d18631472325 src/cgroup.c
|
|
||||||
--- a/src/cgroup.c Tue Oct 07 08:19:56 2008 -0700
|
|
||||||
+++ b/src/cgroup.c Tue Oct 07 08:20:56 2008 -0700
|
|
||||||
@@ -224,26 +224,6 @@
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
-#if 0
|
|
||||||
-/* This is included for completeness, but not yet used */
|
|
||||||
-
|
|
||||||
-static int virCgroupSetValueI64(virCgroupPtr group,
|
|
||||||
- const char *key,
|
|
||||||
- int64_t value)
|
|
||||||
-{
|
|
||||||
- char *strval = NULL;
|
|
||||||
- int rc;
|
|
||||||
-
|
|
||||||
- if (asprintf(&strval, "%" PRIi64, value) == -1)
|
|
||||||
- return -ENOMEM;
|
|
||||||
-
|
|
||||||
- rc = virCgroupSetValueStr(group, key, strval);
|
|
||||||
-
|
|
||||||
- VIR_FREE(strval);
|
|
||||||
-
|
|
||||||
- return rc;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
static int virCgroupGetValueStr(virCgroupPtr group,
|
|
||||||
const char *key,
|
|
||||||
char **value)
|
|
||||||
@@ -293,20 +273,21 @@
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
-static int virCgroupGetValueU64(virCgroupPtr group,
|
|
||||||
+#if 0
|
|
||||||
+/* This is included for completeness, but not yet used */
|
|
||||||
+
|
|
||||||
+static int virCgroupSetValueI64(virCgroupPtr group,
|
|
||||||
const char *key,
|
|
||||||
- uint64_t *value)
|
|
||||||
+ int64_t value)
|
|
||||||
{
|
|
||||||
char *strval = NULL;
|
|
||||||
- int rc = 0;
|
|
||||||
+ int rc;
|
|
||||||
|
|
||||||
- rc = virCgroupGetValueStr(group, key, &strval);
|
|
||||||
- if (rc != 0)
|
|
||||||
- goto out;
|
|
||||||
+ if (asprintf(&strval, "%" PRIi64, value) == -1)
|
|
||||||
+ return -ENOMEM;
|
|
||||||
|
|
||||||
- if (sscanf(strval, "%" SCNu64, value) != 1)
|
|
||||||
- rc = -EINVAL;
|
|
||||||
-out:
|
|
||||||
+ rc = virCgroupSetValueStr(group, key, strval);
|
|
||||||
+
|
|
||||||
VIR_FREE(strval);
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
@@ -331,6 +312,25 @@
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
+
|
|
||||||
+static int virCgroupGetValueU64(virCgroupPtr group,
|
|
||||||
+ const char *key,
|
|
||||||
+ uint64_t *value)
|
|
||||||
+{
|
|
||||||
+ char *strval = NULL;
|
|
||||||
+ int rc = 0;
|
|
||||||
+
|
|
||||||
+ rc = virCgroupGetValueStr(group, key, &strval);
|
|
||||||
+ if (rc != 0)
|
|
||||||
+ goto out;
|
|
||||||
+
|
|
||||||
+ if (sscanf(strval, "%" SCNu64, value) != 1)
|
|
||||||
+ rc = -EINVAL;
|
|
||||||
+out:
|
|
||||||
+ VIR_FREE(strval);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
|
|
||||||
static int _virCgroupInherit(const char *path,
|
|
||||||
const char *key)
|
|
||||||
@@ -760,3 +760,13 @@
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+int virCgroupSetCpuShares(virCgroupPtr group, unsigned long shares)
|
|
||||||
+{
|
|
||||||
+ return virCgroupSetValueU64(group, "cpu.shares", (uint64_t)shares);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int virCgroupGetCpuShares(virCgroupPtr group, unsigned long *shares)
|
|
||||||
+{
|
|
||||||
+ return virCgroupGetValueU64(group, "cpu.shares", (uint64_t *)shares);
|
|
||||||
+}
|
|
||||||
diff -r d18631472325 src/cgroup.h
|
|
||||||
--- a/src/cgroup.h Tue Oct 07 08:19:56 2008 -0700
|
|
||||||
+++ b/src/cgroup.h Tue Oct 07 08:20:56 2008 -0700
|
|
||||||
@@ -36,6 +36,9 @@
|
|
||||||
int major,
|
|
||||||
int minor);
|
|
||||||
|
|
||||||
+int virCgroupSetCpuShares(virCgroupPtr group, unsigned long shares);
|
|
||||||
+int virCgroupGetCpuShares(virCgroupPtr group, unsigned long *shares);
|
|
||||||
+
|
|
||||||
int virCgroupRemove(virCgroupPtr group);
|
|
||||||
|
|
||||||
void virCgroupFree(virCgroupPtr *group);
|
|
10
clone.patch
10
clone.patch
@ -1,6 +1,8 @@
|
|||||||
--- src/lxc_container.c
|
Index: src/lxc_container.c
|
||||||
|
===================================================================
|
||||||
|
--- src/lxc_container.c.orig
|
||||||
+++ src/lxc_container.c
|
+++ src/lxc_container.c
|
||||||
@@ -604,6 +604,9 @@ int lxcContainerStart(virDomainDefPtr de
|
@@ -603,6 +603,9 @@ int lxcContainerStart(virDomainDefPtr de
|
||||||
lxc_child_argv_t args = { def, nveths, veths, control, ttyPath };
|
lxc_child_argv_t args = { def, nveths, veths, control, ttyPath };
|
||||||
|
|
||||||
/* allocate a stack for the container */
|
/* allocate a stack for the container */
|
||||||
@ -10,7 +12,7 @@
|
|||||||
if (VIR_ALLOC_N(stack, stacksize) < 0) {
|
if (VIR_ALLOC_N(stack, stacksize) < 0) {
|
||||||
lxcError(NULL, NULL, VIR_ERR_NO_MEMORY, NULL);
|
lxcError(NULL, NULL, VIR_ERR_NO_MEMORY, NULL);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -615,7 +618,11 @@ int lxcContainerStart(virDomainDefPtr de
|
@@ -614,7 +617,11 @@ int lxcContainerStart(virDomainDefPtr de
|
||||||
if (def->nets != NULL)
|
if (def->nets != NULL)
|
||||||
flags |= CLONE_NEWNET;
|
flags |= CLONE_NEWNET;
|
||||||
|
|
||||||
@ -22,7 +24,7 @@
|
|||||||
VIR_FREE(stack);
|
VIR_FREE(stack);
|
||||||
DEBUG("clone() returned, %d", pid);
|
DEBUG("clone() returned, %d", pid);
|
||||||
|
|
||||||
@@ -641,18 +648,26 @@ int lxcContainerAvailable(int features)
|
@@ -640,18 +647,26 @@ int lxcContainerAvailable(int features)
|
||||||
char *childStack;
|
char *childStack;
|
||||||
char *stack;
|
char *stack;
|
||||||
int childStatus;
|
int childStatus;
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
Index: libvirt-0.4.6/src/libvirt.c
|
diff --git a/src/libvirt.c b/src/libvirt.c
|
||||||
===================================================================
|
--- a/src/libvirt.c
|
||||||
--- libvirt-0.4.6.orig/src/libvirt.c
|
+++ b/src/libvirt.c
|
||||||
+++ libvirt-0.4.6/src/libvirt.c
|
@@ -2296,6 +2296,16 @@ virDomainMigrate (virDomainPtr domain,
|
||||||
@@ -2342,6 +2342,16 @@ virDomainMigrate (virDomainPtr domain,
|
conn = domain->conn; /* Source connection. */
|
||||||
return NULL;
|
if (!VIR_IS_CONNECT (dconn)) {
|
||||||
}
|
virLibConnError (conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ if (domain->conn->flags & VIR_CONNECT_RO) {
|
+ if (domain->conn->flags & VIR_CONNECT_RO) {
|
||||||
+ virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
+ virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||||
+ return NULL;
|
+ return NULL;
|
||||||
@ -13,13 +15,10 @@ Index: libvirt-0.4.6/src/libvirt.c
|
|||||||
+ if (dconn->flags & VIR_CONNECT_RO) {
|
+ if (dconn->flags & VIR_CONNECT_RO) {
|
||||||
+ /* NB, delibrately report error against source object, not dest here */
|
+ /* NB, delibrately report error against source object, not dest here */
|
||||||
+ virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
+ virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||||
+ return NULL;
|
return NULL;
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
/* Check that migration is supported by both drivers. */
|
@@ -2426,6 +2436,11 @@ virDomainMigratePrepare (virConnectPtr d
|
||||||
if (!VIR_DRV_SUPPORTS_FEATURE (conn->driver, conn,
|
|
||||||
VIR_DRV_FEATURE_MIGRATION_V1) ||
|
|
||||||
@@ -2419,6 +2429,11 @@ __virDomainMigratePrepare (virConnectPtr
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +30,7 @@ Index: libvirt-0.4.6/src/libvirt.c
|
|||||||
if (dconn->driver->domainMigratePrepare)
|
if (dconn->driver->domainMigratePrepare)
|
||||||
return dconn->driver->domainMigratePrepare (dconn, cookie, cookielen,
|
return dconn->driver->domainMigratePrepare (dconn, cookie, cookielen,
|
||||||
uri_in, uri_out,
|
uri_in, uri_out,
|
||||||
@@ -2449,6 +2464,11 @@ __virDomainMigratePerform (virDomainPtr
|
@@ -2457,6 +2472,11 @@ virDomainMigratePerform (virDomainPtr do
|
||||||
}
|
}
|
||||||
conn = domain->conn;
|
conn = domain->conn;
|
||||||
|
|
||||||
@ -43,7 +42,31 @@ Index: libvirt-0.4.6/src/libvirt.c
|
|||||||
if (conn->driver->domainMigratePerform)
|
if (conn->driver->domainMigratePerform)
|
||||||
return conn->driver->domainMigratePerform (domain, cookie, cookielen,
|
return conn->driver->domainMigratePerform (domain, cookie, cookielen,
|
||||||
uri,
|
uri,
|
||||||
@@ -2476,6 +2496,11 @@ __virDomainMigrateFinish (virConnectPtr
|
@@ -2482,6 +2502,11 @@ virDomainMigrateFinish (virConnectPtr dc
|
||||||
|
|
||||||
|
if (!VIR_IS_CONNECT (dconn)) {
|
||||||
|
virLibConnError (NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (dconn->flags & VIR_CONNECT_RO) {
|
||||||
|
+ virLibConnError(dconn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -2517,6 +2542,11 @@ virDomainMigratePrepare2 (virConnectPtr
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (dconn->flags & VIR_CONNECT_RO) {
|
||||||
|
+ virLibConnError(dconn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (dconn->driver->domainMigratePrepare2)
|
||||||
|
return dconn->driver->domainMigratePrepare2 (dconn, cookie, cookielen,
|
||||||
|
uri_in, uri_out,
|
||||||
|
@@ -2547,6 +2577,11 @@ virDomainMigrateFinish2 (virConnectPtr d
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,10 +75,10 @@ Index: libvirt-0.4.6/src/libvirt.c
|
|||||||
+ return NULL;
|
+ return NULL;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
if (dconn->driver->domainMigrateFinish)
|
if (dconn->driver->domainMigrateFinish2)
|
||||||
return dconn->driver->domainMigrateFinish (dconn, dname,
|
return dconn->driver->domainMigrateFinish2 (dconn, dname,
|
||||||
cookie, cookielen,
|
cookie, cookielen,
|
||||||
@@ -2833,6 +2858,11 @@ virDomainBlockPeek (virDomainPtr dom,
|
@@ -2905,6 +2940,11 @@ virDomainBlockPeek (virDomainPtr dom,
|
||||||
}
|
}
|
||||||
conn = dom->conn;
|
conn = dom->conn;
|
||||||
|
|
||||||
@ -67,7 +90,7 @@ Index: libvirt-0.4.6/src/libvirt.c
|
|||||||
if (!path) {
|
if (!path) {
|
||||||
virLibDomainError (dom, VIR_ERR_INVALID_ARG,
|
virLibDomainError (dom, VIR_ERR_INVALID_ARG,
|
||||||
_("path is NULL"));
|
_("path is NULL"));
|
||||||
@@ -2908,6 +2938,11 @@ virDomainMemoryPeek (virDomainPtr dom,
|
@@ -2980,6 +3020,11 @@ virDomainMemoryPeek (virDomainPtr dom,
|
||||||
}
|
}
|
||||||
conn = dom->conn;
|
conn = dom->conn;
|
||||||
|
|
||||||
@ -79,19 +102,19 @@ Index: libvirt-0.4.6/src/libvirt.c
|
|||||||
/* Flags must be VIR_MEMORY_VIRTUAL at the moment.
|
/* Flags must be VIR_MEMORY_VIRTUAL at the moment.
|
||||||
*
|
*
|
||||||
* Note on access to physical memory: A VIR_MEMORY_PHYSICAL flag is
|
* Note on access to physical memory: A VIR_MEMORY_PHYSICAL flag is
|
||||||
@@ -3175,6 +3210,11 @@ virDomainSetAutostart(virDomainPtr domai
|
@@ -3246,6 +3291,11 @@ virDomainSetAutostart(virDomainPtr domai
|
||||||
|
}
|
||||||
|
|
||||||
conn = domain->conn;
|
conn = domain->conn;
|
||||||
|
+
|
||||||
+ if (domain->conn->flags & VIR_CONNECT_RO) {
|
+ if (domain->conn->flags & VIR_CONNECT_RO) {
|
||||||
+ virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
+ virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||||
+ return (-1);
|
+ return (-1);
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
if (conn->driver->domainSetAutostart)
|
if (conn->driver->domainSetAutostart)
|
||||||
return conn->driver->domainSetAutostart (domain, autostart);
|
return conn->driver->domainSetAutostart (domain, autostart);
|
||||||
|
@@ -4197,6 +4247,11 @@ virNetworkSetAutostart(virNetworkPtr net
|
||||||
@@ -4125,6 +4165,11 @@ virNetworkSetAutostart(virNetworkPtr net
|
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +126,7 @@ Index: libvirt-0.4.6/src/libvirt.c
|
|||||||
conn = network->conn;
|
conn = network->conn;
|
||||||
|
|
||||||
if (conn->networkDriver && conn->networkDriver->networkSetAutostart)
|
if (conn->networkDriver && conn->networkDriver->networkSetAutostart)
|
||||||
@@ -4323,6 +4368,11 @@ virConnectFindStoragePoolSources(virConn
|
@@ -4395,6 +4450,11 @@ virConnectFindStoragePoolSources(virConn
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +138,7 @@ Index: libvirt-0.4.6/src/libvirt.c
|
|||||||
if (conn->storageDriver && conn->storageDriver->findPoolSources)
|
if (conn->storageDriver && conn->storageDriver->findPoolSources)
|
||||||
return conn->storageDriver->findPoolSources(conn, type, srcSpec, flags);
|
return conn->storageDriver->findPoolSources(conn, type, srcSpec, flags);
|
||||||
|
|
||||||
@@ -4996,6 +5046,11 @@ virStoragePoolSetAutostart(virStoragePoo
|
@@ -5068,6 +5128,11 @@ virStoragePoolSetAutostart(virStoragePoo
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
Index: libvirt-0.4.6/src/xend_internal.c
|
Index: libvirt-0.5.1/src/xend_internal.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- libvirt-0.4.6.orig/src/xend_internal.c
|
--- libvirt-0.5.1.orig/src/xend_internal.c
|
||||||
+++ libvirt-0.4.6/src/xend_internal.c
|
+++ libvirt-0.5.1/src/xend_internal.c
|
||||||
@@ -5615,11 +5615,16 @@ virDomainXMLDevID(virDomainPtr domain,
|
@@ -5465,11 +5465,16 @@ virDomainXMLDevID(virDomainPtr domain,
|
||||||
char *xref;
|
char *xref;
|
||||||
|
|
||||||
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
|
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
|
||||||
@ -21,11 +21,11 @@ Index: libvirt-0.4.6/src/xend_internal.c
|
|||||||
if (xref == NULL)
|
if (xref == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
Index: libvirt-0.4.6/src/xs_internal.c
|
Index: libvirt-0.5.1/src/xs_internal.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- libvirt-0.4.6.orig/src/xs_internal.c
|
--- libvirt-0.5.1.orig/src/xs_internal.c
|
||||||
+++ libvirt-0.4.6/src/xs_internal.c
|
+++ libvirt-0.5.1/src/xs_internal.c
|
||||||
@@ -868,7 +868,8 @@ xenStoreDomainGetNetworkID(virConnectPtr
|
@@ -917,7 +917,8 @@ xenStoreDomainGetNetworkID(virConnectPtr
|
||||||
* freed by the caller.
|
* freed by the caller.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
@ -35,7 +35,7 @@ Index: libvirt-0.4.6/src/xs_internal.c
|
|||||||
char dir[80], path[128], **list = NULL, *val = NULL;
|
char dir[80], path[128], **list = NULL, *val = NULL;
|
||||||
unsigned int devlen, len, i, num;
|
unsigned int devlen, len, i, num;
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
@@ -886,7 +887,7 @@ xenStoreDomainGetDiskID(virConnectPtr co
|
@@ -935,7 +936,7 @@ xenStoreDomainGetDiskID(virConnectPtr co
|
||||||
if (devlen <= 0)
|
if (devlen <= 0)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
@ -44,11 +44,11 @@ Index: libvirt-0.4.6/src/xs_internal.c
|
|||||||
list = xs_directory(priv->xshandle, 0, dir, &num);
|
list = xs_directory(priv->xshandle, 0, dir, &num);
|
||||||
if (list != NULL) {
|
if (list != NULL) {
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
Index: libvirt-0.4.6/src/xs_internal.h
|
Index: libvirt-0.5.1/src/xs_internal.h
|
||||||
===================================================================
|
===================================================================
|
||||||
--- libvirt-0.4.6.orig/src/xs_internal.h
|
--- libvirt-0.5.1.orig/src/xs_internal.h
|
||||||
+++ libvirt-0.4.6/src/xs_internal.h
|
+++ libvirt-0.5.1/src/xs_internal.h
|
||||||
@@ -49,7 +49,8 @@ char * xenStoreDomainGetNetworkID(virCo
|
@@ -48,7 +48,8 @@ char * xenStoreDomainGetNetworkID(virCo
|
||||||
const char *mac);
|
const char *mac);
|
||||||
char * xenStoreDomainGetDiskID(virConnectPtr conn,
|
char * xenStoreDomainGetDiskID(virConnectPtr conn,
|
||||||
int id,
|
int id,
|
||||||
@ -57,4 +57,4 @@ Index: libvirt-0.4.6/src/xs_internal.h
|
|||||||
+ const char *class);
|
+ const char *class);
|
||||||
char * xenStoreDomainGetName(virConnectPtr conn,
|
char * xenStoreDomainGetName(virConnectPtr conn,
|
||||||
int id);
|
int id);
|
||||||
|
int xenStoreDomainGetUUID(virConnectPtr conn,
|
||||||
|
@ -1,19 +1,17 @@
|
|||||||
Index: libvirt-0.4.5/src/storage_backend_fs.c
|
Index: libvirt-0.5.1/src/storage_backend_fs.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- libvirt-0.4.5.orig/src/storage_backend_fs.c
|
--- libvirt-0.5.1.orig/src/storage_backend_fs.c
|
||||||
+++ libvirt-0.4.5/src/storage_backend_fs.c
|
+++ libvirt-0.5.1/src/storage_backend_fs.c
|
||||||
@@ -583,7 +583,9 @@ virStorageBackendFileSystemIsMounted(vir
|
@@ -381,6 +381,8 @@ virStorageBackendFileSystemIsMounted(vir
|
||||||
virStoragePoolObjPtr pool) {
|
virStoragePoolObjPtr pool) {
|
||||||
FILE *mtab;
|
FILE *mtab;
|
||||||
struct mntent *ent;
|
struct mntent *ent;
|
||||||
-
|
|
||||||
+ char *mpoint;
|
+ char *mpoint;
|
||||||
+ size_t len;
|
+ size_t len;
|
||||||
+
|
|
||||||
if ((mtab = fopen(_PATH_MOUNTED, "r")) == NULL) {
|
if ((mtab = fopen(_PATH_MOUNTED, "r")) == NULL) {
|
||||||
virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
|
virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
_("cannot read %s: %s"),
|
@@ -389,14 +391,26 @@ virStorageBackendFileSystemIsMounted(vir
|
||||||
@@ -591,14 +593,27 @@ virStorageBackendFileSystemIsMounted(vir
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,11 +20,10 @@ Index: libvirt-0.4.5/src/storage_backend_fs.c
|
|||||||
+ "%s", strerror(errno));
|
+ "%s", strerror(errno));
|
||||||
+ return -1;
|
+ return -1;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ len = strlen(mpoint);
|
+ len = strlen(mpoint);
|
||||||
+ if (mpoint[len-1] == '/')
|
+ if (mpoint[len-1] == '/')
|
||||||
+ mpoint[len-1] = NULL;
|
+ mpoint[len-1] = NULL;
|
||||||
+
|
|
||||||
+
|
+
|
||||||
while ((ent = getmntent(mtab)) != NULL) {
|
while ((ent = getmntent(mtab)) != NULL) {
|
||||||
- if (STREQ(ent->mnt_dir, pool->def->target.path)) {
|
- if (STREQ(ent->mnt_dir, pool->def->target.path)) {
|
||||||
@ -42,7 +39,7 @@ Index: libvirt-0.4.5/src/storage_backend_fs.c
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -951,12 +966,16 @@ virStorageBackendFileSystemDelete(virCon
|
@@ -735,12 +749,16 @@ virStorageBackendFileSystemDelete(virCon
|
||||||
{
|
{
|
||||||
/* XXX delete all vols first ? */
|
/* XXX delete all vols first ? */
|
||||||
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:135ab72ebfba0359972e0fa0b4e643c4b744a0ebc9d60b3fb5e5518b5e575355
|
|
||||||
size 3136828
|
|
3
libvirt-0.5.1.tar.bz2
Normal file
3
libvirt-0.5.1.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:cc6fc1909f40667bd32574a11f4052160ed94620b79f3d5db5541f25a12429ee
|
||||||
|
size 3778088
|
@ -1,3 +1,17 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jan 28 15:45:25 MST 2009 - jfehlig@novell.com
|
||||||
|
|
||||||
|
- Updated to version 0.5.1
|
||||||
|
- CPU and scheduler support for LXC
|
||||||
|
- SDL display configuration
|
||||||
|
- domain lifecycle event support for QEmu and Xen with python
|
||||||
|
bindings
|
||||||
|
- KVM/QEmu migration support
|
||||||
|
- User Mode Linux driver
|
||||||
|
- API for node device enumeration using HAL and DeviceKit with
|
||||||
|
python bindings
|
||||||
|
- Many bug fixes and improvements
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Jan 9 09:41:49 MST 2009 - jfehlig@novell.com
|
Fri Jan 9 09:41:49 MST 2009 - jfehlig@novell.com
|
||||||
|
|
||||||
|
64
libvirt.spec
64
libvirt.spec
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# spec file for package libvirt (Version 0.4.6)
|
# spec file for package libvirt (Version 0.5.1)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
@ -30,7 +30,7 @@
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
Name: libvirt
|
Name: libvirt
|
||||||
BuildRequires: PolicyKit-devel bridge-utils cyrus-sasl-devel fdupes gettext gnutls-devel iptables-devel libxml2-devel lvm2 ncurses-devel parted-devel pkg-config python-devel readline-devel util-linux xhtml-dtd
|
BuildRequires: PolicyKit-devel bridge-utils cyrus-sasl-devel fdupes gettext gnutls-devel hal-devel iptables-devel libnuma-devel libxml2-devel lvm2 ncurses-devel parted-devel pkg-config python-devel readline-devel util-linux xhtml-dtd
|
||||||
%if %{with_xen}
|
%if %{with_xen}
|
||||||
BuildRequires: xen-devel
|
BuildRequires: xen-devel
|
||||||
%endif
|
%endif
|
||||||
@ -48,8 +48,8 @@ Url: http://libvirt.org/
|
|||||||
License: LGPL v2.1 or later
|
License: LGPL v2.1 or later
|
||||||
Group: Development/Libraries/C and C++
|
Group: Development/Libraries/C and C++
|
||||||
AutoReqProv: yes
|
AutoReqProv: yes
|
||||||
Version: 0.4.6
|
Version: 0.5.1
|
||||||
Release: 14
|
Release: 1
|
||||||
Summary: A C toolkit to interract with the virtualization capabilities of Linux
|
Summary: A C toolkit to interract with the virtualization capabilities of Linux
|
||||||
Requires: readline
|
Requires: readline
|
||||||
Requires: ncurses
|
Requires: ncurses
|
||||||
@ -64,29 +64,20 @@ Requires: dnsmasq
|
|||||||
Requires: PolicyKit >= 0.6
|
Requires: PolicyKit >= 0.6
|
||||||
Requires: socat
|
Requires: socat
|
||||||
Requires: open-iscsi
|
Requires: open-iscsi
|
||||||
|
Requires: nfs-client
|
||||||
|
Requires: hal
|
||||||
Source0: %{name}-%{version}.tar.bz2
|
Source0: %{name}-%{version}.tar.bz2
|
||||||
Source1: libvirtd.init
|
Source1: libvirtd.init
|
||||||
Patch0: socat.patch
|
Patch0: socat.patch
|
||||||
Patch1: libvirtd-defaults.patch
|
Patch1: libvirtd-defaults.patch
|
||||||
Patch2: fs-storage-driver.patch
|
Patch2: fs-storage-driver.patch
|
||||||
Patch3: snapshots.patch
|
Patch3: clone.patch
|
||||||
Patch4: vif-parsing.patch
|
Patch4: vnc-port.patch
|
||||||
Patch5: xen-maxmem.patch
|
Patch5: xen-pv-cdrom.patch
|
||||||
Patch6: cgroup.patch
|
Patch6: detach-disk.patch
|
||||||
Patch7: lxc_res_mem.patch
|
Patch7: migrate-params.patch
|
||||||
Patch8: cgshares.patch
|
Patch8: cve-2008-5086.patch
|
||||||
Patch9: lxcsched.patch
|
Patch9: devhelp.patch
|
||||||
Patch10: lxcvirsh.patch
|
|
||||||
Patch11: cgmajor.patch
|
|
||||||
Patch12: lxcpty.patch
|
|
||||||
Patch13: clone.patch
|
|
||||||
Patch14: vnc-port.patch
|
|
||||||
Patch15: suse-network.patch
|
|
||||||
Patch16: xen-pv-cdrom.patch
|
|
||||||
Patch17: detach-disk.patch
|
|
||||||
Patch18: migrate-params.patch
|
|
||||||
Patch19: cve-2008-5086.patch
|
|
||||||
Patch20: devhelp.patch
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -112,6 +103,7 @@ Group: Development/Libraries/C and C++
|
|||||||
Requires: %{name} = %{version} libxml2-devel
|
Requires: %{name} = %{version} libxml2-devel
|
||||||
%if %{with_xen}
|
%if %{with_xen}
|
||||||
Requires: xen-devel
|
Requires: xen-devel
|
||||||
|
Requires: pkg-config
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%description devel
|
%description devel
|
||||||
@ -180,25 +172,13 @@ Authors:
|
|||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
%patch3 -p1
|
%patch3
|
||||||
%patch4 -p1
|
%patch4 -p1
|
||||||
%patch5 -p1
|
%patch5 -p1
|
||||||
%patch6 -p1
|
%patch6 -p1
|
||||||
%patch7 -p1
|
%patch7 -p1
|
||||||
%patch8 -p1
|
%patch8 -p1
|
||||||
%patch9 -p1
|
%patch9 -p1
|
||||||
%patch10 -p1
|
|
||||||
%patch11 -p1
|
|
||||||
%patch12 -p1
|
|
||||||
%patch13
|
|
||||||
%patch14 -p1
|
|
||||||
%patch15 -p1
|
|
||||||
%patch16 -p1
|
|
||||||
%patch17 -p1
|
|
||||||
%patch18 -p1
|
|
||||||
%patch19 -p1
|
|
||||||
%patch20 -p1
|
|
||||||
rm po/no.*
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%if ! %{with_xen}
|
%if ! %{with_xen}
|
||||||
@ -221,7 +201,8 @@ export CFLAGS="$RPM_OPT_FLAGS"
|
|||||||
--with-xen-proxy=no \
|
--with-xen-proxy=no \
|
||||||
ac_cv_path_DNSMASQ=/usr/sbin/dnsmasq \
|
ac_cv_path_DNSMASQ=/usr/sbin/dnsmasq \
|
||||||
ac_cv_path_QEMU_IMG=/usr/bin/qemu-img-xen \
|
ac_cv_path_QEMU_IMG=/usr/bin/qemu-img-xen \
|
||||||
ac_cv_path_ISCSIADM=/sbin/iscsiadm
|
ac_cv_path_ISCSIADM=/sbin/iscsiadm \
|
||||||
|
ac_cv_path_SHOWMOUNT=/usr/sbin/showmount
|
||||||
make DOCS_DIR=%{_docdir}/%{name}-python EXAMPLE_DIR=%{_docdir}/%{name}-python/examples HTML_DIR=%{_docdir}/%{name}
|
make DOCS_DIR=%{_docdir}/%{name}-python EXAMPLE_DIR=%{_docdir}/%{name}-python/examples HTML_DIR=%{_docdir}/%{name}
|
||||||
|
|
||||||
%install
|
%install
|
||||||
@ -331,6 +312,17 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{py_sitedir}/libvirtmod*
|
%{py_sitedir}/libvirtmod*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jan 28 2009 jfehlig@novell.com
|
||||||
|
- Updated to version 0.5.1
|
||||||
|
- CPU and scheduler support for LXC
|
||||||
|
- SDL display configuration
|
||||||
|
- domain lifecycle event support for QEmu and Xen with python
|
||||||
|
bindings
|
||||||
|
- KVM/QEmu migration support
|
||||||
|
- User Mode Linux driver
|
||||||
|
- API for node device enumeration using HAL and DeviceKit with
|
||||||
|
python bindings
|
||||||
|
- Many bug fixes and improvements
|
||||||
* Fri Jan 09 2009 jfehlig@novell.com
|
* Fri Jan 09 2009 jfehlig@novell.com
|
||||||
- Added missing html and png files to libvirt-doc package
|
- Added missing html and png files to libvirt-doc package
|
||||||
devhelp.patch
|
devhelp.patch
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
Index: libvirt-0.4.4/qemud/libvirtd.conf
|
Index: libvirt-0.5.1/qemud/libvirtd.conf
|
||||||
===================================================================
|
===================================================================
|
||||||
--- libvirt-0.4.4.orig/qemud/libvirtd.conf
|
--- libvirt-0.5.1.orig/qemud/libvirtd.conf
|
||||||
+++ libvirt-0.4.4/qemud/libvirtd.conf
|
+++ libvirt-0.5.1/qemud/libvirtd.conf
|
||||||
@@ -15,8 +15,8 @@
|
@@ -18,8 +18,8 @@
|
||||||
# It is necessary to setup a CA and issue server certificates before
|
# It is necessary to setup a CA and issue server certificates before
|
||||||
# using this capability.
|
# using this capability.
|
||||||
#
|
#
|
||||||
@ -13,7 +13,7 @@ Index: libvirt-0.4.4/qemud/libvirtd.conf
|
|||||||
|
|
||||||
# Listen for unencrypted TCP connections on the public TCP/IP port.
|
# Listen for unencrypted TCP connections on the public TCP/IP port.
|
||||||
# NB, must pass the --listen flag to the libvirtd process for this to
|
# NB, must pass the --listen flag to the libvirtd process for this to
|
||||||
@@ -50,11 +50,9 @@
|
@@ -53,11 +53,9 @@
|
||||||
|
|
||||||
# Flag toggling mDNS advertizement of the libvirt service.
|
# Flag toggling mDNS advertizement of the libvirt service.
|
||||||
#
|
#
|
||||||
@ -28,11 +28,11 @@ Index: libvirt-0.4.4/qemud/libvirtd.conf
|
|||||||
|
|
||||||
# Override the default mDNS advertizement name. This must be
|
# Override the default mDNS advertizement name. This must be
|
||||||
# unique on the immediate broadcast network.
|
# unique on the immediate broadcast network.
|
||||||
Index: libvirt-0.4.4/qemud/qemud.c
|
Index: libvirt-0.5.1/qemud/qemud.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- libvirt-0.4.4.orig/qemud/qemud.c
|
--- libvirt-0.5.1.orig/qemud/qemud.c
|
||||||
+++ libvirt-0.4.4/qemud/qemud.c
|
+++ libvirt-0.5.1/qemud/qemud.c
|
||||||
@@ -68,7 +68,7 @@ static int sigwrite = -1; /* Signa
|
@@ -92,7 +92,7 @@ static int sigwrite = -1; /* Signa
|
||||||
static int ipsock = 0; /* -l Listen for TCP/IP */
|
static int ipsock = 0; /* -l Listen for TCP/IP */
|
||||||
|
|
||||||
/* Defaults for configuration file elements */
|
/* Defaults for configuration file elements */
|
||||||
@ -41,7 +41,7 @@ Index: libvirt-0.4.4/qemud/qemud.c
|
|||||||
static int listen_tcp = 0;
|
static int listen_tcp = 0;
|
||||||
static char *listen_addr = (char *) LIBVIRTD_LISTEN_ADDR;
|
static char *listen_addr = (char *) LIBVIRTD_LISTEN_ADDR;
|
||||||
static char *tls_port = (char *) LIBVIRTD_TLS_PORT;
|
static char *tls_port = (char *) LIBVIRTD_TLS_PORT;
|
||||||
@@ -92,7 +92,7 @@ static int auth_tcp = REMOTE_AUTH_NONE;
|
@@ -116,7 +116,7 @@ static int auth_tcp = REMOTE_AUTH_NONE;
|
||||||
#endif
|
#endif
|
||||||
static int auth_tls = REMOTE_AUTH_NONE;
|
static int auth_tls = REMOTE_AUTH_NONE;
|
||||||
|
|
||||||
|
@ -1,198 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User danms
|
|
||||||
# Date 1223052361 0
|
|
||||||
# Node ID a28490b116b0430aa0d4f579bba57d52793312ed
|
|
||||||
# Parent 47378698026980b5734c81f9480b50c783dde68a
|
|
||||||
[r2008-10-03 16:46:01 by danms] Add cgroup manipulation and LXC driver
|
|
||||||
|
|
||||||
diff -r 473786980269 -r a28490b116b0 src/Makefile.am
|
|
||||||
--- a/src/Makefile.am Thu Oct 02 15:04:11 2008 +0000
|
|
||||||
+++ b/src/Makefile.am Fri Oct 03 16:46:01 2008 +0000
|
|
||||||
@@ -90,13 +90,15 @@
|
|
||||||
lxc_conf.c lxc_conf.h \
|
|
||||||
lxc_container.c lxc_container.h \
|
|
||||||
lxc_driver.c lxc_driver.h \
|
|
||||||
- veth.c veth.h
|
|
||||||
+ veth.c veth.h \
|
|
||||||
+ cgroup.c cgroup.h
|
|
||||||
|
|
||||||
LXC_CONTROLLER_SOURCES = \
|
|
||||||
lxc_conf.c lxc_conf.h \
|
|
||||||
lxc_container.c lxc_container.h \
|
|
||||||
lxc_controller.c \
|
|
||||||
- veth.c veth.h
|
|
||||||
+ veth.c veth.h \
|
|
||||||
+ cgroup.c cgroup.h
|
|
||||||
|
|
||||||
OPENVZ_DRIVER_SOURCES = \
|
|
||||||
openvz_conf.c openvz_conf.h \
|
|
||||||
diff -r 473786980269 -r a28490b116b0 src/lxc_container.c
|
|
||||||
--- a/src/lxc_container.c Thu Oct 02 15:04:11 2008 +0000
|
|
||||||
+++ b/src/lxc_container.c Fri Oct 03 16:46:01 2008 +0000
|
|
||||||
@@ -320,12 +320,12 @@
|
|
||||||
mode_t mode;
|
|
||||||
const char *path;
|
|
||||||
} devs[] = {
|
|
||||||
- { 1, 3, 0666, "/dev/null" },
|
|
||||||
- { 1, 5, 0666, "/dev/zero" },
|
|
||||||
- { 1, 7, 0666, "/dev/full" },
|
|
||||||
- { 5, 1, 0600, "/dev/console" },
|
|
||||||
- { 1, 8, 0666, "/dev/random" },
|
|
||||||
- { 1, 9, 0666, "/dev/urandom" },
|
|
||||||
+ { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_NULL, 0666, "/dev/null" },
|
|
||||||
+ { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_ZERO, 0666, "/dev/zero" },
|
|
||||||
+ { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_FULL, 0666, "/dev/full" },
|
|
||||||
+ { LXC_DEV_MAJ_TTY, LXC_DEV_MIN_CONSOLE, 0600, "/dev/console" },
|
|
||||||
+ { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_RANDOM, 0666, "/dev/random" },
|
|
||||||
+ { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_URANDOM, 0666, "/dev/urandom" },
|
|
||||||
};
|
|
||||||
|
|
||||||
if (virFileMakePath("/dev") < 0 ||
|
|
||||||
diff -r 473786980269 -r a28490b116b0 src/lxc_container.h
|
|
||||||
--- a/src/lxc_container.h Thu Oct 02 15:04:11 2008 +0000
|
|
||||||
+++ b/src/lxc_container.h Fri Oct 03 16:46:01 2008 +0000
|
|
||||||
@@ -30,6 +30,16 @@
|
|
||||||
LXC_CONTAINER_FEATURE_NET = (1 << 0),
|
|
||||||
};
|
|
||||||
|
|
||||||
+#define LXC_DEV_MAJ_MEMORY 1
|
|
||||||
+#define LXC_DEV_MIN_NULL 3
|
|
||||||
+#define LXC_DEV_MIN_ZERO 5
|
|
||||||
+#define LXC_DEV_MIN_FULL 7
|
|
||||||
+#define LXC_DEV_MIN_RANDOM 8
|
|
||||||
+#define LXC_DEV_MIN_URANDOM 9
|
|
||||||
+
|
|
||||||
+#define LXC_DEV_MAJ_TTY 5
|
|
||||||
+#define LXC_DEV_MIN_CONSOLE 1
|
|
||||||
+
|
|
||||||
int lxcContainerSendContinue(int control);
|
|
||||||
|
|
||||||
int lxcContainerStart(virDomainDefPtr def,
|
|
||||||
diff -r 473786980269 -r a28490b116b0 src/lxc_controller.c
|
|
||||||
--- a/src/lxc_controller.c Thu Oct 02 15:04:11 2008 +0000
|
|
||||||
+++ b/src/lxc_controller.c Fri Oct 03 16:46:01 2008 +0000
|
|
||||||
@@ -42,12 +42,82 @@
|
|
||||||
#include "veth.h"
|
|
||||||
#include "memory.h"
|
|
||||||
#include "util.h"
|
|
||||||
-
|
|
||||||
+#include "cgroup.h"
|
|
||||||
|
|
||||||
#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
|
|
||||||
#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
|
|
||||||
|
|
||||||
int debugFlag = 0;
|
|
||||||
+
|
|
||||||
+struct cgroup_device_policy {
|
|
||||||
+ char type;
|
|
||||||
+ int major;
|
|
||||||
+ int minor;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * lxcSetContainerResources
|
|
||||||
+ * @def: pointer to virtual machine structure
|
|
||||||
+ *
|
|
||||||
+ * Creates a cgroup for the container, moves the task inside,
|
|
||||||
+ * and sets resource limits
|
|
||||||
+ *
|
|
||||||
+ * Returns 0 on success or -1 in case of error
|
|
||||||
+ */
|
|
||||||
+static int lxcSetContainerResources(virDomainDefPtr def)
|
|
||||||
+{
|
|
||||||
+ virCgroupPtr cgroup;
|
|
||||||
+ int rc = -1;
|
|
||||||
+ int i;
|
|
||||||
+ struct cgroup_device_policy devices[] = {
|
|
||||||
+ {'c', LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_NULL},
|
|
||||||
+ {'c', LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_ZERO},
|
|
||||||
+ {'c', LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_FULL},
|
|
||||||
+ {'c', LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_RANDOM},
|
|
||||||
+ {'c', LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_URANDOM},
|
|
||||||
+ {'c', LXC_DEV_MAJ_TTY, LXC_DEV_MIN_CONSOLE},
|
|
||||||
+ {0, 0, 0}};
|
|
||||||
+
|
|
||||||
+ if (virCgroupHaveSupport() != 0)
|
|
||||||
+ return 0; /* Not supported, so claim success */
|
|
||||||
+
|
|
||||||
+ rc = virCgroupForDomain(def, "lxc", &cgroup);
|
|
||||||
+ if (rc != 0) {
|
|
||||||
+ lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
|
||||||
+ _("Unable to create cgroup for %s\n"), def->name);
|
|
||||||
+ return rc;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rc = virCgroupSetMemory(cgroup, def->maxmem);
|
|
||||||
+ if (rc != 0)
|
|
||||||
+ goto out;
|
|
||||||
+
|
|
||||||
+ rc = virCgroupDenyAllDevices(cgroup);
|
|
||||||
+ if (rc != 0)
|
|
||||||
+ goto out;
|
|
||||||
+
|
|
||||||
+ for (i = 0; devices[i].type != 0; i++) {
|
|
||||||
+ struct cgroup_device_policy *dev = &devices[i];
|
|
||||||
+ rc = virCgroupAllowDevice(cgroup,
|
|
||||||
+ dev->type,
|
|
||||||
+ dev->major,
|
|
||||||
+ dev->minor);
|
|
||||||
+ if (rc != 0)
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rc = virCgroupAddTask(cgroup, getpid());
|
|
||||||
+out:
|
|
||||||
+ if (rc != 0) {
|
|
||||||
+ lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
|
||||||
+ _("Failed to set lxc resources: %s\n"), strerror(-rc));
|
|
||||||
+ virCgroupRemove(cgroup);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ virCgroupFree(&cgroup);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
|
|
||||||
static char*lxcMonitorPath(virDomainDefPtr def)
|
|
||||||
{
|
|
||||||
@@ -394,6 +464,9 @@
|
|
||||||
if (lxcControllerMoveInterfaces(nveths, veths, container) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
+ if (lxcSetContainerResources(def) < 0)
|
|
||||||
+ goto cleanup;
|
|
||||||
+
|
|
||||||
if (lxcContainerSendContinue(control[0]) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
diff -r 473786980269 -r a28490b116b0 src/lxc_driver.c
|
|
||||||
--- a/src/lxc_driver.c Thu Oct 02 15:04:11 2008 +0000
|
|
||||||
+++ b/src/lxc_driver.c Fri Oct 03 16:46:01 2008 +0000
|
|
||||||
@@ -43,6 +43,7 @@
|
|
||||||
#include "bridge.h"
|
|
||||||
#include "veth.h"
|
|
||||||
#include "event.h"
|
|
||||||
+#include "cgroup.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* debug macros */
|
|
||||||
@@ -376,6 +377,7 @@
|
|
||||||
int waitRc;
|
|
||||||
int childStatus = -1;
|
|
||||||
virDomainNetDefPtr net;
|
|
||||||
+ virCgroupPtr cgroup;
|
|
||||||
|
|
||||||
while (((waitRc = waitpid(vm->pid, &childStatus, 0)) == -1) &&
|
|
||||||
errno == EINTR)
|
|
||||||
@@ -408,6 +410,11 @@
|
|
||||||
for (net = vm->def->nets; net; net = net->next) {
|
|
||||||
vethInterfaceUpOrDown(net->ifname, 0);
|
|
||||||
vethDelete(net->ifname);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (virCgroupForDomain(vm->def, "lxc", &cgroup) == 0) {
|
|
||||||
+ virCgroupRemove(cgroup);
|
|
||||||
+ virCgroupFree(&cgroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rc;
|
|
48
lxcpty.patch
48
lxcpty.patch
@ -1,48 +0,0 @@
|
|||||||
Index: libvirt-0.4.6/src/lxc_container.h
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-0.4.6.orig/src/lxc_container.h
|
|
||||||
+++ libvirt-0.4.6/src/lxc_container.h
|
|
||||||
@@ -40,6 +40,8 @@ enum {
|
|
||||||
#define LXC_DEV_MAJ_TTY 5
|
|
||||||
#define LXC_DEV_MIN_CONSOLE 1
|
|
||||||
|
|
||||||
+#define LXC_DEV_MAJ_PTY 136
|
|
||||||
+
|
|
||||||
int lxcContainerSendContinue(int control);
|
|
||||||
|
|
||||||
int lxcContainerStart(virDomainDefPtr def,
|
|
||||||
Index: libvirt-0.4.6/src/lxc_controller.c
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-0.4.6.orig/src/lxc_controller.c
|
|
||||||
+++ libvirt-0.4.6/src/lxc_controller.c
|
|
||||||
@@ -106,6 +106,10 @@ static int lxcSetContainerResources(virD
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ rc = virCgroupAllowDeviceMajor(cgroup, 'c', LXC_DEV_MAJ_PTY);
|
|
||||||
+ if (rc != 0)
|
|
||||||
+ goto out;
|
|
||||||
+
|
|
||||||
rc = virCgroupAddTask(cgroup, getpid());
|
|
||||||
out:
|
|
||||||
if (rc != 0) {
|
|
||||||
@@ -452,6 +456,9 @@ lxcControllerRun(virDomainDefPtr def,
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (lxcSetContainerResources(def) < 0)
|
|
||||||
+ goto cleanup;
|
|
||||||
+
|
|
||||||
if ((container = lxcContainerStart(def,
|
|
||||||
nveths,
|
|
||||||
veths,
|
|
||||||
@@ -464,9 +471,6 @@ lxcControllerRun(virDomainDefPtr def,
|
|
||||||
if (lxcControllerMoveInterfaces(nveths, veths, container) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
- if (lxcSetContainerResources(def) < 0)
|
|
||||||
- goto cleanup;
|
|
||||||
-
|
|
||||||
if (lxcContainerSendContinue(control[0]) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
130
lxcsched.patch
130
lxcsched.patch
@ -1,130 +0,0 @@
|
|||||||
Add scheduling parameter support for LXC domains
|
|
||||||
|
|
||||||
Index: libvirt-0.4.6/src/lxc_driver.c
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-0.4.6.orig/src/lxc_driver.c
|
|
||||||
+++ libvirt-0.4.6/src/lxc_driver.c
|
|
||||||
@@ -35,6 +35,7 @@
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <wait.h>
|
|
||||||
|
|
||||||
+#include "internal.h"
|
|
||||||
#include "lxc_conf.h"
|
|
||||||
#include "lxc_container.h"
|
|
||||||
#include "lxc_driver.h"
|
|
||||||
@@ -1149,6 +1150,94 @@ static int lxcVersion(virConnectPtr conn
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static char *lxcGetSchedulerType(virDomainPtr domain, int *nparams)
|
|
||||||
+{
|
|
||||||
+ if (nparams)
|
|
||||||
+ *nparams = 1;
|
|
||||||
+
|
|
||||||
+ return strdup("posix");
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int lxcSetSchedulerParameters(virDomainPtr _domain,
|
|
||||||
+ virSchedParameterPtr params,
|
|
||||||
+ int nparams)
|
|
||||||
+{
|
|
||||||
+ int i;
|
|
||||||
+ int rc;
|
|
||||||
+ virCgroupPtr group;
|
|
||||||
+ virDomainObjPtr domain;
|
|
||||||
+
|
|
||||||
+ if (virCgroupHaveSupport() != 0)
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+ domain = virDomainFindByUUID(lxc_driver->domains, _domain->uuid);
|
|
||||||
+ if (domain == NULL) {
|
|
||||||
+ lxcError(NULL, _domain, VIR_ERR_INTERNAL_ERROR,
|
|
||||||
+ _("No such domain %s"), _domain->uuid);
|
|
||||||
+ return -EINVAL;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rc = virCgroupForDomain(domain->def, "lxc", &group);
|
|
||||||
+ if (rc != 0)
|
|
||||||
+ return rc;
|
|
||||||
+
|
|
||||||
+ for (i = 0; i < nparams; i++) {
|
|
||||||
+ virSchedParameterPtr param = ¶ms[i];
|
|
||||||
+
|
|
||||||
+ if (STREQ(param->field, "cpu_shares")) {
|
|
||||||
+ rc = virCgroupSetCpuShares(group, params[i].value.ui);
|
|
||||||
+ } else {
|
|
||||||
+ lxcError(NULL, _domain, VIR_ERR_INVALID_ARG,
|
|
||||||
+ _("Invalid parameter `%s'"), param->field);
|
|
||||||
+ rc = -ENOENT;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rc = 0;
|
|
||||||
+out:
|
|
||||||
+ virCgroupFree(&group);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int lxcGetSchedulerParameters(virDomainPtr _domain,
|
|
||||||
+ virSchedParameterPtr params,
|
|
||||||
+ int *nparams)
|
|
||||||
+{
|
|
||||||
+ int rc = 0;
|
|
||||||
+ virCgroupPtr group;
|
|
||||||
+ virDomainObjPtr domain;
|
|
||||||
+
|
|
||||||
+ if (virCgroupHaveSupport() != 0)
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+ if ((*nparams) != 1) {
|
|
||||||
+ lxcError(NULL, _domain, VIR_ERR_INVALID_ARG,
|
|
||||||
+ _("Invalid parameter count"));
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ domain = virDomainFindByUUID(lxc_driver->domains, _domain->uuid);
|
|
||||||
+ if (domain == NULL) {
|
|
||||||
+ lxcError(NULL, _domain, VIR_ERR_INTERNAL_ERROR,
|
|
||||||
+ _("No such domain %s"), _domain->uuid);
|
|
||||||
+ return -ENOENT;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rc = virCgroupForDomain(domain->def, "lxc", &group);
|
|
||||||
+ if (rc != 0)
|
|
||||||
+ return rc;
|
|
||||||
+
|
|
||||||
+ rc = virCgroupGetCpuShares(group, (unsigned long *)¶ms[0].value.ul);
|
|
||||||
+ strncpy(params[0].field, "cpu_shares", sizeof(params[0].field));
|
|
||||||
+ params[0].type = VIR_DOMAIN_SCHED_FIELD_ULLONG;
|
|
||||||
+
|
|
||||||
+ virCgroupFree(&group);
|
|
||||||
+
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/* Function Tables */
|
|
||||||
static virDriver lxcDriver = {
|
|
||||||
VIR_DRV_LXC, /* the number virDrvNo */
|
|
||||||
@@ -1198,9 +1287,9 @@ static virDriver lxcDriver = {
|
|
||||||
NULL, /* domainDetachDevice */
|
|
||||||
NULL, /* domainGetAutostart */
|
|
||||||
NULL, /* domainSetAutostart */
|
|
||||||
- NULL, /* domainGetSchedulerType */
|
|
||||||
- NULL, /* domainGetSchedulerParameters */
|
|
||||||
- NULL, /* domainSetSchedulerParameters */
|
|
||||||
+ lxcGetSchedulerType, /* domainGetSchedulerType */
|
|
||||||
+ lxcGetSchedulerParameters, /* domainGetSchedulerParameters */
|
|
||||||
+ lxcSetSchedulerParameters, /* domainSetSchedulerParameters */
|
|
||||||
NULL, /* domainMigratePrepare */
|
|
||||||
NULL, /* domainMigratePerform */
|
|
||||||
NULL, /* domainMigrateFinish */
|
|
||||||
@@ -1217,7 +1306,6 @@ static virDriver lxcDriver = {
|
|
||||||
NULL, /* domainListSnapshots */
|
|
||||||
};
|
|
||||||
|
|
||||||
-
|
|
||||||
static virStateDriver lxcStateDriver = {
|
|
||||||
lxcStartup,
|
|
||||||
lxcShutdown,
|
|
123
lxcvirsh.patch
123
lxcvirsh.patch
@ -1,123 +0,0 @@
|
|||||||
Add generic parameter=value support for virsh's schedinfo command
|
|
||||||
|
|
||||||
This patch maintains the two Xen-specific --weight and --cap options,
|
|
||||||
but adds support for setting arbitrary parameters by specifying them in
|
|
||||||
param=value syntax.
|
|
||||||
|
|
||||||
Changes to the virsh manual are included.
|
|
||||||
|
|
||||||
Changes:
|
|
||||||
- Replace use of 'a' conversion modifier with pre-alloc
|
|
||||||
|
|
||||||
Index: libvirt-0.4.6/docs/virsh.pod
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-0.4.6.orig/docs/virsh.pod
|
|
||||||
+++ libvirt-0.4.6/docs/virsh.pod
|
|
||||||
@@ -322,12 +322,14 @@ This is roughly equivalent to doing a hi
|
|
||||||
with all the same limitations. Open network connections may be
|
|
||||||
severed upon restore, as TCP timeouts may have expired.
|
|
||||||
|
|
||||||
+=item B<schedinfo> optional I<--set> B<parameter=value> I<domain-id>
|
|
||||||
+
|
|
||||||
=item B<schedinfo> optional I<--weight> B<number> optional I<--cap> B<number> I<domain-id>
|
|
||||||
|
|
||||||
-Allows to show (and set) the domain scheduler parameters. This is currently
|
|
||||||
-only defined for XEN_CREDIT scheduler, and the optional weight and cap
|
|
||||||
-arguments allows to set the associated parameters in that scheduler if
|
|
||||||
-provided.
|
|
||||||
+Allows to show (and set) the domain scheduler parameters.
|
|
||||||
+
|
|
||||||
+B<Note>: The weight and cap parameters are defined only for the
|
|
||||||
+XEN_CREDIT scheduler and are now I<DEPRECATED>.
|
|
||||||
|
|
||||||
=item B<setmem> I<domain-id> B<kilobytes>
|
|
||||||
|
|
||||||
Index: libvirt-0.4.6/src/virsh.c
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-0.4.6.orig/src/virsh.c
|
|
||||||
+++ libvirt-0.4.6/src/virsh.c
|
|
||||||
@@ -1295,6 +1295,7 @@ static const vshCmdInfo info_schedinfo[]
|
|
||||||
|
|
||||||
static const vshCmdOptDef opts_schedinfo[] = {
|
|
||||||
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("domain name, id or uuid")},
|
|
||||||
+ {"set", VSH_OT_STRING, VSH_OFLAG_NONE, gettext_noop("parameter=value")},
|
|
||||||
{"weight", VSH_OT_INT, VSH_OFLAG_NONE, gettext_noop("weight for XEN_CREDIT")},
|
|
||||||
{"cap", VSH_OT_INT, VSH_OFLAG_NONE, gettext_noop("cap for XEN_CREDIT")},
|
|
||||||
{NULL, 0, 0, NULL}
|
|
||||||
@@ -1304,6 +1305,9 @@ static int
|
|
||||||
cmdSchedinfo(vshControl *ctl, const vshCmd *cmd)
|
|
||||||
{
|
|
||||||
char *schedulertype;
|
|
||||||
+ char *set;
|
|
||||||
+ char *param_name = NULL;
|
|
||||||
+ long long int param_value = 0;
|
|
||||||
virDomainPtr dom;
|
|
||||||
virSchedParameterPtr params = NULL;
|
|
||||||
int i, ret;
|
|
||||||
@@ -1311,6 +1315,7 @@ cmdSchedinfo(vshControl *ctl, const vshC
|
|
||||||
int nr_inputparams = 0;
|
|
||||||
int inputparams = 0;
|
|
||||||
int weightfound = 0;
|
|
||||||
+ int setfound = 0;
|
|
||||||
int weight = 0;
|
|
||||||
int capfound = 0;
|
|
||||||
int cap = 0;
|
|
||||||
@@ -1324,7 +1329,7 @@ cmdSchedinfo(vshControl *ctl, const vshC
|
|
||||||
if (!(dom = vshCommandOptDomain(ctl, cmd, "domain", NULL)))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
- /* Currently supports Xen Credit only */
|
|
||||||
+ /* Deprecated Xen-only options */
|
|
||||||
if(vshCommandOptBool(cmd, "weight")) {
|
|
||||||
weight = vshCommandOptInt(cmd, "weight", &weightfound);
|
|
||||||
if (!weightfound) {
|
|
||||||
@@ -1345,6 +1350,25 @@ cmdSchedinfo(vshControl *ctl, const vshC
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if(vshCommandOptBool(cmd, "set")) {
|
|
||||||
+ set = vshCommandOptString(cmd, "set", &setfound);
|
|
||||||
+ if (!setfound) {
|
|
||||||
+ vshError(ctl, FALSE, "%s", _("Error getting param"));
|
|
||||||
+ goto cleanup;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ param_name = vshMalloc(ctl, strlen(set) + 1);
|
|
||||||
+ if (param_name == NULL)
|
|
||||||
+ goto cleanup;
|
|
||||||
+
|
|
||||||
+ if (sscanf(set, "%[^=]=%i", param_name, ¶m_value) != 2) {
|
|
||||||
+ vshError(ctl, FALSE, "%s", _("Invalid value of param"));
|
|
||||||
+ goto cleanup;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ nr_inputparams++;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
params = vshMalloc(ctl, sizeof (virSchedParameter) * nr_inputparams);
|
|
||||||
if (params == NULL) {
|
|
||||||
goto cleanup;
|
|
||||||
@@ -1363,7 +1387,14 @@ cmdSchedinfo(vshControl *ctl, const vshC
|
|
||||||
params[inputparams].value.ui = cap;
|
|
||||||
inputparams++;
|
|
||||||
}
|
|
||||||
- /* End Currently supports Xen Credit only */
|
|
||||||
+ /* End Deprecated Xen-only options */
|
|
||||||
+
|
|
||||||
+ if (setfound) {
|
|
||||||
+ strncpy(params[inputparams].field,param_name,sizeof(params[0].field));
|
|
||||||
+ params[inputparams].type = VIR_DOMAIN_SCHED_FIELD_LLONG;
|
|
||||||
+ params[inputparams].value.l = param_value;
|
|
||||||
+ inputparams++;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
assert (inputparams == nr_inputparams);
|
|
||||||
|
|
||||||
@@ -1430,6 +1461,7 @@ cmdSchedinfo(vshControl *ctl, const vshC
|
|
||||||
}
|
|
||||||
cleanup:
|
|
||||||
free(params);
|
|
||||||
+ free(param_name);
|
|
||||||
virDomainFree(dom);
|
|
||||||
return ret_val;
|
|
||||||
}
|
|
@ -1,8 +1,8 @@
|
|||||||
Index: libvirt-0.4.6/src/xend_internal.c
|
Index: libvirt-0.5.1/src/xend_internal.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- libvirt-0.4.6.orig/src/xend_internal.c
|
--- libvirt-0.5.1.orig/src/xend_internal.c
|
||||||
+++ libvirt-0.4.6/src/xend_internal.c
|
+++ libvirt-0.5.1/src/xend_internal.c
|
||||||
@@ -4355,6 +4355,8 @@ xenDaemonDomainMigratePerform (virDomain
|
@@ -4226,6 +4226,8 @@ xenDaemonDomainMigratePerform (virDomain
|
||||||
"live", live,
|
"live", live,
|
||||||
"port", port,
|
"port", port,
|
||||||
"resource", "0", /* required, xend ignores it */
|
"resource", "0", /* required, xend ignores it */
|
||||||
|
1215
snapshots.patch
1215
snapshots.patch
File diff suppressed because it is too large
Load Diff
10
socat.patch
10
socat.patch
@ -1,8 +1,8 @@
|
|||||||
Index: libvirt-0.4.5/src/remote_internal.c
|
Index: libvirt-0.5.1/src/remote_internal.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- libvirt-0.4.5.orig/src/remote_internal.c
|
--- libvirt-0.5.1.orig/src/remote_internal.c
|
||||||
+++ libvirt-0.4.5/src/remote_internal.c
|
+++ libvirt-0.5.1/src/remote_internal.c
|
||||||
@@ -623,9 +623,22 @@ doRemoteOpen (virConnectPtr conn,
|
@@ -674,9 +674,22 @@ doRemoteOpen (virConnectPtr conn,
|
||||||
cmd_argv[j++] = strdup ("none");
|
cmd_argv[j++] = strdup ("none");
|
||||||
}
|
}
|
||||||
cmd_argv[j++] = strdup (priv->hostname);
|
cmd_argv[j++] = strdup (priv->hostname);
|
||||||
@ -16,7 +16,7 @@ Index: libvirt-0.4.5/src/remote_internal.c
|
|||||||
+ } else {
|
+ } else {
|
||||||
+ cmd_argv[j++] = strdup ("socat");
|
+ cmd_argv[j++] = strdup ("socat");
|
||||||
+ cmd_argv[j++] = strdup ("-");
|
+ cmd_argv[j++] = strdup ("-");
|
||||||
+
|
+
|
||||||
+ char *socat_addr = 0;
|
+ char *socat_addr = 0;
|
||||||
+ if ((asprintf (&socat_addr, "GOPEN:%s",
|
+ if ((asprintf (&socat_addr, "GOPEN:%s",
|
||||||
+ sockname ? sockname : LIBVIRTD_PRIV_UNIX_SOCKET)) < 0) {
|
+ sockname ? sockname : LIBVIRTD_PRIV_UNIX_SOCKET)) < 0) {
|
||||||
|
@ -1,186 +0,0 @@
|
|||||||
Index: libvirt-0.4.6/src/network_conf.c
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-0.4.6.orig/src/network_conf.c
|
|
||||||
+++ libvirt-0.4.6/src/network_conf.c
|
|
||||||
@@ -752,6 +752,131 @@ error:
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static int virNetworkIsBridge(const char *name)
|
|
||||||
+{
|
|
||||||
+ char *path = NULL;
|
|
||||||
+ int ret = 0;
|
|
||||||
+ struct stat s;
|
|
||||||
+
|
|
||||||
+ if (asprintf(&path, "/sys/class/net/%s/bridge", name) < 0)
|
|
||||||
+ goto out;
|
|
||||||
+
|
|
||||||
+ if (stat(path, &s) != 0)
|
|
||||||
+ goto out;
|
|
||||||
+
|
|
||||||
+ if (S_ISDIR(s.st_mode))
|
|
||||||
+ ret = 1;
|
|
||||||
+
|
|
||||||
+ out:
|
|
||||||
+ free(path);
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static unsigned long virNetworkDefSuseGetValue(char *netName, char *valName)
|
|
||||||
+{
|
|
||||||
+ unsigned long ret = 0;
|
|
||||||
+ char *path = NULL;
|
|
||||||
+ FILE *f;
|
|
||||||
+
|
|
||||||
+ if (asprintf(&path, "/sys/class/net/%s/bridge/%s", netName, valName) < 0)
|
|
||||||
+ return ret;
|
|
||||||
+
|
|
||||||
+ if ((f = fopen(path, "r")) == NULL)
|
|
||||||
+ goto out;
|
|
||||||
+
|
|
||||||
+ if (fscanf(f, "%lu", &ret) != 1) {
|
|
||||||
+ ret = 0;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ out:
|
|
||||||
+ if (f != NULL)
|
|
||||||
+ fclose(f);
|
|
||||||
+ free(path);
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static virNetworkObjPtr virNetworkLoadSuseNet(virConnectPtr conn,
|
|
||||||
+ virNetworkObjPtr *nets,
|
|
||||||
+ char *name)
|
|
||||||
+{
|
|
||||||
+ virNetworkDefPtr def;
|
|
||||||
+ virNetworkObjPtr network;
|
|
||||||
+ int err;
|
|
||||||
+
|
|
||||||
+ if ((network = virNetworkFindByName(*nets, name))) {
|
|
||||||
+ return network;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (VIR_ALLOC(network) < 0) {
|
|
||||||
+ virNetworkReportError(conn, VIR_ERR_NO_MEMORY, NULL);
|
|
||||||
+ return NULL;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ network->autostart = 1;
|
|
||||||
+ network->active = 1;
|
|
||||||
+ network->readonly = 1;
|
|
||||||
+ network->next = *nets;
|
|
||||||
+
|
|
||||||
+ if (VIR_ALLOC(def) < 0) {
|
|
||||||
+ virNetworkReportError(conn, VIR_ERR_NO_MEMORY, NULL);
|
|
||||||
+ goto error;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ network->def = def;
|
|
||||||
+
|
|
||||||
+ /* name */
|
|
||||||
+ def->name = strdup(name);
|
|
||||||
+ if (def->name == NULL) {
|
|
||||||
+ virNetworkReportError(conn, VIR_ERR_NO_MEMORY, NULL);
|
|
||||||
+ goto error;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* uuid */
|
|
||||||
+ if ((err = virUUIDGenerate(def->uuid))) {
|
|
||||||
+ virNetworkReportError(conn, VIR_ERR_INTERNAL_ERROR,
|
|
||||||
+ _("Failed to generate UUID: %s"), strerror(err));
|
|
||||||
+ goto error;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* bridge information */
|
|
||||||
+ def->bridge = strdup(name);
|
|
||||||
+ if (def->bridge == NULL) {
|
|
||||||
+ virNetworkReportError(conn, VIR_ERR_NO_MEMORY, NULL);
|
|
||||||
+ goto error;
|
|
||||||
+ }
|
|
||||||
+ def->stp = (int)virNetworkDefSuseGetValue(name, "stp_state");
|
|
||||||
+ def->delay = virNetworkDefSuseGetValue(name, "forward_delay");
|
|
||||||
+
|
|
||||||
+ /* Add network to the list */
|
|
||||||
+ *nets = network;
|
|
||||||
+ return network;
|
|
||||||
+
|
|
||||||
+ error:
|
|
||||||
+ virNetworkObjFree(network);
|
|
||||||
+ return NULL;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void virNetworkLoadSuseNetworks(virConnectPtr conn,
|
|
||||||
+ virNetworkObjPtr *nets)
|
|
||||||
+{
|
|
||||||
+ DIR *dir = NULL;
|
|
||||||
+ struct dirent *de;
|
|
||||||
+ int count = 0;
|
|
||||||
+
|
|
||||||
+ dir = opendir("/sys/class/net");
|
|
||||||
+ if (dir == NULL)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ while ((de = readdir(dir))) {
|
|
||||||
+ if (virNetworkIsBridge(de->d_name)) {
|
|
||||||
+ virNetworkLoadSuseNet(conn, nets, de->d_name);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ closedir(dir);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
int virNetworkLoadAllConfigs(virConnectPtr conn,
|
|
||||||
virNetworkObjPtr *nets,
|
|
||||||
const char *configDir,
|
|
||||||
@@ -787,6 +912,7 @@ int virNetworkLoadAllConfigs(virConnectP
|
|
||||||
|
|
||||||
closedir(dir);
|
|
||||||
|
|
||||||
+ virNetworkLoadSuseNetworks(conn, nets);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Index: libvirt-0.4.6/src/network_conf.h
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-0.4.6.orig/src/network_conf.h
|
|
||||||
+++ libvirt-0.4.6/src/network_conf.h
|
|
||||||
@@ -82,6 +82,7 @@ struct _virNetworkObj {
|
|
||||||
unsigned int active : 1;
|
|
||||||
unsigned int autostart : 1;
|
|
||||||
unsigned int persistent : 1;
|
|
||||||
+ unsigned int readonly : 1;
|
|
||||||
|
|
||||||
char *configFile; /* Persistent config file path */
|
|
||||||
char *autostartLink; /* Symlink path for autostart */
|
|
||||||
Index: libvirt-0.4.6/src/qemu_driver.c
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-0.4.6.orig/src/qemu_driver.c
|
|
||||||
+++ libvirt-0.4.6/src/qemu_driver.c
|
|
||||||
@@ -1601,6 +1601,12 @@ static int qemudShutdownNetworkDaemon(vi
|
|
||||||
if (!virNetworkIsActive(network))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
+ if (network->readonly) {
|
|
||||||
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
|
||||||
+ ": Network '%s' is readonly", network->def->name);
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (network->dnsmasqPid > 0)
|
|
||||||
kill(network->dnsmasqPid, SIGTERM);
|
|
||||||
|
|
||||||
@@ -3974,6 +3980,12 @@ static int qemudNetworkSetAutostart(virN
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (network->readonly) {
|
|
||||||
+ qemudReportError(net->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
|
||||||
+ ": Network '%s' is readonly", network->def->name);
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
autostart = (autostart != 0);
|
|
||||||
|
|
||||||
if (network->autostart == autostart)
|
|
@ -1,13 +0,0 @@
|
|||||||
Index: libvirt-0.4.6/src/xend_internal.c
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-0.4.6.orig/src/xend_internal.c
|
|
||||||
+++ libvirt-0.4.6/src/xend_internal.c
|
|
||||||
@@ -1890,6 +1890,8 @@ xenDaemonParseSxprNets(virConnectPtr con
|
|
||||||
prev->next = net;
|
|
||||||
else
|
|
||||||
def->nets = net;
|
|
||||||
+
|
|
||||||
+ prev = net;
|
|
||||||
vif_index++;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +1,8 @@
|
|||||||
Index: libvirt-0.4.6/src/xend_internal.c
|
Index: libvirt-0.5.1/src/xend_internal.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- libvirt-0.4.6.orig/src/xend_internal.c
|
--- libvirt-0.5.1.orig/src/xend_internal.c
|
||||||
+++ libvirt-0.4.6/src/xend_internal.c
|
+++ libvirt-0.5.1/src/xend_internal.c
|
||||||
@@ -2138,10 +2138,8 @@ xenDaemonParseSxprGraphicsNew(virConnect
|
@@ -2079,10 +2079,8 @@ xenDaemonParseSxprGraphicsNew(virConnect
|
||||||
const char *keymap = sexpr_node(node, "device/vfb/keymap");
|
const char *keymap = sexpr_node(node, "device/vfb/keymap");
|
||||||
const char *unused = sexpr_node(node, "device/vfb/vncunused");
|
const char *unused = sexpr_node(node, "device/vfb/vncunused");
|
||||||
|
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
Index: libvirt-0.4.6/src/xen_unified.c
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-0.4.6.orig/src/xen_unified.c
|
|
||||||
+++ libvirt-0.4.6/src/xen_unified.c
|
|
||||||
@@ -799,8 +799,15 @@ xenUnifiedDomainSetMaxMemory (virDomainP
|
|
||||||
GET_PRIVATE(dom->conn);
|
|
||||||
int i;
|
|
||||||
|
|
||||||
+ /* Prefer xend for setting max memory */
|
|
||||||
+ if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
|
|
||||||
+ if (xenDaemonDomainSetMaxMemory (dom, memory) == 0)
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
|
|
||||||
- if (priv->opened[i] &&
|
|
||||||
+ if (i != XEN_UNIFIED_XEND_OFFSET &&
|
|
||||||
+ priv->opened[i] &&
|
|
||||||
drivers[i]->domainSetMaxMemory &&
|
|
||||||
drivers[i]->domainSetMaxMemory (dom, memory) == 0)
|
|
||||||
return 0;
|
|
@ -1,8 +1,8 @@
|
|||||||
Index: libvirt-0.4.6/src/xend_internal.c
|
Index: libvirt-0.5.1/src/xend_internal.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- libvirt-0.4.6.orig/src/xend_internal.c
|
--- libvirt-0.5.1.orig/src/xend_internal.c
|
||||||
+++ libvirt-0.4.6/src/xend_internal.c
|
+++ libvirt-0.5.1/src/xend_internal.c
|
||||||
@@ -5158,7 +5158,10 @@ xenDaemonFormatSxprDisk(virConnectPtr co
|
@@ -5021,7 +5021,10 @@ xenDaemonFormatSxprDisk(virConnectPtr co
|
||||||
def->device == VIR_DOMAIN_DISK_DEVICE_CDROM ?
|
def->device == VIR_DOMAIN_DISK_DEVICE_CDROM ?
|
||||||
"cdrom" : "disk");
|
"cdrom" : "disk");
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user