[libvirt] [PATCH v2 0/4] net: support set source address(es) and ports for NAT
by Natanael Copa
This is a rework of the previous sent 'set public ip for nat' patches [1].
Changes v2:
- Use separate attributes for addresses and ports as suggested by Laine.
- support set port range without setting public ip
[1] http://www.redhat.com/archives/libvir-list/2012-December/msg00140.html
Natanael Copa (4):
util: refactor iptables command construction into multiple steps
net: support set public ip for forward mode nat
net: support a public address range for forward mode nat
net: add support for specifying port range for forward mode nat
docs/formatnetwork.html.in | 37 ++++++++
src/conf/network_conf.c | 206 ++++++++++++++++++++++++++++++++++++++++++--
src/conf/network_conf.h | 4 +
src/network/bridge_driver.c | 32 +++++++
src/util/viriptables.c | 195 +++++++++++++++++++++++++----------------
src/util/viriptables.h | 8 ++
6 files changed, 402 insertions(+), 80 deletions(-)
--
1.8.1.2
11 years, 10 months
[libvirt] [PATCH 0/2] virsh: Two small fixes for "snapshot-create-as"
by Peter Krempa
Peter Krempa (2):
virsh-snapshot: Refactor some details in virsh snapshot-create-as
virsh-snapshot: Reject --no-metadata together with --print-xml
tools/virsh-snapshot.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
--
1.8.1.1
11 years, 10 months
[libvirt] libvirt and Parallels Cloud Storage
by Alexander Gordeev
Hi!
I'd like to develop libvirt integration with Parallels Cloud
Storage (Pstorage) which is a new distributed file system from
Parallels designed specifically for storing VM images:
http://www.parallels.com/products/pcs/cloud-storage/
It's not a POSIX FS but there is a FUSE client for it that can be
used to access and manipulate images. It's quite high speed but only
when used with O_DIRECT + aio. I tried to setup several KVMs on top of
a Pstorage mount using virt-manager. It worked good, but I had to:
1. tune cache and IO settings for every disk
2. disable space allocation by libvirt because it is using sync IO and
is therefore slow
I tried to find ways to solve the first issue and IMHO this can be
done by adding a way to specify per-pool defaults for cache and IO
settings. I didn't find any way for this in the current code and UI.
I'd like to add a new storage backend also that will be a 'dir' backend
with extra ability to manage Pstorage mount points and UI integration.
I'd like to merge my work to the main tree when it's finished if
possible.
What do you think about my plan? Can you please suggest me how to add
per-pool defaults the best way?
--
Alexander
11 years, 10 months
[libvirt] [PATCH] qemu: Fix potential crash when attaching/detaching cdrom or floppy
by Osier Yang
The crash could happen if the disk source is empty for cdrom or
floppy disk.
---
src/qemu/qemu_driver.c | 7 +++++--
src/qemu/qemu_process.c | 3 +++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 812bf95..906501b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5884,7 +5884,9 @@ qemuDomainAttachDeviceDiskLive(virConnectPtr conn,
}
if (ret == 0) {
- if (disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK && disk->shared) {
+ if (disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK &&
+ disk->shared &&
+ disk->src) {
if (qemuAddSharedDisk(driver->sharedDisks, disk->src) < 0)
VIR_WARN("Failed to add disk '%s' to shared disk table",
disk->src);
@@ -6011,7 +6013,8 @@ qemuDomainDetachDeviceDiskLive(virQEMUDriverPtr driver,
if (ret == 0 &&
disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK &&
- disk->shared) {
+ disk->shared &&
+ disk->src) {
if (qemuRemoveSharedDisk(driver->sharedDisks, disk->src) < 0)
VIR_WARN("Failed to remove disk '%s' from shared disk table",
disk->src);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index d1872c0..98ed552 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3458,6 +3458,9 @@ qemuCheckSharedDisk(virHashTablePtr sharedDisks,
char *key = NULL;
int ret = 0;
+ if (!disk->src)
+ return 0;
+
if (!(key = qemuGetSharedDiskKey(disk->src)))
return -1;
--
1.7.7.6
11 years, 10 months
[libvirt] Adding new standalone API
by Bilal Ahmad
Hi all,
I am learning to hack libvirt and so far for basic things, I am able to get
things done. For the advanced things like adding a completely new API, I
will need some help from you people. For starters, I have decided to add a
custom network API with only "name" and "UUID" and get my custom network
API to work. I would really appreciate if you could guide me. I have gone
through the “*Implementing a new API in Libvirt*” but its an example which
introduces new APIs to an existing API type. To learn better, I plan to
implement my own standalone sample API and get it to work.
I would really appreciate help from this open-source community.
Thanks,
Bilal
11 years, 10 months
[libvirt] [PATCH 1/5] Public API to allow defining new domain using OVA file
by Ata E Husain Bohra
Appends a new API to libvirt public driver that supports
defining a new domain using OVA format.
API expects following inputs:
1. connection pointer.
2. path to OVA package (single file format).
3. Storage pool name where new domain needs to be created.
API returns pointers to newly created domain that is not powered ON.
Libvirt driver sanitizes the inputs and calls hypervisor specific
driver callbacks to abstract OVA install implementation.
---
include/libvirt/libvirt.h.in | 3 +++
src/driver.h | 5 ++++
src/libvirt.c | 58 ++++++++++++++++++++++++++++++++++++++++++
src/libvirt_public.syms | 5 ++++
4 files changed, 71 insertions(+)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 09c89c5..ea342bc 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1919,6 +1919,9 @@ int virDomainMemoryPeek (virDomainPtr dom,
*/
virDomainPtr virDomainDefineXML (virConnectPtr conn,
const char *xml);
+virDomainPtr virDomainDefineOVA (virConnectPtr conn,
+ const char *ovapath,
+ const char *poolname);
int virDomainUndefine (virDomainPtr domain);
typedef enum {
diff --git a/src/driver.h b/src/driver.h
index 01c95cf..08382a0 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -274,6 +274,10 @@ typedef int
typedef virDomainPtr
(*virDrvDomainDefineXML) (virConnectPtr conn,
const char *xml);
+typedef virDomainPtr
+ (*virDrvDomainDefineOVA) (virConnectPtr conn,
+ const char *ovapath,
+ const char *poolname);
typedef int
(*virDrvDomainUndefine) (virDomainPtr dom);
typedef int
@@ -1008,6 +1012,7 @@ struct _virDriver {
virDrvDomainCreate domainCreate;
virDrvDomainCreateWithFlags domainCreateWithFlags;
virDrvDomainDefineXML domainDefineXML;
+ virDrvDomainDefineOVA domainDefineOVA;
virDrvDomainUndefine domainUndefine;
virDrvDomainUndefineFlags domainUndefineFlags;
virDrvDomainAttachDevice domainAttachDevice;
diff --git a/src/libvirt.c b/src/libvirt.c
index 6d1da12..bdc21b4 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -1988,6 +1988,8 @@ error:
return NULL;
}
+
+
/**
* virDomainCreateLinux:
* @conn: pointer to the hypervisor connection
@@ -8334,6 +8336,62 @@ error:
}
/**
+ * virDomainDefineOVA:
+ * @conn: pointer to the hypervisor connection
+ * @ovapath: OVA file path
+ * @poolname: storage pool where domain needs to be created
+ *
+ * OVA stands for Open Virtualuzation Archive and consist of
+ * three important components:
+ * 1. XML descriptor: defines the virtual machine hardware description,
+ * network connectivity etc.
+ * 2. Virtual disk (may be compressed or optimized).
+ * 3. Manifest file.
+ *
+ * Define a new domain but does not start it.
+ * This function may require privileged access to the hypervisor.
+ *
+ * Returns a new domain object or NULL in case of failure
+ */
+virDomainPtr
+virDomainDefineOVA(virConnectPtr conn, const char *ovapath,
+ const char *poolname)
+{
+ VIR_DEBUG("conn=%p, ovaPath=%s, poolname=%s",
+ conn, ovapath, poolname);
+
+ virResetLastError();
+
+ if (!VIR_IS_CONNECT(conn)) {
+ virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virDispatchError(NULL);
+ return NULL;
+ }
+ if (conn->flags & VIR_CONNECT_RO) {
+ virLibConnError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+ goto error;
+ }
+ virCheckNonNullArgGoto(ovapath, error);
+ virCheckNonNullArgGoto(poolname, error);
+
+ if (conn->driver->domainDefineOVA) {
+ virDomainPtr ret;
+ ret = conn->driver->domainDefineOVA(
+ conn, ovapath, poolname);
+ if (!ret)
+ goto error;
+ return ret;
+ }
+
+ virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+ virDispatchError(conn);
+ return NULL;
+
+}
+
+/**
* virDomainCreate:
* @domain: pointer to a defined domain
*
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index 2107519..1af48c9 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -585,4 +585,9 @@ LIBVIRT_1.0.2 {
virDomainOpenChannel;
} LIBVIRT_1.0.1;
+LIBVIRT_1.0.3 {
+ global:
+ virDomainDefineOVA;
+} LIBVIRT_1.0.2;
+
# .... define new API here using predicted next version number ....
--
1.7.9.5
11 years, 10 months
[libvirt] Environment variable CLASSPATH not set!
by harryxiyou
Hi all,
We are developing a hdfs-based File system, which is HLFS(
http://code.google.com/p/cloudxy/wiki/WHAT_IS_CLOUDXY). Now, we
have developed HLFS driver for Libvirt.You can find our patch for
Libvirt network disk
(Online storage) here
http://cloudxy.googlecode.com/svn/branches/hlfs/person/harry/hlfs/patches...
But when i boot a VM from a base linux OS, which the OS have been
installed into our
HLFS block device at first. However, it(HDFS or JVM) says i have not set the
CLASSPATH like following.
[...]
uri:hdfs:///tmp/testenv/testfs,head:hdfs,dir:/tmp/testenv,fsname:testfs,hostname:default,port:0,user:kanghua
Environment variable CLASSPATH not set!
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
fs is null, hdfsConnect error!
[...]
Actually, i have set CLASSPATH in ~/.bashrc like following. I have
installed CDH3u2
for developing. I can do other hdfs jobs successfully.
$ cat /home/jiawei/.bashrc
[...]
export HLFS_HOME=/home/jiawei/workshop3/hlfs
export LOG_HOME=$HLFS_HOME/3part/log
export SNAPPY_HOME=$HLFS_HOME/3part/snappy
export HADOOP_HOME=$HLFS_HOME/3part/hadoop
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export PATH=/usr/bin/:/usr/local/bin/:/bin/:/usr/sbin/:/sbin/:$JAVA_HOME/bin/
#export LD_LIBRARY_PATH=$JAVAHOME/lib
export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/i386/server/:$HADOOP_HOME/lib32/:$LOG_HOME/lib32/:$SNAPPY_HOME/lib32/:$HLFS_HOME/output/lib32/:/usr/lib/
export PKG_CONFIG_PATH=/usr/lib/pkgconfig/:/usr/share/pkgconfig/
export CFLAGS="-L/usr/lib -L/lib -L/usr/lib64"
export CXXFLAGS="-L/usr/lib -L/lib"
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/htmlconverter.jar:$JAVA_HOME/lib/jconsole.jar:$JAVA_HOME/lib/jconsole.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/charsets.jar:$JAVA_HOME/jre/lib/deploy.jar:$JAVA_HOME/jre/lib/javaws.jar:$JAVA_HOME/jre/lib/jce.jar:$JAVA_HOME/jre/lib/jsse.jar:$JAVA_HOME/jre/lib/management-agent.jar:$JAVA_HOME/jre/lib/plugin.jar:$JAVA_HOME/jre/lib/resources.jar:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/jre/lib/:$JAVA_HOME/lib/:/usr/lib/hadoop-0.20/conf:/usr/lib/jvm/java-6-sun/lib/tools.jar:/usr/lib/hadoop-0.20:/usr/lib/hadoop-0.20/hadoop-core-0.20.2-cdh3u2.jar:/usr/lib/hadoop-0.20/lib/ant-contrib-1.0b3.jar:/usr/lib/hadoop-0.20/lib/aspectjrt-1.6.5.jar:/usr/lib/hadoop-0.20/lib/aspectjtools-1.6.5.jar:/usr/lib/hadoop-0.20/lib/commons-cli-1.2.jar:/usr/lib/hadoop-0.20/lib/commons-codec-1.4.jar:/usr/lib/hadoop-0.20/lib/commons-daemon-1.0.1.jar:/usr/lib/hadoop-0.20/lib/commons-el-1.0.jar:/usr/lib/hadoop-0.20/lib/commons-httpclient-3.1.jar:/usr/lib/hadoop-0.20/lib/commons-logging-1.0.4.jar:/usr/lib/hadoop-0.20/lib/commons-logging-api-1.0.4.jar:/usr/lib/hadoop-0.20/lib/commons-net-1.4.1.jar:/usr/lib/hadoop-0.20/lib/core-3.1.1.jar:/usr/lib/hadoop-0.20/lib/hadoop-fairscheduler-0.20.2-cdh3u2.jar:/usr/lib/hadoop-0.20/lib/hsqldb-1.8.0.10.jar:/usr/lib/hadoop-0.20/lib/jackson-core-asl-1.5.2.jar:/usr/lib/hadoop-0.20/lib/jackson-mapper-asl-1.5.2.jar:/usr/lib/hadoop-0.20/lib/jasper-compiler-5.5.12.jar:/usr/lib/hadoop-0.20/lib/jasper-runtime-5.5.12.jar:/usr/lib/hadoop-0.20/lib/jets3t-0.6.1.jar:/usr/lib/hadoop-0.20/lib/jetty-6.1.26.cloudera.1.jar:/usr/lib/hadoop-0.20/lib/jetty-servlet-tester-6.1.26.cloudera.1.jar:/usr/lib/hadoop-0.20/lib/jetty-util-6.1.26.cloudera.1.jar:/usr/lib/hadoop-0.20/lib/jsch-0.1.42.jar:/usr/lib/hadoop-0.20/lib/junit-4.5.jar:/usr/lib/hadoop-0.20/lib/kfs-0.2.2.jar:/usr/lib/hadoop-0.20/lib/log4j-1.2.15.jar:/usr/lib/hadoop-0.20/lib/mockito-all-1.8.2.jar:/usr/lib/hadoop-0.20/lib/oro-2.0.8.jar:/usr/lib/hadoop-0.20/lib/servlet-api-2.5-20081211.jar:/usr/lib/hadoop-0.20/lib/servlet-api-2.5-6.1.14.jar:/usr/lib/hadoop-0.20/lib/slf4j-api-1.4.3.jar:/usr/lib/hadoop-0.20/lib/slf4j-log4j12-1.4.3.jar:/usr/lib/hadoop-0.20/lib/xmlenc-0.52.jar:/usr/lib/hadoop-0.20/lib/jsp-2.1/jsp-2.1.jar:/usr/lib/hadoop-0.20/lib/jsp-2.1/jsp-api-2.1.jar
I have reproted this matter as an issue to handle, which you can see
http://code.google.com/p/cloudxy/issues/detail?id=37 for details.
I have seen libvirt source codes for this problem, i find it may lead to
by following problems.
1, Some changes made by gnulib, which i find gnulib has some files and
funcs have done some jobs for CLASSPATH like csharpexec.c, javacomp.c,
javaexec.c, etc.
2, After i compile libvirt source codes, i get virsh script, which has a
variable named 'relink_command' that has been set some libraries and
paths permanently.
3, Maybe some other reasons.
Could anyone give me some suggestions? How could i solve this problem?
Thanks a lot in advance ;-)
--
Thanks
Harry Wei
11 years, 10 months
[libvirt] [PATCH 0/4] fix yet another regression due to my backingChain rewrite
by Eric Blake
https://bugzilla.redhat.com/show_bug.cgi?id=903248 details a
regression that I caused, which is tickled by the odd way
in which VDSM uses (abuses?) symlinks to qcow2 files with
relative backing file names. The first two patches are quite
trivial; the third a bit longer but still straightforward;
and the meat of the series is the fourth patch.
Meanwhile, I know of at least one other regression that I still
need to fix in the same area of code:
https://bugzilla.redhat.com/show_bug.cgi?id=896685 is caused
when cgroups are not present (such as in qemu:///session); I
hope to patch that one tomorrow.
Eric Blake (4):
storage: factor out large integer reads
storage: rearrange functions
storage: refactor metadata lookup
storage: don't follow backing chain symlinks too eagerly
src/util/virstoragefile.c | 475 +++++++++++++++++++++++-----------------------
src/util/virstoragefile.h | 1 +
2 files changed, 240 insertions(+), 236 deletions(-)
--
1.8.1
11 years, 10 months