Download System templates on sec storage
(server, services)
| 542 | return template |
| 543 | |
| 544 | def download_systemplates_sec_storage(server, services): |
| 545 | """Download System templates on sec storage""" |
| 546 | |
| 547 | try: |
| 548 | # Login to management server |
| 549 | ssh = SshClient( |
| 550 | server["ipaddress"], |
| 551 | server["port"], |
| 552 | server["username"], |
| 553 | server["password"] |
| 554 | ) |
| 555 | except Exception: |
| 556 | raise Exception("SSH access failed for server with IP address: %s" % |
| 557 | server["ipaddress"]) |
| 558 | # Mount Secondary Storage on Management Server |
| 559 | cmds = [ |
| 560 | "mkdir -p %s" % services["mnt_dir"], |
| 561 | "mount -t nfs %s:/%s %s" % ( |
| 562 | services["sec_storage"], |
| 563 | services["path"], |
| 564 | services["mnt_dir"] |
| 565 | ), |
| 566 | "%s -m %s -u %s -h %s -F" % ( |
| 567 | services["command"], |
| 568 | services["mnt_dir"], |
| 569 | services["download_url"], |
| 570 | services["hypervisor"] |
| 571 | ) |
| 572 | ] |
| 573 | for c in cmds: |
| 574 | result = ssh.execute(c) |
| 575 | |
| 576 | res = str(result) |
| 577 | |
| 578 | # Unmount the Secondary storage |
| 579 | ssh.execute("umount %s" % (services["mnt_dir"])) |
| 580 | |
| 581 | if res.count("Successfully installed system VM template") == 1: |
| 582 | return |
| 583 | else: |
| 584 | raise Exception("Failed to download System Templates on Sec Storage") |
| 585 | return |
| 586 | |
| 587 | |
| 588 | def wait_for_ssvms(apiclient, zoneid, podid, interval=60): |