Re: [libvirt] [virt-tools-list] [virt-manager PATCH] test: Fix tests with latest libvirt
by Cole Robinson
On 05/04/2014 10:59 PM, Chen Hanxiao wrote:
> Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
> ---
> tests/cli-test-xml/compare/virt-clone-clone-auto1.xml | 6 ++++++
> tests/cli-test-xml/compare/virt-clone-clone-auto2.xml | 1 +
> 2 files changed, 7 insertions(+)
>
> diff --git a/tests/cli-test-xml/compare/virt-clone-clone-auto1.xml b/tests/cli-test-xml/compare/virt-clone-clone-auto1.xml
> index b9fde61..03b7b5c 100644
> --- a/tests/cli-test-xml/compare/virt-clone-clone-auto1.xml
> +++ b/tests/cli-test-xml/compare/virt-clone-clone-auto1.xml
> @@ -22,16 +22,19 @@
> <disk type="block" device="floppy">
> <driver type="vmdk"/>
> <source dev="/dev/disk-pool/diskvol1-clone"/>
> + <backingStore/>
> <target dev="fda" bus="fdc"/>
> <address type="drive" controller="0" bus="0" target="0" unit="0"/>
> </disk>
> <disk type="block" device="disk">
> <source dev="/dev/disk-pool/diskvol2"/>
> + <backingStore/>
> <target dev="sda" bus="scsi"/>
> <readonly/>
> <address type="drive" controller="0" bus="0" target="0" unit="0"/>
> </disk>
> <disk type="block" device="cdrom">
> + <backingStore/>
> <target dev="sdb" bus="scsi"/>
> <readonly/>
> <address type="drive" controller="0" bus="0" target="0" unit="1"/>
> @@ -39,6 +42,7 @@
> <disk type="block" device="disk">
> <driver type="qcow2"/>
> <source dev="/dev/default-pool/collidevol1.img"/>
> + <backingStore/>
> <target dev="sdc" bus="scsi"/>
> <readonly/>
> <shareable/>
> @@ -46,11 +50,13 @@
> </disk>
> <disk type="file" device="disk">
> <source file="/dev/default-pool/default-vol-clone"/>
> + <backingStore/>
> <target dev="hda" bus="ide"/>
> <address type="drive" controller="0" bus="0" target="0" unit="0"/>
> </disk>
> <disk type="file" device="disk">
> <source file="/dev/default-pool/testvol2-clone.img"/>
> + <backingStore/>
> <target dev="hdb" bus="ide"/>
> <address type="drive" controller="0" bus="0" target="0" unit="1"/>
> </disk>
> diff --git a/tests/cli-test-xml/compare/virt-clone-clone-auto2.xml b/tests/cli-test-xml/compare/virt-clone-clone-auto2.xml
> index fb78434..bbbde76 100644
> --- a/tests/cli-test-xml/compare/virt-clone-clone-auto2.xml
> +++ b/tests/cli-test-xml/compare/virt-clone-clone-auto2.xml
> @@ -22,6 +22,7 @@
> <disk type="file" device="disk">
> <driver type="qcow2"/>
> <source file="/dev/default-pool/newvm.img"/>
> + <backingStore/>
> <target dev="hda" bus="ide"/>
> <address type="drive" controller="0" bus="0" target="0" unit="0"/>
> </disk>
>
Hmm, what is actually going on here? I know latest libvirt added backingStore
chain XML to the domain XML, but what does a bare <backingStore/> mean here?
Anyone on the libvirt side know if this is intentional?
- Cole
11 years, 2 months
[libvirt] [PATCH V2 0/3] support flags in libxlDomain{Shutdown, Reboot}
by Jim Fehlig
This small series is a V2 of
https://www.redhat.com/archives/libvir-list/2014-April/msg00837.html
Patch 1 adds VIR_DOMAIN_SHUTDOWN_PARAVIRT and
VIR_REBOOT_SHUTDOWN_PARAVIRT flags to the API as requested by danpb.
Patch 2 makes use of the shutdown flags in libxlDomainShutdownFlags.
Patch 3 does the same for libxlDomainReboot.
Jim Fehlig (3):
Introduce a new flag for controlling shutdown/reboot
libxl: support PARAVIRT and ACPI shutdown flags
libxl: support PARAVIRT and ACPI reboot flags
include/libvirt/libvirt.h.in | 2 ++
src/libxl/libxl_driver.c | 64 +++++++++++++++++++++++++++++++++++---------
tools/virsh-domain.c | 14 +++++++---
tools/virsh.pod | 8 +++---
4 files changed, 68 insertions(+), 20 deletions(-)
--
1.8.1.4
11 years, 2 months
[libvirt] [PATCH 0/2] virstoragefile cleanups
by Eric Blake
I found these cleanups while trying to solve the regression
that John identified, where we are losing the correct
capacity read from a qcow2 header when it comes time to
dump a volume's xml. I still plan to get that regression
fixed before 1.2.4 goes out the door, but this was worth
posting in the meantime.
Eric Blake (2):
conf: avoid null deref during storage probe
conf: drop extra storage probe
src/libvirt_private.syms | 1 -
src/storage/storage_backend_fs.c | 8 --------
src/storage/storage_backend_gluster.c | 5 -----
src/util/virstoragefile.c | 37 ++++++++++++++++-------------------
src/util/virstoragefile.h | 7 ++-----
5 files changed, 19 insertions(+), 39 deletions(-)
--
1.9.0
11 years, 2 months
[libvirt] [PATCH] bhyve: report cpuTime in bhyveDomainGetInfo
by Roman Bogorodskiy
Add a helper function virBhyveGetDomainTotalCpuStats() to
obtain process CPU time using kvm (kernel memory interface)
and use it to set cpuTime field of the virDomainInfo struct in
bhyveDomainGetInfo().
---
configure.ac | 7 +++++++
src/bhyve/bhyve_driver.c | 9 +++++++++
src/bhyve/bhyve_process.c | 40 ++++++++++++++++++++++++++++++++++++++++
src/bhyve/bhyve_process.h | 3 +++
4 files changed, 59 insertions(+)
diff --git a/configure.ac b/configure.ac
index 12338d4..2e5fa1a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2684,6 +2684,13 @@ AC_CHECK_DECLS([cpuset_getaffinity],
#include <sys/cpuset.h>
])
+# Check for BSD kvm (kernel memory interface)
+if test $with_freebsd = yes; then
+ AC_CHECK_LIB([kvm], [kvm_getprocs], [],
+ [AC_MSG_ERROR([BSD kernel memory interface library is required to build on FreeBSD])]
+ )
+fi
+
# Check if we need to look for ifconfig
if test "$want_ifconfig" = "yes"; then
AC_PATH_PROG([IFCONFIG_PATH], [ifconfig])
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 6d681fd..0780e74 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -268,6 +268,15 @@ bhyveDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
if (virDomainGetInfoEnsureACL(domain->conn, vm->def) < 0)
goto cleanup;
+ if (virDomainObjIsActive(vm)) {
+ if (virBhyveGetDomainTotalCpuStats(vm, &(info->cpuTime)) < 0) {
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("Cannot read cputime for domain"));
+ goto cleanup;
+ }
+ } else
+ info->cpuTime = 0;
+
info->state = virDomainObjGetState(vm, NULL);
info->maxMem = vm->def->mem.max_balloon;
info->nrVirtCpu = vm->def->vcpus;
diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index a557bc5..b6f0f2c 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
@@ -22,7 +22,11 @@
#include <config.h>
#include <fcntl.h>
+#include <kvm.h>
+#include <sys/param.h>
#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <net/if_tap.h>
@@ -246,3 +250,39 @@ virBhyveProcessStop(bhyveConnPtr driver,
virCommandFree(cmd);
return ret;
}
+
+int
+virBhyveGetDomainTotalCpuStats(virDomainObjPtr vm,
+ unsigned long long *cpustats)
+{
+ struct kinfo_proc *kp;
+ kvm_t *kd;
+ char errbuf[_POSIX2_LINE_MAX];
+ int nprocs;
+ int ret = -1;
+
+ if ((kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf)) == NULL) {
+ virReportError(VIR_ERR_SYSTEM_ERROR,
+ _("Unable to get kvm descriptor: %s"),
+ errbuf);
+ return -1;
+
+ }
+
+ kp = kvm_getprocs(kd, KERN_PROC_PID, vm->pid, &nprocs);
+ if (kp == NULL || nprocs != 1) {
+ virReportError(VIR_ERR_SYSTEM_ERROR,
+ _("Unable to obtain information about pid: %d"),
+ (int)vm->pid);
+ goto cleanup;
+ }
+
+ *cpustats = kp->ki_runtime * 1000ull;
+
+ ret = 0;
+
+ cleanup:
+ kvm_close(kd);
+
+ return ret;
+}
diff --git a/src/bhyve/bhyve_process.h b/src/bhyve/bhyve_process.h
index f91504e..3049ad0 100644
--- a/src/bhyve/bhyve_process.h
+++ b/src/bhyve/bhyve_process.h
@@ -34,6 +34,9 @@ int virBhyveProcessStop(bhyveConnPtr driver,
virDomainObjPtr vm,
virDomainShutoffReason reason);
+int virBhyveGetDomainTotalCpuStats(virDomainObjPtr vm,
+ unsigned long long *cpustats);
+
typedef enum {
VIR_BHYVE_PROCESS_START_AUTODESTROY = 1 << 0,
} bhyveProcessStartFlags;
--
1.9.0
11 years, 2 months
[libvirt] [PATCH v3] storageVolCreateXMLFrom: Allow multiple accesses to origvol
by Michal Privoznik
When creating a new volume, it is possible to copy data into it from
another already existing volume (referred to as @origvol). Obviously,
the read-only access to @origvol is required, which is thread safe
(probably not performance-wise though). However, with current code
both @newvol and @origvol are marked as building for the time of
copying data from the @origvol to @newvol. The rationale behind
is to disallow some operations on both @origvol and @newvol, e.g.
vol-wipe, vol-delete, vol-download. While it makes sense to not allow
such operations on partly copied mirror, but it doesn't make sense to
disallow vol-create on the source (@origvol).
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
diff to v2:
- changed the error message if volume is in use
- reworded commit message
src/conf/storage_conf.h | 1 +
src/storage/storage_driver.c | 32 ++++++++++++++++++++++++++++++--
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index 9ad38e1..eae959c 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -64,6 +64,7 @@ struct _virStorageVolDef {
int type; /* enum virStorageVolType */
unsigned int building;
+ unsigned int in_use;
virStorageVolSource source;
virStorageSource target;
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 2cb8347..542b382 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1640,6 +1640,13 @@ storageVolDelete(virStorageVolPtr obj,
if (virStorageVolDeleteEnsureACL(obj->conn, pool->def, vol) < 0)
goto cleanup;
+ if (vol->in_use) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("volume '%s' is still in use."),
+ vol->name);
+ goto cleanup;
+ }
+
if (vol->building) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("volume '%s' is still being allocated."),
@@ -1912,8 +1919,8 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
/* Drop the pool lock during volume allocation */
pool->asyncjobs++;
- origvol->building = 1;
newvol->building = 1;
+ origvol->in_use++;
virStoragePoolObjUnlock(pool);
if (origpool) {
@@ -1929,7 +1936,7 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
virStoragePoolObjLock(origpool);
storageDriverUnlock(driver);
- origvol->building = 0;
+ origvol->in_use--;
newvol->building = 0;
allocation = newvol->target.allocation;
pool->asyncjobs--;
@@ -2076,6 +2083,13 @@ storageVolUpload(virStorageVolPtr obj,
if (virStorageVolUploadEnsureACL(obj->conn, pool->def, vol) < 0)
goto cleanup;
+ if (vol->in_use) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("volume '%s' is still in use."),
+ vol->name);
+ goto cleanup;
+ }
+
if (vol->building) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("volume '%s' is still being allocated."),
@@ -2167,6 +2181,13 @@ storageVolResize(virStorageVolPtr obj,
if (virStorageVolResizeEnsureACL(obj->conn, pool->def, vol) < 0)
goto cleanup;
+ if (vol->in_use) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("volume '%s' is still in use."),
+ vol->name);
+ goto cleanup;
+ }
+
if (vol->building) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("volume '%s' is still being allocated."),
@@ -2474,6 +2495,13 @@ storageVolWipePattern(virStorageVolPtr obj,
if (virStorageVolWipePatternEnsureACL(obj->conn, pool->def, vol) < 0)
goto cleanup;
+ if (vol->in_use) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("volume '%s' is still in use."),
+ vol->name);
+ goto cleanup;
+ }
+
if (vol->building) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("volume '%s' is still being allocated."),
--
1.9.0
11 years, 2 months
[libvirt] Some odd quriks of libvirt and xen on fedora 20.
by Alvin Starr
I am using xen 4.3 on Fedora 20.
For PV systems the vnc console display is on the correct port with the
following call do qeum-dm
libxl: debug: libxl_dm.c:1213:libxl__spawn_local_dm: -domain-name
libxl: debug: libxl_dm.c:1213:libxl__spawn_local_dm: paravirt
libxl: debug: libxl_dm.c:1213:libxl__spawn_local_dm: -vnc
libxl: debug: libxl_dm.c:1213:libxl__spawn_local_dm: 127.0.0.1:1
but for HV systems xl is being passed
libxl: debug: libxl_dm.c:1213:libxl__spawn_local_dm: -domain-name
libxl: debug: libxl_dm.c:1213:libxl__spawn_local_dm: fullvirt
libxl: debug: libxl_dm.c:1213:libxl__spawn_local_dm: -vnc
libxl: debug: libxl_dm.c:1213:libxl__spawn_local_dm: 127.0.0.1:0
libxl: debug: libxl_dm.c:1213:libxl__spawn_local_dm: -vncunused
libxl: debug: libxl_dm.c:1213:libxl__spawn_local_dm: -serial
libxl: debug: libxl_dm.c:1213:libxl__spawn_local_dm: pty
libxl: debug: libxl_dm.c:1213:libxl__spawn_local_dm: -videoram
libxl: debug: libxl_dm.c:1213:libxl__spawn_local_dm: 8
Where would I look to correct this?
--
Alvin Starr || voice: (905)513-7688
Netvel Inc. || Cell: (416)806-0133
alvin(a)netvel.net ||
11 years, 2 months
[libvirt] [PATCH] typos: fix s/it/is/ where applicable
by Martin Kletzander
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
Notes:
pushed as trivial
docs/drvesx.html.in | 4 ++--
src/esx/esx_driver.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/docs/drvesx.html.in b/docs/drvesx.html.in
index 0816baf..d1e67d0 100644
--- a/docs/drvesx.html.in
+++ b/docs/drvesx.html.in
@@ -148,7 +148,7 @@ vpx://example-vcenter.com/folder1/dc1/folder2/example-esx.com
</td>
<td>
If set to 1, this disables libcurl client checks of the server's
- SSL certificate. The default value it 0. See the
+ SSL certificate. The default value is 0. See the
<a href="#certificates">Certificates for HTTPS</a> section for
details.
</td>
@@ -164,7 +164,7 @@ vpx://example-vcenter.com/folder1/dc1/folder2/example-esx.com
If set to 1, the driver answers all
<a href="#questions">questions</a> with the default answer.
If set to 0, questions are reported as errors. The default
- value it 0. <span class="since">Since 0.7.5</span>.
+ value is 0. <span class="since">Since 0.7.5</span>.
</td>
</tr>
<tr>
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index d082927..5dd0a63 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -889,11 +889,11 @@ esxConnectToVCenter(esxPrivate *priv,
* it. If the ESX host is not managed by a vCenter an error is reported.
*
* If the no_verify parameter is set to 1, this disables libcurl client checks
- * of the server's certificate. The default value it 0.
+ * of the server's certificate. The default value is 0.
*
* If the auto_answer parameter is set to 1, the driver will respond to all
* virtual machine questions with the default answer, otherwise virtual machine
- * questions will be reported as errors. The default value it 0.
+ * questions will be reported as errors. The default value is 0.
*
* The proxy parameter allows to specify a proxy for to be used by libcurl.
* The default for the optional <type> part is http and socks is synonymous for
--
1.9.2
11 years, 2 months
[libvirt] [PATCH v2 0/2] bhyve: implement connectDomainXMLToNative
by Roman Bogorodskiy
Changes from v1:
- Return both bhyveload and bhyve commands, not only bhyve.
Roman Bogorodskiy (2):
bhyve: improve bhyve_command.c testability
bhyve: implement connectDomainXMLToNative
src/bhyve/bhyve_command.c | 85 +++++++++++++++++++++++++----------------------
src/bhyve/bhyve_command.h | 8 +++--
src/bhyve/bhyve_driver.c | 59 ++++++++++++++++++++++++++++++++
src/bhyve/bhyve_process.c | 10 +++---
tests/bhyvexml2argvtest.c | 2 +-
5 files changed, 117 insertions(+), 47 deletions(-)
--
1.9.0
11 years, 2 months
[libvirt] [PATCH] Fix vlan ID detection in udev interface driver
by Ján Tomko
Instead of guessing it from the interface name, look into
/proc/net/vlan/<interface>.
This works for devices not named <real_device>.<vlan ID>,
avoiding an error flood when virt-manager keeps asking about
them every second:
https://bugzilla.redhat.com/show_bug.cgi?id=966329
---
src/interface/interface_backend_udev.c | 67 ++++++++++++++++++++++++++--------
1 file changed, 51 insertions(+), 16 deletions(-)
diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
index b05ac0e..bec8c45 100644
--- a/src/interface/interface_backend_udev.c
+++ b/src/interface/interface_backend_udev.c
@@ -20,11 +20,13 @@
*/
#include <config.h>
+#include <ctype.h>
#include <errno.h>
#include <dirent.h>
#include <libudev.h>
#include "virerror.h"
+#include "virfile.h"
#include "c-ctype.h"
#include "datatypes.h"
#include "domain_conf.h"
@@ -966,31 +968,64 @@ udevGetIfaceDefVlan(struct udev *udev ATTRIBUTE_UNUSED,
const char *name,
virInterfaceDef *ifacedef)
{
- const char *vid;
+ char *procpath = NULL;
+ char *buf = NULL;
+ char *vid_pos, *dev_pos;
+ size_t vid_len, dev_len;
+ const char *vid_prefix = "VID: ";
+ const char *dev_prefix = "\nDevice: ";
+ int ret = -1;
+
+ if (virAsprintf(&procpath, "/proc/net/vlan/%s", name) < 0)
+ goto cleanup;
+
+ if (virFileReadAll(procpath, BUFSIZ, &buf) < 0)
+ goto cleanup;
- /* Find the DEVICE.VID again */
- vid = strrchr(name, '.');
- if (!vid) {
+ if ((vid_pos = strstr(buf, vid_prefix)) == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("failed to find the VID for the VLAN device '%s'"),
name);
- return -1;
+ goto cleanup;
}
+ vid_pos += strlen(vid_prefix);
- /* Set the VLAN specifics */
- if (VIR_STRDUP(ifacedef->data.vlan.tag, vid + 1) < 0)
- goto error;
- if (VIR_STRNDUP(ifacedef->data.vlan.devname,
- name, (vid - name)) < 0)
- goto error;
+ if ((vid_len = strspn(vid_pos, "0123456789")) == 0 ||
+ !isspace(vid_pos[vid_len])) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("failed to find the VID for the VLAN device '%s'"),
+ name);
+ goto cleanup;
+ }
- return 0;
+ if ((dev_pos = strstr(vid_pos + vid_len, dev_prefix)) == NULL) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("failed to find the real device for the VLAN device '%s'"),
+ name);
+ goto cleanup;
+ }
+ dev_pos += strlen(dev_prefix);
- error:
- VIR_FREE(ifacedef->data.vlan.tag);
- VIR_FREE(ifacedef->data.vlan.devname);
+ if ((dev_len = strcspn(dev_pos, "\n")) == 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("failed to find the real device for the VLAN device '%s'"),
+ name);
+ goto cleanup;
+ }
- return -1;
+ if (VIR_STRNDUP(ifacedef->data.vlan.tag, vid_pos, vid_len) < 0)
+ goto cleanup;
+ if (VIR_STRNDUP(ifacedef->data.vlan.devname, dev_pos, dev_len) < 0) {
+ VIR_FREE(ifacedef->data.vlan.tag);
+ goto cleanup;
+ }
+
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(procpath);
+ VIR_FREE(buf);
+ return ret;
}
static virInterfaceDef * ATTRIBUTE_NONNULL(1)
--
1.8.3.2
11 years, 2 months
[libvirt] [PATCH] Bump version to 1.2.5 for new dev cycle
by John Ferlan
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Pushed already just sending note.
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 12338d4..fef99af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,7 @@ dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library. If not, see
dnl <http://www.gnu.org/licenses/>.
-AC_INIT([libvirt], [1.2.4], [libvir-list(a)redhat.com], [], [http://libvirt.org])
+AC_INIT([libvirt], [1.2.5], [libvir-list(a)redhat.com], [], [http://libvirt.org])
AC_CONFIG_SRCDIR([src/libvirt.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h])
--
1.9.0
11 years, 2 months