components/openstack/nova/files/solariszones/sysconfig.py
changeset 7799 e35d3ee6d1b8
parent 6882 9cc65d5f5376
equal deleted inserted replaced
7798:fd5b3d046269 7799:e35d3ee6d1b8
     1 # vim: tabstop=4 shiftwidth=4 softtabstop=4
     1 # vim: tabstop=4 shiftwidth=4 softtabstop=4
     2 
     2 
     3 # Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
     3 # Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
     4 #
     4 #
     5 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
     5 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
     6 #    not use this file except in compliance with the License. You may obtain
     6 #    not use this file except in compliance with the License. You may obtain
     7 #    a copy of the License at
     7 #    a copy of the License at
     8 #
     8 #
   223                      name="ignore_dhcp_hostname", value="true")
   223                      name="ignore_dhcp_hostname", value="true")
   224 
   224 
   225     return svcbundle
   225     return svcbundle
   226 
   226 
   227 
   227 
       
   228 def create_config_drive():
       
   229     """ return an etree object representing the configdrive options for
       
   230     cloudbase-init
       
   231     """
       
   232     svcbundle = etree.Element("service_bundle", type="profile",
       
   233                               name="cloudbase-init")
       
   234     service = etree.SubElement(svcbundle, "service", version="1",
       
   235                                type="service",
       
   236                                name="application/cloudbase-init")
       
   237     instance = etree.SubElement(service, "instance", name="default",
       
   238                                 enabled="true")
       
   239     pg = etree.SubElement(instance, "property_group", type="application",
       
   240                           name="config")
       
   241     etree.SubElement(pg, "propval", type="astring", name="config_drive_types",
       
   242                      value="iso")
       
   243 
       
   244     etree.SubElement(pg, "propval", type="boolean", name="config_drive",
       
   245                      value="true")
       
   246 
       
   247     etree.SubElement(pg, "propval", type="astring",
       
   248                      name="config_drive_locations", value="cdrom, hdd")
       
   249 
       
   250     v = "cloudbaseinit.metadata.services.configdrive.ConfigDriveService"
       
   251     etree.SubElement(pg, "propval", type="astring", name="metadata_services",
       
   252                      value=v)
       
   253 
       
   254     mntpg = etree.SubElement(instance, "property_group", type="application",
       
   255                              name="configdrive")
       
   256 
       
   257     etree.SubElement(mntpg, "propval", type="boolean", name="copydone",
       
   258                      value="false")
       
   259 
       
   260     return svcbundle
       
   261 
       
   262 
   228 def create_sc_profile(path, tree):
   263 def create_sc_profile(path, tree):
   229     """ create a file containing the proper XML headers and encoding for a
   264     """ create a file containing the proper XML headers and encoding for a
   230     given etree object
   265     given etree object
   231     """
   266     """
   232     encoding = locale.getpreferredencoding()
   267     encoding = locale.getpreferredencoding()