MCPcopy Create free account
hub / github.com/apache/cloudstack / program_ssh_access

Method program_ssh_access

tools/marvin/marvin/lib/base.py:521–555  ·  view source on GitHub ↗

Program SSH access to the VM

(
            cls, apiclient, services, mode, networkids, virtual_machine, allow_egress=False, vpcid=None)

Source from the content-addressed store, hash-verified

519
520 @classmethod
521 def program_ssh_access(
522 cls, apiclient, services, mode, networkids, virtual_machine, allow_egress=False, vpcid=None):
523 """
524 Program SSH access to the VM
525 """
526 # program ssh access over NAT via PF
527 retries = 5
528 interval = 30
529 while retries > 0:
530 try:
531 if mode.lower() == 'advanced':
532 cls.access_ssh_over_nat(
533 apiclient,
534 services,
535 virtual_machine,
536 allow_egress=allow_egress,
537 networkid=networkids[0] if networkids else None,
538 vpcid=vpcid)
539 elif mode.lower() == 'basic':
540 if virtual_machine.publicip is not None:
541 # EIP/ELB (netscaler) enabled zone
542 vm_ssh_ip = virtual_machine.publicip
543 else:
544 # regular basic zone with security group
545 vm_ssh_ip = virtual_machine.nic[0].ipaddress
546 virtual_machine.ssh_ip = vm_ssh_ip
547 virtual_machine.public_ip = vm_ssh_ip
548 break
549 except Exception as e:
550 if retries >= 0:
551 retries = retries - 1
552 time.sleep(interval)
553 continue
554 raise Exception(
555 "The following exception appeared while programming ssh access - %s" % e)
556
557 @classmethod
558 def create(cls, apiclient, services, templateid=None, accountid=None,

Callers 2

createMethod · 0.80
createVMFromBackupMethod · 0.80

Implementers 2

VMEntityVOengine/schema/src/main/java/org/apache
VMInstanceVOengine/schema/src/main/java/com/cloud/

Calls 2

access_ssh_over_natMethod · 0.80
sleepMethod · 0.45

Tested by

no test coverage detected