[libvirt] [PATCH] util: Use virReportSystemError for system error in pci.c
by Osier Yang
---
src/util/pci.c | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/util/pci.c b/src/util/pci.c
index d1ad121..191f99d 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -1860,10 +1860,9 @@ pciGetPciConfigAddressFromSysfsDeviceLink(const char *device_link,
device_path = canonicalize_file_name(device_link);
if (device_path == NULL) {
memset(errbuf, '\0', sizeof(errbuf));
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to resolve device link '%s': '%s'"),
- device_link, virStrerror(errno, errbuf,
- sizeof(errbuf)));
+ virReportSystemError(errno,
+ _("Failed to resolve device link '%s'"),
+ device_link);
return ret;
}
@@ -1941,10 +1940,9 @@ pciGetVirtualFunctions(const char *sysfs_path,
dir = opendir(sysfs_path);
if (dir == NULL) {
memset(errbuf, '\0', sizeof(errbuf));
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to open dir '%s': '%s'"),
- sysfs_path, virStrerror(errno, errbuf,
- sizeof(errbuf)));
+ virReportSystemError(errno,
+ _("Failed to open dir '%s'"),
+ sysfs_path);
return ret;
}
--
1.7.7.6
12 years
[libvirt] [PATCH] util: Fix the indention
by Osier Yang
---
Pushed under trivial rule.
---
src/util/cgroup.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/util/cgroup.c b/src/util/cgroup.c
index 3f7b5f7..41a6e4a 100644
--- a/src/util/cgroup.c
+++ b/src/util/cgroup.c
@@ -1189,10 +1189,10 @@ int virCgroupSetBlkioDeviceWeight(virCgroupPtr group,
return ret;
}
#else
- int
- virCgroupSetBlkioDeviceWeight(virCgroupPtr group ATTRIBUTE_UNUSED,
- const char *path ATTRIBUTE_UNUSED,
- unsigned int weight ATTRIBUTE_UNUSED)
+int
+virCgroupSetBlkioDeviceWeight(virCgroupPtr group ATTRIBUTE_UNUSED,
+ const char *path ATTRIBUTE_UNUSED,
+ unsigned int weight ATTRIBUTE_UNUSED)
{
return -ENOSYS;
}
--
1.7.7.6
12 years
[libvirt] image transfer incompletely in live migration
by yli@cloudiya.com
Hi,
I am using libvirt version 0.10.1 and qemu-kvm version 1.2.0 with RHEL 6.3
When I use libvirt API to make block migrate with a VM, it failed
frequently. I check the migrated VM and found that the filesystem damaged.
But sometimes it works very fine, I don't know why, it seems to be random.
All failed tests have the same condition, image transfer incompletely in
live migration. The image I used is 10GB size, after a failed migration it
has only about 400MB to 3GB in remote host.
Here is the code:
import libvirt
from xml.dom import minidom
name = "vm-01"
host = libvirt.open("qemu:///system")
vm = host.lookupByNmae(name)
vm_xml_file = "/etc/libvirt/qemu/%s.xml" % name
vm_xml = minidom.parse(vm_xml_file).documentElement.toxml()
remote_host = "qemu+ssh://host02/system"
remote = libvirt.open(remote_host)
try:
vm.migrate2(remote, vm_xml, 89, name, None, 0)
except Exception,e:
print str(e)
Before run the code I have already create a image for migration in remote
host 'host02'. Path, size, and privilege all OK.
Here is the related log:
in source host 'host01':
2012-11-24 05:14:40.001+0000: 24888: warning :
qemuDomainObjBeginJobInternal:838 : Cannot start job (query, none) for
domain wrksp-776; current job is (async nested, migration out) owned by
(24890, 24890) 2012-11-24 05:16:16.398+0000: 24888: error :
qemuDomainObjBeginJobInternal:842 : Timed out during operation: cannot
acquire state change lock
2012-11-24 05:16:21.317+0000: 24887: error : virNetSocketReadWire:1184 :
End of file while reading data: Input/output error
in remote host 'host02':
2012-11-24 05:14:00.776+0000: 11065: warning :
qemuDomainObjEnterMonitorInternal:993 : This thread seems to be the async
job owner; entering monitor without asking for a nested job is dangerous
2012-11-24 05:14:01.196+0000: 11065: warning :
qemuDomainObjEnterMonitorInternal:993 : This thread seems to be the async
job owner; entering monitor without asking for a nested job is dangerous
2012-11-24 05:14:01.198+0000: 11065: warning :
qemuDomainObjEnterMonitorInternal:993 : This thread seems to be the async
job owner; entering monitor without asking for a nested job is dangerous
2012-11-24 05:14:01.208+0000: 11065: warning :
qemuDomainObjEnterMonitorInternal:993 : This thread seems to be the async
job owner; entering monitor without asking for a nested job is dangerous
2012-11-24 05:14:01.211+0000: 11065: warning :
qemuDomainObjEnterMonitorInternal:993 : This thread seems to be the async
job owner; entering monitor without asking for a nested job is dangerous
I try to use command "virsh migrate vm-01 --live --copy-storage-all
--persistent --undefinesource qemu+ssh://host02/system --verbose", the
test results have no change, common but not regular.
Even after my once successful test, it will certainly fail when I try to
make a second migrate with the same VM.
How can I solve this problem? Anything is helpful.
Thanks.
12 years
[libvirt] [BUG] storage.xml: owner|group=-1 → 2^32-1 on 32 Bit
by Philipp Hahn
Hello,
when you install and use libvirt in a 32 bit environment, the handling of
owner and group in /etc/libvirt/storage/*.xml is broken: The initial -1 is
printed as an "unsigned int" and is thus converted to +(2^32-1):
> # cat /etc/libvirt/storage/default.xml
> <!--
> WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
> OVERWRITTEN AND LOST. Changes to this xml configuration should be made
> using: virsh pool-edit default
> or other application using the libvirt API.
> -->
>
> <pool type='dir'>
> <name>default</name>
> <uuid>4e2670b8-9dc3-528e-6fc2-58268e99f44f</uuid>
> <capacity unit='bytes'>0</capacity>
> <allocation unit='bytes'>0</allocation>
> <available unit='bytes'>0</available>
> <source>
> </source>
> <target>
> <path>/var/lib/libvirt/images</path>
> <permissions>
> <mode>0700</mode>
> <owner>4294967295</owner>
> <group>4294967295</group>
> </permissions>
> </target>
> </pool>
When you next restart libvirtd virStorageDefParsePerms() tries to parse that
as an "signed int", which fails in virXPathLongBase() because of
> 182 if (*value != obj->floatval) {
> (gdb) print *value
> $11 = -2147483648
> (gdb) print obj->floatval
> $12 = 4294967295
> (gdb) print /x *value
> $13 = 0x80000000
> (gdb) print /x obj->floatval
> $14 = 0xffffffff
This then prints the following error messages:
> 2012-11-23 14:03:18.877+0000: 25536: error : virStorageDefParsePerms:613 :
> XML error: malformed owner element
> 2012-11-23 14:03:19.581+0000: > 25529: error :
storagePoolSetAutostart:1056 : Failed to create symlink
> '/etc/libvirt/storage/autostart/default.xml' to '/etc/libvirt/storage/def
The change to print owner and group as %d instead of %u was introdeces in
commit 37a10129:
> Update xml schemas according to libvirt source
...
> storage_conf: Print uid_t and gid_t as signed to storage pool XML.
Care to revert that change? Patch is attached.
Sincerely
Philipp
--
Philipp Hahn Open Source Software Engineer hahn(a)univention.de
Univention GmbH be open. fon: +49 421 22 232- 0
Mary-Somerville-Str.1 D-28359 Bremen fax: +49 421 22 232-99
http://www.univention.de/
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 7944555..b07a7aa 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1036,10 +1036,10 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def) {
virBufferAddLit(&buf," <permissions>\n");
virBufferAsprintf(&buf," <mode>0%o</mode>\n",
def->target.perms.mode);
- virBufferAsprintf(&buf," <owner>%d</owner>\n",
- (int) def->target.perms.uid);
- virBufferAsprintf(&buf," <group>%d</group>\n",
- (int) def->target.perms.gid);
+ virBufferAsprintf(&buf," <owner>%u</owner>\n",
+ (unsigned int) def->target.perms.uid);
+ virBufferAsprintf(&buf," <group>%u</group>\n",
+ (unsigned int) def->target.perms.gid);
12 years
[libvirt] [PATCHv2] virsh: Report error when taking a snapshot with empty --memspec argument
by Peter Krempa
When the value of memspec was empty taking of a snapshot failed without
reporting an error.
---
tools/virsh-snapshot.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index 398730c..8ec6456 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -358,18 +358,19 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd)
if (desc)
virBufferEscapeString(&buf, " <description>%s</description>\n", desc);
- if (vshCommandOptString(cmd, "memspec", &memspec) < 0 ||
- vshParseSnapshotMemspec(ctl, &buf, memspec) < 0) {
- virBufferFreeAndReset(&buf);
+ if (vshCommandOptString(cmd, "memspec", &memspec) < 0) {
+ vshError(ctl, _("memspec argument must not be empty"));
goto cleanup;
}
+
+ if (memspec && vshParseSnapshotMemspec(ctl, &buf, memspec) < 0)
+ goto cleanup;
+
if (vshCommandOptBool(cmd, "diskspec")) {
virBufferAddLit(&buf, " <disks>\n");
while ((opt = vshCommandOptArgv(cmd, opt))) {
- if (vshParseSnapshotDiskspec(ctl, &buf, opt->data) < 0) {
- virBufferFreeAndReset(&buf);
+ if (vshParseSnapshotDiskspec(ctl, &buf, opt->data) < 0)
goto cleanup;
- }
}
virBufferAddLit(&buf, " </disks>\n");
}
@@ -390,6 +391,7 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd)
ret = vshSnapshotCreate(ctl, dom, buffer, flags, NULL);
cleanup:
+ virBufferFreeAndReset(&buf);
VIR_FREE(buffer);
if (dom)
virDomainFree(dom);
--
1.8.0
12 years
Re: [libvirt] Remote connection to KVM hypervisor failed using libvirt 0.10.2
by Daniel P. Berrange
On Fri, Nov 23, 2012 at 11:13:58AM +0200, Ido Levy wrote:
> > From: "Daniel P. Berrange" <berrange(a)redhat.com>
> > To: Ido Levy/Haifa/IBM@IBMIL,
> > Cc: libvir-list(a)redhat.com
> > Date: 23/11/2012 10:59 AM
> > Subject: Re: [libvirt] Remote connection to KVM hypervisor failed
> > using libvirt 0.10.2
> >
> > On Fri, Nov 23, 2012 at 07:43:12AM +0200, Ido Levy wrote:
> > > Hello,
> > >
> > > I compiled libvirt 0.10.2 from source providing extra parameters to
> the
> > > configure procedure to support phyp and hyper-v driver support, and
> python
> > > binding.
> > > When running virsh from the tools directory (libvirt-0.10.2/tools) and
>
> > > trying to connect to remote KVM hypervisor using connect
> > > qemu+ssh://user@hostname/system
> > > I got the following error
> > > error: Failed to connect to the hypervisor
> > > error: End of file while reading data: : Input/output error
> > >
> > > The same scenario working without any issue using virsh tool that is
> > > shipped with RHEL distribution.
> > >
> > > Any advise how can I figure out how to resolve this.
> >
> > What are the full args you passed to 'configure' ?
> >
> > Daniel
>
> ./configure --with-python --with-phyp --with-hyperv
Ok, that's the problem. If you want your build to be able to connect
to the RPM based build, you need to make it use the same paths. For
this you need to pass
./configure --with-python --with-phyp --with-hyperv \
--prefix=/usr --sysconfdir=/etc --localstatedir=/var
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
12 years
[libvirt] [PATCH 0/4] qemu: add boot order support for redirected and host USB devices
by Ján Tomko
Commit a4c19459aa8634c43b51e8138fb1d7eec4c17824 missed the functionality
for redirected USB devices (fixed in 1/4), documentation and tests.
https://bugzilla.redhat.com/show_bug.cgi?id=805414
Ján Tomko (4):
conf: add support for booting from redirected USB devices
docs: boot order for host and redirected USB devices
tests: add boot order for host and redirected USB to qemu argv test
tests: update qemuhelptest data
docs/formatdomain.html.in | 27 ++-
src/conf/domain_conf.c | 34 ++--
tests/qemuhelpdata/qemu-1.2.0 | 1 +
tests/qemuhelpdata/qemu-1.2.0-device | 51 +++-
tests/qemuhelpdata/qemu-kvm-1.2.0 | 276 ++++++++++++++++++++
tests/qemuhelpdata/qemu-kvm-1.2.0-device | 222 ++++++++++++++++
tests/qemuhelptest.c | 106 ++++++++-
...muxml2argv-hostdev-usb-address-device-boot.args | 6 +
...emuxml2argv-hostdev-usb-address-device-boot.xml | 28 ++
.../qemuxml2argv-usb-redir-boot.args | 10 +
.../qemuxml2argv-usb-redir-boot.xml | 42 +++
tests/qemuxml2argvtest.c | 9 +
12 files changed, 775 insertions(+), 37 deletions(-)
create mode 100644 tests/qemuhelpdata/qemu-kvm-1.2.0
create mode 100644 tests/qemuhelpdata/qemu-kvm-1.2.0-device
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address-device-boot.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address-device-boot.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-redir-boot.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-redir-boot.xml
--
1.7.8.6
12 years
[libvirt] [PATCH] bitmap: fix typo to use UL type of integer constant in virBitmapIsAllSet
by Guannan Ren
This bug leads to get incorrect vcpupin information via
qemudDomainGetVcpuPinInfo() API when the number of maximum
cpu on a host falls into a scope such as 31 < ncpus < 64.
gcc warning:
left shift count >= width of type
The following bug is such a case
https://bugzilla.redhat.com/show_bug.cgi?id=876415
---
src/util/bitmap.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/util/bitmap.c b/src/util/bitmap.c
index 5ec5440..c29f5f3 100644
--- a/src/util/bitmap.c
+++ b/src/util/bitmap.c
@@ -574,8 +574,8 @@ bool virBitmapIsAllSet(virBitmapPtr bitmap)
return false;
if (unusedBits > 0) {
- if ((bitmap->map[sz] & ((1U << (VIR_BITMAP_BITS_PER_UNIT - unusedBits)) - 1))
- != ((1U << (VIR_BITMAP_BITS_PER_UNIT - unusedBits)) - 1))
+ if ((bitmap->map[sz] & ((1UL << (VIR_BITMAP_BITS_PER_UNIT - unusedBits)) - 1))
+ != ((1UL << (VIR_BITMAP_BITS_PER_UNIT - unusedBits)) - 1))
return false;
}
--
1.7.1
12 years
[libvirt] Remote connection to KVM hypervisor failed using libvirt 0.10.2
by Ido Levy
Hello,
I compiled libvirt 0.10.2 from source providing extra parameters to the
configure procedure to support phyp and hyper-v driver support, and python
binding.
When running virsh from the tools directory (libvirt-0.10.2/tools) and
trying to connect to remote KVM hypervisor using connect
qemu+ssh://user@hostname/system
I got the following error
error: Failed to connect to the hypervisor
error: End of file while reading data: : Input/output error
The same scenario working without any issue using virsh tool that is
shipped with RHEL distribution.
Any advise how can I figure out how to resolve this.
Thanks,
Ido
12 years