[libvirt] Block replication driver
by Simon Kollberg
Hi!
I'm working on supporting a new FT/HA solution for qemu called COLO
(http://wiki.qemu.org/Features/COLO). The part that is currently being
focused
on for libvirt integration is Block Replication
(http://wiki.qemu.org/Features/BlockReplication) which enables guest state
synchronization for disks.
Right now there are three issues that I'd like to get your input on:
1.
As you can see on the block replication wiki-page we need to reference the
secondary disk id.
Example from the wiki:
-drive if=none,driver=raw,file.filename=1.raw,id=colo1 \
-drive if=xxx,driver=replication,mode=secondary,\
...
file.backing.backing=colo1
My initial thought was to manually set the alias of the
disk and add a new reference element to the backingStore:
<disk type='file' device='disk'>
...
<alias name='colo1'/>
</disk>
<disk type='file' device='disk'>
...
<backingStore type='file'>
...
<reference name='colo1'/>
</backingStore>
</disk>
Though, I quickly realized that setting the alias is only done by the
hypervisor and is therefore not an option with the current code.
Would it be bad letting the user set the alias, and if so, do you have any
ideas of how to solve the referencing?
2.
The format of the disk and the driver type currently shares the same
attribute in libvirt (the type attribute on driver XML element). However,
with
the new replication disk driver you need to be able to set both the disk
format
and also the driver name.
Example from the wiki:
-drive if=xxx,driver=replication,mode=secondary,\
file.file.filename=active_disk.qcow2,\
file.driver=qcow2,\
...
I saw that there was a function in libvirt called virStorageFileProbeFormat
that could let us get the format of the disk without stating it in the XML.
But
as I'm sure you know, it's strongly advised not to be used since you can
trick
the function by modifying the disk file.
3.
When using the replication driver the secondary disk is supposed to be added
but not attached.
Example from the wiki:
-drive if=none,driver=raw,file.filename=1.raw,id=colo1 \
-drive if=xxx,driver=replication,mode=secondary,\
...
Clearly, trying to setup a disk without a target is not allowed at the
moment.
Is there any better way of doing it?
Any comments and insights in general are also greatly appreciated!
/Simon
8 years, 8 months
[libvirt] [PATCH lxc_ethernet] lxc:support network type with ethernet
by zhongguocheng1@163.com
From: z00209963 <z00209963(a)szxbz472.huaweiobz.com>
---
src/lxc/lxc_process.c | 35 +++++++++++++++++++++++++++++++++++
src/lxc/lxc_process.h | 3 +++
2 files changed, 38 insertions(+)
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 57e3880..1ffd9ac 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -359,6 +359,38 @@ char *virLXCProcessSetupInterfaceDirect(virConnectPtr conn,
return ret;
}
+char *virLXCProcessSetupInterfaceEthernet(virDomainDefPtr vm,
+ virDomainNetDefPtr net)
+{
+ char *ret = NULL;
+ char *parentVeth;
+ char *containerVeth = NULL;
+
+ VIR_DEBUG("calling vethCreate()");
+ parentVeth = net->ifname;
+ if (virNetDevVethCreate(&parentVeth, &containerVeth) < 0)
+ goto cleanup;
+ VIR_DEBUG("parentVeth: %s, containerVeth: %s", parentVeth, containerVeth);
+
+ if (net->ifname == NULL)
+ net->ifname = parentVeth;
+
+ if (virNetDevSetMAC(containerVeth, &net->mac) < 0)
+ goto cleanup;
+
+ if (virNetDevSetOnline(parentVeth, true) < 0)
+ goto cleanup;
+
+ if (net->filter &&
+ virDomainConfNWFilterInstantiate(vm->uuid, net) < 0)
+ goto cleanup;
+
+ ret = containerVeth;
+
+ cleanup:
+ return ret;
+}
+
static const char *nsInfoLocal[VIR_LXC_DOMAIN_NAMESPACE_LAST] = {
[VIR_LXC_DOMAIN_NAMESPACE_SHARENET] = "net",
[VIR_LXC_DOMAIN_NAMESPACE_SHAREIPC] = "ipc",
@@ -559,6 +591,9 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn,
break;
case VIR_DOMAIN_NET_TYPE_ETHERNET:
+ if (!(veth = virLXCProcessSetupInterfaceEthernet(def,
+ net)))
+ goto cleanup;
break;
case VIR_DOMAIN_NET_TYPE_USER:
diff --git a/src/lxc/lxc_process.h b/src/lxc/lxc_process.h
index b6c8083..cc8e707 100644
--- a/src/lxc/lxc_process.h
+++ b/src/lxc/lxc_process.h
@@ -53,5 +53,8 @@ char *virLXCProcessSetupInterfaceBridged(virDomainDefPtr vm,
char *virLXCProcessSetupInterfaceDirect(virConnectPtr conn,
virDomainDefPtr def,
virDomainNetDefPtr net);
+char *virLXCProcessSetupInterfaceEthernet(virDomainDefPtr vm,
+ virDomainNetDefPtr net);
+
#endif /* __LXC_PROCESS_H__ */
--
2.5.1.windows.1
8 years, 8 months
[libvirt] Libvirt bite sized tasks
by Michal Privoznik
Dear lists,
I've just started new wiki page which aim is to summarize small and
trivial tasks, that starting contributors can take, investigate and
implement. The aim is to give them something easy to start with while
not scaring them out about complexity of our code. The page can be found
here:
http://wiki.libvirt.org/page/BiteSizedTasks
The name is copied from qemu wiki:
http://wiki.qemu.org/BiteSizedTasks
Please, feel free to extend the list. I plan to use it in the future
when interviewing GSoC candidates.
Michal
8 years, 8 months
[libvirt] [libvirt-glib v2 0/9] gconfig: Add hostdev support
by Christophe Fergeau
Hey,
While reviewing Zeeshan's libvirt-gconfig hostdev series, I fixed up a few
things, and added a few additional helpers/getters in order to simplify the
code/make the test case more complete.
This series contains this new code. The changes I made to Zeeshan's initial
patches are in separate fixup! commits to make reviewing them easier (for you Zeeshan ;).
I expect these to be squashed in the main commits before being pushed.
Zeeshan's commits are unchanged from v1.
Christophe
8 years, 8 months
[libvirt] [PATCH 0/2] RFC: qemu: aarch64 virtio-pci work
by Cole Robinson
These patches apply on top of the series I just posted:
[PATCH 0/9] tests: qemu: unconditionally enable QEMU_CAPS_DEVICE
https://www.redhat.com/archives/libvir-list/2016-January/msg01233.html
These specific changers were discussed here:
https://www.redhat.com/archives/libvir-list/2015-December/msg00217.html
We need a way for apps to tell libvirt 'use virtio-pci not virtio-mmio'
for aarch64 -M virt. We can't really make use this by default yet since
most OS don't actually support it. So we decided the best course of
interaction is to allow users to pass a manual pci controller, and libvirt
will interpret that to mean it's okay to use virtio-pci.
Patch #1 undoes the current behavior of unconditionally adding a q35 style
PCIe controller setup for mach-virt that supports it. In the future we
will probably re-enable something like this, but maybe not for a year or
so until the bits proliferate to distros.
Patch #2 tries to implement the manual pci controller bit. Unfortunately
it's not that easy get the ideal XML to work, so this isn't ready for
committing. See the commit message for more details
Cole Robinson (2):
qemu: aarch64: Don't add PCIe controller by default
HACK: qemu: aarch64: Use virtio-pci if user specifies PCI controller
src/qemu/qemu_command.c | 34 ++++++++----
src/qemu/qemu_domain.c | 4 --
...l2argv-aarch64-pci-manual-nocontroller-fail.xml | 43 ++++++++++++++++
.../qemuxml2argv-aarch64-virtio-pci-default.args | 2 -
...l2argv-aarch64-virtio-pci-manual-addresses.args | 2 -
...ml2argv-aarch64-virtio-pci-manual-addresses.xml | 1 +
...2argv-aarch64-virtio-pci-manual-controller.args | 36 +++++++++++++
...l2argv-aarch64-virtio-pci-manual-controller.xml | 50 ++++++++++++++++++
tests/qemuxml2argvtest.c | 22 ++++++--
.../qemuxml2xmlout-aarch64-virtio-pci-default.xml | 10 ----
...2xmlout-aarch64-virtio-pci-manual-addresses.xml | 11 +---
...xmlout-aarch64-virtio-pci-manual-controller.xml | 60 ++++++++++++++++++++++
tests/qemuxml2xmltest.c | 6 +++
13 files changed, 239 insertions(+), 42 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-pci-manual-nocontroller-fail.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-controller.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-controller.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-controller.xml
--
2.5.0
8 years, 8 months
[libvirt] [PATCH] ruby-libvirt: Don't crash in leases_wrap() by passing NULLs to rb_str_new2()
by Dan Williams
Not all lease values are mandatory, and when they aren't supplied
by the libvirt driver they get set to NULL. That makes
rb_str_new2() bail out.
Signed-off-by: Dan Williams <dcbw(a)redhat.com>
---
For example using the qemu driver we don't get 'iaid', and that
makes ruby unhappy:
[{"iface"=>"virbr1", "expirytime"=>1452189569, "type"=>0, "mac"=>"52:54:00:05:2b:6f",
"ipaddr"=>"192.168.121.49", "prefix"=>24, "hostname"=>"openshiftdev",
"clientid"=>"ff:00:05:2b:6f:00:01:00:01:1e:21:55:ed:52:54:00:05:2b:6f"}]
ext/libvirt/network.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/ext/libvirt/network.c b/ext/libvirt/network.c
index 7c77d73..c250d7d 100644
--- a/ext/libvirt/network.c
+++ b/ext/libvirt/network.c
@@ -269,14 +269,20 @@ static VALUE leases_wrap(VALUE arg)
rb_hash_aset(hash, rb_str_new2("expirytime"),
LL2NUM(lease->expirytime));
rb_hash_aset(hash, rb_str_new2("type"), INT2NUM(lease->type));
- rb_hash_aset(hash, rb_str_new2("mac"), rb_str_new2(lease->mac));
- rb_hash_aset(hash, rb_str_new2("iaid"), rb_str_new2(lease->iaid));
+ if (lease->mac)
+ rb_hash_aset(hash, rb_str_new2("mac"), rb_str_new2(lease->mac));
+ if (lease->iaid)
+ rb_hash_aset(hash, rb_str_new2("iaid"), rb_str_new2(lease->iaid));
rb_hash_aset(hash, rb_str_new2("ipaddr"), rb_str_new2(lease->ipaddr));
rb_hash_aset(hash, rb_str_new2("prefix"), UINT2NUM(lease->prefix));
- rb_hash_aset(hash, rb_str_new2("hostname"),
- rb_str_new2(lease->hostname));
- rb_hash_aset(hash, rb_str_new2("clientid"),
- rb_str_new2(lease->clientid));
+ if (lease->hostname) {
+ rb_hash_aset(hash, rb_str_new2("hostname"),
+ rb_str_new2(lease->hostname));
+ }
+ if (lease->clientid) {
+ rb_hash_aset(hash, rb_str_new2("clientid"),
+ rb_str_new2(lease->clientid));
+ }
rb_ary_store(result, i, hash);
}
--
2.4.3
8 years, 8 months
[libvirt] [FOR 1.3.0 PATCH] conf: add net device prefix for Xen
by Jim Fehlig
In commit d2e5538b1, the libxl driver was changed to copy interface
names autogenerated by libxl to the corresponding network def in the
domain's virDomainDef object. The copied name is freed when the domain
transitions to the shutoff state. But when migrating a domain, the
autogenerated name is included in the XML sent to the destination host.
It is possible an interface with the same name already exists on the
destination host, causing migration to fail. Indeed the Xen project's
OSSTEST CI already encountered such a failure.
This patch defines another VIR_NET_GENERATED_PREFIX for Xen, allowing
the autogenerated names to be excluded when parsing and formatting
inactive config.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
This is an alternative approach to Joao's fix for this regression
https://www.redhat.com/archives/libvir-list/2015-December/msg00197.html
I think it is the same approach used by the qemu driver. My only
reservation is that it expands the potential for clashes with
user-defined names. I.e. with this change both 'vnet' and 'vif' are
reserved prefixes.
src/conf/domain_conf.c | 6 ++++--
src/conf/domain_conf.h | 4 ++++
src/libxl/libxl_domain.c | 5 +++--
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2f5c0ed..debcf4e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8428,7 +8428,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
ifname = virXMLPropString(cur, "dev");
if (ifname &&
(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
- STRPREFIX(ifname, VIR_NET_GENERATED_PREFIX)) {
+ (STRPREFIX(ifname, VIR_NET_GENERATED_PREFIX) ||
+ STRPREFIX(ifname, VIR_NET_GENERATED_PREFIX_XEN))) {
/* An auto-generated target name, blank it out */
VIR_FREE(ifname);
}
@@ -19790,7 +19791,8 @@ virDomainNetDefFormat(virBufferPtr buf,
virBufferEscapeString(buf, "<backenddomain name='%s'/>\n", def->domain_name);
if (def->ifname &&
!((flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) &&
- (STRPREFIX(def->ifname, VIR_NET_GENERATED_PREFIX)))) {
+ (STRPREFIX(def->ifname, VIR_NET_GENERATED_PREFIX) ||
+ STRPREFIX(def->ifname, VIR_NET_GENERATED_PREFIX_XEN)))) {
/* Skip auto-generated target names for inactive config. */
virBufferEscapeString(buf, "<target dev='%s'/>\n", def->ifname);
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 90d8e13..d2cc26f 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1085,6 +1085,10 @@ struct _virDomainNetDef {
* by libvirt, and cannot be used for a persistent network name. */
# define VIR_NET_GENERATED_PREFIX "vnet"
+/* Used for prefix of ifname of any network name generated dynamically
+ * by libvirt for Xen, and cannot be used for a persistent network name. */
+# define VIR_NET_GENERATED_PREFIX_XEN "vif"
+
typedef enum {
VIR_DOMAIN_CHR_DEVICE_STATE_DEFAULT = 0,
VIR_DOMAIN_CHR_DEVICE_STATE_CONNECTED,
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index ef92974..c5d84a4 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -734,7 +734,7 @@ libxlDomainCleanup(libxlDriverPrivatePtr driver,
for (i = 0; i < vm->def->nnets; i++) {
virDomainNetDefPtr net = vm->def->nets[i];
- if (STRPREFIX(net->ifname, "vif"))
+ if (STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX_XEN))
VIR_FREE(net->ifname);
}
}
@@ -918,7 +918,8 @@ libxlDomainCreateIfaceNames(virDomainDefPtr def, libxl_domain_config *d_config)
if (net->ifname)
continue;
- ignore_value(virAsprintf(&net->ifname, "vif%d.%d%s",
+ ignore_value(virAsprintf(&net->ifname,
+ VIR_NET_GENERATED_PREFIX_XEN "%d.%d%s",
def->id, x_nic->devid, suffix));
}
}
--
2.6.1
8 years, 9 months
[libvirt] [PATCH v3 0/7] migration: add multithread compression
by Nikolay Shirokovskiy
Add options to turn multithread compression on during migration and to configure
its parameters.
Changes from v2:
1. Multiple field parameter is used to specify compression methods that should
be used during migration. VIR_MIGRATE_COMPRESSED option flag now specifies
that default compression methods should be used so we keep backward
compatibility. This method is lxbzrle for qemu.
2. Patch that adds monitor commands to configure multithread compression
parameters and patch that adds compression options to migrate command are
reworked.
This series has not patches to configure compression parameters before
migration. Do we need it? Also it has not patch to introspect compression
methods supported by driver as Jiri suggested because I want to publish this
series ealier to check that I'm going in right direction.
Eli Qiao (1):
qemumonitorjsontest: add test for getting multithread compress params
Nikolay Shirokovskiy (4):
qemu migration: factor out setting migration option
migration: add compress method option
qemu migration: add multithread compression options
qemu migration: add xbzrle compression options
ShaoHe Feng (2):
qemu monitor: add multithread compress parameters accessors
virsh: add compression options for migration
include/libvirt/libvirt-domain.h | 44 ++++++-
src/qemu/qemu_domain.c | 4 +
src/qemu/qemu_domain.h | 2 +
src/qemu/qemu_driver.c | 116 +++++++++++++++++-
src/qemu/qemu_migration.c | 256 +++++++++++++++++++--------------------
src/qemu/qemu_migration.h | 24 ++++
src/qemu/qemu_monitor.c | 31 ++++-
src/qemu/qemu_monitor.h | 17 +++
src/qemu/qemu_monitor_json.c | 87 +++++++++++++
src/qemu/qemu_monitor_json.h | 5 +
src/qemu/qemu_monitor_text.c | 100 +++++++++++++++
src/qemu/qemu_monitor_text.h | 5 +
tests/qemumonitorjsontest.c | 53 ++++++++
tools/virsh-domain.c | 84 +++++++++++++
tools/virsh.pod | 25 +++-
15 files changed, 711 insertions(+), 142 deletions(-)
--
1.8.3.1
8 years, 9 months
[libvirt] Storage backend and RBD improvements
by Wido den Hollander
This series of patches is mainly focussed on improving the RBD
storage pool backend.
In the series it fixes a bug in the storage pool driver regarding
volume wiping and it also adds the new flag to instruct storage
pools to use TRIM for wiping volumes.
Afterwards it adds this functionality to the RBD storage pool
and in addition it also adds to ability to clone RBD volumes.
The original series of patches were reviewed by John Ferlan and
this series are revised based on his great feedback.
Wido
8 years, 9 months
[libvirt] [PATCH v7 00/13] qemu: Add quorum support to libvirt
by Matthias Gatto
The purpose of these patches is to introduce quorum for libvirt
I've try to follow this proposal:
http://www.redhat.com/archives/libvir-list/2014-May/msg00533.html
This feature ask for 5 task:
1) Allow a _virStorageSource to contain more than one backing store.
Because all the actual libvirt code use the backingStore field
as a pointer and we needs want to change that, I've decide to encapsulate
the backingStore field to simplifie the array manipulation.
2) Add the missing field a quorum need in _virStorageSource and
the VIR_STORAGE_TYPE_QUORUM and VIR_STORAGE_FILE_QUORUM in
their respectives enums.
3) Parse and format the xml
Because a quorum allows to have more than one backing store at the same level
we need to change virDomainDiskDefFormat and virDomainDiskDefParseXML
to call virDomainDiskBackingStoreFormat and virDomainDiskBackingStoreParse
in a loop.
virDomainDiskBackingStoreFormat and virDomainDiskBackingStoreParse can
call themself recursively in a loop because a quorum can contain another
quorum
4) Build qemu string
As for the xml, we have to call the function which create quorum recursively.
But this task have the problem explained here:
http://www.redhat.com/archives/libvir-list/2014-October/msg00529.html
The _virStorageSource missing some informations that can be passed to
a child, and therefore this version of quorum is incomplet.
5) Allow to hotplug/change a disk in a quorum
This part is not present in these patches because for this task
we have to use blockdev-add, and currently libvirt use
device_add for hotpluging that doesn't allow to hotplug quorum childs.
V2:
-Rebase on master
-Add Documentation
V3:
-Transforme the backingStore field in virStorageSource into
an array of pointer instead of a pointer
-Modify virStorageSourceSetBackingStore to allow it to expand
the backingStore size.
V4:
-Rebase on master
V5:
-Rebase on master
-patch 1-4/9: use patchs from John Ferlan
-patch 4/9: check return of virStorageSourceSetBackingStore
-patch 5/9: report type of error on virStorageSourceSetBackingStore
v6:
-Rebase on master
-Remove node-name patch
-patch 06/13: Add virStorageSourceIsRAID
-patch 10/13: Add virDomainDefHasRAID
-patch 11-13/13: Block all unsupported operations
v7:
-Rebase on master.
-Parse unconditionally backing store.
-fold qemuBuildRAIDFileSourceStr into qemuBuildRAIDStr.
-use 0/-1 return values when failing instead of bool.
-virStorageSourceSetBackingStore now free backing store when they are
already set.
Matthias Gatto (13):
virstoragefile: Add virStorageSourceGetBackingStore
virstoragefile: Always use virStorageSourceGetBackingStore to get
backing store
virstoragefile: Add virStorageSourceSetBackingStore
virstoragefile: Always use virStorageSourceSetBackingStore to set
backing store
virstoragefile: change backingStore to backingStores.
virstoragefile: Add virStorageSourceIsRAID
virstoragefile: Add quorum in virstoragefile
domain_conf: Read and Write quorum config
qemu: Add quorum support in qemuBuildDriveDevStr
domain: Add virDomainDefHasRAID
qemu: Forbid blocks operations with quorum
qemu: qemuDomainGetBlockInfo quorum support
qemu: qemuDiskPathToAlias quorum support
docs/formatdomain.html.in | 23 ++++-
docs/schemas/domaincommon.rng | 21 +++-
docs/schemas/storagecommon.rng | 1 +
docs/schemas/storagevol.rng | 1 +
src/conf/domain_conf.c | 174 ++++++++++++++++++++++++----------
src/conf/domain_conf.h | 1 +
src/conf/storage_conf.c | 23 +++--
src/libvirt_private.syms | 4 +
src/qemu/qemu_cgroup.c | 4 +-
src/qemu/qemu_command.c | 78 +++++++++++++++
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_driver.c | 72 ++++++++++----
src/qemu/qemu_migration.c | 1 +
src/qemu/qemu_monitor_json.c | 4 +-
src/security/security_dac.c | 2 +-
src/security/security_selinux.c | 4 +-
src/security/virt-aa-helper.c | 2 +-
src/storage/storage_backend.c | 24 +++--
src/storage/storage_backend_fs.c | 45 +++++----
src/storage/storage_backend_gluster.c | 11 ++-
src/storage/storage_backend_logical.c | 15 ++-
src/storage/storage_driver.c | 3 +-
src/util/virstoragefile.c | 121 ++++++++++++++++++++---
src/util/virstoragefile.h | 15 ++-
tests/virstoragetest.c | 18 ++--
25 files changed, 518 insertions(+), 151 deletions(-)
--
2.6.2
8 years, 9 months