Support cloud-init's network-config.
This commit is contained in:
parent
eccc35d0bf
commit
413f8f76dc
4 changed files with 16 additions and 1 deletions
|
|
@ -34,9 +34,12 @@
|
||||||
# ...
|
# ...
|
||||||
# "userData":
|
# "userData":
|
||||||
# ...
|
# ...
|
||||||
|
# "networkConfig":
|
||||||
|
# ...
|
||||||
#
|
#
|
||||||
# If .metaData.instance-id is missing, an id is generated from the
|
# If .metaData.instance-id is missing, an id is generated from the
|
||||||
# config file's modification timestamp.
|
# config file's modification timestamp. .userData and .networkConfig
|
||||||
|
# are optional.
|
||||||
|
|
||||||
# Define the VM (required)
|
# Define the VM (required)
|
||||||
"vm":
|
"vm":
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,8 @@ public class Configuration implements Dto {
|
||||||
public Map<String, Object> metaData;
|
public Map<String, Object> metaData;
|
||||||
@SuppressWarnings("PMD.UseConcurrentHashMap")
|
@SuppressWarnings("PMD.UseConcurrentHashMap")
|
||||||
public Map<String, Object> userData;
|
public Map<String, Object> userData;
|
||||||
|
@SuppressWarnings("PMD.UseConcurrentHashMap")
|
||||||
|
public Map<String, Object> networkConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -503,6 +503,13 @@ public class Runner extends Component {
|
||||||
config.cloudInit.userData);
|
config.cloudInit.userData);
|
||||||
}
|
}
|
||||||
userOut.close();
|
userOut.close();
|
||||||
|
if (config.cloudInit.networkConfig != null) {
|
||||||
|
var networkConfig = Files.newBufferedWriter(
|
||||||
|
cloudInitDir.resolve("network-config"));
|
||||||
|
yamlMapper.writer().writeValue(networkConfig,
|
||||||
|
config.cloudInit.networkConfig);
|
||||||
|
networkConfig.close();
|
||||||
|
}
|
||||||
startProcess(cloudInitImgDefinition);
|
startProcess(cloudInitImgDefinition);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.log(Level.SEVERE, e,
|
logger.log(Level.SEVERE, e,
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,9 @@
|
||||||
mformat -C -f 1440 -v CIDATA -i ${ runtimeDir }/cloud-init.img
|
mformat -C -f 1440 -v CIDATA -i ${ runtimeDir }/cloud-init.img
|
||||||
&& mcopy -i ${ runtimeDir }/cloud-init.img
|
&& mcopy -i ${ runtimeDir }/cloud-init.img
|
||||||
${ dataDir }/cloud-init/meta-data ${ dataDir }/cloud-init/user-data ::
|
${ dataDir }/cloud-init/meta-data ${ dataDir }/cloud-init/user-data ::
|
||||||
|
&& if [ -r ${ dataDir }/cloud-init/network-config ]; then
|
||||||
|
mcopy -i ${ runtimeDir }/cloud-init.img
|
||||||
|
${ dataDir }/cloud-init/network-config :: ; fi
|
||||||
|
|
||||||
"qemu":
|
"qemu":
|
||||||
# Candidate paths for the executable
|
# Candidate paths for the executable
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue