[libvirt] [PATCH] phyp: fix logic error on volume creation
by Eric Blake
The phyp code claims that it wants a non-zero value, but actually
enforces a capacity of zero. It has been this way since commit
ebc46fe in June 2010. Bummer that it has my name as the committer
- I guess I should have been much more stubborn about not blindly
taking someone else's 1600-line patch.
* src/phyp/phyp_driver.c (phypStorageVolCreateXML): Use correct
logic.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
The fact that this bug has gone unnoticed for years makes me
wonder if we are better off just removing the phyp driver from
our code base, since it is obvious it is not getting much
testing. I'm also waiting for a review on this, because although
I _think_ the code wanted a non-zero capacity, I don't know
enough about phyp and the "viosvrcmd -c 'mklv -lv'" command line;
maybe the comments are wrong and it always wanted 0 capacity
instead (which is the only thing that would get past the
pre-patch code check).
src/phyp/phyp_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index fc3e7db..3a5eefd 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -2003,15 +2003,15 @@ phypStorageVolCreateXML(virStoragePoolPtr pool,
* in the moment you create the volume.
* */
if (voldef->key) {
VIR_ERROR(_("Key must be empty, Power Hypervisor will create one for you."));
goto err;
}
- if (voldef->capacity) {
+ if (!voldef->capacity) {
VIR_ERROR(_("Capacity cannot be empty."));
goto err;
}
key = phypBuildVolume(pool->conn, voldef->name, spdef->name,
voldef->capacity);
--
1.9.0
10 years, 7 months
[libvirt] [PATCH] Add redirdevs to ABI stability check
by Ján Tomko
Check the bus, type of the source device (tcp vs. spicevmc)
and the device address visible in the guest.
https://bugzilla.redhat.com/show_bug.cgi?id=1035128
---
src/conf/domain_conf.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0af5be7..9f1c020 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13693,6 +13693,42 @@ virDomainHubDefCheckABIStability(virDomainHubDefPtr src,
return true;
}
+
+static bool
+virDomainRedirdevDefCheckABIStability(virDomainRedirdevDefPtr src,
+ virDomainRedirdevDefPtr dst)
+{
+ if (src->bus != dst->bus) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Target redirected device bus %s does not match "
+ "source %s"),
+ virDomainRedirdevBusTypeToString(dst->bus),
+ virDomainRedirdevBusTypeToString(src->bus));
+ return false;
+ }
+
+ switch ((enum virDomainRedirdevBus) src->bus) {
+ case VIR_DOMAIN_REDIRDEV_BUS_USB:
+ if (src->source.chr.type != dst->source.chr.type) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Target redirected device source type %s does "
+ "not match source device source type %s"),
+ virDomainChrTypeToString(dst->source.chr.type),
+ virDomainChrTypeToString(src->source.chr.type));
+ return false;
+ }
+ break;
+ case VIR_DOMAIN_REDIRDEV_BUS_LAST:
+ break;
+ }
+
+ if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
+ return false;
+
+ return true;
+}
+
+
static bool
virDomainRedirFilterDefCheckABIStability(virDomainRedirFilterDefPtr src,
virDomainRedirFilterDefPtr dst)
@@ -14133,6 +14169,20 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
if (!virDomainHubDefCheckABIStability(src->hubs[i], dst->hubs[i]))
goto error;
+ if (src->nredirdevs != dst->nredirdevs) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Target domain redirected devices count %zu "
+ "does not match source %zu"),
+ dst->nconsoles, src->nconsoles);
+ goto error;
+ }
+
+ for (i = 0; i < src->nredirdevs; i++) {
+ if (!virDomainRedirdevDefCheckABIStability(src->redirdevs[i],
+ dst->redirdevs[i]))
+ goto error;
+ }
+
if ((!src->redirfilter && dst->redirfilter) ||
(src->redirfilter && !dst->redirfilter)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
--
1.8.3.2
10 years, 7 months
[libvirt] [PATCH] Use the force flag for mkfs -t xfs
by Ján Tomko
Without this, building an XFS pool on a formatted partition
fails with --overwrite.
https://bugzilla.redhat.com/show_bug.cgi?id=927172
---
src/storage/storage_backend_fs.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index e0244ba..1d85871 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -665,11 +665,13 @@ virStorageBackendExecuteMKFS(const char *device,
int ret = 0;
virCommandPtr cmd = NULL;
- cmd = virCommandNewArgList(MKFS,
- "-t",
- format,
- device,
- NULL);
+ cmd = virCommandNewArgList(MKFS, "-t", format, NULL);
+
+ /* use the force, otherwise mkfs.xfs won't overwrite existing fs */
+ if (STREQ(format, "xfs"))
+ virCommandAddArg(cmd, "-f");
+
+ virCommandAddArg(cmd, device);
if (virCommandRun(cmd, NULL) < 0) {
virReportSystemError(errno,
--
1.8.3.2
10 years, 7 months
[libvirt] [PATCH] virsh: Make 'exit' action same as 'quit'
by liyang
From: Li Yang <liyang.fnst(a)cn.fujitsu.com>
For now 'virsh quit' action like this:
--------------------------------
[root@localhost /]# virsh quit
[root@localhost /]#
--------------------------------
And 'virsh exit' action:
--------------------------------
[root@localhost /]# virsh exit
[root@localhost /]#
--------------------------------
There is a small difference('/n') between them.
According to manual said:
quit, exit
quit this interactive terminal
And in the code they all called cmdQuit func,
They should get same actions.
Signed-off-by: Li Yang <liyang.fnst(a)cn.fujitsu.com>
---
tools/virsh.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 02835d9..da7fedd 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1852,7 +1852,8 @@ vshCommandRun(vshControl *ctl, const vshCmd *cmd)
if (!ret && disconnected != 0)
vshReconnect(ctl);
- if (STREQ(cmd->def->name, "quit")) /* hack ... */
+ if (STREQ(cmd->def->name, "quit") ||
+ STREQ(cmd->def->name, "exit")) /* hack ... */
return ret;
if (enable_timing) {
--
1.7.1
10 years, 7 months
[libvirt] [PATCH] qemu: make sure agent returns error when required data are missing
by Martin Kletzander
Commit 5b3492fa aimed to fix this and caught one error but exposed
another one. When agent command is being executed and the thread
waiting for the reply is woken up by an event (e.g. EOF in case of
shutdown), the command finishes with no data (rxObject == NULL), but
no error is reported, since this might be desired by the caller
(e.g. suspend through agent). However, in other situations, when the
data are required (e.g. getting vCPUs), we proceed to getting desired
data out of the reply, but none of the virJSON*() functions works well
with NULLs. I chose the way of a new parameter for qemuAgentCommand()
function that specifies whether reply is required and behaves
according to that.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1058149
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
Notes:
This issue probably exists since qemu-ga is supported in libvirt, so
this (along with 5b3492fa and e9d09fe1) might be worth back-porting to
some maintenance branches, I just haven't gone through them to see
which ones are applicable.
src/qemu/qemu_agent.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 92573bd..4082331 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -1080,6 +1080,7 @@ static int
qemuAgentCommand(qemuAgentPtr mon,
virJSONValuePtr cmd,
virJSONValuePtr *reply,
+ bool needReply,
int seconds)
{
int ret = -1;
@@ -1111,7 +1112,7 @@ qemuAgentCommand(qemuAgentPtr mon,
/* If we haven't obtained any reply but we wait for an
* event, then don't report this as error */
if (!msg.rxObject) {
- if (await_event) {
+ if (await_event && !needReply) {
VIR_DEBUG("Woken up by event %d", await_event);
} else {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -1275,7 +1276,7 @@ int qemuAgentShutdown(qemuAgentPtr mon,
mon->await_event = QEMU_AGENT_EVENT_RESET;
else
mon->await_event = QEMU_AGENT_EVENT_SHUTDOWN;
- ret = qemuAgentCommand(mon, cmd, &reply,
+ ret = qemuAgentCommand(mon, cmd, &reply, false,
VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK);
virJSONValueFree(cmd);
@@ -1305,7 +1306,7 @@ int qemuAgentFSFreeze(qemuAgentPtr mon)
if (!cmd)
return -1;
- if (qemuAgentCommand(mon, cmd, &reply,
+ if (qemuAgentCommand(mon, cmd, &reply, true,
VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK) < 0)
goto cleanup;
@@ -1342,7 +1343,7 @@ int qemuAgentFSThaw(qemuAgentPtr mon)
if (!cmd)
return -1;
- if (qemuAgentCommand(mon, cmd, &reply,
+ if (qemuAgentCommand(mon, cmd, &reply, true,
VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK) < 0)
goto cleanup;
@@ -1379,7 +1380,7 @@ qemuAgentSuspend(qemuAgentPtr mon,
return -1;
mon->await_event = QEMU_AGENT_EVENT_SUSPEND;
- ret = qemuAgentCommand(mon, cmd, &reply,
+ ret = qemuAgentCommand(mon, cmd, &reply, false,
VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK);
virJSONValueFree(cmd);
@@ -1409,7 +1410,7 @@ qemuAgentArbitraryCommand(qemuAgentPtr mon,
if (!(cmd = virJSONValueFromString(cmd_str)))
goto cleanup;
- if ((ret = qemuAgentCommand(mon, cmd, &reply, timeout)) < 0)
+ if ((ret = qemuAgentCommand(mon, cmd, &reply, true, timeout)) < 0)
goto cleanup;
if (!(*result = virJSONValueToString(reply, false)))
@@ -1436,7 +1437,7 @@ qemuAgentFSTrim(qemuAgentPtr mon,
if (!cmd)
return ret;
- ret = qemuAgentCommand(mon, cmd, &reply,
+ ret = qemuAgentCommand(mon, cmd, &reply, false,
VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK);
virJSONValueFree(cmd);
@@ -1458,7 +1459,7 @@ qemuAgentGetVCPUs(qemuAgentPtr mon,
if (!(cmd = qemuAgentMakeCommand("guest-get-vcpus", NULL)))
return -1;
- if (qemuAgentCommand(mon, cmd, &reply,
+ if (qemuAgentCommand(mon, cmd, &reply, true,
VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK) < 0)
goto cleanup;
@@ -1566,7 +1567,7 @@ qemuAgentSetVCPUs(qemuAgentPtr mon,
cpus = NULL;
- if (qemuAgentCommand(mon, cmd, &reply,
+ if (qemuAgentCommand(mon, cmd, &reply, true,
VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK) < 0)
goto cleanup;
--
1.9.1
10 years, 7 months
[libvirt] [PATCHv3 0/3] Time setting and getting in qemu guests
by Michal Privoznik
Hopefully the last round.
Michal Privoznik (3):
Introduce virDomain{Get,Set}Time APIs
virsh: Expose virDomain{Get,Set}Time
qemu: Implement virDomain{Get,Set}Time
daemon/remote.c | 37 ++++++++++++
include/libvirt/libvirt.h.in | 14 +++++
src/access/viraccessperm.c | 2 +-
src/access/viraccessperm.h | 7 ++-
src/driver.h | 14 +++++
src/libvirt.c | 94 ++++++++++++++++++++++++++++++
src/libvirt_public.syms | 5 ++
src/qemu/qemu_agent.c | 99 ++++++++++++++++++++++++++++++++
src/qemu/qemu_agent.h | 8 +++
src/qemu/qemu_driver.c | 109 +++++++++++++++++++++++++++++++++++
src/remote/remote_driver.c | 35 ++++++++++++
src/remote/remote_protocol.x | 31 +++++++++-
src/remote_protocol-structs | 16 ++++++
tools/virsh-domain-monitor.c | 132 +++++++++++++++++++++++++++++++++++++++++++
tools/virsh.pod | 16 ++++++
15 files changed, 616 insertions(+), 3 deletions(-)
--
1.9.0
10 years, 7 months
[libvirt] [PATCH 0/2] Clean up errors when net device could not be found on detach
by Ján Tomko
Partially fixes https://bugzilla.redhat.com/show_bug.cgi?id=872028
Does nothing to adress the fact that interface type and other
attributes are ignored on device detach
Ján Tomko (2):
Move error reporting into virDomainNetFindIdx
Include PCI address in the error in virDomainNetFindIdx
src/conf/domain_conf.c | 26 ++++++++++++++++++++++----
src/lxc/lxc_driver.c | 39 +++++----------------------------------
src/qemu/qemu_driver.c | 28 +++-------------------------
src/qemu/qemu_hotplug.c | 15 ++-------------
4 files changed, 32 insertions(+), 76 deletions(-)
--
1.8.3.2
10 years, 7 months
[libvirt] Release of python bindings for libvirt 1.2.3
by Daniel Veillard
With a bit of delay due to a dependancy needing fixing, the python
bindings update for 1.2.3 are available, tagged in the libvirt-python
git module and for download at the usual place:
ftp://libvirt.org/libvirt/python/
It carries a mix of improvements, bugs and portability fixes:
Portability:
- Fix nosetests usage with python3 (Daniel P. Berrange)
- setup.py: Allow running --help or clean without pkg-config (Cole Robinson)
Bug Fixes:
- Fix potential crash when setting partial cpu/memory/numa/interface limits on domains (Brian Rak)
- event: fix domain reference bugs (Eric Blake)
- override: Return NULL on python failure in getCPUModelNames (Cole Robinson)
- override: GetCPUModelNames should return None on failure (Cole Robinson)
- setPyVirTypedParameter: free whole return variable on error (Michal Privoznik)
Improvements:
- setup.py: Make have_libvirt_lxc a function (Cole Robinson)
- setup.py: Move module list building to its own function (Cole Robinson)
- setup.py: Remove unused import (Cole Robinson)
- qemu: support arbitrary monitor events (Eric Blake)
- generator: Add virConnectDomainQemuMonitorEventCallback to skipped_types (Martin Kletzander)
- maint: balance {} usage (Eric Blake)
- maint: Add ctags configuration file and ignore the output (Peter Krempa)
- maint: set up preferred emacs settings (Eric Blake)
- maint: ignore .pyc files (Eric Blake)
- Add test for setting scheduler parameters (Daniel P. Berrange)
- Add support for running unit tests with nose (Daniel P. Berrange)
- setPyVirTypedParameter: Copy full field name (Michal Privoznik)
Thaks everybody for your contributions to this release !
Daniel
--
Daniel Veillard | Open Source and Standards, Red Hat
veillard(a)redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | virtualization library http://libvirt.org/
10 years, 7 months
[libvirt] [PATCH] tests: simplify storage test cleanup
by Eric Blake
No need to spawn a child 'rm' process when we can do it ourselves.
* tests/virstoragetest.c (testCleanupImages): Use dedicated
helper.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under the trivial rule.
tests/virstoragetest.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index 3089d70..9ec39c7 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -62,8 +62,6 @@ static char *abslink2;
static void
testCleanupImages(void)
{
- virCommandPtr cmd;
-
VIR_FREE(qemuimg);
VIR_FREE(absraw);
VIR_FREE(canonraw);
@@ -79,9 +77,7 @@ testCleanupImages(void)
return;
}
- cmd = virCommandNewArgList("rm", "-rf", datadir, NULL);
- ignore_value(virCommandRun(cmd, NULL));
- virCommandFree(cmd);
+ virFileDeleteTree(datadir);
}
static int
--
1.9.0
10 years, 7 months
[libvirt] [PATCH v4 0/5] Expose FSFreeze/FSThaw within the guest as API
by Tomoki Sekiyama
Hello,
This is patchset v4 to add FSFreeze/FSThaw API for custom disk snapshotting.
Changes to v3:
* fix typp and label spacing
* rebased to recent tree
(v3: http://www.redhat.com/archives/libvir-list/2014-March/msg01358.html )
=== Description ===
Currently FSFreeze and FSThaw are supported by qemu guest agent and they are
used internally in snapshot-create command with --quiesce option.
However, when users want to utilize the native snapshot feature of storage
devices (such as LVM over iSCSI, enterprise storage appliances, etc.),
they need to issue fsfreeze command separately from libvirt-driven snapshots.
(OpenStack cinder provides these storages' snapshot feature, but it cannot
quiesce the guest filesystems automatically for now.)
Although virDomainQemuGuestAgent() API could be used for this purpose, it
is only for debugging and is not supported officially.
This patchset adds virDomainFSFreeze()/virDomainFSThaw() APIs and virsh
domfsfreeze/domfsthaw commands to enable the users to freeze and thaw
domain's filesystems cleanly.
The APIs have flags option currently unsupported for future extension.
---
Tomoki Sekiyama (5):
Introduce virDomainFSFreeze() and virDomainFSThaw() public API
remote: Implement virDomainFSFreeze and virDomainFSThaw
qemu: Track domain quiesced status
qemu: Implement virDomainFSFreeze and virDomainFSThaw
virsh: Expose new virDomainFSFreeze and virDomainFSThaw API
include/libvirt/libvirt.h.in | 6 ++
src/access/viraccessperm.c | 2 -
src/access/viraccessperm.h | 6 ++
src/driver.h | 10 +++
src/libvirt.c | 70 ++++++++++++++++++++
src/libvirt_public.syms | 2 +
src/qemu/qemu_domain.c | 5 +
src/qemu/qemu_domain.h | 2 +
src/qemu/qemu_driver.c | 144 ++++++++++++++++++++++++++++++++++++++----
src/remote/remote_driver.c | 2 +
src/remote/remote_protocol.x | 25 +++++++
src/remote_protocol-structs | 9 +++
src/rpc/gendispatch.pl | 2 +
tools/virsh-domain.c | 92 +++++++++++++++++++++++++++
tools/virsh.pod | 15 ++++
15 files changed, 376 insertions(+), 16 deletions(-)
10 years, 7 months