
On 04/20/2012 08:46 AM, Osier Yang wrote:
--- repos/domain/update_devflag.py | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/repos/domain/update_devflag.py b/repos/domain/update_devflag.py index f1ecf32..e87b1e5 100644 --- a/repos/domain/update_devflag.py +++ b/repos/domain/update_devflag.py @@ -77,7 +77,7 @@ def create_image(params, util, img_name):
return True
-def check_device_in_domain(params, util, guestip): +def check_device_in_domain(params, util, domip): """Check updated device in guest""" logger = params['logger']
@@ -89,7 +89,7 @@ def check_device_in_domain(params, util, guestip): logger.error("it's not a cdrom or floppy device.") return False, None
- ret, output = utils.remote_exec_pexpect(guestip, params['username'], \ + ret, output = utils.remote_exec_pexpect(domip, params['username'], \ params['password'], cmd) logger.debug(output) if ret: @@ -98,7 +98,7 @@ def check_device_in_domain(params, util, guestip):
time.sleep(5)
- ret, output = utils.remote_exec_pexpect(guestip, params['username'], \ + ret, output = utils.remote_exec_pexpect(domip, params['username'], \ params['password'], "umount /media") logger.debug(output) if ret: @@ -107,7 +107,7 @@ def check_device_in_domain(params, util, guestip):
time.sleep(5)
- ret, output = utils.remote_exec_pexpect(guestip, params['username'], \ + ret, output = utils.remote_exec_pexpect(domip, params['username'], \ params['password'], "ls /media") logger.debug(output) if ret: @@ -117,7 +117,7 @@ def check_device_in_domain(params, util, guestip):
return True, output
-def check_updated_device(params, output, util, guestip, domobj, srcfile): +def check_updated_device(params, output, util, domip, domobj, srcfile): """Check if the device is updated""" logger = params['logger'] xmlobj = domobj.XMLDesc(0) @@ -129,7 +129,7 @@ def check_updated_device(params, output, util, guestip, domobj, srcfile): elif diskTag.parentNode.getAttribute('device') == 'floppy': upfile = diskTag.getAttribute("file")
- res = check_device_in_domain(params, util, guestip) + res = check_device_in_domain(params, util, domip) if res[0] and cmp(res[1], output): if upfile == srcfile: logger.debug("checking fail.") @@ -172,8 +172,8 @@ def update_devflag(params): flag = libvirt.VIR_DOMAIN_AFFECT_CONFIG
mac = utils.get_dom_mac_addr(guestname) - guestip = utils.mac_to_ip(mac, 180) - logger.debug("ip address: %s" % guestip) + domip = utils.mac_to_ip(mac, 180) + logger.debug("ip address: %s" % domip)
conn = sharedmod.libvirtobj['conn']
@@ -211,7 +211,7 @@ def update_devflag(params): return 1
time.sleep(60) - ret, output = check_device_in_domain(params, util, guestip) + ret, output = check_device_in_domain(params, util, domip) logger.debug(output) if not ret: return 1 @@ -249,7 +249,7 @@ def update_devflag(params): return 1
result = check_updated_device(params, output, util, \ - guestip, domobj, srcfile) + domip, domobj, srcfile) if result[0]: logger.error("fail to update '%s' device: %s\n" % (devtype, result[1])) return 1
This one I'd rather reconsider with the others, guest ip is better I think. Just my opinion though. Martin