def _connect(self, label=None):
"""Connects to libvirt subsystem.
@raise CuckooMachineError: when unable to connect to libvirt.
"""
# Check if a connection string is available.
dsn = self.options.get(label).get("dsn", None)
if not dsn:
raise CuckooMachineError("You must provide a proper "
"connection string for "+label)
try:
return libvirt.open(dsn)
except libvirt.libvirtError:
raise CuckooMachineError("Cannot connect to libvirt")
评论列表
文章目录