[libvirt] [PATCHv3 0/2] virsh: Fix negative value parsing in vcpuinfo
by Peter Krempa
Jincheng Miao (1):
virsh: forbid negative vcpu argument to vcpupin
Peter Krempa (1):
virsh: Reject negative numbers in vshCommandOptUInt
tests/vcpupin | 29 ++++++++++++++++++++++++++++-
tools/virsh-domain.c | 35 ++++++++++++++++++-----------------
tools/virsh.c | 4 ++--
3 files changed, 48 insertions(+), 20 deletions(-)
--
1.9.3
10 years, 4 months
[libvirt] Regression with 79f11b35
by Cole Robinson
I'm seeing a regression with:
commit 79f11b35c77b3c286c84312dc9737c2ccbf67ed5
Author: Eric Blake <eblake(a)redhat.com>
Date: Tue Apr 8 14:26:02 2014 -0600
conf: track user vs. canonical name through full chain lookup
Setup info:
$ ls -ld /mnt/data
lrwxrwxrwx. 1 root root 17 Oct 24 2011 /mnt/data -> terabytedrv/data/
$ ls -l /mnt/data/devel/images/f18*
-rw-r--r--. 1 qemu qemu 9316335616 Mar 30 18:36
/mnt/data/devel/images/f18-backing-img.qcow2
-rw-r--r--. 1 root root 6848249856 Apr 25 19:11 /mnt/data/devel/images/f18.qcow2
$ qemu-img info /mnt/data/devel/images/f18-backing-img.qcow2
image: /mnt/data/devel/images/f18-backing-img.qcow2
file format: qcow2
virtual size: 9.8G (10485760000 bytes)
disk size: 8.7G
cluster_size: 65536
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 snapshot1 0 2014-01-13 18:48:43 00:00:00.000
2 snapshot2 0 2014-01-13 18:49:39 00:00:00.000
Format specific information:
compat: 0.10
$ qemu-img info /mnt/data/devel/images/f18.qcow2 image:
/mnt/data/devel/images/f18.qcow2
file format: qcow2
virtual size: 9.8G (10485760000 bytes)
disk size: 6.4G
cluster_size: 65536
backing file: f18-backing-img.qcow2 (actual path:
/mnt/data/devel/images/f18-backing-img.qcow2)
Format specific information:
compat: 0.10
Before the patch:
$ sudo virsh vol-dumpxml /mnt/data/devel/images/f18.qcow2
[full xml with backing image info]
After the patch:
$ sudo virsh vol-dumpxml /mnt/data/devel/images/f18.qcow2
[xml minus xml for the backing image]
And these errors are on the console when the daemon starts:
2014-05-03 20:52:34.970+0000: 20600: error : virFindBackingFile:590 : Cannot
access backing file './f18-backing-img.qcow2': No such file or directory
2014-05-03 20:52:34.970+0000: 20600: warning :
virStorageFileGetMetadataInternal:868 : Backing file 'f18-backing-img.qcow2'
of image '/mnt/data/devel/images/ztester-serial-f18.qcow2' is missing.
On git head actually the vol-dumpxml explicitly fails, but I don't have the
error handy.
- Cole
10 years, 5 months
[libvirt] [PATCH] libxl: add discard support to libxl_device_disk
by Olaf Hering
Translate libvirt discard settings into libxl-4.5 discard settings.
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
---
default means leave decision to libxl.
Not sure if that is what "default" in libvirt terms really means.
src/libxl/libxl_conf.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index b7fed7f..4cb062e 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -713,6 +713,33 @@ libxlMakeDomBuildInfo(virDomainObjPtr vm, libxl_domain_config *d_config)
return -1;
}
+static void
+libxlDiskSetDiscard(libxl_device_disk *x_disk, int discard)
+{
+ if (!x_disk->readwrite)
+ return;
+#if defined(LIBXL_HAVE_LIBXL_DEVICE_DISK_DISCARD_ENABLE)
+ switch (discard) {
+ case VIR_DOMAIN_DISK_DISCARD_DEFAULT:
+ break;
+ case VIR_DOMAIN_DISK_DISCARD_UNMAP:
+ libxl_defbool_set(&x_disk->discard_enable, true);
+ break;
+ default:
+ case VIR_DOMAIN_DISK_DISCARD_IGNORE:
+ libxl_defbool_set(&x_disk->discard_enable, false);
+ break;
+ }
+#else
+ if (discard == VIR_DOMAIN_DISK_DISCARD_DEFAULT)
+ return;
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("This version of libxenlight does not support "
+ "discard= option passing"));
+#endif
+}
+
+
int
libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk *x_disk)
{
@@ -827,6 +854,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk *x_disk)
x_disk->removable = 1;
x_disk->readwrite = !l_disk->readonly;
x_disk->is_cdrom = l_disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM ? 1 : 0;
+ libxlDiskSetDiscard(x_disk, l_disk->discard);
/* An empty CDROM must have the empty format, otherwise libxl fails. */
if (x_disk->is_cdrom && !x_disk->pdev_path)
x_disk->format = LIBXL_DISK_FORMAT_EMPTY;
10 years, 5 months
[libvirt] [PATCHv3] Add invariant TSC cpu flag
by Ján Tomko
Add suport for invariant TSC flag (CPUID 0x80000007, bit 8 of EDX).
If this flag is enabled, the TSC ticks at a constant rate across
all ACPI P-, C- and T-states.
This can be enabled by adding:
<feature name='invtsc'/>
to the <cpu> element.
Migration and saving the domain does not work with this flag.
QEMU support for this is not merged yet:
https://lists.gnu.org/archive/html/qemu-devel/2014-04/msg05024.html
The feature name "invtsc" differs from the name "" used by the linux kernel:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch...
---
v1: https://www.redhat.com/archives/libvir-list/2014-May/msg00183.html
v2: https://www.redhat.com/archives/libvir-list/2014-May/msg00297.html
add it as a cpu flag instead of a timer
v3:
check if the feature wasn't filtered out on domain startup
src/cpu/cpu_map.xml | 5 +++++
src/qemu/qemu_migration.c | 14 ++++++++++++++
src/qemu/qemu_process.c | 15 +++++++++++++++
3 files changed, 34 insertions(+)
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
index 7d34d40..ffaeb92 100644
--- a/src/cpu/cpu_map.xml
+++ b/src/cpu/cpu_map.xml
@@ -327,6 +327,11 @@
<cpuid function='0x00000007' ebx='0x00100000'/>
</feature>
+ <!-- Advanced Power Management edx features -->
+ <feature name='invtsc'>
+ <cpuid function='0x80000007' edx='0x00000100'/>
+ </feature>
+
<!-- models -->
<model name='486'>
<feature name='fpu'/>
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index f0df1a6..7504a38 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1513,6 +1513,20 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver, virDomainObjPtr vm,
return false;
}
+ for (i = 0; i < def->cpu->nfeatures; i++) {
+ virCPUFeatureDefPtr feature = &def->cpu->features[i];
+
+ if (feature->policy != VIR_CPU_FEATURE_REQUIRE)
+ continue;
+
+ if (STREQ(feature->name, "invtsc")) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("domain has CPU feature: %s"),
+ feature->name);
+ return false;
+ }
+ }
+
return true;
}
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index a83780f..0824afe 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3568,6 +3568,7 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, virDomainObjPtr vm)
qemuDomainObjPrivatePtr priv = vm->privateData;
int rc;
bool ret = false;
+ size_t i;
switch (arch) {
case VIR_ARCH_I686:
@@ -3590,6 +3591,20 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, virDomainObjPtr vm)
goto cleanup;
}
}
+
+ for (i = 0; i < def->cpu->nfeatures; i++) {
+ virCPUFeatureDefPtr feature = &def->cpu->features[i];
+
+ if (feature->policy != VIR_CPU_FEATURE_REQUIRE)
+ continue;
+
+ if (STREQ(feature->name, "invtsc") &&
+ !cpuHasFeature(guestcpu, feature->name)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("host doesn't support invariant TSC"));
+ goto cleanup;
+ }
+ }
break;
default:
--
1.8.3.2
10 years, 5 months
[libvirt] [PATCH] qemu: Add cmd_per_lun, max_sectors to virtio-scsi
by Mike Perez
This introduces two new attributes "cmd_per_lun" and "max_sectors" same
with the names QEMU uses for virtio-scsi. An example of the XML:
<controller type='scsi' index='0' model='virtio-scsi' cmd_per_lun='50'
max_sectors='512'/>
The corresponding QEMU command line:
-device virtio-scsi-pci,id=scsi0,cmd_per_lun=50,max_sectors=512,
bus=pci.0,addr=0x3
Signed-off-by: Mike Perez <thingee(a)gmail.com>
---
docs/formatdomain.html.in | 29 +++++++++++++++++++---
docs/schemas/domaincommon.rng | 10 ++++++++
src/conf/domain_conf.c | 27 ++++++++++++++++++--
src/conf/domain_conf.h | 2 ++
src/qemu/qemu_command.c | 27 ++++++++++++++++----
.../qemuxml2argv-disk-virtio-scsi-cmd_per_lun.args | 9 +++++++
.../qemuxml2argv-disk-virtio-scsi-cmd_per_lun.xml | 29 ++++++++++++++++++++++
.../qemuxml2argv-disk-virtio-scsi-max_sectors.args | 9 +++++++
.../qemuxml2argv-disk-virtio-scsi-max_sectors.xml | 29 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 6 +++++
tests/qemuxml2xmltest.c | 2 ++
11 files changed, 168 insertions(+), 11 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-cmd_per_lun.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-cmd_per_lun.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-max_sectors.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-max_sectors.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 691a451..8ffb247 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2559,11 +2559,32 @@
<p>
An optional sub-element <code>driver</code> can specify the driver
- specific options. Currently it only supports attribute <code>queues</code>
- (<span class="since">1.0.5</span>, QEMU and KVM only), which specifies the
- number of queues for the controller. For best performance, it's recommended
- to specify a value matching the number of vCPUs.
+ specific options:
</p>
+ <dl>
+ <dt><code>queues</code></dt>
+ <dd>
+ The optional <code>queues</code> attribute specifies the number of
+ queues for the controller. For best performance, it's recommended to
+ specify a value matching the number of vCPUs.
+ <span class="since">Since 1.0.5 (QEMU and KVM only)</span>
+ </dd>
+ <dt><code>cmd_per_lun</code></dt>
+ <dd>
+ The optional <code>cmd_per_lun</code> attribute specifies the maximum
+ number of commands that can be queued on devices controlled by the
+ host.
+ <span class="since">Since 1.2.5 (QEMU and KVM only)</span>
+ </dd>
+ <dt><code>max_sectors</code></dt>
+ <dd>
+ The optional <code>max_sectors</code> attribute specifies the maximum
+ amount of data in bytes that will be transferred to or from the device
+ in a single command. The transfer length is measured in sectors, where
+ a sector is 512 bytes.
+ <span class="since">Since 1.2.5 (QEMU and KVM only)</span>
+ </dd>
+ </dl>
<p>
USB companion controllers have an optional
sub-element <code><master></code> to specify the exact
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 4249ed5..4bf4699 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1735,6 +1735,16 @@
<ref name="unsignedInt"/>
</attribute>
</optional>
+ <optional>
+ <attribute name="cmd_per_lun">
+ <ref name="unsignedInt"/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="max_sectors">
+ <ref name="unsignedInt"/>
+ </attribute>
+ </optional>
</element>
</optional>
</interleave>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 40c385e..4388cb8 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6041,6 +6041,8 @@ virDomainControllerDefParseXML(xmlNodePtr node,
char *idx = NULL;
char *model = NULL;
char *queues = NULL;
+ char *cmd_per_lun = NULL;
+ char *max_sectors = NULL;
xmlNodePtr saved = ctxt->node;
int rc;
@@ -6084,6 +6086,8 @@ virDomainControllerDefParseXML(xmlNodePtr node,
if (cur->type == XML_ELEMENT_NODE) {
if (xmlStrEqual(cur->name, BAD_CAST "driver"))
queues = virXMLPropString(cur, "queues");
+ cmd_per_lun = virXMLPropString(cur, "cmd_per_lun");
+ max_sectors = virXMLPropString(cur, "max_sectors");
}
cur = cur->next;
}
@@ -6094,6 +6098,17 @@ virDomainControllerDefParseXML(xmlNodePtr node,
goto error;
}
+ if (cmd_per_lun && virStrToLong_ui(cmd_per_lun, NULL, 10, &def->cmd_per_lun) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Malformed 'cmd_per_lun' value '%s'"), cmd_per_lun);
+ goto error;
+ }
+
+ if (max_sectors && virStrToLong_ui(max_sectors, NULL, 10, &def->max_sectors) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Malformed 'max_sectors' value %s'"), max_sectors);
+ }
+
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0)
goto error;
@@ -6201,6 +6216,8 @@ virDomainControllerDefParseXML(xmlNodePtr node,
VIR_FREE(idx);
VIR_FREE(model);
VIR_FREE(queues);
+ VIR_FREE(cmd_per_lun);
+ VIR_FREE(max_sectors);
return def;
@@ -15279,13 +15296,19 @@ virDomainControllerDefFormat(virBufferPtr buf,
break;
}
- if (def->queues || virDomainDeviceInfoIsSet(&def->info, flags) ||
- pcihole64) {
+ if (def->queues || def->cmd_per_lun || def->max_sectors ||
+ virDomainDeviceInfoIsSet(&def->info, flags) || pcihole64) {
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
if (def->queues)
virBufferAsprintf(buf, "<driver queues='%u'/>\n", def->queues);
+ if (def->cmd_per_lun)
+ virBufferAsprintf(buf, "<driver cmd_per_lun='%u'/>\n", def->cmd_per_lun);
+
+ if (def->max_sectors)
+ virBufferAsprintf(buf, "<driver max_sectors='%u'/>\n", def->max_sectors);
+
if (virDomainDeviceInfoIsSet(&def->info, flags) &&
virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
return -1;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index bde303c..66484a1 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -720,6 +720,8 @@ struct _virDomainControllerDef {
unsigned int idx;
int model; /* -1 == undef */
unsigned int queues;
+ unsigned int cmd_per_lun;
+ unsigned int max_sectors;
union {
virDomainVirtioSerialOpts vioserial;
virDomainPCIControllerOpts pciopts;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 193959f..5274d17 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4236,12 +4236,23 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
virBuffer buf = VIR_BUFFER_INITIALIZER;
int model;
- if (def->queues &&
- !(def->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI &&
+ if (!(def->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI &&
def->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("'queues' is only supported by virtio-scsi controller"));
- return NULL;
+ if (def->queues) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("'queues' is only supported by virtio-scsi controller"));
+ return NULL;
+ }
+ if (def->cmd_per_lun) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("'cmd_per_lun' is only supported by virtio-scsi controller"));
+ return NULL;
+ }
+ if (def->max_sectors) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("'max_sectors' is only supported by virtio-scsi controller"));
+ return NULL;
+ }
}
switch (def->type) {
@@ -4369,6 +4380,12 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
if (def->queues)
virBufferAsprintf(&buf, ",num_queues=%u", def->queues);
+ if (def->cmd_per_lun)
+ virBufferAsprintf(&buf, ",cmd_per_lun=%u", def->cmd_per_lun);
+
+ if (def->max_sectors)
+ virBufferAsprintf(&buf, ",max_sectors=%u", def->max_sectors);
+
if (qemuBuildDeviceAddressStr(&buf, domainDef, &def->info, qemuCaps) < 0)
goto error;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-cmd_per_lun.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-cmd_per_lun.args
new file mode 100644
index 0000000..2c75790
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-cmd_per_lun.args
@@ -0,0 +1,9 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 214 -smp 8 -nographic -nodefconfig -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-device virtio-scsi-pci,id=scsi0,cmd_per_lun=50,bus=pci.0,addr=0x3 \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-scsi0-0-0-0 \
+-device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\
+drive=drive-scsi0-0-0-0,id=scsi0-0-0-0 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-cmd_per_lun.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-cmd_per_lun.xml
new file mode 100644
index 0000000..615a7f5
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-cmd_per_lun.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>8</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='sdb' bus='scsi'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='scsi' index='0' model='virtio-scsi'>
+ <driver cmd_per_lun='50'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-max_sectors.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-max_sectors.args
new file mode 100644
index 0000000..895f379
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-max_sectors.args
@@ -0,0 +1,9 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 214 -smp 8 -nographic -nodefconfig -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-device virtio-scsi-pci,id=scsi0,max_sectors=512,bus=pci.0,addr=0x3 \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-scsi0-0-0-0 \
+-device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\
+drive=drive-scsi0-0-0-0,id=scsi0-0-0-0 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-max_sectors.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-max_sectors.xml
new file mode 100644
index 0000000..cd7d4a7
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-max_sectors.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>8</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='sdb' bus='scsi'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='scsi' index='0' model='virtio-scsi'>
+ <driver max_sectors='512'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 1ea7bf8..8ebb202 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -807,6 +807,12 @@ mymain(void)
DO_TEST("disk-virtio-scsi-num_queues",
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
QEMU_CAPS_VIRTIO_SCSI);
+ DO_TEST("disk-virtio-scsi-cmd_per_lun",
+ QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
+ QEMU_CAPS_VIRTIO_SCSI);
+ DO_TEST("disk-virtio-scsi-max_sectors",
+ QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
+ QEMU_CAPS_VIRTIO_SCSI);
DO_TEST("disk-scsi-megasas",
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
QEMU_CAPS_SCSI_MEGASAS);
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index da528da..73c4ff1 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -223,6 +223,8 @@ mymain(void)
DO_TEST("disk-scsi-vscsi");
DO_TEST("disk-scsi-virtio-scsi");
DO_TEST("disk-virtio-scsi-num_queues");
+ DO_TEST("disk-virtio-scsi-cmd_per_lun");
+ DO_TEST("disk-virtio-scsi-max_sectors");
DO_TEST("disk-scsi-megasas");
DO_TEST_FULL("disk-mirror", false, WHEN_ACTIVE);
DO_TEST_FULL("disk-mirror", true, WHEN_INACTIVE);
--
1.9.1
10 years, 5 months
[libvirt] [PATCH 00/12] Couple of host info getting improvements
by Michal Privoznik
The rationale is to fill in the gaps as described here:
https://wiki.openstack.org/wiki/VirtDriverGuestCPUMemoryPlacement
Note that these are targeted for 1.2.6.
Michal Privoznik (12):
Introduce virNodeHugeTLB
Initial virsh exposure of virNodeHugeTLB
nodeinfo: Implement nodeHugeTLB
virpci: Introduce virPCIDeviceIsPCIExpress and friends
nodedev: Introduce <pci-express/> to PCI devices
virInterface: Expose link state & speed
interface_backend_udev: Implement link speed & state
interface_backend_netcf: Implement link speed & state
virhostdev: Move IOMMU and VFIO funcs from qemu
virCaps: Introduce IOMMU and VFIO capabilities
Expose IOMMU and VFIO capabilities from virCaps
nodedev: Export NUMA node locality for PCI devices
daemon/remote.c | 54 ++++++
docs/formatcaps.html.in | 8 +-
docs/formatnode.html.in | 25 +++
docs/schemas/capability.rng | 12 ++
docs/schemas/interface.rng | 27 +++
docs/schemas/nodedev.rng | 37 ++++
include/libvirt/libvirt.h.in | 26 +++
src/conf/capabilities.c | 50 ++++++
src/conf/capabilities.h | 11 ++
src/conf/interface_conf.c | 39 ++++-
src/conf/interface_conf.h | 15 ++
src/conf/node_device_conf.c | 166 +++++++++++++++++-
src/conf/node_device_conf.h | 32 +++-
src/driver.h | 7 +
src/interface/interface_backend_netcf.c | 99 +++++++++++
src/interface/interface_backend_udev.c | 19 ++
src/libvirt.c | 59 +++++++
src/libvirt_private.syms | 13 ++
src/libvirt_public.syms | 5 +
src/lxc/lxc_conf.c | 3 +
src/node_device/node_device_udev.c | 38 ++++
src/nodeinfo.c | 192 +++++++++++++++++++++
src/nodeinfo.h | 6 +
src/parallels/parallels_driver.c | 3 +
src/phyp/phyp_driver.c | 3 +
src/qemu/qemu_capabilities.c | 3 +
src/qemu/qemu_driver.c | 30 +++-
src/qemu/qemu_hostdev.c | 93 ++--------
src/qemu/qemu_hostdev.h | 2 -
src/remote/remote_driver.c | 48 ++++++
src/remote/remote_protocol.x | 19 +-
src/remote_protocol-structs | 13 ++
src/uml/uml_conf.c | 3 +
src/util/virhostdev.c | 73 ++++++++
src/util/virhostdev.h | 4 +
src/util/virpci.c | 81 ++++++++-
src/util/virpci.h | 8 +
src/vbox/vbox_tmpl.c | 3 +
tests/capabilityschemadata/caps-qemu-kvm.xml | 2 +
tests/capabilityschemadata/caps-test.xml | 2 +
tests/capabilityschemadata/caps-test2.xml | 2 +
tests/capabilityschemadata/caps-test3.xml | 2 +
tests/interfaceschemadata/bridge-no-address.xml | 1 +
tests/interfaceschemadata/bridge.xml | 1 +
tests/interfaceschemadata/ethernet-dhcp.xml | 1 +
tests/nodedevschemadata/pci_1002_71c4.xml | 1 +
tests/nodedevschemadata/pci_8086_10c9_sriov_pf.xml | 1 +
.../pci_8086_4238_pcie_wireless.xml | 26 +++
tests/nodedevxml2xmltest.c | 1 +
tests/xencapsdata/xen-i686-pae-hvm.xml | 2 +
tests/xencapsdata/xen-i686-pae.xml | 2 +
tests/xencapsdata/xen-i686.xml | 2 +
tests/xencapsdata/xen-ia64-be-hvm.xml | 2 +
tests/xencapsdata/xen-ia64-be.xml | 2 +
tests/xencapsdata/xen-ia64-hvm.xml | 2 +
tests/xencapsdata/xen-ia64.xml | 2 +
tests/xencapsdata/xen-ppc64.xml | 2 +
tests/xencapsdata/xen-x86_64-hvm.xml | 2 +
tests/xencapsdata/xen-x86_64.xml | 2 +
tools/virsh-host.c | 62 +++++++
tools/virsh.pod | 7 +
61 files changed, 1371 insertions(+), 87 deletions(-)
create mode 100644 tests/nodedevschemadata/pci_8086_4238_pcie_wireless.xml
--
1.9.3
10 years, 5 months
[libvirt] [PATCH v2] Added example script on how to convert LXC container config
by Cédric Bosdonnat
---
Makefile.am | 2 +-
configure.ac | 1 +
examples/lxcconvert/Makefile.am | 18 ++++++
examples/lxcconvert/virt-lxc-convert | 108 +++++++++++++++++++++++++++++++++++
4 files changed, 128 insertions(+), 1 deletion(-)
create mode 100644 examples/lxcconvert/Makefile.am
create mode 100644 examples/lxcconvert/virt-lxc-convert
diff --git a/Makefile.am b/Makefile.am
index 9847ff0..0ef983f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,7 +23,7 @@ SUBDIRS = . gnulib/lib include src daemon tools docs gnulib/tests \
tests po examples/object-events examples/hellolibvirt \
examples/dominfo examples/domsuspend examples/apparmor \
examples/xml/nwfilter examples/openauth examples/systemtap \
- tools/wireshark
+ examples/lxcconvert tools/wireshark
ACLOCAL_AMFLAGS = -I m4
diff --git a/configure.ac b/configure.ac
index 73efffa..f84d4bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2699,6 +2699,7 @@ AC_CONFIG_FILES([\
examples/hellolibvirt/Makefile \
examples/systemtap/Makefile \
examples/xml/nwfilter/Makefile \
+ examples/lxcconvert/Makefile \
tools/wireshark/Makefile \
tools/wireshark/src/Makefile])
AC_OUTPUT
diff --git a/examples/lxcconvert/Makefile.am b/examples/lxcconvert/Makefile.am
new file mode 100644
index 0000000..09cf5d9
--- /dev/null
+++ b/examples/lxcconvert/Makefile.am
@@ -0,0 +1,18 @@
+## Copyright (C) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library. If not, see
+## <http://www.gnu.org/licenses/>.
+
+EXTRA_DIST= \
+ virt-lxc-convert
diff --git a/examples/lxcconvert/virt-lxc-convert b/examples/lxcconvert/virt-lxc-convert
new file mode 100644
index 0000000..a6c5721
--- /dev/null
+++ b/examples/lxcconvert/virt-lxc-convert
@@ -0,0 +1,108 @@
+#!/bin/sh
+
+handler_cleanup()
+{
+ if ! test -z "$conf_dir"; then
+ # Remove the temporary config
+ rm -r "$conf_dir"
+ fi
+}
+trap handler_cleanup INT EXIT
+
+show_help()
+{
+ cat << EOF
+$0 /path/to/lxc/config/file
+
+Wrapper around virsh domxml-from-native to ease conversion of LXC
+containers configuration to libvirt domain XML.
+EOF
+}
+
+if test $# != 1; then
+ show_help
+ exit 1
+fi
+
+if test "$1" = "--help" || test "$1" = "-h"; then
+ show_help
+ exit $?
+fi
+
+conf=$1
+
+conf_dir=$(mktemp --tmpdir -d virt-lxc-convert-XXX)
+conf_new=$conf_dir/config
+
+cp "$conf" "$conf_new"
+
+# Do we have lxc.mount, and is it pointing to a readable file?
+fstab=$(sed -n '/lxc.mount[[:space:]]*=/ s/[[:space:]]*=[[:space:]]*/=/p' \
+ "$conf_new" | cut -f 2 -d '=')
+if test -n "$fstab" && test -r "$fstab"; then
+ sed 's/^lxc.mount[[:space:]]*=.*$//' "$conf_new" >"${conf_new}.tmp"
+ mv "${conf_new}.tmp" "${conf_new}"
+ sed 's/^\([^#]\)/lxc.mount.entry = \1/' "$fstab" >>"${conf_new}"
+fi
+
+memory=$(free | sed -n '/Mem:/s/ \+/ /gp' | cut -f 2 -d ' ')
+default_tmpfs="size=$((memory/2))"
+
+# Do we have tmpfs without size param?
+lineno=0
+while read line; do
+ lineno=$(expr $lineno + 1)
+ has_rel_size=false
+ case $line in
+ lxc.mount.entry[[:space:]]*=[[:space:]]*tmpfs[[:space:]]*)
+ is_tmpfs=true
+ ;;
+ *)
+ is_tmpfs=false
+ ;;
+ esac
+
+ # We only care about tmpfs mount entries here
+ if ! $is_tmpfs; then
+ continue
+ fi
+
+ case $line in
+ *size=[0-9][0-9]*%*)
+ has_rel_size=true
+ has_size=true
+ ;;
+ *size=*)
+ has_size=true
+ ;;
+ *)
+ has_size=false
+ ;;
+ esac
+
+ # Add the default size here (50%) if no size is given
+ if ! $has_size; then
+ last_option_match="\([[:space:]]*[0-9][[:space:]]*[0-9][::space::]*$\)"
+ sed "${lineno}s/$last_option_match/,$default_tmpfs\1/" \
+ "$conf_new" >"${conf_new}.tmp"
+ mv "${conf_new}.tmp" "${conf_new}"
+ fi
+
+ # Convert relative sizes
+ if $has_rel_size; then
+ percent=$(echo "$line" | sed 's/.*size=\([0-9][0-9]*\)%.*/\1/')
+ size="$((memory*percent/100))"
+ sed "${lineno}s/size=[0-9]*%/size=${size}/" \
+ "$conf_new" >"${conf_new}.tmp"
+ mv "${conf_new}.tmp" "${conf_new}"
+ fi
+done < "$conf_new"
+
+# Do we have any memory limit set?
+mem_limit=$(grep 'lxc.cgroup.memory.limit_in_bytes[[:space:]]*=' $conf_new)
+if test -z "$mem_limit"; then
+ echo "lxc.cgroup.memory.limit_in_bytes = $memory" >> "$conf_new"
+fi
+
+virsh -c lxc:/// domxml-from-native lxc-tools $conf_new
+exit $?
--
1.8.4.5
10 years, 5 months
[libvirt] [PATCH] Increase the size of REMOTE_MIGRATE_COOKIE_MAX to REMOTE_STRING_MAX
by Shivaprasad G Bhat
During guest migration, if the domain xml is bigger than 16384 which is
easily possible for a guest with good number of disks, message encode fails
for xdr_remote_domain_migrate_perform3_ret().
So, Increase the COOKIE_MAX to STRING_MAX value.
Signed-off-by: Shivaprasad G Bhat <shivaprasadbhat(a)gmail.com>
---
src/remote/remote_protocol.x | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 1f9d583..ab9b83d 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -86,7 +86,7 @@ const REMOTE_VCPUINFO_MAX = 16384;
const REMOTE_CPUMAPS_MAX = 8388608;
/* Upper limit on migrate cookie. */
-const REMOTE_MIGRATE_COOKIE_MAX = 16384;
+const REMOTE_MIGRATE_COOKIE_MAX = 4194304;
/* Upper limit on lists of networks. */
const REMOTE_NETWORK_LIST_MAX = 16384;
10 years, 5 months
[libvirt] storage conf: Add key-value options to storage pools
by Wido den Hollander
This series of patches adds the ability to pass down options to the
storage pool drivers.
In the case of NFS users can specify mount options and in the case of
RBD users can specify options for librados to influence some behavior.
All options and values are checked on input validity to prevent injection
of malicious commands.
--
Wido den Hollander
10 years, 5 months
[libvirt] [PATCHv3 00/36] Network backed backing chains and block jobs
by Peter Krempa
First 7 patches of v2 are already pushed. First ~6 patches of this series
were already ACKed, but can't be pushed due to the freeze and
rebase conflicts of changing order of the patches. Thus I'm reposting
them.
Peter Krempa (36):
storage: backend: Add unique id retrieval API
storage: Add API to check accessibility of storage volumes
storage: Move virStorageFileGetMetadata to the storage driver
storage: Determine the local storage type right away
test: storage: Initialize storage source to correct type
storage: backend: Add possibility to suppress errors from backend
lookup
storage: Switch metadata crawler to use storage driver to get unique
path
storage: Switch metadata crawler to use storage driver to read headers
storage: Switch metadata crawler to use storage driver file access
check
storage: Add infrastructure to parse remote network backing names
storage: Change to new backing store parser
storage: Traverse backing chains of network disks
util: string: Return element count from virStringSplit
util: string: Add helper to free non-NULL terminated string arrays
util: storagefile: Add helper to resolve "../", "./" and "////" in
paths
util: storage: Add helper to resolve relative path difference
util: storagefile: Add canonicalization to virStorageFileSimplifyPath
storage: gluster: Add backend to return unique storage file path
qemu: json: Add format strings for optional command arguments
tests: storagetest: Unify and reformat storage chain format string
tests: virstoragetest: Remove "expBackingStore" field
tests: virstoragetest: Fix output when hitting errors
storage: Store relative path only for relatively backed storage
tests: virstoragetest: Remove now unused pathAbs
util: storage: Remove now redundant backingRelative from
virStorageSource
tests: virstoragetest: Don't test relative start of backing chains
tests: virstoragetest: Remove unneeded relative test plumbing
storage: Don't canonicalize paths unnecessarily
storage: Don't store parent directory of an image explicitly
qemu: monitor: Add argument for specifying backing name for block
commit
qemu: monitor: Add support for backing name specification for
block-stream
lib: Introduce flag VIR_DOMAIN_BLOCK_COMMIT_RELATIVE
lib: Introduce flag VIR_DOMAIN_BLOCK_REBASE_RELATIVE
qemu: caps: Add capability for change-backing-file command
qemu: Add support for networked disks for block commit
qemu: Add support for networked disks for block pull/block rebase
cfg.mk | 2 +-
include/libvirt/libvirt.h.in | 6 +
src/Makefile.am | 2 +
src/libvirt_private.syms | 7 +-
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_domain.c | 10 +-
src/qemu/qemu_driver.c | 79 +++-
src/qemu/qemu_migration.c | 6 +-
src/qemu/qemu_monitor.c | 21 +-
src/qemu/qemu_monitor.h | 4 +-
src/qemu/qemu_monitor_json.c | 139 ++++--
src/qemu/qemu_monitor_json.h | 2 +
src/security/virt-aa-helper.c | 2 +
src/storage/storage_backend.c | 16 +-
src/storage/storage_backend.h | 12 +-
src/storage/storage_backend_fs.c | 62 +++
src/storage/storage_backend_gluster.c | 92 ++++
src/storage/storage_driver.c | 212 +++++++++
src/storage/storage_driver.h | 7 +
src/util/virstoragefile.c | 822 +++++++++++++++++++++++-----------
src/util/virstoragefile.h | 34 +-
src/util/virstring.c | 44 +-
src/util/virstring.h | 7 +
tests/Makefile.am | 8 +-
tests/qemumonitorjsontest.c | 2 +-
tests/virstoragetest.c | 491 +++++++++++++-------
tests/virstringtest.c | 14 +-
tools/virsh-domain.c | 29 +-
tools/virsh.pod | 10 +-
30 files changed, 1633 insertions(+), 512 deletions(-)
--
1.9.3
10 years, 5 months