[libvirt] Debian packaging for the Java bindings
by Wido den Hollander
Currently the Java bindings for libvirt do not provide a Debian package.
Users with Debian based systems like Ubuntu are now forced to compile from source since
no binary distribution of the JAR file is available.
This patch adds building Debian packages with ant
$ ant deb
This will build a .deb file in the target directory.
It requires dpkg-dev to be installed.
Wido
12 years, 4 months
[libvirt] [PATCH v10 0/9] Add basic driver for Parallels Cloud Server
by Dmitry Guryanov
Parallels Cloud Server is a virtualization solution
that allows users to simultaneously run multiple virtual
machines and containers on the same physical server.
More information can be found here: http://www.parallels.com/products/pcs/
Also beta version of Parallels Cloud Server can be downloaded there.
Changes in v10:
* Change the FSF address
* Replace format strings without % with ' "%s", string '
Dmitry Guryanov (9):
parallels: add driver skeleton
add function virCommandNewVAList
parallels: add functions to list domains and get info
parallels: implement functions for domain life cycle management
parallels: get info about serial ports
parallels: add support of VNC remote display
parallels: implement virDomainDefineXML operation for existing
domains
parallels: add storage driver
parallels: implement VM creation
configure.ac | 61 +-
docs/drvparallels.html.in | 28 +
include/libvirt/virterror.h | 1 +
libvirt.spec.in | 9 +-
mingw-libvirt.spec.in | 6 +
po/POTFILES.in | 3 +
src/Makefile.am | 15 +
src/conf/domain_conf.c | 3 +-
src/conf/domain_conf.h | 1 +
src/driver.h | 1 +
src/libvirt.c | 9 +
src/parallels/parallels_driver.c | 1735 +++++++++++++++++++++++++++++++++++++
src/parallels/parallels_driver.h | 28 +
src/parallels/parallels_storage.c | 1390 +++++++++++++++++++++++++++++
src/parallels/parallels_utils.c | 149 ++++
src/parallels/parallels_utils.h | 66 ++
src/util/command.c | 22 +
src/util/command.h | 3 +
src/util/virterror.c | 3 +-
19 files changed, 3511 insertions(+), 22 deletions(-)
create mode 100644 docs/drvparallels.html.in
create mode 100644 src/parallels/parallels_driver.c
create mode 100644 src/parallels/parallels_driver.h
create mode 100644 src/parallels/parallels_storage.c
create mode 100644 src/parallels/parallels_utils.c
create mode 100644 src/parallels/parallels_utils.h
12 years, 4 months
[libvirt] [PATCH libvirt-glib] gobject: add GVir.DomainShutdownFlags binding
by Marc-André Lureau
---
libvirt-gobject/libvirt-gobject-domain.c | 2 +-
libvirt-gobject/libvirt-gobject-domain.h | 13 +++++++++++++
libvirt-gobject/libvirt-gobject.sym | 1 +
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
index ba8e12b..d12ac97 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
@@ -509,7 +509,7 @@ gboolean gvir_domain_delete(GVirDomain *dom,
/**
* gvir_domain_shutdown:
* @dom: the domain
- * @flags: the flags
+ * @flags: the %GVirDomainShutdownFlags flags
*/
gboolean gvir_domain_shutdown(GVirDomain *dom,
guint flags G_GNUC_UNUSED,
diff --git a/libvirt-gobject/libvirt-gobject-domain.h b/libvirt-gobject/libvirt-gobject-domain.h
index 70e7e37..c61a2f5 100644
--- a/libvirt-gobject/libvirt-gobject-domain.h
+++ b/libvirt-gobject/libvirt-gobject-domain.h
@@ -116,6 +116,19 @@ typedef enum {
GVIR_DOMAIN_XML_UPDATE_CPU = VIR_DOMAIN_XML_UPDATE_CPU,
} GVirDomainXMLFlags;
+/**
+ * GVirDomainShutdownFlags:
+ * @GVIR_DOMAIN_SHUTDOWN_NONE: No flags, hypervisor choice
+ * @GVIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN: Send ACPI event
+ * @GVIR_DOMAIN_SHUTDOWN_GUEST_AGENT: Use guest agent
+ *
+ */
+typedef enum {
+ GVIR_DOMAIN_SHUTDOWN_NONE = 0,
+ GVIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN = VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN,
+ GVIR_DOMAIN_SHUTDOWN_GUEST_AGENT = VIR_DOMAIN_SHUTDOWN_GUEST_AGENT,
+} GVirDomainShutdownFlags;
+
typedef struct _GVirDomainInfo GVirDomainInfo;
struct _GVirDomainInfo
{
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index cc602d3..fe3de97 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -177,6 +177,7 @@ LIBVIRT_GOBJECT_0.0.9 {
LIBVIRT_GOBJECT_0.1.1 {
global:
+ gvir_domain_shutdown_flags_get_type;
gvir_domain_xml_flags_get_type;
} LIBVIRT_GOBJECT_0.0.9;
--
1.7.10.4
12 years, 4 months
[libvirt] [PATCH] Added timestamps to volumes
by Hendrik Schwartke
The access, modify and change times are added to volumes and
corresponding xml representations.
---
docs/schemas/storagevol.rng | 17 +++++++++++++++++
src/conf/storage_conf.c | 9 +++++++++
src/conf/storage_conf.h | 9 +++++++++
src/storage/storage_backend.c | 4 ++++
4 files changed, 39 insertions(+)
diff --git a/docs/schemas/storagevol.rng b/docs/schemas/storagevol.rng
index 7a74331..fc7eb09 100644
--- a/docs/schemas/storagevol.rng
+++ b/docs/schemas/storagevol.rng
@@ -63,6 +63,22 @@
</optional>
</define>
+ <define name='timestamps'>
+ <optional>
+ <element name='timestamps'>
+ <element name='atime'>
+ <ref name='unsignedLong'/>
+ </element>
+ <element name='mtime'>
+ <ref name='unsignedLong'/>
+ </element>
+ <element name='ctime'>
+ <ref name='unsignedLong'/>
+ </element>
+ </element>
+ </optional>
+ </define>
+
<define name='target'>
<element name='target'>
<optional>
@@ -72,6 +88,7 @@
</optional>
<ref name='format'/>
<ref name='permissions'/>
+ <ref name='timestamps'/>
<optional>
<ref name='encryption'/>
</optional>
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index ab8df9e..a4cdac8 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1272,6 +1272,15 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options,
virBufferAddLit(buf," </permissions>\n");
+ virBufferAddLit(buf," <timestamps>\n");
+ virBufferAsprintf(buf," <atime>%llu</atime>\n",
+ (unsigned long long) def->timestamps.atime);
+ virBufferAsprintf(buf," <mtime>%llu</mtime>\n",
+ (unsigned long long) def->timestamps.mtime);
+ virBufferAsprintf(buf," <ctime>%llu</ctime>\n",
+ (unsigned long long) def->timestamps.ctime);
+ virBufferAddLit(buf," </timestamps>\n");
+
if (def->encryption) {
virBufferAdjustIndent(buf, 4);
if (virStorageEncryptionFormat(buf, def->encryption) < 0)
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index 5733b57..8cd1d63 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -46,6 +46,14 @@ struct _virStoragePerms {
/* Storage volumes */
+typedef struct _virStorageTimestamps virStorageTimestamps;
+typedef virStorageTimestamps *virStorageTimestampsPtr;
+struct _virStorageTimestamps {
+ time_t atime;
+ time_t mtime;
+ time_t ctime;
+};
+
/*
* How the volume's data is stored on underlying
@@ -77,6 +85,7 @@ struct _virStorageVolTarget {
char *path;
int format;
virStoragePerms perms;
+ virStorageTimestamps timestamps;
int type; /* only used by disk backend for partition type */
/* Currently used only in virStorageVolDef.target, not in .backingstore. */
virStorageEncryptionPtr encryption;
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index e2e9b51..c827e3c 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -1209,6 +1209,10 @@ virStorageBackendUpdateVolTargetInfoFD(virStorageVolTargetPtr target,
target->perms.uid = sb.st_uid;
target->perms.gid = sb.st_gid;
+ target->timestamps.atime = sb.st_atime;
+ target->timestamps.mtime = sb.st_mtime;
+ target->timestamps.ctime = sb.st_ctime;
+
VIR_FREE(target->perms.label);
#if HAVE_SELINUX
--
1.7.9.5
12 years, 4 months
[libvirt] [PATCH v2] qemu: Allow to attach/detach controller device persistently
by Osier Yang
* src/conf/domain_conf.c:
- Add virDomainControllerFind to find controller device by type
and index.
- Add virDomainControllerRemove to remove the controller device
from maintained controler list.
* src/conf/domain_conf.h:
- Declare the two new helpers.
* src/libvirt_private.syms:
- Expose private symbols for the two new helpers.
* src/qemu/qemu_driver.c:
- Support attach/detach controller device persistently
* src/qemu/qemu_hotplug.c:
- Use the two helpers to simplify the codes.
v1 - v2:
- Allow to detach the controller too.
---
src/conf/domain_conf.c | 37 ++++++++++++++++++++++++++++++++++++
src/conf/domain_conf.h | 3 +-
src/libvirt_private.syms | 2 +
src/qemu/qemu_driver.c | 35 ++++++++++++++++++++++++++++++++-
src/qemu/qemu_hotplug.c | 47 ++++++++++++---------------------------------
5 files changed, 87 insertions(+), 37 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 41726ff..a7ae604 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7554,6 +7554,43 @@ void virDomainControllerInsertPreAlloced(virDomainDefPtr def,
def->ncontrollers++;
}
+int
+virDomainControllerFind(virDomainDefPtr def,
+ int type, int idx)
+{
+ int i;
+
+ for (i = 0 ; i < def->ncontrollers ; i++) {
+ if ((def->controllers[i]->type == type) &&
+ (def->controllers[i]->idx == idx)) {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+virDomainControllerDefPtr
+virDomainControllerRemove(virDomainDefPtr def, size_t i)
+{
+ virDomainControllerDefPtr controller = def->controllers[i];
+
+ if (def->ncontrollers > 1) {
+ memmove(def->controllers + i,
+ def->controllers + i + 1,
+ sizeof(*def->controllers) *
+ (def->ncontrollers - (i + 1)));
+ def->ncontrollers--;
+ if (VIR_REALLOC_N(def->controllers, def->ncontrollers) < 0) {
+ /* ignore, harmless */
+ }
+ } else {
+ VIR_FREE(def->controllers);
+ def->ncontrollers = 0;
+ }
+
+ return controller;
+}
int virDomainLeaseIndex(virDomainDefPtr def,
virDomainLeaseDefPtr lease)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 469d3b6..b102a43 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2043,7 +2043,8 @@ int virDomainControllerInsert(virDomainDefPtr def,
virDomainControllerDefPtr controller);
void virDomainControllerInsertPreAlloced(virDomainDefPtr def,
virDomainControllerDefPtr controller);
-
+int virDomainControllerFind(virDomainDefPtr def, int type, int idx);
+virDomainControllerDefPtr virDomainControllerRemove(virDomainDefPtr def, size_t i);
int virDomainLeaseIndex(virDomainDefPtr def,
virDomainLeaseDefPtr lease);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 734c881..9f14077 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -266,12 +266,14 @@ virDomainClockOffsetTypeFromString;
virDomainClockOffsetTypeToString;
virDomainConfigFile;
virDomainControllerDefFree;
+virDomainControllerFind;
virDomainControllerInsert;
virDomainControllerInsertPreAlloced;
virDomainControllerModelSCSITypeFromString;
virDomainControllerModelSCSITypeToString;
virDomainControllerModelUSBTypeFromString;
virDomainControllerModelUSBTypeToString;
+virDomainControllerRemove;
virDomainControllerTypeToString;
virDomainCpuPlacementModeTypeFromString;
virDomainCpuPlacementModeTypeToString;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6cf3882..2d9c3a9 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5535,6 +5535,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
virDomainNetDefPtr net;
virDomainHostdevDefPtr hostdev;
virDomainLeaseDefPtr lease;
+ virDomainControllerDefPtr controller;
switch (dev->type) {
case VIR_DOMAIN_DEVICE_DISK:
@@ -5607,6 +5608,23 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
dev->data.lease = NULL;
break;
+ case VIR_DOMAIN_DEVICE_CONTROLLER:
+ controller = dev->data.controller;
+ if (virDomainControllerFind(vmdef, controller->type,
+ controller->idx) > 0) {
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Target already exists"));
+ return -1;
+ }
+
+ if (virDomainControllerInsert(vmdef, controller) < 0)
+ return -1;
+ dev->data.controller = NULL;
+
+ if (qemuDomainAssignAddresses(vmdef, NULL, NULL) < 0)
+ return -1;
+ break;
+
default:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("persistent attach of device is not supported"));
@@ -5624,6 +5642,8 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
virDomainNetDefPtr net, det_net;
virDomainHostdevDefPtr hostdev, det_hostdev;
virDomainLeaseDefPtr lease, det_lease;
+ virDomainControllerDefPtr cont, det_cont;
+ int idx;
switch (dev->type) {
case VIR_DOMAIN_DEVICE_DISK:
@@ -5650,8 +5670,6 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
break;
case VIR_DOMAIN_DEVICE_HOSTDEV: {
- int idx;
-
hostdev = dev->data.hostdev;
if ((idx = virDomainHostdevFind(vmdef, hostdev, &det_hostdev)) < 0) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
@@ -5674,6 +5692,19 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
virDomainLeaseDefFree(det_lease);
break;
+ case VIR_DOMAIN_DEVICE_CONTROLLER:
+ cont = dev->data.controller;
+ if ((idx = virDomainControllerFind(vmdef, cont->type,
+ cont->idx)) < 0) {
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("device not present in domain configuration"));
+ return -1;
+ }
+ det_cont = virDomainControllerRemove(vmdef, idx);
+ virDomainControllerDefFree(det_cont);
+
+ break;
+
default:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("persistent detach of device is not supported"));
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 7880606..c3ac938 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -308,21 +308,17 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainControllerDefPtr controller)
{
- int i;
int ret = -1;
const char* type = virDomainControllerTypeToString(controller->type);
char *devstr = NULL;
qemuDomainObjPrivatePtr priv = vm->privateData;
bool releaseaddr = false;
- for (i = 0 ; i < vm->def->ncontrollers ; i++) {
- if ((vm->def->controllers[i]->type == controller->type) &&
- (vm->def->controllers[i]->idx == controller->idx)) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("target %s:%d already exists"),
- type, controller->idx);
- return -1;
- }
+ if (virDomainControllerFind(vm->def, controller->type, controller->idx) > 0) {
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("target %s:%d already exists"),
+ type, controller->idx);
+ return -1;
}
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
@@ -1874,19 +1870,13 @@ int qemuDomainDetachPciControllerDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev)
{
- int i, ret = -1;
+ int idx, ret = -1;
virDomainControllerDefPtr detach = NULL;
qemuDomainObjPrivatePtr priv = vm->privateData;
- for (i = 0 ; i < vm->def->ncontrollers ; i++) {
- if ((vm->def->controllers[i]->type == dev->data.controller->type) &&
- (vm->def->controllers[i]->idx == dev->data.controller->idx)) {
- detach = vm->def->controllers[i];
- break;
- }
- }
-
- if (!detach) {
+ if ((idx = virDomainControllerFind(vm->def,
+ dev->data.controller->type,
+ dev->data.controller->idx)) < 0) {
virReportError(VIR_ERR_OPERATION_FAILED,
_("disk controller %s:%d not found"),
virDomainControllerTypeToString(dev->data.controller->type),
@@ -1894,6 +1884,8 @@ int qemuDomainDetachPciControllerDevice(struct qemud_driver *driver,
goto cleanup;
}
+ detach = vm->def->controllers[idx];
+
if (!virDomainDeviceAddressIsValid(&detach->info,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
@@ -1934,27 +1926,14 @@ int qemuDomainDetachPciControllerDevice(struct qemud_driver *driver,
}
qemuDomainObjExitMonitorWithDriver(driver, vm);
- if (vm->def->ncontrollers > 1) {
- memmove(vm->def->controllers + i,
- vm->def->controllers + i + 1,
- sizeof(*vm->def->controllers) *
- (vm->def->ncontrollers - (i + 1)));
- vm->def->ncontrollers--;
- if (VIR_REALLOC_N(vm->def->controllers, vm->def->ncontrollers) < 0) {
- /* ignore, harmless */
- }
- } else {
- VIR_FREE(vm->def->controllers);
- vm->def->ncontrollers = 0;
- }
+ virDomainControllerRemove(vm->def, idx);
+ virDomainControllerDefFree(detach);
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
qemuDomainPCIAddressReleaseSlot(priv->pciaddrs,
detach->info.addr.pci.slot) < 0)
VIR_WARN("Unable to release PCI address on controller");
- virDomainControllerDefFree(detach);
-
ret = 0;
cleanup:
--
1.7.7.3
12 years, 4 months
[libvirt] [PATCH] build: don't export avahi syms when unused
by Eric Blake
Detected when building --without-avahi.
* src/libvirt_private.syms (virnetservermdns.h): Move...
* src/libvirt_avahi.syms: ...to new file.
* src/Makefile.am (USED_SYM_FILES, EXTRA_DIST): Use it.
---
I'm debating whether to push this under the build-breaker rule.
Unfortunately, while this solved my build on an Ubuntu machine,
I have other machines which are failing for other symbols (some
SASL related, and one for xenLinuxDomainBlockStats), so it's
probably better to fix everything instead of just half the problem.
src/Makefile.am | 7 ++++++-
src/libvirt_avahi.syms | 13 +++++++++++++
src/libvirt_private.syms | 13 -------------
3 files changed, 19 insertions(+), 14 deletions(-)
create mode 100644 src/libvirt_avahi.syms
diff --git a/src/Makefile.am b/src/Makefile.am
index da3d0cd..98bad3d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1344,6 +1344,10 @@ if HAVE_SASL
USED_SYM_FILES += libvirt_sasl.syms
endif
+if HAVE_AVAHI
+USED_SYM_FILES += libvirt_avahi.syms
+endif
+
EXTRA_DIST += \
libvirt_public.syms \
libvirt_private.syms \
@@ -1357,7 +1361,8 @@ EXTRA_DIST += \
libvirt_qemu.syms \
libvirt_sasl.syms \
libvirt_vmx.syms \
- libvirt_xenxs.syms
+ libvirt_xenxs.syms \
+ libvirt_avahi.syms
GENERATED_SYM_FILES = libvirt.syms libvirt.def libvirt_qemu.def
diff --git a/src/libvirt_avahi.syms b/src/libvirt_avahi.syms
new file mode 100644
index 0000000..9bfed41
--- /dev/null
+++ b/src/libvirt_avahi.syms
@@ -0,0 +1,13 @@
+# Conditional on HAVE_AVAHI
+
+# virnetservermdns.h
+virNetServerMDNSAddEntry;
+virNetServerMDNSAddGroup;
+virNetServerMDNSEntryFree;
+virNetServerMDNSFree;
+virNetServerMDNSGroupFree;
+virNetServerMDNSNew;
+virNetServerMDNSRemoveEntry;
+virNetServerMDNSRemoveGroup;
+virNetServerMDNSStart;
+virNetServerMDNSStop;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 83ca99f..71341a2 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1541,19 +1541,6 @@ virNetServerClientStartKeepAlive;
virNetServerClientWantClose;
-# virnetservermdns.h
-virNetServerMDNSAddEntry;
-virNetServerMDNSAddGroup;
-virNetServerMDNSEntryFree;
-virNetServerMDNSFree;
-virNetServerMDNSGroupFree;
-virNetServerMDNSNew;
-virNetServerMDNSRemoveEntry;
-virNetServerMDNSRemoveGroup;
-virNetServerMDNSStart;
-virNetServerMDNSStop;
-
-
# virnetserverprogram.h
virNetServerProgramDispatch;
virNetServerProgramFree;
--
1.7.11.2
12 years, 4 months
[libvirt] [PATCH v4 00/12] Support hypervisor-threads-pin in vcpupin.
by tangchen
Users can use vcpupin command to bind a vcpu thread to a specific physical cpu.
But besides vcpu threads, there are alse some other threads created by qemu
(known as hypervisor threads) that could not be explicitly bound to physical cpus.
The first 3 patches are from Wen Congyang, which implement Cgroup for differrent
hypervisors.
The other 10 patches implemented hypervisor threads binding, in two ways:
1) Use sched_setaffinity() function;
2) Use cpuset cgroup.
A new xml element is introduced, and vcpupin command is improved, see below.
1. Introduce new xml elements:
<cputune>
......
<hypervisorpin cpuset='1'/>
</cputune>
2. Improve vcpupin command to support hypervisor threads binding.
For example, vm1 has the following configuration:
<cputune>
<vcpupin vcpu='1' cpuset='1'/>
<vcpupin vcpu='0' cpuset='0'/>
<hypervisorpin cpuset='1'/>
</cputune>
1) query all threads pining
# vcpupin vm1
VCPU: CPU Affinity
----------------------------------
0: 0
1: 1
Hypervisor: CPU Affinity
----------------------------------
*: 1
2) query hypervisor threads pining only
# vcpupin vm1 --hypervisor
Hypervisor: CPU Affinity
----------------------------------
*: 1
3) change hypervisor threads pining
# vcpupin vm1 --hypervisor 0-1
# vcpupin vm1 --hypervisor
Hypervisor: CPU Affinity
----------------------------------
*: 0-1
# taskset -p 397
pid 397's current affinity mask: 3
Note: If users want to pin a vcpu thread to pcpu, --vcpu option could no longer be omitted.
Tang Chen (9):
Enable cpuset cgroup and synchronous vcpupin info to cgroup.
Support hypervisorpin xml parse.
Introduce qemuSetupCgroupHypervisorPin and synchronize hypervisorpin
info to cgroup.
Add qemuProcessSetHypervisorAffinites and set hypervisor threads
affinities
Introduce virDomainHypervisorPinAdd and virDomainHypervisorPinDel
functions
Introduce virDomainPinHypervisorFlags and
virDomainGetHypervisorPinInfo functions.
Introduce qemudDomainPinHypervisorFlags and
qemudDomainGetHypervisorPinInfo in qemu driver.
Introduce remoteDomainPinHypervisorFlags and
remoteDomainGetHypervisorPinInfo functions in remote driver.
Improve vcpupin to support hypervisorpin dynically.
Wen Congyang (3):
Introduce the function virCgroupForHypervisor
Introduce the function virCgroupMoveTask
create a new cgroup and move all hypervisor threads to the new cgroup
daemon/remote.c | 103 +++++++++
docs/schemas/domaincommon.rng | 7 +
include/libvirt/libvirt.h.in | 10 +
src/conf/domain_conf.c | 169 +++++++++++++-
src/conf/domain_conf.h | 7 +
src/driver.h | 13 +-
src/libvirt.c | 147 +++++++++++++
src/libvirt_private.syms | 7 +
src/libvirt_public.syms | 2 +
src/qemu/qemu_cgroup.c | 151 ++++++++++++-
src/qemu/qemu_cgroup.h | 5 +
src/qemu/qemu_driver.c | 267 ++++++++++++++++++++++-
src/qemu/qemu_process.c | 60 ++++-
src/remote/remote_driver.c | 102 +++++++++
src/remote/remote_protocol.x | 23 +-
src/remote_protocol-structs | 24 ++
src/util/cgroup.c | 188 +++++++++++++++-
src/util/cgroup.h | 15 ++
tests/qemuxml2argvdata/qemuxml2argv-cputune.xml | 1 +
tests/vcpupin | 6 +-
tools/virsh.c | 147 ++++++++-----
tools/virsh.pod | 16 +-
22 files changed, 1393 insertions(+), 77 deletions(-)
--
1.7.10.2
--
Best Regards,
Tang chen
12 years, 4 months
[libvirt] Stored secrets seem to get corrupted
by Wido den Hollander
Hi,
On one of my systems I'm having troubles with my RBD storage backend.
At first I thought it was a problem with my code, but after trying the
same code on a second machine I'm a bit confused.
The problem is that the storage backend tries to retrieve the value of a
secret and base64 decode it, that fails.
My debug log shows:
debug : virStorageBackendRBDOpenRADOSConn:65 : Using cephx authorization
debug : virStorageBackendRBDOpenRADOSConn:75 : Looking up secret by
UUID: 322bccea-f2ed-4eae-a7e5-d0793ffb162d
debug : virSecretLookupByUUIDString:14128 : conn=0x7fac9c0009c0,
uuidstr=322bccea-f2ed-4eae-a7e5-d0793ffb162d
debug : virSecretLookupByUUID:14086 : conn=0x7fac9c0009c0,
uuid=322bccea-f2ed-4eae-a7e5-d0793ffb162d
debug : virSecretGetValue:14486 : secret=0x7fac94000d30,
value_size=0x7facad481918, flags=0
debug : virStorageBackendRBDOpenRADOSConn:103 : Found cephx key: `I^%
debug : virStorageBackendRBDOpenRADOSConn:135 : Found 1 RADOS cluster
monitors in the pool configuration
debug : virStorageBackendRBDOpenRADOSConn:159 : RADOS mon_host has been
set to: 31.25.100.131:6789,
error : virStorageBackendRBDOpenRADOSConn:171 : internal error failed to
connect to the RADOS monitor on: 31.25.100.131:6789,
It goes wrong at "Found cephx key: <garbage>"
So I figured it had to be something in my code and I went over the code
again, but nothing seemed odd.
I tried the same checkout (tag: 0.9.13-rc1) on a different host (also
Ubuntu 12.04) and that worked.
The secret and pool XML's are the same, but what I found is that the
secret storage on disk seems to go wrong on one machine.
Notice this behavior:
root@stack01:~# virsh secret-set-value
322bccea-f2ed-4eae-a7e5-d0793ffb162d
AQAE+uJPCFpELBAAkTniQvHabBGj0Quwnu2imA==
Secret value set
root@stack01:~# md5sum
/etc/libvirt/secrets/322bccea-f2ed-4eae-a7e5-d0793ffb162d.base64
b4b147bc522828731f1a016bfa72c073
/etc/libvirt/secrets/322bccea-f2ed-4eae-a7e5-d0793ffb162d.base64
root@stack01:~# virsh secret-set-value
322bccea-f2ed-4eae-a7e5-d0793ffb162d
AQAE+uJPCFpELBAAkTniQvHabBGj0Quwnu2imA==
Secret value set
root@stack01:~# md5sum
/etc/libvirt/secrets/322bccea-f2ed-4eae-a7e5-d0793ffb162d.base64
927e2458c32cc3f6754d91694e41333f
/etc/libvirt/secrets/322bccea-f2ed-4eae-a7e5-d0793ffb162d.base64
root@stack01:~#
As you can see, the md5sum of the file changes when I set the value of
the secret to the same.
I tried the same on the other host:
root@stack02:~# virsh secret-set-value
322bccea-f2ed-4eae-a7e5-d0793ffb162d
AQAE+uJPCFpELBAAkTniQvHabBGj0Quwnu2imA==
Secret value set
root@stack02:~# md5sum
/etc/libvirt/secrets/322bccea-f2ed-4eae-a7e5-d0793ffb162d.base64
c30db27f9ebfe3f7903470d4bd542d1d
/etc/libvirt/secrets/322bccea-f2ed-4eae-a7e5-d0793ffb162d.base64
root@stack02:~# virsh secret-set-value
322bccea-f2ed-4eae-a7e5-d0793ffb162d
AQAE+uJPCFpELBAAkTniQvHabBGj0Quwnu2imA==
Secret value set
root@stack02:~# md5sum
/etc/libvirt/secrets/322bccea-f2ed-4eae-a7e5-d0793ffb162d.base64
c30db27f9ebfe3f7903470d4bd542d1d
/etc/libvirt/secrets/322bccea-f2ed-4eae-a7e5-d0793ffb162d.base64
root@stack02:~# virsh secret-set-value
322bccea-f2ed-4eae-a7e5-d0793ffb162d
AQAE+uJPCFpELBAAkTniQvHabBGj0Quwnu2imA==
Secret value set
root@stack02:~# md5sum
/etc/libvirt/secrets/322bccea-f2ed-4eae-a7e5-d0793ffb162d.base64
c30db27f9ebfe3f7903470d4bd542d1d
/etc/libvirt/secrets/322bccea-f2ed-4eae-a7e5-d0793ffb162d.base64
root@stack02:~#
The md5sum stays the same on stack02.
I verified that stack01 isn't out of disk space or out of inodes, those
are in the acceptable values range.
Any suggestions?
For the record, the hosts:
OS: Ubuntu 12.04 x864_64
Kernel: 3.2.0-25-generic
Libvirt commit: 0fce94fe1bd782ac4c33fdd59d13ee37b3437413
Thank you,
Wido
12 years, 4 months
[libvirt] [libvirt-glib 1/2] Add async variant of gvir_domain_resume()
by Zeeshan Ali (Khattak)
From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
---
libvirt-gobject/libvirt-gobject-domain.c | 56 ++++++++++++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-domain.h | 7 ++++
libvirt-gobject/libvirt-gobject.sym | 2 ++
3 files changed, 65 insertions(+)
diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
index 861f713..d6d804d 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
@@ -446,6 +446,62 @@ gboolean gvir_domain_resume(GVirDomain *dom,
return TRUE;
}
+static void
+gvir_domain_resume_helper(GSimpleAsyncResult *res,
+ GObject *object,
+ GCancellable *cancellable G_GNUC_UNUSED)
+{
+ GVirDomain *dom = GVIR_DOMAIN(object);
+ GError *err = NULL;
+
+ if (!gvir_domain_resume(dom, &err))
+ g_simple_async_result_take_error(res, err);
+}
+
+/**
+ * gvir_domain_resume_async:
+ * @dom: the domain
+ * @cancellable: (allow-none)(transfer none): cancellation object
+ * @callback: (scope async): completion callback
+ * @user_data: (closure): opaque data for callback
+ *
+ * Asynchronous variant of #gvir_domain_resume.
+ */
+void gvir_domain_resume_async(GVirDomain *dom,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GSimpleAsyncResult *res;
+
+ g_return_if_fail(GVIR_IS_DOMAIN(dom));
+ g_return_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable));
+
+ res = g_simple_async_result_new(G_OBJECT(dom),
+ callback,
+ user_data,
+ gvir_domain_resume_async);
+ g_simple_async_result_run_in_thread(res,
+ gvir_domain_resume_helper,
+ G_PRIORITY_DEFAULT,
+ cancellable);
+ g_object_unref(res);
+}
+
+gboolean gvir_domain_resume_finish(GVirDomain *dom,
+ GAsyncResult *result,
+ GError **err)
+{
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+ g_return_val_if_fail(g_simple_async_result_is_valid(result, G_OBJECT(dom), gvir_domain_resume_async), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+
+ if (g_simple_async_result_propagate_error(G_SIMPLE_ASYNC_RESULT(result), err))
+ return FALSE;
+
+ return TRUE;
+}
+
/**
* gvir_domain_stop:
* @dom: the domain
diff --git a/libvirt-gobject/libvirt-gobject-domain.h b/libvirt-gobject/libvirt-gobject-domain.h
index c61a2f5..6f74a97 100644
--- a/libvirt-gobject/libvirt-gobject-domain.h
+++ b/libvirt-gobject/libvirt-gobject-domain.h
@@ -162,6 +162,13 @@ gboolean gvir_domain_start_finish(GVirDomain *dom,
gboolean gvir_domain_resume(GVirDomain *dom,
GError **err);
+void gvir_domain_resume_async(GVirDomain *dom,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean gvir_domain_resume_finish(GVirDomain *dom,
+ GAsyncResult *result,
+ GError **err);
gboolean gvir_domain_stop(GVirDomain *dom,
guint flags,
GError **err);
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index fe3de97..926381d 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -177,6 +177,8 @@ LIBVIRT_GOBJECT_0.0.9 {
LIBVIRT_GOBJECT_0.1.1 {
global:
+ gvir_domain_resume_async;
+ gvir_domain_resume_finish;
gvir_domain_shutdown_flags_get_type;
gvir_domain_xml_flags_get_type;
} LIBVIRT_GOBJECT_0.0.9;
--
1.7.11.2
12 years, 4 months
[libvirt] [glib PATCH V5] Add bindings for virDomainRestore*()
by Jovanka Gulicoska
---
libvirt-gobject/libvirt-gobject-connection.c | 164 ++++++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-connection.h | 20 ++++
libvirt-gobject/libvirt-gobject.sym | 4 +
3 files changed, 188 insertions(+)
diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c
index 3a99034..dacac68 100644
--- a/libvirt-gobject/libvirt-gobject-connection.c
+++ b/libvirt-gobject/libvirt-gobject-connection.c
@@ -1605,3 +1605,167 @@ gvir_connection_get_capabilities_finish(GVirConnection *conn,
return g_object_ref(caps);
}
+
+/**
+ * gvir_connection_restore_domain_from_file:
+ * @conn: a #GVirConnection
+ * @filename: path to input file
+ * @custom_conf: (allow-none): configuration for domain or NULL
+ * @flags: the flags
+ *
+ * Returns: TRUE on success, FALSE otherwise
+ *
+ * Restores the domain saved with #gvir_domain_save_to_file
+ */
+gboolean gvir_connection_restore_domain_from_file(GVirConnection *conn,
+ gchar *filename,
+ GVirConfigDomain *custom_conf,
+ guint flags,
+ GError **err)
+{
+ GVirConnectionPrivate *priv;
+ int ret;
+
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), FALSE);
+ g_return_val_if_fail((filename != NULL), FALSE);
+ g_return_val_if_fail((err == NULL) || (*err == NULL), FALSE);
+
+ priv = conn->priv;
+
+ if (flags || (custom_conf != NULL)) {
+ gchar *custom_xml = NULL;
+
+ if (custom_conf != NULL)
+ custom_xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(custom_conf));
+
+ ret = virDomainRestoreFlags(priv->conn, filename, custom_xml, flags);
+ g_free (custom_xml);
+ }
+ else {
+ ret = virDomainRestore(priv->conn, filename);
+ }
+
+ if (ret < 0) {
+ gvir_set_error_literal(err, GVIR_CONNECTION_ERROR,
+ 0,
+ "Unable to restore domain");
+
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+typedef struct {
+ gchar *filename;
+ GVirConfigDomain *custom_conf;
+ guint flags;
+} RestoreDomainFromFileData;
+
+static void restore_domain_from_file_data_free(RestoreDomainFromFileData *data)
+{
+ g_free(data->filename);
+ if (data->custom_conf != NULL)
+ g_object_unref(data->custom_conf);
+ g_slice_free(RestoreDomainFromFileData, data);
+}
+
+
+static void
+gvir_connection_restore_domain_from_file_helper
+ (GSimpleAsyncResult *res,
+ GObject *object,
+ GCancellable *cancellable G_GNUC_UNUSED)
+{
+ GVirConnection *conn = GVIR_CONNECTION(object);
+ RestoreDomainFromFileData *data;
+ GError *err = NULL;
+
+ data = g_simple_async_result_get_op_res_gpointer(res);
+
+ if (!gvir_connection_restore_domain_from_file(conn, data->filename,
+ data->custom_conf,
+ data->flags, &err))
+ g_simple_async_result_take_error(res, err);
+}
+
+/**
+ * gvir_connection_restore_domain_from_file_async:
+ * @conn: a #GVirConnection
+ * @filename: path to input file
+ * @custom_conf: (allow-none): configuration for domain
+ * @flags: the flags
+ * @cancellable: (allow-none) (transfer none): cancellation object
+ * @callback: (scope async): completion callback
+ * @user_data: (closure): opaque data for callback
+ *
+ * Asynchronous variant of #gvir_connection_restore_domain_from_file
+ */
+void
+gvir_connection_restore_domain_from_file_async(GVirConnection *conn,
+ gchar *filename,
+ GVirConfigDomain *custom_conf,
+ guint flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GSimpleAsyncResult *res;
+ RestoreDomainFromFileData *data;
+
+ g_return_if_fail(GVIR_IS_CONNECTION(conn));
+ g_return_if_fail(filename != NULL);
+ g_return_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable));
+
+ data = g_slice_new0(RestoreDomainFromFileData);
+ data->filename = g_strdup(filename);
+ if (custom_conf != NULL)
+ data->custom_conf = g_object_ref(custom_conf);
+ data->flags = flags;
+
+ res = g_simple_async_result_new
+ (G_OBJECT(conn),
+ callback,
+ user_data,
+ gvir_connection_restore_domain_from_file_async);
+ g_simple_async_result_set_op_res_gpointer
+ (res,
+ data,
+ (GDestroyNotify)restore_domain_from_file_data_free);
+
+ g_simple_async_result_run_in_thread
+ (res,
+ gvir_connection_restore_domain_from_file_helper,
+ G_PRIORITY_DEFAULT,
+ cancellable);
+
+ g_object_unref(res);
+}
+
+/**
+ * gvir_connection_restore_domain_from_file_finish:
+ * @conn: a #GVirConnection
+ * @result: (transfer none): async method result
+ * @err: Place-holder for possible errors
+ *
+ * Finishes the operation started by #gvir_restore_domain_from_file_async.
+ *
+ * Returns: TRUE if domain was restored successfully, FALSE otherwise.
+ */
+gboolean
+gvir_connection_restore_domain_from_file_finish(GVirConnection *conn,
+ GAsyncResult *result,
+ GError **err)
+{
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), FALSE);
+ g_return_val_if_fail(g_simple_async_result_is_valid
+ (result, G_OBJECT(conn),
+ gvir_connection_restore_domain_from_file_async),
+ FALSE);
+
+ if (g_simple_async_result_propagate_error(G_SIMPLE_ASYNC_RESULT(result),
+ err))
+ return FALSE;
+
+ return TRUE;
+}
diff --git a/libvirt-gobject/libvirt-gobject-connection.h b/libvirt-gobject/libvirt-gobject-connection.h
index c80eecf..d658b01 100644
--- a/libvirt-gobject/libvirt-gobject-connection.h
+++ b/libvirt-gobject/libvirt-gobject-connection.h
@@ -202,6 +202,26 @@ gvir_connection_get_capabilities_finish(GVirConnection *conn,
GAsyncResult *result,
GError **err);
+gboolean
+gvir_connection_restore_domain_from_file(GVirConnection *conn,
+ gchar *filename,
+ GVirConfigDomain *custom_conf,
+ guint flags,
+ GError **err);
+
+void
+gvir_connection_restore_domain_from_file_async(GVirConnection *conn,
+ gchar *filename,
+ GVirConfigDomain *custom_conf,
+ guint flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+gboolean
+gvir_connection_restore_domain_from_file_finish(GVirConnection *conn,
+ GAsyncResult *result,
+ GError **err);
G_END_DECLS
#endif /* __LIBVIRT_GOBJECT_CONNECTION_H__ */
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index 54a093a..c31ed0f 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -169,6 +169,10 @@ LIBVIRT_GOBJECT_0.0.9 {
gvir_connection_get_capabilities_async;
gvir_connection_get_capabilities_finish;
+ gvir_connection_restore_domain_from_file;
+ gvir_connection_restore_domain_from_file_async;
+ gvir_conecction_restore_domain_from_file_finish;
+
gvir_domain_start_async;
gvir_domain_start_finish;
} LIBVIRT_GOBJECT_0.0.8;
--
1.7.10.4
12 years, 4 months