[libvirt] [PATCH] virsh: Add a helper to parse cpulist
by Osier Yang
vcpupin and emulatorpin use same code to parse the cpulist, this
abstracts the same code as a helper. Along with various code style
fixes, and error improvement (only error "Physical CPU %d doesn't
exist" if the specified CPU exceed the range, no "cpulist: Invalid
format", see the following for an example of the error prior to
this patch).
% virsh vcpupin 4 0 0-8
error: Physical CPU 4 doesn't exist.
error: cpulist: Invalid format.
---
tools/virsh-domain.c | 278 ++++++++++++++++++++-------------------------------
1 file changed, 106 insertions(+), 172 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index d1e6f9d..0fe2a51 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -5460,6 +5460,97 @@ vshPrintPinInfo(unsigned char *cpumaps, size_t cpumaplen,
return true;
}
+static unsigned char *
+virParseCPUList(vshControl *ctl, const char *cpulist,
+ int maxcpu, size_t cpumaplen)
+{
+ unsigned char *cpumap = NULL;
+ const char *cur;
+ bool unuse = false;
+ int i, cpu, lastcpu;
+
+ cpumap = vshCalloc(ctl, cpumaplen, sizeof(*cpumap));
+
+ /* Parse cpulist */
+ cur = cpulist;
+ if (*cur == 'r') {
+ for (cpu = 0; cpu < maxcpu; cpu++)
+ VIR_USE_CPU(cpumap, cpu);
+ return cpumap;
+ } else if (*cur == 0) {
+ goto error;
+ }
+
+ while (*cur != 0) {
+ /* The char '^' denotes exclusive */
+ if (*cur == '^') {
+ cur++;
+ unuse = true;
+ }
+
+ /* Parse physical CPU number */
+ if (!c_isdigit(*cur))
+ goto error;
+
+ if ((cpu = virParseNumber(&cur)) < 0)
+ goto error;
+
+ if (cpu >= maxcpu) {
+ vshError(ctl, _("Physical CPU %d doesn't exist."), cpu);
+ goto cleanup;
+ }
+
+ virSkipSpaces(&cur);
+
+ if (*cur == ',' || *cur == 0) {
+ if (unuse)
+ VIR_UNUSE_CPU(cpumap, cpu);
+ else
+ VIR_USE_CPU(cpumap, cpu);
+ } else if (*cur == '-') {
+ /* The char '-' denotes range */
+ if (unuse)
+ goto error;
+ cur++;
+ virSkipSpaces(&cur);
+
+ /* Parse the end of range */
+ lastcpu = virParseNumber(&cur);
+
+ if (lastcpu < cpu)
+ goto error;
+
+ if (lastcpu >= maxcpu) {
+ vshError(ctl, _("Physical CPU %d doesn't exist."), maxcpu);
+ goto cleanup;
+ }
+
+ for (i = cpu; i <= lastcpu; i++)
+ VIR_USE_CPU(cpumap, i);
+
+ virSkipSpaces(&cur);
+ }
+
+ if (*cur == ',') {
+ cur++;
+ virSkipSpaces(&cur);
+ unuse = false;
+ } else if (*cur == 0) {
+ break;
+ } else {
+ goto error;
+ }
+ }
+
+ return cpumap;
+
+error:
+ vshError(ctl, "%s", _("cpulist: Invalid format."));
+cleanup:
+ VIR_FREE(cpumap);
+ return NULL;
+}
+
static bool
cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
{
@@ -5467,13 +5558,11 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
virDomainPtr dom;
int vcpu = -1;
const char *cpulist = NULL;
- bool ret = true;
+ bool ret = false;
unsigned char *cpumap = NULL;
unsigned char *cpumaps = NULL;
size_t cpumaplen;
- int i, cpu, lastcpu, maxcpu, ncpus;
- bool unuse = false;
- const char *cur;
+ int i, maxcpu, ncpus;
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
bool current = vshCommandOptBool(cmd, "current");
@@ -5545,7 +5634,6 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
vshPrint(ctl, "%s %s\n", _("VCPU:"), _("CPU Affinity"));
vshPrint(ctl, "----------------------------------\n");
for (i = 0; i < ncpus; i++) {
-
if (vcpu != -1 && i != vcpu)
continue;
@@ -5556,105 +5644,28 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
break;
}
- } else {
- ret = false;
}
VIR_FREE(cpumaps);
goto cleanup;
}
/* Pin mode: pinning specified vcpu to specified physical cpus*/
-
- cpumap = vshCalloc(ctl, cpumaplen, sizeof(*cpumap));
- /* Parse cpulist */
- cur = cpulist;
- if (*cur == 0) {
- goto parse_error;
- } else if (*cur == 'r') {
- for (cpu = 0; cpu < maxcpu; cpu++)
- VIR_USE_CPU(cpumap, cpu);
- cur = "";
- }
-
- while (*cur != 0) {
-
- /* the char '^' denotes exclusive */
- if (*cur == '^') {
- cur++;
- unuse = true;
- }
-
- /* parse physical CPU number */
- if (!c_isdigit(*cur))
- goto parse_error;
- cpu = virParseNumber(&cur);
- if (cpu < 0) {
- goto parse_error;
- }
- if (cpu >= maxcpu) {
- vshError(ctl, _("Physical CPU %d doesn't exist."), cpu);
- goto parse_error;
- }
- virSkipSpaces(&cur);
-
- if (*cur == ',' || *cur == 0) {
- if (unuse) {
- VIR_UNUSE_CPU(cpumap, cpu);
- } else {
- VIR_USE_CPU(cpumap, cpu);
- }
- } else if (*cur == '-') {
- /* the char '-' denotes range */
- if (unuse) {
- goto parse_error;
- }
- cur++;
- virSkipSpaces(&cur);
- /* parse the end of range */
- lastcpu = virParseNumber(&cur);
- if (lastcpu < cpu) {
- goto parse_error;
- }
- if (lastcpu >= maxcpu) {
- vshError(ctl, _("Physical CPU %d doesn't exist."), maxcpu);
- goto parse_error;
- }
- for (i = cpu; i <= lastcpu; i++) {
- VIR_USE_CPU(cpumap, i);
- }
- virSkipSpaces(&cur);
- }
-
- if (*cur == ',') {
- cur++;
- virSkipSpaces(&cur);
- unuse = false;
- } else if (*cur == 0) {
- break;
- } else {
- goto parse_error;
- }
- }
+ if (!(cpumap = virParseCPUList(ctl, cpulist, maxcpu, cpumaplen)))
+ goto cleanup;
if (flags == -1) {
- if (virDomainPinVcpu(dom, vcpu, cpumap, cpumaplen) != 0) {
- ret = false;
- }
+ if (virDomainPinVcpu(dom, vcpu, cpumap, cpumaplen) != 0)
+ goto cleanup;
} else {
- if (virDomainPinVcpuFlags(dom, vcpu, cpumap, cpumaplen, flags) != 0) {
- ret = false;
- }
+ if (virDomainPinVcpuFlags(dom, vcpu, cpumap, cpumaplen, flags) != 0)
+ goto cleanup;
}
+ ret = true;
cleanup:
VIR_FREE(cpumap);
virDomainFree(dom);
return ret;
-
-parse_error:
- vshError(ctl, "%s", _("cpulist: Invalid format."));
- ret = false;
- goto cleanup;
}
/*
@@ -5701,13 +5712,11 @@ cmdEmulatorPin(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
const char *cpulist = NULL;
- bool ret = true;
+ bool ret = false;
unsigned char *cpumap = NULL;
unsigned char *cpumaps = NULL;
size_t cpumaplen;
- int i, cpu, lastcpu, maxcpu;
- bool unuse = false;
- const char *cur;
+ int maxcpu;
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
bool current = vshCommandOptBool(cmd, "current");
@@ -5761,101 +5770,26 @@ cmdEmulatorPin(vshControl *ctl, const vshCmd *cmd)
vshPrint(ctl, " *: ");
ret = vshPrintPinInfo(cpumaps, cpumaplen, maxcpu, 0);
vshPrint(ctl, "\n");
- } else {
- ret = false;
}
VIR_FREE(cpumaps);
goto cleanup;
}
/* Pin mode: pinning emulator threads to specified physical cpus*/
-
- cpumap = vshCalloc(ctl, cpumaplen, sizeof(*cpumap));
- /* Parse cpulist */
- cur = cpulist;
- if (*cur == 0) {
- goto parse_error;
- } else if (*cur == 'r') {
- for (cpu = 0; cpu < maxcpu; cpu++)
- VIR_USE_CPU(cpumap, cpu);
- cur = "";
- }
-
- while (*cur != 0) {
-
- /* the char '^' denotes exclusive */
- if (*cur == '^') {
- cur++;
- unuse = true;
- }
-
- /* parse physical CPU number */
- if (!c_isdigit(*cur))
- goto parse_error;
- cpu = virParseNumber(&cur);
- if (cpu < 0) {
- goto parse_error;
- }
- if (cpu >= maxcpu) {
- vshError(ctl, _("Physical CPU %d doesn't exist."), cpu);
- goto parse_error;
- }
- virSkipSpaces(&cur);
-
- if (*cur == ',' || *cur == 0) {
- if (unuse) {
- VIR_UNUSE_CPU(cpumap, cpu);
- } else {
- VIR_USE_CPU(cpumap, cpu);
- }
- } else if (*cur == '-') {
- /* the char '-' denotes range */
- if (unuse) {
- goto parse_error;
- }
- cur++;
- virSkipSpaces(&cur);
- /* parse the end of range */
- lastcpu = virParseNumber(&cur);
- if (lastcpu < cpu) {
- goto parse_error;
- }
- if (lastcpu >= maxcpu) {
- vshError(ctl, _("Physical CPU %d doesn't exist."), maxcpu);
- goto parse_error;
- }
- for (i = cpu; i <= lastcpu; i++) {
- VIR_USE_CPU(cpumap, i);
- }
- virSkipSpaces(&cur);
- }
-
- if (*cur == ',') {
- cur++;
- virSkipSpaces(&cur);
- unuse = false;
- } else if (*cur == 0) {
- break;
- } else {
- goto parse_error;
- }
- }
+ if (!(cpumap = virParseCPUList(ctl, cpulist, maxcpu, cpumaplen)))
+ goto cleanup;
if (flags == -1)
flags = VIR_DOMAIN_AFFECT_LIVE;
if (virDomainPinEmulator(dom, cpumap, cpumaplen, flags) != 0)
- ret = false;
+ goto cleanup;
+ ret = true;
cleanup:
VIR_FREE(cpumap);
virDomainFree(dom);
return ret;
-
-parse_error:
- vshError(ctl, "%s", _("cpulist: Invalid format."));
- ret = false;
- goto cleanup;
}
/*
--
1.8.1.4
11 years, 7 months
[libvirt] [PATCH] Resolve valgrind failure
by John Ferlan
Code added by commit id '523207fe8'
TEST: qemuxml2argvtest
........................................ 40
........................................ 80
........................................ 120
........................................ 160
........................................ 200
........................................ 240
................................. 273 OK
==30993== 39 bytes in 1 blocks are definitely lost in loss record 33 of 87
==30993== at 0x4A0887C: malloc (vg_replace_malloc.c:270)
==30993== by 0x41E501: fakeSecretGetValue (qemuxml2argvtest.c:33)
==30993== by 0x427591: qemuBuildDriveURIString (qemu_command.c:2571)
==30993== by 0x42C502: qemuBuildDriveStr (qemu_command.c:2627)
==30993== by 0x4335FC: qemuBuildCommandLine (qemu_command.c:6443)
==30993== by 0x41E8A0: testCompareXMLToArgvHelper (qemuxml2argvtest.c:154
==30993== by 0x41FE8F: virtTestRun (testutils.c:157)
==30993== by 0x418BE3: mymain (qemuxml2argvtest.c:506)
==30993== by 0x4204CA: virtTestMain (testutils.c:719)
==30993== by 0x38D6821A04: (below main) (in /usr/lib64/libc-2.16.so)
==30993==
==30993== 46 bytes in 1 blocks are definitely lost in loss record 64 of 87
==30993== at 0x4A0887C: malloc (vg_replace_malloc.c:270)
==30993== by 0x38D690A167: __vasprintf_chk (in /usr/lib64/libc-2.16.so)
==30993== by 0x4CB28E7: virVasprintf (stdio2.h:210)
==30993== by 0x4CB29A3: virAsprintf (virutil.c:2017)
==30993== by 0x4275B4: qemuBuildDriveURIString (qemu_command.c:2580)
==30993== by 0x42C502: qemuBuildDriveStr (qemu_command.c:2627)
==30993== by 0x4335FC: qemuBuildCommandLine (qemu_command.c:6443)
==30993== by 0x41E8A0: testCompareXMLToArgvHelper (qemuxml2argvtest.c:154
==30993== by 0x41FE8F: virtTestRun (testutils.c:157)
==30993== by 0x418BE3: mymain (qemuxml2argvtest.c:506)
==30993== by 0x4204CA: virtTestMain (testutils.c:719)
==30993== by 0x38D6821A04: (below main) (in /usr/lib64/libc-2.16.so)
==30993==
==30993== 385 (56 direct, 329 indirect) bytes in 1 blocks are definitely los
==30993== at 0x4A06B6F: calloc (vg_replace_malloc.c:593)
==30993== by 0x4C6B2CF: virAllocN (viralloc.c:152)
==30993== by 0x4C9C7EB: virObjectNew (virobject.c:191)
==30993== by 0x4D21810: virGetSecret (datatypes.c:642)
==30993== by 0x41E5D5: fakeSecretLookupByUsage (qemuxml2argvtest.c:51)
==30993== by 0x4D4BEC5: virSecretLookupByUsage (libvirt.c:15295)
==30993== by 0x4276A9: qemuBuildDriveURIString (qemu_command.c:2565)
==30993== by 0x42C502: qemuBuildDriveStr (qemu_command.c:2627)
==30993== by 0x4335FC: qemuBuildCommandLine (qemu_command.c:6443)
==30993== by 0x41E8A0: testCompareXMLToArgvHelper (qemuxml2argvtest.c:154
==30993== by 0x41FE8F: virtTestRun (testutils.c:157)
==30993== by 0x418BE3: mymain (qemuxml2argvtest.c:506)
==30993==
PASS: qemuxml2argvtest
Interesting side note is that running the test singularly via 'make -C tests
check TESTS=qemuxml2argvtest' didn't trip the valgrind error; however,
running during 'make -C tests valgrind' did cause the error to be seen.
---
src/qemu/qemu_command.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index a0c278f..0f6a5a1 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2604,6 +2604,9 @@ cleanup:
VIR_FREE(tmpscheme);
VIR_FREE(volimg);
VIR_FREE(sock);
+ virObjectUnref(sec);
+ VIR_FREE(secret);
+ VIR_FREE(user);
return ret;
--
1.8.1.4
11 years, 7 months
[libvirt] [PATCHv5 00/11] Introduce driver specific XML parsing callbacks
by Peter Krempa
This series now splits out everything unrelated from the virCaps object.
See notes in individual patches for change summary.
This series now contains 2 renaming patches that were suggested by Eric and
Laine.
Peter Krempa (11):
conf: Add post XML parse callbacks and prepare for cleaning of virCaps
conf callback: Rearrange function parameters
qemu: Record the default NIC model in the domain XML
virCaps: get rid of "defaultInitPath" value in the virCaps struct
virCaps: get rid of defaultDiskDriverName
virCaps: get rid of emulatorRequired
virCaps: get rid of defaultDiskDriverType
virCaps: get rid of hasWideScsiBus
virCaps: get rid of macPrefix field
virCaps: get rid of defaultConsoleTargetType callback
maint: Rename xmlconf to xmlopt and virDomainXMLConfing to
virDomainXMLOption
src/conf/capabilities.c | 24 -
src/conf/capabilities.h | 23 -
src/conf/domain_conf.c | 658 ++++++++++++---------
src/conf/domain_conf.h | 103 ++--
src/conf/snapshot_conf.c | 4 +-
src/conf/snapshot_conf.h | 2 +-
src/esx/esx_driver.c | 32 +-
src/esx/esx_private.h | 2 +-
src/libvirt_private.syms | 10 +-
src/libvirt_vmx.syms | 1 +
src/libxl/libxl_conf.c | 13 -
src/libxl/libxl_conf.h | 2 +-
src/libxl/libxl_driver.c | 101 ++--
src/lxc/lxc_conf.c | 21 +-
src/lxc/lxc_conf.h | 4 +-
src/lxc/lxc_controller.c | 10 +-
src/lxc/lxc_domain.c | 34 ++
src/lxc/lxc_domain.h | 1 +
src/lxc/lxc_driver.c | 71 ++-
src/lxc/lxc_process.c | 8 +-
src/openvz/openvz_conf.c | 16 +-
src/openvz/openvz_conf.h | 2 +-
src/openvz/openvz_driver.c | 64 +-
src/parallels/parallels_driver.c | 37 +-
src/parallels/parallels_utils.h | 2 +-
src/phyp/phyp_driver.c | 24 +-
src/phyp/phyp_driver.h | 2 +-
src/qemu/qemu_capabilities.c | 19 -
src/qemu/qemu_command.c | 27 +-
src/qemu/qemu_command.h | 6 +-
src/qemu/qemu_conf.c | 16 +-
src/qemu/qemu_conf.h | 5 +-
src/qemu/qemu_domain.c | 98 ++-
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_driver.c | 147 +++--
src/qemu/qemu_migration.c | 21 +-
src/qemu/qemu_process.c | 34 +-
src/security/virt-aa-helper.c | 19 +-
src/test/test_driver.c | 69 +--
src/uml/uml_conf.c | 9 -
src/uml/uml_conf.h | 2 +-
src/uml/uml_driver.c | 69 ++-
src/vbox/vbox_tmpl.c | 33 +-
src/vmware/vmware_conf.c | 21 +-
src/vmware/vmware_conf.h | 2 +-
src/vmware/vmware_driver.c | 24 +-
src/vmx/vmx.c | 39 +-
src/vmx/vmx.h | 12 +-
src/xen/xen_driver.c | 37 +-
src/xen/xen_driver.h | 4 +-
src/xen/xen_hypervisor.c | 13 -
src/xen/xend_internal.c | 20 +-
src/xen/xm_internal.c | 16 +-
src/xenapi/xenapi_driver.c | 40 +-
src/xenapi/xenapi_driver_private.h | 2 +-
tests/domainsnapshotxml2xmltest.c | 6 +-
tests/lxcxml2xmldata/lxc-hostdev.xml | 1 +
tests/lxcxml2xmldata/lxc-systemd.xml | 1 +
tests/lxcxml2xmltest.c | 8 +-
tests/qemuargv2xmltest.c | 6 +-
tests/qemumonitorjsontest.c | 28 +-
tests/qemumonitortestutils.c | 4 +-
tests/qemumonitortestutils.h | 2 +-
...qemuxml2argv-disk-drive-network-nbd-export.args | 3 +-
.../qemuxml2argv-disk-drive-network-nbd-export.xml | 1 +
...ml2argv-disk-drive-network-nbd-ipv6-export.args | 3 +-
...xml2argv-disk-drive-network-nbd-ipv6-export.xml | 1 +
.../qemuxml2argv-disk-drive-network-nbd-ipv6.args | 3 +-
.../qemuxml2argv-disk-drive-network-nbd-ipv6.xml | 1 +
.../qemuxml2argv-disk-drive-network-nbd-unix.args | 3 +-
.../qemuxml2argv-disk-drive-network-nbd-unix.xml | 1 +
.../qemuxml2argv-disk-drive-network-nbd.args | 5 +-
.../qemuxml2argv-disk-drive-network-nbd.xml | 1 +
.../qemuxml2argv-disk-drive-network-rbd-auth.args | 2 +-
.../qemuxml2argv-disk-drive-network-rbd-ipv6.args | 2 +-
.../qemuxml2argv-disk-drive-network-rbd-ipv6.xml | 1 +
.../qemuxml2argv-disk-drive-network-rbd.args | 2 +-
.../qemuxml2argv-disk-drive-network-rbd.xml | 1 +
.../qemuxml2argv-disk-drive-network-sheepdog.args | 3 +-
.../qemuxml2argv-disk-drive-network-sheepdog.xml | 1 +
.../qemuxml2argv-net-bandwidth.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-net-client.args | 4 +-
.../qemuxml2argv-net-eth-ifname.args | 4 +-
.../qemuxml2argv-net-eth-ifname.xml | 1 +
.../qemuxml2argv-net-eth-names.args | 8 +-
tests/qemuxml2argvdata/qemuxml2argv-net-eth.args | 4 +-
tests/qemuxml2argvdata/qemuxml2argv-net-eth.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-net-hostdev.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-net-mcast.args | 4 +-
.../qemuxml2argv-net-openvswitch.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-net-server.args | 4 +-
tests/qemuxml2argvdata/qemuxml2argv-net-user.args | 3 +-
tests/qemuxml2argvdata/qemuxml2argv-net-user.xml | 1 +
.../qemuxml2argv-net-virtio-network-portgroup.xml | 2 +
tests/qemuxml2argvtest.c | 6 +-
.../qemuxml2xmlout-graphics-spice-timeout.xml | 1 +
tests/qemuxml2xmltest.c | 6 +-
tests/qemuxmlnstest.c | 6 +-
tests/securityselinuxlabeltest.c | 6 +-
tests/testutilslxc.c | 9 -
tests/testutilsqemu.c | 11 -
tests/testutilsqemu.h | 2 +-
tests/testutilsxen.c | 16 -
tests/testutilsxen.h | 2 -
tests/vmx2xmltest.c | 17 +-
tests/xmconfigtest.c | 8 +-
tests/xml2sexprtest.c | 9 +-
tests/xml2vmxtest.c | 19 +-
108 files changed, 1273 insertions(+), 1050 deletions(-)
--
1.8.1.5
11 years, 7 months
[libvirt] [PATCH v2] test: Return Libvirt logo as domain screenshot
by Michal Privoznik
This is just a bare Easter Egg. Whenever user run virDomainScreenshot
over a domain in test driver, he'll get the Libvirt PNG logo in return.
---
docs/Makefile.am | 1 +
src/test/test_driver.c | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 7583772..b5d7575 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -287,6 +287,7 @@ install-data-local:
for file in $(devhelphtml) $(devhelppng) $(devhelpcss); do \
$(INSTALL) -m 0644 $(srcdir)/$${file} $(DESTDIR)$(DEVHELP_DIR) ; \
done
+ $(INSTALL_DATA) $(srcdir)/../docs/libvirtLogo.png $(DESTDIR)$(pkgdatadir)
uninstall-local:
for h in $(apihtml); do rm $(DESTDIR)$(HTML_DIR)/$$h; done
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index c5fffb9..4dbd775 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -39,11 +39,13 @@
#include "virutil.h"
#include "viruuid.h"
#include "capabilities.h"
+#include "configmake.h"
#include "viralloc.h"
#include "network_conf.h"
#include "interface_conf.h"
#include "domain_conf.h"
#include "domain_event.h"
+#include "fdstream.h"
#include "storage_conf.h"
#include "node_device_conf.h"
#include "virxml.h"
@@ -5773,6 +5775,27 @@ cleanup:
return ret;
}
+static char *
+testDomainScreenshot(virDomainPtr dom ATTRIBUTE_UNUSED,
+ virStreamPtr st,
+ unsigned int screen ATTRIBUTE_UNUSED,
+ unsigned int flags)
+{
+ char *ret = NULL;
+
+ virCheckFlags(0, NULL);
+
+ if (!(ret = strdup("image/png"))) {
+ virReportOOMError();
+ return NULL;
+ }
+
+ if (virFDStreamOpenFile(st, PKGDATADIR "/libvirtLogo.png", 0, 0, O_RDONLY < 0))
+ VIR_FREE(ret);
+
+ return ret;
+}
+
static virDriver testDriver = {
.no = VIR_DRV_TEST,
@@ -5843,6 +5866,7 @@ static virDriver testDriver = {
.domainEventDeregisterAny = testDomainEventDeregisterAny, /* 0.8.0 */
.isAlive = testIsAlive, /* 0.9.8 */
.nodeGetCPUMap = testNodeGetCPUMap, /* 1.0.0 */
+ .domainScreenshot = testDomainScreenshot, /* 1.0.5 */
};
static virNetworkDriver testNetworkDriver = {
--
1.8.1.5
11 years, 7 months
[libvirt] The problems of default settings
by Li Zhang
Hi all,
I am recently considering about the default setting for different platforms.
Currently, there is no good way to fix the default setting for PPC64
platform.
For example, we prefer pseries on PPC64 as the default machine type
users don't need to specify it.
I am thinking about the solutions.
1. One solution I am thinking about is to create template xml files for
different platforms.
But if users give their own configuration XML files, how to keep the
preferred configurations in domain definition.
I think this solution should be better in management tools, for example,
ovirt or openstack.
After management tools can generate its own configuration files with
different default settings,
libvirt can help create according to XML files.
2. Another solution is to use hook in libvirt.
But it seems that we need to use hook daemon. Is it complex to use?
I am not familiar with hook.
Any suggestion is appreciated.
Thanks. :)
--Li
11 years, 7 months
[libvirt] migrate qemu domains
by Yin Olivia-R63875
Hi,
I tried to migrate qemu domains between same two Freescale PPC platforms.
1) Migrate test domain from Host1(10.193.20.109) to Host2(10.193.20.181).
root@ppc-host1:~# virsh migrate test qemu+tls://10.193.20.181/system
or
root@ppc-host2:~# virsh -c qemu+tls://10.193.20.109/system migrate test qemu:///system
I waited for a while and finally got error message as below:
error: Unable to read from monitor: Connection reset by peer
Exactly, when waiting (I guess during migration), the migrated domain is pasued on
both source and destination nodes.
root@ppc-host1:~# virsh -c qemu:///system list --all
Id Name State
----------------------------------------------------
5 test paused
And meanwhile, the destination domain is also paused when waiting
root@ppc-host2:~# virsh -c qemu:///system list --all
Id Name State
----------------------------------------------------
2 test paused
Finally, the migrated domain on source node is shut off.
root@ppc-host1:~# virsh -c qemu:///system list --all
Id Name State
----------------------------------------------------
- test shut off
But can't find any domain on destination node any longer.
root@ppc-host2:~# virsh -c qemu:///system list --all
Id Name State
----------------------------------------------------
As I know qemu-system-ppc doesn't support live migration on Freescale PPC platform yet.
My question is whether it depends on qemu implementation to migrate qemu hypervisor with libvirt?
>From the above experiment, it seemed that migration happened but not succeeded finally.
Best Regards,
Olivia
11 years, 7 months