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)
+ instances = self.shell.nova_manager.servers.findall(name=project_name)
if len(instances) == 0:
raise SliverDoesNotExist("You have not allocated any slivers here")
# 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['plos_hostname'] = instance.hostname
+ res['plos_created_at'] = datetime_to_string(utcparse(instance.created))
+ res['plos_boot_state'] = instance.status
+ res['plos_sliver_type'] = self.shell.nova_manager.flavors.find(id=instance.flavor['id']).name
+ sliver_id = Xrn(slice_urn).get_sliver_id(instance.id)
res['geni_urn'] = sliver_id
- if instance.vm_state == 'running':
+ if instance.status.lower() == 'active':
res['boot_state'] = 'ready'
res['geni_status'] = 'ready'
else:
self._normalize()\r
return ':'.join( [Xrn.unescape(x) for x in self.authority] )\r
\r
- def get_sliver_id(self, slice_id, node_id, index=0, authority=None):\r
+ def get_sliver_id(self, slice_id, node_id=None, index=0, authority=None):\r
self._normalize()\r
urn = self.get_urn()\r
if authority:\r
else:\r
hrn = ".".join([authority_hrn, self.get_leaf()])\r
urn = Xrn(hrn, self.get_type()).get_urn()\r
- return ":".join(map(str, [urn, slice_id, node_id, index]))\r
+ parts = [part for part in [urn, slice_id, node_id, index] if part is not None]\r
+ return ":".join(map(str, [parts]))\r
\r
def urn_to_hrn(self):\r
"""\r