[libvirt] [rust PATCH] Domain: Implement scheduler information related APIs
by Vineeth Remanan Pillai
Implement the following:
- virDomainGetSchedulerType
- virDomainSetSchedulerParameters
- virDomainSetSchedulerParametersFlags
- virDomainGetSchedulerParameters
- virDomainGetSchedulerParametersFlags
Signed-off-by: Vineeth Remanan Pillai <vpilllai(a)digitalocean.com>
---
examples/hello.rs | 38 +++++++
src/domain.rs | 260 +++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 283 insertions(+), 15 deletions(-)
diff --git a/examples/hello.rs b/examples/hello.rs
index e5ec6e4..1f336a9 100644
--- a/examples/hello.rs
+++ b/examples/hello.rs
@@ -89,6 +89,44 @@ fn show_domains(conn: &Connect) -> Result<(), Error> {
numa.node_set.unwrap_or(String::from("")));
println!(" Mode: {}", numa.mode.unwrap_or(0));
}
+
+ if let Ok((sched_type, nparams)) = dom.get_scheduler_type() {
+ println!("SchedType: {}, nparams: {}",
+ sched_type, nparams);
+ }
+
+ if let Ok(sched_info) = dom.get_scheduler_parameters() {
+ println!("Schedule Information:");
+ println!("\tScheduler\t: {}", sched_info.scheduler_type);
+ if let Some(shares) = sched_info.cpu_shares {
+ println!("\tcpu_shares\t: {}", shares);
+ }
+ if let Some(period) = sched_info.vcpu_bw.period {
+ println!("\tvcpu_period\t: {}", period);
+ }
+ if let Some(quota) = sched_info.vcpu_bw.quota {
+ println!("\tvcpu_quota\t: {}", quota);
+ }
+ if let Some(period) = sched_info.emulator_bw.period {
+ println!("\temulator_period\t: {}", period);
+ }
+ if let Some(quota) = sched_info.emulator_bw.quota {
+ println!("\temulator_quota\t: {}", quota);
+ }
+ if let Some(period) = sched_info.global_bw.period {
+ println!("\tglobal_period\t: {}", period);
+ }
+ if let Some(quota) = sched_info.global_bw.quota {
+ println!("\tglobal_quota\t: {}", quota);
+ }
+ if let Some(period) = sched_info.global_bw.period {
+ println!("\tiothread_period\t: {}", period);
+ }
+ if let Some(quota) = sched_info.global_bw.quota {
+ println!("\tiothread_quota\t: {}", quota);
+ }
+ }
+
}
}
return Ok(());
diff --git a/src/domain.rs b/src/domain.rs
index acb9e6e..40a18d8 100644
--- a/src/domain.rs
+++ b/src/domain.rs
@@ -363,6 +363,29 @@ extern "C" {
snaps: *mut *mut virDomainSnapshotPtr,
flags: libc::c_uint)
-> libc::c_int;
+
+ fn virDomainGetSchedulerType(ptr: sys::virDomainPtr,
+ nparams: *mut libc::c_int)
+ -> *mut libc::c_char;
+ fn virDomainGetSchedulerParameters(ptr: sys::virDomainPtr,
+ params: virTypedParameterPtr,
+ nparams: *mut libc::c_int)
+ -> libc::c_int;
+ fn virDomainSetSchedulerParameters(ptr: sys::virDomainPtr,
+ params: virTypedParameterPtr,
+ nparams: libc::c_int)
+ -> libc::c_int;
+ fn virDomainGetSchedulerParametersFlags(ptr: sys::virDomainPtr,
+ params: virTypedParameterPtr,
+ nparams: *mut libc::c_int,
+ flags: libc::c_uint)
+ -> libc::c_int;
+ fn virDomainSetSchedulerParametersFlags(ptr: sys::virDomainPtr,
+ params: virTypedParameterPtr,
+ nparams: libc::c_int,
+ flags: libc::c_uint)
+ -> libc::c_int;
+
}
pub type DomainXMLFlags = self::libc::c_uint;
@@ -607,6 +630,124 @@ impl MemoryStats {
}
}
+/// Structure representing the CFS scheduler cpu bandwidth parameters
+/// see https://www.kernel.org/doc/html/latest/scheduler/sched-bwc.html
+#[derive(Clone, Debug, Default)]
+pub struct SchedBandwidth {
+ pub period: Option<u64>,
+ pub quota: Option<i64>,
+}
+
+#[derive(Clone, Debug, Default)]
+pub struct SchedulerInfo {
+ pub scheduler_type: String,
+ // cpu shares for the domain.
+ pub cpu_shares: Option<u64>,
+ // Bandwidth allocated for the vcpu threads.
+ pub vcpu_bw: SchedBandwidth,
+ // Bandwidth allocated for the emulator threads.
+ pub emulator_bw: SchedBandwidth,
+ // Bandwidth allocated for the Domain.
+ pub global_bw: SchedBandwidth,
+ // Bandwidth allocated for the io threads..
+ pub iothread_bw: SchedBandwidth,
+}
+
+impl SchedulerInfo {
+ pub fn from_vec(vec: Vec<virTypedParameter>, scheduler_type: String) -> SchedulerInfo {
+ unsafe {
+ let mut ret = SchedulerInfo::default();
+ ret.scheduler_type = scheduler_type;
+ for param in vec {
+ match str::from_utf8(CStr::from_ptr(param.field.as_ptr()).to_bytes()).unwrap() {
+ "cpu_shares" => ret.cpu_shares = Some(param.value as u64),
+ "vcpu_period" => ret.vcpu_bw.period = Some(param.value as u64),
+ "vcpu_quota" => ret.vcpu_bw.quota = Some(param.value as i64),
+ "emulator_period" => ret.emulator_bw.period = Some(param.value as u64),
+ "emulator_quota" => ret.emulator_bw.quota = Some(param.value as i64),
+ "global_period" => ret.global_bw.period = Some(param.value as u64),
+ "global_quota" => ret.global_bw.quota = Some(param.value as i64),
+ "iothread_period" => ret.iothread_bw.period = Some(param.value as u64),
+ "iothread_quota" => ret.iothread_bw.quota = Some(param.value as i64),
+ unknow => panic!("Field not implemented for SchedulerInfo, {:?}", unknow),
+ }
+ }
+ ret
+ }
+ }
+
+ pub fn to_vec(&self) -> Vec<virTypedParameter> {
+ let mut cparams: Vec<virTypedParameter> = Vec::new();
+
+ if let Some(shares) = self.cpu_shares {
+ cparams.push(virTypedParameter {
+ field: to_arr("cpu_shares\0"),
+ typed: ::typedparam::VIR_TYPED_PARAM_ULLONG,
+ value: shares
+ });
+ }
+
+ if let Some(period) = self.vcpu_bw.period {
+ cparams.push(virTypedParameter {
+ field: to_arr("vcpu_period\0"),
+ typed: ::typedparam::VIR_TYPED_PARAM_ULLONG,
+ value: period,
+ });
+ }
+ if let Some(quota) = self.vcpu_bw.quota {
+ cparams.push(virTypedParameter {
+ field: to_arr("vcpu_quota\0"),
+ typed: ::typedparam::VIR_TYPED_PARAM_LLONG,
+ value: quota as u64,
+ });
+ }
+ if let Some(period) = self.emulator_bw.period {
+ cparams.push(virTypedParameter {
+ field: to_arr("emulator_period\0"),
+ typed: ::typedparam::VIR_TYPED_PARAM_ULLONG,
+ value: period,
+ });
+ }
+ if let Some(quota) = self.emulator_bw.quota {
+ cparams.push(virTypedParameter {
+ field: to_arr("emulator_quota\0"),
+ typed: ::typedparam::VIR_TYPED_PARAM_LLONG,
+ value: quota as u64,
+ });
+ }
+ if let Some(period) = self.global_bw.period {
+ cparams.push(virTypedParameter {
+ field: to_arr("global_period\0"),
+ typed: ::typedparam::VIR_TYPED_PARAM_ULLONG,
+ value: period,
+ });
+ }
+ if let Some(quota) = self.global_bw.quota {
+ cparams.push(virTypedParameter {
+ field: to_arr("global_quota\0"),
+ typed: ::typedparam::VIR_TYPED_PARAM_LLONG,
+ value: quota as u64,
+ });
+ }
+ if let Some(period) = self.iothread_bw.period {
+ cparams.push(virTypedParameter {
+ field: to_arr("iothread_period\0"),
+ typed: ::typedparam::VIR_TYPED_PARAM_ULLONG,
+ value: period,
+ });
+ }
+ if let Some(quota) = self.iothread_bw.quota {
+ cparams.push(virTypedParameter {
+ field: to_arr("iothread_quota\0"),
+ typed: ::typedparam::VIR_TYPED_PARAM_LLONG,
+ value: quota as u64,
+ });
+ }
+
+ cparams
+ }
+}
+
/// Provides APIs for the management of domains.
///
/// See http://libvirt.org/html/libvirt-libvirt-domain.html
@@ -627,6 +768,14 @@ impl Drop for Domain {
}
}
+fn to_arr(name: &str) -> [libc::c_char; 80] {
+ let mut field: [libc::c_char; 80] = [0; 80];
+ for (a, c) in field.iter_mut().zip(name.as_bytes()) {
+ *a = *c as i8
+ }
+ field
+}
+
impl Domain {
pub fn new(ptr: sys::virDomainPtr) -> Domain {
return Domain { ptr: Some(ptr) };
@@ -1656,14 +1805,6 @@ impl Domain {
flags: u32)
-> Result<u32, Error> {
unsafe {
- fn to_arr(name: &str) -> [libc::c_char; 80] {
- let mut field: [libc::c_char; 80] = [0; 80];
- for (a, c) in field.iter_mut().zip(name.as_bytes()) {
- *a = *c as i8
- }
- field
- }
-
let mut cparams: Vec<virTypedParameter> = Vec::new();
if params.hard_limit.is_some() {
cparams.push(virTypedParameter {
@@ -1809,13 +1950,6 @@ impl Domain {
pub fn set_numa_parameters(&self, params: NUMAParameters, flags: u32) -> Result<u32, Error> {
unsafe {
- fn to_arr(name: &str) -> [libc::c_char; 80] {
- let mut field: [libc::c_char; 80] = [0; 80];
- for (a, c) in field.iter_mut().zip(name.as_bytes()) {
- *a = *c as i8
- }
- field
- }
let mut cparams: Vec<virTypedParameter> = Vec::new();
if params.node_set.is_some() {
@@ -1863,4 +1997,100 @@ impl Domain {
return Ok(array);
}
}
+
+ /// Get the cpu scheduler type for the domain
+ pub fn get_scheduler_type(&self) -> Result<(String, i32), Error>
+ {
+ unsafe {
+ let mut nparams: libc::c_int = -1;
+ let sched_type = virDomainGetSchedulerType(self.as_ptr(),
+ &mut nparams);
+ if sched_type.is_null() {
+ return Err(Error::new());
+ }
+
+ return Ok((c_chars_to_string!(sched_type), nparams));
+ }
+ }
+
+ /// Get the scheduler parameters for the domain.
+ pub fn get_scheduler_parameters(&self) -> Result<SchedulerInfo, Error> {
+
+ let (sched_type, mut nparams) = self.get_scheduler_type()?;
+ unsafe {
+ let mut params: Vec<virTypedParameter> = vec![
+ virTypedParameter::default(); 9];
+ let ret = virDomainGetSchedulerParameters(self.as_ptr(),
+ &mut params[0],
+ &mut nparams);
+ if ret == -1 {
+ return Err(Error::new());
+ }
+ Ok(SchedulerInfo::from_vec(params, sched_type))
+ }
+
+ }
+
+ /// Get the scheduler parameters for the domain for the configuration
+ /// as specified by the flags.
+ /// # Arguments
+ ///
+ /// * `flags` - Specifies the Domain Impact: CONFIG, LIVE or CURRENT.
+ pub fn get_scheduler_parameters_flags(&self,
+ flags: DomainModImpactFlags)
+ -> Result<SchedulerInfo, Error> {
+
+ let (sched_type, mut nparams) = self.get_scheduler_type()?;
+ unsafe {
+ let mut params: Vec<virTypedParameter> = vec![
+ virTypedParameter::default(); 9];
+ let ret = virDomainGetSchedulerParametersFlags(self.as_ptr(),
+ &mut params[0],
+ &mut nparams,
+ flags as libc::c_uint);
+ if ret == -1 {
+ return Err(Error::new());
+ }
+ Ok(SchedulerInfo::from_vec(params, sched_type))
+ }
+
+ }
+
+ /// Set the scheduler parameters for the domain.
+ pub fn set_scheduler_parameters(&self,
+ sched_info: &SchedulerInfo)
+ -> Result<i32, Error> {
+ unsafe {
+ let mut params = sched_info.to_vec();
+ let ret = virDomainSetSchedulerParameters(self.as_ptr(),
+ &mut params[0],
+ params.len() as libc::c_int);
+ if ret == -1 {
+ return Err(Error::new());
+ }
+ Ok(ret)
+ }
+ }
+
+ /// Set the scheduler parameters for the domain for the configuration
+ /// as specified by the flags.
+ /// # Arguments
+ ///
+ /// * `flags` - Specifies the Domain Impact: CONFIG, LIVE or CURRENT.
+ pub fn set_scheduler_parameters_flags(&self,
+ sched_info: &SchedulerInfo,
+ flags: DomainModImpactFlags)
+ -> Result<i32, Error> {
+ unsafe {
+ let mut params = sched_info.to_vec();
+ let ret = virDomainSetSchedulerParametersFlags(self.as_ptr(),
+ &mut params[0],
+ params.len() as libc::c_int,
+ flags as libc::c_uint);
+ if ret == -1 {
+ return Err(Error::new());
+ }
+ Ok(ret)
+ }
+ }
}
--
2.17.1
5 years
[libvirt] [PATCH] src: warn against virNodeGetInfo() API call due to inaccurate info
by Daniel P. Berrangé
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
include/libvirt/libvirt-host.h | 4 ++++
src/libvirt-host.c | 16 ++++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/include/libvirt/libvirt-host.h b/include/libvirt/libvirt-host.h
index be65b4686b..b87d634813 100644
--- a/include/libvirt/libvirt-host.h
+++ b/include/libvirt/libvirt-host.h
@@ -147,6 +147,10 @@ typedef virSecurityModel *virSecurityModelPtr;
*
* a virNodeInfo is a structure filled by virNodeGetInfo() and providing
* the information for the Node.
+ *
+ * Note that the information in this struct is not guaranteed to be an
+ * accurate relection of the system hardware. See the virNodeGetInfo()
+ * API documentation for further guidance.
*/
typedef struct _virNodeInfo virNodeInfo;
diff --git a/src/libvirt-host.c b/src/libvirt-host.c
index 94ba5a8e80..bc3d1d2803 100644
--- a/src/libvirt-host.c
+++ b/src/libvirt-host.c
@@ -399,6 +399,22 @@ virConnectGetMaxVcpus(virConnectPtr conn,
*
* Extract hardware information about the node.
*
+ * Use of this API is strongly discouraged as the information provided
+ * is not guaranteed to be accurate on all hardware platforms.
+ *
+ * The mHZ value merely reflects the speed that the first CPU in the
+ * machine is currently running at. This speed may vary across CPUs
+ * and changes continually as the host OS throttles.
+ *
+ * The nodes/sockets/cores/threads data is potentially inaccurate as
+ * it assumes a symmetric installation. If one NUMA node has more
+ * sockets populated that another NUMA node this information will be
+ * wrong. It is also not able to report about CPU dies.
+ *
+ * Applications are recommended to use the virConnectGetCapabilities()
+ * call instead, which provides all the information except CPU mHZ,
+ * in a more accurate representation.
+ *
* Returns 0 in case of success and -1 in case of failure.
*/
int
--
2.23.0
5 years
[libvirt] [PATCH] tools: skip libvirt-guests fast if libvirtd is not active
by Christian Ehrhardt
The most common operation of libvirt-guests is to manage the local
libvirtd. But users might have disabled that and while we are
After=libvirtd for ordering we are not Requiring it..
OTOH adding that or any harder dependency might affect our ordering.
But if people have disabled libvirt they will do a full retry loop
until timeout. Lets check if the local service is active at all and skip
fast if it is not.
Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1854653
Reported-by: Doug Smythies <dsmythies(a)telus.net>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt(a)canonical.com>
---
tools/libvirt-guests.sh.in | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in
index 4bc6e866f0..5a9930ee2f 100644
--- a/tools/libvirt-guests.sh.in
+++ b/tools/libvirt-guests.sh.in
@@ -90,6 +90,14 @@ test_connect()
{
uri=$1
+ if [ "x$uri" = xdefault ]; then
+ # Default config is most common and for the local libvirtd
+ # Check if it is active before wasting time in connect loop
+ if ! systemctl -q is-active libvirtd; then
+ return 1
+ fi
+ fi
+
i=${CONNECT_RETRIES}
while [ $i -gt 0 ]; do
run_virsh "$uri" connect 2>/dev/null
--
2.24.0
5 years
[libvirt] [PATCH] virsh.pod: Mention iscsi-direct is supported in find-storage-pool-sources
by Han Han
Signed-off-by: Han Han <hhan(a)redhat.com>
---
tools/virsh.pod | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index a8331154e1..14f4121787 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -3994,7 +3994,8 @@ any other provided XML elements in I<srcSpec>.
For a "logical" pool, the contents of the I<srcSpec> file are ignored,
although if provided the file must at least exist.
-For an "iscsi" pool, the minimal expect XML required is the <host> element
+For an "iscsi" or "iscsi-direct" pool,
+the minimal expect XML required is the <host> element
with a "name" attribute describing the IP address or hostname to be used to
find the pool (the iSCSI server address). Optionally, the "port" attribute
may be provided, although it will default to 3260. Optionally, an <initiator>
--
2.24.0.rc1
5 years
[libvirt] [PATCH v3 0/6] PCI hostdev partial assignment support
by Daniel Henrique Barboza
changes from previous version [1]:
- do not overload address type='none'. A new address type called
'unassigned' is introduced;
- there is no unassigned' flag being created in virDomainHostdevDef.
The logic added by new address type is enough;
- do not allow function zero of multifunction devices to be
unassigned.
Nothing too special to discuss in this cover letter. More details
can be found at the discussions of the previous version [1]. Commit
messages of the patches have more background info as well.
[1] https://www.redhat.com/archives/libvir-list/2019-November/msg01099.html
Daniel Henrique Barboza (6):
Introducing new address type='unassigned' for PCI hostdevs
qemu: handle unassigned PCI hostdevs in command line and alias
virhostdev.c: check all IOMMU devs in virHostdevPreparePCIDevices
formatdomain.html.in: document <address type='unassigned'/>
utils: PCI multifunction detection helpers
domain_conf.c: don't allow function zero to be unassigned
docs/formatdomain.html.in | 14 +++
docs/schemas/domaincommon.rng | 5 ++
src/conf/device_conf.c | 2 +
src/conf/device_conf.h | 1 +
src/conf/domain_conf.c | 20 ++++-
src/libvirt_private.syms | 2 +
src/qemu/qemu_alias.c | 6 ++
src/qemu/qemu_command.c | 5 ++
src/qemu/qemu_domain.c | 1 +
src/qemu/qemu_domain_address.c | 5 ++
src/util/virhostdev.c | 88 +++++++++++++++++--
src/util/virhostdev.h | 3 +
src/util/virpci.c | 17 ++++
src/util/virpci.h | 2 +
.../hostdev-pci-address-unassigned.args | 31 +++++++
.../hostdev-pci-address-unassigned.xml | 42 +++++++++
...pci-multifunction-zero-unassigned-fail.xml | 42 +++++++++
tests/qemuxml2argvtest.c | 8 ++
.../hostdev-pci-address-unassigned.xml | 58 ++++++++++++
tests/qemuxml2xmltest.c | 1 +
tests/virpcimock.c | 9 +-
21 files changed, 351 insertions(+), 11 deletions(-)
create mode 100644 tests/qemuxml2argvdata/hostdev-pci-address-unassigned.args
create mode 100644 tests/qemuxml2argvdata/hostdev-pci-address-unassigned.xml
create mode 100644 tests/qemuxml2argvdata/hostdev-pci-multifunction-zero-unassigned-fail.xml
create mode 100644 tests/qemuxml2xmloutdata/hostdev-pci-address-unassigned.xml
--
2.23.0
5 years
[libvirt] [libvirt-tck PATCH] Add cases for nvram
by Dan Zheng
This is to add the tests for below flags:
- Sys::Virt::Domain::UNDEFINE_KEEP_NVRAM
- Sys::Virt::Domain::UNDEFINE_NVRAM
Signed-off-by: Dan Zheng <dzheng(a)redhat.com>
---
scripts/domain/401-ovmf-nvram.t | 143 ++++++++++++++++++++++++++++++++
1 file changed, 143 insertions(+)
create mode 100644 scripts/domain/401-ovmf-nvram.t
diff --git a/scripts/domain/401-ovmf-nvram.t b/scripts/domain/401-ovmf-nvram.t
new file mode 100644
index 0000000..5310dd0
--- /dev/null
+++ b/scripts/domain/401-ovmf-nvram.t
@@ -0,0 +1,143 @@
+# -*- perl -*-
+#
+# Copyright (C) 2009 Red Hat, Inc.
+# Copyright (C) 2018 Dan Zheng (dzheng(a)redhat.com)
+#
+# This program is free software; You can redistribute it and/or modify
+# it under the GNU General Public License as published by the Free
+# Software Foundation; either version 2, or (at your option) any
+# later version
+#
+# The file "LICENSE" distributed along with this file provides full
+# details of the terms and conditions
+#
+
+=pod
+
+=head1 NAME
+
+domain/401-ovmf-nvram.t - Test OVMF related functions and flags
+
+=head1 DESCRIPTION
+
+The test cases validates OVMF related APIs and flags
+
+Sys::Virt::Domain::UNDEFINE_KEEP_NVRAM
+Sys::Virt::Domain::UNDEFINE_NVRAM
+
+=cut
+
+use strict;
+use warnings;
+
+use Test::More tests => 8;
+
+use Sys::Virt::TCK;
+use File::stat;
+use File::Copy;
+
+
+my $tck = Sys::Virt::TCK->new();
+my $conn = eval { $tck->setup(); };
+BAIL_OUT "failed to setup test harness: $@" if $@;
+END { $tck->cleanup if $tck; }
+
+
+sub setup_nvram {
+
+my $loader_path = shift;
+my $nvram_template = shift;
+my $nvram_path = shift;
+
+# Install OVMF and check the two files should exist
+# - /usr/share/OVMF/OVMF_CODE.secboot.fd
+# - /usr/share/OVMF/OVMF_VARS.fd
+
+my $ret = `yum install -y OVMF`;
+diag "yum install OVMF: $ret";
+my $st = stat($loader_path);
+ok($st, "path $loader_path exists after OVMF is installed");
+$st = stat($nvram_template);
+ok($st, "path $nvram_template exists after OVMF is installed");
+
+# Ensure the sample nvram file exists
+copy($nvram_template, $nvram_path) or die "Copy failed: $!";
+
+# Use 'q35' as machine type and add below lines to guest xml
+# <loader readonly='yes' secure='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.secboot.fd</loader>
+# <nvram template='/usr/share/OVMF/OVMF_VARS.fd'>/var/lib/libvirt/qemu/nvram/test_VARS.fd</nvram>
+
+my $xml = $tck->generic_domain(name => "tck")->as_xml;
+my $xp = XML::XPath->new($xml);
+diag $xp->getNodeText("/domain/os/type/\@machine");
+
+diag "Changing guest machine type to q35";
+$xp->setNodeText("/domain/os/type/\@machine", "q35");
+
+my $loader_node = XML::XPath::Node::Element->new('loader');
+my $loader_text = XML::XPath::Node::Text->new($loader_path);
+my $attr_ro = XML::XPath::Node::Attribute->new('readonly');
+my $attr_secure = XML::XPath::Node::Attribute->new('secure');
+my $attr_type = XML::XPath::Node::Attribute->new('type');
+
+$attr_ro -> setNodeValue('yes');
+$attr_secure -> setNodeValue('yes');
+$attr_type -> setNodeValue('pflash');
+
+$loader_node->appendChild($loader_text);
+$loader_node->appendAttribute($attr_ro);
+$loader_node->appendAttribute($attr_secure);
+$loader_node->appendAttribute($attr_type);
+
+my $nvram_node = XML::XPath::Node::Element->new('nvram');
+my $nvram_text = XML::XPath::Node::Text->new($nvram_path);
+my $attr_template = XML::XPath::Node::Attribute->new('template');
+
+$attr_template -> setNodeValue($nvram_template);
+
+$nvram_node->appendChild($nvram_text);
+$nvram_node->appendAttribute($attr_template);
+
+my $smm_node = XML::XPath::Node::Element->new('smm');
+my $attr_state = XML::XPath::Node::Attribute->new('state');
+$attr_state -> setNodeValue("on");
+$smm_node -> appendAttribute($attr_state);
+
+my ($root) = $xp->findnodes('/domain/os');
+$root->appendChild($loader_node);
+$root->appendChild($nvram_node);
+($root) = $xp->findnodes('/domain/features');
+$root->appendChild($smm_node);
+
+$xml = $xp->findnodes_as_string('/');
+diag $xml;
+return $xml;
+}
+
+diag "Defining an inactive domain config with nvram";
+my $loader_file_path = '/usr/share/OVMF/OVMF_CODE.secboot.fd';
+my $nvram_file_template = '/usr/share/OVMF/OVMF_VARS.fd';
+my $nvram_file_path = '/var/lib/libvirt/qemu/nvram/test_VARS.fd';
+
+my $xml = setup_nvram($loader_file_path, $nvram_file_template, $nvram_file_path);
+my $dom;
+
+diag "Test Sys::Virt::Domain::UNDEFINE_KEEP_NVRAM";
+ok_domain(sub { $dom = $conn->define_domain($xml) }, "defined domain with nvram configure");
+diag "Checking nvram file already exists";
+my $st = stat($nvram_file_path);
+ok($st, "File '$nvram_file_path' exists as expected");
+$dom->undefine(Sys::Virt::Domain::UNDEFINE_KEEP_NVRAM);
+diag "Checking nvram file still exists";
+$st = stat($nvram_file_path);
+ok($st, "File '$nvram_file_path' still exists as expected");
+
+diag "Test Sys::Virt::Domain::UNDEFINE_NVRAM";
+ok_domain(sub { $dom = $conn->define_domain($xml) }, "defined domain with nvram configure");
+$dom->undefine(Sys::Virt::Domain::UNDEFINE_NVRAM);
+diag "Checking nvram file removed";
+$st = stat($nvram_file_path);
+ok(!$st, "File '$nvram_file_path' is removed");
+
+ok_error(sub { $conn->get_domain_by_name("tck") }, "NO_DOMAIN error raised from missing domain",
+ Sys::Virt::Error::ERR_NO_DOMAIN);
--
2.18.1
5 years
[libvirt] [PATCH 0/2] configure: Provide OpenRC scripts for sub-daemons
by Michal Privoznik
Tested on my Gentoo and it works (TM). I've copied dependencies from
systemd unit files. I was also thinking about providing a dummy init
script that would do nothing but depend on the rest of sub-daemon init
files for convenience:
/etc/init.d/libvirt-dummy start
(the name is still WIP)
But I'm not sure if we want that - after we drop libvirtd we can use
libvirtd script just for that. But if somebody wants it, I can write and
post it as a follow up patch.
Michal Prívozník (2):
configure: Provide OpenRC scripts for sub-daemons
news: Document init scripts
docs/news.xml | 11 ++++++
m4/virt-init-script.m4 | 8 +++-
src/Makefile.am | 56 +++++++++++++++++++++++++++-
src/interface/Makefile.inc.am | 11 ++++++
src/interface/virtinterfaced.init.in | 26 +++++++++++++
src/libxl/Makefile.inc.am | 10 +++++
src/libxl/virtxend.init.in | 26 +++++++++++++
src/lxc/Makefile.inc.am | 10 +++++
src/lxc/virtlxcd.init.in | 26 +++++++++++++
src/network/Makefile.inc.am | 10 +++++
src/network/virtnetworkd.init.in | 26 +++++++++++++
src/node_device/Makefile.inc.am | 11 ++++++
src/node_device/virtnodedevd.init.in | 26 +++++++++++++
src/nwfilter/Makefile.inc.am | 11 ++++++
src/nwfilter/virtnwfilterd.init.in | 26 +++++++++++++
src/qemu/Makefile.inc.am | 10 +++++
src/qemu/virtqemud.init.in | 26 +++++++++++++
src/remote/Makefile.inc.am | 30 +++++++++++++++
src/remote/libvirtd.confd | 18 +++++++++
src/remote/libvirtd.init.in | 29 ++++++++++++++
src/remote/virtproxyd.confd | 10 +++++
src/remote/virtproxyd.init.in | 28 ++++++++++++++
src/secret/Makefile.inc.am | 10 +++++
src/secret/virtsecretd.init.in | 26 +++++++++++++
src/storage/Makefile.inc.am | 10 +++++
src/storage/virtstoraged.init.in | 26 +++++++++++++
src/vbox/Makefile.inc.am | 10 +++++
src/vbox/virtvboxd.init.in | 26 +++++++++++++
src/vz/Makefile.inc.am | 10 +++++
src/vz/virtvzd.init.in | 26 +++++++++++++
30 files changed, 587 insertions(+), 2 deletions(-)
create mode 100644 src/interface/virtinterfaced.init.in
create mode 100644 src/libxl/virtxend.init.in
create mode 100644 src/lxc/virtlxcd.init.in
create mode 100644 src/network/virtnetworkd.init.in
create mode 100644 src/node_device/virtnodedevd.init.in
create mode 100644 src/nwfilter/virtnwfilterd.init.in
create mode 100644 src/qemu/virtqemud.init.in
create mode 100644 src/remote/libvirtd.confd
create mode 100644 src/remote/libvirtd.init.in
create mode 100644 src/remote/virtproxyd.confd
create mode 100644 src/remote/virtproxyd.init.in
create mode 100644 src/secret/virtsecretd.init.in
create mode 100644 src/storage/virtstoraged.init.in
create mode 100644 src/vbox/virtvboxd.init.in
create mode 100644 src/vz/virtvzd.init.in
--
2.23.0
5 years
[libvirt] [PATCH RESEND 0/4] Add support for Hygon Dhyana CPU
by Yingle Hou
As a Joint Venture between AMD and Haiguang Information Technology Co., Ltd.,
Hygon aims to provide x86 server processor in China market. The first
generation processor Dhyana (family 18h) shares similar architecture with
AMD family 17h.
As Dhyana support in QEMU already have been merged in qemu-4.1.0 [1], to add
Dhyana support in libvirt, we have added a new Dhyana CPU model file
x86_Dhyana.xml in cpu_map directory, and also we have added a series of
Dhyana test files.
We have tested the patches on Hygon Dhyana machine with the result that it
has successfully worked as expected.
Reference:
[1] https://patchwork.kernel.org/patch/10902889/
Yingle Hou (4):
cpu: Remove the verification conditions of the model in the x86
signatures
cpu: Add new Dhyana CPU model
cputest: Add CPUID data for Hygon Dhyana 7185 32-core Processor
domaincapstest: Add CPU model Dhyana to QEMU
src/cpu/cpu_x86.c | 2 +-
src/cpu_map/Makefile.inc.am | 1 +
src/cpu_map/index.xml | 3 +
src/cpu_map/x86_Dhyana.xml | 70 +
src/cpu_map/x86_vendors.xml | 1 +
tests/cputest.c | 1 +
...86_64-cpuid-Hygon-C86-7185-32-core-disabled.xml | 7 +
...x86_64-cpuid-Hygon-C86-7185-32-core-enabled.xml | 9 +
.../x86_64-cpuid-Hygon-C86-7185-32-core-guest.xml | 16 +
.../x86_64-cpuid-Hygon-C86-7185-32-core-host.xml | 17 +
.../x86_64-cpuid-Hygon-C86-7185-32-core-json.xml | 12 +
.../x86_64-cpuid-Hygon-C86-7185-32-core.json | 1631 ++++++++++++++++++++
.../x86_64-cpuid-Hygon-C86-7185-32-core.sig | 4 +
.../x86_64-cpuid-Hygon-C86-7185-32-core.xml | 54 +
tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml | 1 +
tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_4.1.0.x86_64.xml | 1 +
tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 1 +
tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_4.2.0.x86_64.xml | 1 +
20 files changed, 1833 insertions(+), 1 deletion(-)
create mode 100644 src/cpu_map/x86_Dhyana.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-disabled.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-enabled.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-guest.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-host.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-json.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core.json
create mode 100644 tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core.sig
create mode 100644 tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core.xml
--
1.8.3.1
5 years
[libvirt] [PATCH] docs: remove link to virsh cmd ref & app dev guide
by Daniel P. Berrangé
Both the application developer guide and virsh command
reference are unmaintained for best part of 8 years, and
so horrifically out of date. This does not give a good
impression to people reading the docs. Now that we are
publishing the man pages online, those are a better
doc to read for virsh. We can also highlight the API
reference instead of the app dev guide.
The virsh command reference & app dev guide will
still exist on the web root, but will not be linked
to.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
docs/docs.html.in | 48 +++++++++++++++++++++--------------------------
1 file changed, 21 insertions(+), 27 deletions(-)
diff --git a/docs/docs.html.in b/docs/docs.html.in
index b592f7d51f..004f099a9f 100644
--- a/docs/docs.html.in
+++ b/docs/docs.html.in
@@ -54,11 +54,27 @@
<div class="panel">
<h2>Application development</h2>
<dl>
- <dt><a href="devguide.html">Development Guide</a></dt>
- <dd>A guide and reference for developing with libvirt</dd>
-
- <dt><a href="virshcmdref.html">Virsh Commands</a></dt>
- <dd>Command reference for virsh</dd>
+ <dt><a href="html/index.html">API reference</a></dt>
+ <dd>Reference manual for the C public API, split in
+ <a href="html/libvirt-libvirt-common.html">common</a>,
+ <a href="html/libvirt-libvirt-domain.html">domain</a>,
+ <a href="html/libvirt-libvirt-domain-checkpoint.html">domain checkpoint</a>,
+ <a href="html/libvirt-libvirt-domain-snapshot.html">domain snapshot</a>,
+ <a href="html/libvirt-virterror.html">error</a>,
+ <a href="html/libvirt-libvirt-event.html">event</a>,
+ <a href="html/libvirt-libvirt-host.html">host</a>,
+ <a href="html/libvirt-libvirt-interface.html">interface</a>,
+ <a href="html/libvirt-libvirt-network.html">network</a>,
+ <a href="html/libvirt-libvirt-nodedev.html">node device</a>,
+ <a href="html/libvirt-libvirt-nwfilter.html">network filter</a>,
+ <a href="html/libvirt-libvirt-secret.html">secret</a>,
+ <a href="html/libvirt-libvirt-storage.html">storage</a>,
+ <a href="html/libvirt-libvirt-stream.html">stream</a>
+ and
+ <a href="html/index-admin.html">admin</a>,
+ <a href="html/index-qemu.html">QEMU</a>,
+ <a href="html/index-lxc.html">LXC</a> libs
+ </dd>
<dt><a href="bindings.html">Language bindings and API modules</a></dt>
<dd>Bindings of the libvirt API for
@@ -97,28 +113,6 @@
<dt><a href="cgroups.html">CGroups</a></dt>
<dd>Control groups integration</dd>
- <dt><a href="html/index.html">API reference</a></dt>
- <dd>Reference manual for the C public API, split in
- <a href="html/libvirt-libvirt-common.html">common</a>,
- <a href="html/libvirt-libvirt-domain.html">domain</a>,
- <a href="html/libvirt-libvirt-domain-checkpoint.html">domain checkpoint</a>,
- <a href="html/libvirt-libvirt-domain-snapshot.html">domain snapshot</a>,
- <a href="html/libvirt-virterror.html">error</a>,
- <a href="html/libvirt-libvirt-event.html">event</a>,
- <a href="html/libvirt-libvirt-host.html">host</a>,
- <a href="html/libvirt-libvirt-interface.html">interface</a>,
- <a href="html/libvirt-libvirt-network.html">network</a>,
- <a href="html/libvirt-libvirt-nodedev.html">node device</a>,
- <a href="html/libvirt-libvirt-nwfilter.html">network filter</a>,
- <a href="html/libvirt-libvirt-secret.html">secret</a>,
- <a href="html/libvirt-libvirt-storage.html">storage</a>,
- <a href="html/libvirt-libvirt-stream.html">stream</a>
- and
- <a href="html/index-admin.html">admin</a>,
- <a href="html/index-qemu.html">QEMU</a>,
- <a href="html/index-lxc.html">LXC</a> libs
- </dd>
-
<dt><a href="drivers.html">Drivers</a></dt>
<dd>Hypervisor specific driver information</dd>
--
2.21.0
5 years
[libvirt] [dockerfiles PATCH] Drop Dockerfile for mips cross-builds on Debian sid
by Andrea Bolognani
The Debian project has dropped support for the architecture.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
Pushed under the Dockerfiles maintainance rule. Text diff below.
buildenv-libvirt-debian-sid-cross-mips.zip | Bin 1010 -> 0 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 buildenv-libvirt-debian-sid-cross-mips.zip
diff --git a/buildenv-libvirt-debian-sid-cross-mips.zip b/buildenv-libvirt-debian-sid-cross-mips.zip
deleted file mode 100644
index 287fa12..0000000
--- a/buildenv-libvirt-debian-sid-cross-mips.zip
+++ /dev/null
@@ -1,112 +0,0 @@
-FROM debian:sid
-
-RUN export DEBIAN_FRONTEND=noninteractive && \
- apt-get update && \
- apt-get dist-upgrade -y && \
- apt-get install --no-install-recommends -y \
- augeas-lenses \
- augeas-tools \
- autoconf \
- automake \
- autopoint \
- bash \
- bash-completion \
- ca-certificates \
- ccache \
- chrony \
- dnsmasq-base \
- dwarves \
- ebtables \
- flake8 \
- gcc \
- gdb \
- gettext \
- git \
- iproute2 \
- kmod \
- libc-dev-bin \
- libtool \
- libtool-bin \
- libxml2-utils \
- locales \
- lsof \
- lvm2 \
- make \
- meson \
- net-tools \
- nfs-common \
- ninja-build \
- numad \
- open-iscsi \
- parted \
- patch \
- perl \
- pkgconf \
- policykit-1 \
- python3 \
- python3-docutils \
- python3-setuptools \
- qemu-utils \
- radvd \
- screen \
- scrub \
- strace \
- sudo \
- vim \
- xsltproc \
- zfs-fuse && \
- apt-get autoremove -y && \
- apt-get autoclean -y && \
- sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
- dpkg-reconfigure locales
-
-RUN export DEBIAN_FRONTEND=noninteractive && \
- dpkg --add-architecture mips && \
- apt-get update && \
- apt-get dist-upgrade -y && \
- apt-get install --no-install-recommends -y \
- gcc-mips-linux-gnu \
- libacl1-dev:mips \
- libapparmor-dev:mips \
- libattr1-dev:mips \
- libaudit-dev:mips \
- libavahi-client-dev:mips \
- libblkid-dev:mips \
- libc6-dev:mips \
- libcap-ng-dev:mips \
- libcurl4-gnutls-dev:mips \
- libdbus-1-dev:mips \
- libdevmapper-dev:mips \
- libfuse-dev:mips \
- libglib2.0-dev:mips \
- libglusterfs-dev:mips \
- libgnutls28-dev:mips \
- libiscsi-dev:mips \
- libncurses-dev:mips \
- libnl-3-dev:mips \
- libnl-route-3-dev:mips \
- libnuma-dev:mips \
- libparted-dev:mips \
- libpcap0.8-dev:mips \
- libpciaccess-dev:mips \
- librbd-dev:mips \
- libreadline-dev:mips \
- libsanlock-dev:mips \
- libsasl2-dev:mips \
- libselinux1-dev:mips \
- libssh-gcrypt-dev:mips \
- libssh2-1-dev:mips \
- libtirpc-dev:mips \
- libudev-dev:mips \
- libxml2-dev:mips \
- libyajl-dev:mips \
- xfslibs-dev:mips && \
- apt-get autoremove -y && \
- apt-get autoclean -y
-
-ENV LANG "en_US.UTF-8"
-
-ENV ABI "mips-linux-gnu"
-ENV CONFIGURE_OPTS "--host=mips-linux-gnu \
- --target=mips-linux-gnu"
-ENV PKG_CONFIG_LIBDIR "/usr/lib/mips-linux-gnu/pkgconfig"
--
2.23.0
5 years