[libvirt] [PATCH v2] qemu: fix return value issue
by ajia@redhat.com
whether or not previous return value is -1, the following codes will be
executed for a inactive guest in src/qemu/qemu_driver.c:
ret = virDomainSaveConfig(driver->configDir, persistentDef);
and if everything is okay, 'ret' is assigned to 0, the previous 'ret'
will be overwritten, this patch will fix this issue.
* src/qemu/qemu_driver.c: avoid return value is overwritten when give a argument
in out of blkio weight range for a inactive guest.
* how to reproduce?
% virsh blkiotune ${guestname} --weight 10
% echo $?
Note: guest must be inactive, argument 10 in out of blkio weight range,
and can get a error information by checking libvirtd.log, however,
virsh hasn't raised any error information, and return value is 0.
https://bugzilla.redhat.com/show_bug.cgi?id=726304
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
src/qemu/qemu_driver.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b673fd5..aaccddf 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5688,7 +5688,9 @@ static int qemuDomainSetBlkioParameters(virDomainPtr dom,
ret = -1;
}
}
- ret = virDomainSaveConfig(driver->configDir, persistentDef);
+
+ if (virDomainSaveConfig(driver->configDir, persistentDef) < 0)
+ ret = -1;
}
cleanup:
--
1.7.1
13 years, 3 months
[libvirt] [PATCH v2] qemu: fix return value issue in qemuDomainSetMemoryParameters
by ajia@redhat.com
whether or not previous return value is -1, the following codes will be
executed for a inactive guest in qemuDomainSetMemoryParameters:
ret = virDomainSaveConfig(driver->configDir, persistentDef);
and if everything is okay, 'ret' is assigned to 0, the previous 'ret'
will be overwritten, this patch will fix this issue.
* src/qemu/qemu_driver.c: avoid return value is overwritten when set
min_guarante value to a inactive guest.
* how to reproduce?
% virsh memtune ${guestname} --min_guarante 1024
% echo $?
Note: guest must be inactive, in fact, 'min_guarante' hasn't been implemented
in memory tunable, and I can get the error when check actual libvirtd.log,
however, virsh hasn't raised any error information, and return value is 0.
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
src/qemu/qemu_driver.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index cce1c68..cb5108d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5983,7 +5983,8 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom,
}
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
- ret = virDomainSaveConfig(driver->configDir, persistentDef);
+ if(virDomainSaveConfig(driver->configDir, persistentDef) < 0)
+ ret = -1;
}
cleanup:
--
1.7.1
13 years, 3 months
[libvirt] [PATCH] qemu: fix return value issue
by ajia@redhat.com
whether or not previous return value is -1, the following codes will be
executed for a inactive guest in src/qemu/qemu_driver.c:
ret = virDomainSaveConfig(driver->configDir, persistentDef);
and if everything is okay, 'ret' is assigned to 0, the previous 'ret'
will be overwritten, this patch will fix this issue.
* src/qemu/qemu_driver.c: avoid return value is overwritten when give a argument
in out of blkio weight range for a inactive guest.
* how to reproduce?
% virsh blkiotune ${guestname} --weight 10
% echo $?
Note: guest must be inactive, argument 10 in out of blkio weight range,
however, virsh hasn't raised any error information, and return value is 0.
https://bugzilla.redhat.com/show_bug.cgi?id=726304
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
src/qemu/qemu_driver.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b673fd5..aaccddf 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5688,7 +5688,9 @@ static int qemuDomainSetBlkioParameters(virDomainPtr dom,
ret = -1;
}
}
- ret = virDomainSaveConfig(driver->configDir, persistentDef);
+
+ if(virDomainSaveConfig(driver->configDir, persistentDef) < 0)
+ goto cleanup;
}
cleanup:
--
1.7.1
13 years, 3 months
[libvirt] [PATCH] virsh: Fix vol-name and vol-pool commands
by Matthias Bolte
This commands don't have a --pool option, so don't tell
vshCommandOptVolBy that there could be one. This made
vshCommandOptString for pooloptname fail and an "missing option"
error was reported.
Make pooloptname optional for vshCommandOptVolBy.
---
tools/virsh.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 9e0744d..5fcf370 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -9201,7 +9201,7 @@ cmdVolName(vshControl *ctl, const vshCmd *cmd)
if (!vshConnectionUsability(ctl, ctl->conn))
return false;
- if (!(vol = vshCommandOptVolBy(ctl, cmd, "vol", "pool", NULL,
+ if (!(vol = vshCommandOptVolBy(ctl, cmd, "vol", NULL, NULL,
VSH_BYUUID)))
return false;
@@ -9238,7 +9238,7 @@ cmdVolPool(vshControl *ctl, const vshCmd *cmd)
return false;
/* Use the supplied string to locate the volume */
- if (!(vol = vshCommandOptVolBy(ctl, cmd, "vol", "pool", NULL,
+ if (!(vol = vshCommandOptVolBy(ctl, cmd, "vol", NULL, NULL,
VSH_BYUUID))) {
return false;
}
@@ -13619,7 +13619,7 @@ vshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL;
- if (vshCommandOptString(cmd, pooloptname, &p) < 0) {
+ if (pooloptname != NULL && vshCommandOptString(cmd, pooloptname, &p) < 0) {
vshError(ctl, "%s", _("missing option"));
return NULL;
}
--
1.7.4.1
13 years, 3 months
[libvirt] [PATCH] Correct the default value of lock_manager in qemu.conf
by Guannan Ren
* src/qemu/qemu.conf lock_manager = "sanlock"
---
src/qemu/qemu.conf | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index 8058352..79c6e85 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -304,9 +304,8 @@
#
# max_processes = 0
-# To enable strict 'fcntl' based locking of the file
+# To enable 'Sanlock' project based locking of the file
# content (to prevent two VMs writing to the same
-# disk), start the 'virtlockd' service, and uncomment
-# this
+# disk), uncomment this
#
-# lock_manager = "fcntl"
+# lock_manager = "sanlock"
--
1.7.1
13 years, 3 months
[libvirt] [PATCH] qemu: Fix a regression of domjobabort
by Osier Yang
Introduced by f9a837da73a11ef, the condition is not changed after
the else clause is removed. So now it quit with "domain is not
running" when the domain is running. However, when the domain is
not running, it reports "no job is active".
How to reproduce:
1)
% virsh start $domain
% virsh domjobabort $domain
error: Requested operation is not valid: domain is not running
2)
% virsh destroy $domain
% virsh domjobabort $domain
error: Requested operation is not valid: no job is active on the domain
3)
% virsh save $domain /tmp/$domain.save
Before above commands finished, try to abort job in another terminal
% virsh domabortjob $domain
error: Requested operation is not valid: domain is not running
---
src/qemu/qemu_driver.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b673fd5..cce1c68 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8065,7 +8065,7 @@ static int qemuDomainAbortJob(virDomainPtr dom) {
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_ABORT) < 0)
goto cleanup;
- if (virDomainObjIsActive(vm)) {
+ if (!virDomainObjIsActive(vm)) {
qemuReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
goto endjob;
--
1.7.6
13 years, 3 months
[libvirt] [PATCH] qemu: fix return value issue in qemuDomainSetMemoryParameters
by ajia@redhat.com
whether or not previous return value is -1, the following codes will be
executed for a inactive guest in qemuDomainSetMemoryParameters:
ret = virDomainSaveConfig(driver->configDir, persistentDef);
and if everything is okay, 'ret' is assigned to 0, the previous 'ret'
will be overwritten, this patch will fix this issue.
* src/qemu/qemu_driver.c: avoid return value is overwritten when set
min_guarante value to a inactive guest.
* how to reproduce?
% virsh memtune ${guestname} --min_guarante 1024
% echo $?
Note: guest must be inactive, in fact, 'min_guarante' hasn't been implemented
in memory tunable, and I can get the error when check actual libvirtd.log,
however, virsh hasn't raised any error information, and return value is 0.
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
src/qemu/qemu_driver.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b673fd5..a099723 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5983,7 +5983,8 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom,
}
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
- ret = virDomainSaveConfig(driver->configDir, persistentDef);
+ if(virDomainSaveConfig(driver->configDir, persistentDef) < 0)
+ goto cleanup;
}
cleanup:
--
1.7.1
13 years, 3 months
[libvirt] [PATCH] conf: Don't leak the virtual port profile in virNetworkDefFree
by Matthias Bolte
Reported by Alex Jia.
---
src/conf/network_conf.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 6714c20..b11c482 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -169,6 +169,8 @@ void virNetworkDefFree(virNetworkDefPtr def)
virNetworkDNSDefFree(def->dns);
+ VIR_FREE(def->virtPortProfile);
+
virBandwidthDefFree(def->bandwidth);
VIR_FREE(def);
--
1.7.4.1
13 years, 3 months