def __start_virtual_machine_helper(self, experiment_id, template_unit): """ Update status of azure virtual machine and virtual environment Update private ip of azure virtual machine :param experiment_id: :param template_unit: :return: """ cloud_service_name = template_unit.get_cloud_service_name() deployment_slot = template_unit.get_deployment_slot() deployment_name = self.service.get_deployment_name(cloud_service_name, deployment_slot) virtual_machine_name = self.VIRTUAL_MACHINE_NAME_BASE % (template_unit.get_virtual_machine_name(), experiment_id) virtual_machine = update_azure_virtual_machine_status(cloud_service_name, deployment_name, virtual_machine_name, AVMStatus.READY_ROLE) public_ip = self.service.get_virtual_machine_public_ip(cloud_service_name, deployment_name, virtual_machine_name) update_azure_virtual_machine_public_ip(virtual_machine, public_ip) private_ip = self.service.get_virtual_machine_private_ip(cloud_service_name, deployment_name, virtual_machine_name) update_azure_virtual_machine_private_ip(virtual_machine, private_ip) update_virtual_environment_status(virtual_machine, VEStatus.RUNNING) remote_port_name = template_unit.get_remote_port_name() remote_port = self.service.get_virtual_machine_public_endpoint(cloud_service_name, deployment_name, virtual_machine_name, remote_port_name) remote_paras = template_unit.get_remote_paras(virtual_machine_name, public_ip, remote_port) update_virtual_environment_remote_paras(virtual_machine, json.dumps(remote_paras))
def __start_virtual_machine_helper(self, experiment_id, template_unit): """ Update status of azure virtual machine and virtual environment Update private ip of azure virtual machine :param experiment_id: :param template_unit: :return: """ cloud_service_name = template_unit.get_cloud_service_name() deployment_slot = template_unit.get_deployment_slot() deployment_name = self.service.get_deployment_name( cloud_service_name, deployment_slot) virtual_machine_name = self.VIRTUAL_MACHINE_NAME_BASE % ( template_unit.get_virtual_machine_name(), experiment_id) virtual_machine = update_azure_virtual_machine_status( cloud_service_name, deployment_name, virtual_machine_name, AVMStatus.READY_ROLE) public_ip = self.service.get_virtual_machine_public_ip( cloud_service_name, deployment_name, virtual_machine_name) update_azure_virtual_machine_public_ip(virtual_machine, public_ip) private_ip = self.service.get_virtual_machine_private_ip( cloud_service_name, deployment_name, virtual_machine_name) update_azure_virtual_machine_private_ip(virtual_machine, private_ip) update_virtual_environment_status(virtual_machine, VEStatus.RUNNING) remote_port_name = template_unit.get_remote_port_name() remote_port = self.service.get_virtual_machine_public_endpoint( cloud_service_name, deployment_name, virtual_machine_name, remote_port_name) remote_paras = template_unit.get_remote_paras(virtual_machine_name, public_ip, remote_port) update_virtual_environment_remote_paras(virtual_machine, json.dumps(remote_paras))
def __stop_virtual_machine_helper(self, experiment_id, template_unit, need_status): """ Update status of azure virtual machine and virtual environment :param experiment_id: :param template_unit: :param need_status: :return: """ cloud_service_name = template_unit.get_cloud_service_name() deployment_slot = template_unit.get_deployment_slot() deployment_name = self.service.get_deployment_name(cloud_service_name, deployment_slot) virtual_machine_name = self.VIRTUAL_MACHINE_NAME_BASE % (template_unit.get_virtual_machine_name(), experiment_id) virtual_machine = update_azure_virtual_machine_status(cloud_service_name, deployment_name, virtual_machine_name, need_status) update_virtual_environment_status(virtual_machine, VEStatus.STOPPED)
def __stop_virtual_machine_helper(self, experiment_id, template_unit, need_status): """ Update status of azure virtual machine and virtual environment :param experiment_id: :param template_unit: :param need_status: :return: """ cloud_service_name = template_unit.get_cloud_service_name() deployment_slot = template_unit.get_deployment_slot() deployment_name = self.service.get_deployment_name( cloud_service_name, deployment_slot) virtual_machine_name = self.VIRTUAL_MACHINE_NAME_BASE % ( template_unit.get_virtual_machine_name(), experiment_id) virtual_machine = update_azure_virtual_machine_status( cloud_service_name, deployment_name, virtual_machine_name, need_status) update_virtual_environment_status(virtual_machine, VEStatus.STOPPED)