[virt-tools-list] [virt-manager PATCH] virt-clone: remove socket path for unix channel

Cole Robinson crobinso at redhat.com
Mon Nov 2 19:13:54 UTC 2015


On 11/02/2015 10:56 AM, Cole Robinson wrote:
> On 11/02/2015 07:34 AM, Pavel Hrdina wrote:
>> 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 at redhat.com>
>> ---
>>  virtinst/cloner.py | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/virtinst/cloner.py b/virtinst/cloner.py
>> index 12716b6..468e559 100644
>> --- a/virtinst/cloner.py
>> +++ b/virtinst/cloner.py
>> @@ -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)
>>
> 
> ACK
> 

This added a pyline error:

************* Module virtinst.cloner
W:421,16: Access to a protected member _source_path of a client class
(protected-access)

I think just changing it to channel.source_path will work, but please add a
test case to verify it. You can probably just add a channel device to
testdriver.xml test-for-clone VM

Thanks,
Cole





More information about the virt-tools-list mailing list