virt-clone: remove socket path for unix channel

Libvirt automatically generates this path with a guest name used as
directory.  The new conception is to have all sockets for one guest in
it's own directory and in order to successfully clone a guest, we need
to remove this path to regenerate it with new guest name.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1270696

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2015-11-02 13:20:15 +01:00
parent 68f0b05720
commit 3a33f3414f

View File

@ -30,6 +30,7 @@ from .guest import Guest
from .deviceinterface import VirtualNetworkInterface
from .devicedisk import VirtualDisk
from .storage import StorageVolume
from .devicechar import VirtualChannelDevice
class Cloner(object):
@ -413,6 +414,12 @@ class Cloner(object):
xmldisk.driver_type = orig_disk.driver_type
xmldisk.path = clone_disk.path
# For guest agent channel, remove a path to generate a new one with
# new guest name
for channel in self._guest.get_devices("channel"):
if channel.type == VirtualChannelDevice.TYPE_UNIX:
channel._source_path = None
# Save altered clone xml
self._clone_xml = self._guest.get_xml_config()
logging.debug("Clone guest xml is\n%s", self._clone_xml)