- def sliver_status (self, slice_urn, slice_hrn):
- # find out where this slice is currently running
- project_name = hrn_to_os_slicename(slice_hrn)
- project = self.shell.auth_manager.get_project(project_name)
- instances = self.shell.db.instance_get_all_by_project(project_name)
- if len(instances) == 0:
- raise SliverDoesNotExist("You have not allocated any slivers here")
-
- result = {}
- result['geni_urn'] = slice_urn
- result['plos_login'] = 'root'
- # do we need real dates here?
- result['plos_expires'] = None
- result['geni_expires'] = None
-
- resources = []
- for instance in instances:
- res = {}
- # instances are accessed by ip, not hostname. We need to report the ip
- # somewhere so users know where to ssh to.
- res['geni_expires'] = None
- res['plos_hostname'] = instance.hostname
- res['plos_created_at'] = datetime_to_string(utcparse(instance.created_at))
- res['plos_boot_state'] = instance.vm_state
- res['plos_sliver_type'] = instance.instance_type.name
- sliver_id = Xrn(slice_urn).get_sliver_id(instance.project_id, \
- instance.hostname, instance.id)
- res['geni_urn'] = sliver_id
-
- if instance.vm_state == 'running':
- res['boot_state'] = 'ready'
- res['geni_status'] = 'ready'
- else:
- res['boot_state'] = 'unknown'
- res['geni_status'] = 'unknown'
- res['geni_allocation_status'] = 'geni_provisioned'
- resources.append(res)
-
- result['geni_resources'] = resources
- return result