Ejemplo n.º 1
0
 def print_global_volumes(self):
     """
     Print all the available volumes for each region and some informations
     """
     table_header = [
         "ID", "Volume Name", "Volume ID", "Creation", "Size (GB)",
         "Attached To", "Status", "Avail. Zone"
     ]
     table_body = self._list_global_volumes()
     SimpleTUI.print_table(table_header, table_body)
     if len(self.global_volumes) == 0:
         SimpleTUI.info("There are no volumes available")
     return len(self.global_volumes)
Ejemplo n.º 2
0
 def print_global_instances(self):
     """
     Print instance id, image id, IP address and state for each active instance in each region
     """
     table_header = [
         "ID", "Instance Name", "Instance ID", "IP address", "Status",
         "Key Name", "Avail. Zone"
     ]
     table_body = self._list_global_instances()
     SimpleTUI.print_table(table_header, table_body)
     if len(self.global_instances) == 0:
         SimpleTUI.info("There are no running or pending instances")
     return len(self.global_instances)
Ejemplo n.º 3
0
 def print_global_floating_ips(self):
     """
     Print ip and other useful information of all floating ip available in each region
     """
     table_header = [
         "ID", "Public Ip", "Floating IP ID", "Associated Instance",
         "Region"
     ]
     table_body = self._list_global_floating_ips()
     SimpleTUI.print_table(table_header, table_body)
     if len(self.global_floating_ips) == 0:
         SimpleTUI.info("There are no floating IPs available")
     return len(self.global_floating_ips)
Ejemplo n.º 4
0
    def print_all_nics(self):
        """
        Print instance id, image id, IP address and state for each active instance
        ! NOTE: before using this method, please set an instance using self.instance = <instance> !

        Returns:
            int: the number of items printed
        """
        table_header = ["ID", "NIC Name"]
        table_body = self._list_all_nics()
        SimpleTUI.print_table(table_header, table_body)
        if len(self.instances) == 0:
            SimpleTUI.info("There are no NICs available for this instance")
        return len(self.instances)