示例#1
0
 def container_stop(self):
     template = self._load_template('tc_container_stop.template')
     search_list = {
         'prio': self.tc_id,
         'host_iface': CONF.ovz_tc_host_slave_device,
         'vz_iface': self.vz_iface,
         'bandwidth': self.bandwidth,
         'vz_address': self.address
     }
     ovz_utils.save_instance_metadata(self.instance['id'],
                                      'tc_id', self.tc_id)
     return self._fill_template(template, search_list).splitlines()
示例#2
0
 def container_start(self):
     template = self._load_template('tc_container_start.template')
     search_list = {
         'prio': self.tc_id,
         'host_iface': CONF.ovz_tc_host_slave_device,
         'vz_iface': self.vz_iface,
         'bandwidth': self.bandwidth,
         'vz_address': self.address,
         'line_speed': CONF.ovz_tc_max_line_speed
     }
     ovz_utils.save_instance_metadata(self.instance['id'],
                                      'tc_id', self.tc_id,
                                      fail_on_dupe_key=False)
     return self._fill_template(template, search_list).splitlines()
 def test_save_instance_metadata_success(self):
     self.mox.StubOutWithMock(ovz_utils.context, 'get_admin_context')
     ovz_utils.context.get_admin_context().AndReturn(fakes.ADMINCONTEXT)
     self.mox.StubOutWithMock(ovz_utils.conductor, 'instance_get')
     ovz_utils.conductor.instance_get(
         fakes.ADMINCONTEXT, fakes.INSTANCE['id']).AndReturn(fakes.INSTANCE)
     self.mox.StubOutWithMock(
         ovz_utils.conductor, 'instance_update')
     ovz_utils.conductor.instance_update(
         fakes.ADMINCONTEXT, fakes.INSTANCE['uuid'],
         system_metadata=ovz_utils.format_system_metadata(
             fakes.INSTANCE['system_metadata']))
     self.mox.ReplayAll()
     ovz_utils.save_instance_metadata(
         fakes.INSTANCE['id'], fakes.METAKEY, fakes.METAVALUE)
示例#4
0
 def _save_instance_tc_id(self):
     """
     Save the tc id in the instance metadata in the database
     """
     ovz_utils.save_instance_metadata(self.instance['id'], 'tc_id',
                                      self.tc_id, fail_on_dupe_key=False)