[libvirt] syntax-check Argument list too long problems
by Roman Bogorodskiy
Hi,
Not so long ago I've started encountering issues with syntax-check, for
example:
trailing_blank
/bin/sh: grep: Argument list too long
When I'm running it with SHELL='sh -x' I can see that it's indeed trying
to run grep with really long list of files, e.g.:
+ grep -nE '\<error *\([^"]*"[^"]*[a-z]{3}' .ctags .dir-locals.el ...
and many many other files in the list.
I see this problem on FreeBSD, but not on Linux, I guess that's because
ARG_MAX is much lower on FreeBSD:
freebsd$ getconf ARG_MAX
262144
linux$ getconf ARG_MAX
2097152
It looks like it's not possible to change ARG_MAX value on FreeBSD. Do I
get it right that it's something that I need to report to gnulib?
Roman Bogorodskiy
9 years, 1 month
[libvirt] [PATCH] conf: Check for attach disk usage of iothread=0
by John Ferlan
Since iothreadid = 0 is invalid, we need to check for it when attempting
to add a disk; otherwise, someone would think/believe their attempt to
add an IOThread to the disk would succeed. Luckily other code ignored
things when ->iothread == 0...
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/conf/domain_conf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b743bdd..10630c0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7448,7 +7448,8 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
}
if (driverIOThread) {
- if (virStrToLong_uip(driverIOThread, NULL, 10, &def->iothread) < 0) {
+ if (virStrToLong_uip(driverIOThread, NULL, 10, &def->iothread) < 0 ||
+ def->iothread == 0) {
virReportError(VIR_ERR_XML_ERROR,
_("Invalid iothread attribute in disk driver "
"element: %s"), driverIOThread);
--
2.1.0
9 years, 1 month
[libvirt] [PATCH 1/2] daemon: Use $(NULL) for libvird_admin's flags
by Guido Günther
This makes it consistent with the other FLAGS in this file and reduced
clutter in the diff when adding new entries.
---
daemon/Makefile.am | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 59bc4d4..be1b5a9 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -136,14 +136,14 @@ libvirtd_admin_la_CFLAGS = \
$(PIE_CFLAGS) \
$(WARN_CFLAGS) \
$(LIBXML_CFLAGS) \
- $(COVERAGE_CFLAGS)
-
+ $(COVERAGE_CFLAGS) \
+ $(NULL)
libvirtd_admin_la_LDFLAGS = \
$(PIE_LDFLAGS) \
$(RELRO_LDFLAGS) \
$(COVERAGE_LDFLAGS) \
- $(NO_INDIRECT_LDFLAGS)
-
+ $(NO_INDIRECT_LDFLAGS) \
+ $(NULL)
libvirtd_admin_la_LIBADD = \
../src/libvirt-admin.la
--
2.1.4
9 years, 1 month
[libvirt] [PATCH] util: fix build without cgroup
by Roman Bogorodskiy
Commit 89c509a0 added getters for cgroup block device I/O throttling,
however stub versions of these functions have not matching function
prototypes that result in compilation fail on platforms not supporting
cgroup.
Fix build by correcting prototypes of the stubbed functions.
Pushing under build-breaker rule.
---
src/util/vircgroup.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index c94512a..0379c2e 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -4427,8 +4427,7 @@ virCgroupSetBlkioDeviceWriteBps(virCgroupPtr group ATTRIBUTE_UNUSED,
int
virCgroupGetBlkioDeviceWeight(virCgroupPtr group ATTRIBUTE_UNUSED,
const char *path ATTRIBUTE_UNUSED,
- const char *dev_str ATTRIBUTE_UNUSED,
- unsigned int weight ATTRIBUTE_UNUSED)
+ unsigned int *weight ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS, "%s",
_("Control groups not supported on this platform"));
@@ -4438,8 +4437,7 @@ virCgroupGetBlkioDeviceWeight(virCgroupPtr group ATTRIBUTE_UNUSED,
int
virCgroupGetBlkioDeviceReadIops(virCgroupPtr group ATTRIBUTE_UNUSED,
const char *path ATTRIBUTE_UNUSED,
- const char *dev_str ATTRIBUTE_UNUSED,
- unsigned int riops ATTRIBUTE_UNUSED)
+ unsigned int *riops ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS, "%s",
_("Control groups not supported on this platform"));
@@ -4449,8 +4447,7 @@ virCgroupGetBlkioDeviceReadIops(virCgroupPtr group ATTRIBUTE_UNUSED,
int
virCgroupGetBlkioDeviceWriteIops(virCgroupPtr group ATTRIBUTE_UNUSED,
const char *path ATTRIBUTE_UNUSED,
- const char *dev_str ATTRIBUTE_UNUSED,
- unsigned int wiops ATTRIBUTE_UNUSED)
+ unsigned int *wiops ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS, "%s",
_("Control groups not supported on this platform"));
@@ -4460,8 +4457,7 @@ virCgroupGetBlkioDeviceWriteIops(virCgroupPtr group ATTRIBUTE_UNUSED,
int
virCgroupGetBlkioDeviceReadBps(virCgroupPtr group ATTRIBUTE_UNUSED,
const char *path ATTRIBUTE_UNUSED,
- const char *dev_str ATTRIBUTE_UNUSED,
- unsigned long long rbps ATTRIBUTE_UNUSED)
+ unsigned long long *rbps ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS, "%s",
_("Control groups not supported on this platform"));
@@ -4471,8 +4467,7 @@ virCgroupGetBlkioDeviceReadBps(virCgroupPtr group ATTRIBUTE_UNUSED,
int
virCgroupGetBlkioDeviceWriteBps(virCgroupPtr group ATTRIBUTE_UNUSED,
const char *path ATTRIBUTE_UNUSED,
- const char *dev_str ATTRIBUTE_UNUSED,
- unsigned long long wbps ATTRIBUTE_UNUSED)
+ unsigned long long *wbps ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS, "%s",
_("Control groups not supported on this platform"));
--
2.4.5
9 years, 1 month
[libvirt] [libvirt-php PATCH] added missing libvirt 1.2.8 constants
by Eric Schultz
---
src/libvirt-php.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index f0a2167..8588128 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -1216,6 +1216,8 @@ PHP_MINIT_FUNCTION(libvirt)
/* XML contants */
REGISTER_LONG_CONSTANT("VIR_DOMAIN_XML_SECURE", 1, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VIR_DOMAIN_XML_INACTIVE", 2, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_DOMAIN_XML_UPDATE_CPU", 4, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_DOMAIN_XML_MIGRATABLE", 8, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VIR_NODE_CPU_STATS_ALL_CPUS", VIR_NODE_CPU_STATS_ALL_CPUS, CONST_CS | CONST_PERSISTENT);
@@ -1227,6 +1229,7 @@ PHP_MINIT_FUNCTION(libvirt)
REGISTER_LONG_CONSTANT("VIR_DOMAIN_SHUTDOWN", 4, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VIR_DOMAIN_SHUTOFF", 5, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VIR_DOMAIN_CRASHED", 6, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_DOMAIN_PMSUSPENDED", 7, CONST_CS | CONST_PERSISTENT);
/* Volume constants */
REGISTER_LONG_CONSTANT("VIR_STORAGE_VOL_RESIZE_ALLOCATE", 1, CONST_CS | CONST_PERSISTENT);
@@ -1270,6 +1273,7 @@ PHP_MINIT_FUNCTION(libvirt)
/* Memory constants */
REGISTER_LONG_CONSTANT("VIR_MEMORY_VIRTUAL", 1, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_MEMORY_PHYSICAL", 2, CONST_CS | CONST_PERSISTENT);
/* Version checking constants */
REGISTER_LONG_CONSTANT("VIR_VERSION_BINDING", VIR_VERSION_BINDING, CONST_CS | CONST_PERSISTENT);
@@ -1317,7 +1321,13 @@ PHP_MINIT_FUNCTION(libvirt)
/* The number of statistics supported by this version of the interface. To add new statistics, add them */
/* to the enum and increase this value. */
REGISTER_LONG_CONSTANT("VIR_DOMAIN_MEMORY_STAT_AVAILABLE", 5, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VIR_DOMAIN_MEMORY_STAT_NR", 6, CONST_CS | CONST_PERSISTENT);
+ /* Current balloon value (in KB). */
+ REGISTER_LONG_CONSTANT("VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON", 6, CONST_CS | CONST_PERSISTENT);
+ /* Resident Set Size of the process running the domain. This value is in kB */
+ REGISTER_LONG_CONSTANT("VIR_DOMAIN_MEMORY_STAT_RSS", 7, CONST_CS | CONST_PERSISTENT);
+ /* The number of statistics supported by this version of the interface. */
+ /* To add new statistics, add them to the enum and increase this value. */
+ REGISTER_LONG_CONSTANT("VIR_DOMAIN_MEMORY_STAT_NR", 8, CONST_CS | CONST_PERSISTENT);
/* Job constants */
REGISTER_LONG_CONSTANT("VIR_DOMAIN_JOB_NONE", 0, CONST_CS | CONST_PERSISTENT);
@@ -1354,6 +1364,18 @@ PHP_MINIT_FUNCTION(libvirt)
REGISTER_LONG_CONSTANT("VIR_MIGRATE_NON_SHARED_DISK", 64, CONST_CS | CONST_PERSISTENT);
/* migration with non-shared storage with incremental copy (same base image shared between source and destination) */
REGISTER_LONG_CONSTANT("VIR_MIGRATE_NON_SHARED_INC", 128, CONST_CS | CONST_PERSISTENT);
+ /* protect for changing domain configuration through the whole migration process; this will be used automatically when supported */
+ REGISTER_LONG_CONSTANT("VIR_MIGRATE_CHANGE_PROTECTION", 256, CONST_CS | CONST_PERSISTENT);
+ /* force migration even if it is considered unsafe */
+ REGISTER_LONG_CONSTANT("VIR_MIGRATE_UNSAFE", 512, CONST_CS | CONST_PERSISTENT);
+ /* offline migrate */
+ REGISTER_LONG_CONSTANT("VIR_MIGRATE_OFFLINE", 1024, CONST_CS | CONST_PERSISTENT);
+ /* compress data during migration */
+ REGISTER_LONG_CONSTANT("VIR_MIGRATE_COMPRESSED", 2048, CONST_CS | CONST_PERSISTENT);
+ /* abort migration on I/O errors happened during migration */
+ REGISTER_LONG_CONSTANT("VIR_MIGRATE_ABORT_ON_ERROR", 4096, CONST_CS | CONST_PERSISTENT);
+ /* force convergence */
+ REGISTER_LONG_CONSTANT("VIR_MIGRATE_AUTO_CONVERGE", 8192, CONST_CS | CONST_PERSISTENT);
/* Modify device allocation based on current domain state */
REGISTER_LONG_CONSTANT("VIR_DOMAIN_DEVICE_MODIFY_CURRENT", 0, CONST_CS | CONST_PERSISTENT);
--
2.5.0
9 years, 1 month
[libvirt] [PATCH] virconf: correct code format
by Cao jin
Signed-off-by: Cao jin <caoj.fnst(a)cn.fujitsu.com>
---
src/util/virconf.c | 4 ++--
src/util/virconf.h | 33 ++++++++++++++++-----------------
2 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/src/util/virconf.c b/src/util/virconf.c
index 01e5a6a..86d76b5 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -938,8 +938,8 @@ virConfSetValue(virConfPtr conf,
* Returns 0 on success, or -1 on failure.
*/
int virConfWalk(virConfPtr conf,
- virConfWalkCallback callback,
- void *opaque)
+ virConfWalkCallback callback,
+ void *opaque)
{
virConfEntryPtr cur;
diff --git a/src/util/virconf.h b/src/util/virconf.h
index 2b4b943..8037956 100644
--- a/src/util/virconf.h
+++ b/src/util/virconf.h
@@ -77,25 +77,24 @@ typedef int (*virConfWalkCallback)(const char* name,
virConfValuePtr value,
void *opaque);
-virConfPtr virConfNew (void);
-virConfPtr virConfReadFile (const char *filename, unsigned int flags);
-virConfPtr virConfReadMem (const char *memory,
- int len, unsigned int flags);
-int virConfFree (virConfPtr conf);
-void virConfFreeValue (virConfValuePtr val);
-
-virConfValuePtr virConfGetValue (virConfPtr conf,
- const char *setting);
-int virConfSetValue (virConfPtr conf,
- const char *setting,
- virConfValuePtr value);
+virConfPtr virConfNew(void);
+virConfPtr virConfReadFile(const char *filename, unsigned int flags);
+virConfPtr virConfReadMem(const char *memory,
+ int len, unsigned int flags);
+int virConfFree(virConfPtr conf);
+void virConfFreeValue(virConfValuePtr val);
+virConfValuePtr virConfGetValue(virConfPtr conf,
+ const char *setting);
+int virConfSetValue(virConfPtr conf,
+ const char *setting,
+ virConfValuePtr value);
int virConfWalk(virConfPtr conf,
virConfWalkCallback callback,
void *opaque);
-int virConfWriteFile (const char *filename,
- virConfPtr conf);
-int virConfWriteMem (char *memory,
- int *len,
- virConfPtr conf);
+int virConfWriteFile(const char *filename,
+ virConfPtr conf);
+int virConfWriteMem(char *memory,
+ int *len,
+ virConfPtr conf);
#endif /* __VIR_CONF_H__ */
--
2.1.0
9 years, 1 month
[libvirt] [PATCH] virConfWalk: fix the inconsistent name
by Cao jin
Fix inconsistency between function description and actual
parameter name.
Signed-off-by: Cao jin <caoj.fnst(a)cn.fujitsu.com>
---
src/util/virconf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virconf.c b/src/util/virconf.c
index ab98c5c..9f2d116 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -930,7 +930,7 @@ virConfSetValue(virConfPtr conf,
* virConfWalk:
* @conf: a configuration file handle
* @callback: the function to call to process each entry
- * @data: obscure data passed to callback
+ * @opaque: obscure data passed to callback
*
* Walk over all entries of the configuration file and run the callback
* for each with entry name, value and the obscure data.
--
2.1.0
9 years, 1 month
[libvirt] [virtio-pci] unbind port from virtio-pci causes kernel crash
by Clarylin L
I am running kvm based virtual guest. The guest has two virtio-based ports.
Now I am trying to unbind ports from their current drivers (by echo
"0000:00:06.0" > /sys/bus/pci/drivers/virtio-pci/unbind) and getting kernel
crash. Don't know how to move forward. Any suggestions are highly
appreciated.
[ 110.034006] WARNING: at kernel/irq/manage.c:937 __free_irq+0x205/0x210()
[ 110.034006] Hardware name: Standard PC (i440FX + PIIX, 1996)
[ 110.034006] Modules linked in: rte_kni igb_uio knpusim(P) knpushm(P)
virtio_scsi virtio_blk vmw_pvscsi ata_piix mptsas mptspi mptscsih mptbase
ub be2net ixgbevf enic ixgbe mdio e1000e e1000 vmxnet3 virtio_net bnx2
3c59x uhci_hcd ehci_hcd
[ 110.034006] Pid: 5578, comm: sh Tainted: P W
2.6.38-staros-v3-ssi-64 #2
[ 110.034006] Call Trace:
[ 110.034006] [<ffffffff810a1905>] ? __free_irq+0x205/0x210
[ 110.034006] [<ffffffff810a1905>] ? __free_irq+0x205/0x210
[ 110.034006] [<ffffffff81056710>] ? warn_slowpath_common+0x90/0xc0
[ 110.034006] [<ffffffff8105675a>] ? warn_slowpath_null+0x1a/0x20
[ 110.034006] [<ffffffff810a1905>] ? __free_irq+0x205/0x210
[ 110.034006] [<ffffffff810a1957>] ? free_irq+0x47/0x90
[ 110.034006] [<ffffffff812f96a3>] ? vp_del_vqs+0x73/0xb0
[ 110.034006] [<ffffffffa00192f6>] ? virtnet_del_vqs+0x36/0x50
[virtio_net]
[ 110.034006] [<ffffffffa001ab16>] ? remove_vq_common+0x36/0x40
[virtio_net]
[ 110.034006] [<ffffffffa001c47f>] ? virtnet_remove+0x3f/0xbc0
[virtio_net]
[ 110.034006] [<ffffffff812f8612>] ? virtio_dev_remove+0x22/0x50
[ 110.034006] [<ffffffff8133a176>] ? __device_release_driver+0x66/0xc0
[ 110.034006] [<ffffffff8133a8ed>] ? device_release_driver+0x2d/0x40
[ 110.034006] [<ffffffff81339b8d>] ? bus_remove_device+0x7d/0xe0
[ 110.034006] [<ffffffff81336a98>] ? device_del+0x128/0x1a0
[ 110.034006] [<ffffffff81336b32>] ? device_unregister+0x22/0x60
[ 110.034006] [<ffffffff812f8682>] ? unregister_virtio_device+0x12/0x20
[ 110.034006] [<ffffffff8155fe2d>] ? virtio_pci_remove+0x1d/0x20
[ 110.034006] [<ffffffff812b6ee7>] ? pci_device_remove+0x37/0x70
[ 110.034006] [<ffffffff8133a176>] ? __device_release_driver+0x66/0xc0
[ 110.034006] [<ffffffff8133a8ed>] ? device_release_driver+0x2d/0x40
[ 110.034006] [<ffffffff81339c8b>] ? driver_unbind+0x9b/0xc0
[ 110.034006] [<ffffffff81338bbc>] ? drv_attr_store+0x2c/0x30
[ 110.034006] [<ffffffff8117f0a6>] ? sysfs_write_file+0xe6/0x150
[ 110.034006] [<ffffffff8111fd7e>] ? vfs_write+0xce/0x170
[ 110.034006] [<ffffffff81120485>] ? sys_write+0x55/0x90
[ 110.034006] [<ffffffff8103fc40>] ? sysenter_dispatch+0x7/0x37
[ 110.034006] [<ffffffff81563e49>] ? trace_hardirqs_on_thunk+0x3a/0x3c
[ 110.034006] ---[ end trace 4eaa2a86a8e2da24 ]---
[ 110.074389] general protection fault: 0000 [#1] PREEMPT SMP
[ 110.075006] last sysfs file: /sys/bus/pci/drivers/virtio-pci/unbind
9 years, 1 month
[libvirt] [PATCH] util: Remove empty resource partition created by libvirt
by Nikunj A Dadhania
The default resource partition is created in the domain start path if it
is not existing. Even when libvirtd is stopped after shutting down all
domains, the resource partition still exists.
The patch adds code to removes the default resource partition in the
cgroup removal path of the domain. If the default resource partition is
found to have no child cgroup, the default resource partition will be
removed.
Moreover, the code does not remove the user provided resource
partitions.
Signed-off-by: Nikunj A Dadhania <nikunj(a)linux.vnet.ibm.com>
---
src/util/vircgroup.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 0599ba5..4dc0702 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -42,6 +42,7 @@
#define __VIR_CGROUP_ALLOW_INCLUDE_PRIV_H__
#include "vircgrouppriv.h"
+#include "dirname.h"
#include "virutil.h"
#include "viralloc.h"
#include "virerror.h"
@@ -3311,6 +3312,59 @@ virCgroupRemoveRecursively(char *grppath)
/**
+ * virCgroupRemoveEmptyParent:
+ *
+ * @group-path: The group path
+ *
+ * Cleanup the libvirt created partition directory if there are no
+ * child group existing. For the given @group-path, find the parent
+ * directory. For resource partition created by libvirt check
+ * existence of child cgroup. Remove the resource partition if no
+ * child cgroup exist.
+ *
+ * Returns: void
+ */
+static void
+virCgroupRemoveEmptyParent(char *grppath)
+{
+ char *parent = NULL, *partition = NULL;
+ struct dirent *ent;
+ DIR *grpdir;
+ int direrr;
+ int is_empty = 1;
+
+ if (!(parent = mdir_name(grppath)))
+ goto cleanup;
+
+ partition = strrchr(parent, '/');
+ if (STRNEQ(partition, "/machine") && STRNEQ(partition, "/machine.slice"))
+ goto cleanup;
+
+ grpdir = opendir(parent);
+ if (grpdir == NULL)
+ goto cleanup;
+
+ while ((direrr = virDirRead(grpdir, &ent, NULL)) > 0) {
+ if (ent->d_name[0] == '.') continue;
+ if (ent->d_type == DT_DIR) {
+ is_empty = 0;
+ break;
+ }
+ }
+ closedir(grpdir);
+
+ if (is_empty) {
+ VIR_DEBUG("Removing empty parent cgroup %s", parent);
+ if (rmdir(parent) != 0)
+ VIR_ERROR(_("Unable to remove %s (%d)"), parent, errno);
+ }
+
+ cleanup:
+ VIR_FREE(parent);
+ return;
+}
+
+/**
* virCgroupRemove:
*
* @group: The group to be removed
@@ -3352,6 +3406,7 @@ virCgroupRemove(virCgroupPtr group)
VIR_DEBUG("Removing cgroup %s and all child cgroups", grppath);
rc = virCgroupRemoveRecursively(grppath);
+ virCgroupRemoveEmptyParent(grppath);
VIR_FREE(grppath);
}
VIR_DEBUG("Done removing cgroup %s", group->path);
--
2.4.3
9 years, 1 month
[libvirt] [PATCH] qemu: Report better error message when renaming to existing domain name
by Martin Kletzander
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/qemu/qemu_driver.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 99a3817ff5ab..16061a51d4a7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -19892,6 +19892,7 @@ static int qemuDomainRename(virDomainPtr dom,
virQEMUDriverPtr driver = dom->conn->privateData;
virQEMUDriverConfigPtr cfg = NULL;
virDomainObjPtr vm = NULL;
+ virDomainObjPtr tmp_dom = NULL;
virObjectEventPtr event_new = NULL;
virObjectEventPtr event_old = NULL;
int ret = -1;
@@ -19946,6 +19947,21 @@ static int qemuDomainRename(virDomainPtr dom,
goto endjob;
}
+ /*
+ * This is a rather racy check, but still better than reporting
+ * internal error. And since new_name != name here, there's no
+ * deadlock imminent.
+ */
+ tmp_dom = virDomainObjListFindByName(driver->domains, new_name);
+ if (tmp_dom) {
+ virObjectUnlock(tmp_dom);
+ virObjectUnref(tmp_dom);
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("domain with name '%s' already exists"),
+ new_name);
+ goto endjob;
+ }
+
if (VIR_STRDUP(new_dom_name, new_name) < 0)
goto endjob;
--
2.5.0
9 years, 2 months