[libvirt] [PATCH libvirt-virshcmdref] Add blockpull and blockjob commands
by Stefan Hajnoczi
The blockpull and blockjob commands have been present since 0.9.4. This
patch adds basic usage examples and command syntax.
Signed-off-by: Stefan Hajnoczi <stefanha(a)linux.vnet.ibm.com>
---
common.sh | 8 ++--
source/blockjob.xml | 79 +++++++++++++++++++++++++++++++++++++++
source/blockpull.xml | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 184 insertions(+), 4 deletions(-)
create mode 100644 source/blockjob.xml
create mode 100644 source/blockpull.xml
diff --git a/common.sh b/common.sh
index 9da1b13..7e3a3a0 100755
--- a/common.sh
+++ b/common.sh
@@ -1,9 +1,9 @@
# List of source files
DOMAIN_COMMANDS="attach-device attach-disk attach-interface autostart
- blkiotune console cpu-baseline cpu-compare create define destroy
- detach-device detach-disk detach-interface domid domjobabort domjobinfo
- domname domuuid domxml-from-native domxml-to-native dump dumpxml echo
- edit freecell hostname inject-nmi managedsave managedsave-remove
+ blkiotune blockjob blockpull console cpu-baseline cpu-compare create define
+ destroy detach-device detach-disk detach-interface domid domjobabort
+ domjobinfo domname domuuid domxml-from-native domxml-to-native dump dumpxml
+ echo edit freecell hostname inject-nmi managedsave managedsave-remove
maxvcpus memtune migrate migrate-setmaxdowntime migrate-getspeed
migrate-setspeed reboot restore resume save schedinfo send-key
setmaxmem setmem setvcpus shutdown start suspend ttyconsole undefine
diff --git a/source/blockjob.xml b/source/blockjob.xml
new file mode 100644
index 0000000..0c34bae
--- /dev/null
+++ b/source/blockjob.xml
@@ -0,0 +1,79 @@
+<?xml version='1.0' encoding='utf-8' ?>
+
+<command>
+ <name>blockjob</name>
+
+ <description>
+ <text>
+ Manage active block operations
+ </text>
+ </description>
+
+ <options>
+ <parameter requirement="required">
+ <value type="string" requirement="required">domain</value>
+ <description>
+ The name of the domain on which to act.
+ </description>
+ </parameter>
+ <parameter requirement="required">
+ <value type="string" requirement="required">path</value>
+ <description>
+ The fully-qualified path of the disk. See "domblklist" for listing these names.
+ </description>
+ </parameter>
+ <parameter requirement="optional">
+ <keyword requirement="required">--abort</keyword>
+ <description>
+ Abort the active job on the specified disk.
+ </description>
+ </parameter>
+ <parameter requirement="optional">
+ <keyword requirement="required">--async</keyword>
+ <description>
+ Return immediately instead of waiting for cancelation to complete, when specified together with "--abort".
+ </description>
+ </parameter>
+ <parameter requirement="optional">
+ <keyword requirement="required">--pivot</keyword>
+ </parameter>
+ <parameter requirement="optional">
+ <keyword requirement="required">--info</keyword>
+ <description>
+ Print information about any active block operation.
+ </description>
+ </parameter>
+ </options>
+
+ <availability from="0.9.4" />
+
+ <notes />
+
+ <examples type="usage">
+ <example>
+ <terminal>virsh # <bold>blockjob</bold> <value>example-domain</value> <value>vda</value> <italic>--info</italic></terminal>
+ <text>
+ Prints information about any active block operation on <value>vda</value> from <value>example-domain</value>.
+ </text>
+ </example>
+ <example>
+ <terminal>virsh # <bold>blockjob</bold> <value>example-domain</value> <value>vda</value> <italic>--abort</italic></terminal>
+ <text>
+ Cancels the active block operation on <value>vda</value> from <value>example-domain</value>.
+ </text>
+ </example>
+ </examples>
+
+ <examples type="fullcontext" />
+
+ <reference type="seealso">
+ <item>
+ <link type="internal" href="blockpull" />
+ <name>blockpull</name>
+ <description>
+ populate a disk from its backing image chain
+ </description>
+ </item>
+ </reference>
+
+</command>
diff --git a/source/blockpull.xml b/source/blockpull.xml
new file mode 100644
index 0000000..81b58da
--- /dev/null
+++ b/source/blockpull.xml
@@ -0,0 +1,101 @@
+<?xml version='1.0' encoding='utf-8' ?>
+
+<command>
+ <name>blockpull</name>
+
+ <description>
+ <text>
+ Populate a disk from its backing image chain
+ </text>
+ </description>
+
+ <options>
+ <parameter requirement="required">
+ <value type="string" requirement="required">domain</value>
+ <description>
+ The name of the domain on which to act.
+ </description>
+ </parameter>
+ <parameter requirement="required">
+ <value type="string" requirement="required">path</value>
+ <description>
+ The fully-qualified path of the disk. See "domblklist" for listing these names.
+ </description>
+ </parameter>
+ <parameter requirement="optional">
+ <value type="number" requirement="required">bandwidth</value>
+ <description>
+ Copying bandwidth limit in MiB/s.
+ </description>
+ </parameter>
+ <parameter requirement="optional">
+ <value type="string" requirement="required">base</value>
+ <description>
+ Stop at a specific backing image instead of flattening the entire chain.
+ </description>
+ </parameter>
+ <parameter requirement="optional">
+ <keyword requirement="required">--wait</keyword>
+ <description>
+ Block until the operation completes instead of returning as soon as possible while the operation runs in the background.
+ </description>
+ </parameter>
+ <parameter requirement="optional">
+ <keyword requirement="required">--verbose</keyword>
+ <description>
+ Print periodic status updates when used together with "--wait".
+ </description>
+ </parameter>
+ <parameter requirement="optional">
+ <keyword requirement="required">--timeout</keyword>
+ <value type="number" requirement="required">seconds</value>
+ <description>
+ Cancel the operation if the timeout elapses. Use together with "--wait".
+ </description>
+ </parameter>
+ <parameter requirement="optional">
+ <keyword requirement="required">--async</keyword>
+ <description>
+ Return as soon as possible.
+ </description>
+ </parameter>
+ </options>
+
+ <availability from="0.9.4" />
+
+ <notes />
+
+ <examples type="usage">
+ <example>
+ <terminal>virsh # <bold>blockpull</bold> <value>example-domain</value> <value>vda</value></terminal>
+ <text>
+ Start populating <value>vda</value> from its backing image chain and return immediately.
+ </text>
+ </example>
+ <example>
+ <terminal>virsh # <bold>blockpull</bold> <value>example-domain</value> <value>vda</value> <value>--wait</value></terminal>
+ <text>
+ Populate <value>vda</value> from its backing image chain and wait for the operation to complete.
+ </text>
+ </example>
+ <example>
+ <terminal>virsh # <bold>blockpull</bold> <value>example-domain</value> <value>vda</value> <value>0</value> <value>/path/to/backing.img</value></terminal>
+ <text>
+ Start populating <value>vda</value> from its backing image chain up to <value>/path/to/backing.img</value> and return immediately. <value>/path/to/backing.img</value> and its backing images will not be flattened. Note that the <value>0</value> means unlimited bandwidth and is necessary because <value>bandwidth</value> and <value>base</value> are positional arguments.
+ </text>
+ </example>
+ </examples>
+
+ <examples type="fullcontext" />
+
+ <reference type="seealso">
+ <item>
+ <link type="internal" href="blockjob" />
+ <name>blockjob</name>
+ <description>
+ manage active block operations
+ </description>
+ </item>
+ </reference>
+
+</command>
--
1.7.10.4
12 years, 7 months
[libvirt] [test-API][PATCH 1/2] New get_conn function in utils
by Wayne Sun
The get_conn function return connection object from libvirt module.
This function could be used by both framework and testcases.
The patch includes:
* get_conn in utils/utils.py
* sync env_inspect.py using the new function
Signed-off-by: Wayne Sun <gsun(a)redhat.com>
---
src/env_inspect.py | 22 ++--------------------
utils/utils.py | 27 +++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/src/env_inspect.py b/src/env_inspect.py
index b260ff8..2c1a701 100644
--- a/src/env_inspect.py
+++ b/src/env_inspect.py
@@ -20,6 +20,7 @@
import commands
import libvirt
import sharedmod
+from utils import utils
def check_libvirt(logger):
virsh = 'virsh -v'
@@ -68,20 +69,6 @@ def hostinfo(logger):
return 1
return 0
-def request_credentials(credentials, user_data):
- for credential in credentials:
- if credential[0] == libvirt.VIR_CRED_AUTHNAME:
- credential[4] = user_data[0]
-
- if len(credential[4]) == 0:
- credential[4] = credential[3]
- elif credential[0] == libvirt.VIR_CRED_PASSPHRASE:
- credential[4] = user_data[1]
- else:
- return -1
-
- return 0
-
def sharemod_init(env_parser, logger):
""" get connection object from libvirt module
initialize sharemod for use by testcases
@@ -89,12 +76,7 @@ def sharemod_init(env_parser, logger):
uri = env_parser.get_value('variables', 'defaulturi')
username = env_parser.get_value('variables', 'username')
password = env_parser.get_value('variables', 'password')
- user_data = [username, password]
- auth = [[libvirt.VIR_CRED_AUTHNAME, libvirt.VIR_CRED_PASSPHRASE], request_credentials, user_data]
- conn = libvirt.openAuth(uri, auth, 0)
- if not conn:
- logger.error("Failed to setup libvirt connection");
- return 1
+ conn = utils.get_conn(uri, username, password)
# initialize conn object in sharedmod
sharedmod.libvirtobj.clear()
diff --git a/utils/utils.py b/utils/utils.py
index be87cdc..eade10d 100644
--- a/utils/utils.py
+++ b/utils/utils.py
@@ -29,6 +29,7 @@ import struct
import pexpect
import string
import subprocess
+import libvirt
from xml.dom import minidom
from urlparse import urlparse
@@ -57,6 +58,32 @@ def get_uri(ip):
uri = "qemu+ssh://%s/system" % ip
return uri
+def request_credentials(credentials, user_data):
+ for credential in credentials:
+ if credential[0] == libvirt.VIR_CRED_AUTHNAME:
+ credential[4] = user_data[0]
+
+ if len(credential[4]) == 0:
+ credential[4] = credential[3]
+ elif credential[0] == libvirt.VIR_CRED_PASSPHRASE:
+ credential[4] = user_data[1]
+ else:
+ return -1
+
+ return 0
+
+def get_conn(uri='', username='', password=''):
+ """ get connection object from libvirt module
+ """
+ user_data = [username, password]
+ auth = [[libvirt.VIR_CRED_AUTHNAME, libvirt.VIR_CRED_PASSPHRASE], request_credentials, user_data]
+ conn = libvirt.openAuth(uri, auth, 0)
+ if not conn:
+ logger.error("Failed to setup libvirt connection");
+ sys.exit(1)
+ else:
+ return conn
+
def parse_uri(uri):
# This is a simple parser for uri
return urlparse(uri)
--
1.7.1
12 years, 7 months
[libvirt] [PATCHv4] add-vcpu-usage
by Hu Tao
show `vcpu usages' by `virt-top -1'
Before this patch, `virt-top -1' shows total cpu usages
which euqal to `vcpu usages' + `hypervisor usages'. This
patch adds another column for domains showing `vcpu
usages'. An example is:
PHYCPU %CPU example_domain
0 10.4 10.4 0.8
1 1.6 1.6 1.4
2 2.6 2.6 2.6
3 0.0 0.0 0.1
---
virt-top/virt_top.ml | 72 ++++++++++++++++++++++++++++++++++++-------------
1 files changed, 53 insertions(+), 19 deletions(-)
diff --git a/virt-top/virt_top.ml b/virt-top/virt_top.ml
index e2fe554..0dcb170 100644
--- a/virt-top/virt_top.ml
+++ b/virt-top/virt_top.ml
@@ -448,6 +448,7 @@ let collect, clear_pcpu_display_data =
(* Save pcpu_usages structures across redraws too (only for pCPU display). *)
let last_pcpu_usages = Hashtbl.create 13 in
+ let last_vcpu_usages = Hashtbl.create 13 in
let clear_pcpu_display_data () =
(* Clear out pcpu_usages used by PCPUDisplay display_mode
@@ -652,12 +653,17 @@ let collect, clear_pcpu_display_data =
(try
let domid = rd.rd_domid in
let maplen = C.cpumaplen nr_pcpus in
- let cpu_stats = D.get_cpu_stats rd.rd_dom nr_pcpus in
- let rec find_usages_from_stats = function
+ let cpu_stats = D.get_cpu_stats rd.rd_dom false in
+ let rec find_cpu_usages = function
| ("cpu_time", D.TypedFieldUInt64 usages) :: _ -> usages
- | _ :: params -> find_usages_from_stats params
+ | _ :: params -> find_cpu_usages params
| [] -> 0L in
- let pcpu_usages = Array.map find_usages_from_stats cpu_stats in
+ let rec find_vcpu_usages = function
+ | ("vcpu_time", D.TypedFieldUInt64 usages) :: _ -> usages
+ | _ :: params -> find_vcpu_usages params
+ | [] -> 0L in
+
+ let pcpu_usages = Array.map find_cpu_usages cpu_stats in
let maxinfo = rd.rd_info.D.nr_virt_cpu in
let nr_vcpus, vcpu_infos, cpumaps =
D.get_vcpus rd.rd_dom maxinfo maplen in
@@ -669,11 +675,19 @@ let collect, clear_pcpu_display_data =
(* Update last_pcpu_usages. *)
Hashtbl.replace last_pcpu_usages domid pcpu_usages;
- (match prev_pcpu_usages with
- | Some prev_pcpu_usages
+ (* vcpu usages *)
+ let vcpu_usages = Array.map find_vcpu_usages cpu_stats in
+ let prev_vcpu_usages =
+ try Some (Hashtbl.find last_vcpu_usages domid)
+ with Not_found -> None in
+ Hashtbl.replace last_vcpu_usages domid vcpu_usages;
+
+ (match prev_pcpu_usages, prev_vcpu_usages with
+ | Some prev_pcpu_usages, Some prev_vcpu_usages
when Array.length prev_pcpu_usages = Array.length pcpu_usages ->
- Some (domid, name, nr_vcpus, vcpu_infos, pcpu_usages,
- prev_pcpu_usages, cpumaps, maplen)
+ Some (domid, name, nr_vcpus, vcpu_infos, pcpu_usages,
+ prev_pcpu_usages, vcpu_usages, prev_vcpu_usages,
+ cpumaps, maplen)
| _ -> None (* ignore missing / unequal length prev_vcpu_infos *)
);
with
@@ -691,13 +705,24 @@ let collect, clear_pcpu_display_data =
List.iteri (
fun di (domid, name, nr_vcpus, vcpu_infos, pcpu_usages,
- prev_pcpu_usages, cpumaps, maplen) ->
+ prev_pcpu_usages, vcpu_usages, prev_vcpu_usages,
+ cpumaps, maplen) ->
(* Which pCPUs can this dom run on? *)
for p = 0 to Array.length pcpu_usages - 1 do
pcpus.(p).(di) <- pcpu_usages.(p) -^ prev_pcpu_usages.(p)
- done
+ done
) doms;
+ let vcpus = Array.make_matrix nr_pcpus nr_doms 0L in
+ List.iteri (
+ fun di (domid, name, nr_vcpus, vcpu_infos, pcpu_usages,
+ prev_pcpu_usages, vcpu_usages, prev_vcpu_usages,
+ cpumaps, maplen) ->
+ for p = 0 to Array.length vcpu_usages - 1 do
+ vcpus.(p).(di) <- vcpu_usages.(p) -^ prev_vcpu_usages.(p)
+ done
+ ) doms;
+
(* Sum the CPU time used by each pCPU, for the %CPU column. *)
let pcpus_cpu_time = Array.map (
fun row ->
@@ -709,7 +734,7 @@ let collect, clear_pcpu_display_data =
Int64.to_float !cpu_time
) pcpus in
- Some (doms, pcpus, pcpus_cpu_time)
+ Some (doms, pcpus, vcpus, pcpus_cpu_time)
) else
None in
@@ -913,7 +938,7 @@ let redraw =
loop domains_lineno doms
| PCPUDisplay -> (*---------- Showing physical CPUs ----------*)
- let doms, pcpus, pcpus_cpu_time =
+ let doms, pcpus, vcpus, pcpus_cpu_time =
match pcpu_display with
| Some p -> p
| None -> failwith "internal error: no pcpu_display data" in
@@ -922,9 +947,9 @@ let redraw =
let dom_names =
String.concat "" (
List.map (
- fun (_, name, _, _, _, _, _, _) ->
+ fun (_, name, _, _, _, _, _, _, _, _) ->
let len = String.length name in
- let width = max (len+1) 7 in
+ let width = max (len+1) 12 in
pad width name
) doms
) in
@@ -941,18 +966,27 @@ let redraw =
addch ' ';
List.iteri (
- fun di (domid, name, _, _, _, _, _, _) ->
+ fun di (domid, name, _, _, _, _, _, _, _, _) ->
let t = pcpus.(p).(di) in
+ let tv = vcpus.(p).(di) in
let len = String.length name in
- let width = max (len+1) 7 in
- let str =
+ let width = max (len+1) 12 in
+ let str_pcpu =
if t <= 0L then ""
else (
let t = Int64.to_float t in
let percent = 100. *. t /. total_cpu_per_pcpu in
- sprintf "%s " (Show.percent percent)
+ sprintf "%s" (Show.percent percent)
) in
- addstr (pad width str);
+ let str_vcpu =
+ if tv <= 0L then ""
+ else (
+ let tv = Int64.to_float tv in
+ let percent = 100. *. tv /. total_cpu_per_pcpu in
+ sprintf "%s" (Show.percent percent)
+ ) in
+ let str = sprintf "%s %s" str_pcpu str_vcpu in
+ addstr (pad width str);
()
) doms
) pcpus;
--
1.7.1
12 years, 7 months
[libvirt] [PATCH] fix check of vcpuid in virDomainVcpuPinDefParseXML
by Hu Tao
For emulator, the vcpuid field is always set to -1, instead of parsing
XML for the value of it.
---
src/conf/domain_conf.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7242205..419088c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7923,7 +7923,7 @@ virDomainVcpuPinDefParseXML(const xmlNodePtr node,
{
virDomainVcpuPinDefPtr def;
xmlNodePtr oldnode = ctxt->node;
- int vcpuid;
+ int vcpuid = -1;
char *tmp = NULL;
int ret;
@@ -7934,15 +7934,17 @@ virDomainVcpuPinDefParseXML(const xmlNodePtr node,
ctxt->node = node;
- ret = virXPathInt("string(./@vcpu)", ctxt, &vcpuid);
- if ((ret == -2) || (vcpuid < -1)) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("vcpu id must be an unsigned integer or -1"));
- goto error;
- } else if ((vcpuid == -1) && (emulator == 0)) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("vcpu id value -1 is not allowed for vcpupin"));
- goto error;
+ if (emulator == 0) {
+ ret = virXPathInt("string(./@vcpu)", ctxt, &vcpuid);
+ if ((ret == -2) || (vcpuid < -1)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("vcpu id must be an unsigned integer or -1"));
+ goto error;
+ } else if (vcpuid == -1) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("vcpu id value -1 is not allowed for vcpupin"));
+ goto error;
+ }
}
if (vcpuid >= maxvcpus) {
--
1.7.10.2
12 years, 7 months
[libvirt] [PATCH] util: eliminate erroneous VIR_WARNs in (eb|ip)tables.c
by Laine Stump
Several VIR_DEBUG()'s were changed to VIR_WARN() while I was testing
the firewalld support patch, and I neglected to change them back
before I pushed.
In the meantime I've decided that it would be useful to have them be
VIR_INFO(), just so there will be logged evidence of which method is
being used (firewall-cmd vs. (eb|ip)tables) without needing to crank
logging to 11. (at most this adds 2 lines to libvirtd's logs per
libvirtd start).
---
src/util/ebtables.c | 8 ++++----
src/util/iptables.c | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/util/ebtables.c b/src/util/ebtables.c
index 1a78f89..3170ab0 100644
--- a/src/util/ebtables.c
+++ b/src/util/ebtables.c
@@ -55,19 +55,19 @@ virEbTablesOnceInit(void)
{
firewall_cmd_path = virFindFileInPath("firewall-cmd");
if (!firewall_cmd_path) {
- VIR_WARN("firewall-cmd not found on system. "
- "firewalld support disabled for ebtables.");
+ VIR_INFO("firewall-cmd not found on system. "
+ "firewalld support disabled for ebtables.");
} else {
virCommandPtr cmd = virCommandNew(firewall_cmd_path);
int status;
virCommandAddArgList(cmd, "--state", NULL);
if (virCommandRun(cmd, &status) < 0 || status != 0) {
- VIR_WARN("firewall-cmd found but disabled for ebtables");
+ VIR_INFO("firewall-cmd found but disabled for ebtables");
VIR_FREE(firewall_cmd_path);
firewall_cmd_path = NULL;
} else {
- VIR_WARN("using firewalld for ebtables commands");
+ VIR_INFO("using firewalld for ebtables commands");
}
virCommandFree(cmd);
}
diff --git a/src/util/iptables.c b/src/util/iptables.c
index d8fdd3b..8a575c2 100644
--- a/src/util/iptables.c
+++ b/src/util/iptables.c
@@ -53,19 +53,19 @@ virIpTablesOnceInit(void)
{
firewall_cmd_path = virFindFileInPath("firewall-cmd");
if (!firewall_cmd_path) {
- VIR_WARN("firewall-cmd not found on system. "
- "firewalld support disabled for iptables.");
+ VIR_INFO("firewall-cmd not found on system. "
+ "firewalld support disabled for iptables.");
} else {
virCommandPtr cmd = virCommandNew(firewall_cmd_path);
int status;
virCommandAddArgList(cmd, "--state", NULL);
if (virCommandRun(cmd, &status) < 0 || status != 0) {
- VIR_WARN("firewall-cmd found but disabled for iptables");
+ VIR_INFO("firewall-cmd found but disabled for iptables");
VIR_FREE(firewall_cmd_path);
firewall_cmd_path = NULL;
} else {
- VIR_WARN("using firewalld for iptables commands");
+ VIR_INFO("using firewalld for iptables commands");
}
virCommandFree(cmd);
}
--
1.7.11.4
12 years, 7 months
[libvirt] [gluster]try to add gluster protocol in libvirt, but has qemuMonitorIO error
by Yin Yin
Hi, all:
after test the qemu gluster V5 patch:
http://lists.nongnu.org/archive/html/qemu-devel/2012-08/msg01023.html
I had write a patch in libvirt to support gluster protocol, but has
qemuMonitorIO error:
2012-08-22 17:17:47.600+0000: 29121: error : qemuMonitorIORead:490 :
Unable to read from monitor: Connection reset by peer
2012-08-22 17:17:47.600+0000: 29121: error : qemuMonitorIO:546 : 内部错误 event
from unexpected fd -1!=27 / watch 15!=15
the vm libvirt config file like this:
<domain type='kvm'>
<name>gluster-vm</name>
<vcpu>1</vcpu>
<cpu>
<topology sockets='1' cores='1' threads='1'/>
</cpu>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<memory>524288</memory>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='network' device='disk'>
<source protocol='gluster' name='volname/windowsxp.img'>
<host name='10.1.0.1' port='24007'/>
</source>
<target dev='vda' bus='virtio'/>
<driver name='qemu' type='qcow2' io='native' cache='none'/>
</disk>
<controller type='virtio-serial' index='0'/>
</devices>
<features>
<pae/>
<acpi/>
<apic/>
</features>
</domain>
my questions:
1. what's the function of qemuMonitorIO?
2. why the qemu-gluster patch caused qemuMonitorIO error?
I could boot vm in qemu command without monitor, like this:
/usr/libexec/qemu-kvm -drive file=gluster://
10.1.0.1/volname/windowsxp.img,format=qcow2
Best Regards,
Yin Yin
12 years, 7 months
[libvirt] [PATCH 0/5] add usb redirection filter support
by Guannan Ren
BZ RFE https://bugzilla.redhat.com/show_bug.cgi?id=795929
qemu support:
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=6af165892cf900291046f1d25f...
Since qemu has have the code to support USB redirection filter. This set of
patches try to support it from libvirt.
The XML format is like this:
<devices>
...
<redirdev bus='usb' type='spicevmc'>
<address type='usb' bus='0' port='4'/>
</redirdev>
<redirfilter>
<usbdev class='0x08' vendor='0x1234' product='0xbeef' \
version='2.00' allow='yes'/>
<usbdev class='-1' vendor='-1' product='-1' version='-1' allow='no'/>
</redirfilter>
...
</devices>
Multiple <usbdev> element as one of filter rule could be added into parent
element <redirfilter>, only no more than <redirfilter> element could exists.
There is no 1:1 mapping between ports and redirected devices and qemu and
spicy client couldn't decide into which usbredir ports the client can 'plug'
redirected devices. So it make sense to apply all of filter rules global to
all existing usb redirection devices. class attribute is USB Class codes.
version is bcdDevice value of USB device. vendor and product is USB vendorId
and productId.
-1 can be used to allow any value for a field. Except allow attribute
the other four are optional, default value is -1.
The above XML will be converted to the following qemu command line:
If there are multiple usb-redir device, all of them have the same filter rules.
-device usb-redir,chardev=charredir0,id=redir0,\
filter=0x08:0x1234:0xBEEF:0x2000:1|-1:-1:-1:-1:0,bus=usb.0,port=4
Guannan Ren(0/5)
qemu: add usb-redir.filter qemu capability flag
qemu: define and parse USB redirection filter XML
qemu: build USB redirection filter qemu command line
test: add xml2argvtest for usb-redir filter and update
doc: update usb redirection filter infomation on
docs/formatdomain.html.in | 38 ++-
docs/schemas/domaincommon.rng | 66 ++++
src/conf/domain_conf.c | 346 ++++++++++++++++++++
src/conf/domain_conf.h | 21 ++
src/qemu/qemu_capabilities.c | 4 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 45 +++-
src/qemu/qemu_command.h | 5 +-
src/qemu/qemu_hotplug.c | 3 +-
.../qemuxml2argv-usb-redir-filter.args | 10 +
.../qemuxml2argv-usb-redir-filter.xml | 45 +++
tests/qemuxml2argvtest.c | 6 +
12 files changed, 571 insertions(+), 19 deletions(-)
12 years, 7 months
[libvirt] [PATCH] additional parameter needed for dnsmasq
by Gene Czarcinski
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=849787
As currently configured, dnsmasq for a virtual network will pass some
queries upstream toward the Internet. This includes AAAA and MX queries
as well a A queries when dnsmasq cannot answer for that name. This is
occurring whether a domain name is specified or not. The problem is that
dnsmasq will, by default, forward all queries unless "local=" is
specified. I cannot envision a situation where such queries should be
forwarded.
See the bugzilla report for more info. While I did a lot of testing to
figure out the problem and what needed to be done to fix it, I am unable
to actually rebuild the libvirt rpm in my environment.
The solution is the following patch:
diff -uNr libvirt-0.9.11.4.orig/src/network/bridge_driver.c
libvirt-0.9.11.4/src/network/bridge_driver.c
--- libvirt-0.9.11.4.orig/src/network/bridge_driver.c 2012-06-15
14:23:21.000000000 -0400
+++ libvirt-0.9.11.4/src/network/bridge_driver.c 2012-08-21
09:03:17.387602485 -0400
@@ -491,7 +491,13 @@
virCommandAddArgList(cmd, "--strict-order", "--bind-interfaces",
NULL);
if (network->def->domain)
- virCommandAddArgList(cmd, "--domain", network->def->domain, NULL);
+// virCommandAddArgList(cmd, "--domain", network->def->domain,
NULL);
+ virCommandAddArgFormat(cmd,
+ "--domain %s --local=/%s/",
+ network->def->domain,
+ network->def->domain);
+ else
+ virCommandAddArg(cmd, "--local=");
if (pidfile)
virCommandAddArgPair(cmd, "--pid-file", pidfile);
12 years, 7 months
[libvirt] [PATCH v3 0/4] Per-guest S3/S4 configuration
by Martin Kletzander
There is a way to tell qemu how (not) to advertise S3/S4 ACPI sleep
state capability to the guest OS. This series includes the capability
to set this in the XML and also covers all the handling from qemu
point of view including checking for the support, parameter parsing,
command building, checking before sending the signals through guest
agent and also tests and documentation.
--
v3:
- Option names are change according to Eric and Doug
- Added docs (formatdomain)
v2:
- Modified the patch to reflect danpb's notes (according to qemu
people the setting the disable_s[34] parameter to 0/1 ensures that
the states will be enabled/disabled respectively)
Martin Kletzander (4):
Add per-guest S3/S4 state configuration
qemu: Add support for S3/S4 state configuration
tests: Add tests for qemu S3/S4 state configuration
docs: Add pm element into documentation
docs/formatdomain.html.in | 21 ++++
docs/schemas/domaincommon.rng | 33 ++++++
src/conf/domain_conf.c | 44 +++++++++
src/conf/domain_conf.h | 15 +++
src/libvirt_private.syms | 2 +
src/qemu/qemu_capabilities.c | 7 ++
src/qemu/qemu_capabilities.h | 2 +
src/qemu/qemu_command.c | 103 ++++++++++++++++++++
src/qemu/qemu_driver.c | 17 +++
tests/qemuargv2xmltest.c | 3 +
.../qemuxml2argv-misc-disable-s3.args | 4 +
.../qemuxml2argv-misc-disable-s3.xml | 27 +++++
.../qemuxml2argv-misc-disable-suspends.args | 4 +
.../qemuxml2argv-misc-disable-suspends.xml | 27 +++++
.../qemuxml2argv-misc-enable-s4.args | 4 +
.../qemuxml2argv-misc-enable-s4.xml | 27 +++++
tests/qemuxml2argvtest.c | 4 +
tests/qemuxml2xmltest.c | 3 +
18 files changed, 347 insertions(+), 0 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-misc-disable-s3.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-misc-disable-s3.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-misc-disable-suspends.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-misc-disable-suspends.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-misc-enable-s4.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-misc-enable-s4.xml
--
1.7.8.6
12 years, 7 months