[libvirt] [PATCH] conf: Mark missing optional USB devices in domain XML
by Jiri Denemark
When startupPolicy set for a USB devices allows such device to be
missing, there was no way this could be detected from domain XML. With
this patch, libvirt emits a new missing='yes' attribute for such devices
when active domain XML is generated.
---
docs/schemas/domaincommon.rng | 8 ++++++++
src/conf/domain_conf.c | 5 +++++
2 files changed, 13 insertions(+)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index b142716..70bc0e2 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1654,6 +1654,14 @@
</optional>
<interleave>
<element name="source">
+ <optional>
+ <attribute name="missing">
+ <choice>
+ <value>yes</value>
+ <value>no</value>
+ </choice>
+ </attribute>
+ </optional>
<choice>
<group>
<ref name="usbproduct"/>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1eda551..a2971cd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12102,6 +12102,11 @@ virDomainHostdevSourceFormat(virBufferPtr buf,
if (def->source.subsys.u.usb.autoAddress &&
(flags & VIR_DOMAIN_XML_MIGRATABLE))
virBufferAddLit(buf, " autoAddress='yes'");
+
+ if (def->missing &&
+ !(flags & VIR_DOMAIN_XML_INACTIVE))
+ virBufferAddLit(buf, " missing='yes'");
+
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
--
1.7.12.3
12 years, 1 month
[libvirt] [PATCH v2 0/3] command line fd passing using fd sets
by Corey Bryant
This series adds command line file descriptor passing support
via a new -add-fd option. This is a follow-on to the existing
QMP fd passing support provided in the following patch series:
comments.gmane.org/gmane.comp.emulators.qemu/165463
The new -add-fd option is designed to mirror the add-fd QMP
option as much as possible.
Corey Bryant (3):
monitor: Allow add-fd to any specified fd set
monitor: Enable adding an inherited fd to an fd set
qemu-config: Add new -add-fd command line option
monitor.c | 131 +++++++++++++++++++++++++++++++------------------------
monitor.h | 2 +
qapi-schema.json | 1 -
qemu-config.c | 22 ++++++++++
qemu-options.hx | 35 +++++++++++++++
vl.c | 36 +++++++++++++++
6 files changed, 170 insertions(+), 57 deletions(-)
--
1.7.11.4
12 years, 1 month
[libvirt] [PATCH v1 0/3] libvirt: Implement CPU model driver for PowerPC
by Li Zhang
CPU model driver is to get host's CPU information and it also provides
one mechanism to expose host's CPU information to guests during migration.
When migrating one guest from one machine to another machine, it will
compare the CPU information. If it is incomptible, it won't start the
guest.
On x86, it uses CPUID instruction to get information. When migrating
the guest, if the CPU defined in guest XML file is incompatible with
host CPU, cpu-baseline will find out best features to expose to guest.
Refer to
[http://berrange.com/posts/2010/02/15
/guest-cpu-model-configuration-in-libvirt-with-qemukvm/].
On PowerPC, it can get CPU version by mfpvr instruction. So, if PVR is
different from definition in guest XML file by cpu-compare, it will fail
to start guest. The CPU infromation can be got by cpu-baseline. But only
CPU vendor and model can be shown, there are no features as x86.
So on PowrePC, it assumes that migration only occurs between the machines
with the same type CPUs on PowerPC.
In this driver, there are definitions of models and PVRs for CPUs supported
on PowerPC. The relationship between models and PVRs are as the following:
For one specific CPU model, its PVR is unique. And also for one PVR code,
the PVR code is also unique.
So from the PVR code of CPU data, it's easy to get model and vendor information.
It is tested on my Power machine which CPU PVR is Power7_v2.3.
* cap.xml has the same definition as the host.
[root@ltckvmopal2 kvm-test]# /bin/virsh cpu-compare cap.xml
CPU described in cap.xml is identical to host CPU
[root@ltckvmopal2 kvm-test]# /bin/virsh cpu-baseline cap.xml
<cpu mode='custom' match='exact'>
<model fallback='allow'>POWER7_v2.3</model>
<vendor>IBM</vendor>
</cpu>
* cap.xml has differnt model as the host.
[root@ltckvmopal2 kvm-test]# /bin/virsh cpu-compare cap.xml
CPU described in cap.xml is incompatible with host CPU
[root@ltckvmopal2 kvm-test]# /bin/virsh cpu-baseline cap.xml
<cpu mode='custom' match='exact'>
<model fallback='allow'>POWER7_v2.1</model>
<vendor>IBM</vendor>
</cpu>
*v1 -> v2:
* Fix coding style's problems in several places.
* Seperate doc-fix from the coding
Li Zhang (3):
libvirt: Add one file cpu_ppc_data.h to define CPU data for PPC
libvirt: Implement CPU model driver for PowerPC
Doc-fix for PowerPC CPU model driver
src/cpu/cpu.h | 3 +
src/cpu/cpu_map.xml | 14 ++
src/cpu/cpu_powerpc.c | 589 ++++++++++++++++++++++++++++++++++++++++++++++--
src/cpu/cpu_ppc_data.h | 33 +++
4 files changed, 621 insertions(+), 18 deletions(-)
create mode 100644 src/cpu/cpu_ppc_data.h
--
1.7.7.6
12 years, 1 month
[libvirt] [PATCHv7 0/9] blockjob: live block migration
by Eric Blake
v6 of these patches is here:
https://www.redhat.com/archives/libvir-list/2012-April/msg01240.html
The 'drive-mirror' command not only missed qemu 1.1 (back when I
first posted these patches), but also missed qemu 1.2. Paolo
is still working on re-posting his patches to the qemu lists
(see patch 2/9 for a link to his previous posting, which has had
two months of commentary). I'm still not anxious to have these
commands committed to upstream libvirt until 'drive-mirror' is
at least in qemu.git rather than just Paolo's tree, but thought
it would be worth rebasing the series to track the things that
have changed since April.
In v7, I've adjusted the series to cater to Paolo's proposed QMP
semantics (most of the review on his last patch to the qemu list
was on the internals, and not the interface itself), as well as to
allow working out-of-the-box with the RHEL 6.3 implementation of
block copy.
Unfortunately, since Paolo's patches are still in flux, I suspect
this will need a v8 that has seen further testing with both upstream
qemu.git and RHEL 6.3 git.
Eric Blake (9):
blockjob: react to active block copy
blockjob: add qemu capabilities related to block jobs
blockjob: return appropriate event and info
blockjob: support pivot operation on cancel
blockjob: make drive-reopen safer
blockjob: implement block copy for qemu
blockjob: allow for existing files
blockjob: allow mirroring under SELinux and cgroup
blockjob: relabel entire existing chain
include/libvirt/libvirt.h.in | 1 +
src/conf/domain_conf.c | 12 ++
src/conf/domain_conf.h | 1 +
src/libvirt.c | 7 +-
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 2 +
src/qemu/qemu_driver.c | 413 ++++++++++++++++++++++++++++++++++++++++++-
src/qemu/qemu_hotplug.c | 7 +
src/qemu/qemu_monitor.c | 52 ++++++
src/qemu/qemu_monitor.h | 14 ++
src/qemu/qemu_monitor_json.c | 101 ++++++++++-
src/qemu/qemu_monitor_json.h | 21 ++-
src/qemu/qemu_process.c | 2 +
14 files changed, 625 insertions(+), 11 deletions(-)
--
1.7.11.4
12 years, 1 month
[libvirt] [PATCH 0/5] udev based backend for virInterface
by Doug Goldstein
The goal is to provide a read-only virInterface provider when netcf is
unavailable. With this patchset it makes virt-manager happy enough that it
does not attempt to do anything with HAL to figure out the host's network
devices.
All patches but 4/5 are really ready for prime time. 4/5 can get merged but it
is somewhat incomplete. With regards to bond and devices in a bridge. The
patches are all at different versions depending on how many times they've hit
the list.
Doug Goldstein (5):
interface: add udev based backend for virInterface
interface: fix netcf based backend naming
interface: always build all available backends
interface: add virInterfaceGetXMLDesc() in udev
interface: add udevIfaceIsActive() to udev backend
configure.ac | 18 +-
po/POTFILES.in | 1 +
src/Makefile.am | 14 +-
src/interface/interface_backend_netcf.c | 4 +-
src/interface/interface_backend_udev.c | 671 +++++++++++++++++++++++++++++++
src/interface/interface_driver.c | 37 ++
src/interface/interface_driver.h | 3 +
tools/virsh.c | 2 +
8 files changed, 734 insertions(+), 16 deletions(-)
create mode 100644 src/interface/interface_backend_udev.c
create mode 100644 src/interface/interface_driver.c
--
1.7.8.6
12 years, 1 month
[libvirt] 100+ misspellings
by Jim Meyering
Hello,
In case someone is interested in weeding out the inevitable false
positives, here is a slightly filtered list of misspelled words
in libvirt, as detected by the misspellings program from here:
http://github.com/lyda/misspell-check
Here's the output from this command:
misspellings $(git ls-files)|grep -vE 'gnulib/|po/|ChangeLog-old'
HACKING:456: particulary -> "particularly"
configure.ac:1359: presense -> "presence"
daemon/libvirtd.conf:254: upto -> "up to"
daemon/libvirtd.conf:270: upto -> "up to"
daemon/stream.c:692: upto -> "up to"
docs/api.html.in:67: garanteed -> "guaranteed"
docs/api.html.in:73: garanteed -> "guaranteed"
docs/apibuild.py:2476: unkown -> "unknown"
docs/apps.html.in:191: upto -> "up to"
docs/firewall.html.in:320: managable -> "manageable","manageably"
docs/formatdomain.html.in:423: ommitted -> "omitted"
docs/hacking.html.in:547: particulary -> "particularly"
docs/internals/locking.html.in:153: psuedo -> "pseudo"
docs/news.html.in:610: commited -> "committed"
docs/news.html.in:1195: dependancy -> "dependency"
docs/news.html.in:1459: doesnt -> "doesn't"
docs/news.html.in:1570: dependancy -> "dependency"
docs/news.html.in:1837: stange -> "strange"
docs/news.html.in:1838: dependancy -> "dependency"
docs/news.html.in:1892: sucessful -> "successful"
docs/news.html.in:1893: sucessful -> "successful"
docs/news.html.in:2032: sucessful -> "successful"
docs/news.html.in:2472: orginal -> "original"
docs/news.html.in:2628: statment -> "statement"
docs/news.html.in:2793: controling -> "controlling"
docs/news.html.in:3912: Seperate -> "Separate"
docs/news.html.in:5025: occurence -> "occurrence"
docs/news.html.in:5592: Explictly -> "Explicitly"
docs/news.html.in:6508: beeing -> "being"
docs/news.html.in:7158: adressing -> "addressing","dressing"
docs/news.html.in:7483: Supress -> "Suppress"
docs/news.html.in:7542: occurence -> "occurrence"
docs/news.html.in:7551: sucess -> "success"
docs/news.html.in:7825: neccessary -> "necessary"
docs/news.html.in:7902: Occurence -> "Occurrence"
docs/news.html.in:7902: occurences -> "occurrences"
docs/news.html.in:8472: wierd -> "weird"
docs/news.html.in:8535: accomodate -> "accommodate"
docs/news.html.in:8598: dependancy -> "dependency"
docs/news.html.in:9008: dependancy -> "dependency"
docs/news.html.in:9306: dependancy -> "dependency"
docs/news.html.in:9324: dependance -> "dependence"
docs/news.html.in:9520: extention -> "extension"
docs/news.html.in:9587: dependance -> "dependence"
docs/remote.html.in:359: agains -> "against"
docs/schemas/interface.rng:7: everytime -> "every time"
docs/schemas/interface.rng:175: grat -> "great"
examples/domain-events/events-python/event-test.py:129: occurr -> "occur"
examples/domain-events/events-python/event-test.py:172: upto -> "up to"
examples/python/dominfo.py:46: runing -> "running"
include/libvirt/libvirt.h.in:642: targetting -> "targeting"
include/libvirt/libvirt.h.in:2935: specfic -> "specific"
include/libvirt/libvirt.h.in:3207: upto -> "up to"
include/libvirt/libvirt.h.in:3639: occuring -> "occurring"
src/conf/domain_conf.c:4565: Unkown -> "Unknown"
src/conf/domain_conf.c:4933: Unkown -> "Unknown"
src/conf/domain_conf.c:6914: Wierd -> "Weird"
src/conf/nwfilter_conf.c:2804: definiton -> "definition"
src/internal.h:114: conciously -> "consciously"
src/libvirt.c:3083: transfered -> "transferred"
src/libvirt.c:4390: dependant -> "dependent"
src/libvirt.c:4441: dependant -> "dependent"
src/libvirt.c:11461: upto -> "up to"
src/libvirt.c:11544: upto -> "up to"
src/libvirt.c:14119: funtion -> "function"
src/libvirt.c:14542: dependant -> "dependent"
src/libvirt_internal.h:2: publically -> "publicly"
src/phyp/phyp_driver.c:2067: avaliable -> "available"
src/phyp/phyp_driver.c:2290: avaliable -> "available"
src/phyp/phyp_driver.c:2770: avaliable -> "available"
src/qemu/qemu_capabilities.c:659: existance -> "existence"
src/qemu/qemu_capabilities.c:1234: targetting -> "targeting"
src/qemu/qemu_conf.c:205: lenght -> "length"
src/qemu/qemu_driver.c:1235: calulate -> "calculate"
src/qemu/qemu_monitor_text.c:2406: everthing -> "everything"
src/qemu/qemu_process.c:2657: pased -> "passed"
src/rpc/virnetsaslcontext.c:153: Succesful -> "Successful"
src/rpc/virnettlscontext.c:377: Succesful -> "Successful"
src/storage/storage_backend_disk.c:536: boundry -> "boundary"
src/storage/storage_backend_disk.c:561: boundry -> "boundary"
src/storage/storage_backend_disk.c:571: boundry -> "boundary"
src/storage/storage_backend_disk.c:620: boundry -> "boundary"
src/storage/storage_backend_rbd.c:318: occured -> "occurred"
src/uml/uml_driver.c:260: upto -> "up to"
src/uml/uml_driver.c:1293: calulate -> "calculate"
src/util/cgroup.c:69: HIERACHY -> "Hierarchy"
src/util/cgroup.c:172: neccessarily -> "necessarily"
src/util/cgroup.c:592: HIERACHY -> "Hierarchy"
src/util/cgroup.c:1007: HIERACHY -> "Hierarchy"
src/util/cgroup.c:2029: existance -> "existence"
src/util/processinfo.c:80: upto -> "up to"
src/util/processinfo.c:145: upto -> "up to"
src/util/virpidfile.c:369: agin -> "again"
src/util/virpidfile.c:378: agin -> "again"
src/util/virsocketaddr.c:421: recieve -> "receive"
src/util/virsocketaddr.c:451: recieve -> "receive"
src/util/virtime.c:105: THRU -> "Through"
src/util/virtime.c:162: THRU -> "Through"
src/util/virtime.c:163: THRU -> "Through"
src/vbox/vbox_tmpl.c:7050: becuase -> "because"
src/vbox/vbox_tmpl.c:8748: devide -> "divide"
src/vbox/vbox_tmpl.c:9262: persistance -> "persistence"
src/xen/xend_internal.c:517: targetting -> "targeting"
src/xen/xm_internal.c:177: funtion -> "function"
src/xen/xm_internal.c:201: funtion -> "function"
src/xen/xm_internal.c:310: funtion -> "function"
src/xen/xm_internal.c:386: alot -> "a lot","allot"
src/xenxs/xen_sxpr.c:814: Subsquent -> "Subsequent"
tests/virnettlscontexttest.c:451: suceeds -> "succeeds"
tools/virsh.pod:128: specfic -> "specific"
tools/virsh.pod:597: folowing -> "following"
tools/virsh.pod:2293: occurr -> "occur"
tools/virsh.pod:2537: preceed -> "precede"
12 years, 1 month
[libvirt] libvirt support for dhcp6 .. not time soon
by Gene Czarcinski
Well, so much for libvirt support for stateful IPv6 addresses (dhcp6).
Not with the current design/implementation.
The problem is UPD6 server port 547 or rather how it is used. I am not
sure what the technical details are yet nor if this is "fixable", but as
the situation now stands, there can be only one dhcp6 server on a
system. DHCPD6 cannot live with dnsmasq and dnsmasq cannot live with
another dnsmasq ... first one started grabs the port and the others die
because they cannot get exclusive use.
I suppose you could run one dnsmasq which supported all virtual networks
but things are going to get messy when virtual networks are
started/destroyed/whatever.
I kludged together a little patch for libvirt which forced a dhcp-range
specification for any net with an ipv6 definition.
If anyone has some insight into this, I would appreciate hearing able it.
If anyone knew that you could not run two or more dhcp6 servers on the
same system, I realy wish that information was more widely known (or
obvious).
Gene
12 years, 1 month
[libvirt] Fw:Re:Re: build libvirt error. lack of AppArmor .
by yue
1.my configure options is "./configure --with-selinux=no --with-secdriver-selinux=no --with-apparmor=no --with-secdriver-apparmor=no --with-init-script=redhat"
because i can not start spSP3-guest-OS,infos on the internet tell security-driver should be disabled. i just test it. so --with-XXXXX=no.
the second problem is details of my guest-os.
2. /var/log/libvirt/qemu/xpSP3.log. i do not know libvirtd or qemu-kvm which one can not recognize ceph-rbd?
--my rbd disk configuration-----------
<disk type='network' device='disk'>
<driver name='qemu' type='raw'/>
<auth username='cloud'>
<secret type='ceph' uuid='7a91dc24-b072-43c4-98fb-4b2415322b0f'/>
</auth>
<source protocol='rbd' name='cloud/testrbd'>
<host name='192.168.10.4' port='6789'/>
</source>
<target dev='vdb' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</disk>
---xpSP3.log----------------
LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin HOME=/root USER=root LOGNAME=root QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -S -M rhel6.2.0 -enable-kvm -m 512 -smp 1,sockets=1,cores=1,threads=1 -name xpSP3 -uuid b45bd66a-6700-4905-c5f4-4c799413d7b7 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/xpSP3.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime,driftfix=slew -no-shutdown -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/var/lib/libvirt/images/xpSP3.img,if=none,id=drive-ide0-0-0,format=raw,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -drive file=rbd:cloud/testrbd:id=cloud:key=AQCGbGRQ+M+NGBAATtylZNiSxqCTQ4uaApd+9w==:auth_supported=cephx none:mon_host=192.168.10.4\:6789,if=none,id=drive-ide0-0-1,format=raw -device ide-drive,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 -netdev tap,fd=26,id=hostnet0 -device e1000,netdev=hostnet0,id=net0!
,mac=52:54:00:2a:8c:48,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0 -vnc 0.0.0.0:0 -vga std -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
Domain id=2 is tainted: high-privileges
char device redirected to /dev/pts/4
qemu-kvm: -drive file=rbd:cloud/testrbd:id=cloud:key=AQCGbGRQ+M+NGBAATtylZNiSxqCTQ4uaApd+9w==:auth_supported=cephx none:mon_host=192.168.10.4\:6789,if=none,id=drive-ide0-0-1,format=raw: could not open disk image rbd:cloud/testrbd:id=cloud:key=AQCGbGRQ+M+NGBAATtylZNiSxqCTQ4uaApd+9w==:auth_supported=cephx none:mon_host=192.168.10.4\:6789: No such file or directory
At 2012-10-11 05:11:58,"Eric Blake" <eblake(a)redhat.com> wrote:
>On 10/10/2012 04:04 AM, yue wrote:
>> error occur when attach a rbd-disk to domain.
>>
>> 1.configure: error: You must install the AppArmor development package in order to compile libvirt
>
>What command line did you pass to configure? AppArmor is optional (and
>in fact, Fedora does not use it); so this message should only be
>triggered if you passed an explicit --with-apparmor or
>--with-secdriver-apparmor to configure, in which case, yes, then you
>need the apparmor devel package.
>
>> 2.
>> 2012-10-10 17:36:16.305+0000: 3808: warning : qemuDomainObjTaint:1297 : Domain id=2 name='xpSP3' uuid=b45bd66a-6700-4905-c5f4-4c799413d7b7 is tainted: high-privileges
>> 2012-10-10 17:36:16.712+0000: 3808: error : qemuMonitorOpenUnix:266 : failed to connect to monitor socket: No such process
>
>This usually means that qemu failed to start; can you check the log file
>for that guest (perhaps /var/log/libvirt/qemu/xpSP3.log) to see if there
>are more details why?
>
>--
>Eric Blake eblake(a)redhat.com +1-919-301-3266
>Libvirt virtualization library http://libvirt.org
>
12 years, 1 month
[libvirt] [libvirt-glib v2] gconfig: Add API to set domain/pm tree
by Zeeshan Ali (Khattak)
From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
API for new domain power management configuration.
---
libvirt-gconfig/Makefile.am | 2 +
.../libvirt-gconfig-domain-power-management.c | 100 +++++++++++++++++++++
.../libvirt-gconfig-domain-power-management.h | 73 +++++++++++++++
libvirt-gconfig/libvirt-gconfig-domain.c | 16 ++++
libvirt-gconfig/libvirt-gconfig-domain.h | 3 +
libvirt-gconfig/libvirt-gconfig.h | 1 +
libvirt-gconfig/libvirt-gconfig.sym | 11 +++
7 files changed, 206 insertions(+)
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-power-management.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-power-management.h
diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 5a80123..caa62f0 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -50,6 +50,7 @@ GCONFIG_HEADER_FILES = \
libvirt-gconfig-domain-memballoon.h \
libvirt-gconfig-domain-os.h \
libvirt-gconfig-domain-parallel.h \
+ libvirt-gconfig-domain-power-management.h \
libvirt-gconfig-domain-redirdev.h \
libvirt-gconfig-domain-seclabel.h \
libvirt-gconfig-domain-serial.h \
@@ -121,6 +122,7 @@ GCONFIG_SOURCE_FILES = \
libvirt-gconfig-domain-memballoon.c \
libvirt-gconfig-domain-os.c \
libvirt-gconfig-domain-parallel.c \
+ libvirt-gconfig-domain-power-management.c \
libvirt-gconfig-domain-redirdev.c \
libvirt-gconfig-domain-seclabel.c \
libvirt-gconfig-domain-serial.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-power-management.c b/libvirt-gconfig/libvirt-gconfig-domain-power-management.c
new file mode 100644
index 0000000..4bc588d
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-power-management.c
@@ -0,0 +1,100 @@
+/*
+ * libvirt-gconfig-domain-power-management.c: libvirt domain power management configuration
+ *
+ * Copyright (C) 2012 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Authors:
+ *
+ * Zeeshan Ali (Khattak) <zeeshanak(a)gnome.org>
+ * Christophe Fergeau <cfergeau(a)redhat.com>
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_POWER_MANAGEMENT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
+ GVIR_CONFIG_TYPE_DOMAIN_POWER_MANAGEMENT, \
+ GVirConfigDomainPowerManagementPrivate))
+
+struct _GVirConfigDomainPowerManagementPrivate
+{
+ gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainPowerManagement,
+ gvir_config_domain_power_management,
+ GVIR_CONFIG_TYPE_OBJECT);
+
+static void gvir_config_domain_power_management_class_init
+ (GVirConfigDomainPowerManagementClass *klass)
+{
+ g_type_class_add_private(klass, sizeof(GVirConfigDomainPowerManagementPrivate));
+}
+
+
+static void
+gvir_config_domain_power_management_init(GVirConfigDomainPowerManagement *pm)
+{
+ g_debug("Init GVirConfigDomainPowerManagement=%p", pm);
+
+ pm->priv = GVIR_CONFIG_DOMAIN_POWER_MANAGEMENT_GET_PRIVATE(pm);
+}
+
+
+GVirConfigDomainPowerManagement *gvir_config_domain_power_management_new(void)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_POWER_MANAGEMENT,
+ "pm", NULL);
+ return GVIR_CONFIG_DOMAIN_POWER_MANAGEMENT(object);
+}
+
+GVirConfigDomainPowerManagement *gvir_config_domain_power_management_new_from_xml(const gchar *xml,
+ GError **error)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_POWER_MANAGEMENT,
+ "pm", NULL, xml, error);
+ return GVIR_CONFIG_DOMAIN_POWER_MANAGEMENT(object);
+}
+
+void gvir_config_domain_power_management_set_mem_suspend_enabled(GVirConfigDomainPowerManagement *pm,
+ gboolean enabled)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_POWER_MANAGEMENT(pm));
+
+ gvir_config_object_add_child_with_attribute(GVIR_CONFIG_OBJECT(pm),
+ "suspend-to-mem",
+ "enabled",
+ enabled? "yes" : "no");
+}
+
+void gvir_config_domain_power_management_set_disk_suspend_enabled(GVirConfigDomainPowerManagement *pm,
+ gboolean enabled)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_POWER_MANAGEMENT(pm));
+
+ gvir_config_object_add_child_with_attribute(GVIR_CONFIG_OBJECT(pm),
+ "suspend-to-disk",
+ "enabled",
+ enabled? "yes" : "no");
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-power-management.h b/libvirt-gconfig/libvirt-gconfig-domain-power-management.h
new file mode 100644
index 0000000..59dde79
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-power-management.h
@@ -0,0 +1,73 @@
+/*
+ * libvirt-gconfig-domain-power-management.h: libvirt domain power management configuration
+ *
+ * Copyright (C) 2012 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Zeeshan Ali (Khattak) <zeeshanak(a)gnome.org>
+ * Christophe Fergeau <cfergeau(a)redhat.com>
+ */
+
+#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD)
+#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly."
+#endif
+
+#ifndef __LIBVIRT_GCONFIG_DOMAIN_POWER_MANAGEMENT_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_POWER_MANAGEMENT_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_CONFIG_TYPE_DOMAIN_POWER_MANAGEMENT (gvir_config_domain_power_management_get_type ())
+#define GVIR_CONFIG_DOMAIN_POWER_MANAGEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_POWER_MANAGEMENT, GVirConfigDomainPowerManagement))
+#define GVIR_CONFIG_DOMAIN_POWER_MANAGEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_POWER_MANAGEMENT, GVirConfigDomainPowerManagementClass))
+#define GVIR_CONFIG_IS_DOMAIN_POWER_MANAGEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_POWER_MANAGEMENT))
+#define GVIR_CONFIG_IS_DOMAIN_POWER_MANAGEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_POWER_MANAGEMENT))
+#define GVIR_CONFIG_DOMAIN_POWER_MANAGEMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_POWER_MANAGEMENT, GVirConfigDomainPowerManagementClass))
+
+typedef struct _GVirConfigDomainPowerManagement GVirConfigDomainPowerManagement;
+typedef struct _GVirConfigDomainPowerManagementPrivate GVirConfigDomainPowerManagementPrivate;
+typedef struct _GVirConfigDomainPowerManagementClass GVirConfigDomainPowerManagementClass;
+
+struct _GVirConfigDomainPowerManagement
+{
+ GVirConfigObject parent;
+
+ GVirConfigDomainPowerManagementPrivate *priv;
+
+ /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainPowerManagementClass
+{
+ GVirConfigObjectClass parent_class;
+
+ gpointer padding[20];
+};
+
+GType gvir_config_domain_power_management_get_type(void);
+
+GVirConfigDomainPowerManagement *gvir_config_domain_power_management_new(void);
+GVirConfigDomainPowerManagement *gvir_config_domain_power_management_new_from_xml(const gchar *xml,
+ GError **error);
+void gvir_config_domain_power_management_set_mem_suspend_enabled(GVirConfigDomainPowerManagement *pm,
+ gboolean enabled);
+void gvir_config_domain_power_management_set_disk_suspend_enabled(GVirConfigDomainPowerManagement *pm,
+ gboolean enabled);
+
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_POWER_MANAGEMENT_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
index e679e3a..e664351 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain.c
@@ -804,3 +804,19 @@ void gvir_config_domain_set_cpu(GVirConfigDomain *domain,
"cpu",
GVIR_CONFIG_OBJECT(cpu));
}
+
+/**
+ * gvir_config_domain_set_power_management:
+ * @domain: a #GVirConfigDomain
+ * @pm: (allow-none): a #GVirPowerManagement instance
+ */
+void gvir_config_domain_set_power_management(GVirConfigDomain *domain,
+ GVirConfigDomainPowerManagement *pm)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN(domain));
+ g_return_if_fail(pm != NULL || GVIR_CONFIG_IS_DOMAIN_POWER_MANAGEMENT(pm));
+
+ gvir_config_object_attach_replace(GVIR_CONFIG_OBJECT(domain),
+ "pm",
+ GVIR_CONFIG_OBJECT(pm));
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.h b/libvirt-gconfig/libvirt-gconfig-domain.h
index a7bd73b..3a7be12 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain.h
@@ -32,6 +32,7 @@
#include <libvirt-gconfig/libvirt-gconfig-domain-device.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-seclabel.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-cpu.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-power-management.h>
G_BEGIN_DECLS
@@ -143,6 +144,8 @@ gchar *gvir_config_domain_get_custom_xml(GVirConfigDomain *domain,
GVirConfigDomainCpu *gvir_config_domain_get_cpu(GVirConfigDomain *domain);
void gvir_config_domain_set_cpu(GVirConfigDomain *domain,
GVirConfigDomainCpu *cpu);
+void gvir_config_domain_set_power_management(GVirConfigDomain *domain,
+ GVirConfigDomainPowerManagement *pm);
G_END_DECLS
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index 4b5ccbd..0428259 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -67,6 +67,7 @@
#include <libvirt-gconfig/libvirt-gconfig-domain-memballoon.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-os.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-parallel.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-power-management.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-redirdev.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-seclabel.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-serial.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 2ec2e80..622e0f2 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -472,4 +472,15 @@ LIBVIRT_GCONFIG_0.1.3 {
gvir_config_domain_graphics_vnc_set_socket;
} LIBVIRT_GCONFIG_0.1.0;
+LIBVIRT_GCONFIG_0.1.4 {
+ global:
+ gvir_config_domain_power_management_get_type;
+ gvir_config_domain_power_management_new;
+ gvir_config_domain_power_management_new_from_xml;
+ gvir_config_domain_power_management_set_mem_suspend_enabled;
+ gvir_config_domain_power_management_set_disk_suspend_enabled;
+
+ gvir_config_domain_set_power_management;
+} LIBVIRT_GCONFIG_0.1.3;
+
# .... define new API here using predicted next version number ....
--
1.7.12.1
12 years, 1 month
[libvirt] [PATCH 0/6] Enhance save/restore/migration of domains with USB devices
by Jiri Denemark
USB devices can disappear without OS being mad about it, which makes
them ideal for startupPolicy so that a domain with USB devices can be
migrated to a host that lacks the USB devices. Moreover, this series
allows USB devices to be re-plugged or a host to be rebooted while
domains with USB devices are (managed)saved.
Jiri Denemark (6):
conf: Add support for startupPolicy for USB devices
qemu: Introduce qemuFindHostdevUSBDevice
qemu: Add option to treat missing USB devices as success
qemu: Implement startupPolicy for USB passed through devices
Add MIGRATABLE flag for virDomainGetXMLDesc
qemu: Make save/restore with USB devices usable
docs/formatdomain.html.in | 28 ++++++--
docs/schemas/domaincommon.rng | 3 +
include/libvirt/libvirt.h.in | 1 +
src/conf/domain_conf.c | 45 ++++++++++++-
src/conf/domain_conf.h | 4 ++
src/qemu/qemu_cgroup.c | 2 +
src/qemu/qemu_command.c | 20 ++++--
src/qemu/qemu_domain.c | 21 +++---
src/qemu/qemu_domain.h | 11 ++--
src/qemu/qemu_driver.c | 19 +++---
src/qemu/qemu_hostdev.c | 137 +++++++++++++++++++++++++++++-----------
src/qemu/qemu_hostdev.h | 6 +-
src/qemu/qemu_hotplug.c | 33 +---------
src/qemu/qemu_migration.c | 12 ++--
src/qemu/qemu_process.c | 16 ++---
src/security/security_dac.c | 16 +++--
src/security/security_selinux.c | 16 +++--
src/util/hostusb.c | 91 ++++++++++++++++++--------
src/util/hostusb.h | 22 ++++---
tools/virsh-domain.c | 4 ++
tools/virsh.pod | 7 +-
21 files changed, 351 insertions(+), 163 deletions(-)
--
1.7.12
12 years, 1 month