[libvirt] [PATCH] docs: fix typo in isa-serial additions
by Laine Stump
This was preventing make rpm from completing.
---
Pushed under the build breaker rule.
docs/formatdomain.html.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 90f8abe..bb0b199 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3693,7 +3693,7 @@ qemu-kvm -net nic,model=? /dev/null
specifies the port number. Ports are numbered starting from 0. There are
usually 0, 1 or 2 serial ports. There is also an optional
<code>type</code> attribute <span class="since">since 1.0.2</span>
- which has two choices for its value, one is< code>isa-serial</code>,
+ which has two choices for its value, one is <code>isa-serial</code>,
the other is <code>usb-serial</code>. If <code>type</code> is missing,
<code>isa-serial</code> will be used by default. For <code>usb-serial</code>
an optional sub-element <code><address></code> with
--
1.7.11.7
12 years, 4 months
[libvirt] [PATCH] util: reduce syscalls for virGetDeviceID
by Eric Blake
There's no need to do lots of readlink() calls to canonicalize
a name if we're only going to use stat() on it, since stat()
already chases symlinks.
* src/util/virutil.c (virGetDeviceID): Let stat() do the symlink
chasing.
---
src/util/virutil.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 47ab17f..7c54bea 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -1,7 +1,7 @@
/*
* virutil.c: common, generic utility functions
*
- * Copyright (C) 2006-2012 Red Hat, Inc.
+ * Copyright (C) 2006-2013 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
* Copyright (C) 2006, 2007 Binary Karma
* Copyright (C) 2006 Shuveb Hussain
@@ -3135,27 +3135,18 @@ int
virGetDeviceID(const char *path, int *maj, int *min)
{
struct stat sb;
- char *canonical_path = NULL;
- if (virFileResolveLink(path, &canonical_path) < 0)
+ if (stat(path, &sb) < 0)
return -errno;
- if (stat(canonical_path, &sb) < 0) {
- VIR_FREE(canonical_path);
- return -errno;
- }
-
- if (!S_ISBLK(sb.st_mode)) {
- VIR_FREE(canonical_path);
+ if (!S_ISBLK(sb.st_mode))
return -EINVAL;
- }
if (maj)
*maj = major(sb.st_rdev);
if (min)
*min = minor(sb.st_rdev);
- VIR_FREE(canonical_path);
return 0;
}
#else
--
1.8.0.2
12 years, 4 months
[libvirt] [PATCH] pass stub driver name instead of pciFindStubDriver
by Chunyan Liu
Pass stub driver name directly to pciDettachDevice and pciReAttachDevice to fit
for different libvirt drivers. For example, qemu driver prefers pci-stub, but
Xen prefers pciback.
Signed-off-by: Chunyan Liu <cyliu(a)suse.com>
---
src/qemu/qemu_driver.c | 4 +-
src/qemu/qemu_hostdev.c | 6 ++--
src/util/virpci.c | 62 +++++++++++++++-------------------------------
src/util/virpci.h | 6 +++-
src/xen/xen_driver.c | 4 +-
5 files changed, 31 insertions(+), 51 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 06b0d28..3427d3f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10022,7 +10022,7 @@ qemuNodeDeviceDettach(virNodeDevicePtr dev)
in_inactive_list = pciDeviceListFind(driver->inactivePciHostdevs, pci);
if (pciDettachDevice(pci, driver->activePciHostdevs,
- driver->inactivePciHostdevs) < 0)
+ driver->inactivePciHostdevs, "pci-stub") < 0)
goto out;
ret = 0;
@@ -10067,7 +10067,7 @@ qemuNodeDeviceReAttach(virNodeDevicePtr dev)
qemuDriverLock(driver);
if (pciReAttachDevice(pci, driver->activePciHostdevs,
- driver->inactivePciHostdevs) < 0)
+ driver->inactivePciHostdevs, "pci-stub") < 0)
goto out;
ret = 0;
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index 174d125..896ad9b 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -458,7 +458,7 @@ int qemuPrepareHostdevPCIDevices(virQEMUDriverPtr driver,
for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
pciDevice *dev = pciDeviceListGet(pcidevs, i);
if (pciDeviceGetManaged(dev) &&
- pciDettachDevice(dev, driver->activePciHostdevs, NULL) < 0)
+ pciDettachDevice(dev, driver->activePciHostdevs, NULL, "pci-stub") < 0)
goto reattachdevs;
}
@@ -574,7 +574,7 @@ resetvfnetconfig:
reattachdevs:
for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
pciDevice *dev = pciDeviceListGet(pcidevs, i);
- pciReAttachDevice(dev, driver->activePciHostdevs, NULL);
+ pciReAttachDevice(dev, driver->activePciHostdevs, NULL, "pci-stub");
}
cleanup:
@@ -830,7 +830,7 @@ void qemuReattachPciDevice(pciDevice *dev, virQEMUDriverPtr driver)
}
if (pciReAttachDevice(dev, driver->activePciHostdevs,
- driver->inactivePciHostdevs) < 0) {
+ driver->inactivePciHostdevs, "pci-stub") < 0) {
virErrorPtr err = virGetLastError();
VIR_ERROR(_("Failed to re-attach PCI device: %s"),
err ? err->message : _("unknown error"));
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 4b26452..fb305e2 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -855,57 +855,35 @@ pciDeviceFile(char **buffer, const char *device, const char *file)
return 0;
}
-
-static const char *
-pciFindStubDriver(void)
+static int
+pciProbeStubDriver(const char *driver)
{
char *drvpath = NULL;
int probed = 0;
recheck:
- if (pciDriverDir(&drvpath, "pci-stub") < 0) {
- return NULL;
- }
-
- if (virFileExists(drvpath)) {
- VIR_FREE(drvpath);
- return "pci-stub";
- }
-
- if (pciDriverDir(&drvpath, "pciback") < 0) {
- return NULL;
- }
-
- if (virFileExists(drvpath)) {
+ if (pciDriverDir(&drvpath, driver) == 0 && virFileExists(drvpath)) {
+ /* driver already loaded, return */
VIR_FREE(drvpath);
- return "pciback";
+ return 0;
}
VIR_FREE(drvpath);
if (!probed) {
- const char *const stubprobe[] = { MODPROBE, "pci-stub", NULL };
- const char *const backprobe[] = { MODPROBE, "pciback", NULL };
-
+ const char *const probecmd[] = { MODPROBE, driver, NULL };
probed = 1;
- /*
- * Probing for pci-stub will succeed regardless of whether
- * on native or Xen kernels.
- * On Xen though, we want to prefer pciback, so probe
- * for that first, because that will only work on Xen
- */
- if (virRun(backprobe, NULL) < 0 &&
- virRun(stubprobe, NULL) < 0) {
+ if (virRun(probecmd, NULL) < 0 ) {
char ebuf[1024];
- VIR_WARN("failed to load pci-stub or pciback drivers: %s",
+ VIR_WARN("failed to load driver %s: %s", driver,
virStrerror(errno, ebuf, sizeof(ebuf)));
- return NULL;
+ return -1;
}
goto recheck;
}
- return NULL;
+ return -1;
}
static int
@@ -1149,12 +1127,12 @@ cleanup:
int
pciDettachDevice(pciDevice *dev,
pciDeviceList *activeDevs,
- pciDeviceList *inactiveDevs)
+ pciDeviceList *inactiveDevs,
+ const char *driver)
{
- const char *driver = pciFindStubDriver();
- if (!driver) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot find any PCI stub module"));
+ if (pciProbeStubDriver(driver) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to load PCI stub module %s"), driver);
return -1;
}
@@ -1179,12 +1157,12 @@ pciDettachDevice(pciDevice *dev,
int
pciReAttachDevice(pciDevice *dev,
pciDeviceList *activeDevs,
- pciDeviceList *inactiveDevs)
+ pciDeviceList *inactiveDevs,
+ const char *driver)
{
- const char *driver = pciFindStubDriver();
- if (!driver) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot find any PCI stub module"));
+ if (pciProbeStubDriver(driver) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to load PCI stub module %s"), driver);
return -1;
}
diff --git a/src/util/virpci.h b/src/util/virpci.h
index 115da4e..bf7da01 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -44,10 +44,12 @@ void pciFreeDevice (pciDevice *dev);
const char *pciDeviceGetName (pciDevice *dev);
int pciDettachDevice (pciDevice *dev,
pciDeviceList *activeDevs,
- pciDeviceList *inactiveDevs);
+ pciDeviceList *inactiveDevs,
+ const char *driver);
int pciReAttachDevice (pciDevice *dev,
pciDeviceList *activeDevs,
- pciDeviceList *inactiveDevs);
+ pciDeviceList *inactiveDevs,
+ const char *driver);
int pciResetDevice (pciDevice *dev,
pciDeviceList *activeDevs,
pciDeviceList *inactiveDevs);
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 559025e..2795ebc 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -2113,7 +2113,7 @@ xenUnifiedNodeDeviceDettach(virNodeDevicePtr dev)
if (!pci)
return -1;
- if (pciDettachDevice(pci, NULL, NULL) < 0)
+ if (pciDettachDevice(pci, NULL, NULL, "pciback") < 0)
goto out;
ret = 0;
@@ -2203,7 +2203,7 @@ xenUnifiedNodeDeviceReAttach(virNodeDevicePtr dev)
goto out;
}
- if (pciReAttachDevice(pci, NULL, NULL) < 0)
+ if (pciReAttachDevice(pci, NULL, NULL, "pciback") < 0)
goto out;
ret = 0;
--
1.7.3.4
12 years, 4 months
[libvirt] Attaching an "Internal Address"
by Varun Bhatnagar
Hi,
I am trying to attach an internal address to my domain. So for that I am
defining the following syntax in my xml file:
but it is giving the following error:
Tried giving interface type as network but that is adding Host-only type
interface.
Can anyone please suggest what can be the possible solution. I think it is
some problem with the source network. Do I have to define any internal
network before in any interface?
If yes then how?
Any help will be appreciated.
Thanks in advance.
Regards,
Varun
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
12 years, 4 months
[libvirt] [PATCH] build: move file deleting action from %files list to %install
by Yufang Zhang
When building libvirt rpms on rhel5, I got the following error:
File must begin with "/": rm
File must begin with "/": -f
File must begin with "/": $RPM_BUILD_ROOT/etc/sysctl.d/libvirtd
Installed (but unpackaged) file(s) found:
/etc/sysctl.d/libvirtd
It is triggerd by the %files list of libvirt daemon:
%if 0%{?fedora} >= 14 || 0%{?rhel} >= 6
%config(noreplace) %{_prefix}/lib/sysctl.d/libvirtd.conf
%else
rm -f $RPM_BUILD_ROOT%{_prefix}/lib/sysctl.d/libvirtd.conf
%endif
After checking document of rpm spec file, I think it would be better
to move the file deleting line from %files list to %install script.
---
libvirt.spec.in | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 52da4f4..4872c07 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1420,6 +1420,10 @@ mv $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_qemu_probes.stp \
%endif
%endif
+%if 0%{?fedora} < 14 || 0%{?rhel} == 5
+rm -f $RPM_BUILD_ROOT%{_prefix}/lib/sysctl.d/libvirtd.conf
+%endif
+
%clean
rm -fr %{buildroot}
@@ -1679,8 +1683,6 @@ fi
%config(noreplace) %{_sysconfdir}/libvirt/libvirtd.conf
%if 0%{?fedora} >= 14 || 0%{?rhel} >= 6
%config(noreplace) %{_prefix}/lib/sysctl.d/libvirtd.conf
-%else
-rm -f $RPM_BUILD_ROOT%{_prefix}/lib/sysctl.d/libvirtd.conf
%endif
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/
--
1.7.4.1
12 years, 4 months
[libvirt] Slow libvirtd startup
by Zeeshan Ali (Khattak)
Hi,
Too lazy to explain again so I'll just c&p conversation I had about
the issue with Eric on IRC:
<zeenix> is timeouts on session libvirt (or in general) something new?
<zeenix> libvirtd startup seems to now take a few seconds so Boxes UI
is all empty for that amount of time
<eblake> it's been around for a while; qemu.conf has settings to
control how long it should take
<zeenix> unless Boxes is launched before libvirtd timesout
<eblake> but there is a relatively new patch that makes the libvirtd
-t actually be useful for qemu:///session
<zeenix> don't think i ever changed that, at least not recently
<zeenix> that could be it
<zeenix> i only saw it happening after i update libvirtd (after a month)
<eblake> if you're seeing some delays in starting libvirtd, those are
probably worth fixing
<zeenix> s/update/recently updated/
<zeenix> yeah
<zeenix> i'll try to write a test app
<zeenix> no need, i can reproduce with virsh :)
[zeenix@z-laptop virt]$ time virsh list
Id Name State
----------------------------------------------------
real 0m6.349s
user 0m0.016s
sys 0m0.010s
[zeenix@z-laptop virt]$ time virsh list
Id Name State
----------------------------------------------------
real 0m0.024s
user 0m0.010s
sys 0m0.011s
--
Regards,
Zeeshan Ali (Khattak)
FSF member#5124
12 years, 4 months
[libvirt] [PATCH 0/3]add usb-net support for qemu
by Guannan Ren
The set of patches fixed some typo in network docs and codes and
is trying to support usb-net qemu virtual device.
The following is an example for use.
Libvirt XML sample:
<devices>
<interface type='user'>
<mac address='52:54:00:32:6a:91'/>
<model type='usb-net'/>
<alias name='net1'/>
<address type='usb' bus='0' port='1'/>
</interface>
</devices>
qemu commandline:
qemu ${other_vm_args}
-netdev user,id=hostnet1 \
-device usb-net,netdev=hostnet1,id=net1,\
mac=52:54:00:32:6a:91,bus=usb.0,port=1
Guannan Ren(3)
[PATCH 1/3] network: fix typos and docs
[PATCH 2/3] qemu: add usb-net caps flag
[PATCH 3/3] qemu: add usb-net support
docs/formatdomain.html.in | 13 +++++++++----
src/conf/domain_conf.c | 22 +++++++++++++++-------
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 8 +++++++-
tests/qemuhelptest.c | 21 ++++++++++++++-------
6 files changed, 48 insertions(+), 19 deletions(-)
12 years, 4 months
[libvirt] API to upgrade read-only connection
by Zeeshan Ali (Khattak)
Hi,
Once again, I'll be lazy and just copy&paste an IRC conversation but
please don't hesitate to ask if something needs clarification:
<zeenix> am i missing something or there is no way to 'upgrade' a
read-only connection to a normal one?
<eblake_out> zeenix: looks like you have to create a new connection if
you want new privileges
<eblake_out> although you may want to float it by the list to see if a
new API for upgrading an existing connection makes sense
<eblake_out> especially in light of danpb's work-in-progress on adding
fine-grained ACLs
<zeenix> ah ok
<zeenix> eblake_out: we'd like to connect to system libvirt as well by
default in boxes
<zeenix> but would be nice to avoid the polkit dialog until we really
need full-access
--
Regards,
Zeeshan Ali (Khattak)
FSF member#5124
12 years, 4 months
[libvirt] [PATCH 0/2]add usb-serial virtual device support for qemu
by Guannan Ren
This two patches are trying to add support for qemu virtual device
usb-serial.
Add an optional 'type' attribute to <target> element of serial port
device. There are two choices for its value, 'isa-serial' and
'usb-serial'. For backward compatibility, when attribute 'type' is
missing the 'isa-serial' will be chose as before.
Libvirt XML sample
<serial type='pty'>
<target type='usb-serial' port='0'/>
<address type='usb' bus='0' port='1'/>
</serial>
qemu commandline:
qemu ${other_vm_args} \
-chardev pty,id=charserial0 \
-device usb-serial,chardev=charserial0,id=serial0,bus=usb.0,port=1
Guannan Ren(2)
[PATCH 1/2] qemu: add usb-serial caps flag
[PATCH 2/2] qemu: add usb-serial support
docs/formatdomain.html.in | 9 ++++++++-
docs/schemas/domaincommon.rng | 20 +++++++++++++++++---
src/conf/domain_conf.c | 42 +++++++++++++++++++++++++++++++++++++++---
src/conf/domain_conf.h | 10 ++++++++++
src/libvirt_private.syms | 2 ++
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 24 ++++++++++++++++++++++--
tests/qemuhelptest.c | 21 ++++++++++++++-------
9 files changed, 115 insertions(+), 16 deletions(-)
12 years, 4 months
[libvirt] [PATCH] Fix wrong indentation for virDomainState
by Claudio Bley
Signed-off-by: Claudio Bley <cbley(a)av-test.de>
---
Pushing under the trivial rule.
include/libvirt/libvirt.h.in | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 09c89c5..d2640e1 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -116,14 +116,14 @@ typedef virDomain *virDomainPtr;
* A domain may be in different states at a given point in time
*/
typedef enum {
- VIR_DOMAIN_NOSTATE = 0, /* no state */
- VIR_DOMAIN_RUNNING = 1, /* the domain is running */
- VIR_DOMAIN_BLOCKED = 2, /* the domain is blocked on resource */
- VIR_DOMAIN_PAUSED = 3, /* the domain is paused by user */
- VIR_DOMAIN_SHUTDOWN= 4, /* the domain is being shut down */
- VIR_DOMAIN_SHUTOFF = 5, /* the domain is shut off */
- VIR_DOMAIN_CRASHED = 6, /* the domain is crashed */
- VIR_DOMAIN_PMSUSPENDED = 7, /* the domain is suspended by guest
+ VIR_DOMAIN_NOSTATE = 0, /* no state */
+ VIR_DOMAIN_RUNNING = 1, /* the domain is running */
+ VIR_DOMAIN_BLOCKED = 2, /* the domain is blocked on resource */
+ VIR_DOMAIN_PAUSED = 3, /* the domain is paused by user */
+ VIR_DOMAIN_SHUTDOWN= 4, /* the domain is being shut down */
+ VIR_DOMAIN_SHUTOFF = 5, /* the domain is shut off */
+ VIR_DOMAIN_CRASHED = 6, /* the domain is crashed */
+ VIR_DOMAIN_PMSUSPENDED = 7, /* the domain is suspended by guest
power management */
#ifdef VIR_ENUM_SENTINELS
@@ -132,7 +132,7 @@ typedef enum {
* added to the libvirt API. It reflects the last state supported
* by this version of the libvirt API.
*/
- VIR_DOMAIN_LAST
+ VIR_DOMAIN_LAST
#endif
} virDomainState;
--
1.7.9.5
12 years, 4 months