[libvirt] [PATCH] vmx: Add support for video device VRAM size
by Matthias Bolte
Update test suite accordingly.
---
src/vmx/vmx.c | 110 ++++++++++++++++++++
src/vmx/vmx.h | 4 +
tests/vmx2xmldata/vmx2xml-annotation.xml | 3 +
tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml | 3 +
tests/vmx2xmldata/vmx2xml-case-insensitive-2.xml | 3 +
tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml | 3 +
tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml | 3 +
tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml | 3 +
tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml | 3 +
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-1.xml | 3 +
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml | 3 +
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml | 3 +
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-4.xml | 3 +
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml | 3 +
tests/vmx2xmldata/vmx2xml-ethernet-bridged.xml | 3 +
tests/vmx2xmldata/vmx2xml-ethernet-custom.xml | 3 +
tests/vmx2xmldata/vmx2xml-ethernet-e1000.xml | 3 +
tests/vmx2xmldata/vmx2xml-ethernet-generated.xml | 3 +
tests/vmx2xmldata/vmx2xml-ethernet-other.xml | 3 +
tests/vmx2xmldata/vmx2xml-ethernet-static.xml | 3 +
tests/vmx2xmldata/vmx2xml-ethernet-vmxnet2.xml | 3 +
tests/vmx2xmldata/vmx2xml-ethernet-vpx.xml | 3 +
tests/vmx2xmldata/vmx2xml-floppy-device.xml | 3 +
tests/vmx2xmldata/vmx2xml-floppy-file.xml | 3 +
tests/vmx2xmldata/vmx2xml-graphics-vnc.xml | 3 +
tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-1.xml | 3 +
tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-2.xml | 3 +
tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-3.xml | 3 +
tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-4.xml | 3 +
tests/vmx2xmldata/vmx2xml-harddisk-ide-file.xml | 3 +
tests/vmx2xmldata/vmx2xml-harddisk-scsi-file.xml | 3 +
tests/vmx2xmldata/vmx2xml-minimal-64bit.xml | 3 +
tests/vmx2xmldata/vmx2xml-minimal.xml | 3 +
tests/vmx2xmldata/vmx2xml-parallel-device.xml | 3 +
tests/vmx2xmldata/vmx2xml-parallel-file.xml | 3 +
tests/vmx2xmldata/vmx2xml-scsi-driver.xml | 3 +
tests/vmx2xmldata/vmx2xml-scsi-writethrough.xml | 3 +
tests/vmx2xmldata/vmx2xml-serial-device.xml | 3 +
tests/vmx2xmldata/vmx2xml-serial-file.xml | 3 +
.../vmx2xmldata/vmx2xml-serial-network-client.xml | 3 +
.../vmx2xmldata/vmx2xml-serial-network-server.xml | 3 +
tests/vmx2xmldata/vmx2xml-serial-pipe.xml | 3 +
tests/vmx2xmldata/vmx2xml-smbios.xml | 3 +
tests/vmx2xmldata/vmx2xml-svga.vmx | 3 +
tests/vmx2xmldata/vmx2xml-svga.xml | 18 +++
tests/vmx2xmltest.c | 2 +
tests/xml2vmxdata/xml2vmx-graphics-vnc.vmx | 1 +
tests/xml2vmxdata/xml2vmx-svga.vmx | 11 ++
tests/xml2vmxdata/xml2vmx-svga.xml | 13 +++
tests/xml2vmxtest.c | 2 +
50 files changed, 287 insertions(+), 0 deletions(-)
create mode 100644 tests/vmx2xmldata/vmx2xml-svga.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-svga.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-svga.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-svga.xml
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 6e3e9af..76cc16a 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -326,6 +326,16 @@ def->nets[0]...
################################################################################
+## video #######################################################################
+
+def->videos[0]...
+->type = _VIDEO_TYPE_VMVGA
+->vram = <value kilobyte> <=> svga.vramSize = "<value byte>"
+->heads = 1
+
+
+
+################################################################################
## serials #####################################################################
serial[0..3] -> <port>
@@ -1636,6 +1646,20 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx)
/* def:inputs */
/* FIXME */
+ /* def:videos */
+ if (VIR_ALLOC_N(def->videos, 1) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ def->nvideos = 0;
+
+ if (virVMXParseSVGA(conf, &def->videos[def->nvideos]) < 0) {
+ goto cleanup;
+ }
+
+ def->nvideos = 1;
+
/* def:sounds */
/* FIXME */
@@ -2765,6 +2789,45 @@ virVMXParseParallel(virVMXContext *ctx, virConfPtr conf, int port,
+int
+virVMXParseSVGA(virConfPtr conf, virDomainVideoDefPtr *def)
+{
+ int result = -1;
+ long long svga_vramSize = 0;
+
+ if (def == NULL || *def != NULL) {
+ VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
+ return -1;
+ }
+
+ if (VIR_ALLOC(*def) < 0) {
+ virReportOOMError();
+ return -1;
+ }
+
+ (*def)->type = VIR_DOMAIN_VIDEO_TYPE_VMVGA;
+
+ /* vmx:vramSize */
+ if (virVMXGetConfigLong(conf, "svga.vramSize", &svga_vramSize,
+ 4 * 1024 * 1024, true) < 0) {
+ goto cleanup;
+ }
+
+ (*def)->vram = svga_vramSize / 1024; /* Scale from bytes to kilobytes */
+
+ result = 0;
+
+ cleanup:
+ if (result < 0) {
+ virDomainVideoDefFree(*def);
+ *def = NULL;
+ }
+
+ return result;
+}
+
+
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Domain XML -> VMX
*/
@@ -3064,6 +3127,19 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def,
/* def:sounds */
/* FIXME */
+ /* def:videos */
+ if (def->nvideos > 0) {
+ if (def->nvideos > 1) {
+ VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("No support for multiple video devices"));
+ goto cleanup;
+ }
+
+ if (virVMXFormatSVGA(def->videos[0], &buffer) < 0) {
+ goto cleanup;
+ }
+ }
+
/* def:hostdevs */
/* FIXME */
@@ -3645,3 +3721,37 @@ virVMXFormatParallel(virVMXContext *ctx, virDomainChrDefPtr def,
return 0;
}
+
+
+
+int
+virVMXFormatSVGA(virDomainVideoDefPtr def, virBufferPtr buffer)
+{
+ if (def->type != VIR_DOMAIN_VIDEO_TYPE_VMVGA) {
+ VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
+ _("Unsupported video device type '%s'"),
+ virDomainVideoTypeToString(def->type));
+ return -1;
+ }
+
+ /*
+ * For Windows guests the VRAM size should be a multiple of 64 kilobyte.
+ * See http://kb.vmware.com/kb/1003 and http://kb.vmware.com/kb/1001558
+ */
+ if (def->vram % 64 != 0) {
+ VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Video device VRAM size must be a multiple of 64 kilobyte"));
+ return -1;
+ }
+
+ if (def->heads > 1) {
+ VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Multi-head video devices are unsupported"));
+ return -1;
+ }
+
+ virBufferVSprintf(buffer, "svga.vramSize = \"%d\"\n",
+ def->vram * 1024); /* Scale from kilobytes to bytes */
+
+ return 0;
+}
diff --git a/src/vmx/vmx.h b/src/vmx/vmx.h
index 1a4fd9c..c317108 100644
--- a/src/vmx/vmx.h
+++ b/src/vmx/vmx.h
@@ -100,6 +100,8 @@ int virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
int virVMXParseParallel(virVMXContext *ctx, virConfPtr conf, int port,
virDomainChrDefPtr *def);
+int virVMXParseSVGA(virConfPtr conf, virDomainVideoDefPtr *def);
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -129,4 +131,6 @@ int virVMXFormatSerial(virVMXContext *ctx, virDomainChrDefPtr def,
int virVMXFormatParallel(virVMXContext *ctx, virDomainChrDefPtr def,
virBufferPtr buffer);
+int virVMXFormatSVGA(virDomainVideoDefPtr def, virBufferPtr buffer);
+
#endif /* __VIR_VMX_H__ */
diff --git a/tests/vmx2xmldata/vmx2xml-annotation.xml b/tests/vmx2xmldata/vmx2xml-annotation.xml
index 1af45aa..f42f77b 100644
--- a/tests/vmx2xmldata/vmx2xml-annotation.xml
+++ b/tests/vmx2xmldata/vmx2xml-annotation.xml
@@ -12,5 +12,8 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml b/tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml
index b47e128..7a5ff5b 100644
--- a/tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml
+++ b/tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml
@@ -22,5 +22,8 @@
<mac address='00:50:56:91:48:c7'/>
<source bridge='VM NETWORK'/>
</interface>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-case-insensitive-2.xml b/tests/vmx2xmldata/vmx2xml-case-insensitive-2.xml
index 4974f4e..18d6461 100644
--- a/tests/vmx2xmldata/vmx2xml-case-insensitive-2.xml
+++ b/tests/vmx2xmldata/vmx2xml-case-insensitive-2.xml
@@ -22,5 +22,8 @@
<mac address='00:50:56:91:48:c7'/>
<source bridge='vm network'/>
</interface>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml b/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml
index 1905f9b..e11d2f9 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml
@@ -17,5 +17,8 @@
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<controller type='ide' index='0'/>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml b/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml
index b9cf1f9..d1fb690 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml
@@ -17,5 +17,8 @@
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<controller type='ide' index='0'/>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml
index 1bb42be..7eb3676 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml
@@ -17,5 +17,8 @@
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<controller type='scsi' index='0'/>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml
index bdcb0b0..df1e7c4 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml
@@ -17,5 +17,8 @@
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<controller type='scsi' index='0'/>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-1.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-1.xml
index fd50008..5e67e74 100644
--- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-1.xml
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-1.xml
@@ -22,5 +22,8 @@
<mac address='00:50:56:91:48:c7'/>
<source bridge='VM Network'/>
</interface>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml
index e98b679..23fc1f6 100644
--- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml
@@ -52,5 +52,8 @@
<source bridge='VM Network'/>
<model type='vlance'/>
</interface>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml
index 6d18209..e193fdb 100644
--- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml
@@ -34,5 +34,8 @@
<mac address='00:0c:29:f5:c3:0c'/>
<source bridge='VM Network'/>
</interface>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-4.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-4.xml
index 4238882..419df51 100644
--- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-4.xml
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-4.xml
@@ -38,5 +38,8 @@
<source path='[498076b2-02796c1a-ef5b-000ae484a6a3] virtMonServ1/serial1.file'/>
<target type='serial' port='0'/>
</console>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml
index d55bf6b..0040163 100644
--- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml
@@ -33,5 +33,8 @@
<source bridge='VM-LAN'/>
<model type='e1000'/>
</interface>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-ethernet-bridged.xml b/tests/vmx2xmldata/vmx2xml-ethernet-bridged.xml
index 7ef2d3d..cec329d 100644
--- a/tests/vmx2xmldata/vmx2xml-ethernet-bridged.xml
+++ b/tests/vmx2xmldata/vmx2xml-ethernet-bridged.xml
@@ -15,5 +15,8 @@
<mac address='00:50:56:11:22:33'/>
<source bridge='VM Network'/>
</interface>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-ethernet-custom.xml b/tests/vmx2xmldata/vmx2xml-ethernet-custom.xml
index e08a450..8c7b833 100644
--- a/tests/vmx2xmldata/vmx2xml-ethernet-custom.xml
+++ b/tests/vmx2xmldata/vmx2xml-ethernet-custom.xml
@@ -16,5 +16,8 @@
<source bridge='VM Network'/>
<target dev='vmnet7'/>
</interface>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-ethernet-e1000.xml b/tests/vmx2xmldata/vmx2xml-ethernet-e1000.xml
index 1e64c52..9b356ea 100644
--- a/tests/vmx2xmldata/vmx2xml-ethernet-e1000.xml
+++ b/tests/vmx2xmldata/vmx2xml-ethernet-e1000.xml
@@ -16,5 +16,8 @@
<source bridge='VM Network'/>
<model type='e1000'/>
</interface>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-ethernet-generated.xml b/tests/vmx2xmldata/vmx2xml-ethernet-generated.xml
index ffb203b..aead831 100644
--- a/tests/vmx2xmldata/vmx2xml-ethernet-generated.xml
+++ b/tests/vmx2xmldata/vmx2xml-ethernet-generated.xml
@@ -15,5 +15,8 @@
<mac address='00:0c:29:11:22:33'/>
<source bridge='VM Network'/>
</interface>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-ethernet-other.xml b/tests/vmx2xmldata/vmx2xml-ethernet-other.xml
index 4c44fbc..a746115 100644
--- a/tests/vmx2xmldata/vmx2xml-ethernet-other.xml
+++ b/tests/vmx2xmldata/vmx2xml-ethernet-other.xml
@@ -15,5 +15,8 @@
<mac address='00:12:34:56:78:90'/>
<source bridge='VM Network'/>
</interface>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-ethernet-static.xml b/tests/vmx2xmldata/vmx2xml-ethernet-static.xml
index 7ef2d3d..cec329d 100644
--- a/tests/vmx2xmldata/vmx2xml-ethernet-static.xml
+++ b/tests/vmx2xmldata/vmx2xml-ethernet-static.xml
@@ -15,5 +15,8 @@
<mac address='00:50:56:11:22:33'/>
<source bridge='VM Network'/>
</interface>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-ethernet-vmxnet2.xml b/tests/vmx2xmldata/vmx2xml-ethernet-vmxnet2.xml
index 090f7ce..b7773ad 100644
--- a/tests/vmx2xmldata/vmx2xml-ethernet-vmxnet2.xml
+++ b/tests/vmx2xmldata/vmx2xml-ethernet-vmxnet2.xml
@@ -16,5 +16,8 @@
<source bridge='VM Network'/>
<model type='vmxnet2'/>
</interface>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-ethernet-vpx.xml b/tests/vmx2xmldata/vmx2xml-ethernet-vpx.xml
index 1d90f31..bdc8d8c 100644
--- a/tests/vmx2xmldata/vmx2xml-ethernet-vpx.xml
+++ b/tests/vmx2xmldata/vmx2xml-ethernet-vpx.xml
@@ -15,5 +15,8 @@
<mac address='00:50:56:87:65:43'/>
<source bridge='VM Network'/>
</interface>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-floppy-device.xml b/tests/vmx2xmldata/vmx2xml-floppy-device.xml
index 4ae16d5..824849a 100644
--- a/tests/vmx2xmldata/vmx2xml-floppy-device.xml
+++ b/tests/vmx2xmldata/vmx2xml-floppy-device.xml
@@ -17,5 +17,8 @@
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<controller type='fdc' index='0'/>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-floppy-file.xml b/tests/vmx2xmldata/vmx2xml-floppy-file.xml
index 5ab538e..75d0d62 100644
--- a/tests/vmx2xmldata/vmx2xml-floppy-file.xml
+++ b/tests/vmx2xmldata/vmx2xml-floppy-file.xml
@@ -17,5 +17,8 @@
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<controller type='fdc' index='0'/>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-graphics-vnc.xml b/tests/vmx2xmldata/vmx2xml-graphics-vnc.xml
index 159324d..047e034 100644
--- a/tests/vmx2xmldata/vmx2xml-graphics-vnc.xml
+++ b/tests/vmx2xmldata/vmx2xml-graphics-vnc.xml
@@ -13,5 +13,8 @@
<devices>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='5903' autoport='no' keymap='de' passwd='password'/>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-1.xml b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-1.xml
index 0c308bc..b572ad1 100644
--- a/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-1.xml
+++ b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-1.xml
@@ -23,5 +23,8 @@
<source bridge='net1'/>
<target dev='/dev/vmnet1'/>
</interface>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-2.xml b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-2.xml
index 7b6158f..180cf68 100644
--- a/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-2.xml
+++ b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-2.xml
@@ -23,5 +23,8 @@
<source bridge='net1'/>
<target dev='/dev/vmnet1'/>
</interface>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-3.xml b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-3.xml
index b926db5..571c83a 100644
--- a/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-3.xml
+++ b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-3.xml
@@ -28,5 +28,8 @@
<source bridge='net2'/>
<target dev='/dev/vmnet2'/>
</interface>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-4.xml b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-4.xml
index 5803f4b..fc3b966 100644
--- a/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-4.xml
+++ b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-4.xml
@@ -23,5 +23,8 @@
<source bridge='net2'/>
<target dev='/dev/vmnet2'/>
</interface>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-harddisk-ide-file.xml b/tests/vmx2xmldata/vmx2xml-harddisk-ide-file.xml
index 7699fbb..72a5c1f 100644
--- a/tests/vmx2xmldata/vmx2xml-harddisk-ide-file.xml
+++ b/tests/vmx2xmldata/vmx2xml-harddisk-ide-file.xml
@@ -17,5 +17,8 @@
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<controller type='ide' index='0'/>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-harddisk-scsi-file.xml b/tests/vmx2xmldata/vmx2xml-harddisk-scsi-file.xml
index b04597b..189e72d 100644
--- a/tests/vmx2xmldata/vmx2xml-harddisk-scsi-file.xml
+++ b/tests/vmx2xmldata/vmx2xml-harddisk-scsi-file.xml
@@ -17,5 +17,8 @@
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<controller type='scsi' index='0'/>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-minimal-64bit.xml b/tests/vmx2xmldata/vmx2xml-minimal-64bit.xml
index cec8ba0..188d31a 100644
--- a/tests/vmx2xmldata/vmx2xml-minimal-64bit.xml
+++ b/tests/vmx2xmldata/vmx2xml-minimal-64bit.xml
@@ -11,5 +11,8 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-minimal.xml b/tests/vmx2xmldata/vmx2xml-minimal.xml
index acfd9bd..ce2cfd6 100644
--- a/tests/vmx2xmldata/vmx2xml-minimal.xml
+++ b/tests/vmx2xmldata/vmx2xml-minimal.xml
@@ -11,5 +11,8 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-parallel-device.xml b/tests/vmx2xmldata/vmx2xml-parallel-device.xml
index 28c2302..bc288a6 100644
--- a/tests/vmx2xmldata/vmx2xml-parallel-device.xml
+++ b/tests/vmx2xmldata/vmx2xml-parallel-device.xml
@@ -15,5 +15,8 @@
<source path='/dev/parallel0'/>
<target port='0'/>
</parallel>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-parallel-file.xml b/tests/vmx2xmldata/vmx2xml-parallel-file.xml
index 340cf4e..ad7a65f 100644
--- a/tests/vmx2xmldata/vmx2xml-parallel-file.xml
+++ b/tests/vmx2xmldata/vmx2xml-parallel-file.xml
@@ -15,5 +15,8 @@
<source path='[datastore] directory/parallel0.file'/>
<target port='0'/>
</parallel>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-scsi-driver.xml b/tests/vmx2xmldata/vmx2xml-scsi-driver.xml
index 553783b..8fa907b 100644
--- a/tests/vmx2xmldata/vmx2xml-scsi-driver.xml
+++ b/tests/vmx2xmldata/vmx2xml-scsi-driver.xml
@@ -35,5 +35,8 @@
<controller type='scsi' index='1' model='lsilogic'/>
<controller type='scsi' index='2' model='lsisas1068'/>
<controller type='scsi' index='3' model='vmpvscsi'/>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-scsi-writethrough.xml b/tests/vmx2xmldata/vmx2xml-scsi-writethrough.xml
index 66e22ae..e5b8934 100644
--- a/tests/vmx2xmldata/vmx2xml-scsi-writethrough.xml
+++ b/tests/vmx2xmldata/vmx2xml-scsi-writethrough.xml
@@ -18,5 +18,8 @@
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<controller type='scsi' index='0' model='buslogic'/>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-serial-device.xml b/tests/vmx2xmldata/vmx2xml-serial-device.xml
index c9f00eb..51fd06f 100644
--- a/tests/vmx2xmldata/vmx2xml-serial-device.xml
+++ b/tests/vmx2xmldata/vmx2xml-serial-device.xml
@@ -19,5 +19,8 @@
<source path='/dev/ttyS0'/>
<target type='serial' port='0'/>
</console>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-serial-file.xml b/tests/vmx2xmldata/vmx2xml-serial-file.xml
index 21b6263..25ade07 100644
--- a/tests/vmx2xmldata/vmx2xml-serial-file.xml
+++ b/tests/vmx2xmldata/vmx2xml-serial-file.xml
@@ -19,5 +19,8 @@
<source path='[datastore] directory/serial0.file'/>
<target type='serial' port='0'/>
</console>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-serial-network-client.xml b/tests/vmx2xmldata/vmx2xml-serial-network-client.xml
index b0c0715..7573a11 100644
--- a/tests/vmx2xmldata/vmx2xml-serial-network-client.xml
+++ b/tests/vmx2xmldata/vmx2xml-serial-network-client.xml
@@ -21,5 +21,8 @@
<protocol type='raw'/>
<target type='serial' port='0'/>
</console>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-serial-network-server.xml b/tests/vmx2xmldata/vmx2xml-serial-network-server.xml
index e151017..ed38495 100644
--- a/tests/vmx2xmldata/vmx2xml-serial-network-server.xml
+++ b/tests/vmx2xmldata/vmx2xml-serial-network-server.xml
@@ -21,5 +21,8 @@
<protocol type='telnets'/>
<target type='serial' port='0'/>
</console>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-serial-pipe.xml b/tests/vmx2xmldata/vmx2xml-serial-pipe.xml
index cf8a797..ca5196c 100644
--- a/tests/vmx2xmldata/vmx2xml-serial-pipe.xml
+++ b/tests/vmx2xmldata/vmx2xml-serial-pipe.xml
@@ -19,5 +19,8 @@
<source path='serial0.pipe'/>
<target type='serial' port='0'/>
</console>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-smbios.xml b/tests/vmx2xmldata/vmx2xml-smbios.xml
index db13001..d78ac6c 100644
--- a/tests/vmx2xmldata/vmx2xml-smbios.xml
+++ b/tests/vmx2xmldata/vmx2xml-smbios.xml
@@ -12,5 +12,8 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
</devices>
</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-svga.vmx b/tests/vmx2xmldata/vmx2xml-svga.vmx
new file mode 100644
index 0000000..081d6ce
--- /dev/null
+++ b/tests/vmx2xmldata/vmx2xml-svga.vmx
@@ -0,0 +1,3 @@
+config.version = "8"
+virtualHW.version = "4"
+svga.vramSize = "8388608"
diff --git a/tests/vmx2xmldata/vmx2xml-svga.xml b/tests/vmx2xmldata/vmx2xml-svga.xml
new file mode 100644
index 0000000..664eba4
--- /dev/null
+++ b/tests/vmx2xmldata/vmx2xml-svga.xml
@@ -0,0 +1,18 @@
+<domain type='vmware'>
+ <uuid>00000000-0000-0000-0000-000000000000</uuid>
+ <memory>32768</memory>
+ <currentMemory>32768</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686'>hvm</type>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <video>
+ <model type='vmvga' vram='8192'/>
+ </video>
+ </devices>
+</domain>
diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
index 9378db3..5fed1c4 100644
--- a/tests/vmx2xmltest.c
+++ b/tests/vmx2xmltest.c
@@ -285,6 +285,8 @@ mymain(int argc, char **argv)
DO_TEST("smbios", "smbios");
+ DO_TEST("svga", "svga");
+
virCapabilitiesFree(caps);
return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/tests/xml2vmxdata/xml2vmx-graphics-vnc.vmx b/tests/xml2vmxdata/xml2vmx-graphics-vnc.vmx
index caab06a..493e0cc 100644
--- a/tests/xml2vmxdata/xml2vmx-graphics-vnc.vmx
+++ b/tests/xml2vmxdata/xml2vmx-graphics-vnc.vmx
@@ -12,3 +12,4 @@ RemoteDisplay.vnc.keymap = "de"
RemoteDisplay.vnc.password = "password"
floppy0.present = "false"
floppy1.present = "false"
+svga.vramSize = "4194304"
diff --git a/tests/xml2vmxdata/xml2vmx-svga.vmx b/tests/xml2vmxdata/xml2vmx-svga.vmx
new file mode 100644
index 0000000..4bd4870
--- /dev/null
+++ b/tests/xml2vmxdata/xml2vmx-svga.vmx
@@ -0,0 +1,11 @@
+.encoding = "UTF-8"
+config.version = "8"
+virtualHW.version = "4"
+guestOS = "other"
+uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
+displayName = "minimal"
+memsize = "4"
+numvcpus = "1"
+floppy0.present = "false"
+floppy1.present = "false"
+svga.vramSize = "8388608"
diff --git a/tests/xml2vmxdata/xml2vmx-svga.xml b/tests/xml2vmxdata/xml2vmx-svga.xml
new file mode 100644
index 0000000..b7db4c8
--- /dev/null
+++ b/tests/xml2vmxdata/xml2vmx-svga.xml
@@ -0,0 +1,13 @@
+<domain type='vmware'>
+ <name>minimal</name>
+ <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid>
+ <memory>4096</memory>
+ <os>
+ <type>hvm</type>
+ </os>
+ <devices>
+ <video>
+ <model type='vmvga' vram='8192'/>
+ </video>
+ </devices>
+</domain>
diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
index 6a39582..a5fb4f7 100644
--- a/tests/xml2vmxtest.c
+++ b/tests/xml2vmxtest.c
@@ -296,6 +296,8 @@ mymain(int argc, char **argv)
DO_TEST("smbios", "smbios", 4);
+ DO_TEST("svga", "svga", 4);
+
virCapabilitiesFree(caps);
return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
--
1.7.0.4
13 years, 10 months
[libvirt] [00/15] Re-factoring XDR RPC code v2
by Daniel P. Berrange
A followup to
http://www.redhat.com/archives/libvir-list/2010-December/msg00051.html
Since that time
- The SASL/TLS I/O code has been integrated into the virNetSocket
class directly to remove duplication between client&servers
- libvirtd has been converted to use the new APIs
- Error handling has been sanitized across libvirtd to use the
normal virReportError APIs
- A couple of test cases have been written
- Many locking, ref counting & ramdom crash bugs fixed
- Some basic interoperability testing against previous code
This is still not quite functionally complete, so not ready to
apply. The missing pieces are
- Make the client side streams code work again
- Re-integrate DTrace probes in libvirtd
Daniel
13 years, 10 months
[libvirt] [PATCH] bridge_driver: use conffile for dnsmasq if it exists
by Paweł Krześniak
By default dnsmasq is spawned with option --conf-file="" which disables
reading of global configuration file -- this is fine for most situations.
This patch adds possibility to run customized DNS/DHCP environment, by
spawning dnsmasq with alternative configuration file if such file exists.
This allows you to set any parameter described in dnsmasq(8).
Configuration file is expected to be located in file named
"<network_name>-dnsmasq.conf" in DNSMASQ_STATE_DIR directory.
If configuration file doesn't exists dnsmasq is spawned as before.
Patch should be applied after my earlier one.
---
src/network/bridge_driver.c | 26 +++++++++++++++++++-------
1 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index f2857b4..702ec95 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -391,6 +391,7 @@ networkSaveDnsmasqHostsfile(virNetworkObjPtr network,
static int
networkBuildDnsmasqArgv(virNetworkObjPtr network,
const char *pidfile,
+ const char *conffile,
virCommandPtr cmd) {
int r, ret = -1;
int nbleases = 0;
@@ -428,8 +429,11 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network,
virCommandAddArgPair(cmd, "--pid-file", pidfile);
- /* *no* conf file */
- virCommandAddArgList(cmd, "--conf-file=", "", NULL);
+ /* if conf file exists use it */
+ if (virFileExists(conffile))
+ virCommandAddArgPair(cmd, "--conf-file", conffile);
+ else
+ virCommandAddArgList(cmd, "--conf-file=", "", NULL);
/*
* XXX does not actually work, due to some kind of
@@ -528,35 +532,41 @@ dhcpStartDhcpDaemon(virNetworkObjPtr network)
virCommandPtr cmd = NULL;
char *pidfile = NULL;
int ret = -1, err;
+ char *conffile = NULL;
network->dnsmasqPid = -1;
if (!VIR_SOCKET_IS_FAMILY(&network->def->ipAddress, AF_INET)) {
networkReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot start dhcp daemon without
IPv4 address for server"));
- goto cleanup2;
+ goto cleanup3;
}
if ((err = virFileMakePath(NETWORK_PID_DIR)) != 0) {
virReportSystemError(err,
_("cannot create directory %s"),
NETWORK_PID_DIR);
- goto cleanup2;
+ goto cleanup3;
}
if ((err = virFileMakePath(NETWORK_STATE_DIR)) != 0) {
virReportSystemError(err,
_("cannot create directory %s"),
NETWORK_STATE_DIR);
- goto cleanup2;
+ goto cleanup3;
}
if (!(pidfile = virFilePid(NETWORK_PID_DIR, network->def->name))) {
virReportOOMError();
+ goto cleanup3;
+ }
+
+ if (virAsprintf(&conffile, DNSMASQ_STATE_DIR "/%s-dnsmasq.conf",
network->def->name) < 0) {
+ virReportOOMError();
goto cleanup2;
}
cmd = virCommandNew(DNSMASQ);
- if (networkBuildDnsmasqArgv(network, pidfile, cmd) < 0) {
+ if (networkBuildDnsmasqArgv(network, pidfile, conffile, cmd) < 0) {
goto cleanup1;
}
@@ -577,9 +587,11 @@ dhcpStartDhcpDaemon(virNetworkObjPtr network)
ret = 0;
cleanup1:
- VIR_FREE(pidfile);
virCommandFree(cmd);
+ VIR_FREE(conffile);
cleanup2:
+ VIR_FREE(pidfile);
+cleanup3:
return ret;
}
13 years, 10 months
[libvirt] [PATCH] [v2] API: Improve log for domain related APIs
by Osier Yang
Add VM name/UUID in log for domain related APIs.
Format: "param0=%p, param1=%p, (VM: %s)"
* src/libvirt.c
---
src/libvirt.c | 293 +++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 220 insertions(+), 73 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index ee2495a..cd1cf6e 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -1961,7 +1961,9 @@ error:
virConnectPtr
virDomainGetConnect (virDomainPtr dom)
{
- DEBUG("dom=%p", dom);
+ const char *name = virDomainGetName(dom);
+
+ DEBUG("dom=%p, (VM: %s)", dom, NULLSTR(name));
virResetLastError();
@@ -2100,7 +2102,10 @@ error:
virDomainPtr
virDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
{
- DEBUG("conn=%p, uuid=%s", conn, uuid);
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+ virUUIDFormat(uuid, uuidstr);
+
+ DEBUG("conn=%p, uuid=%s", conn, uuidstr);
virResetLastError();
@@ -2226,8 +2231,9 @@ int
virDomainDestroy(virDomainPtr domain)
{
virConnectPtr conn;
+ const char *name = virDomainGetName(domain);
- DEBUG("domain=%p", domain);
+ DEBUG("domain=%p, (VM: %s)", domain, NULLSTR(name));
virResetLastError();
@@ -2270,7 +2276,9 @@ error:
int
virDomainFree(virDomainPtr domain)
{
- DEBUG("domain=%p", domain);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, (VM: %s)", domain, NULLSTR(name));
virResetLastError();
@@ -2306,13 +2314,15 @@ virDomainFree(virDomainPtr domain)
int
virDomainRef(virDomainPtr domain)
{
+ const char *name = virDomainGetName(domain);
+
if ((!VIR_IS_CONNECTED_DOMAIN(domain))) {
virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
virDispatchError(NULL);
return(-1);
}
virMutexLock(&domain->conn->lock);
- DEBUG("domain=%p refs=%d", domain, domain->refs);
+ DEBUG("domain=%p refs=%d, (VM: %s)", domain, domain->refs, NULLSTR(name));
domain->refs++;
virMutexUnlock(&domain->conn->lock);
return 0;
@@ -2335,7 +2345,9 @@ int
virDomainSuspend(virDomainPtr domain)
{
virConnectPtr conn;
- DEBUG("domain=%p", domain);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, (VM: %s)", domain, NULLSTR(name));
virResetLastError();
@@ -2380,7 +2392,9 @@ int
virDomainResume(virDomainPtr domain)
{
virConnectPtr conn;
- DEBUG("domain=%p", domain);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, (VM: %s)", domain, NULLSTR(name));
virResetLastError();
@@ -2428,7 +2442,9 @@ virDomainSave(virDomainPtr domain, const char *to)
{
char filepath[4096];
virConnectPtr conn;
- DEBUG("domain=%p, to=%s", domain, to);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, to=%s, (VM: %s)", domain, to, NULLSTR(name));
virResetLastError();
@@ -2570,7 +2586,10 @@ virDomainCoreDump(virDomainPtr domain, const char *to, int flags)
{
char filepath[4096];
virConnectPtr conn;
- DEBUG("domain=%p, to=%s, flags=%d", domain, to, flags);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, to=%s, flags=%d, (VM: %s)", domain, to, flags,
+ NULLSTR(name));
virResetLastError();
@@ -2647,7 +2666,9 @@ int
virDomainShutdown(virDomainPtr domain)
{
virConnectPtr conn;
- DEBUG("domain=%p", domain);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, (VM: %s)", domain, NULLSTR(name));
virResetLastError();
@@ -2693,7 +2714,9 @@ int
virDomainReboot(virDomainPtr domain, unsigned int flags)
{
virConnectPtr conn;
- DEBUG("domain=%p, flags=%u", domain, flags);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, flags=%u, (VM: %s)", domain, flags, NULLSTR(name));
virResetLastError();
@@ -2760,7 +2783,9 @@ virDomainGetName(virDomainPtr domain)
int
virDomainGetUUID(virDomainPtr domain, unsigned char *uuid)
{
- DEBUG("domain=%p, uuid=%p", domain, uuid);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, uuid=%p, (VM: %s)", domain, uuid, NULLSTR(name));
virResetLastError();
@@ -2794,7 +2819,9 @@ int
virDomainGetUUIDString(virDomainPtr domain, char *buf)
{
unsigned char uuid[VIR_UUID_BUFLEN];
- DEBUG("domain=%p, buf=%p", domain, buf);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, buf=%p, (VM: %s)", domain, buf, NULLSTR(name));
virResetLastError();
@@ -2830,7 +2857,9 @@ error:
unsigned int
virDomainGetID(virDomainPtr domain)
{
- DEBUG("domain=%p", domain);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, (VM: %s)", domain, NULLSTR(name));
virResetLastError();
@@ -2855,7 +2884,9 @@ char *
virDomainGetOSType(virDomainPtr domain)
{
virConnectPtr conn;
- DEBUG("domain=%p", domain);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, (VM: %s)", domain, NULLSTR(name));
virResetLastError();
@@ -2896,7 +2927,9 @@ unsigned long
virDomainGetMaxMemory(virDomainPtr domain)
{
virConnectPtr conn;
- DEBUG("domain=%p", domain);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, (VM: %s)", domain, NULLSTR(name));
virResetLastError();
@@ -2942,7 +2975,9 @@ int
virDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
{
virConnectPtr conn;
- DEBUG("domain=%p, memory=%lu", domain, memory);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, memory=%lu, (VM: %s)", domain, memory, NULLSTR(name));
virResetLastError();
@@ -2995,7 +3030,9 @@ int
virDomainSetMemory(virDomainPtr domain, unsigned long memory)
{
virConnectPtr conn;
- DEBUG("domain=%p, memory=%lu", domain, memory);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, memory=%lu, (VM: %s)", domain, memory, NULLSTR(name));
virResetLastError();
@@ -3049,7 +3086,10 @@ virDomainSetMemoryParameters(virDomainPtr domain,
int nparams, unsigned int flags)
{
virConnectPtr conn;
- DEBUG("domain=%p, params=%p, nparams=%d, flags=%u", domain, params, nparams, flags);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, params=%p, nparams=%d, flags=%u, (VM: %s)",
+ domain, params, nparams, flags, NULLSTR(name));
virResetLastError();
@@ -3123,7 +3163,10 @@ virDomainGetMemoryParameters(virDomainPtr domain,
int *nparams, unsigned int flags)
{
virConnectPtr conn;
- DEBUG("domain=%p, params=%p, nparams=%d, flags=%u", domain, params, (nparams)?*nparams:-1, flags);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, params=%p, nparams=%d, flags=%u, (VM: %s)",
+ domain, params, (nparams)?*nparams:-1, flags, NULLSTR(name));
virResetLastError();
@@ -3167,7 +3210,9 @@ int
virDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
{
virConnectPtr conn;
- DEBUG("domain=%p, info=%p", domain, info);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, info=%p, (VM: %s)", domain, info, NULLSTR(name));
virResetLastError();
@@ -3215,7 +3260,9 @@ char *
virDomainGetXMLDesc(virDomainPtr domain, int flags)
{
virConnectPtr conn;
- DEBUG("domain=%p, flags=%d", domain, flags);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, flags=%d, (VM: %s)", domain, flags, NULLSTR(name));
virResetLastError();
@@ -3662,8 +3709,10 @@ virDomainMigrate (virDomainPtr domain,
unsigned long bandwidth)
{
virDomainPtr ddomain = NULL;
- DEBUG("domain=%p, dconn=%p, flags=%lu, dname=%s, uri=%s, bandwidth=%lu",
- domain, dconn, flags, NULLSTR(dname), NULLSTR(uri), bandwidth);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, dconn=%p, flags=%lu, dname=%s, uri=%s, bandwidth=%lu, (VM: %s)",
+ domain, dconn, flags, NULLSTR(dname), NULLSTR(uri), bandwidth, NULLSTR(name));
virResetLastError();
@@ -3811,8 +3860,10 @@ virDomainMigrateToURI (virDomainPtr domain,
const char *dname,
unsigned long bandwidth)
{
- DEBUG("domain=%p, duri=%p, flags=%lu, dname=%s, bandwidth=%lu",
- domain, NULLSTR(duri), flags, NULLSTR(dname), bandwidth);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, duri=%p, flags=%lu, dname=%s, bandwidth=%lu, (VM: %s)",
+ domain, NULLSTR(duri), flags, NULLSTR(dname), bandwidth, NULLSTR(name));
virResetLastError();
@@ -3924,9 +3975,11 @@ virDomainMigratePerform (virDomainPtr domain,
unsigned long bandwidth)
{
virConnectPtr conn;
+ const char *name = virDomainGetName(domain);
+
VIR_DEBUG("domain=%p, cookie=%p, cookielen=%d, uri=%s, flags=%lu, "
- "dname=%s, bandwidth=%lu", domain, cookie, cookielen, uri, flags,
- NULLSTR(dname), bandwidth);
+ "dname=%s, bandwidth=%lu, (VM: %s)", domain, cookie,
+ cookielen, uri, flags, NULLSTR(dname), bandwidth, NULLSTR(name));
virResetLastError();
@@ -4290,7 +4343,9 @@ virDomainGetSchedulerType(virDomainPtr domain, int *nparams)
{
virConnectPtr conn;
char *schedtype;
- DEBUG("domain=%p, nparams=%p", domain, nparams);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, nparams=%p, (VM: %s)", domain, nparams, NULLSTR(name));
virResetLastError();
@@ -4335,7 +4390,10 @@ virDomainGetSchedulerParameters(virDomainPtr domain,
virSchedParameterPtr params, int *nparams)
{
virConnectPtr conn;
- DEBUG("domain=%p, params=%p, nparams=%p", domain, params, nparams);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, params=%p, nparams=%p, (VM: %s)", domain,
+ params, nparams, NULLSTR(name));
virResetLastError();
@@ -4378,7 +4436,10 @@ virDomainSetSchedulerParameters(virDomainPtr domain,
virSchedParameterPtr params, int nparams)
{
virConnectPtr conn;
- DEBUG("domain=%p, params=%p, nparams=%d", domain, params, nparams);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, params=%p, nparams=%d, (VM: %s)", domain,
+ params, nparams, NULLSTR(name));
virResetLastError();
@@ -4438,7 +4499,10 @@ virDomainBlockStats (virDomainPtr dom, const char *path,
{
virConnectPtr conn;
struct _virDomainBlockStats stats2 = { -1, -1, -1, -1, -1 };
- DEBUG("domain=%p, path=%s, stats=%p, size=%zi", dom, path, stats, size);
+ const char *name = virDomainGetName(dom);
+
+ DEBUG("domain=%p, path=%s, stats=%p, size=%zi, (VM: %s)", dom,
+ path, stats, size, NULLSTR(name));
virResetLastError();
@@ -4496,7 +4560,10 @@ virDomainInterfaceStats (virDomainPtr dom, const char *path,
virConnectPtr conn;
struct _virDomainInterfaceStats stats2 = { -1, -1, -1, -1,
-1, -1, -1, -1 };
- DEBUG("domain=%p, path=%s, stats=%p, size=%zi", dom, path, stats, size);
+ const char *name = virDomainGetName(dom);
+
+ DEBUG("domain=%p, path=%s, stats=%p, size=%zi, (VM: %s)", dom,
+ path, stats, size, NULLSTR(name));
virResetLastError();
@@ -4561,7 +4628,10 @@ int virDomainMemoryStats (virDomainPtr dom, virDomainMemoryStatPtr stats,
{
virConnectPtr conn;
unsigned long nr_stats_ret = 0;
- DEBUG("domain=%p, stats=%p, nr_stats=%u", dom, stats, nr_stats);
+ const char *name = virDomainGetName(dom);
+
+ DEBUG("domain=%p, stats=%p, nr_stats=%u, (VM: %s)", dom, stats, nr_stats,
+ NULLSTR(name));
if (flags != 0) {
virLibDomainError (dom, VIR_ERR_INVALID_ARG,
@@ -4645,8 +4715,10 @@ virDomainBlockPeek (virDomainPtr dom,
unsigned int flags)
{
virConnectPtr conn;
- DEBUG("domain=%p, path=%s, offset=%lld, size=%zi, buffer=%p",
- dom, path, offset, size, buffer);
+ const char *name = virDomainGetName(dom);
+
+ DEBUG("domain=%p, path=%s, offset=%lld, size=%zi, buffer=%p, (VM: %s)",
+ dom, path, offset, size, buffer, NULLSTR(name));
virResetLastError();
@@ -4736,8 +4808,10 @@ virDomainMemoryPeek (virDomainPtr dom,
unsigned int flags)
{
virConnectPtr conn;
- DEBUG ("domain=%p, start=%lld, size=%zi, buffer=%p, flags=%d",
- dom, start, size, buffer, flags);
+ const char *name = virDomainGetName(dom);
+
+ DEBUG ("domain=%p, start=%lld, size=%zi, buffer=%p, flags=%d, (VM: %s)",
+ dom, start, size, buffer, flags, NULLSTR(name));
virResetLastError();
@@ -4821,7 +4895,9 @@ int
virDomainGetBlockInfo(virDomainPtr domain, const char *path, virDomainBlockInfoPtr info, unsigned int flags)
{
virConnectPtr conn;
- DEBUG("domain=%p, info=%p flags=%u", domain, info, flags);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, info=%p flags=%u, (VM: %s)", domain, info, flags, NULLSTR(name));
virResetLastError();
@@ -4919,7 +4995,9 @@ error:
int
virDomainUndefine(virDomainPtr domain) {
virConnectPtr conn;
- DEBUG("domain=%p", domain);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p name=%s", domain, NULLSTR(name));
virResetLastError();
@@ -5041,7 +5119,9 @@ error:
int
virDomainCreate(virDomainPtr domain) {
virConnectPtr conn;
- DEBUG("domain=%p", domain);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, (VM :%s)", domain, NULLSTR(name));
virResetLastError();
@@ -5084,7 +5164,9 @@ error:
int
virDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) {
virConnectPtr conn;
- DEBUG("domain=%p, flags=%d", domain, flags);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, flags=%d, (VM: %s)", domain, flags, NULLSTR(name));
virResetLastError();
@@ -5130,7 +5212,9 @@ virDomainGetAutostart(virDomainPtr domain,
int *autostart)
{
virConnectPtr conn;
- DEBUG("domain=%p, autostart=%p", domain, autostart);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, autostart=%p, (VM: %s)", domain, autostart, NULLSTR(name));
virResetLastError();
@@ -5176,7 +5260,9 @@ virDomainSetAutostart(virDomainPtr domain,
int autostart)
{
virConnectPtr conn;
- DEBUG("domain=%p, autostart=%d", domain, autostart);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, autostart=%d, (VM: %s)", domain, autostart, NULLSTR(name));
virResetLastError();
@@ -5230,7 +5316,9 @@ int
virDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
{
virConnectPtr conn;
- DEBUG("domain=%p, nvcpus=%u", domain, nvcpus);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, nvcpus=%u, (VM: %s)", domain, nvcpus, NULLSTR(name));
virResetLastError();
@@ -5296,7 +5384,10 @@ virDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
unsigned int flags)
{
virConnectPtr conn;
- DEBUG("domain=%p, nvcpus=%u, flags=%u", domain, nvcpus, flags);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, nvcpus=%u, flags=%u, (VM: %s)", domain,
+ nvcpus, flags, NULLSTR(name));
virResetLastError();
@@ -5359,7 +5450,9 @@ int
virDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
{
virConnectPtr conn;
- DEBUG("domain=%p, flags=%u", domain, flags);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, flags=%u, (VM: %s)", domain, flags, NULLSTR(name));
virResetLastError();
@@ -5417,7 +5510,10 @@ virDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
unsigned char *cpumap, int maplen)
{
virConnectPtr conn;
- DEBUG("domain=%p, vcpu=%u, cpumap=%p, maplen=%d", domain, vcpu, cpumap, maplen);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, vcpu=%u, cpumap=%p, maplen=%d, (VM: %s)",
+ domain, vcpu, cpumap, maplen, NULLSTR(name));
virResetLastError();
@@ -5480,7 +5576,10 @@ virDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
unsigned char *cpumaps, int maplen)
{
virConnectPtr conn;
- DEBUG("domain=%p, info=%p, maxinfo=%d, cpumaps=%p, maplen=%d", domain, info, maxinfo, cpumaps, maplen);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, info=%p, maxinfo=%d, cpumaps=%p, maplen=%d, (VM: %s)",
+ domain, info, maxinfo, cpumaps, maplen, NULLSTR(name));
virResetLastError();
@@ -5536,7 +5635,9 @@ int
virDomainGetMaxVcpus(virDomainPtr domain)
{
virConnectPtr conn;
- DEBUG("domain=%p", domain);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, (VM: %s)", domain, NULLSTR(name));
virResetLastError();
@@ -5665,7 +5766,9 @@ int
virDomainAttachDevice(virDomainPtr domain, const char *xml)
{
virConnectPtr conn;
- DEBUG("domain=%p, xml=%s", domain, xml);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, xml=%s, (VM: %s)", domain, xml, NULLSTR(name));
virResetLastError();
@@ -5724,7 +5827,10 @@ virDomainAttachDeviceFlags(virDomainPtr domain,
const char *xml, unsigned int flags)
{
virConnectPtr conn;
- DEBUG("domain=%p, xml=%s, flags=%d", domain, xml, flags);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, xml=%s, flags=%d, (VM: %s)", domain, xml,
+ flags, NULLSTR(name));
virResetLastError();
@@ -5767,7 +5873,9 @@ int
virDomainDetachDevice(virDomainPtr domain, const char *xml)
{
virConnectPtr conn;
- DEBUG("domain=%p, xml=%s", domain, xml);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, xml=%s, (VM: %s)", domain, xml, NULLSTR(name));
virResetLastError();
@@ -5822,7 +5930,10 @@ virDomainDetachDeviceFlags(virDomainPtr domain,
const char *xml, unsigned int flags)
{
virConnectPtr conn;
- DEBUG("domain=%p, xml=%s, flags=%d", domain, xml, flags);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, xml=%s, flags=%d, (VM: %s)", domain, xml, flags,
+ NULLSTR(name));
virResetLastError();
@@ -5880,7 +5991,10 @@ virDomainUpdateDeviceFlags(virDomainPtr domain,
const char *xml, unsigned int flags)
{
virConnectPtr conn;
- DEBUG("domain=%p, xml=%s, flags=%d", domain, xml, flags);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, xml=%s, flags=%d, (VM: %s)", domain, xml, flags,
+ NULLSTR(name));
virResetLastError();
@@ -6206,7 +6320,10 @@ error:
virNetworkPtr
virNetworkLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
{
- DEBUG("conn=%p, uuid=%s", conn, uuid);
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+ virUUIDFormat(uuid, uuidstr);
+
+ DEBUG("conn=%p, uuid=%s", conn, uuidstr);
virResetLastError();
@@ -11431,7 +11548,9 @@ error:
*/
int virDomainIsPersistent(virDomainPtr dom)
{
- DEBUG("dom=%p", dom);
+ const char *name = virDomainGetName(dom);
+
+ DEBUG("domain=%p, (VM: %s)", dom, NULLSTR(name));
virResetLastError();
@@ -11464,7 +11583,9 @@ error:
*/
int virDomainIsUpdated(virDomainPtr dom)
{
- DEBUG("dom=%p", dom);
+ const char *name = virDomainGetName(dom);
+
+ DEBUG("domain=%p, (VM: %s)", dom, NULLSTR(name));
virResetLastError();
@@ -12353,7 +12474,9 @@ int
virDomainGetJobInfo(virDomainPtr domain, virDomainJobInfoPtr info)
{
virConnectPtr conn;
- DEBUG("domain=%p, info=%p", domain, info);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, info=%p, (VM: %s)", domain, info, NULLSTR(name));
virResetLastError();
@@ -12401,8 +12524,9 @@ int
virDomainAbortJob(virDomainPtr domain)
{
virConnectPtr conn;
+ const char *name = virDomainGetName(domain);
- DEBUG("domain=%p", domain);
+ DEBUG("domain=%p, (VM: %s)", domain, NULLSTR(name));
virResetLastError();
@@ -12452,8 +12576,10 @@ virDomainMigrateSetMaxDowntime(virDomainPtr domain,
unsigned int flags)
{
virConnectPtr conn;
+ const char *name = virDomainGetName(domain);
- DEBUG("domain=%p, downtime=%llu, flags=%u", domain, downtime, flags);
+ DEBUG("domain=%p, downtime=%llu, flags=%u, (VM: %s)", domain,
+ downtime, flags, NULLSTR(name));
virResetLastError();
@@ -12522,7 +12648,10 @@ virConnectDomainEventRegisterAny(virConnectPtr conn,
void *opaque,
virFreeCallback freecb)
{
- DEBUG("conn=%p dom=%p, eventID=%d, cb=%p, opaque=%p, freecb=%p", conn, dom, eventID, cb, opaque, freecb);
+ const char *name = virDomainGetName(dom);
+
+ DEBUG("conn=%p dom=%p, eventID=%d, cb=%p, opaque=%p, freecb=%p, (VM: %s)",
+ conn, dom, eventID, cb, opaque, freecb, NULLSTR(name));
virResetLastError();
if (!VIR_IS_CONNECT(conn)) {
@@ -12614,8 +12743,9 @@ error:
int virDomainManagedSave(virDomainPtr dom, unsigned int flags)
{
virConnectPtr conn;
+ const char *name = virDomainGetName(dom);
- VIR_DEBUG("dom=%p, flags=%u", dom, flags);
+ VIR_DEBUG("dom%p, flags=%u, (VM: %s)", dom, flags, NULLSTR(name));
virResetLastError();
@@ -12662,8 +12792,9 @@ error:
int virDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags)
{
virConnectPtr conn;
+ const char *name = virDomainGetName(dom);
- VIR_DEBUG("dom=%p, flags=%u", dom, flags);
+ VIR_DEBUG("dom=%p, flags=%u, (VM: %s)", dom, flags, NULLSTR(name));
virResetLastError();
@@ -12703,8 +12834,9 @@ error:
int virDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
{
virConnectPtr conn;
+ const char *name = virDomainGetName(dom);
- VIR_DEBUG("dom=%p, flags=%u", dom, flags);
+ VIR_DEBUG("dom=%p, flags=%u, (VM: %s)", dom, flags, NULLSTR(name));
virResetLastError();
@@ -12753,8 +12885,10 @@ virDomainSnapshotCreateXML(virDomainPtr domain,
unsigned int flags)
{
virConnectPtr conn;
+ const char *name = virDomainGetName(domain);
- DEBUG("domain=%p, xmlDesc=%s, flags=%u", domain, xmlDesc, flags);
+ DEBUG("domain=%p, xmlDesc=%s, flags=%u, (VM: %s)", domain, xmlDesc,
+ flags, NULLSTR(name));
virResetLastError();
@@ -12845,7 +12979,9 @@ int
virDomainSnapshotNum(virDomainPtr domain, unsigned int flags)
{
virConnectPtr conn;
- DEBUG("domain=%p", domain);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, (VM: %s)", domain, NULLSTR(name));
virResetLastError();
@@ -12887,9 +13023,10 @@ virDomainSnapshotListNames(virDomainPtr domain, char **names, int nameslen,
unsigned int flags)
{
virConnectPtr conn;
+ const char *name = virDomainGetName(domain);
- DEBUG("domain=%p, names=%p, nameslen=%d, flags=%u",
- domain, names, nameslen, flags);
+ DEBUG("domain=%p, names=%p, nameslen=%d, flags=%u, (VM: %s)",
+ domain, names, nameslen, flags, NULLSTR(name));
virResetLastError();
@@ -12938,7 +13075,10 @@ virDomainSnapshotLookupByName(virDomainPtr domain,
unsigned int flags)
{
virConnectPtr conn;
- DEBUG("domain=%p, name=%s, flags=%u", domain, name, flags);
+ const char *domname = virDomainGetName(domain);
+
+ DEBUG("domain=%p, name=%s, flags=%u, (VM: %s)", domain, domname,
+ flags, NULLSTR(name));
virResetLastError();
@@ -12982,7 +13122,9 @@ int
virDomainHasCurrentSnapshot(virDomainPtr domain, unsigned int flags)
{
virConnectPtr conn;
- DEBUG("domain=%p, flags=%u", domain, flags);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, flags=%u, (VM: %s)", domain, flags, NULLSTR(name));
virResetLastError();
@@ -13023,7 +13165,9 @@ virDomainSnapshotCurrent(virDomainPtr domain,
unsigned int flags)
{
virConnectPtr conn;
- DEBUG("domain=%p, flags=%u", domain, flags);
+ const char *name = virDomainGetName(domain);
+
+ DEBUG("domain=%p, flags=%u, (VM: %s)", domain, flags, NULLSTR(name));
virResetLastError();
@@ -13187,7 +13331,10 @@ int virDomainOpenConsole(virDomainPtr dom,
unsigned int flags)
{
virConnectPtr conn;
- DEBUG("dom=%p devname=%s, st=%p flags=%u", dom, NULLSTR(devname), st, flags);
+ const char *name = virDomainGetName(dom);
+
+ DEBUG("dom=%p, devname=%s, st=%p, flags=%u, (VM: %s)", dom,
+ NULLSTR(devname), st, flags, NULLSTR(name));
virResetLastError();
--
1.7.3.2
13 years, 10 months
[libvirt] [PATCH] esx: Add domain autostart support
by Matthias Bolte
---
As we're currently in feature freeze this patch is meant to be
applied after the next release.
Matthias
src/esx/esx_driver.c | 209 +++++++++++++++++++++++++++++++++++++++-
src/esx/esx_vi.c | 6 +-
src/esx/esx_vi_generator.input | 60 ++++++++++++
src/esx/esx_vi_generator.py | 5 +-
src/esx/esx_vi_types.c | 6 +
src/esx/esx_vi_types.h | 1 +
6 files changed, 282 insertions(+), 5 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 55847bc..bda5409 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -3193,6 +3193,211 @@ esxDomainUndefine(virDomainPtr domain)
+static int
+esxDomainGetAutostart(virDomainPtr domain, int *autostart)
+{
+ int result = -1;
+ esxPrivate *priv = domain->conn->privateData;
+ esxVI_String *propertyNameList = NULL;
+ esxVI_ObjectContent *hostAutoStartManager = NULL;
+ esxVI_DynamicProperty *dynamicProperty = NULL;
+ esxVI_AutoStartDefaults *defaults = NULL;
+ esxVI_AutoStartPowerInfo *powerInfo = NULL;
+ esxVI_AutoStartPowerInfo *powerInfoList = NULL;
+ esxVI_ObjectContent *virtualMachine = NULL;
+
+ *autostart = 0;
+
+ if (esxVI_EnsureSession(priv->primary) < 0) {
+ return -1;
+ }
+
+ /*
+ * Lookup HostAutoStartManagerConfig from the HostAutoStartManager because
+ * for some reason this is much faster than looking up the same info from
+ * the HostSystem config.
+ */
+
+ /* Check general autostart config */
+ if (esxVI_String_AppendValueToList(&propertyNameList,
+ "config.defaults") < 0 ||
+ esxVI_LookupObjectContentByType
+ (priv->primary,
+ priv->primary->hostSystem->configManager->autoStartManager,
+ "HostAutoStartManager", propertyNameList,
+ &hostAutoStartManager) < 0) {
+ goto cleanup;
+ }
+
+ if (hostAutoStartManager == NULL) {
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the HostAutoStartManager object"));
+ goto cleanup;
+ }
+
+ for (dynamicProperty = hostAutoStartManager->propSet;
+ dynamicProperty != NULL; dynamicProperty = dynamicProperty->_next) {
+ if (STREQ(dynamicProperty->name, "config.defaults")) {
+ if (esxVI_AutoStartDefaults_CastFromAnyType(dynamicProperty->val,
+ &defaults) < 0) {
+ goto cleanup;
+ }
+
+ break;
+ }
+ }
+
+ if (defaults == NULL) {
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the AutoStartDefaults object"));
+ goto cleanup;
+ }
+
+ if (defaults->enabled != esxVI_Boolean_True) {
+ /* Autostart is disabled in general, exit early here */
+ result = 0;
+ goto cleanup;
+ }
+
+ /* Check specific autostart config */
+ esxVI_String_Free(&propertyNameList);
+ esxVI_ObjectContent_Free(&hostAutoStartManager);
+
+ if (esxVI_String_AppendValueToList(&propertyNameList,
+ "config.powerInfo") < 0 ||
+ esxVI_LookupObjectContentByType
+ (priv->primary,
+ priv->primary->hostSystem->configManager->autoStartManager,
+ "HostAutoStartManager", propertyNameList,
+ &hostAutoStartManager) < 0) {
+ goto cleanup;
+ }
+
+ if (hostAutoStartManager == NULL) {
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the HostAutoStartManager object"));
+ goto cleanup;
+ }
+
+ for (dynamicProperty = hostAutoStartManager->propSet;
+ dynamicProperty != NULL; dynamicProperty = dynamicProperty->_next) {
+ if (STREQ(dynamicProperty->name, "config.powerInfo")) {
+ if (esxVI_AutoStartPowerInfo_CastListFromAnyType
+ (dynamicProperty->val, &powerInfoList) < 0) {
+ goto cleanup;
+ }
+
+ break;
+ }
+ }
+
+ if (powerInfoList == NULL) {
+ /* powerInfo list is empty, exit early here */
+ result = 0;
+ goto cleanup;
+ }
+
+ if (esxVI_LookupVirtualMachineByUuid(priv->primary, domain->uuid,
+ NULL, &virtualMachine,
+ esxVI_Occurrence_RequiredItem) < 0) {
+ goto cleanup;
+ }
+
+ for (powerInfo = powerInfoList; powerInfo != NULL;
+ powerInfo = powerInfo->_next) {
+ if (STREQ(powerInfo->key->value, virtualMachine->obj->value)) {
+ if (STRCASEEQ(powerInfo->startAction, "powerOn")) {
+ *autostart = 1;
+ }
+
+ break;
+ }
+ }
+
+ result = 0;
+
+ cleanup:
+ esxVI_String_Free(&propertyNameList);
+ esxVI_ObjectContent_Free(&hostAutoStartManager);
+ esxVI_AutoStartDefaults_Free(&defaults);
+ esxVI_AutoStartPowerInfo_Free(&powerInfoList);
+ esxVI_ObjectContent_Free(&virtualMachine);
+
+ return result;
+}
+
+
+
+static int
+esxDomainSetAutostart(virDomainPtr domain, int autostart)
+{
+ int result = -1;
+ esxPrivate *priv = domain->conn->privateData;
+ esxVI_ObjectContent *virtualMachine = NULL;
+ esxVI_HostAutoStartManagerConfig *spec = NULL;
+ esxVI_AutoStartPowerInfo *powerInfo = NULL;
+
+ if (esxVI_EnsureSession(priv->primary) < 0) {
+ return -1;
+ }
+
+ if (esxVI_LookupVirtualMachineByUuid(priv->primary, domain->uuid,
+ NULL, &virtualMachine,
+ esxVI_Occurrence_RequiredItem) < 0 ||
+ esxVI_HostAutoStartManagerConfig_Alloc(&spec) < 0) {
+ goto cleanup;
+ }
+
+ if (autostart) {
+ /* Enable autostart in general */
+ if (esxVI_AutoStartDefaults_Alloc(&spec->defaults) < 0) {
+ goto cleanup;
+ }
+
+ spec->defaults->enabled = esxVI_Boolean_True;
+ }
+
+ if (esxVI_AutoStartPowerInfo_Alloc(&powerInfo) < 0 ||
+ esxVI_Int_Alloc(&powerInfo->startOrder) < 0 ||
+ esxVI_Int_Alloc(&powerInfo->startDelay) < 0 ||
+ esxVI_Int_Alloc(&powerInfo->stopDelay) < 0 ||
+ esxVI_AutoStartPowerInfo_AppendToList(&spec->powerInfo,
+ powerInfo) < 0) {
+ goto cleanup;
+ }
+
+ powerInfo->key = virtualMachine->obj;
+ powerInfo->startOrder->value = -1; /* no specific start order */
+ powerInfo->startDelay->value = -1; /* use system default */
+ powerInfo->waitForHeartbeat = esxVI_AutoStartWaitHeartbeatSetting_SystemDefault;
+ powerInfo->startAction = autostart ? (char *)"powerOn" : (char *)"none";
+ powerInfo->stopDelay->value = -1; /* use system default */
+ powerInfo->stopAction = (char *)"none";
+
+ if (esxVI_ReconfigureAutostart
+ (priv->primary,
+ priv->primary->hostSystem->configManager->autoStartManager,
+ spec) < 0) {
+ goto cleanup;
+ }
+
+ result = 0;
+
+ cleanup:
+ if (powerInfo != NULL) {
+ powerInfo->key = NULL;
+ powerInfo->startAction = NULL;
+ powerInfo->stopAction = NULL;
+ }
+
+ esxVI_ObjectContent_Free(&virtualMachine);
+ esxVI_HostAutoStartManagerConfig_Free(&spec);
+
+ return result;
+}
+
+
+
/*
* The scheduler interface exposes basically the CPU ResourceAllocationInfo:
*
@@ -4396,8 +4601,8 @@ static virDriver esxDriver = {
NULL, /* domainDetachDevice */
NULL, /* domainDetachDeviceFlags */
NULL, /* domainUpdateDeviceFlags */
- NULL, /* domainGetAutostart */
- NULL, /* domainSetAutostart */
+ esxDomainGetAutostart, /* domainGetAutostart */
+ esxDomainSetAutostart, /* domainSetAutostart */
esxDomainGetSchedulerType, /* domainGetSchedulerType */
esxDomainGetSchedulerParameters, /* domainGetSchedulerParameters */
esxDomainSetSchedulerParameters, /* domainSetSchedulerParameters */
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 76be5a4..97e33c0 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -606,7 +606,8 @@ esxVI_Context_LookupObjectsByPath(esxVI_Context *ctx,
esxVI_String_Free(&propertyNameList);
if (esxVI_String_AppendValueListToList(&propertyNameList,
- "name\0") < 0 ||
+ "name\0"
+ "configManager\0") < 0 ||
esxVI_LookupObjectContentByType(ctx, ctx->computeResource->_reference,
"HostSystem", propertyNameList,
&hostSystemList) < 0) {
@@ -680,7 +681,8 @@ esxVI_Context_LookupObjectsByHostSystemIp(esxVI_Context *ctx,
/* Lookup HostSystem */
if (esxVI_String_AppendValueListToList(&propertyNameList,
- "name\0") < 0 ||
+ "name\0"
+ "configManager\0") < 0 ||
esxVI_FindByIp(ctx, NULL, hostSystemIpAddress, esxVI_Boolean_False,
&managedObjectReference) < 0 ||
esxVI_LookupObjectContentByType(ctx, managedObjectReference,
diff --git a/src/esx/esx_vi_generator.input b/src/esx/esx_vi_generator.input
index 2d903e4..44d1d9b 100644
--- a/src/esx/esx_vi_generator.input
+++ b/src/esx/esx_vi_generator.input
@@ -51,6 +51,13 @@
# Enumerations
#
+enum AutoStartWaitHeartbeatSetting
+ yes
+ no
+ systemDefault
+end
+
+
enum ManagedEntityStatus
gray
green
@@ -140,6 +147,26 @@ object AboutInfo
end
+object AutoStartDefaults
+ Boolean enabled o
+ Int startDelay o
+ Int stopDelay o
+ Boolean waitForHeartbeat o
+ String stopAction o
+end
+
+
+object AutoStartPowerInfo
+ ManagedObjectReference key r
+ Int startOrder r
+ Int startDelay r
+ AutoStartWaitHeartbeatSetting waitForHeartbeat r
+ String startAction r
+ Int stopDelay r
+ String stopAction r
+end
+
+
object ChoiceOption extends OptionType
ElementDescription choiceInfo rl
Int defaultIndex o
@@ -234,6 +261,33 @@ object FolderFileQuery extends FileQuery
end
+object HostAutoStartManagerConfig
+ AutoStartDefaults defaults o
+ AutoStartPowerInfo powerInfo ol
+end
+
+
+object HostConfigManager
+ ManagedObjectReference cpuScheduler o
+ ManagedObjectReference datastoreSystem o
+ ManagedObjectReference memoryManager o
+ ManagedObjectReference storageSystem o
+ ManagedObjectReference networkSystem o
+ ManagedObjectReference vmotionSystem o
+ ManagedObjectReference serviceSystem o
+ ManagedObjectReference firewallSystem o
+ ManagedObjectReference advancedOption o
+ ManagedObjectReference diagnosticSystem o
+ ManagedObjectReference autoStartManager o
+ ManagedObjectReference snmpSystem o
+ ManagedObjectReference dateTimeSystem o
+ ManagedObjectReference patchManager o
+ ManagedObjectReference bootDeviceSystem o
+ ManagedObjectReference firmwareSystem o
+ ManagedObjectReference healthStatusSystem o
+end
+
+
object HostCpuIdInfo
Int level r
String vendor o
@@ -843,6 +897,12 @@ method ReconfigVM_Task returns ManagedObjectReference r
end
+method ReconfigureAutostart
+ ManagedObjectReference _this r
+ HostAutoStartManagerConfig spec r
+end
+
+
method RefreshDatastore
ManagedObjectReference _this r
end
diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py
index 4a8a9dc..3d068f3 100755
--- a/src/esx/esx_vi_generator.py
+++ b/src/esx/esx_vi_generator.py
@@ -1148,11 +1148,14 @@ additional_enum_features = { "ManagedEntityStatus" : Enum.FEATURE__ANY_TYPE
"VirtualMachinePowerState" : Enum.FEATURE__ANY_TYPE }
-additional_object_features = { "DatastoreHostMount" : Object.FEATURE__DEEP_COPY | Object.FEATURE__LIST | Object.FEATURE__ANY_TYPE,
+additional_object_features = { "AutoStartDefaults" : Object.FEATURE__ANY_TYPE,
+ "AutoStartPowerInfo" : Object.FEATURE__ANY_TYPE | Object.FEATURE__LIST,
+ "DatastoreHostMount" : Object.FEATURE__DEEP_COPY | Object.FEATURE__LIST | Object.FEATURE__ANY_TYPE,
"DatastoreInfo" : Object.FEATURE__ANY_TYPE | Object.FEATURE__DYNAMIC_CAST,
"Event" : Object.FEATURE__LIST,
"FileInfo" : Object.FEATURE__DYNAMIC_CAST,
"FileQuery" : Object.FEATURE__DYNAMIC_CAST,
+ "HostConfigManager" : Object.FEATURE__ANY_TYPE,
"HostCpuIdInfo" : Object.FEATURE__ANY_TYPE | Object.FEATURE__LIST,
"HostDatastoreBrowserSearchResults" : Object.FEATURE__LIST | Object.FEATURE__ANY_TYPE,
"ManagedObjectReference" : Object.FEATURE__ANY_TYPE,
diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
index a70e1e0..4ee4110 100644
--- a/src/esx/esx_vi_types.c
+++ b/src/esx/esx_vi_types.c
@@ -1815,6 +1815,7 @@ ESX_VI__TEMPLATE__VALIDATE(HostSystem,
ESX_VI__TEMPLATE__PROPERTY__REQUIRE(name);
/* HostSystem */
+ ESX_VI__TEMPLATE__PROPERTY__REQUIRE(configManager);
})
int
@@ -1851,6 +1852,11 @@ esxVI_HostSystem_CastFromObjectContent(esxVI_ObjectContent *objectContent,
virReportOOMError();
goto failure;
}
+ } else if (STREQ(dynamicProperty->name, "configManager")) {
+ if (esxVI_HostConfigManager_CastFromAnyType
+ (dynamicProperty->val, &(*hostSystem)->configManager) < 0) {
+ goto failure;
+ }
}
}
diff --git a/src/esx/esx_vi_types.h b/src/esx/esx_vi_types.h
index 64bf2dc..1ab39da 100644
--- a/src/esx/esx_vi_types.h
+++ b/src/esx/esx_vi_types.h
@@ -412,6 +412,7 @@ struct _esxVI_HostSystem {
char *name; /* required */
/* HostSystem */
+ esxVI_HostConfigManager *configManager; /* required */
};
int esxVI_HostSystem_Alloc(esxVI_HostSystem **hostSystem);
--
1.7.0.4
13 years, 10 months
[libvirt] [PATCH 00/13] IPv6 support for virtual networks using bridge driver
by Laine Stump
Finally!
Most of this patchset is setup for patch 09/13, which updates the
network XML parser to support IPv6, and 12/13, which turns on IPv6 in
the bridge driver.
In order to have each patch individually pass make check and
(otherwise function properly in case someone is doing a bisect), there
is a bit of extra code churn (lines that are changed in one patch,
only to be changed again in a later patch); I tried to minimize this
as much as possible.
For for IPv6 to work correctly, target *and build* systems will
now need to have ip6tables and radvd available. The way I added
ip6tables into autoconfigure.ac is identical to existing iptables, and
the way I added radvd is identical to dnsmasq. Unfortunately this
doesn't communicate the requirement downstream in a programmatic
fashion, so I guess we need to make sure that this is adequately
reported in the next set of release notes.
There is a remaining problem, outlined in PATCH 13/13, which I would
like some input on - there is a race between radvd writing its pidfile
and libvirtd reading it, and a couple possible ways to fix it, neither
of which is optimal. If anyone has a different idea, I'd like to hear
it (I'm leaning towards option 2 right now - it creates an extra file,
but behavior is 100% correct).
13 years, 10 months
[libvirt] [PATCH v2] Support for qemu aio drive option
by Matthias Dahl
Revised patch against libvirt 0.7.6 to support qemu's aio option.
qemu allows the user to choose what io storage api should be used, either the
default (threads) or native (linux aio) which in the latter case can result in
better performance.
This patch exposes this functionality through libvirt.
Thanks a lot to Eric Blake and Matthias Bolte for their comments.
---
docs/formatdomain.html.in | 4 +++-
docs/schemas/domain.rng | 13 +++++++++++--
src/conf/domain_conf.c | 23 +++++++++++++++++++++++
src/conf/domain_conf.h | 10 ++++++++++
src/qemu/qemu_conf.c | 14 ++++++++++++++
src/qemu/qemu_conf.h | 2 ++
6 files changed, 63 insertions(+), 3 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index ce49f7d..ec85ef3 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -478,7 +478,9 @@
attribute is the primary backend driver name, while the optional <code>type</code>
attribute provides the sub-type. The optional <code>cache</code> attribute
controls the cache mechanism, possible values are "default", "none",
- "writethrough" and "writeback". <span class="since">Since 0.1.8</span>
+ "writethrough" and "writeback". Specific to KVM guests is the optional <code>aio</code>
+ attribute which controls what storage api is used for io operations, its possible
+ values are "threads" and "native". <span class="since">Since 0.1.8; "aio" attribute since 0.7.7</span>
</dd>
<dt><code>encryption</code></dt>
<dd>If present, specifies how the volume is encrypted. See
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
index bb6d00d..5d2dafe 100644
--- a/docs/schemas/domain.rng
+++ b/docs/schemas/domain.rng
@@ -499,8 +499,9 @@
<ref name="driverCache"/>
</group>
</choice>
- <empty/>
- </element>
+ <optional>
+ <ref name="driverAIO"/>
+ </optional>
</define>
<define name="driverFormat">
<attribute name="name">
@@ -521,6 +522,14 @@
</choice>
</attribute>
</define>
+ <define name="driverAIO">
+ <attribute name="aio">
+ <choice>
+ <value>threads</value>
+ <value>native</value>
+ </choice>
+ </attribute>
+ </define>
<define name="controller">
<element name="controller">
<optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 766993c..8bee7b8 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -120,6 +120,11 @@ VIR_ENUM_IMPL(virDomainDiskCache, VIR_DOMAIN_DISK_CACHE_LAST,
"writethrough",
"writeback")
+VIR_ENUM_IMPL(virDomainDiskAIO, VIR_DOMAIN_DISK_AIO_LAST,
+ "default",
+ "native",
+ "threads")
+
VIR_ENUM_IMPL(virDomainController, VIR_DOMAIN_CONTROLLER_TYPE_LAST,
"ide",
"fdc",
@@ -1228,6 +1233,7 @@ virDomainDiskDefParseXML(virConnectPtr conn,
char *target = NULL;
char *bus = NULL;
char *cachetag = NULL;
+ char *aiotag = NULL;
char *devaddr = NULL;
virStorageEncryptionPtr encryption = NULL;
char *serial = NULL;
@@ -1293,6 +1299,7 @@ virDomainDiskDefParseXML(virConnectPtr conn,
driverName = virXMLPropString(cur, "name");
driverType = virXMLPropString(cur, "type");
cachetag = virXMLPropString(cur, "cache");
+ aiotag = virXMLPropString(cur, "aio");
} else if (xmlStrEqual(cur->name, BAD_CAST "readonly")) {
def->readonly = 1;
} else if (xmlStrEqual(cur->name, BAD_CAST "shareable")) {
@@ -1409,6 +1416,13 @@ virDomainDiskDefParseXML(virConnectPtr conn,
goto error;
}
+ if (aiotag &&
+ (def->aiomode = virDomainDiskAIOTypeFromString(aiotag)) < 0) {
+ virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("unknown disk aio mode '%s'"), aiotag);
+ goto error;
+ }
+
if (devaddr) {
if (sscanf(devaddr, "%x:%x:%x",
&def->info.addr.pci.domain,
@@ -1450,6 +1464,7 @@ cleanup:
VIR_FREE(driverType);
VIR_FREE(driverName);
VIR_FREE(cachetag);
+ VIR_FREE(aiotag);
VIR_FREE(devaddr);
VIR_FREE(serial);
virStorageEncryptionFree(encryption);
@@ -4565,6 +4580,7 @@ virDomainDiskDefFormat(virConnectPtr conn,
const char *device = virDomainDiskDeviceTypeToString(def->device);
const char *bus = virDomainDiskBusTypeToString(def->bus);
const char *cachemode = virDomainDiskCacheTypeToString(def->cachemode);
+ const char *aiomode = virDomainDiskAIOTypeToString(def->aiomode);
if (!type) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
@@ -4586,6 +4602,11 @@ virDomainDiskDefFormat(virConnectPtr conn,
_("unexpected disk cache mode %d"), def->cachemode);
return -1;
}
+ if (!aiomode) {
+ virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("unexpected disk aio mode %d"), def->aiomode);
+ return -1;
+ }
virBufferVSprintf(buf,
" <disk type='%s' device='%s'>\n",
@@ -4597,6 +4618,8 @@ virDomainDiskDefFormat(virConnectPtr conn,
virBufferVSprintf(buf, " type='%s'", def->driverType);
if (def->cachemode)
virBufferVSprintf(buf, " cache='%s'", cachemode);
+ if (def->aiomode)
+ virBufferVSprintf(buf, " aio='%s'", aiomode);
virBufferVSprintf(buf, "/>\n");
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 0b79e88..07805a6 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -141,6 +141,14 @@ enum virDomainDiskCache {
VIR_DOMAIN_DISK_CACHE_LAST
};
+enum virDomainDiskAIO {
+ VIR_DOMAIN_DISK_AIO_DEFAULT,
+ VIR_DOMAIN_DISK_AIO_NATIVE,
+ VIR_DOMAIN_DISK_AIO_THREADS,
+
+ VIR_DOMAIN_DISK_AIO_LAST
+};
+
/* Stores the virtual disk configuration */
typedef struct _virDomainDiskDef virDomainDiskDef;
typedef virDomainDiskDef *virDomainDiskDefPtr;
@@ -154,6 +162,7 @@ struct _virDomainDiskDef {
char *driverType;
char *serial;
int cachemode;
+ int aiomode;
unsigned int readonly : 1;
unsigned int shared : 1;
virDomainDeviceInfo info;
@@ -897,6 +906,7 @@ VIR_ENUM_DECL(virDomainDisk)
VIR_ENUM_DECL(virDomainDiskDevice)
VIR_ENUM_DECL(virDomainDiskBus)
VIR_ENUM_DECL(virDomainDiskCache)
+VIR_ENUM_DECL(virDomainDiskAIO)
VIR_ENUM_DECL(virDomainController)
VIR_ENUM_DECL(virDomainFS)
VIR_ENUM_DECL(virDomainNet)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 3d83a8f..fd3a670 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -83,6 +83,12 @@ VIR_ENUM_IMPL(qemuDiskCacheV2, VIR_DOMAIN_DISK_CACHE_LAST,
"writethrough",
"writeback");
+VIR_ENUM_DECL(qemuDiskAIO)
+VIR_ENUM_IMPL(qemuDiskAIO, VIR_DOMAIN_DISK_AIO_LAST,
+ "default",
+ "native",
+ "threads");
+
VIR_ENUM_DECL(qemuVideo)
VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
@@ -1137,6 +1143,8 @@ static unsigned int qemudComputeCmdFlags(const char *help,
flags |= QEMUD_CMD_FLAG_DRIVE_CACHE_V2;
if (strstr(help, "format="))
flags |= QEMUD_CMD_FLAG_DRIVE_FORMAT;
+ if (strstr(help, "aio=threads|native"))
+ flags |= QEMUD_CMD_FLAG_DRIVE_AIO;
}
if (strstr(help, "-vga") && !strstr(help, "-std-vga"))
flags |= QEMUD_CMD_FLAG_VGA;
@@ -2340,6 +2348,12 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
virBufferAddLit(&opt, ",cache=off");
}
+ if (disk->aiomode && (qemuCmdFlags & QEMUD_CMD_FLAG_DRIVE_AIO)) {
+ const char * mode = qemuDiskAIOTypeToString(disk->aiomode);
+
+ virBufferVSprintf(&opt, ",aio=%s", mode);
+ }
+
if (virBufferError(&opt)) {
virReportOOMError(NULL);
goto error;
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 101f187..780ae6e 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -82,6 +82,8 @@ enum qemud_cmd_flags {
QEMUD_CMD_FLAG_SDL = (1 << 27), /* Is the new -sdl arg available */
QEMUD_CMD_FLAG_SMP_TOPOLOGY = (1 << 28), /* Is sockets=s,cores=c,threads=t available for -smp? */
QEMUD_CMD_FLAG_NETDEV = (1 << 29), /* The -netdev flag & netdev_add/remove monitor commands */
+
+ QEMUD_CMD_FLAG_DRIVE_AIO = (1 << 30), /* Is -drive aio= avail */
};
/* Main driver state */
--
1.7.0.4
13 years, 10 months
[libvirt] [PATCH] Support <ipv[46]routing> network parameters
by Paweł Krześniak
Support for optional parameters <ipv[46]routing> in XML network definition.
These parameters allows to set up alternative binary or script to be run
during network start. Such customization allows to run additional services
for started network (besides default DHCP/DNS/NDP) or modify/pass additional
options to dnsmasq and/or radvd.
If <ipv[46]routing> parameters point to default /usr/sbin/dnsmasq or
/usr/sbin/radvd
they are removed from XML network definition.
---
docs/schemas/network.rng | 28 +++++++++++++++
src/conf/network_conf.c | 37 ++++++++++++++++++++
src/conf/network_conf.h | 5 +++
src/network/bridge_driver.c | 8 ++--
.../networkxml2xmlin/with-ipv4routing-network.xml | 11 ++++++
.../networkxml2xmlout/with-ipv4routing-network.xml | 11 ++++++
tests/networkxml2xmltest.c | 1 +
7 files changed, 97 insertions(+), 4 deletions(-)
diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng
index 4252f30..71234a3 100644
--- a/docs/schemas/network.rng
+++ b/docs/schemas/network.rng
@@ -21,6 +21,16 @@
<element name="uuid"><text/></element>
</optional>
+ <!-- <ipv4routing> element -->
+ <optional>
+ <ref name="ipv4routing"/>
+ </optional>
+
+ <!-- <ipv6routing> element -->
+ <optional>
+ <ref name="ipv6routing"/>
+ </optional>
+
<!-- <bridge> element -->
<optional>
<!-- The name of the network to be set up; this will back
@@ -175,4 +185,22 @@
</data>
</define>
+ <!-- ipv4routing and ipv6routing description is a path to the binary -->
+ <define name="ipv4routing">
+ <element name="ipv4routing">
+ <ref name="absFilePath"/>
+ </element>
+ </define>
+
+ <define name="ipv6routing">
+ <element name="ipv6routing">
+ <ref name="absFilePath"/>
+ </element>
+ </define>
+
+ <define name="absFilePath">
+ <data type="string">
+ <param name="pattern">/[a-zA-Z0-9_\.\+\-\\&"'<>/%]+</param>
+ </data>
+ </define>
</grammar>
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 420b94a..b70397f 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -115,6 +115,8 @@ void virNetworkDefFree(virNetworkDefPtr def)
VIR_FREE(def->bridge);
VIR_FREE(def->forwardDev);
VIR_FREE(def->domain);
+ VIR_FREE(def->ipv4routing);
+ VIR_FREE(def->ipv6routing);
for (ii = 0 ; ii < def->nips && def->ips ; ii++) {
virNetworkIpDefClear(&def->ips[ii]);
@@ -612,6 +614,36 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
VIR_FREE(tmp);
}
+ /* Extract path to ipv4routing binary */
+ def->ipv4routing = virXPathString("string(./ipv4routing[1])", ctxt);
+ if (def->ipv4routing) {
+ if (access(def->ipv4routing, X_OK) < 0) {
+ virNetworkReportError(VIR_ERR_INTERNAL_ERROR, _("Cannot
find IPv4Routing binary %s"), def->ipv4routing);
+ goto error;
+ }
+ } else {
+ def->ipv4routing = strdup(DNSMASQ);
+ if (!def->ipv4routing) {
+ virReportOOMError();
+ goto error;
+ }
+ }
+
+ /* Extract path to ipv6routing binary */
+ def->ipv6routing = virXPathString("string(./ipv6routing[1])", ctxt);
+ if (def->ipv6routing) {
+ if (access(def->ipv6routing, X_OK) < 0) {
+ virNetworkReportError(VIR_ERR_INTERNAL_ERROR, _("Cannot
find IPv6Routing binary %s"), def->ipv6routing);
+ goto error;
+ }
+ } else {
+ def->ipv6routing = strdup(RADVD);
+ if (!def->ipv6routing) {
+ virReportOOMError();
+ goto error;
+ }
+ }
+
/* Parse network domain information */
def->domain = virXPathString("string(./domain[1]/@name)", ctxt);
@@ -831,6 +863,11 @@ char *virNetworkDefFormat(const virNetworkDefPtr def)
virUUIDFormat(uuid, uuidstr);
virBufferVSprintf(&buf, " <uuid>%s</uuid>\n", uuidstr);
+ if (def->ipv4routing && STRNEQ(def->ipv4routing, DNSMASQ))
+ virBufferEscapeString(&buf, "
<ipv4routing>%s</ipv4routing>\n", def->ipv4routing);
+ if (def->ipv6routing && STRNEQ(def->ipv6routing, RADVD))
+ virBufferEscapeString(&buf, "
<ipv6routing>%s</ipv6routing>\n", def->ipv6routing);
+
if (def->forwardType != VIR_NETWORK_FORWARD_NONE) {
const char *mode = virNetworkForwardTypeToString(def->forwardType);
if (mode) {
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index fd96c36..8df600c 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -98,6 +98,11 @@ struct _virNetworkDef {
size_t nips;
virNetworkIpDefPtr ips; /* ptr to array of IP addresses on this network */
+
+ char *ipv4routing; /* path to binary for configuring IPv4
network (DNS/DHCP).
+ Defaults to DNSMASQ */
+ char *ipv6routing; /* path to binary for configuring IPv6 network.
+ Defaults to RADVD */
};
typedef struct _virNetworkObj virNetworkObj;
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 7d43ef5..444cbdc 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -177,7 +177,7 @@ networkFindActiveConfigs(struct network_driver *driver) {
virReportOOMError();
goto cleanup;
}
- if (virFileLinkPointsTo(pidpath, DNSMASQ) == 0)
+ if (virFileLinkPointsTo(pidpath,
obj->def->ipv4routing) == 0)
obj->dnsmasqPid = -1;
VIR_FREE(pidpath);
}
@@ -196,7 +196,7 @@ networkFindActiveConfigs(struct network_driver *driver) {
VIR_FREE(radvdpidbase);
goto cleanup;
}
- if (virFileLinkPointsTo(pidpath, RADVD) == 0)
+ if (virFileLinkPointsTo(pidpath,
obj->def->ipv6routing) == 0)
obj->radvdPid = -1;
VIR_FREE(pidpath);
}
@@ -596,7 +596,7 @@ networkStartDhcpDaemon(virNetworkObjPtr network)
goto cleanup;
}
- cmd = virCommandNew(DNSMASQ);
+ cmd = virCommandNew(network->def->ipv4routing);
if (networkBuildDnsmasqArgv(network, ipdef, pidfile, cmd) < 0) {
goto cleanup;
}
@@ -727,7 +727,7 @@ networkStartRadvd(virNetworkObjPtr network)
* its own pidfile, so we just let it do so, with a slightly
* different name. Unused, but harmless.
*/
- cmd = virCommandNewArgList(RADVD, "--debug", "1",
+ cmd = virCommandNewArgList(network->def->ipv6routing, "--debug", "1",
"--config", configfile,
"--pidfile", NULL);
virCommandAddArgFormat(cmd, "%s-bin", pidfile);
diff --git a/tests/networkxml2xmlin/with-ipv4routing-network.xml
b/tests/networkxml2xmlin/with-ipv4routing-network.xml
new file mode 100644
index 0000000..1cf3aa4
--- /dev/null
+++ b/tests/networkxml2xmlin/with-ipv4routing-network.xml
@@ -0,0 +1,11 @@
+<network>
+ <name>private</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <ipv4routing>/usr/local/bin/my-dnsmasq</ipv4routing>
+ <bridge name="virbr2" />
+ <ip address="192.168.152.1" netmask="255.255.255.0">
+ <dhcp>
+ <range start="192.168.152.2" end="192.168.152.254" />
+ </dhcp>
+ </ip>
+</network>
diff --git a/tests/networkxml2xmlout/with-ipv4routing-network.xml
b/tests/networkxml2xmlout/with-ipv4routing-network.xml
new file mode 100644
index 0000000..d649d78
--- /dev/null
+++ b/tests/networkxml2xmlout/with-ipv4routing-network.xml
@@ -0,0 +1,11 @@
+<network>
+ <name>private</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <ipv4routing>/usr/local/bin/my-dnsmasq</ipv4routing>
+ <bridge name='virbr2' stp='on' delay='0' />
+ <ip address='192.168.152.1' netmask='255.255.255.0'>
+ <dhcp>
+ <range start='192.168.152.2' end='192.168.152.254' />
+ </dhcp>
+ </ip>
+</network>
diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c
index 7805548..86e3c81 100644
--- a/tests/networkxml2xmltest.c
+++ b/tests/networkxml2xmltest.c
@@ -90,6 +90,7 @@ mymain(int argc, char **argv)
DO_TEST("nat-network");
DO_TEST("netboot-network");
DO_TEST("netboot-proxy-network");
+ DO_TEST("with-ipv4routing-network");
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
13 years, 10 months
[libvirt] [PATCH] bridge: Fix uninitialized variable
by Jiri Denemark
---
Pushed under the build-breaker rule.
src/util/bridge.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/util/bridge.c b/src/util/bridge.c
index dcd3f39..81a043c 100644
--- a/src/util/bridge.c
+++ b/src/util/bridge.c
@@ -676,7 +676,7 @@ brAddInetAddress(brControl *ctl ATTRIBUTE_UNUSED,
virSocketAddr *addr,
unsigned int prefix)
{
- virCommandPtr cmd;
+ virCommandPtr cmd = NULL;
char *addrstr;
int ret = -1;
@@ -715,7 +715,7 @@ brDelInetAddress(brControl *ctl ATTRIBUTE_UNUSED,
virSocketAddr *addr,
unsigned int prefix)
{
- virCommandPtr cmd;
+ virCommandPtr cmd = NULL;
char *addrstr;
int ret = -1;
--
1.7.3.4
13 years, 10 months
[libvirt] [PATCH] docs: Add additional indentation to level 3 menu items
by Matthias Bolte
formatnetwork.html has a menu item at level 3. libvirt.css
doesn't have a explicit rule for level 3 and level 3 and
level 2 items end up at the same indentation level.
Add an additional 1em indentation to level 3 menu items.
---
docs/libvirt.css | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/docs/libvirt.css b/docs/libvirt.css
index dfc93c6..049e332 100644
--- a/docs/libvirt.css
+++ b/docs/libvirt.css
@@ -106,6 +106,11 @@ h2, h3, h4, h5, h6 {
border-left: 8px solid #c5dbd8;
}
+#menu ul.l3 li .inactive,
+#menu ul.l3 li .active {
+ padding-left: 3em;
+}
+
#headerLogo {
position: absolute;
--
1.7.0.4
13 years, 10 months