[nova-fake-virt]Restore compute restartability
Since the stable-compute-uuid nova feature the compute nodes created via VIRT_DRIVER=fake cannot be restarted as these computes are not writing the compute_id file to disk at first startup. Therefore any subsequent restart will fail as nova-compute will refuse to start due to the missing compute_id file but having a service already in the DB. After this patch fake-virt uses a variant of the fake virt driver that actually writes compute_id file to disk. To allow multiple fake computes running on the same machine each compute now has a separate state_path created so each can store a separate compute_id file. Signed-off-by: Balazs Gibizer <gibi@redhat.com> Change-Id: I813cab3c89554d1e319b2b3e5c3affd8ec5d887e
This commit is contained in:
9
lib/nova
9
lib/nova
@@ -1085,6 +1085,15 @@ function start_nova_compute {
|
||||
# gets its own configuration and own log file.
|
||||
local fake_conf="${NOVA_FAKE_CONF}-${i}"
|
||||
iniset $fake_conf DEFAULT host "${HOSTNAME}${i}"
|
||||
# Ensure that each fake compute has its own state path so that it
|
||||
# can have its own compute_id file
|
||||
local state_path
|
||||
state_path="$NOVA_STATE_PATH/${HOSTNAME}${i}"
|
||||
COMPUTE_ID=$(uuidgen)
|
||||
sudo mkdir -p "$state_path"
|
||||
iniset $fake_conf DEFAULT state_path "$state_path"
|
||||
# use the generated UUID as the stable compute node UUID
|
||||
echo "$COMPUTE_ID" | sudo tee "$state_path/compute_id"
|
||||
run_process "n-cpu-${i}" "$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CPU_CONF --config-file $fake_conf"
|
||||
done
|
||||
else
|
||||
|
||||
@@ -36,7 +36,7 @@ function cleanup_nova_hypervisor {
|
||||
|
||||
# configure_nova_hypervisor - Set config files, create data dirs, etc
|
||||
function configure_nova_hypervisor {
|
||||
iniset $NOVA_CONF DEFAULT compute_driver "fake.FakeDriver"
|
||||
iniset $NOVA_CONF DEFAULT compute_driver "fake.FakeDriverWithoutFakeNodes"
|
||||
# Disable arbitrary limits
|
||||
iniset $NOVA_CONF quota driver nova.quota.NoopQuotaDriver
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user