[libvirt] [PATCH] building: fix deps error when some drivers are not built
by Wen Congyang
libvirt-daemon-driver-XXX should be depent on only when with_driver_modules
is 1.
libvirt-daemon-driver-libxl should be depent on only when with_libxl is 1.
libvirt-daemon-driver-lxc should be depent on only when with_lxc is 1.
libvirt-daemon-driver-qemu should be depent on only when with_qemu is 1.
libvirt-daemon-driver-uml should be depent on only when with_uml is 1.
libvirt-daemon-driver-xen should be depent on only when with_xen is 1.
---
libvirt.spec.in | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 140a182..cfcfc1c 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -326,11 +326,22 @@ Requires: libvirt-daemon-config-network = %{version}-%{release}
%if %{with_nwfilter}
Requires: libvirt-daemon-config-nwfilter = %{version}-%{release}
%endif
+%if %{with_driver_modules}
+%if %{with_libxl}
Requires: libvirt-daemon-driver-libxl = %{version}-%{release}
+%endif
+%if %{with_lxc}
Requires: libvirt-daemon-driver-lxc = %{version}-%{release}
+%endif
+%if %{with_qemu}
Requires: libvirt-daemon-driver-qemu = %{version}-%{release}
+%endif
+%if %{with_uml}
Requires: libvirt-daemon-driver-uml = %{version}-%{release}
+%endif
+%if %{with_xen}
Requires: libvirt-daemon-driver-xen = %{version}-%{release}
+%endif
Requires: libvirt-daemon-driver-interface = %{version}-%{release}
Requires: libvirt-daemon-driver-secret = %{version}-%{release}
@@ -339,6 +350,7 @@ Requires: libvirt-daemon-driver-network = %{version}-%{release}
Requires: libvirt-daemon-driver-nodedev = %{version}-%{release}
Requires: libvirt-daemon-driver-nwfilter = %{version}-%{release}
%endif
+%endif
Requires: libvirt-client = %{version}-%{release}
# All build-time requirements. Run-time requirements are
@@ -750,7 +762,9 @@ Summary: Qemu driver plugin for the libvirtd daemon
Group: Development/Libraries
Requires: libvirt-daemon = %{version}-%{release}
# There really is a hard cross-driver dependency here
+%if %{with_driver_modules}
Requires: libvirt-daemon-driver-network = %{version}-%{release}
+%endif
%description daemon-driver-qemu
The qemu driver plugin for the libvirtd daemon, providing
@@ -765,7 +779,9 @@ Summary: LXC driver plugin for the libvirtd daemon
Group: Development/Libraries
Requires: libvirt-daemon = %{version}-%{release}
# There really is a hard cross-driver dependency here
+%if %{with_driver_modules}
Requires: libvirt-daemon-driver-network = %{version}-%{release}
+%endif
%description daemon-driver-lxc
The LXC driver plugin for the libvirtd daemon, providing
--
1.7.1
12 years, 4 months
[libvirt] Unable to start VM Libvirt-0.9.13
by B Veera-B37207
Hi Daniel,
I am unable to start VM
Lbvirt Version :
Compiled against library: libvir 0.9.13
Using library: libvir 0.9.13
Using API: QEMU 0.9.13
Running hypervisor: QEMU 1.0.0
Here is my command:
LC_ALL=C PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin HOME=/home/root USER=root LOGNAME=root /usr/bin/qemu-system-ppc -name new -M ppce500v2 -enable-kvm -m 256 -smp 1,sockets=1,cores=1,threads=1 -uuid eebd22bb-c1db-da23-ca6d-f54c9c23282f -nographic -nodefconfig -nodefaults -rtc base=utc -no-shutdown -kernel /boot/uImage-p2020rdb.bin -initrd /home/root/guest.rootfs.ext2.gz -append "root=/dev/ram rw console=ttyS0,115200" -serial tcp::4444,server,telnet -chardev socket,id=charserial0,host=,port=4444,path=/usr/local/var/lib/libvirt/qemu/new.monitor,server,nowait -device virtio-balloon-pci,id=balloon0 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/usr/local/var/lib/libvirt/qemu/new.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -device piix3-usb-uhci,id=usb -netdev tap,script=/home/root/qemu-ifup,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:fa:d4:84 -mem-path /var/lib/hugetlbfs/pagesize-4MB -dtb /usr/share/qemu/ppce500v2.dtb
I am able to start VM using above command, but when I convert to xml I unable to start VM
XML File:
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
<name>new</name>
<uuid>eebd22bb-c1db-da23-ca6d-f54c9c23282f</uuid>
<memory unit='KiB'>262144</memory>
<currentMemory unit='KiB'>262144</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='ppc' machine='ppce500v2'>hvm</type>
<kernel>/boot/uImage-p2020rdb.bin</kernel>
<initrd>/home/root/guest.rootfs.ext2.gz</initrd>
<cmdline>root=/dev/ram rw console=ttyS0,115200</cmdline>
</os>
<features>
<acpi/>
</features>
<cpu>
<topology sockets='1' cores='1' threads='1'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-ppc</emulator>
<serial type='tcp'>
<source mode='bind' host='' service='4444'/>
<protocol type='raw'/>
<target port='0'/>
</serial>
<console type='tcp'>
<source mode='bind' host='' service='4444'/>
<protocol type='raw'/>
<target type='serial' port='0'/>
</console>
<memballoon model='virtio'/>
</devices>
<qemu:commandline>
<qemu:arg value='-nodefconfig'/>
<qemu:arg value='-nodefaults'/>
<qemu:arg value='-rtc'/>
<qemu:arg value='base=utc'/>
<qemu:arg value='-no-shutdown'/>
<qemu:arg value='-chardev'/>
<qemu:arg value='socket,id=charserial0,host=,port=4444,path=/usr/local/var/lib/libvirt/qemu/new.monitor,server,nowait'/>
<qemu:arg value='-device'/>
<qemu:arg value='virtio-balloon-pci,id=balloon0'/>
<qemu:arg value='-nodefconfig'/>
<qemu:arg value='-nodefaults'/>
<qemu:arg value='-chardev'/>
<qemu:arg value='socket,id=charmonitor,path=/usr/local/var/lib/libvirt/qemu/new.monitor,server,nowait'/>
<qemu:arg value='-mon'/>
<qemu:arg value='chardev=charmonitor,id=monitor,mode=control'/>
<qemu:arg value='-rtc'/>
<qemu:arg value='base=utc'/>
<qemu:arg value='-no-shutdown'/>
<qemu:arg value='-device'/>
<qemu:arg value='piix3-usb-uhci,id=usb'/>
<qemu:arg value='-netdev'/>
<qemu:arg value='tap,script=/home/root/qemu-ifup,id=hostnet0'/>
<qemu:arg value='-device'/>
<qemu:arg value='virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:fa:d4:84'/>
<qemu:arg value='-mem-path'/>
<qemu:arg value='/var/lib/hugetlbfs/pagesize-4MB'/>
<qemu:arg value='-dtb'/>
<qemu:arg value='/usr/share/qemu/ppce500v2.dtb'/>
</qemu:commandline>
</domain>
Error:
"internal error process exited while connecting to monitor: qemu-system-ppc: -dev
ice piix3-usb-uhci,id=usb,bus=pci,addr=0x1.0x2: Bus 'pci' not found"
Regards,
Veera.
12 years, 4 months
[libvirt] [libvirt-glib PATCHv2] Fix *_new_from_xml
by Christophe Fergeau
For objects with a subtype 'type' attribute, when the _new_from_xml
function was called, the 'type' attribute was forcefully set to the
right value rather than checking that the passed-in value matches
the type of the subclass we are trying to instantiate. This commit
changes this, and returns NULL when the value of the 'type' attribute
of the passed-in XML document does not match the expected type.
---
libvirt-gconfig/libvirt-gconfig-domain-address-pci.c | 5 ++++-
libvirt-gconfig/libvirt-gconfig-domain-address-usb.c | 5 ++++-
libvirt-gconfig/libvirt-gconfig-domain-chardev-source-pty.c | 5 ++++-
libvirt-gconfig/libvirt-gconfig-domain-chardev-source-spicevmc.c | 5 ++++-
libvirt-gconfig/libvirt-gconfig-domain-controller-usb.c | 5 ++++-
libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c | 5 +++--
libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c | 5 +++--
libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c | 5 +++--
libvirt-gconfig/libvirt-gconfig-domain-interface-bridge.c | 5 +++--
libvirt-gconfig/libvirt-gconfig-domain-interface-network.c | 5 +++--
libvirt-gconfig/libvirt-gconfig-domain-interface-user.c | 5 +++--
libvirt-gconfig/libvirt-gconfig-domain-timer-pit.c | 5 ++++-
libvirt-gconfig/libvirt-gconfig-domain-timer-rtc.c | 5 ++++-
13 files changed, 46 insertions(+), 19 deletions(-)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-address-pci.c b/libvirt-gconfig/libvirt-gconfig-domain-address-pci.c
index 48e3872..16fe256 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-address-pci.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-address-pci.c
@@ -67,7 +67,10 @@ GVirConfigDomainAddressPci *gvir_config_domain_address_pci_new_from_xml(const gc
object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_ADDRESS_PCI,
"address", NULL, xml, error);
- gvir_config_object_set_attribute(object, "type", "pci", NULL);
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), "pci") != 0) {
+ g_object_unref(G_OBJECT(object));
+ return NULL;
+ }
return GVIR_CONFIG_DOMAIN_ADDRESS_PCI(object);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-address-usb.c b/libvirt-gconfig/libvirt-gconfig-domain-address-usb.c
index 3da5811..fdddcfb 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-address-usb.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-address-usb.c
@@ -67,7 +67,10 @@ GVirConfigDomainAddressUsb *gvir_config_domain_address_usb_new_from_xml(const gc
object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_ADDRESS_USB,
"address", NULL, xml, error);
- gvir_config_object_set_attribute(object, "type", "usb", NULL);
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), "usb") != 0) {
+ g_object_unref(G_OBJECT(object));
+ return NULL;
+ }
return GVIR_CONFIG_DOMAIN_ADDRESS_USB(object);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-pty.c b/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-pty.c
index 201e123..12e6f18 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-pty.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-pty.c
@@ -75,7 +75,10 @@ GVirConfigDomainChardevSourcePty *gvir_config_domain_chardev_source_pty_new_from
*/
object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_CHARDEV_SOURCE_PTY,
"dummy", NULL, xml, error);
- gvir_config_object_set_attribute(object, "type", "pty", NULL);
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), "pty") != 0) {
+ g_object_unref(G_OBJECT(object));
+ return NULL;
+ }
return GVIR_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY(object);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-spicevmc.c b/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-spicevmc.c
index 22eabf5..3590e55 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-spicevmc.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-spicevmc.c
@@ -75,6 +75,9 @@ GVirConfigDomainChardevSourceSpiceVmc *gvir_config_domain_chardev_source_spicevm
*/
object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_CHARDEV_SOURCE_SPICE_VMC,
"dummy", NULL, xml, error);
- gvir_config_object_set_attribute(object, "type", "spicevmc", NULL);
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), "spicevmc") != 0) {
+ g_object_unref(G_OBJECT(object));
+ return NULL;
+ }
return GVIR_CONFIG_DOMAIN_CHARDEV_SOURCE_SPICE_VMC(object);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-controller-usb.c b/libvirt-gconfig/libvirt-gconfig-domain-controller-usb.c
index 1fd248c..f4d3901 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-controller-usb.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-controller-usb.c
@@ -167,7 +167,10 @@ GVirConfigDomainControllerUsb *gvir_config_domain_controller_usb_new_from_xml(co
object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_CONTROLLER_USB,
"controller", NULL, xml, error);
- gvir_config_object_set_attribute(object, "type", "usb", NULL);
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), "usb") != 0) {
+ g_object_unref(G_OBJECT(object));
+ return NULL;
+ }
return GVIR_CONFIG_DOMAIN_CONTROLLER_USB(object);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c
index 7871ae5..8b22ad0 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c
@@ -68,9 +68,10 @@ gvir_config_domain_graphics_sdl_new_from_xml(const gchar *xml,
object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_SDL,
"graphics", NULL, xml, error);
- if (object == NULL)
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), "sdl") != 0) {
+ g_object_unref(G_OBJECT(object));
return NULL;
- gvir_config_object_set_attribute(object, "type", "sdl", NULL);
+ }
return GVIR_CONFIG_DOMAIN_GRAPHICS_SDL(object);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
index e60a778..61d3f5b 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
@@ -68,9 +68,10 @@ gvir_config_domain_graphics_spice_new_from_xml(const gchar *xml,
object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_SPICE,
"graphics", NULL, xml, error);
- if (object == NULL)
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), "spice") != 0) {
+ g_object_unref(G_OBJECT(object));
return NULL;
- gvir_config_object_set_attribute(object, "type", "spice", NULL);
+ }
return GVIR_CONFIG_DOMAIN_GRAPHICS_SPICE(object);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
index d9d1303..f2fc9d5 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
@@ -68,9 +68,10 @@ gvir_config_domain_graphics_vnc_new_from_xml(const gchar *xml,
object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_VNC,
"graphics", NULL, xml, error);
- if (object == NULL)
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), "vnc") != 0) {
+ g_object_unref(G_OBJECT(object));
return NULL;
- gvir_config_object_set_attribute(object, "type", "vnc", NULL);
+ }
return GVIR_CONFIG_DOMAIN_GRAPHICS_VNC(object);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface-bridge.c b/libvirt-gconfig/libvirt-gconfig-domain-interface-bridge.c
index ea5eafa..09a7efc 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-interface-bridge.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface-bridge.c
@@ -70,9 +70,10 @@ GVirConfigDomainInterfaceBridge *gvir_config_domain_interface_bridge_new_from_xm
object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_BRIDGE,
"interface", NULL, xml, error);
- if (object == NULL)
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), "bridge") != 0) {
+ g_object_unref(G_OBJECT(object));
return NULL;
- gvir_config_object_set_attribute(object, "type", "bridge", NULL);
+ }
return GVIR_CONFIG_DOMAIN_INTERFACE_BRIDGE(object);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface-network.c b/libvirt-gconfig/libvirt-gconfig-domain-interface-network.c
index 1a7bfad..ce39234 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-interface-network.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface-network.c
@@ -69,9 +69,10 @@ GVirConfigDomainInterfaceNetwork *gvir_config_domain_interface_network_new_from_
object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_NETWORK,
"interface", NULL, xml, error);
- if (object == NULL)
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), "network") != 0) {
+ g_object_unref(G_OBJECT(object));
return NULL;
- gvir_config_object_set_attribute(object, "type", "network", NULL);
+ }
return GVIR_CONFIG_DOMAIN_INTERFACE_NETWORK(object);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface-user.c b/libvirt-gconfig/libvirt-gconfig-domain-interface-user.c
index a455a73..4ede31f 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-interface-user.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface-user.c
@@ -69,8 +69,9 @@ GVirConfigDomainInterfaceUser *gvir_config_domain_interface_user_new_from_xml(co
object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_USER,
"interface", NULL, xml, error);
- if (object == NULL)
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), "user") != 0) {
+ g_object_unref(G_OBJECT(object));
return NULL;
- gvir_config_object_set_attribute(object, "type", "user", NULL);
+ }
return GVIR_CONFIG_DOMAIN_INTERFACE_USER(object);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-timer-pit.c b/libvirt-gconfig/libvirt-gconfig-domain-timer-pit.c
index d75cd30..16f7e03 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-timer-pit.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-timer-pit.c
@@ -67,6 +67,9 @@ GVirConfigDomainTimerPit *gvir_config_domain_timer_pit_new_from_xml(const gchar
object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_TIMER_PIT,
"timer", NULL, xml, error);
- gvir_config_object_set_attribute(object, "name", "pit", NULL);
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), "pit") != 0) {
+ g_object_unref(G_OBJECT(object));
+ return NULL;
+ }
return GVIR_CONFIG_DOMAIN_TIMER_PIT(object);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-timer-rtc.c b/libvirt-gconfig/libvirt-gconfig-domain-timer-rtc.c
index b99c1e3..19783df 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-timer-rtc.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-timer-rtc.c
@@ -67,6 +67,9 @@ GVirConfigDomainTimerRtc *gvir_config_domain_timer_rtc_new_from_xml(const gchar
object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_TIMER_RTC,
"timer", NULL, xml, error);
- gvir_config_object_set_attribute(object, "name", "rtc", NULL);
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), "rtc") != 0) {
+ g_object_unref(G_OBJECT(object));
+ return NULL;
+ }
return GVIR_CONFIG_DOMAIN_TIMER_RTC(object);
}
--
1.7.10.4
12 years, 4 months
[libvirt] [PATCH 00/13] Support hypervisor-threads-pin in vcpupin.
by tangchen
Hi~
Users can use vcpupin command to bind a vcpu thread to a specific physical cpu.
But besides vcpu threads, there are alse some other threads created by qemu
(known as hypervisor threads) that could not be explicitly bound to physical cpus.
The first 3 patches are from Wen Congyang, which implement Cgroup for differrent
hypervisors.
The other 10 patches implemented hypervisor threads binding, in two ways:
1) Use sched_setaffinity() function;
2) Use cpuset cgroup.
A new xml element is introduced, and vcpupin command is improved, see below.
1. Introduce new xml elements:
<cputune>
......
<hypervisorpin cpuset='1'/>
</cputune>
2. Improve vcpupin command to support hypervisor threads binding.
For example, vm1 has the following configuration:
<cputune>
<vcpupin vcpu='1' cpuset='1'/>
<vcpupin vcpu='0' cpuset='0'/>
<hypervisorpin cpuset='1'/>
</cputune>
1) query all threads pining
# vcpupin vm1
VCPU: CPU Affinity
----------------------------------
0: 0
1: 1
Hypervisor: CPU Affinity
----------------------------------
*: 1
2) query hypervisor threads pining only
# vcpupin vm1 --hypervisor
Hypervisor: CPU Affinity
----------------------------------
*: 1
3) change hypervisor threads pining
# vcpupin vm1 --hypervisor 0-1
# vcpupin vm1 --hypervisor
Hypervisor: CPU Affinity
----------------------------------
*: 0-1
# taskset -p 397
pid 397's current affinity mask: 3
Note: If users want to pin a vcpu thread to pcpu, --vcpu option could no longer be omitted.
Tang Chen (10):
Enable cpuset cgroup and synchronous vcpupin info to cgroup.
Support hypervisorpin xml parse.
Introduce qemuSetupCgroupHypervisorPin and synchronize hypervisorpin
info to cgroup.
Add qemuProcessSetHypervisorAffinites and set hypervisor threads
affinities
Introduce virDomainHypervisorPinAdd and virDomainHypervisorPinDel
functions
Introduce qemudDomainPinHypervisorFlags and
qemudDomainGetHypervisorPinInfo in qemu driver.
Introduce remoteDomainPinHypervisorFlags and
remoteDomainGetHypervisorPinInfo functions in remote driver.
Introduce remoteDispatchDomainPinHypervisorFlags and
remoteDispatchDomainGetHypervisorPinInfo functions.
Introduce virDomainPinHypervisorFlags and
virDomainGetHypervisorPinInfo functions.
Improve vcpupin to support hypervisorpin dynically.
Wen Congyang (3):
Introduce the function virCgroupForHypervisor
Introduce the function virCgroupMoveTask
create a new cgroup and move all hypervisor threads to the new cgroup
.gnulib | 2 +-
daemon/remote.c | 103 +++++++++
docs/schemas/domaincommon.rng | 7 +
include/libvirt/libvirt.h.in | 10 +
src/conf/domain_conf.c | 173 ++++++++++++++-
src/conf/domain_conf.h | 7 +
src/driver.h | 13 ++
src/libvirt.c | 147 +++++++++++++
src/libvirt_private.syms | 7 +
src/libvirt_public.syms | 2 +
src/qemu/qemu_cgroup.c | 147 ++++++++++++-
src/qemu/qemu_cgroup.h | 5 +
src/qemu/qemu_driver.c | 261 ++++++++++++++++++++++-
src/qemu/qemu_process.c | 60 +++++-
src/remote/remote_driver.c | 102 +++++++++
src/remote/remote_protocol.x | 23 +-
src/remote_protocol-structs | 24 +++
src/util/cgroup.c | 204 +++++++++++++++++-
src/util/cgroup.h | 15 ++
tests/qemuxml2argvdata/qemuxml2argv-cputune.xml | 1 +
tests/vcpupin | 6 +-
tools/virsh.c | 147 ++++++++-----
tools/virsh.pod | 16 +-
23 files changed, 1405 insertions(+), 77 deletions(-)
--
1.7.10.2
--
Best Regards,
Tang chen
12 years, 4 months
[libvirt] [PATCH] virsh: fixed domdisplay command
by Martin Kletzander
The 'domdisplay' command didn't properly evaluate '--include-password'
option.
---
tools/virsh.c | 35 +++++++++++++++++++++++------------
1 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 5888d6c..e0765ba 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -66,6 +66,7 @@
#include "virtypedparam.h"
#include "intprops.h"
#include "conf/virdomainlist.h"
+#include "datatypes.h"
static char *progname;
@@ -13882,7 +13883,16 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
- doc = virDomainGetXMLDesc(dom, 0);
+ if (!vshCommandOptBool(cmd, "include-password"))
+ doc = virDomainGetXMLDesc(dom, 0);
+ else {
+ if (ctl->conn->flags & VIR_DOMAIN_XML_SECURE) {
+ vshError(ctl, _("Cannot get password with read-only connection"));
+ goto cleanup;
+ }
+ doc = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE);
+ }
+
if (!doc)
goto cleanup;
@@ -13944,19 +13954,20 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
if (tmp)
tls_port = 0;
- if (vshCommandOptBool(cmd, "daemon")) {
- /* Create our XPATH lookup for the SPICE password */
- virAsprintf(&xpath, "string(/domain/devices/graphics"
+ /* Create our XPATH lookup for the SPICE password */
+ virAsprintf(&xpath, "string(/domain/devices/graphics"
"[@type='%s']/@passwd)", scheme[iter]);
- if (!xpath) {
- virReportOOMError();
- goto cleanup;
- }
-
- /* Attempt to get the SPICE password */
- passwd = virXPathString(xpath, ctxt);
- VIR_FREE(xpath);
+ if (!xpath) {
+ virReportOOMError();
+ goto cleanup;
}
+
+ /* Attempt to get the SPICE password
+ *
+ * This will return NULL automatically if the
+ * virDomainGetXMLDesc wasn't secure */
+ passwd = virXPathString(xpath, ctxt);
+ VIR_FREE(xpath);
}
/* Build up the full URI, starting with the scheme */
--
1.7.8.6
12 years, 4 months
[libvirt] [PATCH 00/11] Split virsh
by Osier Yang
This splits virsh.c by the command groups, except 'virsh itself' group,
each group will have a separate .c, filled with the its commands, a
few helpers, and command group definition moved from virsh.c. and virsh.c
simply include those new .c files.
It still could be optimized, but this set could set up the skelton, and
further optimization could be later patches.
Osier Yang (11):
virsh: Move definition of cmds and cmd groups right at the top of
main
virsh: Split cmds for domain and domain monitoring from virsh.c
virsh: Split cmds for storage pool and storage volume from virsh.c
virsh: Split cmds to manage network from virsh.c
virsh: Split cmds to manage host interface from virsh.c
virsh: Split cmds to manage network filter from virsh.c
virsh: Split cmds to manage secret from virsh.c
virsh: Split cmds to manage domain snapshot from virsh.c
virsh: Split cmds in host group from virsh.c
virsh: Split cmds in node device group from virsh.c
virsh: Move command group definition into its own file
tools/virsh-domain-monitor.c | 1701 ++++
tools/virsh-domain.c | 8139 +++++++++++++++++++
tools/virsh-host.c | 839 ++
tools/virsh-interface.c | 1032 +++
tools/virsh-network.c | 710 ++
tools/virsh-nodedev.c | 402 +
tools/virsh-nwfilter.c | 324 +
tools/virsh-pool.c | 1442 ++++
tools/virsh-secret.c | 373 +
tools/virsh-snapshot.c | 1628 ++++
tools/virsh-volume.c | 1462 ++++
tools/virsh.c |18474 +-----------------------------------------
12 files changed, 18361 insertions(+), 18165 deletions(-)
create mode 100644 tools/virsh-domain-monitor.c
create mode 100644 tools/virsh-domain.c
create mode 100644 tools/virsh-host.c
create mode 100644 tools/virsh-interface.c
create mode 100644 tools/virsh-network.c
create mode 100644 tools/virsh-nodedev.c
create mode 100644 tools/virsh-nwfilter.c
create mode 100644 tools/virsh-pool.c
create mode 100644 tools/virsh-secret.c
create mode 100644 tools/virsh-snapshot.c
create mode 100644 tools/virsh-volume.c
Regards,
Osier
12 years, 4 months
[libvirt] [PATCH] adding handling EINTR to poll to make it more robust
by Royce Lv
some system call and signal will interrupt poll,
making event loop stops and fails to react events and keepalive message
from libvirt.
adding handling EINTR to poll to make it more robust
Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
---
examples/domain-events/events-python/event-test.py | 87 +++++++++++---------
1 file changed, 46 insertions(+), 41 deletions(-)
diff --git a/examples/domain-events/events-python/event-test.py b/examples/domain-events/events-python/event-test.py
index 96dc268..6b655cd 100644
--- a/examples/domain-events/events-python/event-test.py
+++ b/examples/domain-events/events-python/event-test.py
@@ -178,48 +178,53 @@ class virEventLoopPure:
def run_once(self):
sleep = -1
self.runningPoll = True
- next = self.next_timeout()
- debug("Next timeout due at %d" % next)
- if next > 0:
- now = int(time.time() * 1000)
- if now >= next:
- sleep = 0
- else:
- sleep = (next - now) / 1000.0
-
- debug("Poll with a sleep of %d" % sleep)
- events = self.poll.poll(sleep)
-
- # Dispatch any file handle events that occurred
- for (fd, revents) in events:
- # See if the events was from the self-pipe
- # telling us to wakup. if so, then discard
- # the data just continue
- if fd == self.pipetrick[0]:
- self.pendingWakeup = False
- data = os.read(fd, 1)
- continue
-
- h = self.get_handle_by_fd(fd)
- if h:
- debug("Dispatch fd %d handle %d events %d" % (fd, h.get_id(), revents))
- h.dispatch(self.events_from_poll(revents))
-
- now = int(time.time() * 1000)
- for t in self.timers:
- interval = t.get_interval()
- if interval < 0:
- continue
+ try:
+ next = self.next_timeout()
+ debug("Next timeout due at %d" % next)
+ if next > 0:
+ now = int(time.time() * 1000)
+ if now >= next:
+ sleep = 0
+ else:
+ sleep = (next - now) / 1000.0
+
+ debug("Poll with a sleep of %d" % sleep)
+ events = self.poll.poll(sleep)
+
+ # Dispatch any file handle events that occurred
+ for (fd, revents) in events:
+ # See if the events was from the self-pipe
+ # telling us to wakup. if so, then discard
+ # the data just continue
+ if fd == self.pipetrick[0]:
+ self.pendingWakeup = False
+ data = os.read(fd, 1)
+ continue
+
+ h = self.get_handle_by_fd(fd)
+ if h:
+ debug("Dispatch fd %d handle %d events %d" % (fd, h.get_id(), revents))
+ h.dispatch(self.events_from_poll(revents))
- want = t.get_last_fired() + interval
- # Deduct 20ms, since schedular timeslice
- # means we could be ever so slightly early
- if now >= (want-20):
- debug("Dispatch timer %d now %s want %s" % (t.get_id(), str(now), str(want)))
- t.set_last_fired(now)
- t.dispatch()
-
- self.runningPoll = False
+ now = int(time.time() * 1000)
+ for t in self.timers:
+ interval = t.get_interval()
+ if interval < 0:
+ continue
+
+ want = t.get_last_fired() + interval
+ # Deduct 20ms, since scheduler timeslice
+ # means we could be ever so slightly early
+ if now >= (want-20):
+ debug("Dispatch timer %d now %s want %s" % (t.get_id(), str(now), str(want)))
+ t.set_last_fired(now)
+ t.dispatch()
+
+ except (os.error, select.error), e:
+ if e.args[0] != errno.EINTR:
+ raise
+ finally:
+ self.runningPoll = False
# Actually the event loop forever
--
1.7.10.4
12 years, 4 months
[libvirt] [PATCH] build: regenerate .png files
by Eric Blake
We don't expect people to have tools installed to regenerate .png
from .fig by default. However, since commit 5eb3df8, several
.fig files were updated without regenerating the .png file, and
as a result, 'make dist' ends up regenerating those five files,
or worse, failing because of missing tools.
Additionally, the generation of .png files is nondeterministic
(the resulting files contain a timestamp), which means prior to
this patch, running 'make dist' from two checkouts will end up
producing different tarball contents (two 'make dist' runs will
always produce different tar files, since tarballs also contain
timestamps; but unpacking the tarballs and doing a recursive
diff will show if the contents are unchanged).
Running 'make *.png' in the docs directory and committing the
result means the timestamps are now up-to-date, and 'make dist'
no longer has anything to do. This gets us closer to the goal
of two checkouts being able to produce the same tarball.
* docs/libvirt-*.png: Regenerate.
---
Found when testing 'make dist' on a machine without ImageMagick
installed (for the 'convert' program).
docs/libvirt-daemon-arch.png | Bin 16479 -> 11624 bytes
docs/libvirt-driver-arch.png | Bin 16835 -> 12555 bytes
docs/libvirt-net-logical.png | Bin 7387 -> 11243 bytes
docs/libvirt-net-physical.png | Bin 10666 -> 11336 bytes
docs/libvirt-object-model.png | Bin 14327 -> 9559 bytes
5 files changed, 0 insertions(+), 0 deletions(-)
diff --git a/docs/libvirt-daemon-arch.png b/docs/libvirt-daemon-arch.png
index b7ed2f689112e45ffd5b108ed7a03f9808618d96..621a55cdbfebf968ed079e3940b5bd3da22321a1 100644
GIT binary patch
literal 11624
[actual patch stripped for mailing list length limits - it's just
a regeneration of binary files]
--
1.7.10.4
12 years, 4 months
[libvirt] qemu and <transient/> disks
by Richard W.M. Jones
Partly following up this message:
https://www.redhat.com/archives/libvirt-users/2011-October/msg00142.html
> > And what about qemu's option "snapshot=on" ?
>
> Unreliable. It won't work with SELinux (since qemu tries to create the
> snapshot on /tmp), and it makes your guest unmigratable. I think that
> it is easier to have libvirt use qemu-img to create a qcow2 wrapper
> prior to booting the guest, at which point the solution is easier to
> control from an sVirt perspective, and is more likely to allow us to
> figure out a way to make things work with migration (at least, I'm
> hoping I can figure out how to migrate a guest with a transient disk).
Lack of this feature is pretty annoying, particularly since
(a) libguestfs needs it and (b) it's a trivial patch to add
snapshot=on to the qemu driver. So to concentrate on the two
objections above:
- Why is SELinux concerned about qemu creating and using a file in
/tmp? Obviously it should stop qemu opening and reading random
files from /tmp but that would be a different rule surely?
- The documentation actually states that using <transient/> may make
your guest unable to migrate, and in any case we don't care.
> But if you want to use qemu's snapshot=on in the meantime, you can
> use the <qemu:commandline> namespace XML to add it.
Is there an example how to do this? It seems like it might be
possible using a global qemu '-set device.<id>.snapshot=on' parameter,
but how can I know what <id> libvirt will give to a '-drive'
parameter? (I found from experimentation that it's something like
"drive-virtio-disk0", but I can't track down the bit of code that
produces this string yet ...)
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
12 years, 4 months
[libvirt] [PATCH] [libvirt-java] Fix javadoc warnings.
by Claudio Bley
Hi.
I sent a few mails on friday, 6th July, via gmane.org but they haven't
made it to the list yet. As I'm a subscriber now, I'm resending them
directly. Sorry for any duplicates in advance.
Here's a patch fixing these javadoc warnings:
---
[javadoc] x:\src\libvirt-java\src\main\java\org\libvirt\Connect.java:387: warning - @return tag has no arguments.
[javadoc] x:\src\libvirt-java\src\main\java\org\libvirt\Connect.java:644: warning - @return tag has no arguments.
[javadoc] x:\src\libvirt-java\src\main\java\org\libvirt\Connect.java:658: warning - @return tag has no arguments.
[javadoc] x:\src\libvirt-java\src\main\java\org\libvirt\Domain.java:681: warning - @return tag has no arguments.
[javadoc] x:\src\libvirt-java\src\main\java\org\libvirt\Domain.java:795: warning - Tag @see: reference not found: http
[javadoc] ://www.libvirt.org/html/libvirt-libvirt.html#virDomainMigrateToURI
[javadoc] x:\src\libvirt-java\src\main\java\org\libvirt\DomainSnapshot.java:40: warning - @return tag has no arguments.
[javadoc] x:\src\libvirt-java\src\main\java\org\libvirt\StoragePool.java:349: warning - @return tag has no arguments.
[javadoc] x:\src\libvirt-java\src\main\java\org\libvirt\Stream.java:130: warning - Tag @see:illegal character: "58" in "http://www.libvirt.org/html/libvi
rt-libvirt.html#virStreamRecvAll"
[javadoc] x:\src\libvirt-java\src\main\java\org\libvirt\Stream.java:130: warning - Tag @see:illegal character: "47" in "http://www.libvirt.org/html/libvi
rt-libvirt.html#virStreamRecvAll"
[javadoc] x:\src\libvirt-java\src\main\java\org\libvirt\Stream.java:130: warning - Tag @see:illegal character: "47" in "http://www.libvirt.org/html/libvi
rt-libvirt.html#virStreamRecvAll"
[javadoc] x:\src\libvirt-java\src\main\java\org\libvirt\Stream.java:130: warning - Tag @see:illegal character: "47" in "http://www.libvirt.org/html/libvi
rt-libvirt.html#virStreamRecvAll"
[javadoc] x:\src\libvirt-java\src\main\java\org\libvirt\Stream.java:130: warning - Tag @see:illegal character: "47" in "http://www.libvirt.org/html/libvi
rt-libvirt.html#virStreamRecvAll"
[javadoc] x:\src\libvirt-java\src\main\java\org\libvirt\Stream.java:130: warning - Tag @see:illegal character: "45" in "http://www.libvirt.org/html/libvi
rt-libvirt.html#virStreamRecvAll"
[javadoc] x:\src\libvirt-java\src\main\java\org\libvirt\Stream.java:130: warning - Tag @see: reference not found: http://www.libvirt.org/html/libvirt-lib
virt.html#virStreamRecvAll
---
---
diff --git a/src/main/java/org/libvirt/Connect.java b/src/main/java/org/libvirt/Connect.java
index 77336f0..de75f20 100644
--- a/src/main/java/org/libvirt/Connect.java
+++ b/src/main/java/org/libvirt/Connect.java
@@ -381,7 +381,7 @@ public class Connect {
* Documentation</a>
* @param callbackID
* the callback to deregister
- * @return
+ * @return 0 on success, -1 on failure
* @throws LibvirtException
*/
public int domainEventDeregister(int callbackID) throws LibvirtException {
@@ -400,7 +400,7 @@ public class Connect {
int action);
}
- private interface GenericCallback {
+ protected interface GenericCallback {
void eventCallback(Connect connect, Domain domain);
}
public interface RebootCallback extends GenericCallback {
@@ -638,7 +638,7 @@ public class Connect {
* domain configuration file describing the domain. The format of the native
* data is hypervisor dependant.
*
- * @return
+ * @return domain XML as String, or {@code null} on error
* @throws LibvirtException
*/
public String domainXMLFromNative(String nativeFormat, String nativeConfig, int flags) throws LibvirtException {
@@ -652,7 +652,7 @@ public class Connect {
* native configuration file describing the domain. The format of the native
* data is hypervisor dependant.
*
- * @return
+ * @return domain XML as String, or {@code null} on error
* @throws LibvirtException
*/
public String domainXMLToNative(String nativeFormat, String domainXML, int flags) throws LibvirtException {
diff --git a/src/main/java/org/libvirt/Domain.java b/src/main/java/org/libvirt/Domain.java
index fd7a03a..fe9f3b0 100644
--- a/src/main/java/org/libvirt/Domain.java
+++ b/src/main/java/org/libvirt/Domain.java
@@ -675,7 +675,7 @@ public class Domain {
* @see <a
* href="http://www.libvirt.org/html/libvirt-libvirt.html#virDomainManagedSaveRemove">Libvirt
* Documentation</a>
- * @return
+ * @return 0 in case of success, and -1 in case of error
* @throws LibvirtException
*/
public int managedSaveRemote() throws LibvirtException {
@@ -778,8 +778,9 @@ public class Domain {
* Migrate the domain object from its current host to the destination host
* given by duri.
*
- * @see http
- * ://www.libvirt.org/html/libvirt-libvirt.html#virDomainMigrateToURI
+ * @see <a
+ * href="http://www.libvirt.org/html/libvirt-libvirt.html#virDomainMigrateToURI">
+ * virDomainMigrateToURI</a>
*
* @param uri
* The destination URI
diff --git a/src/main/java/org/libvirt/DomainSnapshot.java b/src/main/java/org/libvirt/DomainSnapshot.java
index e9a23d6..add6830 100644
--- a/src/main/java/org/libvirt/DomainSnapshot.java
+++ b/src/main/java/org/libvirt/DomainSnapshot.java
@@ -34,7 +34,7 @@ public class DomainSnapshot {
* Documentation</a>
* @param flags
* controls teh deletion
- * @return
+ * @return 0 if the selected snapshot(s) were successfully deleted, -1 on error.
* @throws LibvirtException
*/
public int delete(int flags) throws LibvirtException {
diff --git a/src/main/java/org/libvirt/StoragePool.java b/src/main/java/org/libvirt/StoragePool.java
index a3d59a9..0328d8c 100644
--- a/src/main/java/org/libvirt/StoragePool.java
+++ b/src/main/java/org/libvirt/StoragePool.java
@@ -343,7 +343,7 @@ public class StoragePool {
* as input. Information for the new volume (name, perms) are passed via a
* typical volume XML description.
*
- * @return
+ * @return The storage volume, or {@code null} on error.
* @throws LibvirtException
*/
public StorageVol storageVolCreateXMLFrom(String xmlDesc, StorageVol cloneVolume, int flags)
diff --git a/src/main/java/org/libvirt/Stream.java b/src/main/java/org/libvirt/Stream.java
index fdef3a4..6374567 100644
--- a/src/main/java/org/libvirt/Stream.java
+++ b/src/main/java/org/libvirt/Stream.java
@@ -121,7 +121,7 @@ public class Stream {
/**
* Batch receive method
*
- * @see http://www.libvirt.org/html/libvirt-libvirt.html#virStreamRecvAll
+ * @see <a href="http://www.libvirt.org/html/libvirt-libvirt.html#virStreamRecvAll">virStreamRecvAll</a>
* @param handler
* the callback handler
* @return 0 if successfule, -1 otherwise
---
Best regards,
Claudio
--
AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany
Phone: +49 341 265 310 19
Web:<http://www.av-test.org>
Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076)
Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern
12 years, 4 months