Add import command #20

Merged
merged 13 commits into from Aug 31, 2017

Conversation

Projects
None yet
2 participants
Member

babbageclunk commented Aug 30, 2017

This exports the 1.25 environment into the 2.2.3 description, updates the tools for machines and units in the exported model, then imports the model on the target controller. It also uploads tools and charms.

There will be a separate command to activate the imported model once the agents have been upgraded (and checked that they can connect to the model).

babbageclunk added some commits Aug 22, 2017

Add import command
It currently imports the model without any checking, and it doesn't yet
upload the tools and charms.
Pull export code out into its own file
It's shared between verify-source and import.
Move tools downloading code to toolsWrangler
So it can be reused from import.
Keep tools packed on the 'controller'
Unpack them on the unit hosts instead - this makes uploading simpler.
Add --keep-broken flag to allow investigating after an import
Adds baseClientCommand.extraOptions, which can be modified by embedding
structs to add extra options to the remote command.

LGTM overall, but the storage pool filtering looks fishy. Is that needed? Why?

commands/agent-upgrade.py
@@ -94,14 +96,29 @@ def save_rollback_info():
shutil.copy(agent_conf, backup_path)
def find_new_tools():
- dirs = [name for name in os.listdir(UPGRADE_DIR) if path.isdir(path.join(UPGRADE_DIR, name))]
+ dirs = [name for name in os.listdir(UPGRADE_DIR) if path.join(UPGRADE_DIR, name).endswith('.tgz')]
@axw

axw Aug 30, 2017

Member

s/dirs/files/ ?

@babbageclunk

babbageclunk Aug 30, 2017

Member

This is a holdover from the tools originally being pushed out unpacked and moved into place as directories - I'll change it.

+ reader, _, err := store.Get(ch.StoragePath())
+ if err != nil {
+ return errors.Trace(err)
+ }
@axw

axw Aug 30, 2017

Member

defer reader.Close() ?

@babbageclunk

babbageclunk Aug 30, 2017

Member

Yup, thanks!

juju1/state/migration_export.go
@@ -1640,6 +1655,10 @@ func (e *exporter) storagePools() error {
return errors.Annotate(err, "listing pools")
}
for _, cfg := range poolConfigs {
+ if e.model.Config()["type"].(string) != "ec2" && cfg.Name() == "ebs-ssd" {
@axw

axw Aug 30, 2017

Member

I don't understand why you would filter out ebs-ssd specifically. What's special about it?

@babbageclunk

babbageclunk Aug 30, 2017

Member

In 1.25 the settings are created when the ebs provider is registered, even though this is a MAAS environment. Trying to import it into the 2.2.3 target fails because the provider isn't registered in 2 anymore (there was a change at some point to stop the automatic creation of the settings). I'm not sure this is the right way to handle it, but I think we do need to filter it out somehow.

axw approved these changes Aug 31, 2017

@babbageclunk babbageclunk merged commit 6627123 into juju:master Aug 31, 2017

@babbageclunk babbageclunk deleted the babbageclunk:import branch Aug 31, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment