[libvirt] [PATCH 0/4] qemu: Unplug devices that disappeared when libvirtd was down
by Jiri Denemark
In case libvirtd is asked to unplug a device but the device is actually
unplugged later when libvirtd is not running, we need to detect that and
remove such device when libvirtd starts again and reconnects to running
domains.
Jiri Denemark (4):
util: Non-existent string array does not contain any string
conf: Make error reporting in virDomainDefFindDevice optional
qemu: Introduce qemuMonitorGetDeviceAliases
qemu: Unplug devices that disappeared when libvirtd was down
src/conf/domain_conf.c | 11 +++++---
src/conf/domain_conf.h | 3 ++-
src/qemu/qemu_domain.c | 56 ++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_domain.h | 4 +++
src/qemu/qemu_driver.c | 6 +++++
src/qemu/qemu_monitor.c | 21 +++++++++++++++
src/qemu/qemu_monitor.h | 4 +++
src/qemu/qemu_monitor_json.c | 38 +++++++++++++++++++++++++++
src/qemu/qemu_monitor_json.h | 4 +++
src/qemu/qemu_process.c | 45 +++++++++++++++++++++++++++++++-
src/util/virstring.c | 3 +++
tests/qemumonitorjsontest.c | 61 ++++++++++++++++++++++++++++++++++++++++++++
12 files changed, 251 insertions(+), 5 deletions(-)
--
1.8.3.2
11 years, 4 months
[libvirt] [RESEND PATCH 0/5] Handling of undefine and redefine snapshots with VirtualBox 4.2
by Manuel VIVES
Hi,
This is a serie of patches in order to support undefining and redefining
snapshots with VirtualBox 4.2.
The serie of patches is rather big, and adds among other things some utility functions unrelated to VirtualBox in patches 1 & 2.
The code review could be done in several parts: e.g. patches 1 & 2 separately to validate the utility functions.
The VirtualBox API provides only high level operations to manipulate snapshots,
so it not possible to support flags like VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE and
VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY with only API calls.
Following an IRC talk with Eric Blake, the decision was taken to emulate these
behaviours by manipulating directly the .vbox XML files.
The first two patches are some util methods for handling uuid and strings that
will be used after.
The third patch brings more details in the snapshot XML returned by libvirt.
We will need those modifications in order to redefine the snapshots.
The fourth patch brings the support of the VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE
and VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT flags in virDomainSnapshotCreateXML.
The fifth and last patch brings the support of the VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY
flag in virDomainSnapshotDelete.
The patches are only for Virtualbox 4.2
Regards,
Manuel VIVES
Manuel VIVES (5):
viruuid.h/c: Util method for finding uuid patterns in some strings
virstring.h/c: Util method for making some find and replace in
strings
vbox_tmpl.c: Better XML description for snapshots
vbox_tmpl.c: Patch for redefining snapshots
vbox_tmpl.c: Add methods for undefining snapshots
src/conf/domain_conf.c | 20 +-
src/libvirt_private.syms | 2 +
src/util/virstring.c | 129 ++++
src/util/virstring.h | 6 +
src/util/viruuid.c | 79 ++
src/util/viruuid.h | 1 +
src/vbox/vbox_tmpl.c | 1821 +++++++++++++++++++++++++++++++++++++++++++---
7 files changed, 1938 insertions(+), 120 deletions(-)
--
1.7.10.4
11 years, 4 months
[libvirt] [test-API][PATCH V3] Modify repos/network/network_list.py and add network_list case to conf
by hongming zhang
Modify the old network_list.py. The new network_list.py covers all
flags of listAllNetworks and the following api. and add network_list to
basic_network.conf.
virNetwork:
name()
isActive()
isPersistent()
virConnect:
listAllNetworks()
V1-> V2
1.Change the flag in conf from digit to string
2.Remove the checking method using the result of virsh with flags
3.Add checking method via checking network autostart dir
4.Modify the basic_network.conf
V2 -> V3
1.Remove check_bridge_ip method
2.Remove network.bridgeName() call
3.Fix a typo in log
---
cases/basic_network.conf | 35 +++++-
repos/network/network_list.py | 260 ++++++++++++++++-------------------------
2 files changed, 130 insertions(+), 165 deletions(-)
diff --git a/cases/basic_network.conf b/cases/basic_network.conf
index 991ad99..91d7f21 100644
--- a/cases/basic_network.conf
+++ b/cases/basic_network.conf
@@ -14,10 +14,18 @@ network:define
netmode
nat
+network:network_list
+ flags
+ inactive
+
network:start
networkname
$defaultnetname
+network:network_list
+ flags
+ active
+
network:autostart
networkname
$defaultnetname
@@ -28,6 +36,10 @@ network:destroy
networkname
$defaultnetname
+network:network_list
+ flags
+ default
+
network:undefine
networkname
$defaultnetname
@@ -48,6 +60,10 @@ network:create
netmode
nat
+network:network_list
+ flags
+ transient
+
network:destroy
networkname
$defaultnetname
@@ -68,6 +84,10 @@ network:define
netmode
route
+network:network_list
+ flags
+ persistent
+
network:start
networkname
$defaultnetname
@@ -106,7 +126,6 @@ network:destroy
networkname
$defaultnetname
-
network:define
networkname
$defaultnetname
@@ -127,12 +146,20 @@ network:start
networkname
$defaultnetname
+network:network_list
+ flags
+ noautostart
+
network:autostart
networkname
$defaultnetname
autostart
enable
+network:network_list
+ flags
+ autostart
+
network:destroy
networkname
$defaultnetname
@@ -141,7 +168,6 @@ network:undefine
networkname
$defaultnetname
-
network:create
networkname
$defaultnetname
@@ -162,8 +188,3 @@ network:destroy
networkname
$defaultnetname
-
-
-
-
-
diff --git a/repos/network/network_list.py b/repos/network/network_list.py
index 7c34f69..b94b505 100644
--- a/repos/network/network_list.py
+++ b/repos/network/network_list.py
@@ -1,184 +1,128 @@
#!/usr/bin/env python
# To test "virsh net-list" command
-import os
-import sys
-import re
-import commands
-
import libvirt
from libvirt import libvirtError
from src import sharedmod
from utils import utils
-required_params = ('netlistopt',)
+required_params = ('flags',)
optional_params = {}
-VIRSH_QUIET_NETLIST = "virsh --quiet net-list %s|awk '{print $1}'"
-VIRSH_NETLIST = "virsh net-list %s"
-GET_BRIDGE_IP = "/sbin/ifconfig %s | grep 'inet addr:' | cut -d: -f2 | awk '{print $1}'"
-CONFIG_DIR = "/etc/libvirt/qemu/networks/"
+LS_NETWORK_DIR = "ls /etc/libvirt/qemu/networks/"
+LS_AUTOSTART_NET = "ls /etc/libvirt/qemu/networks/autostart/"
-def get_option_list(params):
- """return options we need to test
+def check_persistent_netxml(networkname):
"""
- logger = params['logger']
- option_list=[]
-
- value = params['netlistopt']
-
- if value == 'all':
- option_list = [' ', '--all', '--inactive']
- elif value == '--all' or value == '--inactive':
- option_list.append(value)
- else:
- logger.error("value %s is not supported" % value)
- return 1, option_list
-
- return 0, option_list
-
-def get_output(logger, command, flag):
- """execute shell command
+ Check if the network is persistent via checking network xml dir
+ if the network is persistent, return True, or return False
"""
- status, ret = commands.getstatusoutput(command)
- if not flag and status:
- logger.error("executing "+ "\"" + command + "\"" + " failed")
- logger.error(ret)
- return status, ret
-
-def check_all_option(conn, logger):
- """check the output of virsh net-list with --all option
- """
- all_network = []
- entries = os.listdir(CONFIG_DIR)
- logger.debug("%s in %s" % (entries, CONFIG_DIR))
- status, network_names = get_output(logger, VIRSH_QUIET_NETLIST % '--all', 0)
- if not status:
- all_network = network_names.split('\n')
- logger.info("all network is %s" % all_network)
- else:
- return 1
-
- if all_network == ['']:
- return 0
- for entry in entries:
- if not entry.endswith('.xml'):
- continue
+ (status, output) = utils.exec_cmd(LS_NETWORK_DIR, shell=True)
+ network_list_dir = []
+ if status:
+ logger.error("Executing " + LS_NETWORK_DIR + " failed")
+ logger.error(output)
+ return False
+ else:
+ for i in range(len(output)):
+ network_list_dir.append(output[i][:-4])
+ del network_list_dir[0]
+ logger.info("Get persistent network name list under dir: %s" \
+ % network_list_dir)
+ if networkname in network_list_dir:
+ return True
else:
- network = entry[:-4]
- if network not in all_network:
- logger.error("network %s not in the output of virsh net-list" % network)
- return 1
- return 0
+ return False
-def check_inactive_option(conn, logger):
- """check the output of virsh net-list with --inactive option
+def check_autostart_netxml(networkname):
"""
- inactive_network = []
- status, network_names = get_output(logger, VIRSH_QUIET_NETLIST % '--inactive', 0)
- if not status:
- inactive_network = network_names.split('\n')
- logger.info("inactive network: %s" % inactive_network)
- else:
- return 1
-
- if inactive_network == ['']:
- return 0
-
- for network in inactive_network:
- try:
- netobj = conn.networkLookupByName(network)
- bridgename = netobj.bridgeName()
- status, ip = get_output(logger, GET_BRIDGE_IP % bridgename, 1)
-
- if not status:
- logger.info("network %s is inactive as we expected" % network)
- else:
- logger.error("network %s is not inactive, wrong" % network)
- return 1
- except libvirtError, e:
- logger.error("API error message: %s, error code is %s" \
- % (e.message, e.get_error_code()))
- return 1
-
- return 0
-
-def check_default_option(conn, logger):
- """check the output of virsh net-list
+ Check if the network is autostart via checking network autostart dir
+ if the network is autostart , return True, or return False.
"""
- active_network = []
- status, network_names = get_output(logger, VIRSH_QUIET_NETLIST % '', 0)
- if not status:
- active_network = network_names.split('\n')
- logger.info("running network: %s" % active_network)
- else:
- return 1
- if active_network == ['']:
- return 0
-
- for network in active_network:
- try:
- netobj = conn.networkLookupByName(network)
- bridgename = netobj.bridgeName()
- status, ip = get_output(logger, GET_BRIDGE_IP % bridgename, 0)
- if not status and utils.do_ping(ip, 0):
- logger.info("network %s is active as we expected" % network)
- logger.debug("%s has ip: %s" % (bridgename, ip))
- else:
- logger.error("network %s has no ip or fails to ping" % network)
- return 1
- except libvirtError, e:
- logger.error("API error message: %s, error code is %s" \
- % (e.message, e.get_error_code()))
- return 1
-
- return 0
-
-def execute_virsh_netlist(option, logger):
- """execute virsh net-list command with appropriate option given
- """
- status, ret = get_output(logger, VIRSH_NETLIST % option, 0)
- if not status:
- logger.info(ret)
+ (status, output) = utils.exec_cmd(LS_AUTOSTART_NET, shell=True)
+ autostart_list_dir = []
+ if status:
+ logger.error("Executing " + LS_AUTOSTART_NET + " failed")
+ logger.error(output)
+ return False
+ else:
+ for i in range(len(output)):
+ autostart_list_dir.append(output[i][:-4])
+ logger.info("Get autostart network name list under dir: %s" \
+ % autostart_list_dir)
+ if networkname in autostart_list_dir:
+ return True
+ else:
+ return False
def network_list(params):
- """test net-list command to virsh with default, --all, --inactive
- """
- logger = params['logger']
- ret, option_list = get_option_list(params)
-
- if ret:
- return 1
+ """ List network with flag """
+ global logger
+ logger = params['logger']
conn = sharedmod.libvirtobj['conn']
-
- for option in option_list:
- if option == ' ':
- logger.info("check the output of virsh net-list")
- if not check_default_option(conn, logger):
- logger.info("virsh net-list checking succeeded")
- execute_virsh_netlist(option, logger)
- else:
- logger.error("virsh net-list checking failed")
- return 1
- elif option == '--inactive':
- logger.info("check the output of virsh net-list --inactive")
- if not check_inactive_option(conn, logger):
- logger.info("virsh net-list --inactive checking succeeded")
- execute_virsh_netlist(option, logger)
- else:
- logger.error("virsh net-list --inactive checking failed")
- return 1
- elif option == '--all':
- logger.info("check the output of virsh net-list --all")
- if not check_all_option(conn, logger):
- logger.info("virsh net-list --all checking succeeded")
- execute_virsh_netlist(option, logger)
- else:
- logger.error("virsh net-list --all checking failed")
- return 1
+ flags = params['flags']
+ logger.info("The given flags is %s " % flags)
+ flag = -1
+ if flags == "default":
+ flag = 0
+ elif flags == "inactive":
+ flag = 1
+ elif flags == "active":
+ flag = 2
+ elif flags == "persistent":
+ flag = 4
+ elif flags == "transient":
+ flag = 8
+ elif flags == "autostart":
+ flag = 16
+ elif flags == "noautostart":
+ flag = 32
+ try:
+ network_list_api = conn.listAllNetworks(flag)
+ network_namelist_api = []
+ logger.debug("Traverse the network object list %s" % \
+ network_list_api)
+ for network in network_list_api:
+ networkname = network.name()
+ logger.info("Network name: %s " % networkname)
+ # Check if the network is active
+ if cmp(flags,"active") == 0:
+ if network.isActive():
+ logger.info("The %s network is active" % networkname)
+ else:
+ logger.error("Failed ,the %s network isn't active" % \
+ networkname)
+ return 1
+
+ # Check if the network is persistent
+ if cmp(flags,"persistent") == 0:
+ if network.isPersistent() and \
+ check_persistent_netxml(networkname):
+ logger.info("The %s network is persistent" % networkname)
+ else:
+ logger.error("Failed ,the %s network isn't persistent" % \
+ networkname)
+ return 1
+
+ # Check if the network is auto start
+ if cmp(flags,"autostart") == 0:
+ if check_autostart_netxml(networkname):
+ logger.info("The %s network is autostart" % networkname)
+ else:
+ logger.error("Failed ,the %s network isn't autostart" % \
+ networkname)
+ return 1
+
+ network_namelist_api.append(networkname)
+ logger.info("The network list %s" % network_namelist_api)
+
+ except libvirtError, e:
+ logger.error("API error message: %s" % e.message)
+ return 1
return 0
+
--
1.7.1
11 years, 4 months
[libvirt] [test-API][PATCH V2] Modify repos/network/network_list.py and add network_list case to conf
by hongming zhang
Modify the old network_list.py. The new network_list.py covers all
flags of listAllNetworks and the following api. and add network_list to
basic_network.conf.
virNetwork:
name()
bridgeName()
isActive()
isPersistent()
virConnect:
listAllNetworks()
Changes from V2 to V1 as follows
1.Change the flag in conf from digit to string
2.Remove the checking method using the result of virsh with flags
3.Add checking method via checking network autostart dir
4.Modify the basic_network.conf
---
cases/basic_network.conf | 35 ++++-
repos/network/network_list.py | 277 ++++++++++++++++++-----------------------
2 files changed, 148 insertions(+), 164 deletions(-)
diff --git a/cases/basic_network.conf b/cases/basic_network.conf
index 991ad99..91d7f21 100644
--- a/cases/basic_network.conf
+++ b/cases/basic_network.conf
@@ -14,10 +14,18 @@ network:define
netmode
nat
+network:network_list
+ flags
+ inactive
+
network:start
networkname
$defaultnetname
+network:network_list
+ flags
+ active
+
network:autostart
networkname
$defaultnetname
@@ -28,6 +36,10 @@ network:destroy
networkname
$defaultnetname
+network:network_list
+ flags
+ default
+
network:undefine
networkname
$defaultnetname
@@ -48,6 +60,10 @@ network:create
netmode
nat
+network:network_list
+ flags
+ transient
+
network:destroy
networkname
$defaultnetname
@@ -68,6 +84,10 @@ network:define
netmode
route
+network:network_list
+ flags
+ persistent
+
network:start
networkname
$defaultnetname
@@ -106,7 +126,6 @@ network:destroy
networkname
$defaultnetname
-
network:define
networkname
$defaultnetname
@@ -127,12 +146,20 @@ network:start
networkname
$defaultnetname
+network:network_list
+ flags
+ noautostart
+
network:autostart
networkname
$defaultnetname
autostart
enable
+network:network_list
+ flags
+ autostart
+
network:destroy
networkname
$defaultnetname
@@ -141,7 +168,6 @@ network:undefine
networkname
$defaultnetname
-
network:create
networkname
$defaultnetname
@@ -162,8 +188,3 @@ network:destroy
networkname
$defaultnetname
-
-
-
-
-
diff --git a/repos/network/network_list.py b/repos/network/network_list.py
index 7c34f69..175d6fa 100644
--- a/repos/network/network_list.py
+++ b/repos/network/network_list.py
@@ -1,184 +1,147 @@
#!/usr/bin/env python
# To test "virsh net-list" command
-import os
-import sys
-import re
-import commands
-
import libvirt
from libvirt import libvirtError
from src import sharedmod
from utils import utils
-required_params = ('netlistopt',)
+required_params = ('flags',)
optional_params = {}
-VIRSH_QUIET_NETLIST = "virsh --quiet net-list %s|awk '{print $1}'"
-VIRSH_NETLIST = "virsh net-list %s"
-GET_BRIDGE_IP = "/sbin/ifconfig %s | grep 'inet addr:' | cut -d: -f2 | awk '{print $1}'"
-CONFIG_DIR = "/etc/libvirt/qemu/networks/"
-
-def get_option_list(params):
- """return options we need to test
- """
- logger = params['logger']
- option_list=[]
-
- value = params['netlistopt']
-
- if value == 'all':
- option_list = [' ', '--all', '--inactive']
- elif value == '--all' or value == '--inactive':
- option_list.append(value)
+VIRSH_NETWORK_LIST = "virsh net-list %s|sed -n '3,$'p|awk '{print $1}'"
+GET_BRIDGE_IP = "/sbin/ifconfig %s | grep 'inet addr:' | cut -d: -f2 | awk \
+ '{print $1}'"
+LS_NETWORK_DIR = "ls /etc/libvirt/qemu/networks/"
+LS_AUTOSTART_NET = "ls /etc/libvirt/qemu/networks/autostart/"
+
+def check_bridge_ip(bridgename):
+ """ Check if the bridge has ip """
+
+ (status, output) = utils.exec_cmd(GET_BRIDGE_IP % bridgename,\
+ shell=True)
+ if not status and utils.do_ping(output[0], 50):
+ logger.info("Bridge %s is active" % bridgename)
+ logger.info("%s has ip: %s" % (bridgename, output[0]))
+ return True
else:
- logger.error("value %s is not supported" % value)
- return 1, option_list
-
- return 0, option_list
+ logger.error("Bridge %s has no ip or fails to ping" % bridgename)
+ return False
-def get_output(logger, command, flag):
- """execute shell command
+def check_persistent_netxml(networkname):
"""
- status, ret = commands.getstatusoutput(command)
- if not flag and status:
- logger.error("executing "+ "\"" + command + "\"" + " failed")
- logger.error(ret)
- return status, ret
-
-def check_all_option(conn, logger):
- """check the output of virsh net-list with --all option
+ Check if the network is persistent via checking network xml dir
+ if the network is persistent, return True, or return False
"""
- all_network = []
- entries = os.listdir(CONFIG_DIR)
- logger.debug("%s in %s" % (entries, CONFIG_DIR))
- status, network_names = get_output(logger, VIRSH_QUIET_NETLIST % '--all', 0)
- if not status:
- all_network = network_names.split('\n')
- logger.info("all network is %s" % all_network)
- else:
- return 1
- if all_network == ['']:
- return 0
-
- for entry in entries:
- if not entry.endswith('.xml'):
- continue
+ (status, output) = utils.exec_cmd(LS_NETWORK_DIR, shell=True)
+ network_list_dir = []
+ if status:
+ logger.error("Executing " + LS_NETWORK_DIR + " failed")
+ logger.error(output)
+ return False
+ else:
+ for i in range(len(output)):
+ network_list_dir.append(output[i][:-4])
+ del network_list_dir[0]
+ logger.info("Get persistent network name list under dir: %s" \
+ % network_list_dir)
+ if networkname in network_list_dir:
+ return True
else:
- network = entry[:-4]
- if network not in all_network:
- logger.error("network %s not in the output of virsh net-list" % network)
- return 1
- return 0
+ return False
-def check_inactive_option(conn, logger):
- """check the output of virsh net-list with --inactive option
+def check_autostart_netxml(networkname):
"""
- inactive_network = []
- status, network_names = get_output(logger, VIRSH_QUIET_NETLIST % '--inactive', 0)
- if not status:
- inactive_network = network_names.split('\n')
- logger.info("inactive network: %s" % inactive_network)
- else:
- return 1
-
- if inactive_network == ['']:
- return 0
-
- for network in inactive_network:
- try:
- netobj = conn.networkLookupByName(network)
- bridgename = netobj.bridgeName()
- status, ip = get_output(logger, GET_BRIDGE_IP % bridgename, 1)
-
- if not status:
- logger.info("network %s is inactive as we expected" % network)
- else:
- logger.error("network %s is not inactive, wrong" % network)
- return 1
- except libvirtError, e:
- logger.error("API error message: %s, error code is %s" \
- % (e.message, e.get_error_code()))
- return 1
-
- return 0
-
-def check_default_option(conn, logger):
- """check the output of virsh net-list
+ Check if the network is autostart via checking network autostart dir
+ if the network is autostart , return True, or return False.
"""
- active_network = []
- status, network_names = get_output(logger, VIRSH_QUIET_NETLIST % '', 0)
- if not status:
- active_network = network_names.split('\n')
- logger.info("running network: %s" % active_network)
- else:
- return 1
- if active_network == ['']:
- return 0
-
- for network in active_network:
- try:
- netobj = conn.networkLookupByName(network)
- bridgename = netobj.bridgeName()
- status, ip = get_output(logger, GET_BRIDGE_IP % bridgename, 0)
- if not status and utils.do_ping(ip, 0):
- logger.info("network %s is active as we expected" % network)
- logger.debug("%s has ip: %s" % (bridgename, ip))
- else:
- logger.error("network %s has no ip or fails to ping" % network)
- return 1
- except libvirtError, e:
- logger.error("API error message: %s, error code is %s" \
- % (e.message, e.get_error_code()))
- return 1
-
- return 0
-
-def execute_virsh_netlist(option, logger):
- """execute virsh net-list command with appropriate option given
- """
- status, ret = get_output(logger, VIRSH_NETLIST % option, 0)
- if not status:
- logger.info(ret)
+ (status, output) = utils.exec_cmd(LS_AUTOSTART_NET, shell=True)
+ autostart_list_dir = []
+ if status:
+ logger.error("Executing " + LS_AUTOSTART_NET + " failed")
+ logger.error(output)
+ return False
+ else:
+ for i in range(len(output)):
+ autostart_list_dir.append(output[i][:-4])
+ logger.info("Get persistent network name list under dir: %s" \
+ % autostart_list_dir)
+ if networkname in autostart_list_dir:
+ return True
+ else:
+ return False
def network_list(params):
- """test net-list command to virsh with default, --all, --inactive
- """
- logger = params['logger']
- ret, option_list = get_option_list(params)
-
- if ret:
- return 1
+ """ List network with flag """
+ global logger
+ logger = params['logger']
conn = sharedmod.libvirtobj['conn']
-
- for option in option_list:
- if option == ' ':
- logger.info("check the output of virsh net-list")
- if not check_default_option(conn, logger):
- logger.info("virsh net-list checking succeeded")
- execute_virsh_netlist(option, logger)
- else:
- logger.error("virsh net-list checking failed")
- return 1
- elif option == '--inactive':
- logger.info("check the output of virsh net-list --inactive")
- if not check_inactive_option(conn, logger):
- logger.info("virsh net-list --inactive checking succeeded")
- execute_virsh_netlist(option, logger)
- else:
- logger.error("virsh net-list --inactive checking failed")
- return 1
- elif option == '--all':
- logger.info("check the output of virsh net-list --all")
- if not check_all_option(conn, logger):
- logger.info("virsh net-list --all checking succeeded")
- execute_virsh_netlist(option, logger)
- else:
- logger.error("virsh net-list --all checking failed")
- return 1
+ flags = params['flags']
+ logger.info("The given flags are %s " % flags)
+ flag = -1
+ if flags == "default":
+ flag = 0
+ elif flags == "inactive":
+ flag = 1
+ elif flags == "active":
+ flag = 2
+ elif flags == "persistent":
+ flag = 4
+ elif flags == "transient":
+ flag = 8
+ elif flags == "autostart":
+ flag = 16
+ elif flags == "noautostart":
+ flag = 32
+ try:
+ network_list_api = conn.listAllNetworks(flag)
+ network_namelist_api = []
+ logger.debug("Traverse the network object list %s" % \
+ network_list_api)
+ for network in network_list_api:
+ networkname = network.name()
+ bridgename = network.bridgeName()
+ logger.info("Network name: %s " % networkname)
+ logger.info("Network %s 's bridge name: %s " % (networkname ,\
+ bridgename))
+ # Check if the network is active
+ if cmp(flags,"active") == 0:
+ if network.isActive() and check_bridge_ip(bridgename):
+ logger.info("The %s network is active" % networkname)
+ else:
+ logger.error("Failed ,the %s network isn't active" % \
+ networkname)
+ return 1
+
+ # Check if the network is persistent
+ if cmp(flags,"persistent") == 0:
+ if network.isPersistent() and \
+ check_persistent_netxml(networkname):
+ logger.info("The %s network is persistent" % networkname)
+ else:
+ logger.error("Failed ,the %s network isn't persistent" % \
+ networkname)
+ return 1
+
+ # Check if the network is auto start
+ if cmp(flags,"autostart") == 0:
+ if check_autostart_netxml(networkname):
+ logger.info("The %s network is autostart" % networkname)
+ else:
+ logger.error("Failed ,the %s network isn't autostart" % \
+ networkname)
+ return 1
+
+ network_namelist_api.append(networkname)
+ logger.info("The network list %s" % network_namelist_api)
+
+ except libvirtError, e:
+ logger.error("API error message: %s" % e.message)
+ return 1
return 0
+
--
1.7.1
11 years, 4 months
[libvirt] CfP 8th Workshop on Virtualization in High-Performance Cloud Computing (VHPC '13)
by VHPC 12
we apologize if you receive multiple copies of this CfP
=================================================================
CALL FOR PAPERS
8th Workshop on Virtualization in High-Performance Cloud Computing (VHPC '13)
as part of SC 13, Denver, Colorado | sponsored by ACM sighpc
=================================================================
Date: November 22, 2013
Workshop URL: http://vhpc.org
Paper Submission Deadline: September 23, 2013
CALL FOR PAPERS
Virtualization has become a common abstraction layer in modern data
centers, enabling resource owners to manage complex infrastructures
independently of their applications. Conjointly, virtualization is becoming
a driving technology for a manifold of industry grade IT services. The
cloud concept includes the notion of a separation between resource
owners and users, adding services such as hosted application
frameworks and queueing. Utilizing the same infrastructure, clouds
carry significant potential for use in cpu-intensive or data-intensive
computing. The ability of clouds to provide for requests and releases
of vast computing resources dynamically and close to the marginal
cost of providing the services is unprecedented in the history of
scientific and commercial computing.
This workshop aims to bring together industrial providers with the
application community in order to foster discussion, collaboration
and mutual exchange of knowledge and experience.
The workshop will be one day in length, composed of 20 min paper
presentations, each followed by 10 min discussion sections. Lightning
talks are limited to 5 minutes. Presentations may be accompanied by
interactive demonstrations.
TOPICS
Topics of interest include, but are not limited to:
- Management, deployment and monitoring of VM-based environments
- VM-cloud performance monitoring
- VM cloud topology management and optimization
- Operating systems virtualization supportpptimization
- VM-based cloud performance modelling
- Network virtualization for VM-environments
- Data virtualization
- Cloudbursting
- Evolved grid architectures including such based on network virtualization
- Workload characterization for VM-based environments
- Optimized communication libraries/protocols in the cloud
- System and process/bytecode VM convergence
- Cloud frameworks and APIs
- GPU Virtualization architectures and APIs
- Checkpointing/migration of large compute jobs
- Instrumentation interfaces and languages
- VMM performance (auto-)tuning on various load types
- Cloud reliability, fault-tolerance, and security
- Heterogeneous virtualized environments
- Paravirtualized I/O
- Services in cloud HPC
- Research and education use cases
- Virtualization in cloud, cluster and grid environments
- Cross-layer VM optimizations
- Cloud HPC use cases including optimizations
- Energy-aware virtualization
- Performance and cost modelling
- QoS and and service levels
- Languages for describing highly-distributed compute jobs
- VM cloud and cluster distribution algorithms, load balancing
- Instrumentation interfaces and languages
- Hypervisor extensions and tools for cluster and grid computing
- Virtual machine monitor platforms
- Cluster provisioning in the cloud
Important Dates:
Rolling Paper registration
September 23, 2013 - Full paper submission
October 21, 2013 - Acceptance notification
November 8, 2013 - Camera-ready version due
Lightning Talks:
August 9, 2013 - Deadline for lightning talk abstracts
September 2, 2013 - Lightning talk notification
November 22, 2013 - Workshop Date
TPC
CHAIR
Michael Alexander (chair), TU Wien, Austria
Gianluigi Zanetti (co-chair), CRS4, Italy
Anastassios Nanos (co-chair), NTUA, Greece
PROGRAM COMMITTEE
Costas Bekas, IBM, Switzerland
Jakob Blomer, CERN
Giovanni Busonera, CRS4, Italy
Roberto Canonico, University of Napoli Federico II, Italy
Simon Crosby, Bromium, USA
Tommaso Cucinotta, Alcatel-Lucent Bell Labs, Ireland
Casimer DeCusatis, IBM, USA
William Gardner, University of Guelph, USA
Marcus Hardt, Forschungszentrum Karlsruhe, Germany
Sverre Jarp, CERN, Switzerland
Xuxian Jiang, NC State, USA
Krishna Kant, George Mason University, USA
Romeo Kinzler, IBM, Switzerland
Nectarios Koziris, National Technical University of Athens, Greece
Simone Leo, CRS4, Italy
Jean-Marc Menaud, Ecole des Mines de Nantes, France
Dimitrios Nikolopoulos, Queen's University of Belfast, UK
Josh Simons, VMWare, USA
Borja Sotomayor, University of Chicago, USA
Yoshio Turner, HP Labs, USA
Kurt Tutschku, Blekinge Institute of Technology, Sweden
Chao-Tung Yang, Tunghai University, Taiwan
PAPER SUBMISSION-PUBLICATION
Papers submitted to the workshop will be reviewed by at least two
members of the program committee and external reviewers. Submissions
should include abstract, key words, the e-mail address of the
corresponding author, and must not exceed 8 pages, including tables
and figures at a main font size no smaller than 11 point. Submission
of a paper should be regarded as a commitment that, should the paper
be accepted, at least one of the authors will register and attend the
conference to present the work.
Accepted papers will be published in the ACM International Conference
Proceedings Series. The format must be according to the ACM SIG style.
Initial submissions are in PDF; authors of accepted papers will be
requested to provide source files.
Format Guidelines:
http://www.acm.org/sigs/publications/sigguide-v2.2sp
Style template:
http://www.acm.org/sigs/publications/proceedings-templates
Abstract Submission Link:
http://edas.info/newPaper.php?c=14791
LIGHTNING TALKS
Lightning Talks are non-paper track synoptical in nature that are strictly
limited to 5 minutes. They can be used to gain early feedback on ongoing
research, for demonstrations, to present research results, early research
ideas, perspectives and positions of interest to the community.
GENERAL INFORMATION
The workshop will be held as part of SC’13, Denver, Colorado.
SC 2013: http://sc13.supercomputing.org/
11 years, 4 months
[libvirt] CVE-2013-4153, CVE-2013-4154
by Eric Blake
Two CVEs have been assigned for recent patches both related to 'virsh
vcpucount'. I have backported these patches to v1.1.0-maint (the only
release impacted by either bug).
CVE-2013-4153 was introduced by commit v1.0.6-48-gc6afcb0, and could
allow a read-only client to cause a double free in libvirtd on a domain
that has an active guest agent.
CVE-2013-4154 was introduced by commit v1.0.6-47-g29c1e91, and could
allow a read-only client to cause libvirtd to crash on a domain without
a guest agent.
commit dfc692350a04a70b4ca65667c30869b3bfdaf034
Author: Peter Krempa <pkrempa(a)redhat.com>
Date: Tue Jul 16 15:39:06 2013 +0200
qemu: Fix double free of returned JSON array in qemuAgentGetVCPUs()
A part of the returned monitor response was freed twice and caused
crashes of the daemon when using guest agent cpu count retrieval.
# virsh vcpucount dom --guest
Introduced in v1.0.6-48-gc6afcb0
commit 96518d4316b711c72205117f8d5c967d5127bbb6
Author: Alex Jia <ajia(a)redhat.com>
Date: Tue Jul 16 17:30:20 2013 +0800
qemu: Prevent crash of libvirtd without guest agent configuration
If users haven't configured guest agent then qemuAgentCommand() will
dereference a NULL 'mon' pointer, which causes crash of libvirtd when
using agent based cpu (un)plug.
With the patch, when the qemu-ga service isn't running in the guest,
a expected error "error: Guest agent is not responding: Guest agent
not available for now" will be raised, and the error "error: argument
unsupported: QEMU guest agent is not configured" is raised when the
guest hasn't configured guest agent.
GDB backtrace:
(gdb) bt
#0 virNetServerFatalSignal (sig=11, siginfo=<value optimized out>,
context=<value optimized out>) at rpc/virnetserver.c:326
#1 <signal handler called>
#2 qemuAgentCommand (mon=0x0, cmd=0x7f39300017b0,
reply=0x7f394b090910, seconds=-2) at qemu/qemu_agent.c:975
#3 0x00007f39429507f6 in qemuAgentGetVCPUs (mon=0x0,
info=0x7f394b0909b8) at qemu/qemu_agent.c:1475
#4 0x00007f39429d9857 in qemuDomainGetVcpusFlags (dom=<value
optimized out>, flags=9) at qemu/qemu_driver.c:4849
#5 0x00007f3957dffd8d in virDomainGetVcpusFlags
(domain=0x7f39300009c0, flags=8) at libvirt.c:9843
How to reproduce?
# To start a guest without guest agent configuration
# then run the following cmdline
# virsh vcpucount foobar --guest
error: End of file while reading data: Input/output error
error: One or more references were leaked after disconnect from the
hypervisor
error: Failed to reconnect to the hypervisor
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=984821
Signed-off-by: Alex Jia <ajia(a)redhat.com>
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
11 years, 4 months
[libvirt] Using TLS with chained certs?
by Jon Stanley
I've got a setup where a given cert (for a machine) is issued randomly
by one of three CA's, all of which are signed by a root CA.
When using this with libvirt, it will refuse to start if the cert is
signed by a CA other than the top one in the /etc/pki/CA/cacert.pem
file, and if the client cert is issued by a different CA than the
server cert (quite the possibility), then obviously that connection is
rejected.
It looks like in src/rpc/virnettlscontext.c we're using
gnutls_x509_crt_import() instead of gnutls_x509_crt_list_import()
which would account for this behavior.
11 years, 4 months
[libvirt] [PATCH 0/3] Convert cgroups code to report errors
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Since the viralloc.h methods were changed to report errors, the
cgroups code's approach of returning errno values is even less
sensible than it was before. This series changes the cgroups code
to report errors throughout.
As a general point, I think we should have a goal of eliminating
the use of 'return -errno' in all libvirt code, since it will let
us provide more accurate error messages.
Daniel P. Berrange (3):
Report full errors from virCgroupNew*
Convert the virCgroupKill* APIs to report errors
Convert remainder of cgroups code to report errors
src/libvirt_private.syms | 1 +
src/lxc/lxc_cgroup.c | 83 ++--
src/lxc/lxc_container.c | 6 +-
src/lxc/lxc_fuse.c | 6 +-
src/lxc/lxc_process.c | 15 +-
src/qemu/qemu_cgroup.c | 87 ++--
src/qemu/qemu_driver.c | 76 +---
src/util/vircgroup.c | 1136 +++++++++++++++++++++++++---------------------
src/util/virerror.c | 46 ++
src/util/virerror.h | 4 +
tests/vircgrouptest.c | 44 +-
11 files changed, 784 insertions(+), 720 deletions(-)
--
1.8.1.4
11 years, 4 months
[libvirt] [PATCH] Add helpers for dealing with system errors
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Add virErrorSetErrnoFromLastError and virLastErrorIsSystemErrno
to simplify code which wants to handle system errors in a more
graceful fashion.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/libvirt_private.syms | 1 +
src/util/virerror.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
src/util/virerror.h | 4 ++++
3 files changed, 53 insertions(+)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 5d39d50..a2b61c7 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1318,6 +1318,7 @@ ebtablesRemoveForwardAllowIn;
# util/virerror.h
virDispatchError;
virErrorInitialize;
+virLastErrorIsSystemErrno;
virRaiseErrorFull;
virReportErrorHelper;
virReportOOMErrorFull;
diff --git a/src/util/virerror.c b/src/util/virerror.c
index 36d256b..e90ff07 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -1404,3 +1404,51 @@ void virSetErrorLogPriorityFunc(virErrorLogPriorityFunc func)
{
virErrorLogPriorityFilter = func;
}
+
+
+/**
+ * virErrorSetErrnoFromLastError:
+ *
+ * If the last error had a code of VIR_ERR_SYSTEM_ERROR
+ * then set errno to the value saved in the error object.
+ *
+ * If the last error had a code of VIR_ERR_NO_MEMORY
+ * then set errno to ENOMEM
+ *
+ * Otherwise set errno to EIO.
+ */
+void virErrorSetErrnoFromLastError(void)
+{
+ virErrorPtr err = virGetLastError();
+ if (err && err->code == VIR_ERR_SYSTEM_ERROR) {
+ errno = err->int1;
+ } else if (err && err->code == VIR_ERR_NO_MEMORY) {
+ errno = ENOMEM;
+ } else {
+ errno = EIO;
+ }
+}
+
+
+/**
+ * virLastErrorIsSystemErrno:
+ * @errnum: the errno value
+ *
+ * Check if the last error reported is a system
+ * error with the specific errno value.
+ *
+ * If @errnum is zero, any system error will pass.
+ *
+ * Returns true if the last errr was a system error with errno == @errnum
+ */
+bool virLastErrorIsSystemErrno(int errnum)
+{
+ virErrorPtr err = virGetLastError();
+ if (!err)
+ return false;
+ if (err->code != VIR_ERR_SYSTEM_ERROR)
+ return false;
+ if (errnum != 0 && err->int1 != errnum)
+ return false;
+ return true;
+}
diff --git a/src/util/virerror.h b/src/util/virerror.h
index 6ea456b..05e9950 100644
--- a/src/util/virerror.h
+++ b/src/util/virerror.h
@@ -175,4 +175,8 @@ const char *virStrerror(int theerrno, char *errBuf, size_t errBufLen);
typedef int (*virErrorLogPriorityFunc)(virErrorPtr, int);
void virSetErrorLogPriorityFunc(virErrorLogPriorityFunc func);
+void virErrorSetErrnoFromLastError(void);
+
+bool virLastErrorIsSystemErrno(int errnum);
+
#endif
--
1.8.1.4
11 years, 4 months
[libvirt] [PATCH] security: fix deadlock with prefork
by Eric Blake
Attempts to start a domain with both SELinux and DAC security
modules loaded will deadlock; latent problem introduced in commit
fdb3bde and exposed in commit 29fe5d7. Basically, when recursing
into the security manager for other driver's prefork, we have to
undo the asymmetric lock taken at the manager level.
Reported by Jiri Denemark, with diagnosis help from Dan Berrange.
* src/security/security_stack.c (virSecurityStackPreFork): Undo
extra lock grabbed during recursion.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/security/security_stack.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/security/security_stack.c b/src/security/security_stack.c
index ed69b9c..d7e690a 100644
--- a/src/security/security_stack.c
+++ b/src/security/security_stack.c
@@ -127,6 +127,11 @@ virSecurityStackPreFork(virSecurityManagerPtr mgr)
rc = -1;
break;
}
+ /* Undo the unbalanced locking left behind after recursion; if
+ * PostFork ever delegates to driver callbacks, we'd instead
+ * of to recurse to an internal method that does not regrab a
+ * lock. */
+ virSecurityManagerPostFork(item->securityManager);
}
return rc;
--
1.8.3.1
11 years, 4 months