- sliver_elem = xml.add_instance('sliver_type', sliver, ['type', 'client_id'])
- PGv2SliverType.add_sliver_attributes(sliver_elem, sliver.get('pl_tags', []))
+ sliver_elem = xml.add_element('sliver_type')
+ if sliver.get('type'):
+ sliver_elem.set('name', sliver['type'])
+ attrs = ['client_id', 'cpus', 'memory', 'storage']
+ for attr in attrs:
+ if sliver.get(attr):
+ sliver_elem.set(attr, sliver[attr])
+
+ images = sliver.get('disk_image')
+ if images and isinstance(images, list):
+ PGv2DiskImage.add_images(sliver_elem, images)
+ fw_rules = sliver.get('fw_rules')
+ if fw_rules and isinstance(fw_rules, list):
+ PLOSv1FWRule.add_rules(sliver_elem, fw_rules)
+ PGv2SliverType.add_sliver_attributes(sliver_elem, sliver.get('tags', []))