[libvirt] Allow hvsupport.html.in to be auto-generated
by Daniel P. Berrange
The hvsupport.html.in file is constantly out of date, because when
updating the drivers to add new APIs, people often (always) forget
to update the hvsupport.html.in file.
To solve this we can instead store version number annotations in
the drivers themselves, so it is not easily missed. Then the
hvsupport.html.in file can be auto-generated
13 years, 7 months
[libvirt] Cache and memory bandwidth graphs: native versus guest
by Bill Gray
See attachment with two graphs: (1) cache bandwidth, (2) blowup of
sustained memory bandwidth region...
- X axis has a log scale
- Light blue line is an older system with 32K L1 and 6M L2 caches
- All other measurements on perf34: 32K L1, 256K L2, 30M L3 caches
- Majority of variation in L1 cache region is from the two guest
measurements done with no taskset to a VCPU: yellow and maroon lines.
Perhaps this reflects the test bouncing between VCPUs in the guest.
- The sustained memory bandwidth for the guest with no pinning is only
80% of native (maroon line), which motivates more convenient and
comprehensive numactl for guests.
- Virtualized bandwidth is otherwise nearly in line with native, which
confirms the importance of the virtual CPUID communicating actual native
cache sizes to cache-size-aware guest applications, since guest apps
could benefit from the full size of the native cache. (Guest was
started with "-cpu host", but lscpu in guest showed 4M cache despite
actual 30M cache.)
13 years, 7 months
[libvirt] KVM Forum 2011: Call For Participation
by KVM-Forum-2011-PC@redhat.com
=================================================================
KVM Forum 2011: Call For Participation
August 15-16, 2011 - Hyatt Regency Vancouver - Vancouver, Canada
=================================================================
KVM is an industry leading open source hypervisor that provides an ideal
platform for datacenter virtualization, virtual desktop infrastructure,
and cloud computing. Once again, it's time to bring together the
community of developers and users that define the KVM ecosystem for
our annual technical conference. We will discuss the current state of
affairs and plan for the future of KVM, its surrounding infrastructure,
and management tools. So mark your calendar and join us in advancing KVM.
http://events.linuxfoundation.org/events/kvm-forum/
We are colocated with The Linux Foundation's LinuxCon again this year.
KVM Forum attendees will be eligible to attend LinuxCon for a discounted
rate.
http://events.linuxfoundation.org/events/kvm-forum/register
We invite you to lead part of the discussion by submitting a speaking
proposal for KVM Forum 2011.
http://events.linuxfoundation.org/cfp
Suggested topics:
KVM
- Scaling and performance
- Nested virtualization
- I/O improvements
- PCI device assignment
- Driver domains
- Time keeping
- Resource management (cpu, memory, i/o)
- Memory management (page sharing, swapping, huge pages, etc)
- Fault tolerance
- VEPA, VN-Link, vswitch
- Security
QEMU
- Device model improvements
- New devices
- Scaling and performance
- Desktop virtualization
- Spice
- Increasing robustness and hardening
- Security model
- Management interfaces
- QMP protocol and implementation
- Image formats
- Live migration
- Live snapshots and merging
Virtio
- Speeding up existing devices
- Alternatives
- Virtio on non-Linux
Management infrastructure
- Libvirt
- KVM autotest
- OpenStack
- Network virtualization management
- Enterprise storage management
Cloud computing
- Scalable storage
- Virtual networking
- Security
- Provisioning
- Hybrid
SUBMISSION REQUIREMENTS
Abstracts due: May 16th, 2011
Notification: May 31th, 2011
Please submit a short abstract (~150 words) describing your presentation
proposal. In your submission please note how long your talk will take.
Slots vary in length up to 45 minutes. Also include in your proposal
the proposal type -- one of:
- technical talk
- end-user talk
- BOF (birds of a feather) session
Sumbit your proposal here:
http://events.linuxfoundation.org/cfp
You will receive a notification whether or not your presentation proposal
was accepted by May 31st.
END-USER COLLABORATION
One of the big challenges as developers is to know what, where and how
people actually use our software. We will reserve a few slots for end
users talking about their deployment challenges and achievements.
If you are using KVM in production you are encouraged submit a speaking
proposal. Simply mark it as an end-user collaboration proposal. As and
end user, this is a unique opportunity to get your input to developers.
BOF SESSION
We will reserve some slots in the evening after the main conference
tracks, for birds of a feather sessions. These sessions will be less
formal than presentation tracks and targetted for people who would
like to discuss specific issues with other developers and/or users.
If you are interested in getting developers and/or uses together to
discuss a specific problem, please submit a BOF proposal.
LIGHTNING TALKS
In addition to submitted talks we will also have some room for lightning
talks. These are short (5 minute) discussions to highlight new work or
ideas that aren't complete enough to warrant a full presentation slot.
Lightning talk submissions and scheduling will be handled on-site at
KVM Forum.
HOTEL / TRAVEL
The KVM Forum 2011 will be held in Vancouver BC at the Hyatt Regency
Vancouver.
http://events.linuxfoundation.org/events/kvm-forum/travel
Thank you for your interest in KVM. We're looking forward to your
submissions and seeing you at the KVM Forum 2011 in August!
Thanks,
your KVM Forum 2011 Program Commitee
Please contact us with any questions or comments.
KVM-Forum-2011-PC(a)redhat.com
13 years, 7 months
[libvirt] [PATCH] Disable virCommandExec on Win32
by Daniel P. Berrange
Mingw execve() has a broken signature. Disable this
function until gnulib fixes the signature, since we
don't really need this on Win32 anyway.
* src/util/command.c: Disable virCommandExec on Win32
---
src/util/command.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/src/util/command.c b/src/util/command.c
index 7ac411b..ebb90cb 100644
--- a/src/util/command.c
+++ b/src/util/command.c
@@ -989,6 +989,7 @@ cleanup:
* Returns -1 on any error executing the command.
* Will not return on success.
*/
+#ifndef WIN32
int virCommandExec(virCommandPtr cmd)
{
if (!cmd ||cmd->has_error == ENOMEM) {
@@ -1003,6 +1004,18 @@ int virCommandExec(virCommandPtr cmd)
return execve(cmd->args[0], cmd->args, cmd->env);
}
+#else
+int virCommandExec(virCommandPtr cmd ATTRIBUTE_UNUSED)
+{
+ /* Mingw execve() has a broken signature. Disable this
+ * function until gnulib fixes the signature, since we
+ * don't really need this on Win32 anyway.
+ */
+ virReportSystemError(ENOSYS, "%s",
+ _("Executing new processes is not supported on Win32 platform"));
+ return -1;
+}
+#endif
/*
* Run the command and wait for completion.
--
1.7.4.4
13 years, 7 months
[libvirt] [PATCH] Cast args/env for execve in virCommand
by Daniel P. Berrange
'char **' is not compatible with 'const char* const*' so needs
an explicit cast. Fixes the build on MinGW
* src/util/command.c: Cast args/env for execve
---
src/util/command.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/util/command.c b/src/util/command.c
index 78586e8..d63b984 100644
--- a/src/util/command.c
+++ b/src/util/command.c
@@ -1000,7 +1000,9 @@ int virCommandExec(virCommandPtr cmd)
return -1;
}
- return execve(cmd->args[0], cmd->args, cmd->env);
+ return execve(cmd->args[0],
+ (const char *const *)cmd->args,
+ (const char *const *)cmd->env);
}
/*
--
1.7.4.4
13 years, 7 months
[libvirt] [PATCHv2] spice: support streaming-video parameter
by Alon Levy
This adds a streaming-video=filter|all|off attribute. It is used to change
the behavior of video stream detection in spice, the default is filter (the
default for libvirt is not to specify it - the actual default is defined in
libspice-server.so).
Usage:
<graphics type='spice' autoport='yes'>
<streaming mode='off'/>
</graphics>
Tested with the above and with tests/qemuxml2argvtest.
Signed-off-by: Alon Levy <alevy(a)redhat.com>
---
Fixed: error code for missing mode is now VIR_ERR_XML_ERROR, and added documentation.
Note: I'm not registered to the list, so please cc me on reply, thanks.
---
docs/formatdomain.html.in | 6 ++++
docs/schemas/domain.rng | 12 ++++++++
src/conf/domain_conf.c | 30 ++++++++++++++++++++
src/conf/domain_conf.h | 11 +++++++
src/libvirt_private.syms | 2 +
src/qemu/qemu_command.c | 3 ++
.../qemuxml2argv-graphics-spice.args | 2 +-
.../qemuxml2argv-graphics-spice.xml | 1 +
8 files changed, 66 insertions(+), 1 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 5013c48..78fbc09 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1775,6 +1775,7 @@ qemu-kvm -net nic,model=? /dev/null
<channel name='main' mode='secure'/>
<channel name='record' mode='insecure'/>
<image compression='auto_glz'/>
+ <streaming mode='filter'/>
</graphics></pre>
<p>
Spice supports variable compression settings for audio,
@@ -1793,6 +1794,11 @@ qemu-kvm -net nic,model=? /dev/null
and <code>playback</code> for enabling audio stream
compression (accepts <code>on</code> or <code>off</code>).
</p>
+ <p>
+ Streaming mode is set by the <code>streaming</code>
+ element, settings it's <code>mode</code> attribute to one
+ of <code>filter</code>,<code>all</code> or <code>off</code>.
+ </p>
</dd>
<dt><code>"rdp"</code></dt>
<dd>
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
index 7163c6e..9083ff9 100644
--- a/docs/schemas/domain.rng
+++ b/docs/schemas/domain.rng
@@ -1334,6 +1334,18 @@
<empty/>
</element>
</optional>
+ <optional>
+ <element name="streaming">
+ <attribute name="mode">
+ <choice>
+ <value>filter</value>
+ <value>all</value>
+ <value>off</value>
+ </choice>
+ </attribute>
+ <empty/>
+ </element>
+ </optional>
</interleave>
</group>
<group>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2a681d9..9be459c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -352,6 +352,13 @@ VIR_ENUM_IMPL(virDomainGraphicsSpicePlaybackCompression,
"on",
"off");
+VIR_ENUM_IMPL(virDomainGraphicsSpiceStreamingMode,
+ VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST,
+ "default",
+ "filter",
+ "all",
+ "off");
+
VIR_ENUM_IMPL(virDomainHostdevMode, VIR_DOMAIN_HOSTDEV_MODE_LAST,
"subsystem",
"capabilities")
@@ -4082,6 +4089,26 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) {
VIR_FREE(compression);
def->data.spice.playback = compressionVal;
+ } else if (xmlStrEqual(cur->name, BAD_CAST "streaming")) {
+ const char *mode = virXMLPropString(cur, "mode");
+ int modeVal;
+
+ if (!mode) {
+ virDomainReportError(VIR_ERR_XML_ERROR, "%s",
+ _("spice streaming missing mode"));
+ goto error;
+ }
+ if ((modeVal =
+ virDomainGraphicsSpiceStreamingModeTypeFromString(mode)) <= 0) {
+ virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown spice streaming mode"));
+ VIR_FREE(mode);
+ goto error;
+
+ }
+ VIR_FREE(mode);
+
+ def->data.spice.streaming = modeVal;
}
}
cur = cur->next;
@@ -7979,6 +8006,9 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
if (def->data.spice.playback)
virBufferVSprintf(buf, " <playback compression='%s'/>\n",
virDomainGraphicsSpicePlaybackCompressionTypeToString(def->data.spice.playback));
+ if (def->data.spice.streaming)
+ virBufferVSprintf(buf, " <streaming mode='%s'/>\n",
+ virDomainGraphicsSpiceStreamingModeTypeToString(def->data.spice.streaming));
}
if (children) {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 1dadf98..7a1f29a 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -696,6 +696,15 @@ enum virDomainGraphicsSpicePlaybackCompression {
VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_LAST
};
+enum virDomainGraphicsSpiceStreamingMode {
+ VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_DEFAULT = 0,
+ VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_FILTER,
+ VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_ALL,
+ VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_OFF,
+
+ VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST
+};
+
typedef struct _virDomainGraphicsDef virDomainGraphicsDef;
typedef virDomainGraphicsDef *virDomainGraphicsDefPtr;
struct _virDomainGraphicsDef {
@@ -737,6 +746,7 @@ struct _virDomainGraphicsDef {
int jpeg;
int zlib;
int playback;
+ int streaming;
} spice;
} data;
};
@@ -1476,6 +1486,7 @@ VIR_ENUM_DECL(virDomainGraphicsSpiceImageCompression)
VIR_ENUM_DECL(virDomainGraphicsSpiceJpegCompression)
VIR_ENUM_DECL(virDomainGraphicsSpiceZlibCompression)
VIR_ENUM_DECL(virDomainGraphicsSpicePlaybackCompression)
+VIR_ENUM_DECL(virDomainGraphicsSpiceStreamingMode)
/* from libvirt.h */
VIR_ENUM_DECL(virDomainState)
VIR_ENUM_DECL(virDomainSeclabel)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 1b22be6..2e25202 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -273,6 +273,8 @@ virDomainGraphicsSpicePlaybackCompressionTypeFromString;
virDomainGraphicsSpicePlaybackCompressionTypeToString;
virDomainGraphicsSpiceZlibCompressionTypeFromString;
virDomainGraphicsSpiceZlibCompressionTypeToString;
+virDomainGraphicsSpiceStreamingModeTypeFromString;
+virDomainGraphicsSpiceStreamingModeTypeToString;
virDomainGraphicsTypeFromString;
virDomainGraphicsTypeToString;
virDomainHostdevDefFree;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2205ed1..8036f0c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4037,6 +4037,9 @@ qemuBuildCommandLine(virConnectPtr conn,
if (def->graphics[0]->data.spice.playback)
virBufferVSprintf(&opt, ",playback-compression=%s",
virDomainGraphicsSpicePlaybackCompressionTypeToString(def->graphics[0]->data.spice.playback));
+ if (def->graphics[0]->data.spice.streaming)
+ virBufferVSprintf(&opt, ",streaming-video=%s",
+ virDomainGraphicsSpiceStreamingModeTypeToString(def->graphics[0]->data.spice.streaming));
virCommandAddArg(cmd, "-spice");
virCommandAddArgBuffer(cmd, &opt);
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
index 70cd35b..084a100 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
@@ -4,6 +4,6 @@ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda \
/dev/HostVG/QEMUGuest1 -usb -spice port=5903,tls-port=5904,addr=127.0.0.1,\
x509-dir=/etc/pki/libvirt-spice,tls-channel=main,plaintext-channel=inputs,\
image-compression=auto_glz,jpeg-wan-compression=auto,zlib-glz-wan-compression=auto,\
-playback-compression=on -vga \
+playback-compression=on,streaming-video=filter -vga \
qxl -global qxl.vram_size=18874368 -device qxl,id=video1,vram_size=33554432,bus=pci.0,addr=0x4 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
index a29f50d..0d3dd48 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
@@ -28,6 +28,7 @@
<jpeg compression='auto'/>
<zlib compression='auto'/>
<playback compression='on'/>
+ <streaming mode='filter'/>
</graphics>
<video>
<model type='qxl' vram='18432' heads='1'/>
--
1.7.5.1
13 years, 7 months
[libvirt] [PATCH v2 0/9] Introduce virDomainGetState API
by Jiri Denemark
This new API solves several problems:
- calling virDomainGetInfo for just getting domain status is an overkill since
it may result in sending requests to guest OS
- since virDomainGetInfo can hang when guest OS is not responding and it is
used by virsh list, listing domains can hang
- virDomainGetState provides additional info about what action led to domain's
current state, which can be used instead of listening to domain events
Version 2:
- rebased to current HEAD
- unsigned int flags parameter
- updated version info in public.syms
- noGetState renamed as useGetInfo in virsh.c
- simplified implementation in esx driver per Matthias' suggestion
- call internal xen drivers directly instead of going through xenUnifiedDriver
- fixed || vs && typo in domain_conf.c
- new patch 9/9: qemu: Update domain state when reconnecting monitor
Jiri Denemark (9):
virDomainGetState public API
Internal driver API for virDomainGetState
virDomainGetState public API implementation
Wire protocol format and dispatcher for virDomainGetState
virsh: Prefer virDomainGetState over virDomainGetInfo
remote: Implement virDomainGetState
Implement basic virDomainGetState in all drivers
Implement domain state reason
qemu: Update domain state when reconnecting monitor
daemon/remote.c | 33 +++++++
daemon/remote_generator.pl | 6 +-
include/libvirt/libvirt.h.in | 56 +++++++++++
python/generator.py | 1 +
python/libvirt-override-api.xml | 6 +
python/libvirt-override.c | 30 ++++++
src/conf/domain_conf.c | 163 +++++++++++++++++++++++++++++++-
src/conf/domain_conf.h | 26 +++++-
src/driver.h | 6 +
src/esx/esx_driver.c | 44 +++++++++
src/libvirt.c | 51 ++++++++++
src/libvirt_private.syms | 4 +
src/libvirt_public.syms | 5 +
src/libxl/libxl_driver.c | 80 ++++++++++++----
src/lxc/lxc_driver.c | 81 ++++++++++++----
src/openvz/openvz_conf.c | 16 ++-
src/openvz/openvz_driver.c | 57 +++++++++--
src/phyp/phyp_driver.c | 16 +++
src/qemu/qemu_driver.c | 95 ++++++++++++++-----
src/qemu/qemu_migration.c | 24 +++--
src/qemu/qemu_monitor.c | 20 ++++
src/qemu/qemu_monitor.h | 1 +
src/qemu/qemu_monitor_json.c | 42 +++++++++
src/qemu/qemu_monitor_json.h | 1 +
src/qemu/qemu_monitor_text.c | 30 ++++++
src/qemu/qemu_monitor_text.h | 1 +
src/qemu/qemu_process.c | 99 +++++++++++++++-----
src/qemu/qemu_process.h | 12 ++-
src/remote/remote_driver.c | 34 +++++++
src/remote/remote_protocol.x | 13 +++-
src/remote_protocol-structs | 8 ++
src/test/test_driver.c | 107 +++++++++++++++-------
src/uml/uml_driver.c | 58 ++++++++++--
src/vbox/vbox_tmpl.c | 60 ++++++++++++
src/vmware/vmware_conf.c | 3 +-
src/vmware/vmware_driver.c | 60 ++++++++++---
src/xen/xen_driver.c | 42 +++++++++
src/xen/xen_hypervisor.c | 36 +++++++
src/xen/xen_hypervisor.h | 5 +
src/xen/xend_internal.c | 99 +++++++++++++++-----
src/xen/xend_internal.h | 4 +
src/xen/xm_internal.c | 20 ++++
src/xen/xm_internal.h | 4 +
src/xen/xs_internal.c | 34 +++++++
src/xen/xs_internal.h | 4 +
src/xenapi/xenapi_driver.c | 49 ++++++++++
tools/virsh.c | 195 ++++++++++++++++++++++++++++++++-------
47 files changed, 1603 insertions(+), 238 deletions(-)
--
1.7.5.rc3
13 years, 7 months
[libvirt] [PATCH v4 0/8] Add support for taking screenshots of domain console
by Michal Privoznik
This series adds support for taking screenshots of a running domain console.
The iohelper was added a new argument - delete file after transfer. This is
needed, because the screenshot is written to file and asynchronously transferred
to client.
New API is accessible via virsh screenshot <domain> <path> <screnID>;
For now, we just save the file in format as returned by hypervisor:
PPM for Qemu, PNG for VirtualBox.
diff to v3:
- added screen ID argument
diff to v2:
- rebase
Michal Privoznik (8):
screenshot: Defining the public API
screenshot: Defining the internal API
screenshot: Implementing the public API
screenshot: Implementing the remote protocol
screenshot: Expose the new API in virsh
virFDStream: Add option for delete file after it's opening
qemu: Implement the driver methods
vbox: Implement the driver methods
daemon/remote.c | 57 ++++++++++++++++++
include/libvirt/libvirt.h.in | 8 +++
src/driver.h | 8 ++-
src/esx/esx_driver.c | 1 +
src/fdstream.c | 29 +++++++--
src/fdstream.h | 6 +-
src/libvirt.c | 60 +++++++++++++++++++
src/libvirt_public.syms | 1 +
src/libxl/libxl_driver.c | 1 +
src/lxc/lxc_driver.c | 4 +-
src/openvz/openvz_driver.c | 1 +
src/phyp/phyp_driver.c | 1 +
src/qemu/qemu_driver.c | 92 ++++++++++++++++++++++++++++-
src/qemu/qemu_monitor.c | 20 ++++++
src/qemu/qemu_monitor.h | 3 +
src/qemu/qemu_monitor_json.c | 23 +++++++
src/qemu/qemu_monitor_json.h | 5 ++
src/qemu/qemu_monitor_text.c | 31 ++++++++++
src/qemu/qemu_monitor_text.h | 3 +
src/remote/remote_driver.c | 41 +++++++++++++
src/remote/remote_protocol.x | 13 ++++-
src/remote_protocol-structs | 8 +++
src/storage/storage_driver.c | 4 +-
src/test/test_driver.c | 1 +
src/uml/uml_driver.c | 4 +-
src/util/iohelper.c | 12 +++-
src/vbox/vbox_tmpl.c | 134 ++++++++++++++++++++++++++++++++++++++++++
src/vmware/vmware_driver.c | 1 +
src/xen/xen_driver.c | 4 +-
src/xen/xen_driver.h | 1 +
src/xen/xen_hypervisor.c | 1 +
src/xen/xen_inotify.c | 1 +
src/xen/xend_internal.c | 1 +
src/xen/xm_internal.c | 1 +
src/xen/xs_internal.c | 1 +
src/xenapi/xenapi_driver.c | 1 +
tools/virsh.c | 97 ++++++++++++++++++++++++++++++
tools/virsh.pod | 6 ++
38 files changed, 667 insertions(+), 19 deletions(-)
--
1.7.5.rc3
13 years, 7 months
[libvirt] [PATCH] domain: Require <init> for container guests
by Cole Robinson
Use capabilities to allow a driver to register a default <init> if none
is specified in the XML. Openvz was already open-coding this to be /sbin/init
LXC currently falls over if no init is specified, so an explicit error is
an improvement IMO.
(Side note: I don't think we can set a default value for LXC. If we use
/sbin/init but the user doesn't specify a separate root FS for their guest,
the container will rerun the host's init which can be traumatic :). For
virt-install I'm thinking of defaulting to /sbin/init if a root FS has
been specified, otherwise require the user to manually specify <init>)
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/conf/capabilities.h | 1 +
src/conf/domain_conf.c | 12 ++++++++++++
src/openvz/openvz_conf.c | 4 +++-
src/openvz/openvz_driver.c | 14 --------------
4 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h
index 96bf0a2..e2fa1d6 100644
--- a/src/conf/capabilities.h
+++ b/src/conf/capabilities.h
@@ -150,6 +150,7 @@ struct _virCaps {
int (*privateDataXMLFormat)(virBufferPtr, void *);
int (*privateDataXMLParse)(xmlXPathContextPtr, void *);
bool hasWideScsiBus;
+ const char *defaultInitPath;
virDomainXMLNamespace ns;
};
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9ab9a5a..f7e4959 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5708,6 +5708,18 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
if (STREQ(def->os.type, "exe")) {
def->os.init = virXPathString("string(./os/init[1])", ctxt);
+ if (!def->os.init) {
+ if (caps->defaultInitPath) {
+ def->os.init = strdup(caps->defaultInitPath);
+ if (!def->os.init) {
+ goto no_memory;
+ }
+ } else {
+ virDomainReportError(VIR_ERR_XML_ERROR, "%s",
+ _("init binary must be specified"));
+ goto error;
+ }
+ }
}
if (STREQ(def->os.type, "xen") ||
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 88cd4c8..45bc398 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -174,8 +174,10 @@ virCapsPtr openvzCapsInit(void)
0,
NULL) == NULL)
goto no_memory;
- return caps;
+ caps->defaultInitPath = "/sbin/init";
+
+ return caps;
no_memory:
virCapabilitiesFree(caps);
return NULL;
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 60f2dc2..6af4f75 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -857,13 +857,6 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
VIR_DOMAIN_XML_INACTIVE)) == NULL)
goto cleanup;
- if (vmdef->os.init == NULL) {
- if (!(vmdef->os.init = strdup("/sbin/init"))) {
- virReportOOMError();
- goto cleanup;
- }
- }
-
vm = virDomainFindByName(&driver->domains, vmdef->name);
if (vm) {
openvzError(VIR_ERR_OPERATION_FAILED,
@@ -943,13 +936,6 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
VIR_DOMAIN_XML_INACTIVE)) == NULL)
goto cleanup;
- if (vmdef->os.init == NULL) {
- if (!(vmdef->os.init = strdup("/sbin/init"))) {
- virReportOOMError();
- goto cleanup;
- }
- }
-
vm = virDomainFindByName(&driver->domains, vmdef->name);
if (vm) {
openvzError(VIR_ERR_OPERATION_FAILED,
--
1.7.4.4
13 years, 7 months
[libvirt] [PATCH] phyp: avoid a crash
by Eric Blake
This has been present since the introduction of phypAttachDevice
in commit 444fd07a.
* src/phyp/phyp_driver.c (phypAttachDevice): Don't dereference
NULL.
---
Found by clang, but the NULL dereference is very blatant.
However, I'm worried that this patch, while solving the NULL deref, is
dead wrong. In researching this patch, I also found a memory leak:
phypDomainCreateAndStart mallocs a virDomainDefPtr and passes it
phypBuildLpar, but phypBuildLpar neither stashes that memory into a
hash table nor frees it. If it were to stash it into a table, then
subsequent operations on the same domain should reuse that existing
def, rather than malloc'ing one from scratch. Conversely, if the
driver can reconstruct a def in entirety by reading lpar state, then
def should be freed, and there should be a function to recreate a def
at will. Mallocing a temporary def in functions like phypAttachDevice
is probably the wrong thing to do, when really we want to get at the
domain definition corresponding to the domain we are modifying.
src/phyp/phyp_driver.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 71a3d29..3b4235c 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1716,14 +1716,19 @@ phypAttachDevice(virDomainPtr domain, const char *xml)
char *vios_name = NULL;
char *profile = NULL;
virDomainDeviceDefPtr dev = NULL;
virDomainDefPtr def = NULL;
virBuffer buf = VIR_BUFFER_INITIALIZER;
char *domain_name = NULL;
+ if (VIR_ALLOC(def) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
domain_name = escape_specialcharacters(domain->name);
if (domain_name == NULL) {
goto cleanup;
}
def->os.type = strdup("aix");
--
1.7.4.4
13 years, 7 months