コード例 #1
0
    def test_create_instance(self, mock_console_allocate, mock_put):
        db.create_instance('uuid42', 'barry', 1, 2048, 'disks', 'sshkey',
                           'userdata', 'namespace', {
                               'memory': 16384,
                               'model': 'cirrus'
                           }, None)

        etcd_write = mock_put.mock_calls[0][1]
        del etcd_write[3]['node']
        del etcd_write[3]['state_updated']

        self.assertEqual(('instance', None, 'uuid42', {
            'uuid': 'uuid42',
            'name': 'barry',
            'cpus': 1,
            'memory': 2048,
            'disk_spec': 'disks',
            'ssh_key': 'sshkey',
            'console_port': 1,
            'vdi_port': 2,
            'user_data': 'userdata',
            'block_devices': None,
            'state': 'initial',
            'namespace': 'namespace',
            'power_state': 'initial',
            'video': {
                'memory': 16384,
                'model': 'cirrus'
            },
            'node_history': [],
            'error_message': None,
            'requested_placement': None,
            'placement_attempts': 0,
        }), etcd_write)
コード例 #2
0
def from_definition(uuid=None,
                    name=None,
                    disks=None,
                    memory_mb=None,
                    vcpus=None,
                    ssh_key=None,
                    user_data=None):
    db_entry = db.create_instance(uuid, name, vcpus, memory_mb,
                                  json.dumps(disks), ssh_key, user_data)
    return Instance(db_entry)
コード例 #3
0
ファイル: virt.py プロジェクト: mcarden/shakenfist
def from_definition(uuid=None,
                    name=None,
                    disks=None,
                    memory_mb=None,
                    vcpus=None,
                    ssh_key=None,
                    user_data=None,
                    owner=None):
    db_entry = db.create_instance(uuid, name, vcpus, memory_mb, disks, ssh_key,
                                  user_data, owner)
    return Instance(db_entry)