On 02/04/2015 06:03 PM, jiahu wrote:
1. Using .get method to get a optional dict value
2. Adjust variables sequence during call mac_to_ip
---
repos/domain/destroy.py | 4 ++--
repos/domain/install_linux_cdrom.py | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/repos/domain/destroy.py b/repos/domain/destroy.py
index 154ffaf..36f70db 100644
--- a/repos/domain/destroy.py
+++ b/repos/domain/destroy.py
@@ -32,7 +32,7 @@ def destroy(params):
logger = params['logger']
params.pop('logger')
guestname = params['guestname']
- br = params['bridgename']
+ br = params.get('bridgename','virbr0')
flags = ""
if params.has_key('flags'):
flags = params['flags']
@@ -59,7 +59,7 @@ def destroy(params):
# Get domain ip
mac = utils.get_dom_mac_addr(guestname)
logger.info("get ip by mac address")
- ip = utils.mac_to_ip(mac,br,180)
+ ip = utils.mac_to_ip(mac,180,br)
logger.info("the ip address of guest is %s" % ip)
# Destroy domain
diff --git a/repos/domain/install_linux_cdrom.py b/repos/domain/install_linux_cdrom.py
index 9d3a7e9..412712b 100644
--- a/repos/domain/install_linux_cdrom.py
+++ b/repos/domain/install_linux_cdrom.py
@@ -147,7 +147,7 @@ def install_linux_cdrom(params):
guestname = params.get('guestname')
guestos = params.get('guestos')
guestarch = params.get('guestarch')
- br = params['bridgename']
+ br = params.get('bridgename','virbr0')
xmlstr = params['xml']
logger.info("the name of guest is %s" % guestname)
@@ -304,7 +304,7 @@ def install_linux_cdrom(params):
time.sleep(10)
timeout -= 10
- ip = utils.mac_to_ip(mac,br,180)
+ ip = utils.mac_to_ip(mac,180,br)
if not ip:
logger.info(str(timeout) + "s left")
ACK and Pushed.
Thanks
Hongming
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list