[virt-tools-list] [PATCH] virt-manager:Valid address type change in network device
Lin Qing
qinglbj at linux.vnet.ibm.com
Tue May 29 09:59:14 UTC 2012
Hi Cole:
Cole, please help to review this patch too.
On 05/23/2012 04:05 PM, Qing Lin wrote:
> Function set_address(addr) will only change the value of
> VirtualDeviceAddress._type,doesn't map change in xml.So,
> it will cause change lost problem.Using assignment statements
> will not only change the value of VirtualDeviceAddress._type
> but also change the xml.
>
> Signed-off-by: Qing Lin<qinglbj at linux.vnet.ibm.com>
> Signed-off-by: Li Zhang<zhlcindy at linux.vnet.ibm.com>
> ---
> src/virtManager/domain.py | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/virtManager/domain.py b/src/virtManager/domain.py
> index b547f91..893c5df 100644
> --- a/src/virtManager/domain.py
> +++ b/src/virtManager/domain.py
> @@ -626,7 +626,7 @@ class vmmDomain(vmmLibvirtObject):
> def change(editdev):
> if editdev.model != newmodel:
> editdev.address.clear()
> - editdev.set_address(addr)
> + editdev.address.type = addr
In this place,the address instance is already existing.we change the
address type in order to reflect the xml file later.But by using
function set_address(add),It will lost map in orginal xml file.
Because the we should instance address as below:
self.address = VirtualDeviceAddress(conn,
parsexml=parsexml,
parsexmlnode=parsexmlnode,
caps=caps)
but founction set_address is written this way:
def set_address(self, addrstr):
self.address = VirtualDeviceAddress(self.conn, addrstr=addrstr)
We can see ,there is lack parsexm and parsexmlnode in parameters
,which cause the below assignment statements doesn't work.
bus = _xml_property(_get_bus, _set_bus, xpath="./address/@bus")
so if we call editdev.set_address(addr),the bus type will not change as
we expect.We should just use "editdev.address.type = addr " instead here.
> editdev.model = newmodel
> return self._redefine_device(change, devobj)
>
More information about the virt-tools-list
mailing list